Changeset 269768 in webkit


Ignore:
Timestamp:
Nov 13, 2020 1:53:03 AM (3 years ago)
Author:
commit-queue@webkit.org
Message:

Remove uses of MakeCurrent from WebGL implementation
https://bugs.webkit.org/show_bug.cgi?id=218178
<rdar://problem/70714561>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2020-11-13
Reviewed by Dean Jackson.

Work towards WebGL implementation which uses
GraphicsContextGL abstract base class instead of
GraphicsContextGLOpenGL concrete class.

Move GraphicsContextGLOpenGL::makeContextCurrent() to
private section, as it is an implementation detail of
the class. The function is intended to be called at the
start of all public functions that might call into OpenGL
to ensure that OpenGL uses the right context.

Check all return values of makeCurrentContext(). We
should not call into OpenGL if the context is not current,
as that can lead to corruption, crashes or incorrect results.
Add a compile-time warning if the return value is not used.
Non-EWS compiled flavors of GraphicsContextGLOpenGL are changed
only in best effort manner.

Ensure that all functions actually call the makeCurrentContext()
function before calling into OpenGL. Non-ANGLE flavors of
GraphicsContextGLOpenGL are ensured only in best effort manner.

ANGLE flavor of GraphicsContextGLOpenGL function implementations
should call directly the ANGLE functions instead of calling them
through getExtensions() interface. There is no conditional code
inside and the implementation knows exactly which function to
call in all situations. There is no abstraction between
GraphicsContextGLOpenGL and ExtensionsGL, rather they are
in practice the same object currently, semi-artificially split to
two. This is true of other flavors of GraphicsContextGLOpenGL,
but those are left unchanged in this regard.

No new tests, a refactor.

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::WebGLRenderingContextBase::create):
(WebCore::WebGLRenderingContextBase::initializeNewContext):
(WebCore::WebGLRenderingContextBase::validateElementArraySize):
(WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
(WebCore::WebGLRenderingContextBase::validateDrawElements):
(WebCore::WebGLRenderingContextBase::readPixels):
(WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
(WebCore::WebGLRenderingContextBase::initVertexAttrib0):

  • platform/graphics/angle/ExtensionsGLANGLE.cpp:

(WebCore::ExtensionsGLANGLE::supports):
(WebCore::ExtensionsGLANGLE::ensureEnabled):
(WebCore::ExtensionsGLANGLE::getTranslatedShaderSourceANGLE):
(WebCore::ExtensionsGLANGLE::blitFramebuffer):
(WebCore::ExtensionsGLANGLE::renderbufferStorageMultisample):
(WebCore::ExtensionsGLANGLE::createVertexArrayOES):
(WebCore::ExtensionsGLANGLE::deleteVertexArrayOES):
(WebCore::ExtensionsGLANGLE::isVertexArrayOES):
(WebCore::ExtensionsGLANGLE::bindVertexArrayOES):
(WebCore::ExtensionsGLANGLE::drawBuffersEXT):
(WebCore::ExtensionsGLANGLE::drawArraysInstanced):
(WebCore::ExtensionsGLANGLE::drawElementsInstanced):
(WebCore::ExtensionsGLANGLE::vertexAttribDivisor):
(WebCore::ExtensionsGLANGLE::getBooleanvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getBufferParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getFloatvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getFramebufferAttachmentParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getIntegervRobustANGLE):
(WebCore::ExtensionsGLANGLE::getProgramivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getRenderbufferParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getShaderivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexParameterfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getUniformfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getUniformivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getVertexAttribfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getVertexAttribivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getVertexAttribPointervRobustANGLE):
(WebCore::ExtensionsGLANGLE::readPixelsRobustANGLE):
(WebCore::ExtensionsGLANGLE::texImage2DRobustANGLE):
(WebCore::ExtensionsGLANGLE::texParameterfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::texParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::texSubImage2DRobustANGLE):
(WebCore::ExtensionsGLANGLE::compressedTexImage2DRobustANGLE):
(WebCore::ExtensionsGLANGLE::compressedTexSubImage2DRobustANGLE):
(WebCore::ExtensionsGLANGLE::compressedTexImage3DRobustANGLE):
(WebCore::ExtensionsGLANGLE::compressedTexSubImage3DRobustANGLE):
(WebCore::ExtensionsGLANGLE::texImage3DRobustANGLE):
(WebCore::ExtensionsGLANGLE::texSubImage3DRobustANGLE):
(WebCore::ExtensionsGLANGLE::getQueryivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getQueryObjectuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getBufferPointervRobustANGLE):
(WebCore::ExtensionsGLANGLE::getIntegeri_vRobustANGLE):
(WebCore::ExtensionsGLANGLE::getInternalformativRobustANGLE):
(WebCore::ExtensionsGLANGLE::getVertexAttribIivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getVertexAttribIuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getUniformuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getActiveUniformBlockivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getInteger64vRobustANGLE):
(WebCore::ExtensionsGLANGLE::getInteger64i_vRobustANGLE):
(WebCore::ExtensionsGLANGLE::getBufferParameteri64vRobustANGLE):
(WebCore::ExtensionsGLANGLE::samplerParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::samplerParameterfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getSamplerParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getSamplerParameterfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getFramebufferParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getProgramInterfaceivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getBooleani_vRobustANGLE):
(WebCore::ExtensionsGLANGLE::getMultisamplefvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getPointervRobustANGLERobustANGLE):
(WebCore::ExtensionsGLANGLE::readnPixelsRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformfvRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getnUniformuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::texParameterIivRobustANGLE):
(WebCore::ExtensionsGLANGLE::texParameterIuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexParameterIivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getTexParameterIuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::samplerParameterIivRobustANGLE):
(WebCore::ExtensionsGLANGLE::samplerParameterIuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getSamplerParameterIivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getSamplerParameterIuivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getQueryObjectivRobustANGLE):
(WebCore::ExtensionsGLANGLE::getQueryObjecti64vRobustANGLE):
(WebCore::ExtensionsGLANGLE::getQueryObjectui64vRobustANGLE):

  • platform/graphics/angle/GraphicsContextGLANGLE.cpp:

(WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
(WebCore::GraphicsContextGLOpenGL::renderbufferStorage):
(WebCore::GraphicsContextGLOpenGL::getIntegerv):
(WebCore::GraphicsContextGLOpenGL::getIntegeri_v):
(WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat):
(WebCore::GraphicsContextGLOpenGL::depthRange):
(WebCore::GraphicsContextGLOpenGL::clearDepth):
(WebCore::GraphicsContextGLOpenGL::readPixels):
(WebCore::GraphicsContextGLOpenGL::prepareTexture):
(WebCore::GraphicsContextGLOpenGL::readRenderingResults):
(WebCore::GraphicsContextGLOpenGL::reshape):
(WebCore::GraphicsContextGLOpenGL::activeTexture):
(WebCore::GraphicsContextGLOpenGL::attachShader):
(WebCore::GraphicsContextGLOpenGL::bindAttribLocation):
(WebCore::GraphicsContextGLOpenGL::bindBuffer):
(WebCore::GraphicsContextGLOpenGL::bindFramebuffer):
(WebCore::GraphicsContextGLOpenGL::bindRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::bindTexture):
(WebCore::GraphicsContextGLOpenGL::blendColor):
(WebCore::GraphicsContextGLOpenGL::blendEquation):
(WebCore::GraphicsContextGLOpenGL::blendEquationSeparate):
(WebCore::GraphicsContextGLOpenGL::blendFunc):
(WebCore::GraphicsContextGLOpenGL::blendFuncSeparate):
(WebCore::GraphicsContextGLOpenGL::bufferData):
(WebCore::GraphicsContextGLOpenGL::bufferSubData):
(WebCore::GraphicsContextGLOpenGL::mapBufferRange):
(WebCore::GraphicsContextGLOpenGL::unmapBuffer):
(WebCore::GraphicsContextGLOpenGL::copyBufferSubData):
(WebCore::GraphicsContextGLOpenGL::getInternalformativ):
(WebCore::GraphicsContextGLOpenGL::renderbufferStorageMultisample):
(WebCore::GraphicsContextGLOpenGL::texStorage2D):
(WebCore::GraphicsContextGLOpenGL::texStorage3D):
(WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
(WebCore::GraphicsContextGLOpenGL::checkFramebufferStatus):
(WebCore::GraphicsContextGLOpenGL::clearColor):
(WebCore::GraphicsContextGLOpenGL::clear):
(WebCore::GraphicsContextGLOpenGL::clearStencil):
(WebCore::GraphicsContextGLOpenGL::colorMask):
(WebCore::GraphicsContextGLOpenGL::compileShader):
(WebCore::GraphicsContextGLOpenGL::compileShaderDirect):
(WebCore::GraphicsContextGLOpenGL::copyTexImage2D):
(WebCore::GraphicsContextGLOpenGL::copyTexSubImage2D):
(WebCore::GraphicsContextGLOpenGL::cullFace):
(WebCore::GraphicsContextGLOpenGL::depthFunc):
(WebCore::GraphicsContextGLOpenGL::depthMask):
(WebCore::GraphicsContextGLOpenGL::detachShader):
(WebCore::GraphicsContextGLOpenGL::disable):
(WebCore::GraphicsContextGLOpenGL::disableVertexAttribArray):
(WebCore::GraphicsContextGLOpenGL::drawArrays):
(WebCore::GraphicsContextGLOpenGL::drawElements):
(WebCore::GraphicsContextGLOpenGL::enable):
(WebCore::GraphicsContextGLOpenGL::enableVertexAttribArray):
(WebCore::GraphicsContextGLOpenGL::finish):
(WebCore::GraphicsContextGLOpenGL::flush):
(WebCore::GraphicsContextGLOpenGL::framebufferRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::framebufferTexture2D):
(WebCore::GraphicsContextGLOpenGL::frontFace):
(WebCore::GraphicsContextGLOpenGL::generateMipmap):
(WebCore::GraphicsContextGLOpenGL::getActiveAttribImpl):
(WebCore::GraphicsContextGLOpenGL::getActiveUniformImpl):
(WebCore::GraphicsContextGLOpenGL::getAttachedShaders):
(WebCore::GraphicsContextGLOpenGL::getAttribLocation):
(WebCore::GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList):
(WebCore::GraphicsContextGLOpenGL::getError):
(WebCore::GraphicsContextGLOpenGL::getString):
(WebCore::GraphicsContextGLOpenGL::hint):
(WebCore::GraphicsContextGLOpenGL::isBuffer):
(WebCore::GraphicsContextGLOpenGL::isEnabled):
(WebCore::GraphicsContextGLOpenGL::isFramebuffer):
(WebCore::GraphicsContextGLOpenGL::isProgram):
(WebCore::GraphicsContextGLOpenGL::isRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::isShader):
(WebCore::GraphicsContextGLOpenGL::isTexture):
(WebCore::GraphicsContextGLOpenGL::lineWidth):
(WebCore::GraphicsContextGLOpenGL::linkProgram):
(WebCore::GraphicsContextGLOpenGL::pixelStorei):
(WebCore::GraphicsContextGLOpenGL::polygonOffset):
(WebCore::GraphicsContextGLOpenGL::sampleCoverage):
(WebCore::GraphicsContextGLOpenGL::scissor):
(WebCore::GraphicsContextGLOpenGL::shaderSource):
(WebCore::GraphicsContextGLOpenGL::stencilFunc):
(WebCore::GraphicsContextGLOpenGL::stencilFuncSeparate):
(WebCore::GraphicsContextGLOpenGL::stencilMask):
(WebCore::GraphicsContextGLOpenGL::stencilMaskSeparate):
(WebCore::GraphicsContextGLOpenGL::stencilOp):
(WebCore::GraphicsContextGLOpenGL::stencilOpSeparate):
(WebCore::GraphicsContextGLOpenGL::texParameterf):
(WebCore::GraphicsContextGLOpenGL::texParameteri):
(WebCore::GraphicsContextGLOpenGL::uniform1f):
(WebCore::GraphicsContextGLOpenGL::uniform1fv):
(WebCore::GraphicsContextGLOpenGL::uniform2f):
(WebCore::GraphicsContextGLOpenGL::uniform2fv):
(WebCore::GraphicsContextGLOpenGL::uniform3f):
(WebCore::GraphicsContextGLOpenGL::uniform3fv):
(WebCore::GraphicsContextGLOpenGL::uniform4f):
(WebCore::GraphicsContextGLOpenGL::uniform4fv):
(WebCore::GraphicsContextGLOpenGL::uniform1i):
(WebCore::GraphicsContextGLOpenGL::uniform1iv):
(WebCore::GraphicsContextGLOpenGL::uniform2i):
(WebCore::GraphicsContextGLOpenGL::uniform2iv):
(WebCore::GraphicsContextGLOpenGL::uniform3i):
(WebCore::GraphicsContextGLOpenGL::uniform3iv):
(WebCore::GraphicsContextGLOpenGL::uniform4i):
(WebCore::GraphicsContextGLOpenGL::uniform4iv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv):
(WebCore::GraphicsContextGLOpenGL::useProgram):
(WebCore::GraphicsContextGLOpenGL::validateProgram):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib1f):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib1fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib2f):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib2fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib3f):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib3fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib4f):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib4fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttribPointer):
(WebCore::GraphicsContextGLOpenGL::vertexAttribIPointer):
(WebCore::GraphicsContextGLOpenGL::viewport):
(WebCore::GraphicsContextGLOpenGL::createVertexArray):
(WebCore::GraphicsContextGLOpenGL::deleteVertexArray):
(WebCore::GraphicsContextGLOpenGL::isVertexArray):
(WebCore::GraphicsContextGLOpenGL::bindVertexArray):
(WebCore::GraphicsContextGLOpenGL::getBooleanv):
(WebCore::GraphicsContextGLOpenGL::getBufferParameteriv):
(WebCore::GraphicsContextGLOpenGL::getFloatv):
(WebCore::GraphicsContextGLOpenGL::getInteger64v):
(WebCore::GraphicsContextGLOpenGL::getInteger64i_v):
(WebCore::GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv):
(WebCore::GraphicsContextGLOpenGL::getProgramiv):
(WebCore::GraphicsContextGLOpenGL::getProgramInfoLog):
(WebCore::GraphicsContextGLOpenGL::getRenderbufferParameteriv):
(WebCore::GraphicsContextGLOpenGL::getShaderiv):
(WebCore::GraphicsContextGLOpenGL::getShaderInfoLog):
(WebCore::GraphicsContextGLOpenGL::getTexParameterfv):
(WebCore::GraphicsContextGLOpenGL::getTexParameteriv):
(WebCore::GraphicsContextGLOpenGL::getUniformfv):
(WebCore::GraphicsContextGLOpenGL::getUniformiv):
(WebCore::GraphicsContextGLOpenGL::getUniformuiv):
(WebCore::GraphicsContextGLOpenGL::getUniformLocation):
(WebCore::GraphicsContextGLOpenGL::getVertexAttribfv):
(WebCore::GraphicsContextGLOpenGL::getVertexAttribiv):
(WebCore::GraphicsContextGLOpenGL::getVertexAttribOffset):
(WebCore::GraphicsContextGLOpenGL::texSubImage2D):
(WebCore::GraphicsContextGLOpenGL::compressedTexImage2D):
(WebCore::GraphicsContextGLOpenGL::compressedTexSubImage2D):
(WebCore::GraphicsContextGLOpenGL::createBuffer):
(WebCore::GraphicsContextGLOpenGL::createFramebuffer):
(WebCore::GraphicsContextGLOpenGL::createProgram):
(WebCore::GraphicsContextGLOpenGL::createRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::createShader):
(WebCore::GraphicsContextGLOpenGL::createTexture):
(WebCore::GraphicsContextGLOpenGL::deleteBuffer):
(WebCore::GraphicsContextGLOpenGL::deleteFramebuffer):
(WebCore::GraphicsContextGLOpenGL::deleteProgram):
(WebCore::GraphicsContextGLOpenGL::deleteRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::deleteShader):
(WebCore::GraphicsContextGLOpenGL::deleteTexture):
(WebCore::GraphicsContextGLOpenGL::texImage2DDirect):
(WebCore::GraphicsContextGLOpenGL::drawArraysInstanced):
(WebCore::GraphicsContextGLOpenGL::drawElementsInstanced):
(WebCore::GraphicsContextGLOpenGL::vertexAttribDivisor):
(WebCore::GraphicsContextGLOpenGL::getUniformBlockIndex):
(WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName):
(WebCore::GraphicsContextGLOpenGL::uniformBlockBinding):
(WebCore::GraphicsContextGLOpenGL::createQuery):
(WebCore::GraphicsContextGLOpenGL::beginQuery):
(WebCore::GraphicsContextGLOpenGL::endQuery):
(WebCore::GraphicsContextGLOpenGL::getQueryObjectuiv):
(WebCore::GraphicsContextGLOpenGL::createTransformFeedback):
(WebCore::GraphicsContextGLOpenGL::deleteTransformFeedback):
(WebCore::GraphicsContextGLOpenGL::isTransformFeedback):
(WebCore::GraphicsContextGLOpenGL::bindTransformFeedback):
(WebCore::GraphicsContextGLOpenGL::beginTransformFeedback):
(WebCore::GraphicsContextGLOpenGL::endTransformFeedback):
(WebCore::GraphicsContextGLOpenGL::transformFeedbackVaryings):
(WebCore::GraphicsContextGLOpenGL::getTransformFeedbackVarying):
(WebCore::GraphicsContextGLOpenGL::bindBufferBase):
(WebCore::GraphicsContextGLOpenGL::blitFramebuffer):
(WebCore::GraphicsContextGLOpenGL::framebufferTextureLayer):
(WebCore::GraphicsContextGLOpenGL::invalidateFramebuffer):
(WebCore::GraphicsContextGLOpenGL::invalidateSubFramebuffer):
(WebCore::GraphicsContextGLOpenGL::readBuffer):
(WebCore::GraphicsContextGLOpenGL::copyTexSubImage3D):
(WebCore::GraphicsContextGLOpenGL::getFragDataLocation):
(WebCore::GraphicsContextGLOpenGL::uniform1ui):
(WebCore::GraphicsContextGLOpenGL::uniform2ui):
(WebCore::GraphicsContextGLOpenGL::uniform3ui):
(WebCore::GraphicsContextGLOpenGL::uniform4ui):
(WebCore::GraphicsContextGLOpenGL::uniform1uiv):
(WebCore::GraphicsContextGLOpenGL::uniform2uiv):
(WebCore::GraphicsContextGLOpenGL::uniform3uiv):
(WebCore::GraphicsContextGLOpenGL::uniform4uiv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix2x3fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix3x2fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix2x4fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix4x2fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix3x4fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix4x3fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttribI4i):
(WebCore::GraphicsContextGLOpenGL::vertexAttribI4iv):
(WebCore::GraphicsContextGLOpenGL::vertexAttribI4ui):
(WebCore::GraphicsContextGLOpenGL::vertexAttribI4uiv):
(WebCore::GraphicsContextGLOpenGL::drawRangeElements):
(WebCore::GraphicsContextGLOpenGL::drawBuffers):
(WebCore::GraphicsContextGLOpenGL::clearBufferiv):
(WebCore::GraphicsContextGLOpenGL::clearBufferuiv):
(WebCore::GraphicsContextGLOpenGL::clearBufferfv):
(WebCore::GraphicsContextGLOpenGL::clearBufferfi):
(WebCore::GraphicsContextGLOpenGL::deleteQuery):
(WebCore::GraphicsContextGLOpenGL::isQuery):
(WebCore::GraphicsContextGLOpenGL::getQuery):
(WebCore::GraphicsContextGLOpenGL::createSampler):
(WebCore::GraphicsContextGLOpenGL::deleteSampler):
(WebCore::GraphicsContextGLOpenGL::isSampler):
(WebCore::GraphicsContextGLOpenGL::bindSampler):
(WebCore::GraphicsContextGLOpenGL::samplerParameteri):
(WebCore::GraphicsContextGLOpenGL::samplerParameterf):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameterfv):
(WebCore::GraphicsContextGLOpenGL::getSamplerParameteriv):
(WebCore::GraphicsContextGLOpenGL::fenceSync):
(WebCore::GraphicsContextGLOpenGL::isSync):
(WebCore::GraphicsContextGLOpenGL::deleteSync):
(WebCore::GraphicsContextGLOpenGL::clientWaitSync):
(WebCore::GraphicsContextGLOpenGL::waitSync):
(WebCore::GraphicsContextGLOpenGL::getSynciv):
(WebCore::GraphicsContextGLOpenGL::pauseTransformFeedback):
(WebCore::GraphicsContextGLOpenGL::resumeTransformFeedback):
(WebCore::GraphicsContextGLOpenGL::bindBufferRange):
(WebCore::GraphicsContextGLOpenGL::getUniformIndices):

  • platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:

(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::updateCGLContext):

  • platform/graphics/opengl/ExtensionsGLOpenGL.cpp:

(WebCore::ExtensionsGLOpenGL::blitFramebuffer):
(WebCore::ExtensionsGLOpenGL::renderbufferStorageMultisample):
(WebCore::ExtensionsGLOpenGL::createVertexArrayOES):
(WebCore::ExtensionsGLOpenGL::deleteVertexArrayOES):
(WebCore::ExtensionsGLOpenGL::isVertexArrayOES):
(WebCore::ExtensionsGLOpenGL::bindVertexArrayOES):
(WebCore::ExtensionsGLOpenGL::supportsExtension):
(WebCore::ExtensionsGLOpenGL::drawBuffersEXT):
(WebCore::ExtensionsGLOpenGL::drawArraysInstanced):
(WebCore::ExtensionsGLOpenGL::drawElementsInstanced):
(WebCore::ExtensionsGLOpenGL::vertexAttribDivisor):

  • platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:

(WebCore::ExtensionsGLOpenGLES::framebufferTexture2DMultisampleIMG):
(WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisampleIMG):
(WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisample):
(WebCore::ExtensionsGLOpenGLES::createVertexArrayOES):
(WebCore::ExtensionsGLOpenGLES::deleteVertexArrayOES):
(WebCore::ExtensionsGLOpenGLES::isVertexArrayOES):
(WebCore::ExtensionsGLOpenGLES::bindVertexArrayOES):
(WebCore::ExtensionsGLOpenGLES::getGraphicsResetStatusARB):
(WebCore::ExtensionsGLOpenGLES::readnPixelsEXT):
(WebCore::ExtensionsGLOpenGLES::getnUniformfvEXT):
(WebCore::ExtensionsGLOpenGLES::getnUniformivEXT):
(WebCore::ExtensionsGLOpenGLES::drawArraysInstanced):
(WebCore::ExtensionsGLOpenGLES::drawElementsInstanced):
(WebCore::ExtensionsGLOpenGLES::vertexAttribDivisor):

  • platform/graphics/opengl/GraphicsContextGLOpenGL.h:
  • platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp:

(WebCore::GraphicsContextGLOpenGL::renderbufferStorage):
(WebCore::GraphicsContextGLOpenGL::getIntegerv):
(WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat):
(WebCore::GraphicsContextGLOpenGL::depthRange):
(WebCore::GraphicsContextGLOpenGL::clearDepth):
(WebCore::GraphicsContextGLOpenGL::readPixels):

  • platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:

(WebCore::GraphicsContextGLOpenGL::prepareTexture):
(WebCore::GraphicsContextGLOpenGL::readRenderingResults):
(WebCore::GraphicsContextGLOpenGL::reshape):
(WebCore::GraphicsContextGLOpenGL::activeTexture):
(WebCore::GraphicsContextGLOpenGL::attachShader):
(WebCore::GraphicsContextGLOpenGL::bindAttribLocation):
(WebCore::GraphicsContextGLOpenGL::bindBuffer):
(WebCore::GraphicsContextGLOpenGL::bindFramebuffer):
(WebCore::GraphicsContextGLOpenGL::bindRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::bindTexture):
(WebCore::GraphicsContextGLOpenGL::blendColor):
(WebCore::GraphicsContextGLOpenGL::blendEquation):
(WebCore::GraphicsContextGLOpenGL::blendEquationSeparate):
(WebCore::GraphicsContextGLOpenGL::blendFunc):
(WebCore::GraphicsContextGLOpenGL::blendFuncSeparate):
(WebCore::GraphicsContextGLOpenGL::bufferData):
(WebCore::GraphicsContextGLOpenGL::bufferSubData):
(WebCore::GraphicsContextGLOpenGL::checkFramebufferStatus):
(WebCore::GraphicsContextGLOpenGL::clearColor):
(WebCore::GraphicsContextGLOpenGL::clear):
(WebCore::GraphicsContextGLOpenGL::clearStencil):
(WebCore::GraphicsContextGLOpenGL::colorMask):
(WebCore::GraphicsContextGLOpenGL::compileShader):
(WebCore::GraphicsContextGLOpenGL::compileShaderDirect):
(WebCore::GraphicsContextGLOpenGL::copyTexImage2D):
(WebCore::GraphicsContextGLOpenGL::copyTexSubImage2D):
(WebCore::GraphicsContextGLOpenGL::cullFace):
(WebCore::GraphicsContextGLOpenGL::depthFunc):
(WebCore::GraphicsContextGLOpenGL::depthMask):
(WebCore::GraphicsContextGLOpenGL::detachShader):
(WebCore::GraphicsContextGLOpenGL::disable):
(WebCore::GraphicsContextGLOpenGL::disableVertexAttribArray):
(WebCore::GraphicsContextGLOpenGL::drawArrays):
(WebCore::GraphicsContextGLOpenGL::drawElements):
(WebCore::GraphicsContextGLOpenGL::enable):
(WebCore::GraphicsContextGLOpenGL::enableVertexAttribArray):
(WebCore::GraphicsContextGLOpenGL::finish):
(WebCore::GraphicsContextGLOpenGL::flush):
(WebCore::GraphicsContextGLOpenGL::framebufferRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::framebufferTexture2D):
(WebCore::GraphicsContextGLOpenGL::frontFace):
(WebCore::GraphicsContextGLOpenGL::generateMipmap):
(WebCore::GraphicsContextGLOpenGL::getActiveAttribImpl):
(WebCore::GraphicsContextGLOpenGL::getActiveUniformImpl):
(WebCore::GraphicsContextGLOpenGL::getAttachedShaders):
(WebCore::GraphicsContextGLOpenGL::getAttribLocation):
(WebCore::GraphicsContextGLOpenGL::getAttribLocationDirect):
(WebCore::GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList):
(WebCore::GraphicsContextGLOpenGL::getError):
(WebCore::GraphicsContextGLOpenGL::getString):
(WebCore::GraphicsContextGLOpenGL::hint):
(WebCore::GraphicsContextGLOpenGL::isBuffer):
(WebCore::GraphicsContextGLOpenGL::isEnabled):
(WebCore::GraphicsContextGLOpenGL::isFramebuffer):
(WebCore::GraphicsContextGLOpenGL::isProgram):
(WebCore::GraphicsContextGLOpenGL::isRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::isShader):
(WebCore::GraphicsContextGLOpenGL::isTexture):
(WebCore::GraphicsContextGLOpenGL::lineWidth):
(WebCore::GraphicsContextGLOpenGL::linkProgram):
(WebCore::GraphicsContextGLOpenGL::pixelStorei):
(WebCore::GraphicsContextGLOpenGL::polygonOffset):
(WebCore::GraphicsContextGLOpenGL::sampleCoverage):
(WebCore::GraphicsContextGLOpenGL::scissor):
(WebCore::GraphicsContextGLOpenGL::shaderSource):
(WebCore::GraphicsContextGLOpenGL::stencilFunc):
(WebCore::GraphicsContextGLOpenGL::stencilFuncSeparate):
(WebCore::GraphicsContextGLOpenGL::stencilMask):
(WebCore::GraphicsContextGLOpenGL::stencilMaskSeparate):
(WebCore::GraphicsContextGLOpenGL::stencilOp):
(WebCore::GraphicsContextGLOpenGL::stencilOpSeparate):
(WebCore::GraphicsContextGLOpenGL::texParameterf):
(WebCore::GraphicsContextGLOpenGL::texParameteri):
(WebCore::GraphicsContextGLOpenGL::uniform1f):
(WebCore::GraphicsContextGLOpenGL::uniform1fv):
(WebCore::GraphicsContextGLOpenGL::uniform2f):
(WebCore::GraphicsContextGLOpenGL::uniform2fv):
(WebCore::GraphicsContextGLOpenGL::uniform3f):
(WebCore::GraphicsContextGLOpenGL::uniform3fv):
(WebCore::GraphicsContextGLOpenGL::uniform4f):
(WebCore::GraphicsContextGLOpenGL::uniform4fv):
(WebCore::GraphicsContextGLOpenGL::uniform1i):
(WebCore::GraphicsContextGLOpenGL::uniform1iv):
(WebCore::GraphicsContextGLOpenGL::uniform2i):
(WebCore::GraphicsContextGLOpenGL::uniform2iv):
(WebCore::GraphicsContextGLOpenGL::uniform3i):
(WebCore::GraphicsContextGLOpenGL::uniform3iv):
(WebCore::GraphicsContextGLOpenGL::uniform4i):
(WebCore::GraphicsContextGLOpenGL::uniform4iv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv):
(WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv):
(WebCore::GraphicsContextGLOpenGL::useProgram):
(WebCore::GraphicsContextGLOpenGL::validateProgram):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib1f):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib1fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib2f):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib2fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib3f):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib3fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib4f):
(WebCore::GraphicsContextGLOpenGL::vertexAttrib4fv):
(WebCore::GraphicsContextGLOpenGL::vertexAttribPointer):
(WebCore::GraphicsContextGLOpenGL::viewport):
(WebCore::GraphicsContextGLOpenGL::createVertexArray):
(WebCore::GraphicsContextGLOpenGL::deleteVertexArray):
(WebCore::GraphicsContextGLOpenGL::isVertexArray):
(WebCore::GraphicsContextGLOpenGL::bindVertexArray):
(WebCore::GraphicsContextGLOpenGL::getBooleanv):
(WebCore::GraphicsContextGLOpenGL::getBufferParameteriv):
(WebCore::GraphicsContextGLOpenGL::getFloatv):
(WebCore::GraphicsContextGLOpenGL::getIntegeri_v):
(WebCore::GraphicsContextGLOpenGL::getInteger64v):
(WebCore::GraphicsContextGLOpenGL::getInteger64i_v):
(WebCore::GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv):
(WebCore::GraphicsContextGLOpenGL::getProgramiv):
(WebCore::GraphicsContextGLOpenGL::getNonBuiltInActiveSymbolCount):
(WebCore::GraphicsContextGLOpenGL::getProgramInfoLog):
(WebCore::GraphicsContextGLOpenGL::getRenderbufferParameteriv):
(WebCore::GraphicsContextGLOpenGL::getShaderiv):
(WebCore::GraphicsContextGLOpenGL::getShaderInfoLog):
(WebCore::GraphicsContextGLOpenGL::getShaderSource):
(WebCore::GraphicsContextGLOpenGL::getTexParameterfv):
(WebCore::GraphicsContextGLOpenGL::getTexParameteriv):
(WebCore::GraphicsContextGLOpenGL::getUniformfv):
(WebCore::GraphicsContextGLOpenGL::getUniformiv):
(WebCore::GraphicsContextGLOpenGL::getUniformLocation):
(WebCore::GraphicsContextGLOpenGL::getVertexAttribfv):
(WebCore::GraphicsContextGLOpenGL::getVertexAttribiv):
(WebCore::GraphicsContextGLOpenGL::getVertexAttribOffset):
(WebCore::GraphicsContextGLOpenGL::texSubImage2D):
(WebCore::GraphicsContextGLOpenGL::compressedTexImage2D):
(WebCore::GraphicsContextGLOpenGL::compressedTexSubImage2D):
(WebCore::GraphicsContextGLOpenGL::createBuffer):
(WebCore::GraphicsContextGLOpenGL::createFramebuffer):
(WebCore::GraphicsContextGLOpenGL::createProgram):
(WebCore::GraphicsContextGLOpenGL::createRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::createShader):
(WebCore::GraphicsContextGLOpenGL::createTexture):
(WebCore::GraphicsContextGLOpenGL::deleteBuffer):
(WebCore::GraphicsContextGLOpenGL::deleteFramebuffer):
(WebCore::GraphicsContextGLOpenGL::deleteProgram):
(WebCore::GraphicsContextGLOpenGL::deleteRenderbuffer):
(WebCore::GraphicsContextGLOpenGL::deleteShader):
(WebCore::GraphicsContextGLOpenGL::deleteTexture):
(WebCore::GraphicsContextGLOpenGL::texImage2DDirect):
(WebCore::GraphicsContextGLOpenGL::primitiveRestartIndex):
(WebCore::GraphicsContextGLOpenGL::copyBufferSubData):
(WebCore::GraphicsContextGLOpenGL::mapBufferRange):
(WebCore::GraphicsContextGLOpenGL::unmapBuffer):
(WebCore::GraphicsContextGLOpenGL::getInternalformativ):
(WebCore::GraphicsContextGLOpenGL::renderbufferStorageMultisample):
(WebCore::GraphicsContextGLOpenGL::texStorage2D):
(WebCore::GraphicsContextGLOpenGL::texStorage3D):
(WebCore::GraphicsContextGLOpenGL::getActiveUniforms):

  • platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:

(WebCore::GraphicsContextGLOpenGL::readPixels):
(WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
(WebCore::GraphicsContextGLOpenGL::renderbufferStorage):
(WebCore::GraphicsContextGLOpenGL::getIntegerv):
(WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat):
(WebCore::GraphicsContextGLOpenGL::depthRange):
(WebCore::GraphicsContextGLOpenGL::clearDepth):
(WebCore::GraphicsContextGLOpenGL::create):
(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):

  • platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:

(WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
(WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):

Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r269765 r269768  
     12020-11-13  Kimmo Kinnunen  <kkinnunen@apple.com>
     2
     3        Remove uses of MakeCurrent from WebGL implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=218178
     5        <rdar://problem/70714561>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Work towards WebGL implementation which uses
     10        GraphicsContextGL abstract base class instead of
     11        GraphicsContextGLOpenGL concrete class.
     12
     13        Move GraphicsContextGLOpenGL::makeContextCurrent() to
     14        private section, as it is an implementation detail of
     15        the class. The function is intended to be called at the
     16        start of all public functions that might call into OpenGL
     17        to ensure that OpenGL uses the right context.
     18
     19        Check all return values of makeCurrentContext(). We
     20        should not call into OpenGL if the context is not current,
     21        as that can lead to corruption, crashes or incorrect results.
     22        Add a compile-time warning if the return value is not used.
     23        Non-EWS compiled flavors of GraphicsContextGLOpenGL are changed
     24        only in best effort manner.
     25
     26        Ensure that all functions actually call the makeCurrentContext()
     27        function before calling into OpenGL. Non-ANGLE flavors of
     28        GraphicsContextGLOpenGL are ensured only in best effort manner.
     29
     30        ANGLE flavor of GraphicsContextGLOpenGL function implementations
     31        should call directly the ANGLE functions instead of calling them
     32        through getExtensions() interface. There is no conditional code
     33        inside and the implementation knows exactly which function to
     34        call in all situations. There is no abstraction between
     35        GraphicsContextGLOpenGL and ExtensionsGL, rather they are
     36        in practice the same object currently, semi-artificially split to
     37        two. This is true of other flavors of GraphicsContextGLOpenGL,
     38        but those are left unchanged in this regard.
     39
     40        No new tests, a refactor.
     41
     42        * html/canvas/WebGLRenderingContextBase.cpp:
     43        (WebCore::WebGLRenderingContextBase::create):
     44        (WebCore::WebGLRenderingContextBase::initializeNewContext):
     45        (WebCore::WebGLRenderingContextBase::validateElementArraySize):
     46        (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
     47        (WebCore::WebGLRenderingContextBase::validateDrawElements):
     48        (WebCore::WebGLRenderingContextBase::readPixels):
     49        (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
     50        (WebCore::WebGLRenderingContextBase::initVertexAttrib0):
     51        * platform/graphics/angle/ExtensionsGLANGLE.cpp:
     52        (WebCore::ExtensionsGLANGLE::supports):
     53        (WebCore::ExtensionsGLANGLE::ensureEnabled):
     54        (WebCore::ExtensionsGLANGLE::getTranslatedShaderSourceANGLE):
     55        (WebCore::ExtensionsGLANGLE::blitFramebuffer):
     56        (WebCore::ExtensionsGLANGLE::renderbufferStorageMultisample):
     57        (WebCore::ExtensionsGLANGLE::createVertexArrayOES):
     58        (WebCore::ExtensionsGLANGLE::deleteVertexArrayOES):
     59        (WebCore::ExtensionsGLANGLE::isVertexArrayOES):
     60        (WebCore::ExtensionsGLANGLE::bindVertexArrayOES):
     61        (WebCore::ExtensionsGLANGLE::drawBuffersEXT):
     62        (WebCore::ExtensionsGLANGLE::drawArraysInstanced):
     63        (WebCore::ExtensionsGLANGLE::drawElementsInstanced):
     64        (WebCore::ExtensionsGLANGLE::vertexAttribDivisor):
     65        (WebCore::ExtensionsGLANGLE::getBooleanvRobustANGLE):
     66        (WebCore::ExtensionsGLANGLE::getBufferParameterivRobustANGLE):
     67        (WebCore::ExtensionsGLANGLE::getFloatvRobustANGLE):
     68        (WebCore::ExtensionsGLANGLE::getFramebufferAttachmentParameterivRobustANGLE):
     69        (WebCore::ExtensionsGLANGLE::getIntegervRobustANGLE):
     70        (WebCore::ExtensionsGLANGLE::getProgramivRobustANGLE):
     71        (WebCore::ExtensionsGLANGLE::getRenderbufferParameterivRobustANGLE):
     72        (WebCore::ExtensionsGLANGLE::getShaderivRobustANGLE):
     73        (WebCore::ExtensionsGLANGLE::getTexParameterfvRobustANGLE):
     74        (WebCore::ExtensionsGLANGLE::getTexParameterivRobustANGLE):
     75        (WebCore::ExtensionsGLANGLE::getUniformfvRobustANGLE):
     76        (WebCore::ExtensionsGLANGLE::getUniformivRobustANGLE):
     77        (WebCore::ExtensionsGLANGLE::getVertexAttribfvRobustANGLE):
     78        (WebCore::ExtensionsGLANGLE::getVertexAttribivRobustANGLE):
     79        (WebCore::ExtensionsGLANGLE::getVertexAttribPointervRobustANGLE):
     80        (WebCore::ExtensionsGLANGLE::readPixelsRobustANGLE):
     81        (WebCore::ExtensionsGLANGLE::texImage2DRobustANGLE):
     82        (WebCore::ExtensionsGLANGLE::texParameterfvRobustANGLE):
     83        (WebCore::ExtensionsGLANGLE::texParameterivRobustANGLE):
     84        (WebCore::ExtensionsGLANGLE::texSubImage2DRobustANGLE):
     85        (WebCore::ExtensionsGLANGLE::compressedTexImage2DRobustANGLE):
     86        (WebCore::ExtensionsGLANGLE::compressedTexSubImage2DRobustANGLE):
     87        (WebCore::ExtensionsGLANGLE::compressedTexImage3DRobustANGLE):
     88        (WebCore::ExtensionsGLANGLE::compressedTexSubImage3DRobustANGLE):
     89        (WebCore::ExtensionsGLANGLE::texImage3DRobustANGLE):
     90        (WebCore::ExtensionsGLANGLE::texSubImage3DRobustANGLE):
     91        (WebCore::ExtensionsGLANGLE::getQueryivRobustANGLE):
     92        (WebCore::ExtensionsGLANGLE::getQueryObjectuivRobustANGLE):
     93        (WebCore::ExtensionsGLANGLE::getBufferPointervRobustANGLE):
     94        (WebCore::ExtensionsGLANGLE::getIntegeri_vRobustANGLE):
     95        (WebCore::ExtensionsGLANGLE::getInternalformativRobustANGLE):
     96        (WebCore::ExtensionsGLANGLE::getVertexAttribIivRobustANGLE):
     97        (WebCore::ExtensionsGLANGLE::getVertexAttribIuivRobustANGLE):
     98        (WebCore::ExtensionsGLANGLE::getUniformuivRobustANGLE):
     99        (WebCore::ExtensionsGLANGLE::getActiveUniformBlockivRobustANGLE):
     100        (WebCore::ExtensionsGLANGLE::getInteger64vRobustANGLE):
     101        (WebCore::ExtensionsGLANGLE::getInteger64i_vRobustANGLE):
     102        (WebCore::ExtensionsGLANGLE::getBufferParameteri64vRobustANGLE):
     103        (WebCore::ExtensionsGLANGLE::samplerParameterivRobustANGLE):
     104        (WebCore::ExtensionsGLANGLE::samplerParameterfvRobustANGLE):
     105        (WebCore::ExtensionsGLANGLE::getSamplerParameterivRobustANGLE):
     106        (WebCore::ExtensionsGLANGLE::getSamplerParameterfvRobustANGLE):
     107        (WebCore::ExtensionsGLANGLE::getFramebufferParameterivRobustANGLE):
     108        (WebCore::ExtensionsGLANGLE::getProgramInterfaceivRobustANGLE):
     109        (WebCore::ExtensionsGLANGLE::getBooleani_vRobustANGLE):
     110        (WebCore::ExtensionsGLANGLE::getMultisamplefvRobustANGLE):
     111        (WebCore::ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE):
     112        (WebCore::ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE):
     113        (WebCore::ExtensionsGLANGLE::getPointervRobustANGLERobustANGLE):
     114        (WebCore::ExtensionsGLANGLE::readnPixelsRobustANGLE):
     115        (WebCore::ExtensionsGLANGLE::getnUniformfvRobustANGLE):
     116        (WebCore::ExtensionsGLANGLE::getnUniformivRobustANGLE):
     117        (WebCore::ExtensionsGLANGLE::getnUniformuivRobustANGLE):
     118        (WebCore::ExtensionsGLANGLE::texParameterIivRobustANGLE):
     119        (WebCore::ExtensionsGLANGLE::texParameterIuivRobustANGLE):
     120        (WebCore::ExtensionsGLANGLE::getTexParameterIivRobustANGLE):
     121        (WebCore::ExtensionsGLANGLE::getTexParameterIuivRobustANGLE):
     122        (WebCore::ExtensionsGLANGLE::samplerParameterIivRobustANGLE):
     123        (WebCore::ExtensionsGLANGLE::samplerParameterIuivRobustANGLE):
     124        (WebCore::ExtensionsGLANGLE::getSamplerParameterIivRobustANGLE):
     125        (WebCore::ExtensionsGLANGLE::getSamplerParameterIuivRobustANGLE):
     126        (WebCore::ExtensionsGLANGLE::getQueryObjectivRobustANGLE):
     127        (WebCore::ExtensionsGLANGLE::getQueryObjecti64vRobustANGLE):
     128        (WebCore::ExtensionsGLANGLE::getQueryObjectui64vRobustANGLE):
     129        * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
     130        (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
     131        (WebCore::GraphicsContextGLOpenGL::renderbufferStorage):
     132        (WebCore::GraphicsContextGLOpenGL::getIntegerv):
     133        (WebCore::GraphicsContextGLOpenGL::getIntegeri_v):
     134        (WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat):
     135        (WebCore::GraphicsContextGLOpenGL::depthRange):
     136        (WebCore::GraphicsContextGLOpenGL::clearDepth):
     137        (WebCore::GraphicsContextGLOpenGL::readPixels):
     138        (WebCore::GraphicsContextGLOpenGL::prepareTexture):
     139        (WebCore::GraphicsContextGLOpenGL::readRenderingResults):
     140        (WebCore::GraphicsContextGLOpenGL::reshape):
     141        (WebCore::GraphicsContextGLOpenGL::activeTexture):
     142        (WebCore::GraphicsContextGLOpenGL::attachShader):
     143        (WebCore::GraphicsContextGLOpenGL::bindAttribLocation):
     144        (WebCore::GraphicsContextGLOpenGL::bindBuffer):
     145        (WebCore::GraphicsContextGLOpenGL::bindFramebuffer):
     146        (WebCore::GraphicsContextGLOpenGL::bindRenderbuffer):
     147        (WebCore::GraphicsContextGLOpenGL::bindTexture):
     148        (WebCore::GraphicsContextGLOpenGL::blendColor):
     149        (WebCore::GraphicsContextGLOpenGL::blendEquation):
     150        (WebCore::GraphicsContextGLOpenGL::blendEquationSeparate):
     151        (WebCore::GraphicsContextGLOpenGL::blendFunc):
     152        (WebCore::GraphicsContextGLOpenGL::blendFuncSeparate):
     153        (WebCore::GraphicsContextGLOpenGL::bufferData):
     154        (WebCore::GraphicsContextGLOpenGL::bufferSubData):
     155        (WebCore::GraphicsContextGLOpenGL::mapBufferRange):
     156        (WebCore::GraphicsContextGLOpenGL::unmapBuffer):
     157        (WebCore::GraphicsContextGLOpenGL::copyBufferSubData):
     158        (WebCore::GraphicsContextGLOpenGL::getInternalformativ):
     159        (WebCore::GraphicsContextGLOpenGL::renderbufferStorageMultisample):
     160        (WebCore::GraphicsContextGLOpenGL::texStorage2D):
     161        (WebCore::GraphicsContextGLOpenGL::texStorage3D):
     162        (WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
     163        (WebCore::GraphicsContextGLOpenGL::checkFramebufferStatus):
     164        (WebCore::GraphicsContextGLOpenGL::clearColor):
     165        (WebCore::GraphicsContextGLOpenGL::clear):
     166        (WebCore::GraphicsContextGLOpenGL::clearStencil):
     167        (WebCore::GraphicsContextGLOpenGL::colorMask):
     168        (WebCore::GraphicsContextGLOpenGL::compileShader):
     169        (WebCore::GraphicsContextGLOpenGL::compileShaderDirect):
     170        (WebCore::GraphicsContextGLOpenGL::copyTexImage2D):
     171        (WebCore::GraphicsContextGLOpenGL::copyTexSubImage2D):
     172        (WebCore::GraphicsContextGLOpenGL::cullFace):
     173        (WebCore::GraphicsContextGLOpenGL::depthFunc):
     174        (WebCore::GraphicsContextGLOpenGL::depthMask):
     175        (WebCore::GraphicsContextGLOpenGL::detachShader):
     176        (WebCore::GraphicsContextGLOpenGL::disable):
     177        (WebCore::GraphicsContextGLOpenGL::disableVertexAttribArray):
     178        (WebCore::GraphicsContextGLOpenGL::drawArrays):
     179        (WebCore::GraphicsContextGLOpenGL::drawElements):
     180        (WebCore::GraphicsContextGLOpenGL::enable):
     181        (WebCore::GraphicsContextGLOpenGL::enableVertexAttribArray):
     182        (WebCore::GraphicsContextGLOpenGL::finish):
     183        (WebCore::GraphicsContextGLOpenGL::flush):
     184        (WebCore::GraphicsContextGLOpenGL::framebufferRenderbuffer):
     185        (WebCore::GraphicsContextGLOpenGL::framebufferTexture2D):
     186        (WebCore::GraphicsContextGLOpenGL::frontFace):
     187        (WebCore::GraphicsContextGLOpenGL::generateMipmap):
     188        (WebCore::GraphicsContextGLOpenGL::getActiveAttribImpl):
     189        (WebCore::GraphicsContextGLOpenGL::getActiveUniformImpl):
     190        (WebCore::GraphicsContextGLOpenGL::getAttachedShaders):
     191        (WebCore::GraphicsContextGLOpenGL::getAttribLocation):
     192        (WebCore::GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList):
     193        (WebCore::GraphicsContextGLOpenGL::getError):
     194        (WebCore::GraphicsContextGLOpenGL::getString):
     195        (WebCore::GraphicsContextGLOpenGL::hint):
     196        (WebCore::GraphicsContextGLOpenGL::isBuffer):
     197        (WebCore::GraphicsContextGLOpenGL::isEnabled):
     198        (WebCore::GraphicsContextGLOpenGL::isFramebuffer):
     199        (WebCore::GraphicsContextGLOpenGL::isProgram):
     200        (WebCore::GraphicsContextGLOpenGL::isRenderbuffer):
     201        (WebCore::GraphicsContextGLOpenGL::isShader):
     202        (WebCore::GraphicsContextGLOpenGL::isTexture):
     203        (WebCore::GraphicsContextGLOpenGL::lineWidth):
     204        (WebCore::GraphicsContextGLOpenGL::linkProgram):
     205        (WebCore::GraphicsContextGLOpenGL::pixelStorei):
     206        (WebCore::GraphicsContextGLOpenGL::polygonOffset):
     207        (WebCore::GraphicsContextGLOpenGL::sampleCoverage):
     208        (WebCore::GraphicsContextGLOpenGL::scissor):
     209        (WebCore::GraphicsContextGLOpenGL::shaderSource):
     210        (WebCore::GraphicsContextGLOpenGL::stencilFunc):
     211        (WebCore::GraphicsContextGLOpenGL::stencilFuncSeparate):
     212        (WebCore::GraphicsContextGLOpenGL::stencilMask):
     213        (WebCore::GraphicsContextGLOpenGL::stencilMaskSeparate):
     214        (WebCore::GraphicsContextGLOpenGL::stencilOp):
     215        (WebCore::GraphicsContextGLOpenGL::stencilOpSeparate):
     216        (WebCore::GraphicsContextGLOpenGL::texParameterf):
     217        (WebCore::GraphicsContextGLOpenGL::texParameteri):
     218        (WebCore::GraphicsContextGLOpenGL::uniform1f):
     219        (WebCore::GraphicsContextGLOpenGL::uniform1fv):
     220        (WebCore::GraphicsContextGLOpenGL::uniform2f):
     221        (WebCore::GraphicsContextGLOpenGL::uniform2fv):
     222        (WebCore::GraphicsContextGLOpenGL::uniform3f):
     223        (WebCore::GraphicsContextGLOpenGL::uniform3fv):
     224        (WebCore::GraphicsContextGLOpenGL::uniform4f):
     225        (WebCore::GraphicsContextGLOpenGL::uniform4fv):
     226        (WebCore::GraphicsContextGLOpenGL::uniform1i):
     227        (WebCore::GraphicsContextGLOpenGL::uniform1iv):
     228        (WebCore::GraphicsContextGLOpenGL::uniform2i):
     229        (WebCore::GraphicsContextGLOpenGL::uniform2iv):
     230        (WebCore::GraphicsContextGLOpenGL::uniform3i):
     231        (WebCore::GraphicsContextGLOpenGL::uniform3iv):
     232        (WebCore::GraphicsContextGLOpenGL::uniform4i):
     233        (WebCore::GraphicsContextGLOpenGL::uniform4iv):
     234        (WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv):
     235        (WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv):
     236        (WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv):
     237        (WebCore::GraphicsContextGLOpenGL::useProgram):
     238        (WebCore::GraphicsContextGLOpenGL::validateProgram):
     239        (WebCore::GraphicsContextGLOpenGL::vertexAttrib1f):
     240        (WebCore::GraphicsContextGLOpenGL::vertexAttrib1fv):
     241        (WebCore::GraphicsContextGLOpenGL::vertexAttrib2f):
     242        (WebCore::GraphicsContextGLOpenGL::vertexAttrib2fv):
     243        (WebCore::GraphicsContextGLOpenGL::vertexAttrib3f):
     244        (WebCore::GraphicsContextGLOpenGL::vertexAttrib3fv):
     245        (WebCore::GraphicsContextGLOpenGL::vertexAttrib4f):
     246        (WebCore::GraphicsContextGLOpenGL::vertexAttrib4fv):
     247        (WebCore::GraphicsContextGLOpenGL::vertexAttribPointer):
     248        (WebCore::GraphicsContextGLOpenGL::vertexAttribIPointer):
     249        (WebCore::GraphicsContextGLOpenGL::viewport):
     250        (WebCore::GraphicsContextGLOpenGL::createVertexArray):
     251        (WebCore::GraphicsContextGLOpenGL::deleteVertexArray):
     252        (WebCore::GraphicsContextGLOpenGL::isVertexArray):
     253        (WebCore::GraphicsContextGLOpenGL::bindVertexArray):
     254        (WebCore::GraphicsContextGLOpenGL::getBooleanv):
     255        (WebCore::GraphicsContextGLOpenGL::getBufferParameteriv):
     256        (WebCore::GraphicsContextGLOpenGL::getFloatv):
     257        (WebCore::GraphicsContextGLOpenGL::getInteger64v):
     258        (WebCore::GraphicsContextGLOpenGL::getInteger64i_v):
     259        (WebCore::GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv):
     260        (WebCore::GraphicsContextGLOpenGL::getProgramiv):
     261        (WebCore::GraphicsContextGLOpenGL::getProgramInfoLog):
     262        (WebCore::GraphicsContextGLOpenGL::getRenderbufferParameteriv):
     263        (WebCore::GraphicsContextGLOpenGL::getShaderiv):
     264        (WebCore::GraphicsContextGLOpenGL::getShaderInfoLog):
     265        (WebCore::GraphicsContextGLOpenGL::getTexParameterfv):
     266        (WebCore::GraphicsContextGLOpenGL::getTexParameteriv):
     267        (WebCore::GraphicsContextGLOpenGL::getUniformfv):
     268        (WebCore::GraphicsContextGLOpenGL::getUniformiv):
     269        (WebCore::GraphicsContextGLOpenGL::getUniformuiv):
     270        (WebCore::GraphicsContextGLOpenGL::getUniformLocation):
     271        (WebCore::GraphicsContextGLOpenGL::getVertexAttribfv):
     272        (WebCore::GraphicsContextGLOpenGL::getVertexAttribiv):
     273        (WebCore::GraphicsContextGLOpenGL::getVertexAttribOffset):
     274        (WebCore::GraphicsContextGLOpenGL::texSubImage2D):
     275        (WebCore::GraphicsContextGLOpenGL::compressedTexImage2D):
     276        (WebCore::GraphicsContextGLOpenGL::compressedTexSubImage2D):
     277        (WebCore::GraphicsContextGLOpenGL::createBuffer):
     278        (WebCore::GraphicsContextGLOpenGL::createFramebuffer):
     279        (WebCore::GraphicsContextGLOpenGL::createProgram):
     280        (WebCore::GraphicsContextGLOpenGL::createRenderbuffer):
     281        (WebCore::GraphicsContextGLOpenGL::createShader):
     282        (WebCore::GraphicsContextGLOpenGL::createTexture):
     283        (WebCore::GraphicsContextGLOpenGL::deleteBuffer):
     284        (WebCore::GraphicsContextGLOpenGL::deleteFramebuffer):
     285        (WebCore::GraphicsContextGLOpenGL::deleteProgram):
     286        (WebCore::GraphicsContextGLOpenGL::deleteRenderbuffer):
     287        (WebCore::GraphicsContextGLOpenGL::deleteShader):
     288        (WebCore::GraphicsContextGLOpenGL::deleteTexture):
     289        (WebCore::GraphicsContextGLOpenGL::texImage2DDirect):
     290        (WebCore::GraphicsContextGLOpenGL::drawArraysInstanced):
     291        (WebCore::GraphicsContextGLOpenGL::drawElementsInstanced):
     292        (WebCore::GraphicsContextGLOpenGL::vertexAttribDivisor):
     293        (WebCore::GraphicsContextGLOpenGL::getUniformBlockIndex):
     294        (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName):
     295        (WebCore::GraphicsContextGLOpenGL::uniformBlockBinding):
     296        (WebCore::GraphicsContextGLOpenGL::createQuery):
     297        (WebCore::GraphicsContextGLOpenGL::beginQuery):
     298        (WebCore::GraphicsContextGLOpenGL::endQuery):
     299        (WebCore::GraphicsContextGLOpenGL::getQueryObjectuiv):
     300        (WebCore::GraphicsContextGLOpenGL::createTransformFeedback):
     301        (WebCore::GraphicsContextGLOpenGL::deleteTransformFeedback):
     302        (WebCore::GraphicsContextGLOpenGL::isTransformFeedback):
     303        (WebCore::GraphicsContextGLOpenGL::bindTransformFeedback):
     304        (WebCore::GraphicsContextGLOpenGL::beginTransformFeedback):
     305        (WebCore::GraphicsContextGLOpenGL::endTransformFeedback):
     306        (WebCore::GraphicsContextGLOpenGL::transformFeedbackVaryings):
     307        (WebCore::GraphicsContextGLOpenGL::getTransformFeedbackVarying):
     308        (WebCore::GraphicsContextGLOpenGL::bindBufferBase):
     309        (WebCore::GraphicsContextGLOpenGL::blitFramebuffer):
     310        (WebCore::GraphicsContextGLOpenGL::framebufferTextureLayer):
     311        (WebCore::GraphicsContextGLOpenGL::invalidateFramebuffer):
     312        (WebCore::GraphicsContextGLOpenGL::invalidateSubFramebuffer):
     313        (WebCore::GraphicsContextGLOpenGL::readBuffer):
     314        (WebCore::GraphicsContextGLOpenGL::copyTexSubImage3D):
     315        (WebCore::GraphicsContextGLOpenGL::getFragDataLocation):
     316        (WebCore::GraphicsContextGLOpenGL::uniform1ui):
     317        (WebCore::GraphicsContextGLOpenGL::uniform2ui):
     318        (WebCore::GraphicsContextGLOpenGL::uniform3ui):
     319        (WebCore::GraphicsContextGLOpenGL::uniform4ui):
     320        (WebCore::GraphicsContextGLOpenGL::uniform1uiv):
     321        (WebCore::GraphicsContextGLOpenGL::uniform2uiv):
     322        (WebCore::GraphicsContextGLOpenGL::uniform3uiv):
     323        (WebCore::GraphicsContextGLOpenGL::uniform4uiv):
     324        (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x3fv):
     325        (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x2fv):
     326        (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x4fv):
     327        (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x2fv):
     328        (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x4fv):
     329        (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x3fv):
     330        (WebCore::GraphicsContextGLOpenGL::vertexAttribI4i):
     331        (WebCore::GraphicsContextGLOpenGL::vertexAttribI4iv):
     332        (WebCore::GraphicsContextGLOpenGL::vertexAttribI4ui):
     333        (WebCore::GraphicsContextGLOpenGL::vertexAttribI4uiv):
     334        (WebCore::GraphicsContextGLOpenGL::drawRangeElements):
     335        (WebCore::GraphicsContextGLOpenGL::drawBuffers):
     336        (WebCore::GraphicsContextGLOpenGL::clearBufferiv):
     337        (WebCore::GraphicsContextGLOpenGL::clearBufferuiv):
     338        (WebCore::GraphicsContextGLOpenGL::clearBufferfv):
     339        (WebCore::GraphicsContextGLOpenGL::clearBufferfi):
     340        (WebCore::GraphicsContextGLOpenGL::deleteQuery):
     341        (WebCore::GraphicsContextGLOpenGL::isQuery):
     342        (WebCore::GraphicsContextGLOpenGL::getQuery):
     343        (WebCore::GraphicsContextGLOpenGL::createSampler):
     344        (WebCore::GraphicsContextGLOpenGL::deleteSampler):
     345        (WebCore::GraphicsContextGLOpenGL::isSampler):
     346        (WebCore::GraphicsContextGLOpenGL::bindSampler):
     347        (WebCore::GraphicsContextGLOpenGL::samplerParameteri):
     348        (WebCore::GraphicsContextGLOpenGL::samplerParameterf):
     349        (WebCore::GraphicsContextGLOpenGL::getSamplerParameterfv):
     350        (WebCore::GraphicsContextGLOpenGL::getSamplerParameteriv):
     351        (WebCore::GraphicsContextGLOpenGL::fenceSync):
     352        (WebCore::GraphicsContextGLOpenGL::isSync):
     353        (WebCore::GraphicsContextGLOpenGL::deleteSync):
     354        (WebCore::GraphicsContextGLOpenGL::clientWaitSync):
     355        (WebCore::GraphicsContextGLOpenGL::waitSync):
     356        (WebCore::GraphicsContextGLOpenGL::getSynciv):
     357        (WebCore::GraphicsContextGLOpenGL::pauseTransformFeedback):
     358        (WebCore::GraphicsContextGLOpenGL::resumeTransformFeedback):
     359        (WebCore::GraphicsContextGLOpenGL::bindBufferRange):
     360        (WebCore::GraphicsContextGLOpenGL::getUniformIndices):
     361        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
     362        (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
     363        (WebCore::GraphicsContextGLOpenGL::updateCGLContext):
     364        * platform/graphics/opengl/ExtensionsGLOpenGL.cpp:
     365        (WebCore::ExtensionsGLOpenGL::blitFramebuffer):
     366        (WebCore::ExtensionsGLOpenGL::renderbufferStorageMultisample):
     367        (WebCore::ExtensionsGLOpenGL::createVertexArrayOES):
     368        (WebCore::ExtensionsGLOpenGL::deleteVertexArrayOES):
     369        (WebCore::ExtensionsGLOpenGL::isVertexArrayOES):
     370        (WebCore::ExtensionsGLOpenGL::bindVertexArrayOES):
     371        (WebCore::ExtensionsGLOpenGL::supportsExtension):
     372        (WebCore::ExtensionsGLOpenGL::drawBuffersEXT):
     373        (WebCore::ExtensionsGLOpenGL::drawArraysInstanced):
     374        (WebCore::ExtensionsGLOpenGL::drawElementsInstanced):
     375        (WebCore::ExtensionsGLOpenGL::vertexAttribDivisor):
     376        * platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:
     377        (WebCore::ExtensionsGLOpenGLES::framebufferTexture2DMultisampleIMG):
     378        (WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisampleIMG):
     379        (WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisample):
     380        (WebCore::ExtensionsGLOpenGLES::createVertexArrayOES):
     381        (WebCore::ExtensionsGLOpenGLES::deleteVertexArrayOES):
     382        (WebCore::ExtensionsGLOpenGLES::isVertexArrayOES):
     383        (WebCore::ExtensionsGLOpenGLES::bindVertexArrayOES):
     384        (WebCore::ExtensionsGLOpenGLES::getGraphicsResetStatusARB):
     385        (WebCore::ExtensionsGLOpenGLES::readnPixelsEXT):
     386        (WebCore::ExtensionsGLOpenGLES::getnUniformfvEXT):
     387        (WebCore::ExtensionsGLOpenGLES::getnUniformivEXT):
     388        (WebCore::ExtensionsGLOpenGLES::drawArraysInstanced):
     389        (WebCore::ExtensionsGLOpenGLES::drawElementsInstanced):
     390        (WebCore::ExtensionsGLOpenGLES::vertexAttribDivisor):
     391        * platform/graphics/opengl/GraphicsContextGLOpenGL.h:
     392        * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp:
     393        (WebCore::GraphicsContextGLOpenGL::renderbufferStorage):
     394        (WebCore::GraphicsContextGLOpenGL::getIntegerv):
     395        (WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat):
     396        (WebCore::GraphicsContextGLOpenGL::depthRange):
     397        (WebCore::GraphicsContextGLOpenGL::clearDepth):
     398        (WebCore::GraphicsContextGLOpenGL::readPixels):
     399        * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp:
     400        (WebCore::GraphicsContextGLOpenGL::prepareTexture):
     401        (WebCore::GraphicsContextGLOpenGL::readRenderingResults):
     402        (WebCore::GraphicsContextGLOpenGL::reshape):
     403        (WebCore::GraphicsContextGLOpenGL::activeTexture):
     404        (WebCore::GraphicsContextGLOpenGL::attachShader):
     405        (WebCore::GraphicsContextGLOpenGL::bindAttribLocation):
     406        (WebCore::GraphicsContextGLOpenGL::bindBuffer):
     407        (WebCore::GraphicsContextGLOpenGL::bindFramebuffer):
     408        (WebCore::GraphicsContextGLOpenGL::bindRenderbuffer):
     409        (WebCore::GraphicsContextGLOpenGL::bindTexture):
     410        (WebCore::GraphicsContextGLOpenGL::blendColor):
     411        (WebCore::GraphicsContextGLOpenGL::blendEquation):
     412        (WebCore::GraphicsContextGLOpenGL::blendEquationSeparate):
     413        (WebCore::GraphicsContextGLOpenGL::blendFunc):
     414        (WebCore::GraphicsContextGLOpenGL::blendFuncSeparate):
     415        (WebCore::GraphicsContextGLOpenGL::bufferData):
     416        (WebCore::GraphicsContextGLOpenGL::bufferSubData):
     417        (WebCore::GraphicsContextGLOpenGL::checkFramebufferStatus):
     418        (WebCore::GraphicsContextGLOpenGL::clearColor):
     419        (WebCore::GraphicsContextGLOpenGL::clear):
     420        (WebCore::GraphicsContextGLOpenGL::clearStencil):
     421        (WebCore::GraphicsContextGLOpenGL::colorMask):
     422        (WebCore::GraphicsContextGLOpenGL::compileShader):
     423        (WebCore::GraphicsContextGLOpenGL::compileShaderDirect):
     424        (WebCore::GraphicsContextGLOpenGL::copyTexImage2D):
     425        (WebCore::GraphicsContextGLOpenGL::copyTexSubImage2D):
     426        (WebCore::GraphicsContextGLOpenGL::cullFace):
     427        (WebCore::GraphicsContextGLOpenGL::depthFunc):
     428        (WebCore::GraphicsContextGLOpenGL::depthMask):
     429        (WebCore::GraphicsContextGLOpenGL::detachShader):
     430        (WebCore::GraphicsContextGLOpenGL::disable):
     431        (WebCore::GraphicsContextGLOpenGL::disableVertexAttribArray):
     432        (WebCore::GraphicsContextGLOpenGL::drawArrays):
     433        (WebCore::GraphicsContextGLOpenGL::drawElements):
     434        (WebCore::GraphicsContextGLOpenGL::enable):
     435        (WebCore::GraphicsContextGLOpenGL::enableVertexAttribArray):
     436        (WebCore::GraphicsContextGLOpenGL::finish):
     437        (WebCore::GraphicsContextGLOpenGL::flush):
     438        (WebCore::GraphicsContextGLOpenGL::framebufferRenderbuffer):
     439        (WebCore::GraphicsContextGLOpenGL::framebufferTexture2D):
     440        (WebCore::GraphicsContextGLOpenGL::frontFace):
     441        (WebCore::GraphicsContextGLOpenGL::generateMipmap):
     442        (WebCore::GraphicsContextGLOpenGL::getActiveAttribImpl):
     443        (WebCore::GraphicsContextGLOpenGL::getActiveUniformImpl):
     444        (WebCore::GraphicsContextGLOpenGL::getAttachedShaders):
     445        (WebCore::GraphicsContextGLOpenGL::getAttribLocation):
     446        (WebCore::GraphicsContextGLOpenGL::getAttribLocationDirect):
     447        (WebCore::GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList):
     448        (WebCore::GraphicsContextGLOpenGL::getError):
     449        (WebCore::GraphicsContextGLOpenGL::getString):
     450        (WebCore::GraphicsContextGLOpenGL::hint):
     451        (WebCore::GraphicsContextGLOpenGL::isBuffer):
     452        (WebCore::GraphicsContextGLOpenGL::isEnabled):
     453        (WebCore::GraphicsContextGLOpenGL::isFramebuffer):
     454        (WebCore::GraphicsContextGLOpenGL::isProgram):
     455        (WebCore::GraphicsContextGLOpenGL::isRenderbuffer):
     456        (WebCore::GraphicsContextGLOpenGL::isShader):
     457        (WebCore::GraphicsContextGLOpenGL::isTexture):
     458        (WebCore::GraphicsContextGLOpenGL::lineWidth):
     459        (WebCore::GraphicsContextGLOpenGL::linkProgram):
     460        (WebCore::GraphicsContextGLOpenGL::pixelStorei):
     461        (WebCore::GraphicsContextGLOpenGL::polygonOffset):
     462        (WebCore::GraphicsContextGLOpenGL::sampleCoverage):
     463        (WebCore::GraphicsContextGLOpenGL::scissor):
     464        (WebCore::GraphicsContextGLOpenGL::shaderSource):
     465        (WebCore::GraphicsContextGLOpenGL::stencilFunc):
     466        (WebCore::GraphicsContextGLOpenGL::stencilFuncSeparate):
     467        (WebCore::GraphicsContextGLOpenGL::stencilMask):
     468        (WebCore::GraphicsContextGLOpenGL::stencilMaskSeparate):
     469        (WebCore::GraphicsContextGLOpenGL::stencilOp):
     470        (WebCore::GraphicsContextGLOpenGL::stencilOpSeparate):
     471        (WebCore::GraphicsContextGLOpenGL::texParameterf):
     472        (WebCore::GraphicsContextGLOpenGL::texParameteri):
     473        (WebCore::GraphicsContextGLOpenGL::uniform1f):
     474        (WebCore::GraphicsContextGLOpenGL::uniform1fv):
     475        (WebCore::GraphicsContextGLOpenGL::uniform2f):
     476        (WebCore::GraphicsContextGLOpenGL::uniform2fv):
     477        (WebCore::GraphicsContextGLOpenGL::uniform3f):
     478        (WebCore::GraphicsContextGLOpenGL::uniform3fv):
     479        (WebCore::GraphicsContextGLOpenGL::uniform4f):
     480        (WebCore::GraphicsContextGLOpenGL::uniform4fv):
     481        (WebCore::GraphicsContextGLOpenGL::uniform1i):
     482        (WebCore::GraphicsContextGLOpenGL::uniform1iv):
     483        (WebCore::GraphicsContextGLOpenGL::uniform2i):
     484        (WebCore::GraphicsContextGLOpenGL::uniform2iv):
     485        (WebCore::GraphicsContextGLOpenGL::uniform3i):
     486        (WebCore::GraphicsContextGLOpenGL::uniform3iv):
     487        (WebCore::GraphicsContextGLOpenGL::uniform4i):
     488        (WebCore::GraphicsContextGLOpenGL::uniform4iv):
     489        (WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv):
     490        (WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv):
     491        (WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv):
     492        (WebCore::GraphicsContextGLOpenGL::useProgram):
     493        (WebCore::GraphicsContextGLOpenGL::validateProgram):
     494        (WebCore::GraphicsContextGLOpenGL::vertexAttrib1f):
     495        (WebCore::GraphicsContextGLOpenGL::vertexAttrib1fv):
     496        (WebCore::GraphicsContextGLOpenGL::vertexAttrib2f):
     497        (WebCore::GraphicsContextGLOpenGL::vertexAttrib2fv):
     498        (WebCore::GraphicsContextGLOpenGL::vertexAttrib3f):
     499        (WebCore::GraphicsContextGLOpenGL::vertexAttrib3fv):
     500        (WebCore::GraphicsContextGLOpenGL::vertexAttrib4f):
     501        (WebCore::GraphicsContextGLOpenGL::vertexAttrib4fv):
     502        (WebCore::GraphicsContextGLOpenGL::vertexAttribPointer):
     503        (WebCore::GraphicsContextGLOpenGL::viewport):
     504        (WebCore::GraphicsContextGLOpenGL::createVertexArray):
     505        (WebCore::GraphicsContextGLOpenGL::deleteVertexArray):
     506        (WebCore::GraphicsContextGLOpenGL::isVertexArray):
     507        (WebCore::GraphicsContextGLOpenGL::bindVertexArray):
     508        (WebCore::GraphicsContextGLOpenGL::getBooleanv):
     509        (WebCore::GraphicsContextGLOpenGL::getBufferParameteriv):
     510        (WebCore::GraphicsContextGLOpenGL::getFloatv):
     511        (WebCore::GraphicsContextGLOpenGL::getIntegeri_v):
     512        (WebCore::GraphicsContextGLOpenGL::getInteger64v):
     513        (WebCore::GraphicsContextGLOpenGL::getInteger64i_v):
     514        (WebCore::GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv):
     515        (WebCore::GraphicsContextGLOpenGL::getProgramiv):
     516        (WebCore::GraphicsContextGLOpenGL::getNonBuiltInActiveSymbolCount):
     517        (WebCore::GraphicsContextGLOpenGL::getProgramInfoLog):
     518        (WebCore::GraphicsContextGLOpenGL::getRenderbufferParameteriv):
     519        (WebCore::GraphicsContextGLOpenGL::getShaderiv):
     520        (WebCore::GraphicsContextGLOpenGL::getShaderInfoLog):
     521        (WebCore::GraphicsContextGLOpenGL::getShaderSource):
     522        (WebCore::GraphicsContextGLOpenGL::getTexParameterfv):
     523        (WebCore::GraphicsContextGLOpenGL::getTexParameteriv):
     524        (WebCore::GraphicsContextGLOpenGL::getUniformfv):
     525        (WebCore::GraphicsContextGLOpenGL::getUniformiv):
     526        (WebCore::GraphicsContextGLOpenGL::getUniformLocation):
     527        (WebCore::GraphicsContextGLOpenGL::getVertexAttribfv):
     528        (WebCore::GraphicsContextGLOpenGL::getVertexAttribiv):
     529        (WebCore::GraphicsContextGLOpenGL::getVertexAttribOffset):
     530        (WebCore::GraphicsContextGLOpenGL::texSubImage2D):
     531        (WebCore::GraphicsContextGLOpenGL::compressedTexImage2D):
     532        (WebCore::GraphicsContextGLOpenGL::compressedTexSubImage2D):
     533        (WebCore::GraphicsContextGLOpenGL::createBuffer):
     534        (WebCore::GraphicsContextGLOpenGL::createFramebuffer):
     535        (WebCore::GraphicsContextGLOpenGL::createProgram):
     536        (WebCore::GraphicsContextGLOpenGL::createRenderbuffer):
     537        (WebCore::GraphicsContextGLOpenGL::createShader):
     538        (WebCore::GraphicsContextGLOpenGL::createTexture):
     539        (WebCore::GraphicsContextGLOpenGL::deleteBuffer):
     540        (WebCore::GraphicsContextGLOpenGL::deleteFramebuffer):
     541        (WebCore::GraphicsContextGLOpenGL::deleteProgram):
     542        (WebCore::GraphicsContextGLOpenGL::deleteRenderbuffer):
     543        (WebCore::GraphicsContextGLOpenGL::deleteShader):
     544        (WebCore::GraphicsContextGLOpenGL::deleteTexture):
     545        (WebCore::GraphicsContextGLOpenGL::texImage2DDirect):
     546        (WebCore::GraphicsContextGLOpenGL::primitiveRestartIndex):
     547        (WebCore::GraphicsContextGLOpenGL::copyBufferSubData):
     548        (WebCore::GraphicsContextGLOpenGL::mapBufferRange):
     549        (WebCore::GraphicsContextGLOpenGL::unmapBuffer):
     550        (WebCore::GraphicsContextGLOpenGL::getInternalformativ):
     551        (WebCore::GraphicsContextGLOpenGL::renderbufferStorageMultisample):
     552        (WebCore::GraphicsContextGLOpenGL::texStorage2D):
     553        (WebCore::GraphicsContextGLOpenGL::texStorage3D):
     554        (WebCore::GraphicsContextGLOpenGL::getActiveUniforms):
     555        * platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp:
     556        (WebCore::GraphicsContextGLOpenGL::readPixels):
     557        (WebCore::GraphicsContextGLOpenGL::reshapeFBOs):
     558        (WebCore::GraphicsContextGLOpenGL::renderbufferStorage):
     559        (WebCore::GraphicsContextGLOpenGL::getIntegerv):
     560        (WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat):
     561        (WebCore::GraphicsContextGLOpenGL::depthRange):
     562        (WebCore::GraphicsContextGLOpenGL::clearDepth):
     563        (WebCore::GraphicsContextGLOpenGL::create):
     564        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
     565        (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
     566        * platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp:
     567        (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL):
     568        (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL):
     569
    15702020-11-13  Miguel Gomez  <magomez@igalia.com>
    2571
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r269686 r269768  
    712712
    713713    auto context = GraphicsContextGLOpenGL::create(attributes, hostWindow);
    714     if (!context || !context->makeContextCurrent()) {
     714    if (!context) {
    715715        if (canvasElement) {
    716716            canvasElement->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent,
     
    43504350
    43514351#if USE(ANGLE)
    4352         GCGLsizei length, columns, rows;
    4353         m_context->makeContextCurrent();
    4354         m_context->getExtensions().readnPixelsRobustANGLE(x, y, width, height, format, type, pixels.byteLength(), &length, &columns, &rows, data, false);
     4352    GCGLsizei length = 0;
     4353    GCGLsizei columns = 0;
     4354    GCGLsizei rows = 0;
     4355    m_context->getExtensions().readnPixelsRobustANGLE(x, y, width, height, format, type, pixels.byteLength(), &length, &columns, &rows, data, false);
    43554356#else
    43564357    if (m_isRobustnessEXTSupported)
  • trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp

    r269686 r269768  
    7575bool ExtensionsGLANGLE::supports(const String& name)
    7676{
    77     if (!m_initializedAvailableExtensions)
     77    if (!m_initializedAvailableExtensions) {
     78        if (!m_context->makeContextCurrent())
     79            return false;
    7880        initializeAvailableExtensions();
    79 
     81    }
    8082    return supportsExtension(name);
    8183}
     
    8587    // Enable support in ANGLE (if not enabled already).
    8688    if (m_requestableExtensions.contains(name) && !m_enabledExtensions.contains(name)) {
    87         m_context->makeContextCurrent();
     89        if (!m_context->makeContextCurrent())
     90            return;
    8891        gl::RequestExtensionANGLE(name.ascii().data());
    8992        m_enabledExtensions.add(name);
     
    108111String ExtensionsGLANGLE::getTranslatedShaderSourceANGLE(PlatformGLObject shader)
    109112{
    110     m_context->makeContextCurrent();
     113    if (!m_context->makeContextCurrent())
     114        return String();
     115
    111116    int sourceLength = 0;
    112117    m_context->getShaderiv(shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &sourceLength);
     
    162167{
    163168    // FIXME: consider adding support for APPLE_framebuffer_multisample.
    164     m_context->makeContextCurrent();
     169    if (!m_context->makeContextCurrent())
     170        return;
     171
    165172    gl::BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
    166173}
     
    168175void ExtensionsGLANGLE::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
    169176{
    170     m_context->makeContextCurrent();
     177    if (!m_context->makeContextCurrent())
     178        return;
     179
    171180    gl::RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
    172181}
     
    174183PlatformGLObject ExtensionsGLANGLE::createVertexArrayOES()
    175184{
    176     m_context->makeContextCurrent();
     185    if (!m_context->makeContextCurrent())
     186        return 0;
     187
    177188    GLuint array = 0;
    178189    gl::GenVertexArraysOES(1, &array);
     
    185196        return;
    186197
    187     m_context->makeContextCurrent();
     198    if (!m_context->makeContextCurrent())
     199        return;
     200
    188201    gl::DeleteVertexArraysOES(1, &array);
    189202}
     
    194207        return GL_FALSE;
    195208
    196     m_context->makeContextCurrent();
     209    if (!m_context->makeContextCurrent())
     210        return GL_FALSE;
     211
    197212    return gl::IsVertexArrayOES(array);
    198213}
     
    200215void ExtensionsGLANGLE::bindVertexArrayOES(PlatformGLObject array)
    201216{
    202     m_context->makeContextCurrent();
     217    if (!m_context->makeContextCurrent())
     218        return;
     219
    203220    gl::BindVertexArrayOES(array);
    204221}
     
    229246void ExtensionsGLANGLE::drawBuffersEXT(GCGLsizei n, const GCGLenum* bufs)
    230247{
    231     m_context->makeContextCurrent();
     248    if (!m_context->makeContextCurrent())
     249        return;
     250
    232251    gl::DrawBuffersEXT(n, bufs);
    233252}
     
    235254void ExtensionsGLANGLE::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
    236255{
    237     m_context->makeContextCurrent();
     256    if (!m_context->makeContextCurrent())
     257        return;
     258
    238259    gl::DrawArraysInstancedANGLE(mode, first, count, primcount);
    239260}
     
    241262void ExtensionsGLANGLE::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount)
    242263{
    243     m_context->makeContextCurrent();
     264    if (!m_context->makeContextCurrent())
     265        return;
     266
    244267    gl::DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount);
    245268}
     
    247270void ExtensionsGLANGLE::vertexAttribDivisor(GCGLuint index, GCGLuint divisor)
    248271{
    249     m_context->makeContextCurrent();
     272    if (!m_context->makeContextCurrent())
     273        return;
     274
    250275    gl::VertexAttribDivisorANGLE(index, divisor);
    251276}
     
    272297void ExtensionsGLANGLE::getBooleanvRobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLboolean *data)
    273298{
    274     m_context->makeContextCurrent();
     299    if (!m_context->makeContextCurrent())
     300        return;
     301
    275302    gl::GetBooleanvRobustANGLE(pname, bufSize, length, data);
    276303}
     
    278305void ExtensionsGLANGLE::getBufferParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    279306{
    280     m_context->makeContextCurrent();
     307    if (!m_context->makeContextCurrent())
     308        return;
     309
    281310    gl::GetBufferParameterivRobustANGLE(target, pname, bufSize, length, params);
    282311}
     
    284313void ExtensionsGLANGLE::getFloatvRobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *data)
    285314{
    286     m_context->makeContextCurrent();
     315    if (!m_context->makeContextCurrent())
     316        return;
     317
    287318    gl::GetFloatvRobustANGLE(pname, bufSize, length, data);
    288319}
     
    290321void ExtensionsGLANGLE::getFramebufferAttachmentParameterivRobustANGLE(GCGLenum target, GCGLenum attachment, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    291322{
    292     m_context->makeContextCurrent();
     323    if (!m_context->makeContextCurrent())
     324        return;
     325
    293326    gl::GetFramebufferAttachmentParameterivRobustANGLE(target, attachment, pname, bufSize, length, params);
    294327}
     
    296329void ExtensionsGLANGLE::getIntegervRobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *data)
    297330{
    298     m_context->makeContextCurrent();
     331    if (!m_context->makeContextCurrent())
     332        return;
     333
    299334    gl::GetIntegervRobustANGLE(pname, bufSize, length, data);
    300335}
     
    302337void ExtensionsGLANGLE::getProgramivRobustANGLE(GCGLuint program, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    303338{
    304     m_context->makeContextCurrent();
     339    if (!m_context->makeContextCurrent())
     340        return;
     341
    305342    gl::GetProgramivRobustANGLE(program, pname, bufSize, length, params);
    306343}
     
    308345void ExtensionsGLANGLE::getRenderbufferParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    309346{
    310     m_context->makeContextCurrent();
     347    if (!m_context->makeContextCurrent())
     348        return;
     349
    311350    gl::GetRenderbufferParameterivRobustANGLE(target, pname, bufSize, length, params);
    312351}
     
    314353void ExtensionsGLANGLE::getShaderivRobustANGLE(GCGLuint shader, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    315354{
    316     m_context->makeContextCurrent();
     355    if (!m_context->makeContextCurrent())
     356        return;
     357
    317358    gl::GetShaderivRobustANGLE(shader, pname, bufSize, length, params);
    318359}
     
    320361void ExtensionsGLANGLE::getTexParameterfvRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
    321362{
    322     m_context->makeContextCurrent();
     363    if (!m_context->makeContextCurrent())
     364        return;
     365
    323366    gl::GetTexParameterfvRobustANGLE(target, pname, bufSize, length, params);
    324367}
     
    326369void ExtensionsGLANGLE::getTexParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    327370{
    328     m_context->makeContextCurrent();
     371    if (!m_context->makeContextCurrent())
     372        return;
     373
    329374    gl::GetTexParameterivRobustANGLE(target, pname, bufSize, length, params);
    330375}
     
    332377void ExtensionsGLANGLE::getUniformfvRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
    333378{
    334     m_context->makeContextCurrent();
     379    if (!m_context->makeContextCurrent())
     380        return;
     381
    335382    gl::GetUniformfvRobustANGLE(program, location, bufSize, length, params);
    336383}
     
    338385void ExtensionsGLANGLE::getUniformivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    339386{
    340     m_context->makeContextCurrent();
     387    if (!m_context->makeContextCurrent())
     388        return;
     389
    341390    gl::GetUniformivRobustANGLE(program, location, bufSize, length, params);
    342391}
     
    344393void ExtensionsGLANGLE::getVertexAttribfvRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
    345394{
    346     m_context->makeContextCurrent();
     395    if (!m_context->makeContextCurrent())
     396        return;
     397
    347398    gl::GetVertexAttribfvRobustANGLE(index, pname, bufSize, length, params);
    348399}
     
    350401void ExtensionsGLANGLE::getVertexAttribivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    351402{
    352     m_context->makeContextCurrent();
     403    if (!m_context->makeContextCurrent())
     404        return;
     405
    353406    gl::GetVertexAttribivRobustANGLE(index, pname, bufSize, length, params);
    354407}
     
    356409void ExtensionsGLANGLE::getVertexAttribPointervRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **pointer)
    357410{
    358     m_context->makeContextCurrent();
     411    if (!m_context->makeContextCurrent())
     412        return;
     413
    359414    gl::GetVertexAttribPointervRobustANGLE(index, pname, bufSize, length, pointer);
    360415}
     
    362417void ExtensionsGLANGLE::readPixelsRobustANGLE(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei *length, GCGLsizei *columns, GCGLsizei *rows, void *pixels)
    363418{
    364     m_context->makeContextCurrent();
     419    if (!m_context->makeContextCurrent())
     420        return;
     421
    365422    gl::ReadPixelsRobustANGLE(x, y, width, height, format, type, bufSize, length, columns, rows, pixels);
    366423}
     
    370427    if (!m_context->m_isForWebGL2)
    371428        internalformat = adjustWebGL1TextureInternalFormat(internalformat, format, type);
    372     m_context->makeContextCurrent();
     429    if (!m_context->makeContextCurrent())
     430        return;
     431
    373432    gl::TexImage2DRobustANGLE(target, level, internalformat, width, height, border, format, type, bufSize, pixels);
    374433}
     
    376435void ExtensionsGLANGLE::texParameterfvRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLfloat *params)
    377436{
    378     m_context->makeContextCurrent();
     437    if (!m_context->makeContextCurrent())
     438        return;
     439
    379440    gl::TexParameterfvRobustANGLE(target, pname, bufSize, params);
    380441}
     
    382443void ExtensionsGLANGLE::texParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLint *params)
    383444{
    384     m_context->makeContextCurrent();
     445    if (!m_context->makeContextCurrent())
     446        return;
     447
    385448    gl::TexParameterivRobustANGLE(target, pname, bufSize, params);
    386449}
     
    388451void ExtensionsGLANGLE::texSubImage2DRobustANGLE(GCGLenum target, int level, int xoffset, int yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, const void *pixels)
    389452{
    390     m_context->makeContextCurrent();
     453    if (!m_context->makeContextCurrent())
     454        return;
     455
    391456    gl::TexSubImage2DRobustANGLE(target, level, xoffset, yoffset, width, height, format, type, bufSize, pixels);
    392457}
     
    394459void ExtensionsGLANGLE::compressedTexImage2DRobustANGLE(GCGLenum target, int level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, int border, GCGLsizei imageSize, GCGLsizei bufSize, const void* data)
    395460{
    396     m_context->makeContextCurrent();
     461    if (!m_context->makeContextCurrent())
     462        return;
     463
    397464    gl::CompressedTexImage2DRobustANGLE(target, level, internalformat, width, height, border, imageSize, bufSize, data);
    398465}
     
    400467void ExtensionsGLANGLE::compressedTexSubImage2DRobustANGLE(GCGLenum target, int level, int xoffset, int yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLsizei imageSize, GCGLsizei bufSize, const void* data)
    401468{
    402     m_context->makeContextCurrent();
     469    if (!m_context->makeContextCurrent())
     470        return;
     471
    403472    gl::CompressedTexSubImage2DRobustANGLE(target, level, xoffset, yoffset, width, height, format, imageSize, bufSize, data);
    404473}
     
    406475void ExtensionsGLANGLE::compressedTexImage3DRobustANGLE(GCGLenum target, int level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth, int border, GCGLsizei imageSize, GCGLsizei bufSize, const void* data)
    407476{
    408     m_context->makeContextCurrent();
     477    if (!m_context->makeContextCurrent())
     478        return;
     479
    409480    gl::CompressedTexImage3DRobustANGLE(target, level, internalformat, width, height, depth, border, imageSize, bufSize, data);
    410481}
     
    412483void ExtensionsGLANGLE::compressedTexSubImage3DRobustANGLE(GCGLenum target, int level, int xoffset, int yoffset, int zoffset, GCGLsizei width, GCGLsizei height, GCGLsizei depth, GCGLenum format, GCGLsizei imageSize, GCGLsizei bufSize, const void* data)
    413484{
    414     m_context->makeContextCurrent();
     485    if (!m_context->makeContextCurrent())
     486        return;
     487
    415488    gl::CompressedTexSubImage3DRobustANGLE(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bufSize, data);
    416489}
     
    419492void ExtensionsGLANGLE::texImage3DRobustANGLE(GCGLenum target, int level, int internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth, int border, GCGLenum format, GCGLenum type, GCGLsizei bufSize, const void *pixels)
    420493{
    421     m_context->makeContextCurrent();
     494    if (!m_context->makeContextCurrent())
     495        return;
     496
    422497    gl::TexImage3DRobustANGLE(target, level, internalformat, width, height, depth, border, format, type, bufSize, pixels);
    423498}
     
    425500void ExtensionsGLANGLE::texSubImage3DRobustANGLE(GCGLenum target, int level, int xoffset, int yoffset, int zoffset, GCGLsizei width, GCGLsizei height, GCGLsizei depth, GCGLenum format, GCGLenum type, GCGLsizei bufSize, const void *pixels)
    426501{
    427     m_context->makeContextCurrent();
     502    if (!m_context->makeContextCurrent())
     503        return;
     504
    428505    gl::TexSubImage3DRobustANGLE(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels);
    429506}
     
    431508void ExtensionsGLANGLE::getQueryivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    432509{
    433     m_context->makeContextCurrent();
     510    if (!m_context->makeContextCurrent())
     511        return;
     512
    434513    gl::GetQueryivRobustANGLE(target, pname, bufSize, length, params);
    435514}
     
    437516void ExtensionsGLANGLE::getQueryObjectuivRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
    438517{
    439     m_context->makeContextCurrent();
     518    if (!m_context->makeContextCurrent())
     519        return;
     520
    440521    gl::GetQueryObjectuivRobustANGLE(id, pname, bufSize, length, params);
    441522}
     
    443524void ExtensionsGLANGLE::getBufferPointervRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **params)
    444525{
    445     m_context->makeContextCurrent();
     526    if (!m_context->makeContextCurrent())
     527        return;
     528
    446529    gl::GetBufferPointervRobustANGLE(target, pname, bufSize, length, params);
    447530}
     
    449532void ExtensionsGLANGLE::getIntegeri_vRobustANGLE(GCGLenum target, GCGLuint index, GCGLsizei bufSize, GCGLsizei *length, GCGLint *data)
    450533{
    451     m_context->makeContextCurrent();
     534    if (!m_context->makeContextCurrent())
     535        return;
     536
    452537    gl::GetIntegeri_vRobustANGLE(target, index, bufSize, length, data);
    453538}
     
    455540void ExtensionsGLANGLE::getInternalformativRobustANGLE(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    456541{
    457     m_context->makeContextCurrent();
     542    if (!m_context->makeContextCurrent())
     543        return;
     544
    458545    gl::GetInternalformativRobustANGLE(target, internalformat, pname, bufSize, length, params);
    459546}
     
    461548void ExtensionsGLANGLE::getVertexAttribIivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    462549{
    463     m_context->makeContextCurrent();
     550    if (!m_context->makeContextCurrent())
     551        return;
     552
    464553    gl::GetVertexAttribIivRobustANGLE(index, pname, bufSize, length, params);
    465554}
     
    467556void ExtensionsGLANGLE::getVertexAttribIuivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
    468557{
    469     m_context->makeContextCurrent();
     558    if (!m_context->makeContextCurrent())
     559        return;
     560
    470561    gl::GetVertexAttribIuivRobustANGLE(index, pname, bufSize, length, params);
    471562}
     
    473564void ExtensionsGLANGLE::getUniformuivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
    474565{
    475     m_context->makeContextCurrent();
     566    if (!m_context->makeContextCurrent())
     567        return;
     568
    476569    gl::GetUniformuivRobustANGLE(program, location, bufSize, length, params);
    477570}
     
    479572void ExtensionsGLANGLE::getActiveUniformBlockivRobustANGLE(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    480573{
    481     m_context->makeContextCurrent();
     574    if (!m_context->makeContextCurrent())
     575        return;
     576
    482577    gl::GetActiveUniformBlockivRobustANGLE(program, uniformBlockIndex, pname, bufSize, length, params);
    483578}
     
    485580void ExtensionsGLANGLE::getInteger64vRobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint64 *data)
    486581{
    487     m_context->makeContextCurrent();
     582    if (!m_context->makeContextCurrent())
     583        return;
     584
    488585    gl::GetInteger64vRobustANGLE(pname, bufSize, length, reinterpret_cast<GLint64*>(data));
    489586}
     
    491588void ExtensionsGLANGLE::getInteger64i_vRobustANGLE(GCGLenum target, GCGLuint index, GCGLsizei bufSize, GCGLsizei *length, GCGLint64 *data)
    492589{
    493     m_context->makeContextCurrent();
     590    if (!m_context->makeContextCurrent())
     591        return;
     592
    494593    gl::GetInteger64i_vRobustANGLE(target, index, bufSize, length, reinterpret_cast<GLint64*>(data));
    495594}
     
    497596void ExtensionsGLANGLE::getBufferParameteri64vRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint64 *params)
    498597{
    499     m_context->makeContextCurrent();
     598    if (!m_context->makeContextCurrent())
     599        return;
     600
    500601    gl::GetBufferParameteri64vRobustANGLE(target, pname, bufSize, length, reinterpret_cast<GLint64*>(params));
    501602}
     
    503604void ExtensionsGLANGLE::samplerParameterivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, const GCGLint *param)
    504605{
    505     m_context->makeContextCurrent();
     606    if (!m_context->makeContextCurrent())
     607        return;
     608
    506609    gl::SamplerParameterivRobustANGLE(sampler, pname, bufSize, param);
    507610}
     
    509612void ExtensionsGLANGLE::samplerParameterfvRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, const GCGLfloat *param)
    510613{
    511     m_context->makeContextCurrent();
     614    if (!m_context->makeContextCurrent())
     615        return;
     616
    512617    gl::SamplerParameterfvRobustANGLE(sampler, pname, bufSize, param);
    513618}
     
    515620void ExtensionsGLANGLE::getSamplerParameterivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    516621{
    517     m_context->makeContextCurrent();
     622    if (!m_context->makeContextCurrent())
     623        return;
     624
    518625    gl::GetSamplerParameterivRobustANGLE(sampler, pname, bufSize, length, params);
    519626}
     
    521628void ExtensionsGLANGLE::getSamplerParameterfvRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
    522629{
    523     m_context->makeContextCurrent();
     630    if (!m_context->makeContextCurrent())
     631        return;
     632
    524633    gl::GetSamplerParameterfvRobustANGLE(sampler, pname, bufSize, length, params);
    525634}
     
    528637void ExtensionsGLANGLE::getFramebufferParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    529638{
    530     m_context->makeContextCurrent();
     639    if (!m_context->makeContextCurrent())
     640        return;
     641
    531642    gl::GetFramebufferParameterivRobustANGLE(target, pname, bufSize, length, params);
    532643}
     
    534645void ExtensionsGLANGLE::getProgramInterfaceivRobustANGLE(GCGLuint program, GCGLenum programInterface, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    535646{
    536     m_context->makeContextCurrent();
     647    if (!m_context->makeContextCurrent())
     648        return;
     649
    537650    gl::GetProgramInterfaceivRobustANGLE(program, programInterface, pname, bufSize, length, params);
    538651}
     
    540653void ExtensionsGLANGLE::getBooleani_vRobustANGLE(GCGLenum target, GCGLuint index, GCGLsizei bufSize, GCGLsizei *length, GCGLboolean *data)
    541654{
    542     m_context->makeContextCurrent();
     655    if (!m_context->makeContextCurrent())
     656        return;
     657
    543658    gl::GetBooleani_vRobustANGLE(target, index, bufSize, length, data);
    544659}
     
    546661void ExtensionsGLANGLE::getMultisamplefvRobustANGLE(GCGLenum pname, GCGLuint index, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *val)
    547662{
    548     m_context->makeContextCurrent();
     663    if (!m_context->makeContextCurrent())
     664        return;
     665
    549666    gl::GetMultisamplefvRobustANGLE(pname, index, bufSize, length, val);
    550667}
     
    552669void ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE(GCGLenum target, int level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    553670{
    554     m_context->makeContextCurrent();
     671    if (!m_context->makeContextCurrent())
     672        return;
     673
    555674    gl::GetTexLevelParameterivRobustANGLE(target, level, pname, bufSize, length, params);
    556675}
     
    558677void ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE(GCGLenum target, int level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
    559678{
    560     m_context->makeContextCurrent();
     679    if (!m_context->makeContextCurrent())
     680        return;
     681
    561682    gl::GetTexLevelParameterfvRobustANGLE(target, level, pname, bufSize, length, params);
    562683}
     
    565686void ExtensionsGLANGLE::getPointervRobustANGLERobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **params)
    566687{
    567     m_context->makeContextCurrent();
     688    if (!m_context->makeContextCurrent())
     689        return;
     690
    568691    gl::GetPointervRobustANGLERobustANGLE(pname, bufSize, length, params);
    569692}
     
    582705void ExtensionsGLANGLE::readnPixelsRobustANGLE(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei *length, GCGLsizei *columns, GCGLsizei *rows, void *data, bool readingToPixelBufferObject)
    583706{
    584     m_context->makeContextCurrent();
     707    if (!m_context->makeContextCurrent())
     708        return;
     709
    585710    // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e.,
    586711    // all previous rendering calls should be done before reading pixels.
     
    617742void ExtensionsGLANGLE::getnUniformfvRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params)
    618743{
    619     m_context->makeContextCurrent();
     744    if (!m_context->makeContextCurrent())
     745        return;
     746
    620747    gl::GetnUniformfvRobustANGLE(program, location, bufSize, length, params);
    621748}
     
    623750void ExtensionsGLANGLE::getnUniformivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    624751{
    625     m_context->makeContextCurrent();
     752    if (!m_context->makeContextCurrent())
     753        return;
     754
    626755    gl::GetnUniformivRobustANGLE(program, location, bufSize, length, params);
    627756}
     
    629758void ExtensionsGLANGLE::getnUniformuivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
    630759{
    631     m_context->makeContextCurrent();
     760    if (!m_context->makeContextCurrent())
     761        return;
     762
    632763    gl::GetnUniformuivRobustANGLE(program, location, bufSize, length, params);
    633764}
     
    635766void ExtensionsGLANGLE::texParameterIivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLint *params)
    636767{
    637     m_context->makeContextCurrent();
     768    if (!m_context->makeContextCurrent())
     769        return;
     770
    638771    gl::TexParameterIivRobustANGLE(target, pname, bufSize, params);
    639772}
     
    641774void ExtensionsGLANGLE::texParameterIuivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLuint *params)
    642775{
    643     m_context->makeContextCurrent();
     776    if (!m_context->makeContextCurrent())
     777        return;
     778
    644779    gl::TexParameterIuivRobustANGLE(target, pname, bufSize, params);
    645780}
     
    647782void ExtensionsGLANGLE::getTexParameterIivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    648783{
    649     m_context->makeContextCurrent();
     784    if (!m_context->makeContextCurrent())
     785        return;
     786
    650787    gl::GetTexParameterIivRobustANGLE(target, pname, bufSize, length, params);
    651788}
     
    653790void ExtensionsGLANGLE::getTexParameterIuivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
    654791{
    655     m_context->makeContextCurrent();
     792    if (!m_context->makeContextCurrent())
     793        return;
     794
    656795    gl::GetTexParameterIuivRobustANGLE(target, pname, bufSize, length, params);
    657796}
     
    659798void ExtensionsGLANGLE::samplerParameterIivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, const GCGLint *param)
    660799{
    661     m_context->makeContextCurrent();
     800    if (!m_context->makeContextCurrent())
     801        return;
     802
    662803    gl::SamplerParameterIivRobustANGLE(sampler, pname, bufSize, param);
    663804}
     
    665806void ExtensionsGLANGLE::samplerParameterIuivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, const GCGLuint *param)
    666807{
    667     m_context->makeContextCurrent();
     808    if (!m_context->makeContextCurrent())
     809        return;
     810
    668811    gl::SamplerParameterIuivRobustANGLE(sampler, pname, bufSize, param);
    669812}
     
    671814void ExtensionsGLANGLE::getSamplerParameterIivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    672815{
    673     m_context->makeContextCurrent();
     816    if (!m_context->makeContextCurrent())
     817        return;
     818
    674819    gl::GetSamplerParameterIivRobustANGLE(sampler, pname, bufSize, length, params);
    675820}
     
    677822void ExtensionsGLANGLE::getSamplerParameterIuivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params)
    678823{
    679     m_context->makeContextCurrent();
     824    if (!m_context->makeContextCurrent())
     825        return;
     826
    680827    gl::GetSamplerParameterIuivRobustANGLE(sampler, pname, bufSize, length, params);
    681828}
     
    684831void ExtensionsGLANGLE::getQueryObjectivRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params)
    685832{
    686     m_context->makeContextCurrent();
     833    if (!m_context->makeContextCurrent())
     834        return;
     835
    687836    gl::GetQueryObjectivRobustANGLE(id, pname, bufSize, length, params);
    688837}
     
    690839void ExtensionsGLANGLE::getQueryObjecti64vRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint64 *params)
    691840{
    692     m_context->makeContextCurrent();
     841    if (!m_context->makeContextCurrent())
     842        return;
     843
    693844    gl::GetQueryObjecti64vRobustANGLE(id, pname, bufSize, length, reinterpret_cast<GLint64*>(params));
    694845}
     
    696847void ExtensionsGLANGLE::getQueryObjectui64vRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint64 *params)
    697848{
    698     m_context->makeContextCurrent();
     849    if (!m_context->makeContextCurrent())
     850        return;
     851
    699852    gl::GetQueryObjectui64vRobustANGLE(id, pname, bufSize, length, reinterpret_cast<GLuint64*>(params));
    700853}
  • trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp

    r269686 r269768  
    186186        gl::BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
    187187        gl::BindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer);
    188         getExtensions().renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, m_internalColorFormat, width, height);
     188        gl::RenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, m_internalColorFormat, width, height);
    189189        gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer);
    190190        if (attrs.stencil || attrs.depth) {
    191191            gl::BindRenderbuffer(GL_RENDERBUFFER, m_multisampleDepthStencilBuffer);
    192             getExtensions().renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, internalDepthStencilFormat, width, height);
     192            gl::RenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, internalDepthStencilFormat, width, height);
    193193            // WebGL 1.0's rules state that combined depth/stencil renderbuffers
    194194            // have to be attached to the synthetic DEPTH_STENCIL_ATTACHMENT point.
     
    325325void GraphicsContextGLOpenGL::renderbufferStorage(GCGLenum target, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    326326{
    327     makeContextCurrent();
     327    if (!makeContextCurrent())
     328        return;
     329
    328330    gl::RenderbufferStorage(target, internalformat, width, height);
    329331}
     
    331333void GraphicsContextGLOpenGL::getIntegerv(GCGLenum pname, GCGLint* value)
    332334{
    333     makeContextCurrent();
     335    if (!makeContextCurrent())
     336        return;
     337
    334338    switch (pname) {
    335339    case MAX_TEXTURE_SIZE:
     
    364368void GraphicsContextGLOpenGL::getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLint* value)
    365369{
    366     makeContextCurrent();
     370    if (!makeContextCurrent())
     371        return;
     372
    367373    gl::GetIntegeri_v(pname, index, value);
    368374}
     
    370376void GraphicsContextGLOpenGL::getShaderPrecisionFormat(GCGLenum shaderType, GCGLenum precisionType, GCGLint* range, GCGLint* precision)
    371377{
    372     makeContextCurrent();
     378    if (!makeContextCurrent())
     379        return;
     380
    373381    gl::GetShaderPrecisionFormat(shaderType, precisionType, range, precision);
    374382}
     
    387395void GraphicsContextGLOpenGL::depthRange(GCGLclampf zNear, GCGLclampf zFar)
    388396{
    389     makeContextCurrent();
     397    if (!makeContextCurrent())
     398        return;
     399
    390400    gl::DepthRangef(static_cast<float>(zNear), static_cast<float>(zFar));
    391401}
     
    393403void GraphicsContextGLOpenGL::clearDepth(GCGLclampf depth)
    394404{
    395     makeContextCurrent();
     405    if (!makeContextCurrent())
     406        return;
     407
    396408    gl::ClearDepthf(static_cast<float>(depth));
    397409}
     
    408420    // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e.,
    409421    // all previous rendering calls should be done before reading pixels.
    410     makeContextCurrent();
     422    if (!makeContextCurrent())
     423        return;
     424
    411425    gl::Flush();
    412426    auto attrs = contextAttributes();
     
    523537        return;
    524538
    525     makeContextCurrent();
     539    if (!makeContextCurrent())
     540        return;
     541
    526542    prepareTextureImpl();
    527543}
     
    573589        return;
    574590
    575     makeContextCurrent();
     591    if (!makeContextCurrent())
     592        return;
     593
    576594
    577595    GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
     
    629647void GraphicsContextGLOpenGL::reshape(int width, int height)
    630648{
    631     if (!platformGraphicsContextGL())
    632         return;
    633 
    634649    if (width == m_currentWidth && height == m_currentHeight)
    635650        return;
     
    639654        return;
    640655
     656    if (!makeContextCurrent())
     657        return;
     658
     659    // FIXME: these may call makeContextCurrent again, we need to do this before changing the size.
     660    moveErrorsToSyntheticErrorList();
     661    validateAttributes();
     662
    641663    markContextChanged();
    642664
    643665    m_currentWidth = width;
    644666    m_currentHeight = height;
    645 
    646     makeContextCurrent();
    647     moveErrorsToSyntheticErrorList();
    648     validateAttributes();
    649667
    650668    TemporaryANGLESetting scopedScissor(GL_SCISSOR_TEST, GL_FALSE);
     
    667685    if (attrs.depth) {
    668686        gl::GetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth);
    669         GraphicsContextGLOpenGL::clearDepth(1);
     687        gl::ClearDepthf(1.0f);
    670688        gl::GetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
    671689        gl::DepthMask(GL_TRUE);
    672690        clearMask |= GL_DEPTH_BUFFER_BIT;
    673691    }
     692
    674693    if (attrs.stencil) {
    675694        gl::GetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil);
     
    687706    gl::ColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
    688707    if (attrs.depth) {
    689         GraphicsContextGLOpenGL::clearDepth(clearDepth);
     708        gl::ClearDepthf(clearDepth);
    690709        gl::DepthMask(depthMask);
    691710    }
     
    714733void GraphicsContextGLOpenGL::activeTexture(GCGLenum texture)
    715734{
    716     makeContextCurrent();
     735    if (!makeContextCurrent())
     736        return;
     737
    717738    m_state.activeTextureUnit = texture;
    718739    gl::ActiveTexture(texture);
     
    723744    ASSERT(program);
    724745    ASSERT(shader);
    725     makeContextCurrent();
     746    if (!makeContextCurrent())
     747        return;
     748
    726749    gl::AttachShader(program, shader);
    727750}
     
    730753{
    731754    ASSERT(program);
    732     makeContextCurrent();
     755    if (!makeContextCurrent())
     756        return;
     757
    733758    gl::BindAttribLocation(program, index, name.utf8().data());
    734759}
     
    736761void GraphicsContextGLOpenGL::bindBuffer(GCGLenum target, PlatformGLObject buffer)
    737762{
    738     makeContextCurrent();
     763    if (!makeContextCurrent())
     764        return;
     765
    739766    gl::BindBuffer(target, buffer);
    740767}
     
    742769void GraphicsContextGLOpenGL::bindFramebuffer(GCGLenum target, PlatformGLObject buffer)
    743770{
    744     makeContextCurrent();
     771    if (!makeContextCurrent())
     772        return;
     773
    745774    GLuint fbo;
    746775    if (buffer)
     
    761790void GraphicsContextGLOpenGL::bindRenderbuffer(GCGLenum target, PlatformGLObject renderbuffer)
    762791{
    763     makeContextCurrent();
     792    if (!makeContextCurrent())
     793        return;
     794
    764795    gl::BindRenderbuffer(target, renderbuffer);
    765796}
     
    768799void GraphicsContextGLOpenGL::bindTexture(GCGLenum target, PlatformGLObject texture)
    769800{
    770     makeContextCurrent();
     801    if (!makeContextCurrent())
     802        return;
     803
    771804    m_state.setBoundTexture(m_state.activeTextureUnit, texture, target);
    772805    gl::BindTexture(target, texture);
     
    775808void GraphicsContextGLOpenGL::blendColor(GCGLclampf red, GCGLclampf green, GCGLclampf blue, GCGLclampf alpha)
    776809{
    777     makeContextCurrent();
     810    if (!makeContextCurrent())
     811        return;
     812
    778813    gl::BlendColor(red, green, blue, alpha);
    779814}
     
    781816void GraphicsContextGLOpenGL::blendEquation(GCGLenum mode)
    782817{
    783     makeContextCurrent();
     818    if (!makeContextCurrent())
     819        return;
     820
    784821    gl::BlendEquation(mode);
    785822}
     
    787824void GraphicsContextGLOpenGL::blendEquationSeparate(GCGLenum modeRGB, GCGLenum modeAlpha)
    788825{
    789     makeContextCurrent();
     826    if (!makeContextCurrent())
     827        return;
     828
    790829    gl::BlendEquationSeparate(modeRGB, modeAlpha);
    791830}
     
    794833void GraphicsContextGLOpenGL::blendFunc(GCGLenum sfactor, GCGLenum dfactor)
    795834{
    796     makeContextCurrent();
     835    if (!makeContextCurrent())
     836        return;
     837
    797838    gl::BlendFunc(sfactor, dfactor);
    798839}
     
    800841void GraphicsContextGLOpenGL::blendFuncSeparate(GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha)
    801842{
    802     makeContextCurrent();
     843    if (!makeContextCurrent())
     844        return;
     845
    803846    gl::BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    804847}
     
    806849void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, GCGLenum usage)
    807850{
    808     makeContextCurrent();
     851    if (!makeContextCurrent())
     852        return;
     853
    809854    gl::BufferData(target, size, 0, usage);
    810855}
     
    812857void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, const void* data, GCGLenum usage)
    813858{
    814     makeContextCurrent();
     859    if (!makeContextCurrent())
     860        return;
     861
    815862    gl::BufferData(target, size, data, usage);
    816863}
     
    818865void GraphicsContextGLOpenGL::bufferSubData(GCGLenum target, GCGLintptr offset, GCGLsizeiptr size, const void* data)
    819866{
    820     makeContextCurrent();
     867    if (!makeContextCurrent())
     868        return;
     869
    821870    gl::BufferSubData(target, offset, size, data);
    822871}
     
    824873void* GraphicsContextGLOpenGL::mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access)
    825874{
    826     makeContextCurrent();
     875    if (!makeContextCurrent())
     876        return nullptr;
     877
    827878    return gl::MapBufferRange(target, offset, length, access);
    828879}
     
    830881GCGLboolean GraphicsContextGLOpenGL::unmapBuffer(GCGLenum target)
    831882{
    832     makeContextCurrent();
     883    if (!makeContextCurrent())
     884        return GL_FALSE;
     885
    833886    return gl::UnmapBuffer(target);
    834887}
     
    836889void GraphicsContextGLOpenGL::copyBufferSubData(GCGLenum readTarget, GCGLenum writeTarget, GCGLintptr readOffset, GCGLintptr writeOffset, GCGLsizeiptr size)
    837890{
    838     makeContextCurrent();
     891    if (!makeContextCurrent())
     892        return;
     893
    839894    gl::CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
    840895}
     
    842897void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLint* params)
    843898{
    844     makeContextCurrent();
     899    if (!makeContextCurrent())
     900        return;
     901
    845902    gl::GetInternalformativ(target, internalformat, pname, bufSize, params);
    846903}
     
    848905void GraphicsContextGLOpenGL::renderbufferStorageMultisample(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    849906{
    850     makeContextCurrent();
     907    if (!makeContextCurrent())
     908        return;
     909
    851910    gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height);
    852911}
     
    854913void GraphicsContextGLOpenGL::texStorage2D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    855914{
    856     makeContextCurrent();
     915    if (!makeContextCurrent())
     916        return;
     917
    857918    gl::TexStorage2D(target, levels, internalformat, width, height);
    858919    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    861922void GraphicsContextGLOpenGL::texStorage3D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth)
    862923{
    863     makeContextCurrent();
     924    if (!makeContextCurrent())
     925        return;
     926
    864927    gl::TexStorage3D(target, levels, internalformat, width, height, depth);
    865928    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    869932{
    870933    ASSERT(program);
    871     makeContextCurrent();
     934    if (!makeContextCurrent())
     935        return;
     936
    872937
    873938    gl::GetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, params.data());
     
    876941GCGLenum GraphicsContextGLOpenGL::checkFramebufferStatus(GCGLenum target)
    877942{
    878     makeContextCurrent();
     943    if (!makeContextCurrent())
     944        return GL_INVALID_OPERATION;
     945
    879946    return gl::CheckFramebufferStatus(target);
    880947}
     
    882949void GraphicsContextGLOpenGL::clearColor(GCGLclampf r, GCGLclampf g, GCGLclampf b, GCGLclampf a)
    883950{
    884     makeContextCurrent();
     951    if (!makeContextCurrent())
     952        return;
     953
    885954    gl::ClearColor(r, g, b, a);
    886955}
     
    888957void GraphicsContextGLOpenGL::clear(GCGLbitfield mask)
    889958{
    890     makeContextCurrent();
     959    if (!makeContextCurrent())
     960        return;
     961
    891962    gl::Clear(mask);
    892963    checkGPUStatus();
     
    895966void GraphicsContextGLOpenGL::clearStencil(GCGLint s)
    896967{
    897     makeContextCurrent();
     968    if (!makeContextCurrent())
     969        return;
     970
    898971    gl::ClearStencil(s);
    899972}
     
    901974void GraphicsContextGLOpenGL::colorMask(GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha)
    902975{
    903     makeContextCurrent();
     976    if (!makeContextCurrent())
     977        return;
     978
    904979    gl::ColorMask(red, green, blue, alpha);
    905980}
     
    908983{
    909984    ASSERT(shader);
    910     makeContextCurrent();
     985    if (!makeContextCurrent())
     986        return;
     987
    911988    // We need the ANGLE_texture_rectangle extension to support IOSurface
    912989    // backbuffers, but we don't want it exposed to WebGL user shaders.
     
    920997{
    921998    ASSERT(shader);
    922     makeContextCurrent();
     999    if (!makeContextCurrent())
     1000        return;
     1001
    9231002    gl::CompileShader(shader);
    9241003}
     
    9261005void GraphicsContextGLOpenGL::copyTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLint border)
    9271006{
    928     makeContextCurrent();
     1007    if (!makeContextCurrent())
     1008        return;
     1009
    9291010    auto attrs = contextAttributes();
    9301011    GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
     
    9411022void GraphicsContextGLOpenGL::copyTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    9421023{
    943     makeContextCurrent();
     1024    if (!makeContextCurrent())
     1025        return;
     1026
    9441027    auto attrs = contextAttributes();
    9451028    GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
     
    9561039void GraphicsContextGLOpenGL::cullFace(GCGLenum mode)
    9571040{
    958     makeContextCurrent();
     1041    if (!makeContextCurrent())
     1042        return;
     1043
    9591044    gl::CullFace(mode);
    9601045}
     
    9621047void GraphicsContextGLOpenGL::depthFunc(GCGLenum func)
    9631048{
    964     makeContextCurrent();
     1049    if (!makeContextCurrent())
     1050        return;
     1051
    9651052    gl::DepthFunc(func);
    9661053}
     
    9681055void GraphicsContextGLOpenGL::depthMask(GCGLboolean flag)
    9691056{
    970     makeContextCurrent();
     1057    if (!makeContextCurrent())
     1058        return;
     1059
    9711060    gl::DepthMask(flag);
    9721061}
     
    9761065    ASSERT(program);
    9771066    ASSERT(shader);
    978     makeContextCurrent();
     1067    if (!makeContextCurrent())
     1068        return;
     1069
    9791070    gl::DetachShader(program, shader);
    9801071}
     
    9821073void GraphicsContextGLOpenGL::disable(GCGLenum cap)
    9831074{
    984     makeContextCurrent();
     1075    if (!makeContextCurrent())
     1076        return;
     1077
    9851078    gl::Disable(cap);
    9861079}
     
    9881081void GraphicsContextGLOpenGL::disableVertexAttribArray(GCGLuint index)
    9891082{
    990     makeContextCurrent();
     1083    if (!makeContextCurrent())
     1084        return;
     1085
    9911086    gl::DisableVertexAttribArray(index);
    9921087}
     
    9941089void GraphicsContextGLOpenGL::drawArrays(GCGLenum mode, GCGLint first, GCGLsizei count)
    9951090{
    996     makeContextCurrent();
     1091    if (!makeContextCurrent())
     1092        return;
     1093
    9971094    gl::DrawArrays(mode, first, count);
    9981095    checkGPUStatus();
     
    10011098void GraphicsContextGLOpenGL::drawElements(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset)
    10021099{
    1003     makeContextCurrent();
     1100    if (!makeContextCurrent())
     1101        return;
     1102
    10041103    gl::DrawElements(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)));
    10051104    checkGPUStatus();
     
    10081107void GraphicsContextGLOpenGL::enable(GCGLenum cap)
    10091108{
    1010     makeContextCurrent();
     1109    if (!makeContextCurrent())
     1110        return;
     1111
    10111112    gl::Enable(cap);
    10121113}
     
    10141115void GraphicsContextGLOpenGL::enableVertexAttribArray(GCGLuint index)
    10151116{
    1016     makeContextCurrent();
     1117    if (!makeContextCurrent())
     1118        return;
     1119
    10171120    gl::EnableVertexAttribArray(index);
    10181121}
     
    10201123void GraphicsContextGLOpenGL::finish()
    10211124{
    1022     makeContextCurrent();
     1125    if (!makeContextCurrent())
     1126        return;
     1127
    10231128    gl::Finish();
    10241129}
     
    10261131void GraphicsContextGLOpenGL::flush()
    10271132{
    1028     makeContextCurrent();
     1133    if (!makeContextCurrent())
     1134        return;
     1135
    10291136    gl::Flush();
    10301137}
     
    10321139void GraphicsContextGLOpenGL::framebufferRenderbuffer(GCGLenum target, GCGLenum attachment, GCGLenum renderbuffertarget, PlatformGLObject buffer)
    10331140{
    1034     makeContextCurrent();
     1141    if (!makeContextCurrent())
     1142        return;
     1143
    10351144    gl::FramebufferRenderbuffer(target, attachment, renderbuffertarget, buffer);
    10361145}
     
    10381147void GraphicsContextGLOpenGL::framebufferTexture2D(GCGLenum target, GCGLenum attachment, GCGLenum textarget, PlatformGLObject texture, GCGLint level)
    10391148{
    1040     makeContextCurrent();
     1149    if (!makeContextCurrent())
     1150        return;
     1151
    10411152    gl::FramebufferTexture2D(target, attachment, textarget, texture, level);
    10421153    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    10451156void GraphicsContextGLOpenGL::frontFace(GCGLenum mode)
    10461157{
    1047     makeContextCurrent();
     1158    if (!makeContextCurrent())
     1159        return;
     1160
    10481161    gl::FrontFace(mode);
    10491162}
     
    10511164void GraphicsContextGLOpenGL::generateMipmap(GCGLenum target)
    10521165{
    1053     makeContextCurrent();
     1166    if (!makeContextCurrent())
     1167        return;
     1168
    10541169    gl::GenerateMipmap(target);
    10551170}
     
    10611176        return false;
    10621177    }
    1063     makeContextCurrent();
     1178    if (!makeContextCurrent())
     1179        return false;
     1180
    10641181    GLint maxAttributeSize = 0;
    10651182    gl::GetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize);
     
    10901207    }
    10911208
    1092     makeContextCurrent();
     1209    if (!makeContextCurrent())
     1210        return false;
     1211
    10931212    GLint maxUniformSize = 0;
    10941213    gl::GetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize);
     
    11191238        return;
    11201239    }
    1121     makeContextCurrent();
     1240    if (!makeContextCurrent())
     1241        return;
     1242
    11221243    gl::GetAttachedShaders(program, maxCount, count, shaders);
    11231244}
     
    11281249        return -1;
    11291250
    1130     makeContextCurrent();
     1251    if (!makeContextCurrent())
     1252        return -1;
     1253
    11311254
    11321255    return gl::GetAttribLocation(program, name.utf8().data());
     
    11401263bool GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList()
    11411264{
    1142     makeContextCurrent();
     1265    if (!makeContextCurrent())
     1266        return false;
     1267
    11431268    bool movedAnError = false;
    11441269
     
    11671292    }
    11681293
    1169     makeContextCurrent();
     1294    if (!makeContextCurrent())
     1295        return GL_INVALID_OPERATION;
     1296
    11701297    return gl::GetError();
    11711298}
     
    11731300String GraphicsContextGLOpenGL::getString(GCGLenum name)
    11741301{
    1175     makeContextCurrent();
     1302    if (!makeContextCurrent())
     1303        return String();
     1304
    11761305    return String(reinterpret_cast<const char*>(gl::GetString(name)));
    11771306}
     
    11791308void GraphicsContextGLOpenGL::hint(GCGLenum target, GCGLenum mode)
    11801309{
    1181     makeContextCurrent();
     1310    if (!makeContextCurrent())
     1311        return;
     1312
    11821313    gl::Hint(target, mode);
    11831314}
     
    11881319        return GL_FALSE;
    11891320
    1190     makeContextCurrent();
     1321    if (!makeContextCurrent())
     1322        return GL_FALSE;
     1323
    11911324    return gl::IsBuffer(buffer);
    11921325}
     
    11941327GCGLboolean GraphicsContextGLOpenGL::isEnabled(GCGLenum cap)
    11951328{
    1196     makeContextCurrent();
     1329    if (!makeContextCurrent())
     1330        return GL_FALSE;
     1331
    11971332    return gl::IsEnabled(cap);
    11981333}
     
    12031338        return GL_FALSE;
    12041339
    1205     makeContextCurrent();
     1340    if (!makeContextCurrent())
     1341        return GL_FALSE;
     1342
    12061343    return gl::IsFramebuffer(framebuffer);
    12071344}
     
    12121349        return GL_FALSE;
    12131350
    1214     makeContextCurrent();
     1351    if (!makeContextCurrent())
     1352        return GL_FALSE;
     1353
    12151354    return gl::IsProgram(program);
    12161355}
     
    12211360        return GL_FALSE;
    12221361
    1223     makeContextCurrent();
     1362    if (!makeContextCurrent())
     1363        return GL_FALSE;
     1364
    12241365    return gl::IsRenderbuffer(renderbuffer);
    12251366}
     
    12301371        return GL_FALSE;
    12311372
    1232     makeContextCurrent();
     1373    if (!makeContextCurrent())
     1374        return GL_FALSE;
     1375
    12331376    return gl::IsShader(shader);
    12341377}
     
    12391382        return GL_FALSE;
    12401383
    1241     makeContextCurrent();
     1384    if (!makeContextCurrent())
     1385        return GL_FALSE;
     1386
    12421387    return gl::IsTexture(texture);
    12431388}
     
    12451390void GraphicsContextGLOpenGL::lineWidth(GCGLfloat width)
    12461391{
    1247     makeContextCurrent();
     1392    if (!makeContextCurrent())
     1393        return;
     1394
    12481395    gl::LineWidth(width);
    12491396}
     
    12521399{
    12531400    ASSERT(program);
    1254     makeContextCurrent();
     1401    if (!makeContextCurrent())
     1402        return;
     1403
    12551404    gl::LinkProgram(program);
    12561405}
     
    12581407void GraphicsContextGLOpenGL::pixelStorei(GCGLenum pname, GCGLint param)
    12591408{
    1260     makeContextCurrent();
     1409    if (!makeContextCurrent())
     1410        return;
     1411
    12611412    gl::PixelStorei(pname, param);
    12621413}
     
    12641415void GraphicsContextGLOpenGL::polygonOffset(GCGLfloat factor, GCGLfloat units)
    12651416{
    1266     makeContextCurrent();
     1417    if (!makeContextCurrent())
     1418        return;
     1419
    12671420    gl::PolygonOffset(factor, units);
    12681421}
     
    12701423void GraphicsContextGLOpenGL::sampleCoverage(GCGLclampf value, GCGLboolean invert)
    12711424{
    1272     makeContextCurrent();
     1425    if (!makeContextCurrent())
     1426        return;
     1427
    12731428    gl::SampleCoverage(value, invert);
    12741429}
     
    12761431void GraphicsContextGLOpenGL::scissor(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    12771432{
    1278     makeContextCurrent();
     1433    if (!makeContextCurrent())
     1434        return;
     1435
    12791436    gl::Scissor(x, y, width, height);
    12801437}
     
    12841441    ASSERT(shader);
    12851442
    1286     makeContextCurrent();
     1443    if (!makeContextCurrent())
     1444        return;
    12871445
    12881446    const CString& shaderSourceCString = string.utf8();
     
    12941452void GraphicsContextGLOpenGL::stencilFunc(GCGLenum func, GCGLint ref, GCGLuint mask)
    12951453{
    1296     makeContextCurrent();
     1454    if (!makeContextCurrent())
     1455        return;
     1456
    12971457    gl::StencilFunc(func, ref, mask);
    12981458}
     
    13001460void GraphicsContextGLOpenGL::stencilFuncSeparate(GCGLenum face, GCGLenum func, GCGLint ref, GCGLuint mask)
    13011461{
    1302     makeContextCurrent();
     1462    if (!makeContextCurrent())
     1463        return;
     1464
    13031465    gl::StencilFuncSeparate(face, func, ref, mask);
    13041466}
     
    13061468void GraphicsContextGLOpenGL::stencilMask(GCGLuint mask)
    13071469{
    1308     makeContextCurrent();
     1470    if (!makeContextCurrent())
     1471        return;
     1472
    13091473    gl::StencilMask(mask);
    13101474}
     
    13121476void GraphicsContextGLOpenGL::stencilMaskSeparate(GCGLenum face, GCGLuint mask)
    13131477{
    1314     makeContextCurrent();
     1478    if (!makeContextCurrent())
     1479        return;
     1480
    13151481    gl::StencilMaskSeparate(face, mask);
    13161482}
     
    13181484void GraphicsContextGLOpenGL::stencilOp(GCGLenum fail, GCGLenum zfail, GCGLenum zpass)
    13191485{
    1320     makeContextCurrent();
     1486    if (!makeContextCurrent())
     1487        return;
     1488
    13211489    gl::StencilOp(fail, zfail, zpass);
    13221490}
     
    13241492void GraphicsContextGLOpenGL::stencilOpSeparate(GCGLenum face, GCGLenum fail, GCGLenum zfail, GCGLenum zpass)
    13251493{
    1326     makeContextCurrent();
     1494    if (!makeContextCurrent())
     1495        return;
     1496
    13271497    gl::StencilOpSeparate(face, fail, zfail, zpass);
    13281498}
     
    13301500void GraphicsContextGLOpenGL::texParameterf(GCGLenum target, GCGLenum pname, GCGLfloat value)
    13311501{
    1332     makeContextCurrent();
     1502    if (!makeContextCurrent())
     1503        return;
     1504
    13331505    gl::TexParameterf(target, pname, value);
    13341506}
     
    13361508void GraphicsContextGLOpenGL::texParameteri(GCGLenum target, GCGLenum pname, GCGLint value)
    13371509{
    1338     makeContextCurrent();
     1510    if (!makeContextCurrent())
     1511        return;
     1512
    13391513    gl::TexParameteri(target, pname, value);
    13401514}
     
    13421516void GraphicsContextGLOpenGL::uniform1f(GCGLint location, GCGLfloat v0)
    13431517{
    1344     makeContextCurrent();
     1518    if (!makeContextCurrent())
     1519        return;
     1520
    13451521    gl::Uniform1f(location, v0);
    13461522}
     
    13481524void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, GCGLsizei size, const GCGLfloat* array)
    13491525{
    1350     makeContextCurrent();
     1526    if (!makeContextCurrent())
     1527        return;
     1528
    13511529    gl::Uniform1fv(location, size, array);
    13521530}
     
    13541532void GraphicsContextGLOpenGL::uniform2f(GCGLint location, GCGLfloat v0, GCGLfloat v1)
    13551533{
    1356     makeContextCurrent();
     1534    if (!makeContextCurrent())
     1535        return;
     1536
    13571537    gl::Uniform2f(location, v0, v1);
    13581538}
     
    13611541{
    13621542    // FIXME: length needs to be a multiple of 2.
    1363     makeContextCurrent();
     1543    if (!makeContextCurrent())
     1544        return;
     1545
    13641546    gl::Uniform2fv(location, size, array);
    13651547}
     
    13671549void GraphicsContextGLOpenGL::uniform3f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2)
    13681550{
    1369     makeContextCurrent();
     1551    if (!makeContextCurrent())
     1552        return;
     1553
    13701554    gl::Uniform3f(location, v0, v1, v2);
    13711555}
     
    13741558{
    13751559    // FIXME: length needs to be a multiple of 3.
    1376     makeContextCurrent();
     1560    if (!makeContextCurrent())
     1561        return;
     1562
    13771563    gl::Uniform3fv(location, size, array);
    13781564}
     
    13801566void GraphicsContextGLOpenGL::uniform4f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3)
    13811567{
    1382     makeContextCurrent();
     1568    if (!makeContextCurrent())
     1569        return;
     1570
    13831571    gl::Uniform4f(location, v0, v1, v2, v3);
    13841572}
     
    13871575{
    13881576    // FIXME: length needs to be a multiple of 4.
    1389     makeContextCurrent();
     1577    if (!makeContextCurrent())
     1578        return;
     1579
    13901580    gl::Uniform4fv(location, size, array);
    13911581}
     
    13931583void GraphicsContextGLOpenGL::uniform1i(GCGLint location, GCGLint v0)
    13941584{
    1395     makeContextCurrent();
     1585    if (!makeContextCurrent())
     1586        return;
     1587
    13961588    gl::Uniform1i(location, v0);
    13971589}
     
    13991591void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, GCGLsizei size, const GCGLint* array)
    14001592{
    1401     makeContextCurrent();
     1593    if (!makeContextCurrent())
     1594        return;
     1595
    14021596    gl::Uniform1iv(location, size, array);
    14031597}
     
    14051599void GraphicsContextGLOpenGL::uniform2i(GCGLint location, GCGLint v0, GCGLint v1)
    14061600{
    1407     makeContextCurrent();
     1601    if (!makeContextCurrent())
     1602        return;
     1603
    14081604    gl::Uniform2i(location, v0, v1);
    14091605}
     
    14121608{
    14131609    // FIXME: length needs to be a multiple of 2.
    1414     makeContextCurrent();
     1610    if (!makeContextCurrent())
     1611        return;
     1612
    14151613    gl::Uniform2iv(location, size, array);
    14161614}
     
    14181616void GraphicsContextGLOpenGL::uniform3i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2)
    14191617{
    1420     makeContextCurrent();
     1618    if (!makeContextCurrent())
     1619        return;
     1620
    14211621    gl::Uniform3i(location, v0, v1, v2);
    14221622}
     
    14251625{
    14261626    // FIXME: length needs to be a multiple of 3.
    1427     makeContextCurrent();
     1627    if (!makeContextCurrent())
     1628        return;
     1629
    14281630    gl::Uniform3iv(location, size, array);
    14291631}
     
    14311633void GraphicsContextGLOpenGL::uniform4i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2, GCGLint v3)
    14321634{
    1433     makeContextCurrent();
     1635    if (!makeContextCurrent())
     1636        return;
     1637
    14341638    gl::Uniform4i(location, v0, v1, v2, v3);
    14351639}
     
    14381642{
    14391643    // FIXME: length needs to be a multiple of 4.
    1440     makeContextCurrent();
     1644    if (!makeContextCurrent())
     1645        return;
     1646
    14411647    gl::Uniform4iv(location, size, array);
    14421648}
     
    14451651{
    14461652    // FIXME: length needs to be a multiple of 4.
    1447     makeContextCurrent();
     1653    if (!makeContextCurrent())
     1654        return;
     1655
    14481656    gl::UniformMatrix2fv(location, size, transpose, array);
    14491657}
     
    14521660{
    14531661    // FIXME: length needs to be a multiple of 9.
    1454     makeContextCurrent();
     1662    if (!makeContextCurrent())
     1663        return;
     1664
    14551665    gl::UniformMatrix3fv(location, size, transpose, array);
    14561666}
     
    14591669{
    14601670    // FIXME: length needs to be a multiple of 16.
    1461     makeContextCurrent();
     1671    if (!makeContextCurrent())
     1672        return;
     1673
    14621674    gl::UniformMatrix4fv(location, size, transpose, array);
    14631675}
     
    14651677void GraphicsContextGLOpenGL::useProgram(PlatformGLObject program)
    14661678{
    1467     makeContextCurrent();
     1679    if (!makeContextCurrent())
     1680        return;
     1681
    14681682    gl::UseProgram(program);
    14691683}
     
    14731687    ASSERT(program);
    14741688
    1475     makeContextCurrent();
     1689    if (!makeContextCurrent())
     1690        return;
     1691
    14761692    gl::ValidateProgram(program);
    14771693}
     
    14791695void GraphicsContextGLOpenGL::vertexAttrib1f(GCGLuint index, GCGLfloat v0)
    14801696{
    1481     makeContextCurrent();
     1697    if (!makeContextCurrent())
     1698        return;
     1699
    14821700    gl::VertexAttrib1f(index, v0);
    14831701}
     
    14851703void GraphicsContextGLOpenGL::vertexAttrib1fv(GCGLuint index, const GCGLfloat* array)
    14861704{
    1487     makeContextCurrent();
     1705    if (!makeContextCurrent())
     1706        return;
     1707
    14881708    gl::VertexAttrib1fv(index, array);
    14891709}
     
    14911711void GraphicsContextGLOpenGL::vertexAttrib2f(GCGLuint index, GCGLfloat v0, GCGLfloat v1)
    14921712{
    1493     makeContextCurrent();
     1713    if (!makeContextCurrent())
     1714        return;
     1715
    14941716    gl::VertexAttrib2f(index, v0, v1);
    14951717}
     
    14971719void GraphicsContextGLOpenGL::vertexAttrib2fv(GCGLuint index, const GCGLfloat* array)
    14981720{
    1499     makeContextCurrent();
     1721    if (!makeContextCurrent())
     1722        return;
     1723
    15001724    gl::VertexAttrib2fv(index, array);
    15011725}
     
    15031727void GraphicsContextGLOpenGL::vertexAttrib3f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2)
    15041728{
    1505     makeContextCurrent();
     1729    if (!makeContextCurrent())
     1730        return;
     1731
    15061732    gl::VertexAttrib3f(index, v0, v1, v2);
    15071733}
     
    15091735void GraphicsContextGLOpenGL::vertexAttrib3fv(GCGLuint index, const GCGLfloat* array)
    15101736{
    1511     makeContextCurrent();
     1737    if (!makeContextCurrent())
     1738        return;
     1739
    15121740    gl::VertexAttrib3fv(index, array);
    15131741}
     
    15151743void GraphicsContextGLOpenGL::vertexAttrib4f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3)
    15161744{
    1517     makeContextCurrent();
     1745    if (!makeContextCurrent())
     1746        return;
     1747
    15181748    gl::VertexAttrib4f(index, v0, v1, v2, v3);
    15191749}
     
    15211751void GraphicsContextGLOpenGL::vertexAttrib4fv(GCGLuint index, const GCGLfloat* array)
    15221752{
    1523     makeContextCurrent();
     1753    if (!makeContextCurrent())
     1754        return;
     1755
    15241756    gl::VertexAttrib4fv(index, array);
    15251757}
     
    15271759void GraphicsContextGLOpenGL::vertexAttribPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLboolean normalized, GCGLsizei stride, GCGLintptr offset)
    15281760{
    1529     makeContextCurrent();
     1761    if (!makeContextCurrent())
     1762        return;
     1763
    15301764    gl::VertexAttribPointer(index, size, type, normalized, stride, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)));
    15311765}
     
    15331767void GraphicsContextGLOpenGL::vertexAttribIPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLsizei stride, GCGLintptr offset)
    15341768{
    1535     makeContextCurrent();
     1769    if (!makeContextCurrent())
     1770        return;
     1771
    15361772    gl::VertexAttribIPointer(index, size, type, stride, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)));
    15371773}
     
    15391775void GraphicsContextGLOpenGL::viewport(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    15401776{
    1541     makeContextCurrent();
     1777    if (!makeContextCurrent())
     1778        return;
     1779
    15421780    gl::Viewport(x, y, width, height);
    15431781}
     
    15451783PlatformGLObject GraphicsContextGLOpenGL::createVertexArray()
    15461784{
    1547     makeContextCurrent();
     1785    if (!makeContextCurrent())
     1786        return 0;
     1787
    15481788    GLuint array = 0;
    15491789    gl::GenVertexArrays(1, &array);
     
    15551795    if (!array)
    15561796        return;
    1557     makeContextCurrent();
     1797    if (!makeContextCurrent())
     1798        return;
     1799
    15581800    gl::DeleteVertexArrays(1, &array);
    15591801}
     
    15631805    if (!array)
    15641806        return GL_FALSE;
    1565     makeContextCurrent();
     1807    if (!makeContextCurrent())
     1808        return GL_FALSE;
     1809
    15661810    return gl::IsVertexArray(array);
    15671811}
     
    15691813void GraphicsContextGLOpenGL::bindVertexArray(PlatformGLObject array)
    15701814{
    1571     makeContextCurrent();
     1815    if (!makeContextCurrent())
     1816        return;
     1817
    15721818    gl::BindVertexArray(array);
    15731819}
     
    15751821void GraphicsContextGLOpenGL::getBooleanv(GCGLenum pname, GCGLboolean* value)
    15761822{
    1577     makeContextCurrent();
     1823    if (!makeContextCurrent())
     1824        return;
     1825
    15781826    gl::GetBooleanv(pname, value);
    15791827}
     
    15811829void GraphicsContextGLOpenGL::getBufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    15821830{
    1583     makeContextCurrent();
     1831    if (!makeContextCurrent())
     1832        return;
     1833
    15841834    gl::GetBufferParameteriv(target, pname, value);
    15851835}
     
    15871837void GraphicsContextGLOpenGL::getFloatv(GCGLenum pname, GCGLfloat* value)
    15881838{
    1589     makeContextCurrent();
     1839    if (!makeContextCurrent())
     1840        return;
     1841
    15901842    gl::GetFloatv(pname, value);
    15911843}
     
    15931845void GraphicsContextGLOpenGL::getInteger64v(GCGLenum pname, GCGLint64* value)
    15941846{
    1595     makeContextCurrent();
     1847    if (!makeContextCurrent())
     1848        return;
     1849
    15961850    *value = 0;
    15971851    gl::GetInteger64v(pname, value);
     
    16001854void GraphicsContextGLOpenGL::getInteger64i_v(GCGLenum pname, GCGLuint index, GCGLint64* value)
    16011855{
    1602     makeContextCurrent();
     1856    if (!makeContextCurrent())
     1857        return;
     1858
    16031859    *value = 0;
    16041860    gl::GetInteger64i_v(pname, index, value);
     
    16071863void GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv(GCGLenum target, GCGLenum attachment, GCGLenum pname, GCGLint* value)
    16081864{
    1609     makeContextCurrent();
     1865    if (!makeContextCurrent())
     1866        return;
     1867
    16101868    if (attachment == DEPTH_STENCIL_ATTACHMENT)
    16111869        attachment = DEPTH_ATTACHMENT; // Or STENCIL_ATTACHMENT, either works.
     
    16151873void GraphicsContextGLOpenGL::getProgramiv(PlatformGLObject program, GCGLenum pname, GCGLint* value)
    16161874{
    1617     makeContextCurrent();
     1875    if (!makeContextCurrent())
     1876        return;
     1877
    16181878    gl::GetProgramiv(program, pname, value);
    16191879}
     
    16431903    ASSERT(program);
    16441904
    1645     makeContextCurrent();
     1905    if (!makeContextCurrent())
     1906        return String();
     1907
    16461908    GLint length = 0;
    16471909    gl::GetProgramiv(program, GL_INFO_LOG_LENGTH, &length);
     
    16621924void GraphicsContextGLOpenGL::getRenderbufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    16631925{
    1664     makeContextCurrent();
     1926    if (!makeContextCurrent())
     1927        return;
     1928
    16651929    gl::GetRenderbufferParameteriv(target, pname, value);
    16661930}
     
    16701934    ASSERT(shader);
    16711935
    1672     makeContextCurrent();
     1936    if (!makeContextCurrent())
     1937        return;
     1938
    16731939    gl::GetShaderiv(shader, pname, value);
    16741940}
     
    16781944    ASSERT(shader);
    16791945
    1680     makeContextCurrent();
     1946    if (!makeContextCurrent())
     1947        return String();
     1948
    16811949    GLint length = 0;
    16821950    gl::GetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
     
    16991967void GraphicsContextGLOpenGL::getTexParameterfv(GCGLenum target, GCGLenum pname, GCGLfloat* value)
    17001968{
    1701     makeContextCurrent();
     1969    if (!makeContextCurrent())
     1970        return;
     1971
    17021972    gl::GetTexParameterfv(target, pname, value);
    17031973}
     
    17051975void GraphicsContextGLOpenGL::getTexParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    17061976{
    1707     makeContextCurrent();
     1977    if (!makeContextCurrent())
     1978        return;
     1979
    17081980    gl::GetTexParameteriv(target, pname, value);
    17091981}
     
    17111983void GraphicsContextGLOpenGL::getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value)
    17121984{
    1713     makeContextCurrent();
     1985    if (!makeContextCurrent())
     1986        return;
     1987
    17141988    gl::GetUniformfv(program, location, value);
    17151989}
     
    17171991void GraphicsContextGLOpenGL::getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value)
    17181992{
    1719     makeContextCurrent();
     1993    if (!makeContextCurrent())
     1994        return;
     1995
    17201996    gl::GetUniformiv(program, location, value);
    17211997}
     
    17231999void GraphicsContextGLOpenGL::getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value)
    17242000{
    1725     makeContextCurrent();
     2001    if (!makeContextCurrent())
     2002        return;
     2003
    17262004    gl::GetUniformuiv(program, location, value);
    17272005}
     
    17312009    ASSERT(program);
    17322010
    1733     makeContextCurrent();
     2011    if (!makeContextCurrent())
     2012        return -1;
     2013
    17342014    return gl::GetUniformLocation(program, name.utf8().data());
    17352015}
     
    17372017void GraphicsContextGLOpenGL::getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLfloat* value)
    17382018{
    1739     makeContextCurrent();
     2019    if (!makeContextCurrent())
     2020        return;
     2021
    17402022    gl::GetVertexAttribfv(index, pname, value);
    17412023}
     
    17432025void GraphicsContextGLOpenGL::getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLint* value)
    17442026{
    1745     makeContextCurrent();
     2027    if (!makeContextCurrent())
     2028        return;
     2029
    17462030    gl::GetVertexAttribiv(index, pname, value);
    17472031}
     
    17492033GCGLsizeiptr GraphicsContextGLOpenGL::getVertexAttribOffset(GCGLuint index, GCGLenum pname)
    17502034{
    1751     makeContextCurrent();
     2035    if (!makeContextCurrent())
     2036        return 0;
    17522037
    17532038    GLvoid* pointer = 0;
     
    17582043void GraphicsContextGLOpenGL::texSubImage2D(GCGLenum target, GCGLint level, GCGLint xoff, GCGLint yoff, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, const void* pixels)
    17592044{
    1760     makeContextCurrent();
     2045    if (!makeContextCurrent())
     2046        return;
    17612047
    17622048    // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size.
     
    17672053void GraphicsContextGLOpenGL::compressedTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLsizei imageSize, const void* data)
    17682054{
    1769     makeContextCurrent();
     2055    if (!makeContextCurrent())
     2056        return;
     2057
    17702058    gl::CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
    17712059    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    17742062void GraphicsContextGLOpenGL::compressedTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLsizei imageSize, const void* data)
    17752063{
    1776     makeContextCurrent();
     2064    if (!makeContextCurrent())
     2065        return;
     2066
    17772067    gl::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
    17782068    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    17812071PlatformGLObject GraphicsContextGLOpenGL::createBuffer()
    17822072{
    1783     makeContextCurrent();
     2073    if (!makeContextCurrent())
     2074        return 0;
     2075
    17842076    GLuint o = 0;
    17852077    gl::GenBuffers(1, &o);
     
    17892081PlatformGLObject GraphicsContextGLOpenGL::createFramebuffer()
    17902082{
    1791     makeContextCurrent();
     2083    if (!makeContextCurrent())
     2084        return 0;
     2085
    17922086    GLuint o = 0;
    17932087    gl::GenFramebuffers(1, &o);
     
    17972091PlatformGLObject GraphicsContextGLOpenGL::createProgram()
    17982092{
    1799     makeContextCurrent();
     2093    if (!makeContextCurrent())
     2094        return 0;
     2095
    18002096    return gl::CreateProgram();
    18012097}
     
    18032099PlatformGLObject GraphicsContextGLOpenGL::createRenderbuffer()
    18042100{
    1805     makeContextCurrent();
     2101    if (!makeContextCurrent())
     2102        return 0;
     2103
    18062104    GLuint o = 0;
    18072105    gl::GenRenderbuffers(1, &o);
     
    18112109PlatformGLObject GraphicsContextGLOpenGL::createShader(GCGLenum type)
    18122110{
    1813     makeContextCurrent();
     2111    if (!makeContextCurrent())
     2112        return 0;
     2113
    18142114    return gl::CreateShader((type == FRAGMENT_SHADER) ? GL_FRAGMENT_SHADER : GL_VERTEX_SHADER);
    18152115}
     
    18172117PlatformGLObject GraphicsContextGLOpenGL::createTexture()
    18182118{
    1819     makeContextCurrent();
     2119    if (!makeContextCurrent())
     2120        return 0;
     2121
    18202122    GLuint o = 0;
    18212123    gl::GenTextures(1, &o);
     
    18262128void GraphicsContextGLOpenGL::deleteBuffer(PlatformGLObject buffer)
    18272129{
    1828     makeContextCurrent();
     2130    if (!makeContextCurrent())
     2131        return;
     2132
    18292133    gl::DeleteBuffers(1, &buffer);
    18302134}
     
    18322136void GraphicsContextGLOpenGL::deleteFramebuffer(PlatformGLObject framebuffer)
    18332137{
    1834     makeContextCurrent();
     2138    if (!makeContextCurrent())
     2139        return;
     2140
    18352141    // Make sure the framebuffer is not going to be used for drawing
    18362142    // operations after it gets deleted.
     
    18472153void GraphicsContextGLOpenGL::deleteProgram(PlatformGLObject program)
    18482154{
    1849     makeContextCurrent();
     2155    if (!makeContextCurrent())
     2156        return;
     2157
    18502158    gl::DeleteProgram(program);
    18512159}
     
    18532161void GraphicsContextGLOpenGL::deleteRenderbuffer(PlatformGLObject renderbuffer)
    18542162{
    1855     makeContextCurrent();
     2163    if (!makeContextCurrent())
     2164        return;
     2165
    18562166    gl::DeleteRenderbuffers(1, &renderbuffer);
    18572167}
     
    18592169void GraphicsContextGLOpenGL::deleteShader(PlatformGLObject shader)
    18602170{
    1861     makeContextCurrent();
     2171    if (!makeContextCurrent())
     2172        return;
     2173
    18622174    gl::DeleteShader(shader);
    18632175}
     
    18652177void GraphicsContextGLOpenGL::deleteTexture(PlatformGLObject texture)
    18662178{
    1867     makeContextCurrent();
     2179    if (!makeContextCurrent())
     2180        return;
     2181
    18682182    m_state.boundTextureMap.removeIf([texture] (auto& keyValue) {
    18692183        return keyValue.value.first == texture;
     
    19212235void GraphicsContextGLOpenGL::texImage2DDirect(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, const void* pixels)
    19222236{
    1923     makeContextCurrent();
     2237    if (!makeContextCurrent())
     2238        return;
     2239
    19242240    if (!m_isForWebGL2 && m_extensions)
    19252241        internalformat = m_extensions->adjustWebGL1TextureInternalFormat(internalformat, format, type);
     
    19302246void GraphicsContextGLOpenGL::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
    19312247{
     2248    if (!makeContextCurrent())
     2249        return;
     2250
    19322251    if (m_isForWebGL2)
    19332252        gl::DrawArraysInstanced(mode, first, count, primcount);
    19342253    else
    1935         getExtensions().drawArraysInstanced(mode, first, count, primcount);
     2254        gl::DrawArraysInstancedANGLE(mode, first, count, primcount);
    19362255    checkGPUStatus();
    19372256}
     
    19392258void GraphicsContextGLOpenGL::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset, GCGLsizei primcount)
    19402259{
     2260    if (!makeContextCurrent())
     2261        return;
     2262
    19412263    if (m_isForWebGL2)
    19422264        gl::DrawElementsInstanced(mode, count, type, reinterpret_cast<void*>(offset), primcount);
    19432265    else
    1944         getExtensions().drawElementsInstanced(mode, count, type, offset, primcount);
     2266        gl::DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<void*>(offset), primcount);
    19452267    checkGPUStatus();
    19462268}
     
    19482270void GraphicsContextGLOpenGL::vertexAttribDivisor(GCGLuint index, GCGLuint divisor)
    19492271{
     2272    if (!makeContextCurrent())
     2273        return;
     2274
    19502275    if (m_isForWebGL2)
    19512276        gl::VertexAttribDivisor(index, divisor);
    19522277    else
    1953         getExtensions().vertexAttribDivisor(index, divisor);
     2278        gl::VertexAttribDivisorANGLE(index, divisor);
    19542279}
    19552280
     
    19572282{
    19582283    ASSERT(program);
    1959     makeContextCurrent();
     2284    if (!makeContextCurrent())
     2285        return GL_INVALID_INDEX;
     2286
    19602287    return gl::GetUniformBlockIndex(program, uniformBlockName.utf8().data());
    19612288}
     
    19742301{
    19752302    ASSERT(program);
    1976     makeContextCurrent();
     2303    if (!makeContextCurrent())
     2304        return String();
     2305
    19772306    GLint maxLength = 0;
    19782307    gl::GetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &maxLength);
     
    19922321{
    19932322    ASSERT(program);
    1994     makeContextCurrent();
     2323    if (!makeContextCurrent())
     2324        return;
     2325
    19952326    gl::UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
    19962327}
     
    20002331PlatformGLObject GraphicsContextGLOpenGL::createQuery()
    20012332{
    2002     makeContextCurrent();
     2333    if (!makeContextCurrent())
     2334        return 0;
     2335
    20032336    GLuint name = 0;
    20042337    gl::GenQueries(1, &name);
     
    20082341void GraphicsContextGLOpenGL::beginQuery(GCGLenum target, PlatformGLObject query)
    20092342{
    2010     makeContextCurrent();
     2343    if (!makeContextCurrent())
     2344        return;
     2345
    20112346    gl::BeginQuery(target, query);
    20122347}
     
    20142349void GraphicsContextGLOpenGL::endQuery(GCGLenum target)
    20152350{
    2016     makeContextCurrent();
     2351    if (!makeContextCurrent())
     2352        return;
     2353
    20172354    gl::EndQuery(target);
    20182355}
     
    20202357void GraphicsContextGLOpenGL::getQueryObjectuiv(GCGLuint id, GCGLenum pname, GCGLuint* params)
    20212358{
    2022     makeContextCurrent();
     2359    if (!makeContextCurrent())
     2360        return;
     2361
    20232362    gl::GetQueryObjectuiv(id, pname, params);
    20242363}
     
    20282367PlatformGLObject GraphicsContextGLOpenGL::createTransformFeedback()
    20292368{
    2030     makeContextCurrent();
     2369    if (!makeContextCurrent())
     2370        return 0;
     2371
    20312372    GLuint name = 0;
    20322373    gl::GenTransformFeedbacks(1, &name);
     
    20362377void GraphicsContextGLOpenGL::deleteTransformFeedback(PlatformGLObject transformFeedback)
    20372378{
    2038     makeContextCurrent();
     2379    if (!makeContextCurrent())
     2380        return;
     2381
    20392382    gl::DeleteTransformFeedbacks(1, &transformFeedback);
    20402383}
     
    20422385GCGLboolean GraphicsContextGLOpenGL::isTransformFeedback(PlatformGLObject transformFeedback)
    20432386{
    2044     makeContextCurrent();
     2387    if (!makeContextCurrent())
     2388        return GL_FALSE;
     2389
    20452390    return gl::IsTransformFeedback(transformFeedback);
    20462391}
     
    20482393void GraphicsContextGLOpenGL::bindTransformFeedback(GCGLenum target, PlatformGLObject transformFeedback)
    20492394{
    2050     makeContextCurrent();
     2395    if (!makeContextCurrent())
     2396        return;
     2397
    20512398    gl::BindTransformFeedback(target, transformFeedback);
    20522399}
     
    20542401void GraphicsContextGLOpenGL::beginTransformFeedback(GCGLenum primitiveMode)
    20552402{
    2056     makeContextCurrent();
     2403    if (!makeContextCurrent())
     2404        return;
     2405
    20572406    gl::BeginTransformFeedback(primitiveMode);
    20582407}
     
    20602409void GraphicsContextGLOpenGL::endTransformFeedback()
    20612410{
    2062     makeContextCurrent();
     2411    if (!makeContextCurrent())
     2412        return;
     2413
    20632414    gl::EndTransformFeedback();
    20642415}
     
    20662417void GraphicsContextGLOpenGL::transformFeedbackVaryings(PlatformGLObject program, const Vector<String>& varyings, GCGLenum bufferMode)
    20672418{
     2419    if (!makeContextCurrent())
     2420        return;
     2421
    20682422    Vector<CString> convertedVaryings = varyings.map([](const String& varying) {
    20692423        return varying.utf8();
     
    20722426        return varying.data();
    20732427    });
    2074     makeContextCurrent();
     2428
    20752429    gl::TransformFeedbackVaryings(program, pointersToVaryings.size(), pointersToVaryings.data(), bufferMode);
    20762430}
     
    20782432void GraphicsContextGLOpenGL::getTransformFeedbackVarying(PlatformGLObject program, GCGLuint index, ActiveInfo& info)
    20792433{
    2080     makeContextCurrent();
     2434    if (!makeContextCurrent())
     2435        return;
     2436
    20812437    GCGLsizei bufSize = 0;
    20822438    gl::GetProgramiv(program, GraphicsContextGLOpenGL::TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &bufSize);
     
    20982454void GraphicsContextGLOpenGL::bindBufferBase(GCGLenum target, GCGLuint index, PlatformGLObject buffer)
    20992455{
    2100     makeContextCurrent();
     2456    if (!makeContextCurrent())
     2457        return;
     2458
    21012459    gl::BindBufferBase(target, index, buffer);
    21022460}
     
    21322490void GraphicsContextGLOpenGL::blitFramebuffer(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter)
    21332491{
     2492    if (!makeContextCurrent())
     2493        return;
     2494
    21342495    gl::BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
    21352496}
     
    21372498void GraphicsContextGLOpenGL::framebufferTextureLayer(GCGLenum target, GCGLenum attachment, PlatformGLObject texture, GCGLint level, GCGLint layer)
    21382499{
     2500    if (!makeContextCurrent())
     2501        return;
     2502
    21392503    gl::FramebufferTextureLayer(target, attachment, texture, level, layer);
    21402504}
     
    21422506void GraphicsContextGLOpenGL::invalidateFramebuffer(GCGLenum target, GCGLsizei numAttachments, const GCGLenum* attachments)
    21432507{
     2508    if (!makeContextCurrent())
     2509        return;
     2510
    21442511    gl::InvalidateFramebuffer(target, numAttachments, attachments);
    21452512}
     
    21472514void GraphicsContextGLOpenGL::invalidateSubFramebuffer(GCGLenum target, GCGLsizei numAttachments, const GCGLenum* attachments, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    21482515{
     2516    if (!makeContextCurrent())
     2517        return;
     2518
    21492519    gl::InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
    21502520}
     
    21522522void GraphicsContextGLOpenGL::readBuffer(GCGLenum src)
    21532523{
     2524    if (!makeContextCurrent())
     2525        return;
     2526
    21542527    gl::ReadBuffer(src);
    21552528}
     
    21572530void GraphicsContextGLOpenGL::copyTexSubImage3D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint zoffset, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    21582531{
    2159     makeContextCurrent();
     2532    if (!makeContextCurrent())
     2533        return;
     2534
    21602535    auto attrs = contextAttributes();
    21612536    GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
     
    21722547GCGLint GraphicsContextGLOpenGL::getFragDataLocation(PlatformGLObject program, const String& name)
    21732548{
    2174     makeContextCurrent();
     2549    if (!makeContextCurrent())
     2550        return -1;
     2551
    21752552    return gl::GetFragDataLocation(program, name.utf8().data());
    21762553}
     
    21782555void GraphicsContextGLOpenGL::uniform1ui(GCGLint location, GCGLuint v0)
    21792556{
    2180     makeContextCurrent();
     2557    if (!makeContextCurrent())
     2558        return;
     2559
    21812560    gl::Uniform1ui(location, v0);
    21822561}
     
    21842563void GraphicsContextGLOpenGL::uniform2ui(GCGLint location, GCGLuint v0, GCGLuint v1)
    21852564{
    2186     makeContextCurrent();
     2565    if (!makeContextCurrent())
     2566        return;
     2567
    21872568    gl::Uniform2ui(location, v0, v1);
    21882569}
     
    21902571void GraphicsContextGLOpenGL::uniform3ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2)
    21912572{
    2192     makeContextCurrent();
     2573    if (!makeContextCurrent())
     2574        return;
     2575
    21932576    gl::Uniform3ui(location, v0, v1, v2);
    21942577}
     
    21962579void GraphicsContextGLOpenGL::uniform4ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2, GCGLuint v3)
    21972580{
    2198     makeContextCurrent();
     2581    if (!makeContextCurrent())
     2582        return;
     2583
    21992584    gl::Uniform4ui(location, v0, v1, v2, v3);
    22002585}
     
    22022587void GraphicsContextGLOpenGL::uniform1uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
    22032588{
    2204     makeContextCurrent();
     2589    if (!makeContextCurrent())
     2590        return;
     2591
    22052592    gl::Uniform1uiv(location, srcLength, data + srcOffset);
    22062593}
     
    22082595void GraphicsContextGLOpenGL::uniform2uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
    22092596{
    2210     makeContextCurrent();
     2597    if (!makeContextCurrent())
     2598        return;
     2599
    22112600    gl::Uniform2uiv(location, srcLength, data + srcOffset);
    22122601}
     
    22142603void GraphicsContextGLOpenGL::uniform3uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
    22152604{
    2216     makeContextCurrent();
     2605    if (!makeContextCurrent())
     2606        return;
     2607
    22172608    gl::Uniform3uiv(location, srcLength, data + srcOffset);
    22182609}
     
    22202611void GraphicsContextGLOpenGL::uniform4uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
    22212612{
    2222     makeContextCurrent();
     2613    if (!makeContextCurrent())
     2614        return;
     2615
    22232616    gl::Uniform4uiv(location, srcLength, data + srcOffset);
    22242617}
     
    22262619void GraphicsContextGLOpenGL::uniformMatrix2x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22272620{
    2228     makeContextCurrent();
     2621    if (!makeContextCurrent())
     2622        return;
     2623
    22292624    gl::UniformMatrix2x3fv(location, srcLength, transpose, data + srcOffset);
    22302625}
     
    22322627void GraphicsContextGLOpenGL::uniformMatrix3x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22332628{
    2234     makeContextCurrent();
     2629    if (!makeContextCurrent())
     2630        return;
     2631
    22352632    gl::UniformMatrix3x2fv(location, srcLength, transpose, data + srcOffset);
    22362633}
     
    22382635void GraphicsContextGLOpenGL::uniformMatrix2x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22392636{
    2240     makeContextCurrent();
     2637    if (!makeContextCurrent())
     2638        return;
     2639
    22412640    gl::UniformMatrix2x4fv(location, srcLength, transpose, data + srcOffset);
    22422641}
     
    22442643void GraphicsContextGLOpenGL::uniformMatrix4x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22452644{
    2246     makeContextCurrent();
     2645    if (!makeContextCurrent())
     2646        return;
     2647
    22472648    gl::UniformMatrix4x2fv(location, srcLength, transpose, data + srcOffset);
    22482649}
     
    22502651void GraphicsContextGLOpenGL::uniformMatrix3x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22512652{
    2252     makeContextCurrent();
     2653    if (!makeContextCurrent())
     2654        return;
     2655
    22532656    gl::UniformMatrix3x4fv(location, srcLength, transpose, data + srcOffset);
    22542657}
     
    22562659void GraphicsContextGLOpenGL::uniformMatrix4x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22572660{
    2258     makeContextCurrent();
     2661    if (!makeContextCurrent())
     2662        return;
     2663
    22592664    gl::UniformMatrix4x3fv(location, srcLength, transpose, data + srcOffset);
    22602665}
     
    22622667void GraphicsContextGLOpenGL::vertexAttribI4i(GCGLuint index, GCGLint x, GCGLint y, GCGLint z, GCGLint w)
    22632668{
    2264     makeContextCurrent();
     2669    if (!makeContextCurrent())
     2670        return;
     2671
    22652672    gl::VertexAttribI4i(index, x, y, z, w);
    22662673}
     
    22682675void GraphicsContextGLOpenGL::vertexAttribI4iv(GCGLuint index, const GCGLint* values)
    22692676{
    2270     makeContextCurrent();
     2677    if (!makeContextCurrent())
     2678        return;
     2679
    22712680    gl::VertexAttribI4iv(index, values);
    22722681}
     
    22742683void GraphicsContextGLOpenGL::vertexAttribI4ui(GCGLuint index, GCGLuint x, GCGLuint y, GCGLuint z, GCGLuint w)
    22752684{
    2276     makeContextCurrent();
     2685    if (!makeContextCurrent())
     2686        return;
     2687
    22772688    gl::VertexAttribI4ui(index, x, y, z, w);
    22782689}
     
    22802691void GraphicsContextGLOpenGL::vertexAttribI4uiv(GCGLuint index, const GCGLuint* values)
    22812692{
    2282     makeContextCurrent();
     2693    if (!makeContextCurrent())
     2694        return;
     2695
    22832696    gl::VertexAttribI4uiv(index, values);
    22842697}
     
    22862699void GraphicsContextGLOpenGL::drawRangeElements(GCGLenum mode, GCGLuint start, GCGLuint end, GCGLsizei count, GCGLenum type, GCGLintptr offset)
    22872700{
     2701    if (!makeContextCurrent())
     2702        return;
     2703
    22882704    gl::DrawRangeElements(mode, start, end, count, type, reinterpret_cast<void*>(offset));
    22892705}
     
    22912707void GraphicsContextGLOpenGL::drawBuffers(GCGLsizei n, const GCGLenum* bufs)
    22922708{
     2709    if (!makeContextCurrent())
     2710        return;
     2711
    22932712    gl::DrawBuffers(n, bufs);
    22942713}
     
    22962715void GraphicsContextGLOpenGL::clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLint* values, GCGLuint srcOffset)
    22972716{
     2717    if (!makeContextCurrent())
     2718        return;
     2719
    22982720    gl::ClearBufferiv(buffer, drawbuffer, values + srcOffset);
    22992721}
     
    23012723void GraphicsContextGLOpenGL::clearBufferuiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLuint* values, GCGLuint srcOffset)
    23022724{
     2725    if (!makeContextCurrent())
     2726        return;
     2727
    23032728    gl::ClearBufferuiv(buffer, drawbuffer, values + srcOffset);
    23042729}
     
    23062731void GraphicsContextGLOpenGL::clearBufferfv(GCGLenum buffer, GCGLint drawbuffer, const GCGLfloat* values, GCGLuint srcOffset)
    23072732{
     2733    if (!makeContextCurrent())
     2734        return;
     2735
    23082736    gl::ClearBufferfv(buffer, drawbuffer, values + srcOffset);
    23092737}
     
    23112739void GraphicsContextGLOpenGL::clearBufferfi(GCGLenum buffer, GCGLint drawbuffer, GCGLfloat depth, GCGLint stencil)
    23122740{
     2741    if (!makeContextCurrent())
     2742        return;
     2743
    23132744    gl::ClearBufferfi(buffer, drawbuffer, depth, stencil);
    23142745}
     
    23162747void GraphicsContextGLOpenGL::deleteQuery(PlatformGLObject query)
    23172748{
    2318     makeContextCurrent();
     2749    if (!makeContextCurrent())
     2750        return;
     2751
    23192752    gl::DeleteQueries(1, &query);
    23202753}
     
    23222755GCGLboolean GraphicsContextGLOpenGL::isQuery(PlatformGLObject query)
    23232756{
    2324     makeContextCurrent();
     2757    if (!makeContextCurrent())
     2758        return GL_FALSE;
     2759
    23252760    return gl::IsQuery(query);
    23262761}
     
    23282763PlatformGLObject GraphicsContextGLOpenGL::getQuery(GCGLenum target, GCGLenum pname)
    23292764{
    2330     makeContextCurrent();
     2765    if (!makeContextCurrent())
     2766        return 0;
     2767
    23312768    GLint value;
    23322769    gl::GetQueryiv(target, pname, &value);
     
    23362773PlatformGLObject GraphicsContextGLOpenGL::createSampler()
    23372774{
    2338     makeContextCurrent();
     2775    if (!makeContextCurrent())
     2776        return 0;
     2777
    23392778    GLuint name = 0;
    23402779    gl::GenSamplers(1, &name);
     
    23442783void GraphicsContextGLOpenGL::deleteSampler(PlatformGLObject sampler)
    23452784{
    2346     makeContextCurrent();
     2785    if (!makeContextCurrent())
     2786        return;
     2787
    23472788    gl::DeleteSamplers(1, &sampler);
    23482789}
     
    23502791GCGLboolean GraphicsContextGLOpenGL::isSampler(PlatformGLObject sampler)
    23512792{
    2352     makeContextCurrent();
     2793    if (!makeContextCurrent())
     2794        return GL_FALSE;
     2795
    23532796    return gl::IsSampler(sampler);
    23542797}
     
    23562799void GraphicsContextGLOpenGL::bindSampler(GCGLuint unit, PlatformGLObject sampler)
    23572800{
    2358     makeContextCurrent();
     2801    if (!makeContextCurrent())
     2802        return;
     2803
    23592804    gl::BindSampler(unit, sampler);
    23602805}
     
    23622807void GraphicsContextGLOpenGL::samplerParameteri(PlatformGLObject sampler, GCGLenum pname, GCGLint param)
    23632808{
    2364     makeContextCurrent();
     2809    if (!makeContextCurrent())
     2810        return;
     2811
    23652812    gl::SamplerParameteri(sampler, pname, param);
    23662813}
     
    23682815void GraphicsContextGLOpenGL::samplerParameterf(PlatformGLObject sampler, GCGLenum pname, GCGLfloat param)
    23692816{
    2370     makeContextCurrent();
     2817    if (!makeContextCurrent())
     2818        return;
     2819
    23712820    gl::SamplerParameterf(sampler, pname, param);
    23722821}
     
    23742823void GraphicsContextGLOpenGL::getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value)
    23752824{
    2376     makeContextCurrent();
     2825    if (!makeContextCurrent())
     2826        return;
     2827
    23772828    gl::GetSamplerParameterfv(sampler, pname, value);
    23782829}
     
    23802831void GraphicsContextGLOpenGL::getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value)
    23812832{
    2382     makeContextCurrent();
     2833    if (!makeContextCurrent())
     2834        return;
     2835
    23832836    gl::GetSamplerParameteriv(sampler, pname, value);
    23842837}
     
    23862839GCGLsync GraphicsContextGLOpenGL::fenceSync(GCGLenum condition, GCGLbitfield flags)
    23872840{
    2388     makeContextCurrent();
     2841    if (!makeContextCurrent())
     2842        return 0;
     2843
    23892844    return gl::FenceSync(condition, flags);
    23902845}
     
    23922847GCGLboolean GraphicsContextGLOpenGL::isSync(GCGLsync sync)
    23932848{
    2394     makeContextCurrent();
     2849    if (!makeContextCurrent())
     2850        return GL_FALSE;
     2851
    23952852    return gl::IsSync(sync);
    23962853}
     
    23982855void GraphicsContextGLOpenGL::deleteSync(GCGLsync sync)
    23992856{
    2400     makeContextCurrent();
     2857    if (!makeContextCurrent())
     2858        return;
     2859
    24012860    gl::DeleteSync(sync);
    24022861}
     
    24042863GCGLenum GraphicsContextGLOpenGL::clientWaitSync(GCGLsync sync, GCGLbitfield flags, GCGLuint64 timeout)
    24052864{
    2406     makeContextCurrent();
     2865    if (!makeContextCurrent())
     2866        return GL_WAIT_FAILED;
     2867
    24072868    return gl::ClientWaitSync(sync, flags, timeout);
    24082869}
     
    24102871void GraphicsContextGLOpenGL::waitSync(GCGLsync sync, GCGLbitfield flags, GCGLint64 timeout)
    24112872{
    2412     makeContextCurrent();
     2873    if (!makeContextCurrent())
     2874        return;
     2875
    24132876    gl::WaitSync(sync, flags, timeout);
    24142877}
     
    24162879void GraphicsContextGLOpenGL::getSynciv(GCGLsync sync, GCGLenum pname, GCGLsizei bufSize, GCGLint *value)
    24172880{
    2418     makeContextCurrent();
     2881    if (!makeContextCurrent())
     2882        return;
     2883
    24192884    gl::GetSynciv(sync, pname, bufSize, nullptr, value);
    24202885}
     
    24222887void GraphicsContextGLOpenGL::pauseTransformFeedback()
    24232888{
    2424     makeContextCurrent();
     2889    if (!makeContextCurrent())
     2890        return;
     2891
    24252892    gl::PauseTransformFeedback();
    24262893}
     
    24282895void GraphicsContextGLOpenGL::resumeTransformFeedback()
    24292896{
    2430     makeContextCurrent();
     2897    if (!makeContextCurrent())
     2898        return;
     2899
    24312900    gl::ResumeTransformFeedback();
    24322901}
     
    24342903void GraphicsContextGLOpenGL::bindBufferRange(GCGLenum target, GCGLuint index, PlatformGLObject buffer, GCGLintptr offset, GCGLsizeiptr size)
    24352904{
    2436     makeContextCurrent();
     2905    if (!makeContextCurrent())
     2906        return;
     2907
    24372908    gl::BindBufferRange(target, index, buffer, offset, size);
    24382909}
     
    24412912{
    24422913    ASSERT(program);
    2443     makeContextCurrent();
     2914    if (!makeContextCurrent())
     2915        return { };
     2916
    24442917    Vector<CString> utf8 = uniformNames.map([](auto& x) { return x.utf8(); });
    24452918    Vector<const char*> cstr = utf8.map([](auto& x) { return x.data(); });
     
    25032976void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25042977{
    2505     makeContextCurrent();
     2978    if (!makeContextCurrent())
     2979        return;
     2980
    25062981    gl::Uniform1fv(location, srcLength, data + srcOffset);
    25072982}
     
    25092984void GraphicsContextGLOpenGL::uniform2fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25102985{
    2511     makeContextCurrent();
     2986    if (!makeContextCurrent())
     2987        return;
     2988
    25122989    gl::Uniform2fv(location, srcLength, data + srcOffset);
    25132990}
     
    25152992void GraphicsContextGLOpenGL::uniform3fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25162993{
    2517     makeContextCurrent();
     2994    if (!makeContextCurrent())
     2995        return;
     2996
    25182997    gl::Uniform3fv(location, srcLength, data + srcOffset);
    25192998}
     
    25213000void GraphicsContextGLOpenGL::uniform4fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25223001{
    2523     makeContextCurrent();
     3002    if (!makeContextCurrent())
     3003        return;
     3004
    25243005    gl::Uniform4fv(location, srcLength, data + srcOffset);
    25253006}
     
    25273008void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
    25283009{
    2529     makeContextCurrent();
     3010    if (!makeContextCurrent())
     3011        return;
     3012
    25303013    gl::Uniform1iv(location, srcLength, data + srcOffset);
    25313014}
     
    25333016void GraphicsContextGLOpenGL::uniform2iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
    25343017{
    2535     makeContextCurrent();
     3018    if (!makeContextCurrent())
     3019        return;
     3020
    25363021    gl::Uniform2iv(location, srcLength, data + srcOffset);
    25373022}
     
    25393024void GraphicsContextGLOpenGL::uniform3iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
    25403025{
    2541     makeContextCurrent();
     3026    if (!makeContextCurrent())
     3027        return;
     3028
    25423029    gl::Uniform3iv(location, srcLength, data + srcOffset);
    25433030}
     
    25453032void GraphicsContextGLOpenGL::uniform4iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
    25463033{
    2547     makeContextCurrent();
     3034    if (!makeContextCurrent())
     3035        return;
     3036
    25483037    gl::Uniform4iv(location, srcLength, data + srcOffset);
    25493038}
     
    25513040void GraphicsContextGLOpenGL::uniformMatrix2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25523041{
    2553     makeContextCurrent();
     3042    if (!makeContextCurrent())
     3043        return;
     3044
    25543045    gl::UniformMatrix2fv(location, srcLength, transpose, data + srcOffset);
    25553046}
     
    25573048void GraphicsContextGLOpenGL::uniformMatrix3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25583049{
    2559     makeContextCurrent();
     3050    if (!makeContextCurrent())
     3051        return;
     3052
    25603053    gl::UniformMatrix3fv(location, srcLength, transpose, data + srcOffset);
    25613054}
     
    25633056void GraphicsContextGLOpenGL::uniformMatrix4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25643057{
    2565     makeContextCurrent();
     3058    if (!makeContextCurrent())
     3059        return;
     3060
    25663061    gl::UniformMatrix4fv(location, srcLength, transpose, data + srcOffset);
    25673062}
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm

    r269686 r269768  
    388388{
    389389    GraphicsContextGLOpenGLManager::sharedManager().removeContext(this);
    390 
    391     if (m_contextObj) {
     390    if (makeContextCurrent()) {
    392391        GraphicsContextGLAttributes attrs = contextAttributes();
    393         makeContextCurrent(); // TODO: check result.
    394392        gl::DeleteTextures(1, &m_texture);
    395393
     
    408406        if (m_preserveDrawingBufferFBO)
    409407            gl::DeleteFramebuffers(1, &m_preserveDrawingBufferFBO);
    410 
    411         if (m_displayBufferPbuffer) {
    412             EGL_ReleaseTexImage(m_displayObj, m_displayBufferPbuffer, EGL_BACK_BUFFER);
    413             EGL_DestroySurface(m_displayObj, m_displayBufferPbuffer);
    414         }
     408    }
     409    if (m_displayBufferPbuffer)
     410        EGL_DestroySurface(m_displayObj, m_displayBufferPbuffer);
     411    if (m_webGLLayer) {
    415412        auto recycledBuffer = [m_webGLLayer recycleBuffer];
    416413        if (recycledBuffer.handle)
     
    419416        if (contentsHandle)
    420417            EGL_DestroySurface(m_displayObj, contentsHandle);
    421 
     418    }
     419    if (m_contextObj) {
    422420        EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    423421        EGL_DestroyContext(m_displayObj, m_contextObj);
     
    553551void GraphicsContextGLOpenGL::updateCGLContext()
    554552{
    555     if (!m_contextObj)
    556         return;
    557 
     553    if (!makeContextCurrent())
     554        return;
    558555    LOG(WebGL, "Detected a mux switch or display reconfiguration. Call CGLUpdateContext. (%p)", this);
    559556
    560     makeContextCurrent();
    561557    EGLDeviceEXT device = nullptr;
    562558    EGL_QueryDisplayAttribEXT(m_displayObj, EGL_DEVICE_EXT, reinterpret_cast<EGLAttrib*>(&device));
  • trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.cpp

    r269686 r269768  
    5151void ExtensionsGLOpenGL::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter)
    5252{
     53    if (!m_context->makeContextCurrent())
     54        return;
     55
    5356    ::glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
    5457}
     
    5659void ExtensionsGLOpenGL::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
    5760{
     61    if (!m_context->makeContextCurrent())
     62        return;
     63
    5864    ::glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height);
    5965}
     
    6167PlatformGLObject ExtensionsGLOpenGL::createVertexArrayOES()
    6268{
    63     m_context->makeContextCurrent();
     69    if (!m_context->makeContextCurrent())
     70        return 0;
     71
    6472    GLuint array = 0;
    6573#if PLATFORM(GTK) || PLATFORM(WIN)
     
    7785        return;
    7886
    79     m_context->makeContextCurrent();
     87    if (!m_context->makeContextCurrent())
     88        return;
     89
    8090#if PLATFORM(GTK) || PLATFORM(WIN)
    8191    if (isVertexArrayObjectSupported())
     
    91101        return GL_FALSE;
    92102
    93     m_context->makeContextCurrent();
     103    if (!m_context->makeContextCurrent())
     104        return GL_FALSE;
     105
    94106#if PLATFORM(GTK) || PLATFORM(WIN)
    95107    if (isVertexArrayObjectSupported())
     
    103115void ExtensionsGLOpenGL::bindVertexArrayOES(PlatformGLObject array)
    104116{
    105     m_context->makeContextCurrent();
     117    if (!m_context->makeContextCurrent())
     118        return;
     119
    106120#if PLATFORM(GTK) || PLATFORM(WIN)
    107121    if (isVertexArrayObjectSupported())
     
    197211void ExtensionsGLOpenGL::drawBuffersEXT(GCGLsizei n, const GCGLenum* bufs)
    198212{
     213    if (!m_context->makeContextCurrent())
     214        return;
     215
    199216    //  FIXME: implement support for other platforms.
    200217#if PLATFORM(GTK)
     
    208225void ExtensionsGLOpenGL::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
    209226{
    210     m_context->makeContextCurrent();
     227    if (!m_context->makeContextCurrent())
     228        return;
     229
    211230#if PLATFORM(GTK)
    212231    ::glDrawArraysInstanced(mode, first, count, primcount);
     
    221240void ExtensionsGLOpenGL::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount)
    222241{
    223     m_context->makeContextCurrent();
     242    if (!m_context->makeContextCurrent())
     243        return;
     244
    224245#if PLATFORM(GTK)
    225246    ::glDrawElementsInstanced(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount);
     
    235256void ExtensionsGLOpenGL::vertexAttribDivisor(GCGLuint index, GCGLuint divisor)
    236257{
    237     m_context->makeContextCurrent();
     258    if (!m_context->makeContextCurrent())
     259        return;
     260
    238261#if PLATFORM(GTK)
    239262    ::glVertexAttribDivisor(index, divisor);
  • trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp

    r269686 r269768  
    8686void ExtensionsGLOpenGLES::framebufferTexture2DMultisampleIMG(unsigned long target, unsigned long attachment, unsigned long textarget, unsigned texture, int level, unsigned long samples)
    8787{
     88    if (!m_context->makeContextCurrent())
     89        return;
    8890    if (m_glFramebufferTexture2DMultisampleIMG)
    8991        m_glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples);
     
    9496void ExtensionsGLOpenGLES::renderbufferStorageMultisampleIMG(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
    9597{
     98    if (!m_context->makeContextCurrent())
     99        return;
    96100    if (m_glRenderbufferStorageMultisampleIMG)
    97101        m_glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height);
     
    107111void ExtensionsGLOpenGLES::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height)
    108112{
     113    if (!m_context->makeContextCurrent())
     114        return;
    109115    if (m_glRenderbufferStorageMultisampleIMG)
    110116        renderbufferStorageMultisampleIMG(target, samples, internalformat, width, height);
     
    130136PlatformGLObject ExtensionsGLOpenGLES::createVertexArrayOES()
    131137{
    132     m_context->makeContextCurrent();
    133138    if (m_glGenVertexArraysOES) {
     139        if (!m_context->makeContextCurrent())
     140            return 0;
    134141        GLuint array = 0;
    135142        m_glGenVertexArraysOES(1, &array);
     
    145152    if (!array)
    146153        return;
    147 
    148     m_context->makeContextCurrent();
    149     if (m_glDeleteVertexArraysOES)
     154    if (m_glDeleteVertexArraysOES) {
     155        if (!m_context->makeContextCurrent())
     156            return;
    150157        m_glDeleteVertexArraysOES(1, &array);
    151     else
    152         m_context->synthesizeGLError(GL_INVALID_OPERATION);
     158        return;
     159    }
     160    m_context->synthesizeGLError(GL_INVALID_OPERATION);
    153161}
    154162
     
    157165    if (!array)
    158166        return GL_FALSE;
    159 
    160     m_context->makeContextCurrent();
    161     if (m_glIsVertexArrayOES)
     167    if (m_glIsVertexArrayOES) {
     168        if (!m_context->makeContextCurrent())
     169            return GL_FALSE;
    162170        return m_glIsVertexArrayOES(array);
    163 
     171    }
    164172    m_context->synthesizeGLError(GL_INVALID_OPERATION);
    165173    return false;
     
    168176void ExtensionsGLOpenGLES::bindVertexArrayOES(PlatformGLObject array)
    169177{
    170     m_context->makeContextCurrent();
    171     if (m_glBindVertexArrayOES)
     178    if (m_glBindVertexArrayOES) {
     179        if (!m_context->makeContextCurrent())
     180            return;
    172181        m_glBindVertexArrayOES(array);
    173     else
     182    } else
    174183        m_context->synthesizeGLError(GL_INVALID_OPERATION);
    175184}
     
    189198        return m_contextResetStatus;
    190199    if (m_glGetGraphicsResetStatusEXT) {
    191         m_context->makeContextCurrent();
    192         int reasonForReset = m_glGetGraphicsResetStatusEXT();
     200        int reasonForReset = UNKNOWN_CONTEXT_RESET_ARB;
     201        if (m_context->makeContextCurrent())
     202            reasonForReset = m_glGetGraphicsResetStatusEXT();
    193203        if (reasonForReset != GL_NO_ERROR)
    194204            m_contextResetStatus = reasonForReset;
     
    203213{
    204214    if (m_glReadnPixelsEXT) {
    205         m_context->makeContextCurrent();
     215        if (!m_context->makeContextCurrent())
     216            return;
     217
    206218        // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e.,
    207219        // all previous rendering calls should be done before reading pixels.
     
    220232{
    221233    if (m_glGetnUniformfvEXT) {
    222         m_context->makeContextCurrent();
     234        if (!m_context->makeContextCurrent())
     235            return;
     236
    223237        m_glGetnUniformfvEXT(program, location, bufSize, params);
    224238        return;
     
    231245{
    232246    if (m_glGetnUniformivEXT) {
    233         m_context->makeContextCurrent();
     247        if (!m_context->makeContextCurrent())
     248            return;
     249
    234250        m_glGetnUniformivEXT(program, location, bufSize, params);
    235251        return;
     
    246262    }
    247263
    248     m_context->makeContextCurrent();
     264    if (!m_context->makeContextCurrent())
     265        return;
     266
    249267    m_glDrawArraysInstancedANGLE(mode, first, count, primcount);
    250268}
     
    257275    }
    258276
    259     m_context->makeContextCurrent();
     277    if (!m_context->makeContextCurrent())
     278        return;
     279
    260280    m_glDrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount);
    261281}
     
    268288    }
    269289
    270     m_context->makeContextCurrent();
     290    if (!m_context->makeContextCurrent())
     291        return;
     292
    271293    m_glVertexAttribDivisorANGLE(index, divisor);
    272294}
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h

    r269686 r269768  
    109109#endif
    110110
    111     bool makeContextCurrent();
    112111#if PLATFORM(IOS_FAMILY)
    113112    enum class ReleaseBehavior {
     
    518517    GraphicsContextGLOpenGL(GraphicsContextGLAttributes, HostWindow*, Destination = Destination::Offscreen, GraphicsContextGLOpenGL* sharedContext = nullptr);
    519518
     519    // Called once by all the public entry points that eventually call OpenGL.
     520    // Called once by all the public entry points of ExtensionsGL that eventually call OpenGL.
     521    bool makeContextCurrent() WARN_UNUSED_RETURN;
    520522
    521523    // Take into account the user's requested context creation attributes,
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp

    r269686 r269768  
    238238void GraphicsContextGLOpenGL::renderbufferStorage(GCGLenum target, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    239239{
    240     makeContextCurrent();
     240    if (!makeContextCurrent())
     241        return;
     242
    241243#if USE(OPENGL)
    242244    switch (internalformat) {
     
    265267    // whereas GLES2 return the number of vectors (each vector has 4 components).
    266268    // Therefore, the value returned by desktop GL needs to be divided by 4.
    267     makeContextCurrent();
     269    if (!makeContextCurrent())
     270        return;
     271
    268272    switch (pname) {
    269273#if USE(OPENGL)
     
    311315    ASSERT(precision);
    312316
    313     makeContextCurrent();
     317    if (!makeContextCurrent())
     318        return;
     319
    314320
    315321    switch (precisionType) {
     
    404410void GraphicsContextGLOpenGL::depthRange(GCGLclampf zNear, GCGLclampf zFar)
    405411{
    406     makeContextCurrent();
     412    if (!makeContextCurrent())
     413        return;
     414
    407415    ::glDepthRange(zNear, zFar);
    408416}
     
    410418void GraphicsContextGLOpenGL::clearDepth(GCGLclampf depth)
    411419{
    412     makeContextCurrent();
     420    if (!makeContextCurrent())
     421        return;
     422
    413423    ::glClearDepth(depth);
    414424}
     
    429439    // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e.,
    430440    // all previous rendering calls should be done before reading pixels.
    431     makeContextCurrent();
     441    if (!makeContextCurrent())
     442        return;
     443
    432444    ::glFlush();
    433445    ASSERT(m_state.boundReadFBO == m_state.boundDrawFBO);
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp

    r269686 r269768  
    201201        return;
    202202
    203     makeContextCurrent();
     203    if (!makeContextCurrent())
     204        return;
     205
    204206
    205207#if !USE(COORDINATED_GRAPHICS)
     
    240242        return;
    241243
    242     makeContextCurrent();
     244    if (!makeContextCurrent())
     245        return;
     246
    243247
    244248    bool mustRestoreFBO = false;
     
    274278void GraphicsContextGLOpenGL::reshape(int width, int height)
    275279{
    276     if (!platformGraphicsContextGL())
    277         return;
    278 
    279280    if (width == m_currentWidth && height == m_currentHeight)
    280281        return;
     
    284285        return;
    285286
     287    if (!makeContextCurrent())
     288        return;
     289
    286290    markContextChanged();
    287291
     
    289293    m_currentHeight = height;
    290294
    291     makeContextCurrent();
    292295    validateAttributes();
    293296
     
    428431void GraphicsContextGLOpenGL::activeTexture(GCGLenum texture)
    429432{
    430     makeContextCurrent();
     433    if (!makeContextCurrent())
     434        return;
     435
    431436    m_state.activeTextureUnit = texture;
    432437    ::glActiveTexture(texture);
     
    437442    ASSERT(program);
    438443    ASSERT(shader);
    439     makeContextCurrent();
     444    if (!makeContextCurrent())
     445        return;
     446
    440447    m_shaderProgramSymbolCountMap.remove(program);
    441448    ::glAttachShader(program, shader);
     
    445452{
    446453    ASSERT(program);
    447     makeContextCurrent();
     454    if (!makeContextCurrent())
     455        return;
    448456
    449457    String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_ATTRIBUTE, name);
     
    454462void GraphicsContextGLOpenGL::bindBuffer(GCGLenum target, PlatformGLObject buffer)
    455463{
    456     makeContextCurrent();
     464    if (!makeContextCurrent())
     465        return;
     466
    457467    ::glBindBuffer(target, buffer);
    458468}
     
    460470void GraphicsContextGLOpenGL::bindFramebuffer(GCGLenum target, PlatformGLObject buffer)
    461471{
    462     makeContextCurrent();
     472    if (!makeContextCurrent())
     473        return;
     474
    463475    GLuint fbo;
    464476    if (buffer)
     
    476488void GraphicsContextGLOpenGL::bindRenderbuffer(GCGLenum target, PlatformGLObject renderbuffer)
    477489{
    478     makeContextCurrent();
     490    if (!makeContextCurrent())
     491        return;
     492
    479493    ::glBindRenderbufferEXT(target, renderbuffer);
    480494}
     
    483497void GraphicsContextGLOpenGL::bindTexture(GCGLenum target, PlatformGLObject texture)
    484498{
    485     makeContextCurrent();
     499    if (!makeContextCurrent())
     500        return;
     501
    486502    m_state.setBoundTexture(m_state.activeTextureUnit, texture, target);
    487503    ::glBindTexture(target, texture);
     
    490506void GraphicsContextGLOpenGL::blendColor(GCGLclampf red, GCGLclampf green, GCGLclampf blue, GCGLclampf alpha)
    491507{
    492     makeContextCurrent();
     508    if (!makeContextCurrent())
     509        return;
     510
    493511    ::glBlendColor(red, green, blue, alpha);
    494512}
     
    496514void GraphicsContextGLOpenGL::blendEquation(GCGLenum mode)
    497515{
    498     makeContextCurrent();
     516    if (!makeContextCurrent())
     517        return;
     518
    499519    ::glBlendEquation(mode);
    500520}
     
    502522void GraphicsContextGLOpenGL::blendEquationSeparate(GCGLenum modeRGB, GCGLenum modeAlpha)
    503523{
    504     makeContextCurrent();
     524    if (!makeContextCurrent())
     525        return;
     526
    505527    ::glBlendEquationSeparate(modeRGB, modeAlpha);
    506528}
     
    509531void GraphicsContextGLOpenGL::blendFunc(GCGLenum sfactor, GCGLenum dfactor)
    510532{
    511     makeContextCurrent();
     533    if (!makeContextCurrent())
     534        return;
     535
    512536    ::glBlendFunc(sfactor, dfactor);
    513537}       
     
    515539void GraphicsContextGLOpenGL::blendFuncSeparate(GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha)
    516540{
    517     makeContextCurrent();
     541    if (!makeContextCurrent())
     542        return;
     543
    518544    ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    519545}
     
    521547void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, GCGLenum usage)
    522548{
    523     makeContextCurrent();
     549    if (!makeContextCurrent())
     550        return;
     551
    524552    ::glBufferData(target, size, 0, usage);
    525553}
     
    527555void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, const void* data, GCGLenum usage)
    528556{
    529     makeContextCurrent();
     557    if (!makeContextCurrent())
     558        return;
     559
    530560    ::glBufferData(target, size, data, usage);
    531561}
     
    533563void GraphicsContextGLOpenGL::bufferSubData(GCGLenum target, GCGLintptr offset, GCGLsizeiptr size, const void* data)
    534564{
    535     makeContextCurrent();
     565    if (!makeContextCurrent())
     566        return;
     567
    536568    ::glBufferSubData(target, offset, size, data);
    537569}
     
    539571GCGLenum GraphicsContextGLOpenGL::checkFramebufferStatus(GCGLenum target)
    540572{
    541     makeContextCurrent();
     573    if (!makeContextCurrent())
     574        return GL_INVALID_OPERATION;
     575
    542576    return ::glCheckFramebufferStatusEXT(target);
    543577}
     
    545579void GraphicsContextGLOpenGL::clearColor(GCGLclampf r, GCGLclampf g, GCGLclampf b, GCGLclampf a)
    546580{
    547     makeContextCurrent();
     581    if (!makeContextCurrent())
     582        return;
     583
    548584    ::glClearColor(r, g, b, a);
    549585}
     
    551587void GraphicsContextGLOpenGL::clear(GCGLbitfield mask)
    552588{
    553     makeContextCurrent();
     589    if (!makeContextCurrent())
     590        return;
     591
    554592    ::glClear(mask);
    555593    checkGPUStatus();
     
    558596void GraphicsContextGLOpenGL::clearStencil(GCGLint s)
    559597{
    560     makeContextCurrent();
     598    if (!makeContextCurrent())
     599        return;
     600
    561601    ::glClearStencil(s);
    562602}
     
    564604void GraphicsContextGLOpenGL::colorMask(GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha)
    565605{
    566     makeContextCurrent();
     606    if (!makeContextCurrent())
     607        return;
     608
    567609    ::glColorMask(red, green, blue, alpha);
    568610}
     
    571613{
    572614    ASSERT(shader);
    573     makeContextCurrent();
     615    if (!makeContextCurrent())
     616        return;
    574617
    575618    // Turn on name mapping. Due to the way ANGLE name hashing works, we
     
    633676{
    634677    ASSERT(shader);
    635     makeContextCurrent();
     678    if (!makeContextCurrent())
     679        return;
    636680
    637681    HashMap<PlatformGLObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader);
     
    667711void GraphicsContextGLOpenGL::copyTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLint border)
    668712{
    669     makeContextCurrent();
     713    if (!makeContextCurrent())
     714        return;
     715
    670716    auto attrs = contextAttributes();
    671717
     
    682728void GraphicsContextGLOpenGL::copyTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    683729{
    684     makeContextCurrent();
     730    if (!makeContextCurrent())
     731        return;
     732
    685733    auto attrs = contextAttributes();
    686734
     
    697745void GraphicsContextGLOpenGL::cullFace(GCGLenum mode)
    698746{
    699     makeContextCurrent();
     747    if (!makeContextCurrent())
     748        return;
     749
    700750    ::glCullFace(mode);
    701751}
     
    703753void GraphicsContextGLOpenGL::depthFunc(GCGLenum func)
    704754{
    705     makeContextCurrent();
     755    if (!makeContextCurrent())
     756        return;
     757
    706758    ::glDepthFunc(func);
    707759}
     
    709761void GraphicsContextGLOpenGL::depthMask(GCGLboolean flag)
    710762{
    711     makeContextCurrent();
     763    if (!makeContextCurrent())
     764        return;
     765
    712766    ::glDepthMask(flag);
    713767}
     
    717771    ASSERT(program);
    718772    ASSERT(shader);
    719     makeContextCurrent();
     773    if (!makeContextCurrent())
     774        return;
     775
    720776    m_shaderProgramSymbolCountMap.remove(program);
    721777    ::glDetachShader(program, shader);
     
    724780void GraphicsContextGLOpenGL::disable(GCGLenum cap)
    725781{
    726     makeContextCurrent();
     782    if (!makeContextCurrent())
     783        return;
     784
    727785    ::glDisable(cap);
    728786}
     
    730788void GraphicsContextGLOpenGL::disableVertexAttribArray(GCGLuint index)
    731789{
    732     makeContextCurrent();
     790    if (!makeContextCurrent())
     791        return;
     792
    733793    ::glDisableVertexAttribArray(index);
    734794}
     
    736796void GraphicsContextGLOpenGL::drawArrays(GCGLenum mode, GCGLint first, GCGLsizei count)
    737797{
    738     makeContextCurrent();
     798    if (!makeContextCurrent())
     799        return;
     800
    739801    ::glDrawArrays(mode, first, count);
    740802    checkGPUStatus();
     
    743805void GraphicsContextGLOpenGL::drawElements(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset)
    744806{
    745     makeContextCurrent();
     807    if (!makeContextCurrent())
     808        return;
     809
    746810    ::glDrawElements(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)));
    747811    checkGPUStatus();
     
    750814void GraphicsContextGLOpenGL::enable(GCGLenum cap)
    751815{
    752     makeContextCurrent();
     816    if (!makeContextCurrent())
     817        return;
     818
    753819    ::glEnable(cap);
    754820}
     
    756822void GraphicsContextGLOpenGL::enableVertexAttribArray(GCGLuint index)
    757823{
    758     makeContextCurrent();
     824    if (!makeContextCurrent())
     825        return;
     826
    759827    ::glEnableVertexAttribArray(index);
    760828}
     
    762830void GraphicsContextGLOpenGL::finish()
    763831{
    764     makeContextCurrent();
     832    if (!makeContextCurrent())
     833        return;
     834
    765835    ::glFinish();
    766836}
     
    768838void GraphicsContextGLOpenGL::flush()
    769839{
    770     makeContextCurrent();
     840    if (!makeContextCurrent())
     841        return;
     842
    771843    ::glFlush();
    772844}
     
    774846void GraphicsContextGLOpenGL::framebufferRenderbuffer(GCGLenum target, GCGLenum attachment, GCGLenum renderbuffertarget, PlatformGLObject buffer)
    775847{
    776     makeContextCurrent();
     848    if (!makeContextCurrent())
     849        return;
     850
    777851    ::glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, buffer);
    778852}
     
    780854void GraphicsContextGLOpenGL::framebufferTexture2D(GCGLenum target, GCGLenum attachment, GCGLenum textarget, PlatformGLObject texture, GCGLint level)
    781855{
    782     makeContextCurrent();
     856    if (!makeContextCurrent())
     857        return;
     858
    783859    ::glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
    784860    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    787863void GraphicsContextGLOpenGL::frontFace(GCGLenum mode)
    788864{
    789     makeContextCurrent();
     865    if (!makeContextCurrent())
     866        return;
     867
    790868    ::glFrontFace(mode);
    791869}
     
    793871void GraphicsContextGLOpenGL::generateMipmap(GCGLenum target)
    794872{
    795     makeContextCurrent();
     873    if (!makeContextCurrent())
     874        return;
     875
    796876    ::glGenerateMipmap(target);
    797877}
     
    803883        return false;
    804884    }
    805     makeContextCurrent();
     885    if (!makeContextCurrent())
     886        return false;
     887
    806888    GLint maxAttributeSize = 0;
    807889    ::glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize);
     
    849931    }
    850932
    851     makeContextCurrent();
     933    if (!makeContextCurrent())
     934        return false;
     935
    852936    GLint maxUniformSize = 0;
    853937    ::glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize);
     
    895979        return;
    896980    }
    897     makeContextCurrent();
     981    if (!makeContextCurrent())
     982        return;
     983
    898984    ::glGetAttachedShaders(program, maxCount, count, shaders);
    899985}
     
    10381124        return -1;
    10391125
    1040     makeContextCurrent();
     1126    if (!makeContextCurrent())
     1127        return -1;
     1128
    10411129
    10421130    String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_ATTRIBUTE, name);
     
    10501138        return -1;
    10511139
    1052     makeContextCurrent();
     1140    if (!makeContextCurrent())
     1141        return -1;
     1142
    10531143
    10541144    return ::glGetAttribLocation(program, name.utf8().data());
     
    10571147bool GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList()
    10581148{
    1059     makeContextCurrent();
     1149    if (!makeContextCurrent())
     1150        return false;
     1151
    10601152    bool movedAnError = false;
    10611153
     
    10841176    }
    10851177
    1086     makeContextCurrent();
     1178    if (!makeContextCurrent())
     1179        return GL_INVALID_OPERATION;
     1180
    10871181    return ::glGetError();
    10881182}
     
    10901184String GraphicsContextGLOpenGL::getString(GCGLenum name)
    10911185{
    1092     makeContextCurrent();
     1186    if (!makeContextCurrent())
     1187        return String();
     1188
    10931189    return String(reinterpret_cast<const char*>(::glGetString(name)));
    10941190}
     
    10961192void GraphicsContextGLOpenGL::hint(GCGLenum target, GCGLenum mode)
    10971193{
    1098     makeContextCurrent();
     1194    if (!makeContextCurrent())
     1195        return;
     1196
    10991197    ::glHint(target, mode);
    11001198}
     
    11051203        return GL_FALSE;
    11061204
    1107     makeContextCurrent();
     1205    if (!makeContextCurrent())
     1206        return GL_FALSE;
     1207
    11081208    return ::glIsBuffer(buffer);
    11091209}
     
    11111211GCGLboolean GraphicsContextGLOpenGL::isEnabled(GCGLenum cap)
    11121212{
    1113     makeContextCurrent();
     1213    if (!makeContextCurrent())
     1214        return GL_FALSE;
     1215
    11141216    return ::glIsEnabled(cap);
    11151217}
     
    11201222        return GL_FALSE;
    11211223
    1122     makeContextCurrent();
     1224    if (!makeContextCurrent())
     1225        return GL_FALSE;
     1226
    11231227    return ::glIsFramebufferEXT(framebuffer);
    11241228}
     
    11291233        return GL_FALSE;
    11301234
    1131     makeContextCurrent();
     1235    if (!makeContextCurrent())
     1236        return GL_FALSE;
     1237
    11321238    return ::glIsProgram(program);
    11331239}
     
    11381244        return GL_FALSE;
    11391245
    1140     makeContextCurrent();
     1246    if (!makeContextCurrent())
     1247        return GL_FALSE;
     1248
    11411249    return ::glIsRenderbufferEXT(renderbuffer);
    11421250}
     
    11471255        return GL_FALSE;
    11481256
    1149     makeContextCurrent();
     1257    if (!makeContextCurrent())
     1258        return GL_FALSE;
     1259
    11501260    return ::glIsShader(shader);
    11511261}
     
    11561266        return GL_FALSE;
    11571267
    1158     makeContextCurrent();
     1268    if (!makeContextCurrent())
     1269        return GL_FALSE;
     1270
    11591271    return ::glIsTexture(texture);
    11601272}
     
    11621274void GraphicsContextGLOpenGL::lineWidth(GCGLfloat width)
    11631275{
    1164     makeContextCurrent();
     1276    if (!makeContextCurrent())
     1277        return;
     1278
    11651279    ::glLineWidth(width);
    11661280}
     
    11691283{
    11701284    ASSERT(program);
    1171     makeContextCurrent();
     1285    if (!makeContextCurrent())
     1286        return;
     1287
    11721288
    11731289    GCGLsizei count = 0;
     
    11831299void GraphicsContextGLOpenGL::pixelStorei(GCGLenum pname, GCGLint param)
    11841300{
    1185     makeContextCurrent();
     1301    if (!makeContextCurrent())
     1302        return;
     1303
    11861304    ::glPixelStorei(pname, param);
    11871305}
     
    11891307void GraphicsContextGLOpenGL::polygonOffset(GCGLfloat factor, GCGLfloat units)
    11901308{
    1191     makeContextCurrent();
     1309    if (!makeContextCurrent())
     1310        return;
     1311
    11921312    ::glPolygonOffset(factor, units);
    11931313}
     
    11951315void GraphicsContextGLOpenGL::sampleCoverage(GCGLclampf value, GCGLboolean invert)
    11961316{
    1197     makeContextCurrent();
     1317    if (!makeContextCurrent())
     1318        return;
     1319
    11981320    ::glSampleCoverage(value, invert);
    11991321}
     
    12011323void GraphicsContextGLOpenGL::scissor(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    12021324{
    1203     makeContextCurrent();
     1325    if (!makeContextCurrent())
     1326        return;
     1327
    12041328    ::glScissor(x, y, width, height);
    12051329}
     
    12091333    ASSERT(shader);
    12101334
    1211     makeContextCurrent();
     1335    if (!makeContextCurrent())
     1336        return;
     1337
    12121338
    12131339    ShaderSourceEntry entry;
     
    12201346void GraphicsContextGLOpenGL::stencilFunc(GCGLenum func, GCGLint ref, GCGLuint mask)
    12211347{
    1222     makeContextCurrent();
     1348    if (!makeContextCurrent())
     1349        return;
     1350
    12231351    ::glStencilFunc(func, ref, mask);
    12241352}
     
    12261354void GraphicsContextGLOpenGL::stencilFuncSeparate(GCGLenum face, GCGLenum func, GCGLint ref, GCGLuint mask)
    12271355{
    1228     makeContextCurrent();
     1356    if (!makeContextCurrent())
     1357        return;
     1358
    12291359    ::glStencilFuncSeparate(face, func, ref, mask);
    12301360}
     
    12321362void GraphicsContextGLOpenGL::stencilMask(GCGLuint mask)
    12331363{
    1234     makeContextCurrent();
     1364    if (!makeContextCurrent())
     1365        return;
     1366
    12351367    ::glStencilMask(mask);
    12361368}
     
    12381370void GraphicsContextGLOpenGL::stencilMaskSeparate(GCGLenum face, GCGLuint mask)
    12391371{
    1240     makeContextCurrent();
     1372    if (!makeContextCurrent())
     1373        return;
     1374
    12411375    ::glStencilMaskSeparate(face, mask);
    12421376}
     
    12441378void GraphicsContextGLOpenGL::stencilOp(GCGLenum fail, GCGLenum zfail, GCGLenum zpass)
    12451379{
    1246     makeContextCurrent();
     1380    if (!makeContextCurrent())
     1381        return;
     1382
    12471383    ::glStencilOp(fail, zfail, zpass);
    12481384}
     
    12501386void GraphicsContextGLOpenGL::stencilOpSeparate(GCGLenum face, GCGLenum fail, GCGLenum zfail, GCGLenum zpass)
    12511387{
    1252     makeContextCurrent();
     1388    if (!makeContextCurrent())
     1389        return;
     1390
    12531391    ::glStencilOpSeparate(face, fail, zfail, zpass);
    12541392}
     
    12561394void GraphicsContextGLOpenGL::texParameterf(GCGLenum target, GCGLenum pname, GCGLfloat value)
    12571395{
    1258     makeContextCurrent();
     1396    if (!makeContextCurrent())
     1397        return;
     1398
    12591399    ::glTexParameterf(target, pname, value);
    12601400}
     
    12621402void GraphicsContextGLOpenGL::texParameteri(GCGLenum target, GCGLenum pname, GCGLint value)
    12631403{
    1264     makeContextCurrent();
     1404    if (!makeContextCurrent())
     1405        return;
     1406
    12651407    ::glTexParameteri(target, pname, value);
    12661408}
     
    12681410void GraphicsContextGLOpenGL::uniform1f(GCGLint location, GCGLfloat v0)
    12691411{
    1270     makeContextCurrent();
     1412    if (!makeContextCurrent())
     1413        return;
     1414
    12711415    ::glUniform1f(location, v0);
    12721416}
     
    12741418void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, GCGLsizei size, const GCGLfloat* array)
    12751419{
    1276     makeContextCurrent();
     1420    if (!makeContextCurrent())
     1421        return;
     1422
    12771423    ::glUniform1fv(location, size, array);
    12781424}
     
    12801426void GraphicsContextGLOpenGL::uniform2f(GCGLint location, GCGLfloat v0, GCGLfloat v1)
    12811427{
    1282     makeContextCurrent();
     1428    if (!makeContextCurrent())
     1429        return;
     1430
    12831431    ::glUniform2f(location, v0, v1);
    12841432}
     
    12871435{
    12881436    // FIXME: length needs to be a multiple of 2.
    1289     makeContextCurrent();
     1437    if (!makeContextCurrent())
     1438        return;
     1439
    12901440    ::glUniform2fv(location, size, array);
    12911441}
     
    12931443void GraphicsContextGLOpenGL::uniform3f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2)
    12941444{
    1295     makeContextCurrent();
     1445    if (!makeContextCurrent())
     1446        return;
     1447
    12961448    ::glUniform3f(location, v0, v1, v2);
    12971449}
     
    13001452{
    13011453    // FIXME: length needs to be a multiple of 3.
    1302     makeContextCurrent();
     1454    if (!makeContextCurrent())
     1455        return;
     1456
    13031457    ::glUniform3fv(location, size, array);
    13041458}
     
    13061460void GraphicsContextGLOpenGL::uniform4f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3)
    13071461{
    1308     makeContextCurrent();
     1462    if (!makeContextCurrent())
     1463        return;
     1464
    13091465    ::glUniform4f(location, v0, v1, v2, v3);
    13101466}
     
    13131469{
    13141470    // FIXME: length needs to be a multiple of 4.
    1315     makeContextCurrent();
     1471    if (!makeContextCurrent())
     1472        return;
     1473
    13161474    ::glUniform4fv(location, size, array);
    13171475}
     
    13191477void GraphicsContextGLOpenGL::uniform1i(GCGLint location, GCGLint v0)
    13201478{
    1321     makeContextCurrent();
     1479    if (!makeContextCurrent())
     1480        return;
     1481
    13221482    ::glUniform1i(location, v0);
    13231483}
     
    13251485void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, GCGLsizei size, const GCGLint* array)
    13261486{
    1327     makeContextCurrent();
     1487    if (!makeContextCurrent())
     1488        return;
     1489
    13281490    ::glUniform1iv(location, size, array);
    13291491}
     
    13311493void GraphicsContextGLOpenGL::uniform2i(GCGLint location, GCGLint v0, GCGLint v1)
    13321494{
    1333     makeContextCurrent();
     1495    if (!makeContextCurrent())
     1496        return;
     1497
    13341498    ::glUniform2i(location, v0, v1);
    13351499}
     
    13381502{
    13391503    // FIXME: length needs to be a multiple of 2.
    1340     makeContextCurrent();
     1504    if (!makeContextCurrent())
     1505        return;
     1506
    13411507    ::glUniform2iv(location, size, array);
    13421508}
     
    13441510void GraphicsContextGLOpenGL::uniform3i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2)
    13451511{
    1346     makeContextCurrent();
     1512    if (!makeContextCurrent())
     1513        return;
     1514
    13471515    ::glUniform3i(location, v0, v1, v2);
    13481516}
     
    13511519{
    13521520    // FIXME: length needs to be a multiple of 3.
    1353     makeContextCurrent();
     1521    if (!makeContextCurrent())
     1522        return;
     1523
    13541524    ::glUniform3iv(location, size, array);
    13551525}
     
    13571527void GraphicsContextGLOpenGL::uniform4i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2, GCGLint v3)
    13581528{
    1359     makeContextCurrent();
     1529    if (!makeContextCurrent())
     1530        return;
     1531
    13601532    ::glUniform4i(location, v0, v1, v2, v3);
    13611533}
     
    13641536{
    13651537    // FIXME: length needs to be a multiple of 4.
    1366     makeContextCurrent();
     1538    if (!makeContextCurrent())
     1539        return;
     1540
    13671541    ::glUniform4iv(location, size, array);
    13681542}
     
    13711545{
    13721546    // FIXME: length needs to be a multiple of 4.
    1373     makeContextCurrent();
     1547    if (!makeContextCurrent())
     1548        return;
     1549
    13741550    ::glUniformMatrix2fv(location, size, transpose, array);
    13751551}
     
    13781554{
    13791555    // FIXME: length needs to be a multiple of 9.
    1380     makeContextCurrent();
     1556    if (!makeContextCurrent())
     1557        return;
     1558
    13811559    ::glUniformMatrix3fv(location, size, transpose, array);
    13821560}
     
    13851563{
    13861564    // FIXME: length needs to be a multiple of 16.
    1387     makeContextCurrent();
     1565    if (!makeContextCurrent())
     1566        return;
     1567
    13881568    ::glUniformMatrix4fv(location, size, transpose, array);
    13891569}
     
    13911571void GraphicsContextGLOpenGL::useProgram(PlatformGLObject program)
    13921572{
    1393     makeContextCurrent();
     1573    if (!makeContextCurrent())
     1574        return;
     1575
    13941576    ::glUseProgram(program);
    13951577}
     
    13991581    ASSERT(program);
    14001582
    1401     makeContextCurrent();
     1583    if (!makeContextCurrent())
     1584        return;
     1585
    14021586    ::glValidateProgram(program);
    14031587}
     
    14051589void GraphicsContextGLOpenGL::vertexAttrib1f(GCGLuint index, GCGLfloat v0)
    14061590{
    1407     makeContextCurrent();
     1591    if (!makeContextCurrent())
     1592        return;
     1593
    14081594    ::glVertexAttrib1f(index, v0);
    14091595}
     
    14111597void GraphicsContextGLOpenGL::vertexAttrib1fv(GCGLuint index, const GCGLfloat* array)
    14121598{
    1413     makeContextCurrent();
     1599    if (!makeContextCurrent())
     1600        return;
     1601
    14141602    ::glVertexAttrib1fv(index, array);
    14151603}
     
    14171605void GraphicsContextGLOpenGL::vertexAttrib2f(GCGLuint index, GCGLfloat v0, GCGLfloat v1)
    14181606{
    1419     makeContextCurrent();
     1607    if (!makeContextCurrent())
     1608        return;
     1609
    14201610    ::glVertexAttrib2f(index, v0, v1);
    14211611}
     
    14231613void GraphicsContextGLOpenGL::vertexAttrib2fv(GCGLuint index, const GCGLfloat* array)
    14241614{
    1425     makeContextCurrent();
     1615    if (!makeContextCurrent())
     1616        return;
     1617
    14261618    ::glVertexAttrib2fv(index, array);
    14271619}
     
    14291621void GraphicsContextGLOpenGL::vertexAttrib3f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2)
    14301622{
    1431     makeContextCurrent();
     1623    if (!makeContextCurrent())
     1624        return;
     1625
    14321626    ::glVertexAttrib3f(index, v0, v1, v2);
    14331627}
     
    14351629void GraphicsContextGLOpenGL::vertexAttrib3fv(GCGLuint index, const GCGLfloat* array)
    14361630{
    1437     makeContextCurrent();
     1631    if (!makeContextCurrent())
     1632        return;
     1633
    14381634    ::glVertexAttrib3fv(index, array);
    14391635}
     
    14411637void GraphicsContextGLOpenGL::vertexAttrib4f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3)
    14421638{
    1443     makeContextCurrent();
     1639    if (!makeContextCurrent())
     1640        return;
     1641
    14441642    ::glVertexAttrib4f(index, v0, v1, v2, v3);
    14451643}
     
    14471645void GraphicsContextGLOpenGL::vertexAttrib4fv(GCGLuint index, const GCGLfloat* array)
    14481646{
    1449     makeContextCurrent();
     1647    if (!makeContextCurrent())
     1648        return;
     1649
    14501650    ::glVertexAttrib4fv(index, array);
    14511651}
     
    14531653void GraphicsContextGLOpenGL::vertexAttribPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLboolean normalized, GCGLsizei stride, GCGLintptr offset)
    14541654{
    1455     makeContextCurrent();
     1655    if (!makeContextCurrent())
     1656        return;
     1657
    14561658    ::glVertexAttribPointer(index, size, type, normalized, stride, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)));
    14571659}
     
    14591661void GraphicsContextGLOpenGL::viewport(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    14601662{
    1461     makeContextCurrent();
     1663    if (!makeContextCurrent())
     1664        return;
     1665
    14621666    ::glViewport(x, y, width, height);
    14631667}
     
    14651669PlatformGLObject GraphicsContextGLOpenGL::createVertexArray()
    14661670{
    1467     makeContextCurrent();
     1671    if (!makeContextCurrent())
     1672        return 0;
     1673
    14681674    GLuint array = 0;
    14691675#if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA)
     
    14781684        return;
    14791685   
    1480     makeContextCurrent();
     1686    if (!makeContextCurrent())
     1687        return;
     1688
    14811689#if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA)
    14821690    ::glDeleteVertexArrays(1, &array);
     
    14891697        return GL_FALSE;
    14901698   
    1491     makeContextCurrent();
     1699    if (!makeContextCurrent())
     1700        return GL_FALSE;
     1701
    14921702#if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA)
    14931703    return ::glIsVertexArray(array);
     
    14981708void GraphicsContextGLOpenGL::bindVertexArray(PlatformGLObject array)
    14991709{
    1500     makeContextCurrent();
     1710    if (!makeContextCurrent())
     1711        return;
     1712
    15011713#if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA)
    15021714    ::glBindVertexArray(array);
     
    15081720void GraphicsContextGLOpenGL::getBooleanv(GCGLenum pname, GCGLboolean* value)
    15091721{
    1510     makeContextCurrent();
     1722    if (!makeContextCurrent())
     1723        return;
     1724
    15111725    ::glGetBooleanv(pname, value);
    15121726}
     
    15141728void GraphicsContextGLOpenGL::getBufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    15151729{
    1516     makeContextCurrent();
     1730    if (!makeContextCurrent())
     1731        return;
     1732
    15171733    ::glGetBufferParameteriv(target, pname, value);
    15181734}
     
    15201736void GraphicsContextGLOpenGL::getFloatv(GCGLenum pname, GCGLfloat* value)
    15211737{
    1522     makeContextCurrent();
     1738    if (!makeContextCurrent())
     1739        return;
     1740
    15231741    ::glGetFloatv(pname, value);
    15241742}
     
    15281746    UNUSED_PARAM(pname);
    15291747    UNUSED_PARAM(index);
    1530     makeContextCurrent();
     1748    if (!makeContextCurrent())
     1749        return;
     1750
    15311751    *value = 0;
    15321752    // FIXME 141178: Before enabling this we must first switch over to using gl3.h and creating and initialing the WebGL2 context using OpenGL ES 3.0.
     
    15371757{
    15381758    UNUSED_PARAM(pname);
    1539     makeContextCurrent();
     1759    if (!makeContextCurrent())
     1760        return;
     1761
    15401762    *value = 0;
    15411763    // FIXME 141178: Before enabling this we must first switch over to using gl3.h and creating and initialing the WebGL2 context using OpenGL ES 3.0.
     
    15471769    UNUSED_PARAM(pname);
    15481770    UNUSED_PARAM(index);
    1549     makeContextCurrent();
     1771    if (!makeContextCurrent())
     1772        return;
     1773
    15501774    *value = 0;
    15511775    // FIXME 141178: Before enabling this we must first switch over to using gl3.h and creating and initialing the WebGL2 context using OpenGL ES 3.0.
     
    15551779void GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv(GCGLenum target, GCGLenum attachment, GCGLenum pname, GCGLint* value)
    15561780{
    1557     makeContextCurrent();
     1781    if (!makeContextCurrent())
     1782        return;
     1783
    15581784    if (attachment == DEPTH_STENCIL_ATTACHMENT)
    15591785        attachment = DEPTH_ATTACHMENT; // Or STENCIL_ATTACHMENT, either works.
     
    15631789void GraphicsContextGLOpenGL::getProgramiv(PlatformGLObject program, GCGLenum pname, GCGLint* value)
    15641790{
    1565     makeContextCurrent();
     1791    if (!makeContextCurrent())
     1792        return;
     1793
    15661794    ::glGetProgramiv(program, pname, value);
    15671795}
     
    15731801        return;
    15741802
    1575     makeContextCurrent();
     1803    if (!makeContextCurrent())
     1804        return;
     1805
    15761806    const auto& result = m_shaderProgramSymbolCountMap.find(program);
    15771807    if (result != m_shaderProgramSymbolCountMap.end()) {
     
    16511881    ASSERT(program);
    16521882
    1653     makeContextCurrent();
     1883    if (!makeContextCurrent())
     1884        return String();
     1885
    16541886    GLint length = 0;
    16551887    ::glGetProgramiv(program, GL_INFO_LOG_LENGTH, &length);
     
    16701902void GraphicsContextGLOpenGL::getRenderbufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    16711903{
    1672     makeContextCurrent();
     1904    if (!makeContextCurrent())
     1905        return;
     1906
    16731907    ::glGetRenderbufferParameterivEXT(target, pname, value);
    16741908}
     
    16781912    ASSERT(shader);
    16791913
    1680     makeContextCurrent();
     1914    if (!makeContextCurrent())
     1915        return;
     1916
    16811917
    16821918    const auto& result = m_shaderSourceMap.find(shader);
     
    17131949    ASSERT(shader);
    17141950
    1715     makeContextCurrent();
     1951    if (!makeContextCurrent())
     1952        return String();
    17161953
    17171954    const auto& result = m_shaderSourceMap.find(shader);
     
    17401977    ASSERT(shader);
    17411978
    1742     makeContextCurrent();
     1979    if (!makeContextCurrent())
     1980        return String();
    17431981
    17441982    const auto& result = m_shaderSourceMap.find(shader);
     
    17511989void GraphicsContextGLOpenGL::getTexParameterfv(GCGLenum target, GCGLenum pname, GCGLfloat* value)
    17521990{
    1753     makeContextCurrent();
     1991    if (!makeContextCurrent())
     1992        return;
     1993
    17541994    ::glGetTexParameterfv(target, pname, value);
    17551995}
     
    17571997void GraphicsContextGLOpenGL::getTexParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    17581998{
    1759     makeContextCurrent();
     1999    if (!makeContextCurrent())
     2000        return;
     2001
    17602002    ::glGetTexParameteriv(target, pname, value);
    17612003}
     
    17632005void GraphicsContextGLOpenGL::getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value)
    17642006{
    1765     makeContextCurrent();
     2007    if (!makeContextCurrent())
     2008        return;
     2009
    17662010    ::glGetUniformfv(program, location, value);
    17672011}
     
    17692013void GraphicsContextGLOpenGL::getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value)
    17702014{
    1771     makeContextCurrent();
     2015    if (!makeContextCurrent())
     2016        return;
     2017
    17722018    ::glGetUniformiv(program, location, value);
    17732019}
     
    17842030    ASSERT(program);
    17852031
    1786     makeContextCurrent();
     2032    if (!makeContextCurrent())
     2033        return -1;
    17872034
    17882035    String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_UNIFORM, name);
     
    17932040void GraphicsContextGLOpenGL::getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLfloat* value)
    17942041{
    1795     makeContextCurrent();
     2042    if (!makeContextCurrent())
     2043        return;
     2044
    17962045    ::glGetVertexAttribfv(index, pname, value);
    17972046}
     
    17992048void GraphicsContextGLOpenGL::getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLint* value)
    18002049{
    1801     makeContextCurrent();
     2050    if (!makeContextCurrent())
     2051        return;
     2052
    18022053    ::glGetVertexAttribiv(index, pname, value);
    18032054}
     
    18052056GCGLsizeiptr GraphicsContextGLOpenGL::getVertexAttribOffset(GCGLuint index, GCGLenum pname)
    18062057{
    1807     makeContextCurrent();
     2058    if (!makeContextCurrent())
     2059        return 0;
    18082060
    18092061    GLvoid* pointer = 0;
     
    18142066void GraphicsContextGLOpenGL::texSubImage2D(GCGLenum target, GCGLint level, GCGLint xoff, GCGLint yoff, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, const void* pixels)
    18152067{
    1816     makeContextCurrent();
     2068    if (!makeContextCurrent())
     2069        return;
    18172070
    18182071#if !USE(OPENGL_ES)
     
    18452098void GraphicsContextGLOpenGL::compressedTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLsizei imageSize, const void* data)
    18462099{
    1847     makeContextCurrent();
     2100    if (!makeContextCurrent())
     2101        return;
     2102
    18482103    ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
    18492104    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    18522107void GraphicsContextGLOpenGL::compressedTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLsizei imageSize, const void* data)
    18532108{
    1854     makeContextCurrent();
     2109    if (!makeContextCurrent())
     2110        return;
     2111
    18552112    ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
    18562113    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    18592116PlatformGLObject GraphicsContextGLOpenGL::createBuffer()
    18602117{
    1861     makeContextCurrent();
     2118    if (!makeContextCurrent())
     2119        return 0;
     2120
    18622121    GLuint o = 0;
    18632122    glGenBuffers(1, &o);
     
    18672126PlatformGLObject GraphicsContextGLOpenGL::createFramebuffer()
    18682127{
    1869     makeContextCurrent();
     2128    if (!makeContextCurrent())
     2129        return 0;
     2130
    18702131    GLuint o = 0;
    18712132    glGenFramebuffersEXT(1, &o);
     
    18752136PlatformGLObject GraphicsContextGLOpenGL::createProgram()
    18762137{
    1877     makeContextCurrent();
     2138    if (!makeContextCurrent())
     2139        return 0;
     2140
    18782141    return glCreateProgram();
    18792142}
     
    18812144PlatformGLObject GraphicsContextGLOpenGL::createRenderbuffer()
    18822145{
    1883     makeContextCurrent();
     2146    if (!makeContextCurrent())
     2147        return 0;
     2148
    18842149    GLuint o = 0;
    18852150    glGenRenderbuffersEXT(1, &o);
     
    18892154PlatformGLObject GraphicsContextGLOpenGL::createShader(GCGLenum type)
    18902155{
    1891     makeContextCurrent();
     2156    if (!makeContextCurrent())
     2157        return 0;
     2158
    18922159    return glCreateShader((type == FRAGMENT_SHADER) ? GL_FRAGMENT_SHADER : GL_VERTEX_SHADER);
    18932160}
     
    18952162PlatformGLObject GraphicsContextGLOpenGL::createTexture()
    18962163{
    1897     makeContextCurrent();
     2164    if (!makeContextCurrent())
     2165        return 0;
     2166
    18982167    GLuint o = 0;
    18992168    glGenTextures(1, &o);
     
    19042173void GraphicsContextGLOpenGL::deleteBuffer(PlatformGLObject buffer)
    19052174{
    1906     makeContextCurrent();
     2175    if (!makeContextCurrent())
     2176        return;
     2177
    19072178    glDeleteBuffers(1, &buffer);
    19082179}
     
    19102181void GraphicsContextGLOpenGL::deleteFramebuffer(PlatformGLObject framebuffer)
    19112182{
    1912     makeContextCurrent();
     2183    if (!makeContextCurrent())
     2184        return;
     2185
    19132186    ASSERT(m_state.boundReadFBO == m_state.boundDrawFBO);
    19142187    if (framebuffer == m_state.boundDrawFBO) {
     
    19222195void GraphicsContextGLOpenGL::deleteProgram(PlatformGLObject program)
    19232196{
    1924     makeContextCurrent();
     2197    if (!makeContextCurrent())
     2198        return;
     2199
    19252200    m_shaderProgramSymbolCountMap.remove(program);
    19262201    glDeleteProgram(program);
     
    19292204void GraphicsContextGLOpenGL::deleteRenderbuffer(PlatformGLObject renderbuffer)
    19302205{
    1931     makeContextCurrent();
     2206    if (!makeContextCurrent())
     2207        return;
     2208
    19322209    glDeleteRenderbuffersEXT(1, &renderbuffer);
    19332210}
     
    19352212void GraphicsContextGLOpenGL::deleteShader(PlatformGLObject shader)
    19362213{
    1937     makeContextCurrent();
     2214    if (!makeContextCurrent())
     2215        return;
     2216
    19382217    glDeleteShader(shader);
    19392218}
     
    19412220void GraphicsContextGLOpenGL::deleteTexture(PlatformGLObject texture)
    19422221{
    1943     makeContextCurrent();
     2222    if (!makeContextCurrent())
     2223        return;
     2224
    19442225    m_state.boundTextureMap.removeIf([texture] (auto& keyValue) {
    19452226        return keyValue.value.first == texture;
     
    19972278void GraphicsContextGLOpenGL::texImage2DDirect(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, const void* pixels)
    19982279{
    1999     makeContextCurrent();
     2280    if (!makeContextCurrent())
     2281        return;
     2282
    20002283    ::glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
    20012284    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    20222305void GraphicsContextGLOpenGL::primitiveRestartIndex(GCGLuint index)
    20232306{
    2024     makeContextCurrent();
     2307    if (!makeContextCurrent())
     2308        return;
     2309
    20252310    ::glPrimitiveRestartIndex(index);
    20262311}
     
    20482333void GraphicsContextGLOpenGL::copyBufferSubData(GCGLenum readTarget, GCGLenum writeTarget, GCGLintptr readOffset, GCGLintptr writeOffset, GCGLsizeiptr size)
    20492334{
    2050     makeContextCurrent();
     2335    if (!makeContextCurrent())
     2336        return;
     2337
    20512338    ::glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
    20522339}
     
    20692356void* GraphicsContextGLOpenGL::mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access)
    20702357{
    2071     makeContextCurrent();
     2358    if (!makeContextCurrent())
     2359        return nullptr;
     2360
    20722361    return ::glMapBufferRange(target, offset, length, access);
    20732362}
     
    20752364GCGLboolean GraphicsContextGLOpenGL::unmapBuffer(GCGLenum target)
    20762365{
    2077     makeContextCurrent();
     2366    if (!makeContextCurrent())
     2367        return GL_FALSE;
     2368
    20782369    return ::glUnmapBuffer(target);
    20792370}
     
    21402431{
    21412432#if USE(OPENGL_ES)
    2142     makeContextCurrent();
     2433    if (!makeContextCurrent())
     2434        return;
     2435
    21432436    ::glGetInternalformativ(target, internalformat, pname, bufSize, params);
    21442437#else
     
    21532446void GraphicsContextGLOpenGL::renderbufferStorageMultisample(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    21542447{
    2155     makeContextCurrent();
     2448    if (!makeContextCurrent())
     2449        return;
     2450
    21562451    ::glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
    21572452}
     
    21592454void GraphicsContextGLOpenGL::texStorage2D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    21602455{
    2161     makeContextCurrent();
     2456    if (!makeContextCurrent())
     2457        return;
     2458
    21622459    ::glTexStorage2D(target, levels, internalformat, width, height);
    21632460    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    21662463void GraphicsContextGLOpenGL::texStorage3D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth)
    21672464{
    2168     makeContextCurrent();
     2465    if (!makeContextCurrent())
     2466        return;
     2467
    21692468    ::glTexStorage3D(target, levels, internalformat, width, height, depth);
    21702469    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    26312930{
    26322931    ASSERT(program);
    2633     makeContextCurrent();
     2932    if (!makeContextCurrent())
     2933        return;
    26342934
    26352935    ::glGetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, params.data());
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp

    r269686 r269768  
    4343void GraphicsContextGLOpenGL::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, void* data)
    4444{
    45     makeContextCurrent();
     45    if (!makeContextCurrent())
     46        return;
     47
    4648
    4749    auto attributes = contextAttributes();
     
    189191void GraphicsContextGLOpenGL::renderbufferStorage(GCGLenum target, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    190192{
    191     makeContextCurrent();
     193    if (!makeContextCurrent())
     194        return;
     195
    192196    ::glRenderbufferStorage(target, internalformat, width, height);
    193197}
     
    195199void GraphicsContextGLOpenGL::getIntegerv(GCGLenum pname, GCGLint* value)
    196200{
    197     makeContextCurrent();
     201    if (!makeContextCurrent())
     202        return;
     203
    198204    ::glGetIntegerv(pname, value);
    199205}
     
    204210    ASSERT(precision);
    205211
    206     makeContextCurrent();
     212    if (!makeContextCurrent())
     213        return;
     214
    207215    ::glGetShaderPrecisionFormat(shaderType, precisionType, range, precision);
    208216}
     
    233241void GraphicsContextGLOpenGL::depthRange(GCGLclampf zNear, GCGLclampf zFar)
    234242{
    235     makeContextCurrent();
     243    if (!makeContextCurrent())
     244        return;
     245
    236246    ::glDepthRangef(zNear, zFar);
    237247}
     
    239249void GraphicsContextGLOpenGL::clearDepth(GCGLclampf depth)
    240250{
    241     makeContextCurrent();
     251    if (!makeContextCurrent())
     252        return;
     253
    242254    ::glClearDepthf(depth);
    243255}
     
    279291{
    280292    ASSERT_UNUSED(sharedContext, !sharedContext);
    281     makeContextCurrent();
     293    if (!makeContextCurrent())
     294        return;
     295
    282296   
    283297    validateAttributes();
     
    344358GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL()
    345359{
    346     makeContextCurrent();
     360    if (!makeContextCurrent())
     361        return;
     362
    347363    ::glDeleteTextures(1, &m_texture);
    348364
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp

    r269686 r269768  
    140140    m_texmapLayer = WTF::makeUnique<TextureMapperGCGLPlatformLayer>(*this, destination);
    141141#endif
    142     makeContextCurrent();
     142    bool success = makeContextCurrent();
     143    ASSERT_UNUSED(success, success);
    143144
    144145    validateAttributes();
     
    214215#endif
    215216
    216     makeContextCurrent();
     217    bool success = makeContextCurrent();
     218    ASSERT_UNUSED(success, success);
    217219
    218220    validateAttributes();
     
    334336GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL()
    335337{
    336     makeContextCurrent();
     338    bool success = makeContextCurrent();
     339    ASSERT_UNUSED(success, success);
    337340    if (m_texture)
    338341        gl::DeleteTextures(1, &m_texture);
     
    378381GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL()
    379382{
    380     makeContextCurrent();
     383    bool success = makeContextCurrent();
     384    ASSERT_UNUSED(success, success);
    381385    if (m_texture)
    382386        ::glDeleteTextures(1, &m_texture);
Note: See TracChangeset for help on using the changeset viewer.