diff options
Diffstat (limited to 'third_party/WebKit/Source')
12 files changed, 232 insertions, 236 deletions
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp index 0301507..810ff9e 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp @@ -699,7 +699,7 @@ void WebGL2RenderingContextBase::renderbufferStorageImpl( synthesizeGLError(GL_INVALID_OPERATION, functionName, "samples out of range"); return; } - webContext()->renderbufferStorageMultisampleCHROMIUM( + contextGL()->RenderbufferStorageMultisampleCHROMIUM( target, samples, internalformat, width, height); } break; diff --git a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp index 4c007df..9ef1517 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp @@ -114,7 +114,7 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web return false; Platform3DObject fbo = context->createFramebuffer(); - context->bindFramebuffer(GL_FRAMEBUFFER, fbo); + gl->BindFramebuffer(GL_FRAMEBUFFER, fbo); const unsigned char* buffer = 0; // Chromium doesn't allow init data for depth/stencil tetxures. bool supportsDepth = (extensionsUtil->supportsExtension("GL_CHROMIUM_depth_texture") @@ -125,13 +125,13 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web Platform3DObject depthStencil = 0; if (supportsDepthStencil) { depthStencil = context->createTexture(); - context->bindTexture(GL_TEXTURE_2D, depthStencil); + gl->BindTexture(GL_TEXTURE_2D, depthStencil); context->texImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, 1, 1, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, buffer); } Platform3DObject depth = 0; if (supportsDepth) { depth = context->createTexture(); - context->bindTexture(GL_TEXTURE_2D, depth); + gl->BindTexture(GL_TEXTURE_2D, depth); context->texImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 1, 1, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buffer); } @@ -141,16 +141,16 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web for (GLint i = 0; i < maxAllowedBuffers; ++i) { Platform3DObject color = context->createTexture(); colors.append(color); - context->bindTexture(GL_TEXTURE_2D, color); + gl->BindTexture(GL_TEXTURE_2D, color); context->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, color, 0); - if (context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { + if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { ok = false; break; } if (supportsDepth) { gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth, 0); - if (context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { + if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { ok = false; break; } @@ -159,7 +159,7 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web if (supportsDepthStencil) { gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0); gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0); - if (context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { + if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { ok = false; break; } diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index 1fa00a8..2cca13e 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp @@ -150,7 +150,7 @@ WebGLRenderingContextBase* WebGLRenderingContextBase::oldestContext() ASSERT(!candidate->isContextLost()); for (WebGLRenderingContextBase* context : activeContexts()) { ASSERT(!context->isContextLost()); - if (context->webContext()->lastFlushID() < candidate->webContext()->lastFlushID()) { + if (context->contextGL()->GetLastFlushIdCHROMIUM() < candidate->contextGL()->GetLastFlushIdCHROMIUM()) { candidate = context; } } @@ -1162,28 +1162,28 @@ WebGLRenderingContextBase::HowToClear WebGLRenderingContextBase::clearIfComposit // Determine if it's possible to combine the clear the user asked for and this clear. bool combinedClear = mask && !m_scissorEnabled; - webContext()->disable(GL_SCISSOR_TEST); + contextGL()->Disable(GL_SCISSOR_TEST); if (combinedClear && (mask & GL_COLOR_BUFFER_BIT)) { - webContext()->clearColor(m_colorMask[0] ? m_clearColor[0] : 0, + contextGL()->ClearColor(m_colorMask[0] ? m_clearColor[0] : 0, m_colorMask[1] ? m_clearColor[1] : 0, m_colorMask[2] ? m_clearColor[2] : 0, m_colorMask[3] ? m_clearColor[3] : 0); } else { - webContext()->clearColor(0, 0, 0, 0); + contextGL()->ClearColor(0, 0, 0, 0); } - webContext()->colorMask(true, true, true, true); + contextGL()->ColorMask(true, true, true, true); GLbitfield clearMask = GL_COLOR_BUFFER_BIT; if (contextAttributes.get().depth()) { if (!combinedClear || !m_depthMask || !(mask & GL_DEPTH_BUFFER_BIT)) - webContext()->clearDepth(1.0f); + contextGL()->ClearDepthf(1.0f); clearMask |= GL_DEPTH_BUFFER_BIT; - webContext()->depthMask(true); + contextGL()->DepthMask(true); } if (contextAttributes.get().stencil() || drawingBuffer()->hasImplicitStencilBuffer()) { if (combinedClear && (mask & GL_STENCIL_BUFFER_BIT)) - webContext()->clearStencil(m_clearStencil & m_stencilMask); + contextGL()->ClearStencil(m_clearStencil & m_stencilMask); else - webContext()->clearStencil(0); + contextGL()->ClearStencil(0); clearMask |= GL_STENCIL_BUFFER_BIT; webContext()->stencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); } @@ -1204,15 +1204,15 @@ void WebGLRenderingContextBase::restoreStateAfterClear() // Restore the state that the context set. if (m_scissorEnabled) - webContext()->enable(GL_SCISSOR_TEST); - webContext()->clearColor(m_clearColor[0], m_clearColor[1], + contextGL()->Enable(GL_SCISSOR_TEST); + contextGL()->ClearColor(m_clearColor[0], m_clearColor[1], m_clearColor[2], m_clearColor[3]); - webContext()->colorMask(m_colorMask[0], m_colorMask[1], + contextGL()->ColorMask(m_colorMask[0], m_colorMask[1], m_colorMask[2], m_colorMask[3]); - webContext()->clearDepth(m_clearDepth); - webContext()->clearStencil(m_clearStencil); + contextGL()->ClearDepthf(m_clearDepth); + contextGL()->ClearStencil(m_clearStencil); webContext()->stencilMaskSeparate(GL_FRONT, m_stencilMask); - webContext()->depthMask(m_depthMask); + contextGL()->DepthMask(m_depthMask); } void WebGLRenderingContextBase::markLayerComposited() @@ -1314,8 +1314,8 @@ void WebGLRenderingContextBase::reshape(int width, int height) drawingBuffer()->reset(IntSize(width, height)); restoreStateAfterClear(); - webContext()->bindTexture(GL_TEXTURE_2D, objectOrZero(m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get())); - webContext()->bindRenderbuffer(GL_RENDERBUFFER, objectOrZero(m_renderbufferBinding.get())); + contextGL()->BindTexture(GL_TEXTURE_2D, objectOrZero(m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get())); + contextGL()->BindRenderbuffer(GL_RENDERBUFFER, objectOrZero(m_renderbufferBinding.get())); drawingBuffer()->restoreFramebufferBindings(); } @@ -1338,7 +1338,7 @@ void WebGLRenderingContextBase::activeTexture(GLenum texture) return; } m_activeTextureUnit = texture - GL_TEXTURE0; - webContext()->activeTexture(texture); + contextGL()->ActiveTexture(texture); drawingBuffer()->setActiveTextureUnit(texture); @@ -1352,7 +1352,7 @@ void WebGLRenderingContextBase::attachShader(ScriptState* scriptState, WebGLProg synthesizeGLError(GL_INVALID_OPERATION, "attachShader", "shader attachment already has shader"); return; } - webContext()->attachShader(objectOrZero(program), objectOrZero(shader)); + contextGL()->AttachShader(objectOrZero(program), objectOrZero(shader)); shader->onAttached(); preserveObjectWrapper(scriptState, program, "shader", shader->type(), shader); } @@ -1367,7 +1367,7 @@ void WebGLRenderingContextBase::bindAttribLocation(WebGLProgram* program, GLuint synthesizeGLError(GL_INVALID_OPERATION, "bindAttribLocation", "reserved prefix"); return; } - webContext()->bindAttribLocation(objectOrZero(program), index, name.utf8().data()); + contextGL()->BindAttribLocation(objectOrZero(program), index, name.utf8().data()); } bool WebGLRenderingContextBase::checkObjectToBeBound(const char* functionName, WebGLObject* object, bool& deleted) @@ -1422,7 +1422,7 @@ void WebGLRenderingContextBase::bindBuffer(ScriptState* scriptState, GLenum targ if (!validateAndUpdateBufferBindTarget("bindBuffer", target, buffer)) return; - webContext()->bindBuffer(target, objectOrZero(buffer)); + contextGL()->BindBuffer(target, objectOrZero(buffer)); preserveObjectWrapper(scriptState, this, "buffer", target, buffer); maybePreserveDefaultVAOObjectWrapper(scriptState); } @@ -1460,7 +1460,7 @@ void WebGLRenderingContextBase::bindRenderbuffer(ScriptState* scriptState, GLenu return; } m_renderbufferBinding = renderBuffer; - webContext()->bindRenderbuffer(target, objectOrZero(renderBuffer)); + contextGL()->BindRenderbuffer(target, objectOrZero(renderBuffer)); preserveObjectWrapper(scriptState, this, "renderbuffer", 0, renderBuffer); if (renderBuffer) renderBuffer->setHasEverBeenBound(); @@ -1499,7 +1499,7 @@ void WebGLRenderingContextBase::bindTexture(ScriptState* scriptState, GLenum tar return; } - webContext()->bindTexture(target, objectOrZero(texture)); + contextGL()->BindTexture(target, objectOrZero(texture)); // This is called both internally and externally (from JavaScript). We only update which wrapper // is preserved when it's called from JavaScript. if (scriptState) { @@ -1530,21 +1530,21 @@ void WebGLRenderingContextBase::blendColor(GLfloat red, GLfloat green, GLfloat b { if (isContextLost()) return; - webContext()->blendColor(red, green, blue, alpha); + contextGL()->BlendColor(red, green, blue, alpha); } void WebGLRenderingContextBase::blendEquation(GLenum mode) { if (isContextLost() || !validateBlendEquation("blendEquation", mode)) return; - webContext()->blendEquation(mode); + contextGL()->BlendEquation(mode); } void WebGLRenderingContextBase::blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { if (isContextLost() || !validateBlendEquation("blendEquationSeparate", modeRGB) || !validateBlendEquation("blendEquationSeparate", modeAlpha)) return; - webContext()->blendEquationSeparate(modeRGB, modeAlpha); + contextGL()->BlendEquationSeparate(modeRGB, modeAlpha); } @@ -1552,7 +1552,7 @@ void WebGLRenderingContextBase::blendFunc(GLenum sfactor, GLenum dfactor) { if (isContextLost() || !validateBlendFuncFactors("blendFunc", sfactor, dfactor)) return; - webContext()->blendFunc(sfactor, dfactor); + contextGL()->BlendFunc(sfactor, dfactor); } void WebGLRenderingContextBase::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) @@ -1560,7 +1560,7 @@ void WebGLRenderingContextBase::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, // Note: Alpha does not have the same restrictions as RGB. if (isContextLost() || !validateBlendFuncFactors("blendFuncSeparate", srcRGB, dstRGB)) return; - webContext()->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + contextGL()->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } void WebGLRenderingContextBase::bufferDataImpl(GLenum target, long long size, const void* data, GLenum usage) @@ -1577,7 +1577,7 @@ void WebGLRenderingContextBase::bufferDataImpl(GLenum target, long long size, co buffer->setSize(size); - webContext()->bufferData(target, static_cast<GLsizeiptr>(size), data, usage); + contextGL()->BufferData(target, static_cast<GLsizeiptr>(size), data, usage); } void WebGLRenderingContextBase::bufferData(GLenum target, long long size, GLenum usage) @@ -1623,7 +1623,7 @@ void WebGLRenderingContextBase::bufferSubDataImpl(GLenum target, long long offse return; } - webContext()->bufferSubData(target, static_cast<GLintptr>(offset), size, data); + contextGL()->BufferSubData(target, static_cast<GLintptr>(offset), size, data); } void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data) @@ -1684,7 +1684,7 @@ GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) return status; } } - return webContext()->checkFramebufferStatus(target); + return contextGL()->CheckFramebufferStatus(target); } void WebGLRenderingContextBase::clear(GLbitfield mask) @@ -1708,7 +1708,7 @@ void WebGLRenderingContextBase::clear(GLbitfield mask) // claim that the stencil buffer doesn't exist. mask |= GL_STENCIL_BUFFER_BIT; } - webContext()->clear(mask); + contextGL()->Clear(mask); } markContextChanged(CanvasChanged); } @@ -1729,7 +1729,7 @@ void WebGLRenderingContextBase::clearColor(GLfloat r, GLfloat g, GLfloat b, GLfl m_clearColor[1] = g; m_clearColor[2] = b; m_clearColor[3] = a; - webContext()->clearColor(r, g, b, a); + contextGL()->ClearColor(r, g, b, a); } void WebGLRenderingContextBase::clearDepth(GLfloat depth) @@ -1737,7 +1737,7 @@ void WebGLRenderingContextBase::clearDepth(GLfloat depth) if (isContextLost()) return; m_clearDepth = depth; - webContext()->clearDepth(depth); + contextGL()->ClearDepthf(depth); } void WebGLRenderingContextBase::clearStencil(GLint s) @@ -1745,7 +1745,7 @@ void WebGLRenderingContextBase::clearStencil(GLint s) if (isContextLost()) return; m_clearStencil = s; - webContext()->clearStencil(s); + contextGL()->ClearStencil(s); } void WebGLRenderingContextBase::colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) @@ -1756,14 +1756,14 @@ void WebGLRenderingContextBase::colorMask(GLboolean red, GLboolean green, GLbool m_colorMask[1] = green; m_colorMask[2] = blue; m_colorMask[3] = alpha; - webContext()->colorMask(red, green, blue, alpha); + contextGL()->ColorMask(red, green, blue, alpha); } void WebGLRenderingContextBase::compileShader(WebGLShader* shader) { if (isContextLost() || !validateWebGLObject("compileShader", shader)) return; - webContext()->compileShader(objectOrZero(shader)); + contextGL()->CompileShader(objectOrZero(shader)); } void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, DOMArrayBufferView* data) @@ -1774,7 +1774,7 @@ void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, GLint level, return; if (!validateCompressedTexFormat("compressedTexImage2D", internalformat)) return; - webContext()->compressedTexImage2D(target, level, internalformat, width, height, + contextGL()->CompressedTexImage2D(target, level, internalformat, width, height, border, data->byteLength(), data->baseAddress()); } @@ -1786,7 +1786,7 @@ void WebGLRenderingContextBase::compressedTexSubImage2D(GLenum target, GLint lev return; if (!validateCompressedTexFormat("compressedTexSubImage2D", format)) return; - webContext()->compressedTexSubImage2D(target, level, xoffset, yoffset, + contextGL()->CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data->byteLength(), data->baseAddress()); } @@ -1832,7 +1832,7 @@ void WebGLRenderingContextBase::copyTexImage2D(GLenum target, GLint level, GLenu return; clearIfComposited(); ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding); - webContext()->copyTexImage2D(target, level, internalformat, x, y, width, height, border); + contextGL()->CopyTexImage2D(target, level, internalformat, x, y, width, height, border); } void WebGLRenderingContextBase::copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) @@ -1846,7 +1846,7 @@ void WebGLRenderingContextBase::copyTexSubImage2D(GLenum target, GLint level, GL return; clearIfComposited(); ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding); - webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + contextGL()->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); } WebGLBuffer* WebGLRenderingContextBase::createBuffer() @@ -1922,7 +1922,7 @@ void WebGLRenderingContextBase::cullFace(GLenum mode) { if (isContextLost()) return; - webContext()->cullFace(mode); + contextGL()->CullFace(mode); } bool WebGLRenderingContextBase::deleteObject(WebGLObject* object) @@ -2027,7 +2027,7 @@ void WebGLRenderingContextBase::depthFunc(GLenum func) { if (isContextLost()) return; - webContext()->depthFunc(func); + contextGL()->DepthFunc(func); } void WebGLRenderingContextBase::depthMask(GLboolean flag) @@ -2035,7 +2035,7 @@ void WebGLRenderingContextBase::depthMask(GLboolean flag) if (isContextLost()) return; m_depthMask = flag; - webContext()->depthMask(flag); + contextGL()->DepthMask(flag); } void WebGLRenderingContextBase::depthRange(GLfloat zNear, GLfloat zFar) @@ -2047,7 +2047,7 @@ void WebGLRenderingContextBase::depthRange(GLfloat zNear, GLfloat zFar) synthesizeGLError(GL_INVALID_OPERATION, "depthRange", "zNear > zFar"); return; } - webContext()->depthRange(zNear, zFar); + contextGL()->DepthRangef(zNear, zFar); } void WebGLRenderingContextBase::detachShader(ScriptState* scriptState, WebGLProgram* program, WebGLShader* shader) @@ -2058,7 +2058,7 @@ void WebGLRenderingContextBase::detachShader(ScriptState* scriptState, WebGLProg synthesizeGLError(GL_INVALID_OPERATION, "detachShader", "shader not attached"); return; } - webContext()->detachShader(objectOrZero(program), objectOrZero(shader)); + contextGL()->DetachShader(objectOrZero(program), objectOrZero(shader)); shader->onDetached(webContext()); preserveObjectWrapper(scriptState, program, "shader", shader->type(), nullptr); } @@ -2076,7 +2076,7 @@ void WebGLRenderingContextBase::disable(GLenum cap) m_scissorEnabled = false; drawingBuffer()->setScissorEnabled(m_scissorEnabled); } - webContext()->disable(cap); + contextGL()->Disable(cap); } void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index) @@ -2088,7 +2088,7 @@ void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index) return; } - webContext()->disableVertexAttribArray(index); + contextGL()->DisableVertexAttribArray(index); } bool WebGLRenderingContextBase::validateRenderingState(const char* functionName) @@ -2121,7 +2121,7 @@ void WebGLRenderingContextBase::drawArrays(GLenum mode, GLint first, GLsizei cou return; clearIfComposited(); - webContext()->drawArrays(mode, first, count); + contextGL()->DrawArrays(mode, first, count); markContextChanged(CanvasChanged); } @@ -2173,7 +2173,7 @@ void WebGLRenderingContextBase::enable(GLenum cap) m_scissorEnabled = true; drawingBuffer()->setScissorEnabled(m_scissorEnabled); } - webContext()->enable(cap); + contextGL()->Enable(cap); } void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) @@ -2185,7 +2185,7 @@ void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) return; } - webContext()->enableVertexAttribArray(index); + contextGL()->EnableVertexAttribArray(index); } void WebGLRenderingContextBase::finish() @@ -3811,7 +3811,7 @@ void WebGLRenderingContextBase::bindValuebufferCHROMIUM(GLenum target, CHROMIUMV if (deleted) valuebuffer = 0; m_valuebufferBinding = valuebuffer; - webContext()->bindValuebufferCHROMIUM(target, objectOrZero(valuebuffer)); + contextGL()->BindValuebufferCHROMIUM(target, objectOrZero(valuebuffer)); if (valuebuffer) valuebuffer->setHasEverBeenBound(); } @@ -4069,7 +4069,7 @@ void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy targetInternalformat = GL_RGBA; targetType = GL_UNSIGNED_BYTE; targetTexture = webContext()->createTexture(); - webContext()->bindTexture(GL_TEXTURE_2D, targetTexture); + contextGL()->BindTexture(GL_TEXTURE_2D, targetTexture); webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -4080,14 +4080,14 @@ void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy if (!canvas->is3D()) { ImageBuffer* buffer = canvas->buffer(); - if (!buffer->copyToPlatformTexture(webContext(), targetTexture, targetInternalformat, targetType, + if (!buffer->copyToPlatformTexture(webContext(), contextGL(), targetTexture, targetInternalformat, targetType, targetLevel, m_unpackPremultiplyAlpha, m_unpackFlipY)) { ASSERT_NOT_REACHED(); } } else { WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas->renderingContext()); ScopedTexture2DRestorer restorer(gl); - if (!gl->drawingBuffer()->copyToPlatformTexture(webContext(), targetTexture, targetInternalformat, targetType, + if (!gl->drawingBuffer()->copyToPlatformTexture(webContext(), contextGL(), targetTexture, targetInternalformat, targetType, targetLevel, m_unpackPremultiplyAlpha, !m_unpackFlipY, BackBuffer)) { ASSERT_NOT_REACHED(); } @@ -4095,13 +4095,13 @@ void WebGLRenderingContextBase::texImageCanvasByGPU(TexImageByGPUType functionTy if (!possibleDirectCopy) { WebGLId tmpFBO = webContext()->createFramebuffer(); - webContext()->bindFramebuffer(GL_FRAMEBUFFER, tmpFBO); + contextGL()->BindFramebuffer(GL_FRAMEBUFFER, tmpFBO); contextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, targetTexture, 0); - webContext()->bindTexture(texture->getTarget(), texture->object()); + contextGL()->BindTexture(texture->getTarget(), texture->object()); if (functionType == TexImage2DByGPU) { - webContext()->copyTexSubImage2D(target, level, 0, 0, 0, 0, canvas->width(), canvas->height()); + contextGL()->CopyTexSubImage2D(target, level, 0, 0, 0, 0, canvas->width(), canvas->height()); } else if (functionType == TexSubImage2DByGPU) { - webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, 0, 0, canvas->width(), canvas->height()); + contextGL()->CopyTexSubImage2D(target, level, xoffset, yoffset, 0, 0, canvas->width(), canvas->height()); } else if (functionType == TexSubImage3DByGPU) { webContext()->copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, 0, 0, canvas->width(), canvas->height()); } @@ -4183,7 +4183,7 @@ void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLint int video->paintCurrentFrame(imageBuffer->canvas(), IntRect(0, 0, video->videoWidth(), video->videoHeight()), nullptr); // This is a straight GPU-GPU copy, any necessary color space conversion was handled in the paintCurrentFrameInContext() call. - if (imageBuffer->copyToPlatformTexture(webContext(), texture->object(), internalformat, type, + if (imageBuffer->copyToPlatformTexture(webContext(), contextGL(), texture->object(), internalformat, type, level, m_unpackPremultiplyAlpha, m_unpackFlipY)) { return; } @@ -6097,9 +6097,9 @@ void WebGLRenderingContextBase::enableOrDisable(GLenum capability, bool enable) if (isContextLost()) return; if (enable) - webContext()->enable(capability); + contextGL()->Enable(capability); else - webContext()->disable(capability); + contextGL()->Disable(capability); } IntSize WebGLRenderingContextBase::clampedCanvasSize() @@ -6149,7 +6149,7 @@ void WebGLRenderingContextBase::setFramebuffer(GLenum target, WebGLFramebuffer* // Instead of binding fb 0, bind the drawing buffer. drawingBuffer()->bind(target); } else { - webContext()->bindFramebuffer(target, buffer->object()); + contextGL()->BindFramebuffer(target, buffer->object()); } } diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp index 21d3da2..19d3be5 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp @@ -217,6 +217,7 @@ bool Canvas2DLayerBridge::prepareIOSurfaceMailboxFromImage(SkImage* image, WebEx if (imageInfo.empty()) return false; + 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); @@ -226,14 +227,14 @@ bool Canvas2DLayerBridge::prepareIOSurfaceMailboxFromImage(SkImage* image, WebEx context()->produceTextureDirectCHROMIUM(imageInfo.m_textureId, info.m_mailbox.textureTarget, info.m_mailbox.name); info.m_mailbox.allowOverlay = true; - const WGC3Duint64 fenceSync = context()->insertFenceSyncCHROMIUM(); + const WGC3Duint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); context()->flush(); info.m_mailbox.validSyncToken = context()->genSyncTokenCHROMIUM(fenceSync, info.m_mailbox.syncToken); info.m_imageInfo = imageInfo; *outMailbox = info.m_mailbox; - context()->bindTexture(GC3D_TEXTURE_RECTANGLE_ARB, 0); + gl->BindTexture(GC3D_TEXTURE_RECTANGLE_ARB, 0); // Because we are changing the texture binding without going through skia, // we must dirty the context. @@ -251,6 +252,7 @@ Canvas2DLayerBridge::ImageInfo Canvas2DLayerBridge::createIOSurfaceBackedTexture } WebGraphicsContext3D* webContext = context(); + gpu::gles2::GLES2Interface* gl = contextGL(); GLuint imageId = webContext->createGpuMemoryBufferImageCHROMIUM(m_size.width(), m_size.height(), GL_BGRA_EXT, GC3D_SCANOUT_CHROMIUM); if (!imageId) return Canvas2DLayerBridge::ImageInfo(); @@ -262,7 +264,7 @@ Canvas2DLayerBridge::ImageInfo Canvas2DLayerBridge::createIOSurfaceBackedTexture } GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; - webContext->bindTexture(target, textureId); + gl->BindTexture(target, textureId); webContext->texParameteri(target, GL_TEXTURE_MAG_FILTER, getGLFilter()); webContext->texParameteri(target, GL_TEXTURE_MIN_FILTER, getGLFilter()); webContext->texParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -274,16 +276,17 @@ Canvas2DLayerBridge::ImageInfo Canvas2DLayerBridge::createIOSurfaceBackedTexture void Canvas2DLayerBridge::deleteCHROMIUMImage(ImageInfo info) { - if (m_contextProvider->contextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) + WebGraphicsContext3D* webContext = context(); + gpu::gles2::GLES2Interface* gl = contextGL(); + if (gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) return; GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; - WebGraphicsContext3D* webContext = context(); - webContext->bindTexture(target, info.m_textureId); + gl->BindTexture(target, info.m_textureId); webContext->releaseTexImage2DCHROMIUM(target, info.m_imageId); webContext->destroyImageCHROMIUM(info.m_imageId); webContext->deleteTexture(info.m_textureId); - webContext->bindTexture(target, 0); + gl->BindTexture(target, 0); resetSkiaTextureBinding(); } @@ -341,8 +344,9 @@ bool Canvas2DLayerBridge::prepareMailboxFromImage(PassRefPtr<SkImage> image, Web mailboxInfo.m_mailbox.textureTarget = GL_TEXTURE_2D; WebGraphicsContext3D* webContext = context(); + gpu::gles2::GLES2Interface* gl = contextGL(); GLuint textureID = skia::GrBackendObjectToGrGLTextureInfo(mailboxInfo.m_image->getTextureHandle(true))->fID; - webContext->bindTexture(GL_TEXTURE_2D, textureID); + gl->BindTexture(GL_TEXTURE_2D, textureID); webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, getGLFilter()); webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, getGLFilter()); webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -366,11 +370,11 @@ bool Canvas2DLayerBridge::prepareMailboxFromImage(PassRefPtr<SkImage> image, Web } else { // 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 WGC3Duint64 fenceSync = webContext->insertFenceSyncCHROMIUM(); + const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); webContext->flush(); mailboxInfo.m_mailbox.validSyncToken = webContext->genSyncTokenCHROMIUM(fenceSync, mailboxInfo.m_mailbox.syncToken); } - webContext->bindTexture(GL_TEXTURE_2D, 0); + gl->BindTexture(GL_TEXTURE_2D, 0); // Because we are changing the texture binding without going through skia, // we must dirty the context. grContext->resetContext(kTextureBinding_GrGLBackendState); @@ -718,6 +722,17 @@ WebGraphicsContext3D* Canvas2DLayerBridge::context() return m_contextProvider ? m_contextProvider->context3d() : 0; } +gpu::gles2::GLES2Interface* Canvas2DLayerBridge::contextGL() +{ + // Check on m_layer is necessary because contextGL() may be called during + // the destruction of m_layer + if (m_layer && !m_destructionInProgress) { + // Ensure rate limiter is disabled if context is lost. + checkSurfaceValid(); + } + return m_contextProvider ? m_contextProvider->contextGL() : nullptr; +} + bool Canvas2DLayerBridge::checkSurfaceValid() { ASSERT(!m_destructionInProgress); @@ -844,7 +859,7 @@ void Canvas2DLayerBridge::mailboxReleased(const WebExternalTextureMailbox& mailb ASSERT(releasedMailboxInfo->m_imageInfo.empty()); #endif // USE_IOSURFACE_FOR_2D_CANVAS if (mailbox.validSyncToken) { - context()->waitSyncTokenCHROMIUM(mailbox.syncToken); + contextGL()->WaitSyncTokenCHROMIUM(mailbox.syncToken); } GrTexture* texture = releasedMailboxInfo->m_image->getTexture(); if (texture) { diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h index c3dc4ca..fc314be 100644 --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.h @@ -45,6 +45,12 @@ class SkPictureRecorder; +namespace gpu { +namespace gles2 { +class GLES2Interface; +} +} + namespace blink { class Canvas2DLayerBridgeHistogramLogger; @@ -176,6 +182,7 @@ private: Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize&, int msaaSampleCount, OpacityMode, AccelerationMode); WebGraphicsContext3D* context(); + gpu::gles2::GLES2Interface* contextGL(); void startRecording(); void skipQueuedDrawCommands(); void flushRecordingOnly(); diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp index 0d45edd..78e01fb 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp @@ -32,7 +32,7 @@ #include "platform/graphics/ImageBuffer.h" -#include "GrContext.h" +#include "gpu/command_buffer/client/gles2_interface.h" #include "platform/MIMETypeRegistry.h" #include "platform/geometry/IntRect.h" #include "platform/graphics/GraphicsContext.h" @@ -52,6 +52,7 @@ #include "public/platform/WebGraphicsContext3DProvider.h" #include "skia/ext/texture_handle.h" #include "third_party/skia/include/core/SkPicture.h" +#include "third_party/skia/include/gpu/GrContext.h" #include "third_party/skia/include/gpu/gl/GrGLTypes.h" #include "wtf/ArrayBufferContents.h" #include "wtf/MathExtras.h" @@ -177,7 +178,7 @@ WebLayer* ImageBuffer::platformLayer() const return m_surface->layer(); } -bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlpha, bool flipY) +bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gles2::GLES2Interface* gl, Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlpha, bool flipY) { if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalFormat, destType, level)) return false; @@ -203,6 +204,7 @@ bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3 if (!provider) return false; WebGraphicsContext3D* sharedContext = provider->context3d(); + gpu::gles2::GLES2Interface* sharedGL = provider->contextGL(); OwnPtr<WebExternalTextureMailbox> mailbox = adoptPtr(new WebExternalTextureMailbox); mailbox->textureSize = WebSize(textureImage->width(), textureImage->height()); @@ -210,12 +212,12 @@ bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3 // 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); - const WGC3Duint64 sharedFenceSync = sharedContext->insertFenceSyncCHROMIUM(); + const GLuint64 sharedFenceSync = sharedGL->InsertFenceSyncCHROMIUM(); sharedContext->flush(); mailbox->validSyncToken = sharedContext->genSyncTokenCHROMIUM(sharedFenceSync, mailbox->syncToken); if (mailbox->validSyncToken) - context->waitSyncTokenCHROMIUM(mailbox->syncToken); + gl->WaitSyncTokenCHROMIUM(mailbox->syncToken); Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(textureInfo->fTarget, mailbox->name); @@ -225,13 +227,13 @@ bool ImageBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3 context->deleteTexture(sourceTexture); - const WGC3Duint64 contextFenceSync = context->insertFenceSyncCHROMIUM(); + const GLuint64 contextFenceSync = gl->InsertFenceSyncCHROMIUM(); context->flush(); WGC3Dbyte syncToken[24]; if (context->genSyncTokenCHROMIUM(contextFenceSync, syncToken)) - sharedContext->waitSyncTokenCHROMIUM(syncToken); + sharedGL->WaitSyncTokenCHROMIUM(syncToken); // Undo grContext texture binding changes introduced in this function provider->grContext()->resetContext(kTextureBinding_GrGLBackendState); @@ -247,13 +249,14 @@ bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(DrawingBuffer* drawingBu if (!provider) return false; WebGraphicsContext3D* context3D = provider->context3d(); + gpu::gles2::GLES2Interface* gl = provider->contextGL(); Platform3DObject textureId = m_surface->getBackingTextureHandleForOverwrite(); if (!textureId) return false; context3D->flush(); - return drawingBuffer->copyToPlatformTexture(context3D, textureId, GL_RGBA, + return drawingBuffer->copyToPlatformTexture(context3D, gl, textureId, GL_RGBA, GL_UNSIGNED_BYTE, 0, true, false, sourceBuffer); } diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.h b/third_party/WebKit/Source/platform/graphics/ImageBuffer.h index a794d6c..83039ac 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.h @@ -45,6 +45,12 @@ #include "wtf/Vector.h" #include "wtf/text/WTFString.h" +namespace gpu { +namespace gles2 { +class GLES2Interface; +} +} + namespace WTF { class ArrayBufferContents; @@ -118,7 +124,7 @@ public: // with textures that are RGB or RGBA format, UNSIGNED_BYTE type and level 0, as specified in // Extensions3D::canUseCopyTextureCHROMIUM(). // Destroys the TEXTURE_2D binding for the active texture unit of the passed context - bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject, GLenum, GLenum, GLint, bool, bool); + bool copyToPlatformTexture(WebGraphicsContext3D*, gpu::gles2::GLES2Interface*, Platform3DObject, GLenum, GLenum, GLint, bool, bool); bool copyRenderingResultsFromDrawingBuffer(DrawingBuffer*, SourceDrawingBuffer); diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index 1cfa344..861edba 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp @@ -66,21 +66,21 @@ class ScopedTextureUnit0BindingRestorer { STACK_ALLOCATED(); WTF_MAKE_NONCOPYABLE(ScopedTextureUnit0BindingRestorer); public: - ScopedTextureUnit0BindingRestorer(WebGraphicsContext3D* context, GLenum activeTextureUnit, Platform3DObject textureUnitZeroId) - : m_context(context) + ScopedTextureUnit0BindingRestorer(gpu::gles2::GLES2Interface* gl, GLenum activeTextureUnit, Platform3DObject textureUnitZeroId) + : m_gl(gl) , m_oldActiveTextureUnit(activeTextureUnit) , m_oldTextureUnitZeroId(textureUnitZeroId) { - m_context->activeTexture(GL_TEXTURE0); + m_gl->ActiveTexture(GL_TEXTURE0); } ~ScopedTextureUnit0BindingRestorer() { - m_context->bindTexture(GL_TEXTURE_2D, m_oldTextureUnitZeroId); - m_context->activeTexture(m_oldActiveTextureUnit); + m_gl->BindTexture(GL_TEXTURE_2D, m_oldTextureUnitZeroId); + m_gl->ActiveTexture(m_oldActiveTextureUnit); } private: - WebGraphicsContext3D* m_context; + gpu::gles2::GLES2Interface* m_gl; GLenum m_oldActiveTextureUnit; Platform3DObject m_oldTextureUnitZeroId; }; @@ -269,7 +269,7 @@ bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt // We must restore the texture binding since creating new textures, // consuming and producing mailboxes changes it. - ScopedTextureUnit0BindingRestorer restorer(m_context.get(), m_activeTextureUnit, m_texture2DBinding); + ScopedTextureUnit0BindingRestorer restorer(m_gl, m_activeTextureUnit, m_texture2DBinding); // First try to recycle an old buffer. RefPtr<MailboxInfo> frontColorBufferMailbox = recycledMailbox(); @@ -290,13 +290,13 @@ bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt // WebGLRenderingContext::clearIfComposited() call made before the next draw call which restores the framebuffer binding. // If this stops being true at some point, we should track the current framebuffer binding in the DrawingBuffer and restore // it after attaching the new back buffer here. - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); attachColorBufferToCurrentFBO(); if (m_discardFramebufferSupported) { // Explicitly discard framebuffer to save GPU memory bandwidth for tile-based GPU arch. const WGC3Denum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT}; - m_context->discardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments); + 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); @@ -306,7 +306,7 @@ bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt m_contentsChanged = false; m_context->produceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferMailbox->mailbox.name); - const WGC3Duint64 fenceSync = m_context->insertFenceSyncCHROMIUM(); + const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); m_context->flush(); frontColorBufferMailbox->mailbox.validSyncToken = m_context->genSyncTokenCHROMIUM(fenceSync, frontColorBufferMailbox->mailbox.syncToken); frontColorBufferMailbox->mailbox.allowOverlay = frontColorBufferMailbox->textureInfo.imageId != 0; @@ -407,7 +407,7 @@ PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::recycledMailbox() ASSERT(mailboxInfo); if (mailboxInfo->mailbox.validSyncToken) { - m_context->waitSyncTokenCHROMIUM(mailboxInfo->mailbox.syncToken); + m_gl->WaitSyncTokenCHROMIUM(mailboxInfo->mailbox.syncToken); mailboxInfo->mailbox.validSyncToken = false; } @@ -434,7 +434,7 @@ void DrawingBuffer::deleteMailbox(const WebExternalTextureMailbox& mailbox) for (size_t i = 0; i < m_textureMailboxes.size(); i++) { if (nameEquals(m_textureMailboxes[i]->mailbox, mailbox)) { if (mailbox.validSyncToken) - m_context->waitSyncTokenCHROMIUM(mailbox.syncToken); + m_gl->WaitSyncTokenCHROMIUM(mailbox.syncToken); deleteChromiumImageForTexture(&m_textureMailboxes[i]->textureInfo); @@ -470,7 +470,7 @@ bool DrawingBuffer::initialize(const IntSize& size) m_fbo = m_context->createFramebuffer(); - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); createSecondaryBuffers(); // We first try to initialize everything with the requested attributes. if (!reset(size)) @@ -502,7 +502,7 @@ bool DrawingBuffer::initialize(const IntSize& size) return true; } -bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3DObject texture, GLenum internalFormat, +bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, gpu::gles2::GLES2Interface* gl, Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawingBuffer sourceBuffer) { if (m_contentsChanged) { @@ -530,13 +530,13 @@ bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platfor target = m_colorBuffer.parameters.target; m_context->genMailboxCHROMIUM(mailbox.name); m_context->produceTextureDirectCHROMIUM(textureId, target, mailbox.name); - const WGC3Duint64 fenceSync = m_context->insertFenceSyncCHROMIUM(); + const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); m_context->flush(); mailbox.validSyncToken = m_context->genSyncTokenCHROMIUM(fenceSync, mailbox.syncToken); } if (mailbox.validSyncToken) - context->waitSyncTokenCHROMIUM(mailbox.syncToken); + gl->WaitSyncTokenCHROMIUM(mailbox.syncToken); Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(target, mailbox.name); GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; @@ -550,12 +550,12 @@ bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platfor context->deleteTexture(sourceTexture); - const WGC3Duint64 fenceSync = context->insertFenceSyncCHROMIUM(); + const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); context->flush(); GLbyte syncToken[24]; if (context->genSyncTokenCHROMIUM(fenceSync, syncToken)) - m_context->waitSyncTokenCHROMIUM(syncToken); + m_gl->WaitSyncTokenCHROMIUM(syncToken); return true; } @@ -634,7 +634,7 @@ WebGLId DrawingBuffer::createColorTexture(const TextureParameters& parameters) if (!offscreenColorTexture) return 0; - m_context->bindTexture(parameters.target, offscreenColorTexture); + m_gl->BindTexture(parameters.target, offscreenColorTexture); m_context->texParameteri(parameters.target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); m_context->texParameteri(parameters.target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); m_context->texParameteri(parameters.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -648,17 +648,17 @@ void DrawingBuffer::createSecondaryBuffers() // create a multisample FBO if (m_antiAliasingMode == MSAAExplicitResolve) { m_multisampleFBO = m_context->createFramebuffer(); - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); m_multisampleColorBuffer = m_context->createRenderbuffer(); } } bool DrawingBuffer::resizeFramebuffer(const IntSize& size) { - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); if (m_antiAliasingMode != MSAAExplicitResolve) resizeDepthStencil(size); - if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) + if (m_gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) return false; return true; @@ -667,17 +667,17 @@ bool DrawingBuffer::resizeFramebuffer(const IntSize& size) bool DrawingBuffer::resizeMultisampleFramebuffer(const IntSize& size) { if (m_antiAliasingMode == MSAAExplicitResolve) { - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); - m_context->bindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer); - m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sampleCount, m_colorBuffer.parameters.internalRenderbufferFormat, size.width(), size.height()); + m_gl->BindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer); + m_gl->RenderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sampleCount, m_colorBuffer.parameters.internalRenderbufferFormat, size.width(), size.height()); if (m_context->getError() == GL_OUT_OF_MEMORY) return false; m_gl->FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer); resizeDepthStencil(size); - if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) + if (m_gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) return false; } @@ -691,15 +691,15 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size) if (!m_depthStencilBuffer) m_depthStencilBuffer = m_context->createRenderbuffer(); - m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer); + m_gl->BindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer); if (m_antiAliasingMode == MSAAImplicitResolve) m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); else if (m_antiAliasingMode == MSAAExplicitResolve) - m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); + 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->FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer); - m_context->bindRenderbuffer(GL_RENDERBUFFER, 0); + m_gl->BindRenderbuffer(GL_RENDERBUFFER, 0); } @@ -708,12 +708,12 @@ void DrawingBuffer::clearFramebuffers(GLbitfield clearMask) { // We will clear the multisample FBO, but we also need to clear the non-multisampled buffer. if (m_multisampleFBO) { - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); - m_context->clear(GL_COLOR_BUFFER_BIT); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); + m_gl->Clear(GL_COLOR_BUFFER_BIT); } - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo); - m_context->clear(clearMask); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo); + m_gl->Clear(clearMask); } bool DrawingBuffer::hasImplicitStencilBuffer() const @@ -758,7 +758,7 @@ bool DrawingBuffer::reset(const IntSize& newSize) m_colorBuffer = createTextureAndAllocateMemory(adjustedSize); } - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); attachColorBufferToCurrentFBO(); // resize multisample FBO @@ -775,18 +775,18 @@ bool DrawingBuffer::reset(const IntSize& newSize) return false; } - m_context->disable(GL_SCISSOR_TEST); - m_context->clearColor(0, 0, 0, 0); - m_context->colorMask(true, true, true, true); + m_gl->Disable(GL_SCISSOR_TEST); + m_gl->ClearColor(0, 0, 0, 0); + m_gl->ColorMask(true, true, true, true); GLbitfield clearMask = GL_COLOR_BUFFER_BIT; if (m_actualAttributes.depth) { - m_context->clearDepth(1.0f); + m_gl->ClearDepthf(1.0f); clearMask |= GL_DEPTH_BUFFER_BIT; - m_context->depthMask(true); + m_gl->DepthMask(true); } if (m_actualAttributes.stencil) { - m_context->clearStencil(0); + m_gl->ClearStencil(0); clearMask |= GL_STENCIL_BUFFER_BIT; m_context->stencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); } @@ -798,11 +798,11 @@ bool DrawingBuffer::reset(const IntSize& newSize) void DrawingBuffer::commit() { if (m_multisampleFBO && !m_contentsChangeCommitted) { - m_context->bindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, m_multisampleFBO); - m_context->bindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, m_fbo); + m_gl->BindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, m_multisampleFBO); + m_gl->BindFramebuffer(GL_DRAW_FRAMEBUFFER_ANGLE, m_fbo); if (m_scissorEnabled) - m_context->disable(GL_SCISSOR_TEST); + m_gl->Disable(GL_SCISSOR_TEST); int width = m_size.width(); int height = m_size.height(); @@ -810,12 +810,12 @@ void DrawingBuffer::commit() m_context->blitFramebufferCHROMIUM(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST); if (m_scissorEnabled) - m_context->enable(GL_SCISSOR_TEST); + m_gl->Enable(GL_SCISSOR_TEST); } - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_fbo); if (m_antiAliasingMode == ScreenSpaceAntialiasing) { - m_context->applyScreenSpaceAntialiasingCHROMIUM(); + m_gl->ApplyScreenSpaceAntialiasingCHROMIUM(); } m_contentsChangeCommitted = true; } @@ -824,10 +824,10 @@ void DrawingBuffer::restoreFramebufferBindings() { if (m_drawFramebufferBinding && m_readFramebufferBinding) { if (m_drawFramebufferBinding == m_readFramebufferBinding) { - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_readFramebufferBinding); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, m_readFramebufferBinding); } else { - m_context->bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBinding); - m_context->bindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebufferBinding); + m_gl->BindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBinding); + m_gl->BindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebufferBinding); } return; } @@ -837,10 +837,10 @@ void DrawingBuffer::restoreFramebufferBindings() } if (!m_drawFramebufferBinding) { bind(GL_DRAW_FRAMEBUFFER); - m_context->bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBinding); + m_gl->BindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBinding); } else { bind(GL_READ_FRAMEBUFFER); - m_context->bindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebufferBinding); + m_gl->BindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebufferBinding); } } @@ -852,9 +852,9 @@ bool DrawingBuffer::multisample() const void DrawingBuffer::bind(GLenum target) { if (target != GL_READ_FRAMEBUFFER) - m_context->bindFramebuffer(target, m_multisampleFBO ? m_multisampleFBO : m_fbo); + m_gl->BindFramebuffer(target, m_multisampleFBO ? m_multisampleFBO : m_fbo); else - m_context->bindFramebuffer(target, m_fbo); + m_gl->BindFramebuffer(target, m_fbo); } void DrawingBuffer::setPackAlignment(GLint param) @@ -879,10 +879,10 @@ bool DrawingBuffer::paintRenderingResultsToImageData(int& width, int& height, So GLint fbo = 0; if (sourceBuffer == FrontBuffer && m_frontColorBuffer.texInfo.textureId) { fbo = m_context->createFramebuffer(); - m_context->bindFramebuffer(GL_FRAMEBUFFER, fbo); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, fbo); m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_frontColorBuffer.texInfo.parameters.target, m_frontColorBuffer.texInfo.textureId, 0); } else { - m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer()); + m_gl->BindFramebuffer(GL_FRAMEBUFFER, framebuffer()); } readBackFramebuffer(static_cast<unsigned char*>(pixels.data()), width, height, ReadbackRGBA, WebGLImageConversion::AlphaDoNothing); @@ -954,7 +954,7 @@ void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) { if (info->imageId) { - m_context->bindTexture(info->parameters.target, info->textureId); + m_gl->BindTexture(info->parameters.target, info->textureId); m_context->releaseTexImage2DCHROMIUM(info->parameters.target, info->imageId); m_context->destroyImageCHROMIUM(info->imageId); info->imageId = 0; @@ -1013,7 +1013,7 @@ void DrawingBuffer::resizeTextureMemory(TextureInfo* info, const IntSize& size) deleteChromiumImageForTexture(info); info->imageId = m_context->createGpuMemoryBufferImageCHROMIUM(size.width(), size.height(), info->parameters.internalColorFormat, GC3D_SCANOUT_CHROMIUM); if (info->imageId) { - m_context->bindTexture(info->parameters.target, info->textureId); + m_gl->BindTexture(info->parameters.target, info->textureId); m_context->bindTexImage2DCHROMIUM(info->parameters.target, info->imageId); return; } @@ -1024,7 +1024,7 @@ void DrawingBuffer::resizeTextureMemory(TextureInfo* info, const IntSize& size) return; } - m_context->bindTexture(info->parameters.target, info->textureId); + m_gl->BindTexture(info->parameters.target, info->textureId); texImage2DResourceSafe(info->parameters.target, 0, info->parameters.internalColorFormat, size.width(), size.height(), 0, info->parameters.colorFormat, GL_UNSIGNED_BYTE); } @@ -1032,14 +1032,14 @@ void DrawingBuffer::attachColorBufferToCurrentFBO() { WGC3Denum target = m_colorBuffer.parameters.target; - m_context->bindTexture(target, m_colorBuffer.textureId); + m_gl->BindTexture(target, m_colorBuffer.textureId); if (m_antiAliasingMode == MSAAImplicitResolve) m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); else m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, m_colorBuffer.textureId, 0); - m_context->bindTexture(GL_TEXTURE_2D, m_texture2DBinding); + m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); } } // namespace blink diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h index 80e83bf..856619c 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h @@ -161,7 +161,7 @@ public: void mailboxReleased(const WebExternalTextureMailbox&, bool lostResource = false) override; // Destroys the TEXTURE_2D binding for the owned context - bool copyToPlatformTexture(WebGraphicsContext3D*, Platform3DObject texture, GLenum internalFormat, + bool copyToPlatformTexture(WebGraphicsContext3D*, gpu::gles2::GLES2Interface*, Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawingBuffer); void setPackAlignment(GLint param); diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp index 2ced4a1..9b13f2e 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBufferTest.cpp @@ -70,23 +70,8 @@ WGC3Denum drawingBufferTextureTarget(bool allowImageChromium) } // namespace class GLES2InterfaceForTests : public gpu::gles2::GLES2InterfaceStub { -}; - -class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { public: - WebGraphicsContext3DForTests(PassOwnPtr<GLES2InterfaceForTests> contextGL) - : MockWebGraphicsContext3D() - , m_boundTexture(0) - , m_boundTextureTarget(0) - , m_currentMailboxByte(0) - , m_mostRecentlyWaitedSyncToken(0) - , m_currentImageId(1) - , m_allowImageChromium(true) - , m_contextGL(std::move(contextGL)) - { - } - - void bindTexture(WGC3Denum target, WebGLId texture) override + void BindTexture(GLenum target, GLuint texture) override { if (target != m_boundTextureTarget && texture == 0) return; @@ -97,10 +82,46 @@ public: m_boundTexture = texture; } + GLuint64 InsertFenceSyncCHROMIUM() override + { + static WGC3Duint64 syncPointGenerator = 0; + return ++syncPointGenerator; + } + + void WaitSyncTokenCHROMIUM(const GLbyte* syncToken) override + { + memcpy(&m_mostRecentlyWaitedSyncToken, syncToken, sizeof(m_mostRecentlyWaitedSyncToken)); + } + + GLenum CheckFramebufferStatus(GLenum target) override + { + return GL_FRAMEBUFFER_COMPLETE; + } + + uint32_t boundTexture() const { return m_boundTexture; } + uint32_t boundTextureTarget() const { return m_boundTextureTarget; } + uint32_t mostRecentlyWaitedSyncToken() const { return m_mostRecentlyWaitedSyncToken; } + +private: + uint32_t m_boundTexture = 0; + uint32_t m_boundTextureTarget = 0; + uint32_t m_mostRecentlyWaitedSyncToken = 0; +}; + +class WebGraphicsContext3DForTests : public MockWebGraphicsContext3D { +public: + WebGraphicsContext3DForTests(PassOwnPtr<GLES2InterfaceForTests> contextGL) + : m_currentMailboxByte(0) + , m_currentImageId(1) + , m_allowImageChromium(true) + , m_contextGL(std::move(contextGL)) + { + } + 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_boundTexture, IntSize(width, height)); + m_textureSizes.set(m_contextGL->boundTexture(), IntSize(width, height)); } } @@ -123,23 +144,12 @@ public: return m_mostRecentlyProducedSize; } - WGC3Duint64 insertFenceSyncCHROMIUM() override - { - static WGC3Duint64 syncPointGenerator = 0; - return ++syncPointGenerator; - } - bool genSyncTokenCHROMIUM(WGC3Duint64 fenceSync, WGC3Dbyte* syncToken) override { memcpy(syncToken, &fenceSync, sizeof(fenceSync)); return true; } - void waitSyncTokenCHROMIUM(const WGC3Dbyte* syncToken) override - { - memcpy(&m_mostRecentlyWaitedSyncToken, syncToken, sizeof(m_mostRecentlyWaitedSyncToken)); - } - WGC3Duint createGpuMemoryBufferImageCHROMIUM(WGC3Dsizei width, WGC3Dsizei height, WGC3Denum internalformat, WGC3Denum usage) override { if (!m_allowImageChromium) @@ -162,8 +172,8 @@ public: void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId) { if (target == imageTextureTarget()) { - m_textureSizes.set(m_boundTexture, m_imageSizes.find(imageId)->value); - m_imageToTextureMap.set(imageId, m_boundTexture); + m_textureSizes.set(m_contextGL->boundTexture(), m_imageSizes.find(imageId)->value); + m_imageToTextureMap.set(imageId, m_contextGL->boundTexture()); bindTexImage2DMock(imageId); } } @@ -180,7 +190,7 @@ public: WGC3Duint mostRecentlyWaitedSyncToken() { - return m_mostRecentlyWaitedSyncToken; + return m_contextGL->mostRecentlyWaitedSyncToken(); } WGC3Duint nextImageIdToBeCreated() @@ -199,12 +209,9 @@ public: } private: - WebGLId m_boundTexture; - WGC3Denum m_boundTextureTarget; HashMap<WebGLId, IntSize> m_textureSizes; WGC3Dbyte m_currentMailboxByte; IntSize m_mostRecentlyProducedSize; - WGC3Duint m_mostRecentlyWaitedSyncToken; WGC3Duint m_currentImageId; HashMap<WGC3Duint, IntSize> m_imageSizes; HashMap<WGC3Duint, WebGLId> m_imageToTextureMap; @@ -451,7 +458,7 @@ TEST_F(DrawingBufferTest, verifyInsertAndWaitSyncTokenCorrectly) EXPECT_EQ(0u, webContext()->mostRecentlyWaitedSyncToken()); WGC3Duint64 waitSyncToken = 0; - webContext()->genSyncTokenCHROMIUM(webContext()->insertFenceSyncCHROMIUM(), reinterpret_cast<WGC3Dbyte*>(&waitSyncToken)); + webContext()->genSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), reinterpret_cast<WGC3Dbyte*>(&waitSyncToken)); memcpy(mailbox.syncToken, &waitSyncToken, sizeof(waitSyncToken)); mailbox.validSyncToken = true; m_drawingBuffer->mailboxReleased(mailbox, false); @@ -464,7 +471,7 @@ TEST_F(DrawingBufferTest, verifyInsertAndWaitSyncTokenCorrectly) EXPECT_EQ(waitSyncToken, webContext()->mostRecentlyWaitedSyncToken()); m_drawingBuffer->beginDestruction(); - webContext()->genSyncTokenCHROMIUM(webContext()->insertFenceSyncCHROMIUM(), reinterpret_cast<WGC3Dbyte*>(&waitSyncToken)); + webContext()->genSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), reinterpret_cast<WGC3Dbyte*>(&waitSyncToken)); memcpy(mailbox.syncToken, &waitSyncToken, sizeof(waitSyncToken)); mailbox.validSyncToken = true; m_drawingBuffer->mailboxReleased(mailbox, false); @@ -587,6 +594,11 @@ public: } } + GLenum CheckFramebufferStatus(GLenum target) override + { + return GL_FRAMEBUFFER_COMPLETE; + } + uint32_t stencilAttachment() const { return m_stencilAttachment; } uint32_t depthAttachment() const { return m_depthAttachment; } uint32_t depthStencilAttachment() const { return m_depthStencilAttachment; } @@ -717,7 +729,7 @@ TEST_F(DrawingBufferTest, verifySetIsHiddenProperlyAffectsMailboxes) m_drawingBuffer->markContentsChanged(); EXPECT_TRUE(m_drawingBuffer->prepareMailbox(&mailbox, 0)); - mailbox.validSyncToken = webContext()->genSyncTokenCHROMIUM(webContext()->insertFenceSyncCHROMIUM(), mailbox.syncToken); + mailbox.validSyncToken = webContext()->genSyncTokenCHROMIUM(m_gl->InsertFenceSyncCHROMIUM(), mailbox.syncToken); m_drawingBuffer->setIsHidden(true); m_drawingBuffer->mailboxReleased(mailbox); // m_drawingBuffer deletes mailbox immediately when hidden. diff --git a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp index 4941e8d..ce6494c 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/Extensions3DUtil.cpp @@ -69,7 +69,7 @@ bool Extensions3DUtil::ensureExtensionEnabled(const String& name) return true; if (m_requestableExtensions.contains(name)) { - m_context->requestExtensionCHROMIUM(name.ascii().data()); + m_gl->RequestExtensionCHROMIUM(name.ascii().data()); m_enabledExtensions.clear(); m_requestableExtensions.clear(); initializeExtensions(); diff --git a/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h b/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h index 14cde23..a986c12 100644 --- a/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h +++ b/third_party/WebKit/Source/platform/graphics/test/MockWebGraphicsContext3D.h @@ -43,59 +43,12 @@ public: virtual void synthesizeGLError(WGC3Denum) { } - virtual void discardFramebufferEXT(WGC3Denum target, WGC3Dsizei numAttachments, const WGC3Denum* attachments) { } - virtual void ensureFramebufferCHROMIUM() { } - virtual WebString getRequestableExtensionsCHROMIUM() { return WebString(); } - virtual void requestExtensionCHROMIUM(const char*) { } virtual void blitFramebufferCHROMIUM(WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, WGC3Dbitfield mask, WGC3Denum filter) { } - virtual void renderbufferStorageMultisampleCHROMIUM(WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) { } - - virtual void activeTexture(WGC3Denum texture) { } - virtual void attachShader(WebGLId program, WebGLId shader) { } - virtual void bindAttribLocation(WebGLId program, WGC3Duint index, const WGC3Dchar* name) { } - virtual void bindBuffer(WGC3Denum target, WebGLId buffer) { } - virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer) { } - virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer) { } - virtual void bindTexture(WGC3Denum target, WebGLId texture) { } - virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) { } - virtual void blendEquation(WGC3Denum mode) { } - virtual void blendEquationSeparate(WGC3Denum modeRGB, WGC3Denum modeAlpha) { } - virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor) { } - virtual void blendFuncSeparate(WGC3Denum srcRGB, WGC3Denum dstRGB, WGC3Denum srcAlpha, WGC3Denum dstAlpha) { } - - virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, const void* data, WGC3Denum usage) { } - virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, const void* data) { } - - virtual WGC3Denum checkFramebufferStatus(WGC3Denum target) - { - return GL_FRAMEBUFFER_COMPLETE; - } - virtual void clear(WGC3Dbitfield mask) { } - virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) { } - virtual void clearDepth(WGC3Dclampf depth) { } - virtual void clearStencil(WGC3Dint s) { } - virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, WGC3Dboolean blue, WGC3Dboolean alpha) { } - virtual void compileShader(WebGLId shader) { } - - virtual void compressedTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Dsizei imageSize, const void* data) { } - virtual void compressedTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Dsizei imageSize, const void* data) { } - virtual void copyTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border) { } - virtual void copyTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) { } - virtual void cullFace(WGC3Denum mode) { } - virtual void depthFunc(WGC3Denum func) { } - virtual void depthMask(WGC3Dboolean flag) { } - virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar) { } - virtual void detachShader(WebGLId program, WebGLId shader) { } - virtual void disable(WGC3Denum cap) { } - virtual void disableVertexAttribArray(WGC3Duint index) { } - virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count) { } virtual void drawElements(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) { } - virtual void enable(WGC3Denum cap) { } - virtual void enableVertexAttribArray(WGC3Duint index) { } virtual void finish() { } virtual void flush() { } virtual void frontFace(WGC3Denum mode) { } |