diff options
21 files changed, 276 insertions, 741 deletions
diff --git a/components/test_runner/test_plugin.cc b/components/test_runner/test_plugin.cc index 96798d78..c7db602 100644 --- a/components/test_runner/test_plugin.cc +++ b/components/test_runner/test_plugin.cc @@ -264,10 +264,10 @@ void TestPlugin::updateGeometry( DrawSceneGL(); gpu::Mailbox mailbox; - context_->genMailboxCHROMIUM(mailbox.name); - context_->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); + gl_->GenMailboxCHROMIUM(mailbox.name); + gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); const GLuint64 fence_sync = gl_->InsertFenceSyncCHROMIUM(); - context_->flush(); + gl_->Flush(); gpu::SyncToken sync_token; context_->genSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); @@ -463,9 +463,8 @@ bool TestPlugin::InitProgram() { if (!scene_.program) return false; - scene_.color_location = context_->getUniformLocation(scene_.program, "color"); - scene_.position_location = - context_->getAttribLocation(scene_.program, "position"); + scene_.color_location = gl_->GetUniformLocation(scene_.program, "color"); + scene_.position_location = gl_->GetAttribLocation(scene_.program, "position"); return true; } @@ -512,7 +511,7 @@ unsigned TestPlugin::LoadShader(unsigned type, const std::string& source) { gl_->CompileShader(shader); int compiled = 0; - context_->getShaderiv(shader, GL_COMPILE_STATUS, &compiled); + gl_->GetShaderiv(shader, GL_COMPILE_STATUS, &compiled); if (!compiled) { context_->deleteShader(shader); shader = 0; @@ -529,10 +528,10 @@ unsigned TestPlugin::LoadProgram(const std::string& vertex_source, if (vertex_shader && fragment_shader && program) { gl_->AttachShader(program, vertex_shader); gl_->AttachShader(program, fragment_shader); - context_->linkProgram(program); + gl_->LinkProgram(program); int linked = 0; - context_->getProgramiv(program, GL_LINK_STATUS, &linked); + gl_->GetProgramiv(program, GL_LINK_STATUS, &linked); if (!linked) { context_->deleteProgram(program); program = 0; diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc index f28ee85..3ce2c1e 100644 --- a/content/renderer/media/android/webmediaplayer_android.cc +++ b/content/renderer/media/android/webmediaplayer_android.cc @@ -739,7 +739,7 @@ bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( premultiply_alpha, false); gl->DeleteTextures(1, &src_texture); - web_graphics_context->flush(); + gl->Flush(); SyncTokenClientImpl client(gl); video_frame->UpdateReleaseSyncToken(&client); diff --git a/gpu/blink/webgraphicscontext3d_impl.cc b/gpu/blink/webgraphicscontext3d_impl.cc index 5d087a2..89716ec 100644 --- a/gpu/blink/webgraphicscontext3d_impl.cc +++ b/gpu/blink/webgraphicscontext3d_impl.cc @@ -230,13 +230,6 @@ void WebGraphicsContext3DImpl::drawElements(WGC3Denum mode, reinterpret_cast<void*>(static_cast<intptr_t>(offset))); } -DELEGATE_TO_GL(finish, Finish) -DELEGATE_TO_GL(flush, Flush) - -DELEGATE_TO_GL_1(frontFace, FrontFace, WGC3Denum) - -DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, WGC3Denum) - bool WebGraphicsContext3DImpl::getActiveAttrib( WebGLId program, WGC3Duint index, ActiveInfo& info) { if (!program) { @@ -295,17 +288,6 @@ bool WebGraphicsContext3DImpl::getActiveUniform( return true; } -DELEGATE_TO_GL_4(getAttachedShaders, GetAttachedShaders, - WebGLId, WGC3Dsizei, WGC3Dsizei*, WebGLId*) - -DELEGATE_TO_GL_2R(getAttribLocation, GetAttribLocation, - WebGLId, const WGC3Dchar*, WGC3Dint) - -DELEGATE_TO_GL_2(getBooleanv, GetBooleanv, WGC3Denum, WGC3Dboolean*) - -DELEGATE_TO_GL_3(getBufferParameteriv, GetBufferParameteriv, - WGC3Denum, WGC3Denum, WGC3Dint*) - WGC3Denum WebGraphicsContext3DImpl::getError() { if (!synthetic_errors_.empty()) { std::vector<WGC3Denum>::iterator iter = synthetic_errors_.begin(); @@ -317,23 +299,6 @@ WGC3Denum WebGraphicsContext3DImpl::getError() { return gl_->GetError(); } -DELEGATE_TO_GL_2(getFloatv, GetFloatv, WGC3Denum, WGC3Dfloat*) - -DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv, - GetFramebufferAttachmentParameteriv, - WGC3Denum, WGC3Denum, WGC3Denum, WGC3Dint*) - -DELEGATE_TO_GL_2(getIntegerv, GetIntegerv, WGC3Denum, WGC3Dint*) - -DELEGATE_TO_GL_2(getInteger64v, GetInteger64v, WGC3Denum, WGC3Dint64*) - -DELEGATE_TO_GL_3(getIntegeri_v, GetIntegeri_v, WGC3Denum, WGC3Duint, WGC3Dint*) - -DELEGATE_TO_GL_3(getInteger64i_v, GetInteger64i_v, - WGC3Denum, WGC3Duint, WGC3Dint64*) - -DELEGATE_TO_GL_3(getProgramiv, GetProgramiv, WebGLId, WGC3Denum, WGC3Dint*) - blink::WebString WebGraphicsContext3DImpl::getProgramInfoLog( WebGLId program) { GLint logLength = 0; @@ -352,11 +317,6 @@ blink::WebString WebGraphicsContext3DImpl::getProgramInfoLog( return res; } -DELEGATE_TO_GL_3(getRenderbufferParameteriv, GetRenderbufferParameteriv, - WGC3Denum, WGC3Denum, WGC3Dint*) - -DELEGATE_TO_GL_3(getShaderiv, GetShaderiv, WebGLId, WGC3Denum, WGC3Dint*) - blink::WebString WebGraphicsContext3DImpl::getShaderInfoLog( WebGLId shader) { GLint logLength = 0; @@ -375,9 +335,6 @@ blink::WebString WebGraphicsContext3DImpl::getShaderInfoLog( return res; } -DELEGATE_TO_GL_4(getShaderPrecisionFormat, GetShaderPrecisionFormat, - WGC3Denum, WGC3Denum, WGC3Dint*, WGC3Dint*) - blink::WebString WebGraphicsContext3DImpl::getShaderSource( WebGLId shader) { GLint logLength = 0; @@ -434,25 +391,6 @@ void WebGraphicsContext3DImpl::getSynciv(blink::WGC3Dsync sync, reinterpret_cast<GLsync>(sync), pname, bufSize, length, params); } -DELEGATE_TO_GL_3(getTexParameterfv, GetTexParameterfv, - WGC3Denum, WGC3Denum, WGC3Dfloat*) - -DELEGATE_TO_GL_3(getTexParameteriv, GetTexParameteriv, - WGC3Denum, WGC3Denum, WGC3Dint*) - -DELEGATE_TO_GL_3(getUniformfv, GetUniformfv, WebGLId, WGC3Dint, WGC3Dfloat*) - -DELEGATE_TO_GL_3(getUniformiv, GetUniformiv, WebGLId, WGC3Dint, WGC3Dint*) - -DELEGATE_TO_GL_2R(getUniformLocation, GetUniformLocation, - WebGLId, const WGC3Dchar*, WGC3Dint) - -DELEGATE_TO_GL_3(getVertexAttribfv, GetVertexAttribfv, - WGC3Duint, WGC3Denum, WGC3Dfloat*) - -DELEGATE_TO_GL_3(getVertexAttribiv, GetVertexAttribiv, - WGC3Duint, WGC3Denum, WGC3Dint*) - WGC3Dsizeiptr WebGraphicsContext3DImpl::getVertexAttribOffset( WGC3Duint index, WGC3Denum pname) { GLvoid* value = NULL; @@ -462,63 +400,12 @@ WGC3Dsizeiptr WebGraphicsContext3DImpl::getVertexAttribOffset( return static_cast<WGC3Dsizeiptr>(reinterpret_cast<intptr_t>(value)); } -DELEGATE_TO_GL_2(hint, Hint, WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_1RB(isBuffer, IsBuffer, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isEnabled, IsEnabled, WGC3Denum, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isFramebuffer, IsFramebuffer, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isProgram, IsProgram, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isRenderbuffer, IsRenderbuffer, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isShader, IsShader, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1RB(isTexture, IsTexture, WebGLId, WGC3Dboolean) - -DELEGATE_TO_GL_1(lineWidth, LineWidth, WGC3Dfloat) - -DELEGATE_TO_GL_1(linkProgram, LinkProgram, WebGLId) - -DELEGATE_TO_GL_2(pixelStorei, PixelStorei, WGC3Denum, WGC3Dint) - -DELEGATE_TO_GL_2(polygonOffset, PolygonOffset, WGC3Dfloat, WGC3Dfloat) - -DELEGATE_TO_GL_7(readPixels, ReadPixels, - WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, WGC3Denum, - WGC3Denum, void*) - -DELEGATE_TO_GL_4(renderbufferStorage, RenderbufferStorage, - WGC3Denum, WGC3Denum, WGC3Dsizei, WGC3Dsizei) - -DELEGATE_TO_GL_2(sampleCoverage, SampleCoverage, WGC3Dfloat, WGC3Dboolean) - -DELEGATE_TO_GL_4(scissor, Scissor, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei) - void WebGraphicsContext3DImpl::shaderSource( WebGLId shader, const WGC3Dchar* string) { GLint length = strlen(string); gl_->ShaderSource(shader, 1, &string, &length); } -DELEGATE_TO_GL_3(stencilFunc, StencilFunc, WGC3Denum, WGC3Dint, WGC3Duint) - -DELEGATE_TO_GL_4(stencilFuncSeparate, StencilFuncSeparate, - WGC3Denum, WGC3Denum, WGC3Dint, WGC3Duint) - -DELEGATE_TO_GL_1(stencilMask, StencilMask, WGC3Duint) - -DELEGATE_TO_GL_2(stencilMaskSeparate, StencilMaskSeparate, - WGC3Denum, WGC3Duint) - -DELEGATE_TO_GL_3(stencilOp, StencilOp, - WGC3Denum, WGC3Denum, WGC3Denum) - -DELEGATE_TO_GL_4(stencilOpSeparate, StencilOpSeparate, - WGC3Denum, WGC3Denum, WGC3Denum, WGC3Denum) - DELEGATE_TO_GL_9(texImage2D, TexImage2D, WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dsizei, WGC3Dsizei, WGC3Dint, WGC3Denum, WGC3Denum, const void*) @@ -693,58 +580,6 @@ void WebGraphicsContext3DImpl::deleteQueryEXT( gl_->DeleteQueriesEXT(1, &query); } -DELEGATE_TO_GL_1R(isQueryEXT, IsQueryEXT, WebGLId, WGC3Dboolean) -DELEGATE_TO_GL_2(beginQueryEXT, BeginQueryEXT, WGC3Denum, WebGLId) -DELEGATE_TO_GL_1(endQueryEXT, EndQueryEXT, WGC3Denum) -DELEGATE_TO_GL_3(getQueryivEXT, GetQueryivEXT, WGC3Denum, WGC3Denum, WGC3Dint*) -DELEGATE_TO_GL_3(getQueryObjectuivEXT, GetQueryObjectuivEXT, - WebGLId, WGC3Denum, WGC3Duint*) - -DELEGATE_TO_GL_2(queryCounterEXT, QueryCounterEXT, WebGLId, WGC3Denum) -DELEGATE_TO_GL_3(getQueryObjectui64vEXT, - GetQueryObjectui64vEXT, - WebGLId, - WGC3Denum, - WGC3Duint64*) - -DELEGATE_TO_GL_7(copyTextureCHROMIUM, - CopyTextureCHROMIUM, - WebGLId, - WebGLId, - WGC3Denum, - WGC3Denum, - WGC3Dboolean, - WGC3Dboolean, - WGC3Dboolean); - -DELEGATE_TO_GL_11(copySubTextureCHROMIUM, - CopySubTextureCHROMIUM, - WebGLId, - WebGLId, - WGC3Dint, - WGC3Dint, - WGC3Dint, - WGC3Dint, - WGC3Dsizei, - WGC3Dsizei, - WGC3Dboolean, - WGC3Dboolean, - WGC3Dboolean); - -DELEGATE_TO_GL_1(genMailboxCHROMIUM, GenMailboxCHROMIUM, WGC3Dbyte*) -DELEGATE_TO_GL_2(produceTextureCHROMIUM, ProduceTextureCHROMIUM, - WGC3Denum, const WGC3Dbyte*) -DELEGATE_TO_GL_3(produceTextureDirectCHROMIUM, ProduceTextureDirectCHROMIUM, - WebGLId, WGC3Denum, const WGC3Dbyte*) -DELEGATE_TO_GL_2R(createAndConsumeTextureCHROMIUM, - CreateAndConsumeTextureCHROMIUM, - WGC3Denum, const WGC3Dbyte*, WebGLId) - -DELEGATE_TO_GL_2(genValuebuffersCHROMIUM, - GenValuebuffersCHROMIUM, - WGC3Dsizei, - WebGLId*); - WebGLId WebGraphicsContext3DImpl::createValuebufferCHROMIUM() { GLuint o; gl_->GenValuebuffersCHROMIUM(1, &o); @@ -760,10 +595,6 @@ void WebGraphicsContext3DImpl::deleteValuebufferCHROMIUM(WebGLId valuebuffer) { gl_->DeleteValuebuffersCHROMIUM(1, &valuebuffer); } -DELEGATE_TO_GL_1RB(isValuebufferCHROMIUM, - IsValuebufferCHROMIUM, - WebGLId, - WGC3Dboolean) DELEGATE_TO_GL_2(bindValuebufferCHROMIUM, BindValuebufferCHROMIUM, WGC3Denum, diff --git a/gpu/blink/webgraphicscontext3d_impl.h b/gpu/blink/webgraphicscontext3d_impl.h index cd423bc..acce68c 100644 --- a/gpu/blink/webgraphicscontext3d_impl.h +++ b/gpu/blink/webgraphicscontext3d_impl.h @@ -45,11 +45,6 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Denum type, blink::WGC3Dintptr offset) override; - void finish() override; - void flush() override; - void frontFace(blink::WGC3Denum mode) override; - void generateMipmap(blink::WGC3Denum target) override; - bool getActiveAttrib(blink::WebGLId program, blink::WGC3Duint index, ActiveInfo&) override; @@ -57,62 +52,9 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Duint index, ActiveInfo&) override; - void getAttachedShaders(blink::WebGLId program, - blink::WGC3Dsizei maxCount, - blink::WGC3Dsizei* count, - blink::WebGLId* shaders) override; - - blink::WGC3Dint getAttribLocation(blink::WebGLId program, - const blink::WGC3Dchar* name) override; - - void getBooleanv(blink::WGC3Denum pname, blink::WGC3Dboolean* value) override; - - void getBufferParameteriv(blink::WGC3Denum target, - blink::WGC3Denum pname, - blink::WGC3Dint* value) override; - blink::WGC3Denum getError() override; - - void getFloatv(blink::WGC3Denum pname, blink::WGC3Dfloat* value) override; - - void getFramebufferAttachmentParameteriv(blink::WGC3Denum target, - blink::WGC3Denum attachment, - blink::WGC3Denum pname, - blink::WGC3Dint* value) override; - - void getIntegerv(blink::WGC3Denum pname, blink::WGC3Dint* value) override; - - void getInteger64v(blink::WGC3Denum pname, blink::WGC3Dint64* value) override; - - void getIntegeri_v(blink::WGC3Denum target, - blink::WGC3Duint index, - blink::WGC3Dint *data) override; - - void getInteger64i_v(blink::WGC3Denum pname, - blink::WGC3Duint index, - blink::WGC3Dint64* value) override; - - void getProgramiv(blink::WebGLId program, - blink::WGC3Denum pname, - blink::WGC3Dint* value) override; - blink::WebString getProgramInfoLog(blink::WebGLId program) override; - - void getRenderbufferParameteriv(blink::WGC3Denum target, - blink::WGC3Denum pname, - blink::WGC3Dint* value) override; - - void getShaderiv(blink::WebGLId shader, - blink::WGC3Denum pname, - blink::WGC3Dint* value) override; - blink::WebString getShaderInfoLog(blink::WebGLId shader) override; - - void getShaderPrecisionFormat(blink::WGC3Denum shadertype, - blink::WGC3Denum precisiontype, - blink::WGC3Dint* range, - blink::WGC3Dint* precision) override; - blink::WebString getShaderSource(blink::WebGLId shader) override; blink::WebString getString(blink::WGC3Denum name) override; @@ -122,84 +64,11 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WGC3Dsizei *length, blink::WGC3Dint *params) override; - void getTexParameterfv(blink::WGC3Denum target, - blink::WGC3Denum pname, - blink::WGC3Dfloat* value) override; - void getTexParameteriv(blink::WGC3Denum target, - blink::WGC3Denum pname, - blink::WGC3Dint* value) override; - - void getUniformfv(blink::WebGLId program, - blink::WGC3Dint location, - blink::WGC3Dfloat* value) override; - void getUniformiv(blink::WebGLId program, - blink::WGC3Dint location, - blink::WGC3Dint* value) override; - - blink::WGC3Dint getUniformLocation(blink::WebGLId program, - const blink::WGC3Dchar* name) override; - - void getVertexAttribfv(blink::WGC3Duint index, - blink::WGC3Denum pname, - blink::WGC3Dfloat* value) override; - void getVertexAttribiv(blink::WGC3Duint index, - blink::WGC3Denum pname, - blink::WGC3Dint* value) override; - blink::WGC3Dsizeiptr getVertexAttribOffset(blink::WGC3Duint index, blink::WGC3Denum pname) override; - void hint(blink::WGC3Denum target, blink::WGC3Denum mode) override; - blink::WGC3Dboolean isBuffer(blink::WebGLId buffer) override; - blink::WGC3Dboolean isEnabled(blink::WGC3Denum cap) override; - blink::WGC3Dboolean isFramebuffer(blink::WebGLId framebuffer) override; - blink::WGC3Dboolean isProgram(blink::WebGLId program) override; - blink::WGC3Dboolean isRenderbuffer(blink::WebGLId renderbuffer) override; - blink::WGC3Dboolean isShader(blink::WebGLId shader) override; - blink::WGC3Dboolean isTexture(blink::WebGLId texture) override; - void lineWidth(blink::WGC3Dfloat) override; - void linkProgram(blink::WebGLId program) override; - void pixelStorei(blink::WGC3Denum pname, blink::WGC3Dint param) override; - void polygonOffset(blink::WGC3Dfloat factor, - blink::WGC3Dfloat units) override; - - void readPixels(blink::WGC3Dint x, - blink::WGC3Dint y, - blink::WGC3Dsizei width, - blink::WGC3Dsizei height, - blink::WGC3Denum format, - blink::WGC3Denum type, - void* pixels) override; - - void renderbufferStorage(blink::WGC3Denum target, - blink::WGC3Denum internalformat, - blink::WGC3Dsizei width, - blink::WGC3Dsizei height) override; - void sampleCoverage(blink::WGC3Dfloat value, - blink::WGC3Dboolean invert) override; - void scissor(blink::WGC3Dint x, - blink::WGC3Dint y, - blink::WGC3Dsizei width, - blink::WGC3Dsizei height) override; void shaderSource(blink::WebGLId shader, const blink::WGC3Dchar* string) override; - void stencilFunc(blink::WGC3Denum func, - blink::WGC3Dint ref, - blink::WGC3Duint mask) override; - void stencilFuncSeparate(blink::WGC3Denum face, - blink::WGC3Denum func, - blink::WGC3Dint ref, - blink::WGC3Duint mask) override; - void stencilMask(blink::WGC3Duint mask) override; - void stencilMaskSeparate(blink::WGC3Denum face, - blink::WGC3Duint mask) override; - void stencilOp(blink::WGC3Denum fail, - blink::WGC3Denum zfail, - blink::WGC3Denum zpass) override; - void stencilOpSeparate(blink::WGC3Denum face, - blink::WGC3Denum fail, - blink::WGC3Denum zfail, - blink::WGC3Denum zpass) override; void texImage2D(blink::WGC3Denum target, blink::WGC3Dint level, @@ -374,63 +243,13 @@ class GPU_BLINK_EXPORT WebGraphicsContext3DImpl blink::WebGLId createQueryEXT() override; void deleteQueryEXT(blink::WebGLId query) override; - blink::WGC3Dboolean isQueryEXT(blink::WGC3Duint query) override; - void beginQueryEXT(blink::WGC3Denum target, blink::WebGLId query) override; - void endQueryEXT(blink::WGC3Denum target) override; - void getQueryivEXT(blink::WGC3Denum target, - blink::WGC3Denum pname, - blink::WGC3Dint* params) override; - void getQueryObjectuivEXT(blink::WebGLId query, - blink::WGC3Denum pname, - blink::WGC3Duint* params) override; - - void queryCounterEXT(blink::WebGLId query, blink::WGC3Denum target) override; - void getQueryObjectui64vEXT(blink::WebGLId query, - blink::WGC3Denum pname, - blink::WGC3Duint64* params) override; - - void copyTextureCHROMIUM( - blink::WebGLId source_id, - blink::WebGLId dest_id, - blink::WGC3Denum internal_format, - blink::WGC3Denum dest_type, - blink::WGC3Dboolean unpack_flip_y, - blink::WGC3Dboolean unpack_premultiply_alpha, - blink::WGC3Dboolean unpack_unmultiply_alpha) override; - - void copySubTextureCHROMIUM( - blink::WebGLId source_id, - blink::WebGLId dest_id, - blink::WGC3Dint xoffset, - blink::WGC3Dint yoffset, - blink::WGC3Dint x, - blink::WGC3Dint y, - blink::WGC3Dsizei width, - blink::WGC3Dsizei height, - blink::WGC3Dboolean unpack_flip_y, - blink::WGC3Dboolean unpack_premultiply_alpha, - blink::WGC3Dboolean unpack_unmultiply_alpha) override; - - void genMailboxCHROMIUM(blink::WGC3Dbyte* mailbox) override; - void produceTextureCHROMIUM(blink::WGC3Denum target, - const blink::WGC3Dbyte* mailbox) override; - void produceTextureDirectCHROMIUM(blink::WebGLId texture, - blink::WGC3Denum target, - const blink::WGC3Dbyte* mailbox) override; - blink::WebGLId createAndConsumeTextureCHROMIUM( - blink::WGC3Denum target, - const blink::WGC3Dbyte* mailbox) override; - void genValuebuffersCHROMIUM(blink::WGC3Dsizei count, - blink::WebGLId* ids) override; blink::WebGLId createValuebufferCHROMIUM() override; void deleteValuebuffersCHROMIUM(blink::WGC3Dsizei count, blink::WebGLId* ids) override; void deleteValuebufferCHROMIUM(blink::WebGLId) override; void bindValuebufferCHROMIUM(blink::WGC3Denum target, blink::WebGLId valuebuffer) override; - blink::WGC3Dboolean isValuebufferCHROMIUM( - blink::WebGLId renderbuffer) override; void subscribeValueCHROMIUM(blink::WGC3Denum target, blink::WGC3Denum subscription) override; void populateSubscribedValuesCHROMIUM(blink::WGC3Denum target) override; diff --git a/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp b/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp index 29f6521..f1f9d0f 100644 --- a/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp +++ b/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp @@ -5,6 +5,7 @@ #include "modules/webgl/EXTDisjointTimerQuery.h" #include "bindings/modules/v8/WebGLAny.h" +#include "gpu/command_buffer/client/gles2_interface.h" #include "modules/webgl/WebGLRenderingContextBase.h" #include "modules/webgl/WebGLTimerQueryEXT.h" @@ -64,7 +65,7 @@ GLboolean EXTDisjointTimerQuery::isQueryEXT(WebGLTimerQueryEXT* query) return false; } - return scoped.context()->webContext()->isQueryEXT(query->object()); + return scoped.context()->contextGL()->IsQueryEXT(query->object()); } void EXTDisjointTimerQuery::beginQueryEXT(GLenum target, WebGLTimerQueryEXT* query) @@ -93,7 +94,7 @@ void EXTDisjointTimerQuery::beginQueryEXT(GLenum target, WebGLTimerQueryEXT* que return; } - scoped.context()->webContext()->beginQueryEXT(target, query->object()); + scoped.context()->contextGL()->BeginQueryEXT(target, query->object()); query->setTarget(target); m_currentElapsedQuery = query; } @@ -114,7 +115,7 @@ void EXTDisjointTimerQuery::endQueryEXT(GLenum target) return; } - scoped.context()->webContext()->endQueryEXT(target); + scoped.context()->contextGL()->EndQueryEXT(target); m_currentElapsedQuery->resetCachedResult(); m_currentElapsedQuery.clear(); } @@ -140,7 +141,7 @@ void EXTDisjointTimerQuery::queryCounterEXT(WebGLTimerQueryEXT* query, GLenum ta return; } - scoped.context()->webContext()->queryCounterEXT(query->object(), target); + scoped.context()->contextGL()->QueryCounterEXT(query->object(), target); query->setTarget(target); query->resetCachedResult(); } @@ -159,7 +160,7 @@ ScriptValue EXTDisjointTimerQuery::getQueryEXT(ScriptState* scriptState, GLenum return ScriptValue::createNull(scriptState); case GL_QUERY_COUNTER_BITS_EXT: { GLint value = 0; - scoped.context()->webContext()->getQueryivEXT(target, pname, &value); + scoped.context()->contextGL()->GetQueryivEXT(target, pname, &value); return WebGLAny(scriptState, value); } default: @@ -184,11 +185,11 @@ ScriptValue EXTDisjointTimerQuery::getQueryObjectEXT(ScriptState* scriptState, W switch (pname) { case GL_QUERY_RESULT_EXT: { - query->updateCachedResult(scoped.context()->webContext()); + query->updateCachedResult(scoped.context()->contextGL()); return WebGLAny(scriptState, query->getQueryResult()); } case GL_QUERY_RESULT_AVAILABLE_EXT: { - query->updateCachedResult(scoped.context()->webContext()); + query->updateCachedResult(scoped.context()->contextGL()); return WebGLAny(scriptState, query->isQueryResultAvailable()); } default: diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp index 810ff9e..0c5b85d 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp @@ -153,17 +153,17 @@ void WebGL2RenderingContextBase::initializeNewContext() m_currentTransformFeedbackPrimitivesWrittenQuery = nullptr; GLint numCombinedTextureImageUnits = 0; - webContext()->getIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numCombinedTextureImageUnits); + contextGL()->GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numCombinedTextureImageUnits); m_samplerUnits.clear(); m_samplerUnits.resize(numCombinedTextureImageUnits); m_maxTransformFeedbackSeparateAttribs = 0; - webContext()->getIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &m_maxTransformFeedbackSeparateAttribs); + contextGL()->GetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &m_maxTransformFeedbackSeparateAttribs); m_boundIndexedTransformFeedbackBuffers.clear(); m_boundIndexedTransformFeedbackBuffers.resize(m_maxTransformFeedbackSeparateAttribs); GLint maxUniformBufferBindings = 0; - webContext()->getIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings); + contextGL()->GetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings); m_boundIndexedUniformBuffers.clear(); m_boundIndexedUniformBuffers.resize(maxUniformBufferBindings); m_maxBoundUniformBufferIndex = 0; @@ -592,7 +592,7 @@ void WebGL2RenderingContextBase::pixelStorei(GLenum pname, GLint param) WebGLRenderingContextBase::pixelStorei(pname, param); return; } - webContext()->pixelStorei(pname, param); + contextGL()->PixelStorei(pname, param); } void WebGL2RenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels) @@ -642,7 +642,7 @@ void WebGL2RenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLs { ScopedDrawingBufferBinder binder(drawingBuffer(), framebuffer); - webContext()->readPixels(x, y, width, height, format, type, reinterpret_cast<void*>(offset)); + contextGL()->ReadPixels(x, y, width, height, format, type, reinterpret_cast<void*>(offset)); } } @@ -691,7 +691,7 @@ void WebGL2RenderingContextBase::renderbufferStorageImpl( case GL_DEPTH32F_STENCIL8: case GL_STENCIL_INDEX8: if (!samples) { - webContext()->renderbufferStorage(target, internalformat, width, height); + contextGL()->RenderbufferStorage(target, internalformat, width, height); } else { GLint maxNumberOfSamples = 0; webContext()->getInternalformativ(target, internalformat, GL_SAMPLES, 1, &maxNumberOfSamples); @@ -709,7 +709,7 @@ void WebGL2RenderingContextBase::renderbufferStorageImpl( synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat"); return; } - webContext()->renderbufferStorage(target, GL_DEPTH24_STENCIL8, width, height); + contextGL()->RenderbufferStorage(target, GL_DEPTH24_STENCIL8, width, height); break; case GL_R16F: case GL_RG16F: @@ -726,7 +726,7 @@ void WebGL2RenderingContextBase::renderbufferStorageImpl( synthesizeGLError(GL_INVALID_VALUE, functionName, "multisampled float buffers not supported"); return; } - webContext()->renderbufferStorage(target, internalformat, width, height); + contextGL()->RenderbufferStorage(target, internalformat, width, height); break; default: synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid internalformat"); @@ -764,15 +764,15 @@ void WebGL2RenderingContextBase::resetUnpackParameters() WebGLRenderingContextBase::resetUnpackParameters(); if (!m_unpackRowLength) - webContext()->pixelStorei(GL_UNPACK_ROW_LENGTH, 0); + contextGL()->PixelStorei(GL_UNPACK_ROW_LENGTH, 0); if (!m_unpackImageHeight) - webContext()->pixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); + contextGL()->PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); if (!m_unpackSkipPixels) - webContext()->pixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + contextGL()->PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); if (!m_unpackSkipRows) - webContext()->pixelStorei(GL_UNPACK_SKIP_ROWS, 0); + contextGL()->PixelStorei(GL_UNPACK_SKIP_ROWS, 0); if (!m_unpackSkipImages) - webContext()->pixelStorei(GL_UNPACK_SKIP_IMAGES, 0); + contextGL()->PixelStorei(GL_UNPACK_SKIP_IMAGES, 0); } void WebGL2RenderingContextBase::restoreUnpackParameters() @@ -780,15 +780,15 @@ void WebGL2RenderingContextBase::restoreUnpackParameters() WebGLRenderingContextBase::restoreUnpackParameters(); if (!m_unpackRowLength) - webContext()->pixelStorei(GL_UNPACK_ROW_LENGTH, m_unpackRowLength); + contextGL()->PixelStorei(GL_UNPACK_ROW_LENGTH, m_unpackRowLength); if (!m_unpackImageHeight) - webContext()->pixelStorei(GL_UNPACK_IMAGE_HEIGHT, m_unpackImageHeight); + contextGL()->PixelStorei(GL_UNPACK_IMAGE_HEIGHT, m_unpackImageHeight); if (!m_unpackSkipPixels) - webContext()->pixelStorei(GL_UNPACK_SKIP_PIXELS, m_unpackSkipPixels); + contextGL()->PixelStorei(GL_UNPACK_SKIP_PIXELS, m_unpackSkipPixels); if (!m_unpackSkipRows) - webContext()->pixelStorei(GL_UNPACK_SKIP_ROWS, m_unpackSkipRows); + contextGL()->PixelStorei(GL_UNPACK_SKIP_ROWS, m_unpackSkipRows); if (!m_unpackSkipImages) - webContext()->pixelStorei(GL_UNPACK_SKIP_IMAGES, m_unpackSkipImages); + contextGL()->PixelStorei(GL_UNPACK_SKIP_IMAGES, m_unpackSkipImages); } /* Texture objects */ @@ -1706,12 +1706,12 @@ void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) return; if (m_currentBooleanOcclusionQuery == query) { - webContext()->endQueryEXT(m_currentBooleanOcclusionQuery->getTarget()); + contextGL()->EndQueryEXT(m_currentBooleanOcclusionQuery->getTarget()); m_currentBooleanOcclusionQuery = nullptr; } if (m_currentTransformFeedbackPrimitivesWrittenQuery == query) { - webContext()->endQueryEXT(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); + contextGL()->EndQueryEXT(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); m_currentTransformFeedbackPrimitivesWrittenQuery = nullptr; } @@ -1723,7 +1723,7 @@ GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) if (isContextLost() || !query) return 0; - return webContext()->isQueryEXT(query->object()); + return contextGL()->IsQueryEXT(query->object()); } void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) @@ -1774,7 +1774,7 @@ void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) if (!query->getTarget()) query->setTarget(target); - webContext()->beginQueryEXT(target, query->object()); + contextGL()->BeginQueryEXT(target, query->object()); } void WebGL2RenderingContextBase::endQuery(GLenum target) @@ -1811,7 +1811,7 @@ void WebGL2RenderingContextBase::endQuery(GLenum target) return; } - webContext()->endQueryEXT(target); + contextGL()->EndQueryEXT(target); } WebGLQuery* WebGL2RenderingContextBase::getQuery(GLenum target, GLenum pname) @@ -1866,12 +1866,12 @@ ScriptValue WebGL2RenderingContextBase::getQueryParameter(ScriptState* scriptSta switch (pname) { case GL_QUERY_RESULT: { - query->updateCachedResult(webContext()); + query->updateCachedResult(contextGL()); return WebGLAny(scriptState, query->getQueryResult()); } case GL_QUERY_RESULT_AVAILABLE: { - query->updateCachedResult(webContext()); + query->updateCachedResult(contextGL()); return WebGLAny(scriptState, query->isQueryResultAvailable()); } default: @@ -2278,14 +2278,14 @@ WebGLActiveInfo* WebGL2RenderingContextBase::getTransformFeedbackVarying(WebGLPr return nullptr; } GLint maxIndex = 0; - webContext()->getProgramiv(objectOrZero(program), GL_TRANSFORM_FEEDBACK_VARYINGS, &maxIndex); + contextGL()->GetProgramiv(objectOrZero(program), GL_TRANSFORM_FEEDBACK_VARYINGS, &maxIndex); if (index >= static_cast<GLuint>(maxIndex)) { synthesizeGLError(GL_INVALID_VALUE, "getTransformFeedbackVarying", "invalid index"); return nullptr; } GLint maxNameLength = -1; - webContext()->getProgramiv(objectOrZero(program), GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &maxNameLength); + contextGL()->GetProgramiv(objectOrZero(program), GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &maxNameLength); if (maxNameLength <= 0) { return nullptr; } @@ -2447,7 +2447,7 @@ ScriptValue WebGL2RenderingContextBase::getIndexedParameter(ScriptState* scriptS case GL_UNIFORM_BUFFER_START: { GLint64 value = -1; - webContext()->getInteger64i_v(target, index, &value); + contextGL()->GetInteger64i_v(target, index, &value); return WebGLAny(scriptState, value); } default: @@ -2509,7 +2509,7 @@ ScriptValue WebGL2RenderingContextBase::getActiveUniforms(ScriptState* scriptSta } GLint activeUniforms = -1; - webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORMS, &activeUniforms); + contextGL()->GetProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORMS, &activeUniforms); GLuint activeUniformsUnsigned = activeUniforms; size_t size = uniformIndices.size(); @@ -2572,7 +2572,7 @@ bool WebGL2RenderingContextBase::validateUniformBlockIndex(const char* functionN return false; } GLint activeUniformBlocks = 0; - webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCKS, &activeUniformBlocks); + contextGL()->GetProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCKS, &activeUniformBlocks); if (blockIndex >= static_cast<GLuint>(activeUniformBlocks)) { synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid uniform block index"); return false; @@ -2628,7 +2628,7 @@ String WebGL2RenderingContextBase::getActiveUniformBlockName(WebGLProgram* progr return String(); GLint maxNameLength = -1; - webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &maxNameLength); + contextGL()->GetProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &maxNameLength); if (maxNameLength <= 0) { // This state indicates that there are no active uniform blocks synthesizeGLError(GL_INVALID_VALUE, "getActiveUniformBlockName", "invalid uniform block index"); @@ -2899,7 +2899,7 @@ ScriptValue WebGL2RenderingContextBase::getInt64Parameter(ScriptState* scriptSta { GLint64 value = 0; if (!isContextLost()) - webContext()->getInteger64v(pname, &value); + contextGL()->GetInteger64v(pname, &value); return WebGLAny(scriptState, value); } @@ -3386,7 +3386,7 @@ ScriptValue WebGL2RenderingContextBase::getFramebufferAttachmentParameter(Script case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: { GLint value = 0; - webContext()->getFramebufferAttachmentParameteriv(target, attachment, pname, &value); + contextGL()->GetFramebufferAttachmentParameteriv(target, attachment, pname, &value); return WebGLAny(scriptState, value); } case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: @@ -3398,7 +3398,7 @@ ScriptValue WebGL2RenderingContextBase::getFramebufferAttachmentParameter(Script case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: { GLint value = 0; - webContext()->getFramebufferAttachmentParameteriv(target, attachment, pname, &value); + contextGL()->GetFramebufferAttachmentParameteriv(target, attachment, pname, &value); return WebGLAny(scriptState, static_cast<unsigned>(value)); } default: @@ -3468,27 +3468,27 @@ ScriptValue WebGL2RenderingContextBase::getTexParameter(ScriptState* scriptState case GL_TEXTURE_IMMUTABLE_LEVELS: { GLint value = 0; - webContext()->getTexParameteriv(target, pname, &value); + contextGL()->GetTexParameteriv(target, pname, &value); return WebGLAny(scriptState, static_cast<unsigned>(value)); } case GL_TEXTURE_IMMUTABLE_FORMAT: { GLint value = 0; - webContext()->getTexParameteriv(target, pname, &value); + contextGL()->GetTexParameteriv(target, pname, &value); return WebGLAny(scriptState, static_cast<bool>(value)); } case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: { GLint value = 0; - webContext()->getTexParameteriv(target, pname, &value); + contextGL()->GetTexParameteriv(target, pname, &value); return WebGLAny(scriptState, value); } case GL_TEXTURE_MAX_LOD: case GL_TEXTURE_MIN_LOD: { GLfloat value = 0.f; - webContext()->getTexParameterfv(target, pname, &value); + contextGL()->GetTexParameterfv(target, pname, &value); return WebGLAny(scriptState, value); } default: diff --git a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp index 9ef1517..7645e28 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp @@ -108,8 +108,8 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web // This is called after we make sure GL_EXT_draw_buffers is supported. GLint maxDrawBuffers = 0; GLint maxColorAttachments = 0; - context->getIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &maxDrawBuffers); - context->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &maxColorAttachments); + gl->GetIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &maxDrawBuffers); + gl->GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &maxColorAttachments); if (maxDrawBuffers < 4 || maxColorAttachments < 4) return false; diff --git a/third_party/WebKit/Source/modules/webgl/WebGLProgram.cpp b/third_party/WebKit/Source/modules/webgl/WebGLProgram.cpp index ac1648e..f4ea87d 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLProgram.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLProgram.cpp @@ -25,6 +25,7 @@ #include "modules/webgl/WebGLProgram.h" +#include "gpu/command_buffer/client/gles2_interface.h" #include "modules/webgl/WebGLContextGroup.h" #include "modules/webgl/WebGLRenderingContextBase.h" @@ -170,17 +171,17 @@ bool WebGLProgram::detachShader(WebGLShader* shader) } } -void WebGLProgram::cacheActiveAttribLocations(WebGraphicsContext3D* context3d) +void WebGLProgram::cacheActiveAttribLocations(WebGraphicsContext3D* context3d, gpu::gles2::GLES2Interface* gl) { m_activeAttribLocations.clear(); GLint numAttribs = 0; - context3d->getProgramiv(m_object, GL_ACTIVE_ATTRIBUTES, &numAttribs); + gl->GetProgramiv(m_object, GL_ACTIVE_ATTRIBUTES, &numAttribs); m_activeAttribLocations.resize(static_cast<size_t>(numAttribs)); for (int i = 0; i < numAttribs; ++i) { WebGraphicsContext3D::ActiveInfo info; context3d->getActiveAttrib(m_object, i, info); - m_activeAttribLocations[i] = context3d->getAttribLocation(m_object, info.name.utf8().data()); + m_activeAttribLocations[i] = gl->GetAttribLocation(m_object, info.name.utf8().data()); } } @@ -197,11 +198,12 @@ void WebGLProgram::cacheInfoIfNeeded() WebGraphicsContext3D* context = contextGroup()->getAWebGraphicsContext3D(); if (!context) return; + gpu::gles2::GLES2Interface* gl = context->getGLES2Interface(); GLint linkStatus = 0; - context->getProgramiv(m_object, GL_LINK_STATUS, &linkStatus); + gl->GetProgramiv(m_object, GL_LINK_STATUS, &linkStatus); m_linkStatus = linkStatus; if (m_linkStatus) - cacheActiveAttribLocations(context); + cacheActiveAttribLocations(context, gl); m_infoValid = true; } diff --git a/third_party/WebKit/Source/modules/webgl/WebGLProgram.h b/third_party/WebKit/Source/modules/webgl/WebGLProgram.h index 3a641ce..20060ab 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLProgram.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLProgram.h @@ -31,6 +31,12 @@ #include "wtf/PassRefPtr.h" #include "wtf/Vector.h" +namespace gpu { +namespace gles2 { +class GLES2Interface; +} +} + namespace blink { class WebGLProgram final : public WebGLSharedPlatform3DObject { @@ -73,7 +79,7 @@ protected: private: bool isProgram() const override { return true; } - void cacheActiveAttribLocations(WebGraphicsContext3D*); + void cacheActiveAttribLocations(WebGraphicsContext3D*, gpu::gles2::GLES2Interface*); void cacheInfoIfNeeded(); Vector<GLint> m_activeAttribLocations; diff --git a/third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp b/third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp index 910cca4..ec6be74 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp @@ -4,6 +4,7 @@ #include "modules/webgl/WebGLQuery.h" +#include "gpu/command_buffer/client/gles2_interface.h" #include "modules/webgl/WebGL2RenderingContextBase.h" #include "public/platform/Platform.h" @@ -57,7 +58,7 @@ void WebGLQuery::resetCachedResult() registerTaskObserver(); } -void WebGLQuery::updateCachedResult(WebGraphicsContext3D* ctx) +void WebGLQuery::updateCachedResult(gpu::gles2::GLES2Interface* gl) { if (m_queryResultAvailable) return; @@ -71,11 +72,11 @@ void WebGLQuery::updateCachedResult(WebGraphicsContext3D* ctx) // We can only update the cached result when control returns to the browser. m_canUpdateAvailability = false; GLuint available = 0; - ctx->getQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &available); + gl->GetQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &available); m_queryResultAvailable = !!available; if (m_queryResultAvailable) { GLuint result = 0; - ctx->getQueryObjectuivEXT(object(), GL_QUERY_RESULT_EXT, &result); + gl->GetQueryObjectuivEXT(object(), GL_QUERY_RESULT_EXT, &result); m_queryResult = result; unregisterTaskObserver(); } diff --git a/third_party/WebKit/Source/modules/webgl/WebGLQuery.h b/third_party/WebKit/Source/modules/webgl/WebGLQuery.h index 867cc49..86c511a 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLQuery.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLQuery.h @@ -7,6 +7,12 @@ #include "modules/webgl/WebGLSharedPlatform3DObject.h" +namespace gpu { +namespace gles2 { +class GLES2Interface; +} +} + namespace blink { class WebGL2RenderingContextBase; @@ -23,7 +29,7 @@ public: GLenum getTarget() const { return m_target; } void resetCachedResult(); - void updateCachedResult(WebGraphicsContext3D*); + void updateCachedResult(gpu::gles2::GLES2Interface*); bool isQueryResultAvailable(); GLuint getQueryResult(); diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index 2cca13e..5956818 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp @@ -866,12 +866,13 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa #endif { ASSERT(context); + gpu::gles2::GLES2Interface* gl = context->getGLES2Interface(); m_contextGroup = WebGLContextGroup::create(); m_contextGroup->addContext(this); m_maxViewportDims[0] = m_maxViewportDims[1] = 0; - context->getIntegerv(GL_MAX_VIEWPORT_DIMS, m_maxViewportDims); + gl->GetIntegerv(GL_MAX_VIEWPORT_DIMS, m_maxViewportDims); RefPtr<DrawingBuffer> buffer = createDrawingBuffer(context); if (!buffer) { @@ -941,30 +942,30 @@ void WebGLRenderingContextBase::initializeNewContext() m_colorMask[0] = m_colorMask[1] = m_colorMask[2] = m_colorMask[3] = true; GLint numCombinedTextureImageUnits = 0; - webContext()->getIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numCombinedTextureImageUnits); + contextGL()->GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numCombinedTextureImageUnits); m_textureUnits.clear(); m_textureUnits.resize(numCombinedTextureImageUnits); GLint numVertexAttribs = 0; - webContext()->getIntegerv(GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs); + contextGL()->GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs); m_maxVertexAttribs = numVertexAttribs; m_maxTextureSize = 0; - webContext()->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize); + contextGL()->GetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize); m_maxTextureLevel = WebGLTexture::computeLevelCount(m_maxTextureSize, m_maxTextureSize, 1); m_maxCubeMapTextureSize = 0; - webContext()->getIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &m_maxCubeMapTextureSize); + contextGL()->GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &m_maxCubeMapTextureSize); m_max3DTextureSize = 0; m_max3DTextureLevel = 0; m_maxArrayTextureLayers = 0; if (isWebGL2OrHigher()) { - webContext()->getIntegerv(GL_MAX_3D_TEXTURE_SIZE, &m_max3DTextureSize); + contextGL()->GetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &m_max3DTextureSize); m_max3DTextureLevel = WebGLTexture::computeLevelCount(m_max3DTextureSize, m_max3DTextureSize, m_max3DTextureSize); - webContext()->getIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &m_maxArrayTextureLayers); + contextGL()->GetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &m_maxArrayTextureLayers); } m_maxCubeMapTextureLevel = WebGLTexture::computeLevelCount(m_maxCubeMapTextureSize, m_maxCubeMapTextureSize, 1); m_maxRenderbufferSize = 0; - webContext()->getIntegerv(GL_MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize); + contextGL()->GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize); // These two values from EXT_draw_buffers are lazily queried. m_maxDrawBuffers = 0; @@ -987,7 +988,7 @@ void WebGLRenderingContextBase::initializeNewContext() m_vertexAttribType.resize(m_maxVertexAttribs); webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); - webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); + contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(this); m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::create(this); @@ -996,7 +997,7 @@ void WebGLRenderingContextBase::initializeNewContext() webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); // This ensures that the context has a valid "lastFlushID" and won't be mistakenly identified as the "least recently used" context. - webContext()->flush(); + contextGL()->Flush(); for (int i = 0; i < WebGLExtensionNameCount; ++i) m_extensionEnabled[i] = false; @@ -1185,7 +1186,7 @@ WebGLRenderingContextBase::HowToClear WebGLRenderingContextBase::clearIfComposit else contextGL()->ClearStencil(0); clearMask |= GL_STENCIL_BUFFER_BIT; - webContext()->stencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); + contextGL()->StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); } drawingBuffer()->clearFramebuffers(clearMask); @@ -1211,7 +1212,7 @@ void WebGLRenderingContextBase::restoreStateAfterClear() m_colorMask[2], m_colorMask[3]); contextGL()->ClearDepthf(m_clearDepth); contextGL()->ClearStencil(m_clearStencil); - webContext()->stencilMaskSeparate(GL_FRONT, m_stencilMask); + contextGL()->StencilMaskSeparate(GL_FRONT, m_stencilMask); contextGL()->DepthMask(m_depthMask); } @@ -2192,14 +2193,14 @@ void WebGLRenderingContextBase::finish() { if (isContextLost()) return; - webContext()->flush(); // Intentionally a flush, not a finish. + contextGL()->Flush(); // Intentionally a flush, not a finish. } void WebGLRenderingContextBase::flush() { if (isContextLost()) return; - webContext()->flush(); + contextGL()->Flush(); } void WebGLRenderingContextBase::framebufferRenderbuffer(ScriptState* scriptState, GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer* buffer) @@ -2278,7 +2279,7 @@ void WebGLRenderingContextBase::frontFace(GLenum mode) { if (isContextLost()) return; - webContext()->frontFace(mode); + contextGL()->FrontFace(mode); } void WebGLRenderingContextBase::generateMipmap(GLenum target) @@ -2287,7 +2288,7 @@ void WebGLRenderingContextBase::generateMipmap(GLenum target) return; if (!validateTextureBinding("generateMipmap", target)) return; - webContext()->generateMipmap(target); + contextGL()->GenerateMipmap(target); } WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* program, GLuint index) @@ -2342,7 +2343,7 @@ GLint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, const synthesizeGLError(GL_INVALID_OPERATION, "getAttribLocation", "program not linked"); return 0; } - return webContext()->getAttribLocation(objectOrZero(program), name.utf8().data()); + return contextGL()->GetAttribLocation(objectOrZero(program), name.utf8().data()); } bool WebGLRenderingContextBase::validateBufferTarget(const char* functionName, GLenum target) @@ -2366,13 +2367,13 @@ ScriptValue WebGLRenderingContextBase::getBufferParameter(ScriptState* scriptSta case GL_BUFFER_USAGE: { GLint value = 0; - webContext()->getBufferParameteriv(target, pname, &value); + contextGL()->GetBufferParameteriv(target, pname, &value); return WebGLAny(scriptState, static_cast<unsigned>(value)); } case GL_BUFFER_SIZE: { GLint value = 0; - webContext()->getBufferParameteriv(target, pname, &value); + contextGL()->GetBufferParameteriv(target, pname, &value); if (!isWebGL2OrHigher()) return WebGLAny(scriptState, value); return WebGLAny(scriptState, static_cast<GLint64>(value)); @@ -2504,13 +2505,13 @@ ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter(ScriptS case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: { GLint value = 0; - webContext()->getFramebufferAttachmentParameteriv(target, attachment, pname, &value); + contextGL()->GetFramebufferAttachmentParameteriv(target, attachment, pname, &value); return WebGLAny(scriptState, value); } case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: if (extensionEnabled(EXTsRGBName)) { GLint value = 0; - webContext()->getFramebufferAttachmentParameteriv(target, attachment, pname, &value); + contextGL()->GetFramebufferAttachmentParameteriv(target, attachment, pname, &value); return WebGLAny(scriptState, static_cast<unsigned>(value)); } synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name for renderbuffer attachment"); @@ -2528,7 +2529,7 @@ ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter(ScriptS case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: if (extensionEnabled(EXTsRGBName)) { GLint value = 0; - webContext()->getFramebufferAttachmentParameteriv(target, attachment, pname, &value); + contextGL()->GetFramebufferAttachmentParameteriv(target, attachment, pname, &value); return WebGLAny(scriptState, value); } synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name for renderbuffer attachment"); @@ -2802,7 +2803,7 @@ ScriptValue WebGLRenderingContextBase::getProgramParameter(ScriptState* scriptSt case GL_DELETE_STATUS: return WebGLAny(scriptState, program->isDeleted()); case GL_VALIDATE_STATUS: - webContext()->getProgramiv(objectOrZero(program), pname, &value); + contextGL()->GetProgramiv(objectOrZero(program), pname, &value); return WebGLAny(scriptState, static_cast<bool>(value)); case GL_LINK_STATUS: return WebGLAny(scriptState, program->linkStatus()); @@ -2815,11 +2816,11 @@ ScriptValue WebGLRenderingContextBase::getProgramParameter(ScriptState* scriptSt case GL_ATTACHED_SHADERS: case GL_ACTIVE_ATTRIBUTES: case GL_ACTIVE_UNIFORMS: - webContext()->getProgramiv(objectOrZero(program), pname, &value); + contextGL()->GetProgramiv(objectOrZero(program), pname, &value); return WebGLAny(scriptState, value); case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: if (isWebGL2OrHigher()) { - webContext()->getProgramiv(objectOrZero(program), pname, &value); + contextGL()->GetProgramiv(objectOrZero(program), pname, &value); return WebGLAny(scriptState, static_cast<unsigned>(value)); } default: @@ -2862,10 +2863,10 @@ ScriptValue WebGLRenderingContextBase::getRenderbufferParameter(ScriptState* scr case GL_RENDERBUFFER_BLUE_SIZE: case GL_RENDERBUFFER_ALPHA_SIZE: case GL_RENDERBUFFER_DEPTH_SIZE: - webContext()->getRenderbufferParameteriv(target, pname, &value); + contextGL()->GetRenderbufferParameteriv(target, pname, &value); return WebGLAny(scriptState, value); case GL_RENDERBUFFER_STENCIL_SIZE: - webContext()->getRenderbufferParameteriv(target, pname, &value); + contextGL()->GetRenderbufferParameteriv(target, pname, &value); return WebGLAny(scriptState, value); case GL_RENDERBUFFER_INTERNAL_FORMAT: return WebGLAny(scriptState, m_renderbufferBinding->internalFormat()); @@ -2884,10 +2885,10 @@ ScriptValue WebGLRenderingContextBase::getShaderParameter(ScriptState* scriptSta case GL_DELETE_STATUS: return WebGLAny(scriptState, shader->isDeleted()); case GL_COMPILE_STATUS: - webContext()->getShaderiv(objectOrZero(shader), pname, &value); + contextGL()->GetShaderiv(objectOrZero(shader), pname, &value); return WebGLAny(scriptState, static_cast<bool>(value)); case GL_SHADER_TYPE: - webContext()->getShaderiv(objectOrZero(shader), pname, &value); + contextGL()->GetShaderiv(objectOrZero(shader), pname, &value); return WebGLAny(scriptState, static_cast<unsigned>(value)); default: synthesizeGLError(GL_INVALID_ENUM, "getShaderParameter", "invalid parameter name"); @@ -2929,7 +2930,7 @@ WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat( GLint range[2] = {0, 0}; GLint precision = 0; - webContext()->getShaderPrecisionFormat(shaderType, precisionType, range, &precision); + contextGL()->GetShaderPrecisionFormat(shaderType, precisionType, range, &precision); return WebGLShaderPrecisionFormat::create(range[0], range[1], precision); } @@ -2974,13 +2975,13 @@ ScriptValue WebGLRenderingContextBase::getTexParameter(ScriptState* scriptState, case GL_TEXTURE_WRAP_T: { GLint value = 0; - webContext()->getTexParameteriv(target, pname, &value); + contextGL()->GetTexParameteriv(target, pname, &value); return WebGLAny(scriptState, static_cast<unsigned>(value)); } case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic if (extensionEnabled(EXTTextureFilterAnisotropicName)) { GLfloat value = 0.f; - webContext()->getTexParameterfv(target, pname, &value); + contextGL()->GetTexParameterfv(target, pname, &value); return WebGLAny(scriptState, value); } synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled"); @@ -3003,7 +3004,7 @@ ScriptValue WebGLRenderingContextBase::getUniform(ScriptState* scriptState, WebG // FIXME: make this more efficient using WebGLUniformLocation and caching types in it GLint activeUniforms = 0; - webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORMS, &activeUniforms); + contextGL()->GetProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORMS, &activeUniforms); for (GLint i = 0; i < activeUniforms; i++) { WebGraphicsContext3D::ActiveInfo info; if (!webContext()->getActiveUniform(objectOrZero(program), i, info)) @@ -3023,7 +3024,7 @@ ScriptValue WebGLRenderingContextBase::getUniform(ScriptState* scriptState, WebG nameBuilder.append(']'); } // Now need to look this up by name again to find its location - GLint loc = webContext()->getUniformLocation(objectOrZero(program), nameBuilder.toString().utf8().data()); + GLint loc = contextGL()->GetUniformLocation(objectOrZero(program), nameBuilder.toString().utf8().data()); if (loc == location) { // Found it. Use the type in the ActiveInfo to determine the return type. GLenum baseType; @@ -3156,28 +3157,28 @@ ScriptValue WebGLRenderingContextBase::getUniform(ScriptState* scriptState, WebG switch (baseType) { case GL_FLOAT: { GLfloat value[16] = {0}; - webContext()->getUniformfv(objectOrZero(program), location, value); + contextGL()->GetUniformfv(objectOrZero(program), location, value); if (length == 1) return WebGLAny(scriptState, value[0]); return WebGLAny(scriptState, DOMFloat32Array::create(value, length)); } case GL_INT: { GLint value[4] = {0}; - webContext()->getUniformiv(objectOrZero(program), location, value); + contextGL()->GetUniformiv(objectOrZero(program), location, value); if (length == 1) return WebGLAny(scriptState, value[0]); return WebGLAny(scriptState, DOMInt32Array::create(value, length)); } case GL_UNSIGNED_INT: { GLuint value[4] = {0}; - webContext()->getUniformuiv(objectOrZero(program), location, value); + contextGL()->GetUniformuiv(objectOrZero(program), location, value); if (length == 1) return WebGLAny(scriptState, value[0]); return WebGLAny(scriptState, DOMUint32Array::create(value, length)); } case GL_BOOL: { GLint value[4] = {0}; - webContext()->getUniformiv(objectOrZero(program), location, value); + contextGL()->GetUniformiv(objectOrZero(program), location, value); if (length > 1) { bool boolValue[16] = {0}; for (unsigned j = 0; j < length; j++) @@ -3211,7 +3212,7 @@ WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation(WebGLProgram synthesizeGLError(GL_INVALID_OPERATION, "getUniformLocation", "program not linked"); return nullptr; } - GLint uniformLocation = webContext()->getUniformLocation(objectOrZero(program), name.utf8().data()); + GLint uniformLocation = contextGL()->GetUniformLocation(objectOrZero(program), name.utf8().data()); if (uniformLocation == -1) return nullptr; return WebGLUniformLocation::create(program, uniformLocation); @@ -3230,7 +3231,7 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) { GLint value = 0; - webContext()->getVertexAttribiv(index, pname, &value); + contextGL()->GetVertexAttribiv(index, pname, &value); return WebGLAny(scriptState, value); } @@ -3241,20 +3242,20 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: { GLint value = 0; - webContext()->getVertexAttribiv(index, pname, &value); + contextGL()->GetVertexAttribiv(index, pname, &value); return WebGLAny(scriptState, static_cast<bool>(value)); } case GL_VERTEX_ATTRIB_ARRAY_SIZE: case GL_VERTEX_ATTRIB_ARRAY_STRIDE: { GLint value = 0; - webContext()->getVertexAttribiv(index, pname, &value); + contextGL()->GetVertexAttribiv(index, pname, &value); return WebGLAny(scriptState, value); } case GL_VERTEX_ATTRIB_ARRAY_TYPE: { GLint value = 0; - webContext()->getVertexAttribiv(index, pname, &value); + contextGL()->GetVertexAttribiv(index, pname, &value); return WebGLAny(scriptState, static_cast<GLenum>(value)); } case GL_CURRENT_VERTEX_ATTRIB: @@ -3262,17 +3263,17 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, switch (m_vertexAttribType[index]) { case Float32ArrayType: { GLfloat floatValue[4]; - webContext()->getVertexAttribfv(index, pname, floatValue); + contextGL()->GetVertexAttribfv(index, pname, floatValue); return WebGLAny(scriptState, DOMFloat32Array::create(floatValue, 4)); } case Int32ArrayType: { GLint intValue[4]; - webContext()->getVertexAttribIiv(index, pname, intValue); + contextGL()->GetVertexAttribIiv(index, pname, intValue); return WebGLAny(scriptState, DOMInt32Array::create(intValue, 4)); } case Uint32ArrayType: { GLuint uintValue[4]; - webContext()->getVertexAttribIuiv(index, pname, uintValue); + contextGL()->GetVertexAttribIuiv(index, pname, uintValue); return WebGLAny(scriptState, DOMUint32Array::create(uintValue, 4)); } default: @@ -3284,7 +3285,7 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, case GL_VERTEX_ATTRIB_ARRAY_INTEGER: if (isWebGL2OrHigher()) { GLint value = 0; - webContext()->getVertexAttribiv(index, pname, &value); + contextGL()->GetVertexAttribiv(index, pname, &value); return WebGLAny(scriptState, static_cast<bool>(value)); } // fall through to default error case @@ -3320,7 +3321,7 @@ void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) synthesizeGLError(GL_INVALID_ENUM, "hint", "invalid target"); return; } - webContext()->hint(target, mode); + contextGL()->Hint(target, mode); } GLboolean WebGLRenderingContextBase::isBuffer(WebGLBuffer* buffer) @@ -3333,7 +3334,7 @@ GLboolean WebGLRenderingContextBase::isBuffer(WebGLBuffer* buffer) if (buffer->isDeleted()) return 0; - return webContext()->isBuffer(buffer->object()); + return contextGL()->IsBuffer(buffer->object()); } bool WebGLRenderingContextBase::isContextLost() const @@ -3347,7 +3348,7 @@ GLboolean WebGLRenderingContextBase::isEnabled(GLenum cap) return 0; if (cap == GL_STENCIL_TEST) return m_stencilEnabled; - return webContext()->isEnabled(cap); + return contextGL()->IsEnabled(cap); } GLboolean WebGLRenderingContextBase::isFramebuffer(WebGLFramebuffer* framebuffer) @@ -3360,7 +3361,7 @@ GLboolean WebGLRenderingContextBase::isFramebuffer(WebGLFramebuffer* framebuffer if (framebuffer->isDeleted()) return 0; - return webContext()->isFramebuffer(framebuffer->object()); + return contextGL()->IsFramebuffer(framebuffer->object()); } GLboolean WebGLRenderingContextBase::isProgram(WebGLProgram* program) @@ -3368,7 +3369,7 @@ GLboolean WebGLRenderingContextBase::isProgram(WebGLProgram* program) if (!program || isContextLost()) return 0; - return webContext()->isProgram(program->object()); + return contextGL()->IsProgram(program->object()); } GLboolean WebGLRenderingContextBase::isRenderbuffer(WebGLRenderbuffer* renderbuffer) @@ -3381,7 +3382,7 @@ GLboolean WebGLRenderingContextBase::isRenderbuffer(WebGLRenderbuffer* renderbuf if (renderbuffer->isDeleted()) return 0; - return webContext()->isRenderbuffer(renderbuffer->object()); + return contextGL()->IsRenderbuffer(renderbuffer->object()); } GLboolean WebGLRenderingContextBase::isShader(WebGLShader* shader) @@ -3389,7 +3390,7 @@ GLboolean WebGLRenderingContextBase::isShader(WebGLShader* shader) if (!shader || isContextLost()) return 0; - return webContext()->isShader(shader->object()); + return contextGL()->IsShader(shader->object()); } GLboolean WebGLRenderingContextBase::isTexture(WebGLTexture* texture) @@ -3402,14 +3403,14 @@ GLboolean WebGLRenderingContextBase::isTexture(WebGLTexture* texture) if (texture->isDeleted()) return 0; - return webContext()->isTexture(texture->object()); + return contextGL()->IsTexture(texture->object()); } void WebGLRenderingContextBase::lineWidth(GLfloat width) { if (isContextLost()) return; - webContext()->lineWidth(width); + contextGL()->LineWidth(width); } void WebGLRenderingContextBase::linkProgram(WebGLProgram* program) @@ -3422,7 +3423,7 @@ void WebGLRenderingContextBase::linkProgram(WebGLProgram* program) return; } - webContext()->linkProgram(objectOrZero(program)); + contextGL()->LinkProgram(objectOrZero(program)); program->increaseLinkCount(); } @@ -3454,7 +3455,7 @@ void WebGLRenderingContextBase::pixelStorei(GLenum pname, GLint param) } else { // GL_UNPACK_ALIGNMENT: m_unpackAlignment = param; } - webContext()->pixelStorei(pname, param); + contextGL()->PixelStorei(pname, param); } else { synthesizeGLError(GL_INVALID_VALUE, "pixelStorei", "invalid parameter for alignment"); return; @@ -3470,7 +3471,7 @@ void WebGLRenderingContextBase::polygonOffset(GLfloat factor, GLfloat units) { if (isContextLost()) return; - webContext()->polygonOffset(factor, units); + contextGL()->PolygonOffset(factor, units); } bool WebGLRenderingContextBase::validateReadBufferAndGetInfo(const char* functionName, WebGLFramebuffer*& readFramebufferBinding) @@ -3604,7 +3605,7 @@ void WebGLRenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsi { ScopedDrawingBufferBinder binder(drawingBuffer(), framebuffer); - webContext()->readPixels(x, y, width, height, format, type, data); + contextGL()->ReadPixels(x, y, width, height, format, type, data); } } @@ -3620,7 +3621,7 @@ void WebGLRenderingContextBase::renderbufferStorageImpl( case GL_RGB5_A1: case GL_RGB565: case GL_STENCIL_INDEX8: - webContext()->renderbufferStorage(target, internalformat, width, height); + contextGL()->RenderbufferStorage(target, internalformat, width, height); m_renderbufferBinding->setInternalFormat(internalformat); m_renderbufferBinding->setSize(width, height); break; @@ -3629,13 +3630,13 @@ void WebGLRenderingContextBase::renderbufferStorageImpl( synthesizeGLError(GL_INVALID_ENUM, functionName, "sRGB not enabled"); break; } - webContext()->renderbufferStorage(target, internalformat, width, height); + contextGL()->RenderbufferStorage(target, internalformat, width, height); m_renderbufferBinding->setInternalFormat(internalformat); m_renderbufferBinding->setSize(width, height); break; case GL_DEPTH_STENCIL_OES: ASSERT(isDepthStencilSupported()); - webContext()->renderbufferStorage(target, GL_DEPTH24_STENCIL8_OES, width, height); + contextGL()->RenderbufferStorage(target, GL_DEPTH24_STENCIL8_OES, width, height); m_renderbufferBinding->setSize(width, height); m_renderbufferBinding->setInternalFormat(internalformat); break; @@ -3668,14 +3669,14 @@ void WebGLRenderingContextBase::sampleCoverage(GLfloat value, GLboolean invert) { if (isContextLost()) return; - webContext()->sampleCoverage(value, invert); + contextGL()->SampleCoverage(value, invert); } void WebGLRenderingContextBase::scissor(GLint x, GLint y, GLsizei width, GLsizei height) { if (isContextLost()) return; - webContext()->scissor(x, y, width, height); + contextGL()->Scissor(x, y, width, height); } void WebGLRenderingContextBase::shaderSource(WebGLShader* shader, const String& string) @@ -3699,7 +3700,7 @@ void WebGLRenderingContextBase::stencilFunc(GLenum func, GLint ref, GLuint mask) m_stencilFuncRefBack = ref; m_stencilFuncMask = mask; m_stencilFuncMaskBack = mask; - webContext()->stencilFunc(func, ref, mask); + contextGL()->StencilFunc(func, ref, mask); } void WebGLRenderingContextBase::stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) @@ -3727,7 +3728,7 @@ void WebGLRenderingContextBase::stencilFuncSeparate(GLenum face, GLenum func, GL synthesizeGLError(GL_INVALID_ENUM, "stencilFuncSeparate", "invalid face"); return; } - webContext()->stencilFuncSeparate(face, func, ref, mask); + contextGL()->StencilFuncSeparate(face, func, ref, mask); } void WebGLRenderingContextBase::stencilMask(GLuint mask) @@ -3736,7 +3737,7 @@ void WebGLRenderingContextBase::stencilMask(GLuint mask) return; m_stencilMask = mask; m_stencilMaskBack = mask; - webContext()->stencilMask(mask); + contextGL()->StencilMask(mask); } void WebGLRenderingContextBase::stencilMaskSeparate(GLenum face, GLuint mask) @@ -3758,21 +3759,21 @@ void WebGLRenderingContextBase::stencilMaskSeparate(GLenum face, GLuint mask) synthesizeGLError(GL_INVALID_ENUM, "stencilMaskSeparate", "invalid face"); return; } - webContext()->stencilMaskSeparate(face, mask); + contextGL()->StencilMaskSeparate(face, mask); } void WebGLRenderingContextBase::stencilOp(GLenum fail, GLenum zfail, GLenum zpass) { if (isContextLost()) return; - webContext()->stencilOp(fail, zfail, zpass); + contextGL()->StencilOp(fail, zfail, zpass); } void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { if (isContextLost()) return; - webContext()->stencilOpSeparate(face, fail, zfail, zpass); + contextGL()->StencilOpSeparate(face, fail, zfail, zpass); } CHROMIUMValuebuffer* WebGLRenderingContextBase::createValuebufferCHROMIUM() @@ -3800,7 +3801,7 @@ GLboolean WebGLRenderingContextBase::isValuebufferCHROMIUM(CHROMIUMValuebuffer* return 0; if (valuebuffer->isDeleted()) return 0; - return webContext()->isValuebufferCHROMIUM(valuebuffer->object()); + return contextGL()->IsValuebufferCHROMIUM(valuebuffer->object()); } void WebGLRenderingContextBase::bindValuebufferCHROMIUM(GLenum target, CHROMIUMValuebuffer* valuebuffer) @@ -5133,7 +5134,7 @@ ScriptValue WebGLRenderingContextBase::getBooleanParameter(ScriptState* scriptSt { GLboolean value = 0; if (!isContextLost()) - webContext()->getBooleanv(pname, &value); + contextGL()->GetBooleanv(pname, &value); return WebGLAny(scriptState, static_cast<bool>(value)); } @@ -5145,7 +5146,7 @@ ScriptValue WebGLRenderingContextBase::getBooleanArrayParameter(ScriptState* scr } GLboolean value[4] = {0}; if (!isContextLost()) - webContext()->getBooleanv(pname, value); + contextGL()->GetBooleanv(pname, value); bool boolValue[4]; for (int ii = 0; ii < 4; ++ii) boolValue[ii] = static_cast<bool>(value[ii]); @@ -5156,7 +5157,7 @@ ScriptValue WebGLRenderingContextBase::getFloatParameter(ScriptState* scriptStat { GLfloat value = 0; if (!isContextLost()) - webContext()->getFloatv(pname, &value); + contextGL()->GetFloatv(pname, &value); return WebGLAny(scriptState, value); } @@ -5164,7 +5165,7 @@ ScriptValue WebGLRenderingContextBase::getIntParameter(ScriptState* scriptState, { GLint value = 0; if (!isContextLost()) - webContext()->getIntegerv(pname, &value); + contextGL()->GetIntegerv(pname, &value); return WebGLAny(scriptState, value); } @@ -5172,7 +5173,7 @@ ScriptValue WebGLRenderingContextBase::getInt64Parameter(ScriptState* scriptStat { GLint64 value = 0; if (!isContextLost()) - webContext()->getInteger64v(pname, &value); + contextGL()->GetInteger64v(pname, &value); return WebGLAny(scriptState, value); } @@ -5180,7 +5181,7 @@ ScriptValue WebGLRenderingContextBase::getUnsignedIntParameter(ScriptState* scri { GLint value = 0; if (!isContextLost()) - webContext()->getIntegerv(pname, &value); + contextGL()->GetIntegerv(pname, &value); return WebGLAny(scriptState, static_cast<unsigned>(value)); } @@ -5188,7 +5189,7 @@ ScriptValue WebGLRenderingContextBase::getWebGLFloatArrayParameter(ScriptState* { GLfloat value[4] = {0}; if (!isContextLost()) - webContext()->getFloatv(pname, value); + contextGL()->GetFloatv(pname, value); unsigned length = 0; switch (pname) { case GL_ALIASED_POINT_SIZE_RANGE: @@ -5210,7 +5211,7 @@ ScriptValue WebGLRenderingContextBase::getWebGLIntArrayParameter(ScriptState* sc { GLint value[4] = {0}; if (!isContextLost()) - webContext()->getIntegerv(pname, value); + contextGL()->GetIntegerv(pname, value); unsigned length = 0; switch (pname) { case GL_MAX_VIEWPORT_DIMS: @@ -6113,9 +6114,9 @@ GLint WebGLRenderingContextBase::maxDrawBuffers() if (isContextLost() || !(extensionEnabled(WebGLDrawBuffersName) || isWebGL2OrHigher())) return 0; if (!m_maxDrawBuffers) - webContext()->getIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &m_maxDrawBuffers); + contextGL()->GetIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &m_maxDrawBuffers); if (!m_maxColorAttachments) - webContext()->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttachments); + contextGL()->GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttachments); // WEBGL_draw_buffers requires MAX_COLOR_ATTACHMENTS >= MAX_DRAW_BUFFERS. return std::min(m_maxDrawBuffers, m_maxColorAttachments); } @@ -6125,7 +6126,7 @@ GLint WebGLRenderingContextBase::maxColorAttachments() if (isContextLost() || !(extensionEnabled(WebGLDrawBuffersName) || isWebGL2OrHigher())) return 0; if (!m_maxColorAttachments) - webContext()->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttachments); + contextGL()->GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttachments); return m_maxColorAttachments; } @@ -6292,13 +6293,13 @@ DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const void WebGLRenderingContextBase::resetUnpackParameters() { if (m_unpackAlignment != 1) - webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); + contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); } void WebGLRenderingContextBase::restoreUnpackParameters() { if (m_unpackAlignment != 1) - webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); + contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); } } // namespace blink diff --git a/third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.cpp b/third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.cpp index e4518f1..7e1fae1 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.cpp @@ -4,6 +4,7 @@ #include "modules/webgl/WebGLTimerQueryEXT.h" +#include "gpu/command_buffer/client/gles2_interface.h" #include "modules/webgl/WebGLRenderingContextBase.h" #include "public/platform/Platform.h" @@ -45,7 +46,7 @@ void WebGLTimerQueryEXT::resetCachedResult() registerTaskObserver(); } -void WebGLTimerQueryEXT::updateCachedResult(WebGraphicsContext3D* ctx) +void WebGLTimerQueryEXT::updateCachedResult(gpu::gles2::GLES2Interface* gl) { if (m_queryResultAvailable) return; @@ -59,11 +60,11 @@ void WebGLTimerQueryEXT::updateCachedResult(WebGraphicsContext3D* ctx) // We can only update the cached result when control returns to the browser. m_canUpdateAvailability = false; GLuint available = 0; - ctx->getQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &available); + gl->GetQueryObjectuivEXT(object(), GL_QUERY_RESULT_AVAILABLE_EXT, &available); m_queryResultAvailable = !!available; if (m_queryResultAvailable) { GLuint64 result = 0; - ctx->getQueryObjectui64vEXT(object(), GL_QUERY_RESULT_EXT, &result); + gl->GetQueryObjectui64vEXT(object(), GL_QUERY_RESULT_EXT, &result); m_queryResult = result; unregisterTaskObserver(); } diff --git a/third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.h b/third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.h index a5082ce..e8c4df2 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.h +++ b/third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.h @@ -9,6 +9,12 @@ #include "public/platform/WebThread.h" +namespace gpu { +namespace gles2 { +class GLES2Interface; +} +} + namespace blink { class WebGLTimerQueryEXT : public WebGLContextObject, public WebThread::TaskObserver { @@ -25,7 +31,7 @@ public: GLenum target() const { return m_target; } void resetCachedResult(); - void updateCachedResult(WebGraphicsContext3D*); + void updateCachedResult(gpu::gles2::GLES2Interface*); bool isQueryResultAvailable(); GLuint64 getQueryResult(); diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index 19d3be5..2c842d2 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp @@ -219,12 +219,12 @@ bool Canvas2DLayerBridge::prepareIOSurfaceMailboxFromImage(SkImage* image, WebEx gpu::gles2::GLES2Interface* gl = contextGL(); GLuint imageTexture = skia::GrBackendObjectToGrGLTextureInfo(image->getTextureHandle(true))->fID; - context()->copySubTextureCHROMIUM(imageTexture, imageInfo.m_textureId, 0, 0, 0, 0, m_size.width(), m_size.height(), GL_FALSE, GL_FALSE, GL_FALSE); + gl->CopySubTextureCHROMIUM(imageTexture, imageInfo.m_textureId, 0, 0, 0, 0, m_size.width(), m_size.height(), GL_FALSE, GL_FALSE, GL_FALSE); MailboxInfo& info = m_mailboxes.first(); info.m_mailbox.textureTarget = GC3D_TEXTURE_RECTANGLE_ARB; - context()->genMailboxCHROMIUM(info.m_mailbox.name); - context()->produceTextureDirectCHROMIUM(imageInfo.m_textureId, info.m_mailbox.textureTarget, info.m_mailbox.name); + gl->GenMailboxCHROMIUM(info.m_mailbox.name); + gl->ProduceTextureDirectCHROMIUM(imageInfo.m_textureId, info.m_mailbox.textureTarget, info.m_mailbox.name); info.m_mailbox.allowOverlay = true; const WGC3Duint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); @@ -357,10 +357,10 @@ bool Canvas2DLayerBridge::prepareMailboxFromImage(PassRefPtr<SkImage> image, Web ASSERT(mailboxInfo.m_image->getTexture()->getCustomData()->size() == sizeof(mailboxInfo.m_mailbox.name)); memcpy(&mailboxInfo.m_mailbox.name[0], mailboxInfo.m_image->getTexture()->getCustomData()->data(), sizeof(mailboxInfo.m_mailbox.name)); } else { - context()->genMailboxCHROMIUM(mailboxInfo.m_mailbox.name); + gl->GenMailboxCHROMIUM(mailboxInfo.m_mailbox.name); RefPtr<SkData> mailboxNameData = adoptRef(SkData::NewWithCopy(&mailboxInfo.m_mailbox.name[0], sizeof(mailboxInfo.m_mailbox.name))); mailboxInfo.m_image->getTexture()->setCustomData(mailboxNameData.get()); - webContext->produceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo.m_mailbox.name); + gl->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo.m_mailbox.name); } if (isHidden()) { @@ -371,7 +371,7 @@ bool Canvas2DLayerBridge::prepareMailboxFromImage(PassRefPtr<SkImage> image, Web // FIXME: We'd rather insert a syncpoint than perform a flush here, // but currently the canvas will flicker if we don't flush here. const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); - webContext->flush(); + gl->Flush(); mailboxInfo.m_mailbox.validSyncToken = webContext->genSyncTokenCHROMIUM(fenceSync, mailboxInfo.m_mailbox.syncToken); } gl->BindTexture(GL_TEXTURE_2D, 0); @@ -707,9 +707,9 @@ void Canvas2DLayerBridge::flushGpu() { TRACE_EVENT0("cc", "Canvas2DLayerBridge::flushGpu"); flush(); - WebGraphicsContext3D* webContext = context(); - if (isAccelerated() && webContext) - webContext->flush(); + gpu::gles2::GLES2Interface* gl = contextGL(); + if (isAccelerated() && gl) + gl->Flush(); } diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp index 78e01fb..134dfe4 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp @@ -210,26 +210,26 @@ bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gles mailbox->textureSize = WebSize(textureImage->width(), textureImage->height()); // Contexts may be in a different share group. We must transfer the texture through a mailbox first - sharedContext->genMailboxCHROMIUM(mailbox->name); - sharedContext->produceTextureDirectCHROMIUM(textureInfo->fID, textureInfo->fTarget, mailbox->name); + sharedGL->GenMailboxCHROMIUM(mailbox->name); + sharedGL->ProduceTextureDirectCHROMIUM(textureInfo->fID, textureInfo->fTarget, mailbox->name); const GLuint64 sharedFenceSync = sharedGL->InsertFenceSyncCHROMIUM(); - sharedContext->flush(); + sharedGL->Flush(); mailbox->validSyncToken = sharedContext->genSyncTokenCHROMIUM(sharedFenceSync, mailbox->syncToken); if (mailbox->validSyncToken) gl->WaitSyncTokenCHROMIUM(mailbox->syncToken); - Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(textureInfo->fTarget, mailbox->name); + Platform3DObject sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(textureInfo->fTarget, mailbox->name); // The canvas is stored in a premultiplied format, so unpremultiply if necessary. // The canvas is stored in an inverted position, so the flip semantics are reversed. - context->copyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, flipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FALSE : GL_TRUE); + gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, flipY ? GL_FALSE : GL_TRUE, GL_FALSE, premultiplyAlpha ? GL_FALSE : GL_TRUE); context->deleteTexture(sourceTexture); const GLuint64 contextFenceSync = gl->InsertFenceSyncCHROMIUM(); - context->flush(); + gl->Flush(); WGC3Dbyte syncToken[24]; if (context->genSyncTokenCHROMIUM(contextFenceSync, syncToken)) @@ -254,7 +254,7 @@ bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu if (!textureId) return false; - context3D->flush(); + gl->Flush(); return drawingBuffer->copyToPlatformTexture(context3D, gl, textureId, GL_RGBA, GL_UNSIGNED_BYTE, 0, true, false, sourceBuffer); diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index 861edba..77c49726 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp @@ -299,15 +299,15 @@ bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt m_gl->DiscardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments); } } else { - m_context->copyTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMailbox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.internalColorFormat, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_FALSE); + m_gl->CopyTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMailbox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.internalColorFormat, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_FALSE); } restoreFramebufferBindings(); m_contentsChanged = false; - m_context->produceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferMailbox->mailbox.name); + m_gl->ProduceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferMailbox->mailbox.name); const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); - m_context->flush(); + m_gl->Flush(); frontColorBufferMailbox->mailbox.validSyncToken = m_context->genSyncTokenCHROMIUM(fenceSync, frontColorBufferMailbox->mailbox.syncToken); frontColorBufferMailbox->mailbox.allowOverlay = frontColorBufferMailbox->textureInfo.imageId != 0; frontColorBufferMailbox->mailbox.textureTarget = frontColorBufferMailbox->textureInfo.parameters.target; @@ -422,7 +422,7 @@ PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::recycledMailbox() PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::createNewMailbox(const TextureInfo& info) { RefPtr<MailboxInfo> returnMailbox = adoptRef(new MailboxInfo()); - m_context->genMailboxCHROMIUM(returnMailbox->mailbox.name); + m_gl->GenMailboxCHROMIUM(returnMailbox->mailbox.name); returnMailbox->textureInfo = info; returnMailbox->size = m_size; m_textureMailboxes.append(returnMailbox); @@ -453,12 +453,12 @@ bool DrawingBuffer::initialize(const IntSize& size) return false; } - m_context->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize); + m_gl->GetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize); int maxSampleCount = 0; m_antiAliasingMode = None; if (m_requestedAttributes.antialias && m_multisampleExtensionSupported) { - m_context->getIntegerv(GL_MAX_SAMPLES_ANGLE, &maxSampleCount); + m_gl->GetIntegerv(GL_MAX_SAMPLES_ANGLE, &maxSampleCount); m_antiAliasingMode = MSAAExplicitResolve; if (m_extensionsUtil->supportsExtension("GL_EXT_multisampled_render_to_texture")) { m_antiAliasingMode = MSAAImplicitResolve; @@ -479,17 +479,17 @@ bool DrawingBuffer::initialize(const IntSize& size) m_actualAttributes = m_requestedAttributes; if (m_requestedAttributes.alpha) { WGC3Dint alphaBits = 0; - m_context->getIntegerv(GL_ALPHA_BITS, &alphaBits); + m_gl->GetIntegerv(GL_ALPHA_BITS, &alphaBits); m_actualAttributes.alpha = alphaBits > 0; } if (m_requestedAttributes.depth) { WGC3Dint depthBits = 0; - m_context->getIntegerv(GL_DEPTH_BITS, &depthBits); + m_gl->GetIntegerv(GL_DEPTH_BITS, &depthBits); m_actualAttributes.depth = depthBits > 0; } if (m_requestedAttributes.stencil) { WGC3Dint stencilBits = 0; - m_context->getIntegerv(GL_STENCIL_BITS, &stencilBits); + m_gl->GetIntegerv(GL_STENCIL_BITS, &stencilBits); m_actualAttributes.stencil = stencilBits > 0; } m_actualAttributes.antialias = multisample(); @@ -510,7 +510,7 @@ bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gl commit(); restoreFramebufferBindings(); } - m_context->flush(); + m_gl->Flush(); } // Assume that the destination target is GL_TEXTURE_2D. @@ -528,16 +528,16 @@ bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gl } else { textureId = m_colorBuffer.textureId; target = m_colorBuffer.parameters.target; - m_context->genMailboxCHROMIUM(mailbox.name); - m_context->produceTextureDirectCHROMIUM(textureId, target, mailbox.name); + m_gl->GenMailboxCHROMIUM(mailbox.name); + m_gl->ProduceTextureDirectCHROMIUM(textureId, target, mailbox.name); const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); - m_context->flush(); + m_gl->Flush(); mailbox.validSyncToken = m_context->genSyncTokenCHROMIUM(fenceSync, mailbox.syncToken); } if (mailbox.validSyncToken) gl->WaitSyncTokenCHROMIUM(mailbox.syncToken); - Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(target, mailbox.name); + Platform3DObject sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.name); GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; @@ -546,13 +546,13 @@ bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gl else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha && premultiplyAlpha) unpackPremultiplyAlphaNeeded = GL_TRUE; - context->copyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, flipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); + gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, flipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); context->deleteTexture(sourceTexture); const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); - context->flush(); + gl->Flush(); GLbyte syncToken[24]; if (context->genSyncTokenCHROMIUM(fenceSync, syncToken)) m_gl->WaitSyncTokenCHROMIUM(syncToken); @@ -585,7 +585,7 @@ void DrawingBuffer::clearPlatformLayer() if (m_layer) m_layer->clearTexture(); - m_context->flush(); + m_gl->Flush(); } void DrawingBuffer::beginDestruction() @@ -697,7 +697,7 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size) else if (m_antiAliasingMode == MSAAExplicitResolve) m_gl->RenderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); else - m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); + m_gl->RenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); m_gl->FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer); m_gl->BindRenderbuffer(GL_RENDERBUFFER, 0); } @@ -788,7 +788,7 @@ bool DrawingBuffer::reset(const IntSize& newSize) if (m_actualAttributes.stencil) { m_gl->ClearStencil(0); clearMask |= GL_STENCIL_BUFFER_BIT; - m_context->stencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); + m_gl->StencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); } clearFramebuffers(clearMask); @@ -902,10 +902,10 @@ bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So void DrawingBuffer::readBackFramebuffer(unsigned char* pixels, int width, int height, ReadbackOrder readbackOrder, WebGLImageConversion::AlphaOp op) { if (m_packAlignment > 4) - m_context->pixelStorei(GL_PACK_ALIGNMENT, 1); - m_context->readPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + m_gl->PixelStorei(GL_PACK_ALIGNMENT, 1); + m_gl->ReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); if (m_packAlignment > 4) - m_context->pixelStorei(GL_PACK_ALIGNMENT, m_packAlignment); + m_gl->PixelStorei(GL_PACK_ALIGNMENT, m_packAlignment); size_t bufferSize = 4 * width * height; diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp index 9b13f2e..86f5d41 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp @@ -98,22 +98,50 @@ public: return GL_FRAMEBUFFER_COMPLETE; } + void GetIntegerv(GLenum pname, GLint* value) override + { + if (pname == GL_MAX_TEXTURE_SIZE) + *value = 1024; + } + + void GenMailboxCHROMIUM(GLbyte* mailbox) override + { + ++m_currentMailboxByte; + WebExternalTextureMailbox temp; + memset(mailbox, m_currentMailboxByte, sizeof(temp.name)); + } + + void ProduceTextureDirectCHROMIUM(GLuint texture, GLenum target, const GLbyte* mailbox) override + { + ASSERT_EQ(target, drawingBufferTextureTarget(m_allowImageChromium)); + ASSERT_TRUE(m_textureSizes.contains(texture)); + m_mostRecentlyProducedSize = m_textureSizes.get(texture); + } + uint32_t boundTexture() const { return m_boundTexture; } uint32_t boundTextureTarget() const { return m_boundTextureTarget; } uint32_t mostRecentlyWaitedSyncToken() const { return m_mostRecentlyWaitedSyncToken; } + IntSize mostRecentlyProducedSize() const { return m_mostRecentlyProducedSize; } + bool allowImageChromium() const { return m_allowImageChromium; } + HashMap<WebGLId, IntSize>& textureSizes() { return m_textureSizes; } + const HashMap<WebGLId, IntSize>& textureSizes() const { return m_textureSizes; } + + void setAllowImageChromium(bool allow) { m_allowImageChromium = allow; } private: uint32_t m_boundTexture = 0; uint32_t m_boundTextureTarget = 0; uint32_t m_mostRecentlyWaitedSyncToken = 0; + HashMap<WebGLId, IntSize> m_textureSizes; + WGC3Dbyte m_currentMailboxByte = 0; + IntSize m_mostRecentlyProducedSize; + bool m_allowImageChromium = true; }; class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { public: WebGraphicsContext3DForTests(PassOwnPtr<GLES2InterfaceForTests> contextGL) - : m_currentMailboxByte(0) - , m_currentImageId(1) - , m_allowImageChromium(true) + : m_currentImageId(1) , m_contextGL(std::move(contextGL)) { } @@ -121,29 +149,10 @@ public: void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) override { if (target == GL_TEXTURE_2D && !level) { - m_textureSizes.set(m_contextGL->boundTexture(), IntSize(width, height)); + m_contextGL->textureSizes().set(m_contextGL->boundTexture(), IntSize(width, height)); } } - void genMailboxCHROMIUM(WGC3Dbyte* mailbox) override - { - ++m_currentMailboxByte; - WebExternalTextureMailbox temp; - memset(mailbox, m_currentMailboxByte, sizeof(temp.name)); - } - - void produceTextureDirectCHROMIUM(WebGLId texture, WGC3Denum target, const WGC3Dbyte* mailbox) override - { - ASSERT_EQ(target, drawingBufferTextureTarget(m_allowImageChromium)); - ASSERT_TRUE(m_textureSizes.contains(texture)); - m_mostRecentlyProducedSize = m_textureSizes.get(texture); - } - - IntSize mostRecentlyProducedSize() - { - return m_mostRecentlyProducedSize; - } - bool genSyncTokenCHROMIUM(WGC3Duint64 fenceSync, WGC3Dbyte* syncToken) override { memcpy(syncToken, &fenceSync, sizeof(fenceSync)); @@ -152,7 +161,7 @@ public: WGC3Duint createGpuMemoryBufferImageCHROMIUM(WGC3Dsizei width, WGC3Dsizei height, WGC3Denum internalformat, WGC3Denum usage) override { - if (!m_allowImageChromium) + if (!m_contextGL->allowImageChromium()) return false; m_imageSizes.set(m_currentImageId, IntSize(width, height)); return m_currentImageId++; @@ -172,7 +181,7 @@ public: void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId) { if (target == imageTextureTarget()) { - m_textureSizes.set(m_contextGL->boundTexture(), m_imageSizes.find(imageId)->value); + m_contextGL->textureSizes().set(m_contextGL->boundTexture(), m_imageSizes.find(imageId)->value); m_imageToTextureMap.set(imageId, m_contextGL->boundTexture()); bindTexImage2DMock(imageId); } @@ -193,14 +202,15 @@ public: return m_contextGL->mostRecentlyWaitedSyncToken(); } - WGC3Duint nextImageIdToBeCreated() + IntSize mostRecentlyProducedSize() { - return m_currentImageId; + return m_contextGL->mostRecentlyProducedSize(); } - void setAllowImageChromium(bool allow) + + WGC3Duint nextImageIdToBeCreated() { - m_allowImageChromium = allow; + return m_currentImageId; } gpu::gles2::GLES2Interface* getGLES2Interface() override @@ -209,13 +219,9 @@ public: } private: - HashMap<WebGLId, IntSize> m_textureSizes; - WGC3Dbyte m_currentMailboxByte; - IntSize m_mostRecentlyProducedSize; WGC3Duint m_currentImageId; HashMap<WGC3Duint, IntSize> m_imageSizes; HashMap<WGC3Duint, WebGLId> m_imageToTextureMap; - bool m_allowImageChromium; OwnPtr<GLES2InterfaceForTests> m_contextGL; }; @@ -599,6 +605,21 @@ public: return GL_FRAMEBUFFER_COMPLETE; } + void GetIntegerv(GLenum ptype, GLint* value) override + { + switch (ptype) { + case GL_DEPTH_BITS: + *value = (m_depthAttachment || m_depthStencilAttachment) ? 24 : 0; + return; + case GL_STENCIL_BITS: + *value = (m_stencilAttachment || m_depthStencilAttachment) ? 8 : 0; + return; + case GL_MAX_TEXTURE_SIZE: + *value = 1024; + return; + } + } + uint32_t stencilAttachment() const { return m_stencilAttachment; } uint32_t depthAttachment() const { return m_depthAttachment; } uint32_t depthStencilAttachment() const { return m_depthStencilAttachment; } @@ -632,19 +653,6 @@ public: return ++m_nextRenderBufferId; } - void getIntegerv(WGC3Denum ptype, WGC3Dint* value) override - { - switch (ptype) { - case GL_DEPTH_BITS: - *value = (depthAttachment() || depthStencilAttachment()) ? 24 : 0; - return; - case GL_STENCIL_BITS: - *value = (stencilAttachment() || depthStencilAttachment()) ? 8 : 0; - return; - } - MockWebGraphicsContext3D::getIntegerv(ptype, value); - } - gpu::gles2::GLES2Interface* getGLES2Interface() override { return &m_contextGL; } private: @@ -746,9 +754,9 @@ protected: void SetUp() override { OwnPtr<GLES2InterfaceForTests> gl = adoptPtr(new GLES2InterfaceForTests); + gl->setAllowImageChromium(false); m_gl = gl.get(); OwnPtr<WebGraphicsContext3DForTests> context = adoptPtr(new WebGraphicsContext3DForTests(gl.release())); - context->setAllowImageChromium(false); m_context = context.get(); RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(true); m_drawingBuffer = DrawingBufferForTests::create(context.release(), m_gl, diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp index 0fc1996..4b0dbc7 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp @@ -50,17 +50,17 @@ void SharedContextRateLimiter::tick() WebGraphicsContext3D* context = m_contextProvider->context3d(); m_queries.append(m_canUseSyncQueries ? context->createQueryEXT() : 0); if (m_canUseSyncQueries) { - context->beginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, m_queries.last()); - context->endQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); + gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, m_queries.last()); + gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); } if (m_queries.size() > m_maxPendingTicks) { if (m_canUseSyncQueries) { WGC3Duint result; - context->getQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT, &result); + gl->GetQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT, &result); context->deleteQueryEXT(m_queries.first()); m_queries.removeFirst(); } else { - context->finish(); + gl->Finish(); reset(); } } diff --git a/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h b/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h index a986c12..895adf9 100644 --- a/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h +++ b/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h @@ -49,81 +49,17 @@ public: virtual void drawElements(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) { } - virtual void finish() { } - virtual void flush() { } - virtual void frontFace(WGC3Denum mode) { } - virtual void generateMipmap(WGC3Denum target) { } - virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&) { return false; } virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&) { return false; } - virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, WGC3Dsizei* count, WebGLId* shaders) { } - virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) { return 0; } - virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) { } - virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { } virtual Attributes getContextAttributes() { return m_attrs; } virtual WGC3Denum getError() { return 0; } - virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) { } - virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) { } - - virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) - { - if (pname == GL_MAX_TEXTURE_SIZE) - *value = 1024; - } - - virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) - { - if (pname == GL_LINK_STATUS) - *value = 1; - } - virtual WebString getProgramInfoLog(WebGLId program) { return WebString(); } - virtual void getRenderbufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { } - - virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) - { - if (pname == GL_COMPILE_STATUS) - *value = 1; - } - virtual WebString getShaderInfoLog(WebGLId shader) { return WebString(); } - virtual void getShaderPrecisionFormat(WGC3Denum shadertype, WGC3Denum precisiontype, WGC3Dint* range, WGC3Dint* precision) { } virtual WebString getShaderSource(WebGLId shader) { return WebString(); } virtual WebString getString(WGC3Denum name) { return WebString(); } - virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) { } - virtual void getTexParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) { } - virtual void getUniformfv(WebGLId program, WGC3Dint location, WGC3Dfloat* value) { } - virtual void getUniformiv(WebGLId program, WGC3Dint location, WGC3Dint* value) { } - virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name) { return 0; } - virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value) { } - virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, WGC3Dint* value) { } virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) { return 0; } - virtual void hint(WGC3Denum target, WGC3Denum mode) { } - virtual WGC3Dboolean isBuffer(WebGLId buffer) { return false; } - virtual WGC3Dboolean isEnabled(WGC3Denum cap) { return false; } - virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer) { return false; } - virtual WGC3Dboolean isProgram(WebGLId program) { return false; } - virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer) { return false; } - virtual WGC3Dboolean isShader(WebGLId shader) { return false; } - virtual WGC3Dboolean isTexture(WebGLId texture) { return false; } - virtual void lineWidth(WGC3Dfloat) { } - virtual void linkProgram(WebGLId program) { } - virtual void pixelStorei(WGC3Denum pname, WGC3Dint param) { } - virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units) { } - - virtual void readPixels(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, void* pixels) { } - - virtual void renderbufferStorage(WGC3Denum target, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) { } - virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert) { } - virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { } virtual void shaderSource(WebGLId shader, const WGC3Dchar* string) { } - virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask) { } - virtual void stencilFuncSeparate(WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask) { } - virtual void stencilMask(WGC3Duint mask) { } - virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask) { } - virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) { } - virtual void stencilOpSeparate(WGC3Denum face, WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) { } virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) { } @@ -213,11 +149,6 @@ public: virtual WebGLId createQueryEXT() { return 1; } virtual void deleteQueryEXT(WebGLId) { } - virtual GLboolean isQueryEXT(WebGLId) { return true; } - virtual void beginQueryEXT(GLenum, WebGLId) { } - virtual void endQueryEXT(GLenum) { } - virtual void getQueryivEXT(GLenum, GLenum, GLint*) { } - virtual void getQueryObjectuivEXT(WebGLId, GLenum, GLuint*) { } virtual WebString getTranslatedShaderSourceANGLE(WebGLId) { return WebString(); } diff --git a/third_party/WebKit/public/platform/WebGraphicsContext3D.h b/third_party/WebKit/public/platform/WebGraphicsContext3D.h index 12e0f4c..68d0521 100644 --- a/third_party/WebKit/public/platform/WebGraphicsContext3D.h +++ b/third_party/WebKit/public/platform/WebGraphicsContext3D.h @@ -160,63 +160,16 @@ public: // and: http://www.khronos.org/opengles/sdk/docs/man/ virtual void drawElements(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) = 0; - virtual void finish() = 0; - virtual void flush() = 0; - virtual void frontFace(WGC3Denum mode) = 0; - virtual void generateMipmap(WGC3Denum target) = 0; - virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&) = 0; virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&) = 0; - virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, WGC3Dsizei* count, WebGLId* shaders) = 0; - virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) = 0; - virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) = 0; - virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; virtual WGC3Denum getError() = 0; - virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) = 0; - virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) = 0; - virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) = 0; - virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) = 0; virtual WebString getProgramInfoLog(WebGLId program) = 0; - virtual void getRenderbufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; - virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) = 0; virtual WebString getShaderInfoLog(WebGLId shader) = 0; - virtual void getShaderPrecisionFormat(WGC3Denum shadertype, WGC3Denum precisiontype, WGC3Dint* range, WGC3Dint* precision) = 0; virtual WebString getShaderSource(WebGLId shader) = 0; virtual WebString getString(WGC3Denum name) = 0; - virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) = 0; - virtual void getTexParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; - virtual void getUniformfv(WebGLId program, WGC3Dint location, WGC3Dfloat* value) = 0; - virtual void getUniformiv(WebGLId program, WGC3Dint location, WGC3Dint* value) = 0; - virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name) = 0; - virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value) = 0; - virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, WGC3Dint* value) = 0; virtual WGC3Dintptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) = 0; - virtual void hint(WGC3Denum target, WGC3Denum mode) = 0; - virtual WGC3Dboolean isBuffer(WebGLId buffer) = 0; - virtual WGC3Dboolean isEnabled(WGC3Denum cap) = 0; - virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer) = 0; - virtual WGC3Dboolean isProgram(WebGLId program) = 0; - virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer) = 0; - virtual WGC3Dboolean isShader(WebGLId shader) = 0; - virtual WGC3Dboolean isTexture(WebGLId texture) = 0; - virtual void lineWidth(WGC3Dfloat) = 0; - virtual void linkProgram(WebGLId program) = 0; - virtual void pixelStorei(WGC3Denum pname, WGC3Dint param) = 0; - virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units) = 0; - - virtual void readPixels(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, void* pixels) = 0; - - virtual void renderbufferStorage(WGC3Denum target, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; - virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert) = 0; - virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; virtual void shaderSource(WebGLId shader, const WGC3Dchar* string) = 0; - virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask) = 0; - virtual void stencilFuncSeparate(WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask) = 0; - virtual void stencilMask(WGC3Duint mask) = 0; - virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask) = 0; - virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) = 0; - virtual void stencilOpSeparate(WGC3Denum face, WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) = 0; virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) = 0; @@ -289,43 +242,16 @@ public: // GL_EXT_occlusion_query virtual WebGLId createQueryEXT() { return 0; } virtual void deleteQueryEXT(WebGLId query) { } - virtual WGC3Dboolean isQueryEXT(WebGLId query) { return false; } - virtual void beginQueryEXT(WGC3Denum target, WebGLId query) { } - virtual void endQueryEXT(WGC3Denum target) { } - virtual void getQueryivEXT(WGC3Denum target, WGC3Denum pname, WGC3Dint* params) { } - virtual void getQueryObjectuivEXT(WebGLId query, WGC3Denum pname, WGC3Duint* params) { } - - // GL_EXT_disjoint_timer_query - virtual void queryCounterEXT(WebGLId query, WGC3Denum target) {} - virtual void getQueryObjectui64vEXT(WebGLId query, WGC3Denum pname, WGC3Duint64* params) {} - - // GL_CHROMIUM_copy_texture - virtual void copyTextureCHROMIUM(WGC3Duint sourceId, - WGC3Duint destId, WGC3Denum internalFormat, WGC3Denum destType, - WGC3Dboolean unpackFlipY, WGC3Dboolean unpackPremultiplyAlpha, WGC3Dboolean unpackUnmultiplyAlpha) { } - virtual void copySubTextureCHROMIUM(WGC3Duint sourceId, - WGC3Duint destId, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dint x, - WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, - WGC3Dboolean unpackFlipY, WGC3Dboolean unpackPremultiplyAlpha, WGC3Dboolean unpackUnmultiplyAlpha) { } // GL_CHROMIUM_subscribe_uniform - virtual void genValuebuffersCHROMIUM(WGC3Dsizei count, WebGLId* ids) { } virtual WebGLId createValuebufferCHROMIUM() { return 0; } virtual void deleteValuebuffersCHROMIUM(WGC3Dsizei count, WebGLId* ids) { } virtual void deleteValuebufferCHROMIUM(WebGLId) { } - virtual WGC3Dboolean isValuebufferCHROMIUM(WebGLId renderbuffer) { return false; } virtual void bindValuebufferCHROMIUM(WGC3Denum target, WebGLId valuebuffer) { } virtual void subscribeValueCHROMIUM(WGC3Denum target, WGC3Denum subscription) { } virtual void populateSubscribedValuesCHROMIUM(WGC3Denum target) { } virtual void uniformValuebufferCHROMIUM(WGC3Dint location, WGC3Denum target, WGC3Denum subscription) { } - // GL_CHROMIUM_texture_mailbox - virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) { } - virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { } - virtual void produceTextureDirectCHROMIUM(WebGLId texture, WGC3Denum target, const WGC3Dbyte* mailbox) { } - - virtual WebGLId createAndConsumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { return 0; } - // GL_EXT_debug_marker virtual void pushGroupMarkerEXT(const WGC3Dchar* marker) { } @@ -385,9 +311,6 @@ public: virtual void getActiveUniformsiv(WebGLId program, WGC3Dsizei uniformCount, const WGC3Duint *uniformIndices, WGC3Denum pname, WGC3Dint *params) { } virtual void getBufferParameteri64v(WGC3Denum target, WGC3Denum pname, WGC3Dint64 *value) { } virtual WGC3Dint getFragDataLocation(WebGLId program, const WGC3Dchar *name) { return -1; } - virtual void getInteger64v(WGC3Denum pname, WGC3Dint64 *data) { } - virtual void getIntegeri_v(WGC3Denum target, WGC3Duint index, WGC3Dint *data) { } - virtual void getInteger64i_v(WGC3Denum target, WGC3Duint index, WGC3Dint64 *data) { } virtual void getInternalformativ(WGC3Denum target, WGC3Denum internalformat, WGC3Denum pname, WGC3Dsizei bufSize, WGC3Dint *params) { } virtual void getSamplerParameterfv(WebGLId sampler, WGC3Denum pname, WGC3Dfloat *params) { } virtual void getSamplerParameteriv(WebGLId sampler, WGC3Denum pname, WGC3Dint *params) { } |