Changeset 269680 in webkit


Ignore:
Timestamp:
Nov 11, 2020 4:27:43 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-11
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

    r269678 r269680  
     12020-11-11  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-11  Kimmo Kinnunen  <kkinnunen@apple.com>
    2571
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

    r269343 r269680  
    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

    r269051 r269680  
    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

    r269678 r269680  
    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: this will call makeCurrentContext again, we need to do this before changing the size.
     660    moveErrorsToSyntheticErrorList();
     661
    641662    markContextChanged();
    642663
     
    644665    m_currentHeight = height;
    645666
    646     makeContextCurrent();
    647     moveErrorsToSyntheticErrorList();
    648667    validateAttributes();
    649668
     
    667686    if (attrs.depth) {
    668687        gl::GetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth);
    669         GraphicsContextGLOpenGL::clearDepth(1);
     688        gl::ClearDepthf(1.0f);
    670689        gl::GetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
    671690        gl::DepthMask(GL_TRUE);
    672691        clearMask |= GL_DEPTH_BUFFER_BIT;
    673692    }
     693
    674694    if (attrs.stencil) {
    675695        gl::GetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil);
     
    687707    gl::ColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
    688708    if (attrs.depth) {
    689         GraphicsContextGLOpenGL::clearDepth(clearDepth);
     709        gl::ClearDepthf(clearDepth);
    690710        gl::DepthMask(depthMask);
    691711    }
     
    714734void GraphicsContextGLOpenGL::activeTexture(GCGLenum texture)
    715735{
    716     makeContextCurrent();
     736    if (!makeContextCurrent())
     737        return;
     738
    717739    m_state.activeTextureUnit = texture;
    718740    gl::ActiveTexture(texture);
     
    723745    ASSERT(program);
    724746    ASSERT(shader);
    725     makeContextCurrent();
     747    if (!makeContextCurrent())
     748        return;
     749
    726750    gl::AttachShader(program, shader);
    727751}
     
    730754{
    731755    ASSERT(program);
    732     makeContextCurrent();
     756    if (!makeContextCurrent())
     757        return;
     758
    733759    gl::BindAttribLocation(program, index, name.utf8().data());
    734760}
     
    736762void GraphicsContextGLOpenGL::bindBuffer(GCGLenum target, PlatformGLObject buffer)
    737763{
    738     makeContextCurrent();
     764    if (!makeContextCurrent())
     765        return;
     766
    739767    gl::BindBuffer(target, buffer);
    740768}
     
    742770void GraphicsContextGLOpenGL::bindFramebuffer(GCGLenum target, PlatformGLObject buffer)
    743771{
    744     makeContextCurrent();
     772    if (!makeContextCurrent())
     773        return;
     774
    745775    GLuint fbo;
    746776    if (buffer)
     
    761791void GraphicsContextGLOpenGL::bindRenderbuffer(GCGLenum target, PlatformGLObject renderbuffer)
    762792{
    763     makeContextCurrent();
     793    if (!makeContextCurrent())
     794        return;
     795
    764796    gl::BindRenderbuffer(target, renderbuffer);
    765797}
     
    768800void GraphicsContextGLOpenGL::bindTexture(GCGLenum target, PlatformGLObject texture)
    769801{
    770     makeContextCurrent();
     802    if (!makeContextCurrent())
     803        return;
     804
    771805    m_state.setBoundTexture(m_state.activeTextureUnit, texture, target);
    772806    gl::BindTexture(target, texture);
     
    775809void GraphicsContextGLOpenGL::blendColor(GCGLclampf red, GCGLclampf green, GCGLclampf blue, GCGLclampf alpha)
    776810{
    777     makeContextCurrent();
     811    if (!makeContextCurrent())
     812        return;
     813
    778814    gl::BlendColor(red, green, blue, alpha);
    779815}
     
    781817void GraphicsContextGLOpenGL::blendEquation(GCGLenum mode)
    782818{
    783     makeContextCurrent();
     819    if (!makeContextCurrent())
     820        return;
     821
    784822    gl::BlendEquation(mode);
    785823}
     
    787825void GraphicsContextGLOpenGL::blendEquationSeparate(GCGLenum modeRGB, GCGLenum modeAlpha)
    788826{
    789     makeContextCurrent();
     827    if (!makeContextCurrent())
     828        return;
     829
    790830    gl::BlendEquationSeparate(modeRGB, modeAlpha);
    791831}
     
    794834void GraphicsContextGLOpenGL::blendFunc(GCGLenum sfactor, GCGLenum dfactor)
    795835{
    796     makeContextCurrent();
     836    if (!makeContextCurrent())
     837        return;
     838
    797839    gl::BlendFunc(sfactor, dfactor);
    798840}
     
    800842void GraphicsContextGLOpenGL::blendFuncSeparate(GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha)
    801843{
    802     makeContextCurrent();
     844    if (!makeContextCurrent())
     845        return;
     846
    803847    gl::BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
    804848}
     
    806850void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, GCGLenum usage)
    807851{
    808     makeContextCurrent();
     852    if (!makeContextCurrent())
     853        return;
     854
    809855    gl::BufferData(target, size, 0, usage);
    810856}
     
    812858void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, const void* data, GCGLenum usage)
    813859{
    814     makeContextCurrent();
     860    if (!makeContextCurrent())
     861        return;
     862
    815863    gl::BufferData(target, size, data, usage);
    816864}
     
    818866void GraphicsContextGLOpenGL::bufferSubData(GCGLenum target, GCGLintptr offset, GCGLsizeiptr size, const void* data)
    819867{
    820     makeContextCurrent();
     868    if (!makeContextCurrent())
     869        return;
     870
    821871    gl::BufferSubData(target, offset, size, data);
    822872}
     
    824874void* GraphicsContextGLOpenGL::mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access)
    825875{
    826     makeContextCurrent();
     876    if (!makeContextCurrent())
     877        return nullptr;
     878
    827879    return gl::MapBufferRange(target, offset, length, access);
    828880}
     
    830882GCGLboolean GraphicsContextGLOpenGL::unmapBuffer(GCGLenum target)
    831883{
    832     makeContextCurrent();
     884    if (!makeContextCurrent())
     885        return GL_FALSE;
     886
    833887    return gl::UnmapBuffer(target);
    834888}
     
    836890void GraphicsContextGLOpenGL::copyBufferSubData(GCGLenum readTarget, GCGLenum writeTarget, GCGLintptr readOffset, GCGLintptr writeOffset, GCGLsizeiptr size)
    837891{
    838     makeContextCurrent();
     892    if (!makeContextCurrent())
     893        return;
     894
    839895    gl::CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
    840896}
     
    842898void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLint* params)
    843899{
    844     makeContextCurrent();
     900    if (!makeContextCurrent())
     901        return;
     902
    845903    gl::GetInternalformativ(target, internalformat, pname, bufSize, params);
    846904}
     
    848906void GraphicsContextGLOpenGL::renderbufferStorageMultisample(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    849907{
    850     makeContextCurrent();
     908    if (!makeContextCurrent())
     909        return;
     910
    851911    gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height);
    852912}
     
    854914void GraphicsContextGLOpenGL::texStorage2D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height)
    855915{
    856     makeContextCurrent();
     916    if (!makeContextCurrent())
     917        return;
     918
    857919    gl::TexStorage2D(target, levels, internalformat, width, height);
    858920    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    861923void GraphicsContextGLOpenGL::texStorage3D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth)
    862924{
    863     makeContextCurrent();
     925    if (!makeContextCurrent())
     926        return;
     927
    864928    gl::TexStorage3D(target, levels, internalformat, width, height, depth);
    865929    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    869933{
    870934    ASSERT(program);
    871     makeContextCurrent();
     935    if (!makeContextCurrent())
     936        return;
     937
    872938
    873939    gl::GetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, params.data());
     
    876942GCGLenum GraphicsContextGLOpenGL::checkFramebufferStatus(GCGLenum target)
    877943{
    878     makeContextCurrent();
     944    if (!makeContextCurrent())
     945        return GL_INVALID_OPERATION;
     946
    879947    return gl::CheckFramebufferStatus(target);
    880948}
     
    882950void GraphicsContextGLOpenGL::clearColor(GCGLclampf r, GCGLclampf g, GCGLclampf b, GCGLclampf a)
    883951{
    884     makeContextCurrent();
     952    if (!makeContextCurrent())
     953        return;
     954
    885955    gl::ClearColor(r, g, b, a);
    886956}
     
    888958void GraphicsContextGLOpenGL::clear(GCGLbitfield mask)
    889959{
    890     makeContextCurrent();
     960    if (!makeContextCurrent())
     961        return;
     962
    891963    gl::Clear(mask);
    892964    checkGPUStatus();
     
    895967void GraphicsContextGLOpenGL::clearStencil(GCGLint s)
    896968{
    897     makeContextCurrent();
     969    if (!makeContextCurrent())
     970        return;
     971
    898972    gl::ClearStencil(s);
    899973}
     
    901975void GraphicsContextGLOpenGL::colorMask(GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha)
    902976{
    903     makeContextCurrent();
     977    if (!makeContextCurrent())
     978        return;
     979
    904980    gl::ColorMask(red, green, blue, alpha);
    905981}
     
    908984{
    909985    ASSERT(shader);
    910     makeContextCurrent();
     986    if (!makeContextCurrent())
     987        return;
     988
    911989    // We need the ANGLE_texture_rectangle extension to support IOSurface
    912990    // backbuffers, but we don't want it exposed to WebGL user shaders.
     
    920998{
    921999    ASSERT(shader);
    922     makeContextCurrent();
     1000    if (!makeContextCurrent())
     1001        return;
     1002
    9231003    gl::CompileShader(shader);
    9241004}
     
    9261006void GraphicsContextGLOpenGL::copyTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLint border)
    9271007{
    928     makeContextCurrent();
     1008    if (!makeContextCurrent())
     1009        return;
     1010
    9291011    auto attrs = contextAttributes();
    9301012    GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
     
    9411023void GraphicsContextGLOpenGL::copyTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    9421024{
    943     makeContextCurrent();
     1025    if (!makeContextCurrent())
     1026        return;
     1027
    9441028    auto attrs = contextAttributes();
    9451029    GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
     
    9561040void GraphicsContextGLOpenGL::cullFace(GCGLenum mode)
    9571041{
    958     makeContextCurrent();
     1042    if (!makeContextCurrent())
     1043        return;
     1044
    9591045    gl::CullFace(mode);
    9601046}
     
    9621048void GraphicsContextGLOpenGL::depthFunc(GCGLenum func)
    9631049{
    964     makeContextCurrent();
     1050    if (!makeContextCurrent())
     1051        return;
     1052
    9651053    gl::DepthFunc(func);
    9661054}
     
    9681056void GraphicsContextGLOpenGL::depthMask(GCGLboolean flag)
    9691057{
    970     makeContextCurrent();
     1058    if (!makeContextCurrent())
     1059        return;
     1060
    9711061    gl::DepthMask(flag);
    9721062}
     
    9761066    ASSERT(program);
    9771067    ASSERT(shader);
    978     makeContextCurrent();
     1068    if (!makeContextCurrent())
     1069        return;
     1070
    9791071    gl::DetachShader(program, shader);
    9801072}
     
    9821074void GraphicsContextGLOpenGL::disable(GCGLenum cap)
    9831075{
    984     makeContextCurrent();
     1076    if (!makeContextCurrent())
     1077        return;
     1078
    9851079    gl::Disable(cap);
    9861080}
     
    9881082void GraphicsContextGLOpenGL::disableVertexAttribArray(GCGLuint index)
    9891083{
    990     makeContextCurrent();
     1084    if (!makeContextCurrent())
     1085        return;
     1086
    9911087    gl::DisableVertexAttribArray(index);
    9921088}
     
    9941090void GraphicsContextGLOpenGL::drawArrays(GCGLenum mode, GCGLint first, GCGLsizei count)
    9951091{
    996     makeContextCurrent();
     1092    if (!makeContextCurrent())
     1093        return;
     1094
    9971095    gl::DrawArrays(mode, first, count);
    9981096    checkGPUStatus();
     
    10011099void GraphicsContextGLOpenGL::drawElements(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset)
    10021100{
    1003     makeContextCurrent();
     1101    if (!makeContextCurrent())
     1102        return;
     1103
    10041104    gl::DrawElements(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)));
    10051105    checkGPUStatus();
     
    10081108void GraphicsContextGLOpenGL::enable(GCGLenum cap)
    10091109{
    1010     makeContextCurrent();
     1110    if (!makeContextCurrent())
     1111        return;
     1112
    10111113    gl::Enable(cap);
    10121114}
     
    10141116void GraphicsContextGLOpenGL::enableVertexAttribArray(GCGLuint index)
    10151117{
    1016     makeContextCurrent();
     1118    if (!makeContextCurrent())
     1119        return;
     1120
    10171121    gl::EnableVertexAttribArray(index);
    10181122}
     
    10201124void GraphicsContextGLOpenGL::finish()
    10211125{
    1022     makeContextCurrent();
     1126    if (!makeContextCurrent())
     1127        return;
     1128
    10231129    gl::Finish();
    10241130}
     
    10261132void GraphicsContextGLOpenGL::flush()
    10271133{
    1028     makeContextCurrent();
     1134    if (!makeContextCurrent())
     1135        return;
     1136
    10291137    gl::Flush();
    10301138}
     
    10321140void GraphicsContextGLOpenGL::framebufferRenderbuffer(GCGLenum target, GCGLenum attachment, GCGLenum renderbuffertarget, PlatformGLObject buffer)
    10331141{
    1034     makeContextCurrent();
     1142    if (!makeContextCurrent())
     1143        return;
     1144
    10351145    gl::FramebufferRenderbuffer(target, attachment, renderbuffertarget, buffer);
    10361146}
     
    10381148void GraphicsContextGLOpenGL::framebufferTexture2D(GCGLenum target, GCGLenum attachment, GCGLenum textarget, PlatformGLObject texture, GCGLint level)
    10391149{
    1040     makeContextCurrent();
     1150    if (!makeContextCurrent())
     1151        return;
     1152
    10411153    gl::FramebufferTexture2D(target, attachment, textarget, texture, level);
    10421154    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    10451157void GraphicsContextGLOpenGL::frontFace(GCGLenum mode)
    10461158{
    1047     makeContextCurrent();
     1159    if (!makeContextCurrent())
     1160        return;
     1161
    10481162    gl::FrontFace(mode);
    10491163}
     
    10511165void GraphicsContextGLOpenGL::generateMipmap(GCGLenum target)
    10521166{
    1053     makeContextCurrent();
     1167    if (!makeContextCurrent())
     1168        return;
     1169
    10541170    gl::GenerateMipmap(target);
    10551171}
     
    10611177        return false;
    10621178    }
    1063     makeContextCurrent();
     1179    if (!makeContextCurrent())
     1180        return false;
     1181
    10641182    GLint maxAttributeSize = 0;
    10651183    gl::GetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize);
     
    10901208    }
    10911209
    1092     makeContextCurrent();
     1210    if (!makeContextCurrent())
     1211        return false;
     1212
    10931213    GLint maxUniformSize = 0;
    10941214    gl::GetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize);
     
    11191239        return;
    11201240    }
    1121     makeContextCurrent();
     1241    if (!makeContextCurrent())
     1242        return;
     1243
    11221244    gl::GetAttachedShaders(program, maxCount, count, shaders);
    11231245}
     
    11281250        return -1;
    11291251
    1130     makeContextCurrent();
     1252    if (!makeContextCurrent())
     1253        return -1;
     1254
    11311255
    11321256    return gl::GetAttribLocation(program, name.utf8().data());
     
    11401264bool GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList()
    11411265{
    1142     makeContextCurrent();
     1266    if (!makeContextCurrent())
     1267        return false;
     1268
    11431269    bool movedAnError = false;
    11441270
     
    11671293    }
    11681294
    1169     makeContextCurrent();
     1295    if (!makeContextCurrent())
     1296        return GL_INVALID_OPERATION;
     1297
    11701298    return gl::GetError();
    11711299}
     
    11731301String GraphicsContextGLOpenGL::getString(GCGLenum name)
    11741302{
    1175     makeContextCurrent();
     1303    if (!makeContextCurrent())
     1304        return String();
     1305
    11761306    return String(reinterpret_cast<const char*>(gl::GetString(name)));
    11771307}
     
    11791309void GraphicsContextGLOpenGL::hint(GCGLenum target, GCGLenum mode)
    11801310{
    1181     makeContextCurrent();
     1311    if (!makeContextCurrent())
     1312        return;
     1313
    11821314    gl::Hint(target, mode);
    11831315}
     
    11881320        return GL_FALSE;
    11891321
    1190     makeContextCurrent();
     1322    if (!makeContextCurrent())
     1323        return GL_FALSE;
     1324
    11911325    return gl::IsBuffer(buffer);
    11921326}
     
    11941328GCGLboolean GraphicsContextGLOpenGL::isEnabled(GCGLenum cap)
    11951329{
    1196     makeContextCurrent();
     1330    if (!makeContextCurrent())
     1331        return GL_FALSE;
     1332
    11971333    return gl::IsEnabled(cap);
    11981334}
     
    12031339        return GL_FALSE;
    12041340
    1205     makeContextCurrent();
     1341    if (!makeContextCurrent())
     1342        return GL_FALSE;
     1343
    12061344    return gl::IsFramebuffer(framebuffer);
    12071345}
     
    12121350        return GL_FALSE;
    12131351
    1214     makeContextCurrent();
     1352    if (!makeContextCurrent())
     1353        return GL_FALSE;
     1354
    12151355    return gl::IsProgram(program);
    12161356}
     
    12211361        return GL_FALSE;
    12221362
    1223     makeContextCurrent();
     1363    if (!makeContextCurrent())
     1364        return GL_FALSE;
     1365
    12241366    return gl::IsRenderbuffer(renderbuffer);
    12251367}
     
    12301372        return GL_FALSE;
    12311373
    1232     makeContextCurrent();
     1374    if (!makeContextCurrent())
     1375        return GL_FALSE;
     1376
    12331377    return gl::IsShader(shader);
    12341378}
     
    12391383        return GL_FALSE;
    12401384
    1241     makeContextCurrent();
     1385    if (!makeContextCurrent())
     1386        return GL_FALSE;
     1387
    12421388    return gl::IsTexture(texture);
    12431389}
     
    12451391void GraphicsContextGLOpenGL::lineWidth(GCGLfloat width)
    12461392{
    1247     makeContextCurrent();
     1393    if (!makeContextCurrent())
     1394        return;
     1395
    12481396    gl::LineWidth(width);
    12491397}
     
    12521400{
    12531401    ASSERT(program);
    1254     makeContextCurrent();
     1402    if (!makeContextCurrent())
     1403        return;
     1404
    12551405    gl::LinkProgram(program);
    12561406}
     
    12581408void GraphicsContextGLOpenGL::pixelStorei(GCGLenum pname, GCGLint param)
    12591409{
    1260     makeContextCurrent();
     1410    if (!makeContextCurrent())
     1411        return;
     1412
    12611413    gl::PixelStorei(pname, param);
    12621414}
     
    12641416void GraphicsContextGLOpenGL::polygonOffset(GCGLfloat factor, GCGLfloat units)
    12651417{
    1266     makeContextCurrent();
     1418    if (!makeContextCurrent())
     1419        return;
     1420
    12671421    gl::PolygonOffset(factor, units);
    12681422}
     
    12701424void GraphicsContextGLOpenGL::sampleCoverage(GCGLclampf value, GCGLboolean invert)
    12711425{
    1272     makeContextCurrent();
     1426    if (!makeContextCurrent())
     1427        return;
     1428
    12731429    gl::SampleCoverage(value, invert);
    12741430}
     
    12761432void GraphicsContextGLOpenGL::scissor(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    12771433{
    1278     makeContextCurrent();
     1434    if (!makeContextCurrent())
     1435        return;
     1436
    12791437    gl::Scissor(x, y, width, height);
    12801438}
     
    12841442    ASSERT(shader);
    12851443
    1286     makeContextCurrent();
     1444    if (!makeContextCurrent())
     1445        return;
    12871446
    12881447    const CString& shaderSourceCString = string.utf8();
     
    12941453void GraphicsContextGLOpenGL::stencilFunc(GCGLenum func, GCGLint ref, GCGLuint mask)
    12951454{
    1296     makeContextCurrent();
     1455    if (!makeContextCurrent())
     1456        return;
     1457
    12971458    gl::StencilFunc(func, ref, mask);
    12981459}
     
    13001461void GraphicsContextGLOpenGL::stencilFuncSeparate(GCGLenum face, GCGLenum func, GCGLint ref, GCGLuint mask)
    13011462{
    1302     makeContextCurrent();
     1463    if (!makeContextCurrent())
     1464        return;
     1465
    13031466    gl::StencilFuncSeparate(face, func, ref, mask);
    13041467}
     
    13061469void GraphicsContextGLOpenGL::stencilMask(GCGLuint mask)
    13071470{
    1308     makeContextCurrent();
     1471    if (!makeContextCurrent())
     1472        return;
     1473
    13091474    gl::StencilMask(mask);
    13101475}
     
    13121477void GraphicsContextGLOpenGL::stencilMaskSeparate(GCGLenum face, GCGLuint mask)
    13131478{
    1314     makeContextCurrent();
     1479    if (!makeContextCurrent())
     1480        return;
     1481
    13151482    gl::StencilMaskSeparate(face, mask);
    13161483}
     
    13181485void GraphicsContextGLOpenGL::stencilOp(GCGLenum fail, GCGLenum zfail, GCGLenum zpass)
    13191486{
    1320     makeContextCurrent();
     1487    if (!makeContextCurrent())
     1488        return;
     1489
    13211490    gl::StencilOp(fail, zfail, zpass);
    13221491}
     
    13241493void GraphicsContextGLOpenGL::stencilOpSeparate(GCGLenum face, GCGLenum fail, GCGLenum zfail, GCGLenum zpass)
    13251494{
    1326     makeContextCurrent();
     1495    if (!makeContextCurrent())
     1496        return;
     1497
    13271498    gl::StencilOpSeparate(face, fail, zfail, zpass);
    13281499}
     
    13301501void GraphicsContextGLOpenGL::texParameterf(GCGLenum target, GCGLenum pname, GCGLfloat value)
    13311502{
    1332     makeContextCurrent();
     1503    if (!makeContextCurrent())
     1504        return;
     1505
    13331506    gl::TexParameterf(target, pname, value);
    13341507}
     
    13361509void GraphicsContextGLOpenGL::texParameteri(GCGLenum target, GCGLenum pname, GCGLint value)
    13371510{
    1338     makeContextCurrent();
     1511    if (!makeContextCurrent())
     1512        return;
     1513
    13391514    gl::TexParameteri(target, pname, value);
    13401515}
     
    13421517void GraphicsContextGLOpenGL::uniform1f(GCGLint location, GCGLfloat v0)
    13431518{
    1344     makeContextCurrent();
     1519    if (!makeContextCurrent())
     1520        return;
     1521
    13451522    gl::Uniform1f(location, v0);
    13461523}
     
    13481525void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, GCGLsizei size, const GCGLfloat* array)
    13491526{
    1350     makeContextCurrent();
     1527    if (!makeContextCurrent())
     1528        return;
     1529
    13511530    gl::Uniform1fv(location, size, array);
    13521531}
     
    13541533void GraphicsContextGLOpenGL::uniform2f(GCGLint location, GCGLfloat v0, GCGLfloat v1)
    13551534{
    1356     makeContextCurrent();
     1535    if (!makeContextCurrent())
     1536        return;
     1537
    13571538    gl::Uniform2f(location, v0, v1);
    13581539}
     
    13611542{
    13621543    // FIXME: length needs to be a multiple of 2.
    1363     makeContextCurrent();
     1544    if (!makeContextCurrent())
     1545        return;
     1546
    13641547    gl::Uniform2fv(location, size, array);
    13651548}
     
    13671550void GraphicsContextGLOpenGL::uniform3f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2)
    13681551{
    1369     makeContextCurrent();
     1552    if (!makeContextCurrent())
     1553        return;
     1554
    13701555    gl::Uniform3f(location, v0, v1, v2);
    13711556}
     
    13741559{
    13751560    // FIXME: length needs to be a multiple of 3.
    1376     makeContextCurrent();
     1561    if (!makeContextCurrent())
     1562        return;
     1563
    13771564    gl::Uniform3fv(location, size, array);
    13781565}
     
    13801567void GraphicsContextGLOpenGL::uniform4f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3)
    13811568{
    1382     makeContextCurrent();
     1569    if (!makeContextCurrent())
     1570        return;
     1571
    13831572    gl::Uniform4f(location, v0, v1, v2, v3);
    13841573}
     
    13871576{
    13881577    // FIXME: length needs to be a multiple of 4.
    1389     makeContextCurrent();
     1578    if (!makeContextCurrent())
     1579        return;
     1580
    13901581    gl::Uniform4fv(location, size, array);
    13911582}
     
    13931584void GraphicsContextGLOpenGL::uniform1i(GCGLint location, GCGLint v0)
    13941585{
    1395     makeContextCurrent();
     1586    if (!makeContextCurrent())
     1587        return;
     1588
    13961589    gl::Uniform1i(location, v0);
    13971590}
     
    13991592void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, GCGLsizei size, const GCGLint* array)
    14001593{
    1401     makeContextCurrent();
     1594    if (!makeContextCurrent())
     1595        return;
     1596
    14021597    gl::Uniform1iv(location, size, array);
    14031598}
     
    14051600void GraphicsContextGLOpenGL::uniform2i(GCGLint location, GCGLint v0, GCGLint v1)
    14061601{
    1407     makeContextCurrent();
     1602    if (!makeContextCurrent())
     1603        return;
     1604
    14081605    gl::Uniform2i(location, v0, v1);
    14091606}
     
    14121609{
    14131610    // FIXME: length needs to be a multiple of 2.
    1414     makeContextCurrent();
     1611    if (!makeContextCurrent())
     1612        return;
     1613
    14151614    gl::Uniform2iv(location, size, array);
    14161615}
     
    14181617void GraphicsContextGLOpenGL::uniform3i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2)
    14191618{
    1420     makeContextCurrent();
     1619    if (!makeContextCurrent())
     1620        return;
     1621
    14211622    gl::Uniform3i(location, v0, v1, v2);
    14221623}
     
    14251626{
    14261627    // FIXME: length needs to be a multiple of 3.
    1427     makeContextCurrent();
     1628    if (!makeContextCurrent())
     1629        return;
     1630
    14281631    gl::Uniform3iv(location, size, array);
    14291632}
     
    14311634void GraphicsContextGLOpenGL::uniform4i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2, GCGLint v3)
    14321635{
    1433     makeContextCurrent();
     1636    if (!makeContextCurrent())
     1637        return;
     1638
    14341639    gl::Uniform4i(location, v0, v1, v2, v3);
    14351640}
     
    14381643{
    14391644    // FIXME: length needs to be a multiple of 4.
    1440     makeContextCurrent();
     1645    if (!makeContextCurrent())
     1646        return;
     1647
    14411648    gl::Uniform4iv(location, size, array);
    14421649}
     
    14451652{
    14461653    // FIXME: length needs to be a multiple of 4.
    1447     makeContextCurrent();
     1654    if (!makeContextCurrent())
     1655        return;
     1656
    14481657    gl::UniformMatrix2fv(location, size, transpose, array);
    14491658}
     
    14521661{
    14531662    // FIXME: length needs to be a multiple of 9.
    1454     makeContextCurrent();
     1663    if (!makeContextCurrent())
     1664        return;
     1665
    14551666    gl::UniformMatrix3fv(location, size, transpose, array);
    14561667}
     
    14591670{
    14601671    // FIXME: length needs to be a multiple of 16.
    1461     makeContextCurrent();
     1672    if (!makeContextCurrent())
     1673        return;
     1674
    14621675    gl::UniformMatrix4fv(location, size, transpose, array);
    14631676}
     
    14651678void GraphicsContextGLOpenGL::useProgram(PlatformGLObject program)
    14661679{
    1467     makeContextCurrent();
     1680    if (!makeContextCurrent())
     1681        return;
     1682
    14681683    gl::UseProgram(program);
    14691684}
     
    14731688    ASSERT(program);
    14741689
    1475     makeContextCurrent();
     1690    if (!makeContextCurrent())
     1691        return;
     1692
    14761693    gl::ValidateProgram(program);
    14771694}
     
    14791696void GraphicsContextGLOpenGL::vertexAttrib1f(GCGLuint index, GCGLfloat v0)
    14801697{
    1481     makeContextCurrent();
     1698    if (!makeContextCurrent())
     1699        return;
     1700
    14821701    gl::VertexAttrib1f(index, v0);
    14831702}
     
    14851704void GraphicsContextGLOpenGL::vertexAttrib1fv(GCGLuint index, const GCGLfloat* array)
    14861705{
    1487     makeContextCurrent();
     1706    if (!makeContextCurrent())
     1707        return;
     1708
    14881709    gl::VertexAttrib1fv(index, array);
    14891710}
     
    14911712void GraphicsContextGLOpenGL::vertexAttrib2f(GCGLuint index, GCGLfloat v0, GCGLfloat v1)
    14921713{
    1493     makeContextCurrent();
     1714    if (!makeContextCurrent())
     1715        return;
     1716
    14941717    gl::VertexAttrib2f(index, v0, v1);
    14951718}
     
    14971720void GraphicsContextGLOpenGL::vertexAttrib2fv(GCGLuint index, const GCGLfloat* array)
    14981721{
    1499     makeContextCurrent();
     1722    if (!makeContextCurrent())
     1723        return;
     1724
    15001725    gl::VertexAttrib2fv(index, array);
    15011726}
     
    15031728void GraphicsContextGLOpenGL::vertexAttrib3f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2)
    15041729{
    1505     makeContextCurrent();
     1730    if (!makeContextCurrent())
     1731        return;
     1732
    15061733    gl::VertexAttrib3f(index, v0, v1, v2);
    15071734}
     
    15091736void GraphicsContextGLOpenGL::vertexAttrib3fv(GCGLuint index, const GCGLfloat* array)
    15101737{
    1511     makeContextCurrent();
     1738    if (!makeContextCurrent())
     1739        return;
     1740
    15121741    gl::VertexAttrib3fv(index, array);
    15131742}
     
    15151744void GraphicsContextGLOpenGL::vertexAttrib4f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3)
    15161745{
    1517     makeContextCurrent();
     1746    if (!makeContextCurrent())
     1747        return;
     1748
    15181749    gl::VertexAttrib4f(index, v0, v1, v2, v3);
    15191750}
     
    15211752void GraphicsContextGLOpenGL::vertexAttrib4fv(GCGLuint index, const GCGLfloat* array)
    15221753{
    1523     makeContextCurrent();
     1754    if (!makeContextCurrent())
     1755        return;
     1756
    15241757    gl::VertexAttrib4fv(index, array);
    15251758}
     
    15271760void GraphicsContextGLOpenGL::vertexAttribPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLboolean normalized, GCGLsizei stride, GCGLintptr offset)
    15281761{
    1529     makeContextCurrent();
     1762    if (!makeContextCurrent())
     1763        return;
     1764
    15301765    gl::VertexAttribPointer(index, size, type, normalized, stride, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)));
    15311766}
     
    15331768void GraphicsContextGLOpenGL::vertexAttribIPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLsizei stride, GCGLintptr offset)
    15341769{
    1535     makeContextCurrent();
     1770    if (!makeContextCurrent())
     1771        return;
     1772
    15361773    gl::VertexAttribIPointer(index, size, type, stride, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)));
    15371774}
     
    15391776void GraphicsContextGLOpenGL::viewport(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    15401777{
    1541     makeContextCurrent();
     1778    if (!makeContextCurrent())
     1779        return;
     1780
    15421781    gl::Viewport(x, y, width, height);
    15431782}
     
    15451784PlatformGLObject GraphicsContextGLOpenGL::createVertexArray()
    15461785{
    1547     makeContextCurrent();
     1786    if (!makeContextCurrent())
     1787        return 0;
     1788
    15481789    GLuint array = 0;
    15491790    gl::GenVertexArrays(1, &array);
     
    15551796    if (!array)
    15561797        return;
    1557     makeContextCurrent();
     1798    if (!makeContextCurrent())
     1799        return;
     1800
    15581801    gl::DeleteVertexArrays(1, &array);
    15591802}
     
    15631806    if (!array)
    15641807        return GL_FALSE;
    1565     makeContextCurrent();
     1808    if (!makeContextCurrent())
     1809        return GL_FALSE;
     1810
    15661811    return gl::IsVertexArray(array);
    15671812}
     
    15691814void GraphicsContextGLOpenGL::bindVertexArray(PlatformGLObject array)
    15701815{
    1571     makeContextCurrent();
     1816    if (!makeContextCurrent())
     1817        return;
     1818
    15721819    gl::BindVertexArray(array);
    15731820}
     
    15751822void GraphicsContextGLOpenGL::getBooleanv(GCGLenum pname, GCGLboolean* value)
    15761823{
    1577     makeContextCurrent();
     1824    if (!makeContextCurrent())
     1825        return;
     1826
    15781827    gl::GetBooleanv(pname, value);
    15791828}
     
    15811830void GraphicsContextGLOpenGL::getBufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    15821831{
    1583     makeContextCurrent();
     1832    if (!makeContextCurrent())
     1833        return;
     1834
    15841835    gl::GetBufferParameteriv(target, pname, value);
    15851836}
     
    15871838void GraphicsContextGLOpenGL::getFloatv(GCGLenum pname, GCGLfloat* value)
    15881839{
    1589     makeContextCurrent();
     1840    if (!makeContextCurrent())
     1841        return;
     1842
    15901843    gl::GetFloatv(pname, value);
    15911844}
     
    15931846void GraphicsContextGLOpenGL::getInteger64v(GCGLenum pname, GCGLint64* value)
    15941847{
    1595     makeContextCurrent();
     1848    if (!makeContextCurrent())
     1849        return;
     1850
    15961851    *value = 0;
    15971852    gl::GetInteger64v(pname, value);
     
    16001855void GraphicsContextGLOpenGL::getInteger64i_v(GCGLenum pname, GCGLuint index, GCGLint64* value)
    16011856{
    1602     makeContextCurrent();
     1857    if (!makeContextCurrent())
     1858        return;
     1859
    16031860    *value = 0;
    16041861    gl::GetInteger64i_v(pname, index, value);
     
    16071864void GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv(GCGLenum target, GCGLenum attachment, GCGLenum pname, GCGLint* value)
    16081865{
    1609     makeContextCurrent();
     1866    if (!makeContextCurrent())
     1867        return;
     1868
    16101869    if (attachment == DEPTH_STENCIL_ATTACHMENT)
    16111870        attachment = DEPTH_ATTACHMENT; // Or STENCIL_ATTACHMENT, either works.
     
    16151874void GraphicsContextGLOpenGL::getProgramiv(PlatformGLObject program, GCGLenum pname, GCGLint* value)
    16161875{
    1617     makeContextCurrent();
     1876    if (!makeContextCurrent())
     1877        return;
     1878
    16181879    gl::GetProgramiv(program, pname, value);
    16191880}
     
    16431904    ASSERT(program);
    16441905
    1645     makeContextCurrent();
     1906    if (!makeContextCurrent())
     1907        return String();
     1908
    16461909    GLint length = 0;
    16471910    gl::GetProgramiv(program, GL_INFO_LOG_LENGTH, &length);
     
    16621925void GraphicsContextGLOpenGL::getRenderbufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    16631926{
    1664     makeContextCurrent();
     1927    if (!makeContextCurrent())
     1928        return;
     1929
    16651930    gl::GetRenderbufferParameteriv(target, pname, value);
    16661931}
     
    16701935    ASSERT(shader);
    16711936
    1672     makeContextCurrent();
     1937    if (!makeContextCurrent())
     1938        return;
     1939
    16731940    gl::GetShaderiv(shader, pname, value);
    16741941}
     
    16781945    ASSERT(shader);
    16791946
    1680     makeContextCurrent();
     1947    if (!makeContextCurrent())
     1948        return String();
     1949
    16811950    GLint length = 0;
    16821951    gl::GetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
     
    16991968void GraphicsContextGLOpenGL::getTexParameterfv(GCGLenum target, GCGLenum pname, GCGLfloat* value)
    17001969{
    1701     makeContextCurrent();
     1970    if (!makeContextCurrent())
     1971        return;
     1972
    17021973    gl::GetTexParameterfv(target, pname, value);
    17031974}
     
    17051976void GraphicsContextGLOpenGL::getTexParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value)
    17061977{
    1707     makeContextCurrent();
     1978    if (!makeContextCurrent())
     1979        return;
     1980
    17081981    gl::GetTexParameteriv(target, pname, value);
    17091982}
     
    17111984void GraphicsContextGLOpenGL::getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value)
    17121985{
    1713     makeContextCurrent();
     1986    if (!makeContextCurrent())
     1987        return;
     1988
    17141989    gl::GetUniformfv(program, location, value);
    17151990}
     
    17171992void GraphicsContextGLOpenGL::getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value)
    17181993{
    1719     makeContextCurrent();
     1994    if (!makeContextCurrent())
     1995        return;
     1996
    17201997    gl::GetUniformiv(program, location, value);
    17211998}
     
    17232000void GraphicsContextGLOpenGL::getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value)
    17242001{
    1725     makeContextCurrent();
     2002    if (!makeContextCurrent())
     2003        return;
     2004
    17262005    gl::GetUniformuiv(program, location, value);
    17272006}
     
    17312010    ASSERT(program);
    17322011
    1733     makeContextCurrent();
     2012    if (!makeContextCurrent())
     2013        return -1;
     2014
    17342015    return gl::GetUniformLocation(program, name.utf8().data());
    17352016}
     
    17372018void GraphicsContextGLOpenGL::getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLfloat* value)
    17382019{
    1739     makeContextCurrent();
     2020    if (!makeContextCurrent())
     2021        return;
     2022
    17402023    gl::GetVertexAttribfv(index, pname, value);
    17412024}
     
    17432026void GraphicsContextGLOpenGL::getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLint* value)
    17442027{
    1745     makeContextCurrent();
     2028    if (!makeContextCurrent())
     2029        return;
     2030
    17462031    gl::GetVertexAttribiv(index, pname, value);
    17472032}
     
    17492034GCGLsizeiptr GraphicsContextGLOpenGL::getVertexAttribOffset(GCGLuint index, GCGLenum pname)
    17502035{
    1751     makeContextCurrent();
     2036    if (!makeContextCurrent())
     2037        return 0;
    17522038
    17532039    GLvoid* pointer = 0;
     
    17582044void GraphicsContextGLOpenGL::texSubImage2D(GCGLenum target, GCGLint level, GCGLint xoff, GCGLint yoff, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, const void* pixels)
    17592045{
    1760     makeContextCurrent();
     2046    if (!makeContextCurrent())
     2047        return;
    17612048
    17622049    // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size.
     
    17672054void GraphicsContextGLOpenGL::compressedTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLsizei imageSize, const void* data)
    17682055{
    1769     makeContextCurrent();
     2056    if (!makeContextCurrent())
     2057        return;
     2058
    17702059    gl::CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
    17712060    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    17742063void GraphicsContextGLOpenGL::compressedTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLsizei imageSize, const void* data)
    17752064{
    1776     makeContextCurrent();
     2065    if (!makeContextCurrent())
     2066        return;
     2067
    17772068    gl::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
    17782069    m_state.textureSeedCount.add(m_state.currentBoundTexture());
     
    17812072PlatformGLObject GraphicsContextGLOpenGL::createBuffer()
    17822073{
    1783     makeContextCurrent();
     2074    if (!makeContextCurrent())
     2075        return 0;
     2076
    17842077    GLuint o = 0;
    17852078    gl::GenBuffers(1, &o);
     
    17892082PlatformGLObject GraphicsContextGLOpenGL::createFramebuffer()
    17902083{
    1791     makeContextCurrent();
     2084    if (!makeContextCurrent())
     2085        return 0;
     2086
    17922087    GLuint o = 0;
    17932088    gl::GenFramebuffers(1, &o);
     
    17972092PlatformGLObject GraphicsContextGLOpenGL::createProgram()
    17982093{
    1799     makeContextCurrent();
     2094    if (!makeContextCurrent())
     2095        return 0;
     2096
    18002097    return gl::CreateProgram();
    18012098}
     
    18032100PlatformGLObject GraphicsContextGLOpenGL::createRenderbuffer()
    18042101{
    1805     makeContextCurrent();
     2102    if (!makeContextCurrent())
     2103        return 0;
     2104
    18062105    GLuint o = 0;
    18072106    gl::GenRenderbuffers(1, &o);
     
    18112110PlatformGLObject GraphicsContextGLOpenGL::createShader(GCGLenum type)
    18122111{
    1813     makeContextCurrent();
     2112    if (!makeContextCurrent())
     2113        return 0;
     2114
    18142115    return gl::CreateShader((type == FRAGMENT_SHADER) ? GL_FRAGMENT_SHADER : GL_VERTEX_SHADER);
    18152116}
     
    18172118PlatformGLObject GraphicsContextGLOpenGL::createTexture()
    18182119{
    1819     makeContextCurrent();
     2120    if (!makeContextCurrent())
     2121        return 0;
     2122
    18202123    GLuint o = 0;
    18212124    gl::GenTextures(1, &o);
     
    18262129void GraphicsContextGLOpenGL::deleteBuffer(PlatformGLObject buffer)
    18272130{
    1828     makeContextCurrent();
     2131    if (!makeContextCurrent())
     2132        return;
     2133
    18292134    gl::DeleteBuffers(1, &buffer);
    18302135}
     
    18322137void GraphicsContextGLOpenGL::deleteFramebuffer(PlatformGLObject framebuffer)
    18332138{
    1834     makeContextCurrent();
     2139    if (!makeContextCurrent())
     2140        return;
     2141
    18352142    // Make sure the framebuffer is not going to be used for drawing
    18362143    // operations after it gets deleted.
     
    18472154void GraphicsContextGLOpenGL::deleteProgram(PlatformGLObject program)
    18482155{
    1849     makeContextCurrent();
     2156    if (!makeContextCurrent())
     2157        return;
     2158
    18502159    gl::DeleteProgram(program);
    18512160}
     
    18532162void GraphicsContextGLOpenGL::deleteRenderbuffer(PlatformGLObject renderbuffer)
    18542163{
    1855     makeContextCurrent();
     2164    if (!makeContextCurrent())
     2165        return;
     2166
    18562167    gl::DeleteRenderbuffers(1, &renderbuffer);
    18572168}
     
    18592170void GraphicsContextGLOpenGL::deleteShader(PlatformGLObject shader)
    18602171{
    1861     makeContextCurrent();
     2172    if (!makeContextCurrent())
     2173        return;
     2174
    18622175    gl::DeleteShader(shader);
    18632176}
     
    18652178void GraphicsContextGLOpenGL::deleteTexture(PlatformGLObject texture)
    18662179{
    1867     makeContextCurrent();
     2180    if (!makeContextCurrent())
     2181        return;
     2182
    18682183    m_state.boundTextureMap.removeIf([texture] (auto& keyValue) {
    18692184        return keyValue.value.first == texture;
     
    19212236void GraphicsContextGLOpenGL::texImage2DDirect(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, const void* pixels)
    19222237{
    1923     makeContextCurrent();
     2238    if (!makeContextCurrent())
     2239        return;
     2240
    19242241    if (!m_isForWebGL2 && m_extensions)
    19252242        internalformat = m_extensions->adjustWebGL1TextureInternalFormat(internalformat, format, type);
     
    19302247void GraphicsContextGLOpenGL::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount)
    19312248{
     2249    if (!makeContextCurrent())
     2250        return;
     2251
    19322252    if (m_isForWebGL2)
    19332253        gl::DrawArraysInstanced(mode, first, count, primcount);
    19342254    else
    1935         getExtensions().drawArraysInstanced(mode, first, count, primcount);
     2255        gl::DrawArraysInstancedANGLE(mode, first, count, primcount);
    19362256    checkGPUStatus();
    19372257}
     
    19392259void GraphicsContextGLOpenGL::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset, GCGLsizei primcount)
    19402260{
     2261    if (!makeContextCurrent())
     2262        return;
     2263
    19412264    if (m_isForWebGL2)
    19422265        gl::DrawElementsInstanced(mode, count, type, reinterpret_cast<void*>(offset), primcount);
    19432266    else
    1944         getExtensions().drawElementsInstanced(mode, count, type, offset, primcount);
     2267        gl::DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<void*>(offset), primcount);
    19452268    checkGPUStatus();
    19462269}
     
    19482271void GraphicsContextGLOpenGL::vertexAttribDivisor(GCGLuint index, GCGLuint divisor)
    19492272{
     2273    if (!makeContextCurrent())
     2274        return;
     2275
    19502276    if (m_isForWebGL2)
    19512277        gl::VertexAttribDivisor(index, divisor);
    19522278    else
    1953         getExtensions().vertexAttribDivisor(index, divisor);
     2279        gl::VertexAttribDivisorANGLE(index, divisor);
    19542280}
    19552281
     
    19572283{
    19582284    ASSERT(program);
    1959     makeContextCurrent();
     2285    if (!makeContextCurrent())
     2286        return GL_INVALID_INDEX;
     2287
    19602288    return gl::GetUniformBlockIndex(program, uniformBlockName.utf8().data());
    19612289}
     
    19742302{
    19752303    ASSERT(program);
    1976     makeContextCurrent();
     2304    if (!makeContextCurrent())
     2305        return String();
     2306
    19772307    GLint maxLength = 0;
    19782308    gl::GetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &maxLength);
     
    19922322{
    19932323    ASSERT(program);
    1994     makeContextCurrent();
     2324    if (!makeContextCurrent())
     2325        return;
     2326
    19952327    gl::UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
    19962328}
     
    20002332PlatformGLObject GraphicsContextGLOpenGL::createQuery()
    20012333{
    2002     makeContextCurrent();
     2334    if (!makeContextCurrent())
     2335        return 0;
     2336
    20032337    GLuint name = 0;
    20042338    gl::GenQueries(1, &name);
     
    20082342void GraphicsContextGLOpenGL::beginQuery(GCGLenum target, PlatformGLObject query)
    20092343{
    2010     makeContextCurrent();
     2344    if (!makeContextCurrent())
     2345        return;
     2346
    20112347    gl::BeginQuery(target, query);
    20122348}
     
    20142350void GraphicsContextGLOpenGL::endQuery(GCGLenum target)
    20152351{
    2016     makeContextCurrent();
     2352    if (!makeContextCurrent())
     2353        return;
     2354
    20172355    gl::EndQuery(target);
    20182356}
     
    20202358void GraphicsContextGLOpenGL::getQueryObjectuiv(GCGLuint id, GCGLenum pname, GCGLuint* params)
    20212359{
    2022     makeContextCurrent();
     2360    if (!makeContextCurrent())
     2361        return;
     2362
    20232363    gl::GetQueryObjectuiv(id, pname, params);
    20242364}
     
    20282368PlatformGLObject GraphicsContextGLOpenGL::createTransformFeedback()
    20292369{
    2030     makeContextCurrent();
     2370    if (!makeContextCurrent())
     2371        return 0;
     2372
    20312373    GLuint name = 0;
    20322374    gl::GenTransformFeedbacks(1, &name);
     
    20362378void GraphicsContextGLOpenGL::deleteTransformFeedback(PlatformGLObject transformFeedback)
    20372379{
    2038     makeContextCurrent();
     2380    if (!makeContextCurrent())
     2381        return;
     2382
    20392383    gl::DeleteTransformFeedbacks(1, &transformFeedback);
    20402384}
     
    20422386GCGLboolean GraphicsContextGLOpenGL::isTransformFeedback(PlatformGLObject transformFeedback)
    20432387{
    2044     makeContextCurrent();
     2388    if (!makeContextCurrent())
     2389        return GL_FALSE;
     2390
    20452391    return gl::IsTransformFeedback(transformFeedback);
    20462392}
     
    20482394void GraphicsContextGLOpenGL::bindTransformFeedback(GCGLenum target, PlatformGLObject transformFeedback)
    20492395{
    2050     makeContextCurrent();
     2396    if (!makeContextCurrent())
     2397        return;
     2398
    20512399    gl::BindTransformFeedback(target, transformFeedback);
    20522400}
     
    20542402void GraphicsContextGLOpenGL::beginTransformFeedback(GCGLenum primitiveMode)
    20552403{
    2056     makeContextCurrent();
     2404    if (!makeContextCurrent())
     2405        return;
     2406
    20572407    gl::BeginTransformFeedback(primitiveMode);
    20582408}
     
    20602410void GraphicsContextGLOpenGL::endTransformFeedback()
    20612411{
    2062     makeContextCurrent();
     2412    if (!makeContextCurrent())
     2413        return;
     2414
    20632415    gl::EndTransformFeedback();
    20642416}
     
    20662418void GraphicsContextGLOpenGL::transformFeedbackVaryings(PlatformGLObject program, const Vector<String>& varyings, GCGLenum bufferMode)
    20672419{
     2420    if (!makeContextCurrent())
     2421        return;
     2422
    20682423    Vector<CString> convertedVaryings = varyings.map([](const String& varying) {
    20692424        return varying.utf8();
     
    20722427        return varying.data();
    20732428    });
    2074     makeContextCurrent();
     2429
    20752430    gl::TransformFeedbackVaryings(program, pointersToVaryings.size(), pointersToVaryings.data(), bufferMode);
    20762431}
     
    20782433void GraphicsContextGLOpenGL::getTransformFeedbackVarying(PlatformGLObject program, GCGLuint index, ActiveInfo& info)
    20792434{
    2080     makeContextCurrent();
     2435    if (!makeContextCurrent())
     2436        return;
     2437
    20812438    GCGLsizei bufSize = 0;
    20822439    gl::GetProgramiv(program, GraphicsContextGLOpenGL::TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &bufSize);
     
    20982455void GraphicsContextGLOpenGL::bindBufferBase(GCGLenum target, GCGLuint index, PlatformGLObject buffer)
    20992456{
    2100     makeContextCurrent();
     2457    if (!makeContextCurrent())
     2458        return;
     2459
    21012460    gl::BindBufferBase(target, index, buffer);
    21022461}
     
    21322491void GraphicsContextGLOpenGL::blitFramebuffer(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter)
    21332492{
     2493    if (!makeContextCurrent())
     2494        return;
     2495
    21342496    gl::BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
    21352497}
     
    21372499void GraphicsContextGLOpenGL::framebufferTextureLayer(GCGLenum target, GCGLenum attachment, PlatformGLObject texture, GCGLint level, GCGLint layer)
    21382500{
     2501    if (!makeContextCurrent())
     2502        return;
     2503
    21392504    gl::FramebufferTextureLayer(target, attachment, texture, level, layer);
    21402505}
     
    21422507void GraphicsContextGLOpenGL::invalidateFramebuffer(GCGLenum target, GCGLsizei numAttachments, const GCGLenum* attachments)
    21432508{
     2509    if (!makeContextCurrent())
     2510        return;
     2511
    21442512    gl::InvalidateFramebuffer(target, numAttachments, attachments);
    21452513}
     
    21472515void GraphicsContextGLOpenGL::invalidateSubFramebuffer(GCGLenum target, GCGLsizei numAttachments, const GCGLenum* attachments, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    21482516{
     2517    if (!makeContextCurrent())
     2518        return;
     2519
    21492520    gl::InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
    21502521}
     
    21522523void GraphicsContextGLOpenGL::readBuffer(GCGLenum src)
    21532524{
     2525    if (!makeContextCurrent())
     2526        return;
     2527
    21542528    gl::ReadBuffer(src);
    21552529}
     
    21572531void GraphicsContextGLOpenGL::copyTexSubImage3D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint zoffset, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height)
    21582532{
    2159     makeContextCurrent();
     2533    if (!makeContextCurrent())
     2534        return;
     2535
    21602536    auto attrs = contextAttributes();
    21612537    GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER;
     
    21722548GCGLint GraphicsContextGLOpenGL::getFragDataLocation(PlatformGLObject program, const String& name)
    21732549{
    2174     makeContextCurrent();
     2550    if (!makeContextCurrent())
     2551        return -1;
     2552
    21752553    return gl::GetFragDataLocation(program, name.utf8().data());
    21762554}
     
    21782556void GraphicsContextGLOpenGL::uniform1ui(GCGLint location, GCGLuint v0)
    21792557{
    2180     makeContextCurrent();
     2558    if (!makeContextCurrent())
     2559        return;
     2560
    21812561    gl::Uniform1ui(location, v0);
    21822562}
     
    21842564void GraphicsContextGLOpenGL::uniform2ui(GCGLint location, GCGLuint v0, GCGLuint v1)
    21852565{
    2186     makeContextCurrent();
     2566    if (!makeContextCurrent())
     2567        return;
     2568
    21872569    gl::Uniform2ui(location, v0, v1);
    21882570}
     
    21902572void GraphicsContextGLOpenGL::uniform3ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2)
    21912573{
    2192     makeContextCurrent();
     2574    if (!makeContextCurrent())
     2575        return;
     2576
    21932577    gl::Uniform3ui(location, v0, v1, v2);
    21942578}
     
    21962580void GraphicsContextGLOpenGL::uniform4ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2, GCGLuint v3)
    21972581{
    2198     makeContextCurrent();
     2582    if (!makeContextCurrent())
     2583        return;
     2584
    21992585    gl::Uniform4ui(location, v0, v1, v2, v3);
    22002586}
     
    22022588void GraphicsContextGLOpenGL::uniform1uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
    22032589{
    2204     makeContextCurrent();
     2590    if (!makeContextCurrent())
     2591        return;
     2592
    22052593    gl::Uniform1uiv(location, srcLength, data + srcOffset);
    22062594}
     
    22082596void GraphicsContextGLOpenGL::uniform2uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
    22092597{
    2210     makeContextCurrent();
     2598    if (!makeContextCurrent())
     2599        return;
     2600
    22112601    gl::Uniform2uiv(location, srcLength, data + srcOffset);
    22122602}
     
    22142604void GraphicsContextGLOpenGL::uniform3uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
    22152605{
    2216     makeContextCurrent();
     2606    if (!makeContextCurrent())
     2607        return;
     2608
    22172609    gl::Uniform3uiv(location, srcLength, data + srcOffset);
    22182610}
     
    22202612void GraphicsContextGLOpenGL::uniform4uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength)
    22212613{
    2222     makeContextCurrent();
     2614    if (!makeContextCurrent())
     2615        return;
     2616
    22232617    gl::Uniform4uiv(location, srcLength, data + srcOffset);
    22242618}
     
    22262620void GraphicsContextGLOpenGL::uniformMatrix2x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22272621{
    2228     makeContextCurrent();
     2622    if (!makeContextCurrent())
     2623        return;
     2624
    22292625    gl::UniformMatrix2x3fv(location, srcLength, transpose, data + srcOffset);
    22302626}
     
    22322628void GraphicsContextGLOpenGL::uniformMatrix3x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22332629{
    2234     makeContextCurrent();
     2630    if (!makeContextCurrent())
     2631        return;
     2632
    22352633    gl::UniformMatrix3x2fv(location, srcLength, transpose, data + srcOffset);
    22362634}
     
    22382636void GraphicsContextGLOpenGL::uniformMatrix2x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22392637{
    2240     makeContextCurrent();
     2638    if (!makeContextCurrent())
     2639        return;
     2640
    22412641    gl::UniformMatrix2x4fv(location, srcLength, transpose, data + srcOffset);
    22422642}
     
    22442644void GraphicsContextGLOpenGL::uniformMatrix4x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22452645{
    2246     makeContextCurrent();
     2646    if (!makeContextCurrent())
     2647        return;
     2648
    22472649    gl::UniformMatrix4x2fv(location, srcLength, transpose, data + srcOffset);
    22482650}
     
    22502652void GraphicsContextGLOpenGL::uniformMatrix3x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22512653{
    2252     makeContextCurrent();
     2654    if (!makeContextCurrent())
     2655        return;
     2656
    22532657    gl::UniformMatrix3x4fv(location, srcLength, transpose, data + srcOffset);
    22542658}
     
    22562660void GraphicsContextGLOpenGL::uniformMatrix4x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    22572661{
    2258     makeContextCurrent();
     2662    if (!makeContextCurrent())
     2663        return;
     2664
    22592665    gl::UniformMatrix4x3fv(location, srcLength, transpose, data + srcOffset);
    22602666}
     
    22622668void GraphicsContextGLOpenGL::vertexAttribI4i(GCGLuint index, GCGLint x, GCGLint y, GCGLint z, GCGLint w)
    22632669{
    2264     makeContextCurrent();
     2670    if (!makeContextCurrent())
     2671        return;
     2672
    22652673    gl::VertexAttribI4i(index, x, y, z, w);
    22662674}
     
    22682676void GraphicsContextGLOpenGL::vertexAttribI4iv(GCGLuint index, const GCGLint* values)
    22692677{
    2270     makeContextCurrent();
     2678    if (!makeContextCurrent())
     2679        return;
     2680
    22712681    gl::VertexAttribI4iv(index, values);
    22722682}
     
    22742684void GraphicsContextGLOpenGL::vertexAttribI4ui(GCGLuint index, GCGLuint x, GCGLuint y, GCGLuint z, GCGLuint w)
    22752685{
    2276     makeContextCurrent();
     2686    if (!makeContextCurrent())
     2687        return;
     2688
    22772689    gl::VertexAttribI4ui(index, x, y, z, w);
    22782690}
     
    22802692void GraphicsContextGLOpenGL::vertexAttribI4uiv(GCGLuint index, const GCGLuint* values)
    22812693{
    2282     makeContextCurrent();
     2694    if (!makeContextCurrent())
     2695        return;
     2696
    22832697    gl::VertexAttribI4uiv(index, values);
    22842698}
     
    22862700void GraphicsContextGLOpenGL::drawRangeElements(GCGLenum mode, GCGLuint start, GCGLuint end, GCGLsizei count, GCGLenum type, GCGLintptr offset)
    22872701{
     2702    if (!makeContextCurrent())
     2703        return;
     2704
    22882705    gl::DrawRangeElements(mode, start, end, count, type, reinterpret_cast<void*>(offset));
    22892706}
     
    22912708void GraphicsContextGLOpenGL::drawBuffers(GCGLsizei n, const GCGLenum* bufs)
    22922709{
     2710    if (!makeContextCurrent())
     2711        return;
     2712
    22932713    gl::DrawBuffers(n, bufs);
    22942714}
     
    22962716void GraphicsContextGLOpenGL::clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLint* values, GCGLuint srcOffset)
    22972717{
     2718    if (!makeContextCurrent())
     2719        return;
     2720
    22982721    gl::ClearBufferiv(buffer, drawbuffer, values + srcOffset);
    22992722}
     
    23012724void GraphicsContextGLOpenGL::clearBufferuiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLuint* values, GCGLuint srcOffset)
    23022725{
     2726    if (!makeContextCurrent())
     2727        return;
     2728
    23032729    gl::ClearBufferuiv(buffer, drawbuffer, values + srcOffset);
    23042730}
     
    23062732void GraphicsContextGLOpenGL::clearBufferfv(GCGLenum buffer, GCGLint drawbuffer, const GCGLfloat* values, GCGLuint srcOffset)
    23072733{
     2734    if (!makeContextCurrent())
     2735        return;
     2736
    23082737    gl::ClearBufferfv(buffer, drawbuffer, values + srcOffset);
    23092738}
     
    23112740void GraphicsContextGLOpenGL::clearBufferfi(GCGLenum buffer, GCGLint drawbuffer, GCGLfloat depth, GCGLint stencil)
    23122741{
     2742    if (!makeContextCurrent())
     2743        return;
     2744
    23132745    gl::ClearBufferfi(buffer, drawbuffer, depth, stencil);
    23142746}
     
    23162748void GraphicsContextGLOpenGL::deleteQuery(PlatformGLObject query)
    23172749{
    2318     makeContextCurrent();
     2750    if (!makeContextCurrent())
     2751        return;
     2752
    23192753    gl::DeleteQueries(1, &query);
    23202754}
     
    23222756GCGLboolean GraphicsContextGLOpenGL::isQuery(PlatformGLObject query)
    23232757{
    2324     makeContextCurrent();
     2758    if (!makeContextCurrent())
     2759        return GL_FALSE;
     2760
    23252761    return gl::IsQuery(query);
    23262762}
     
    23282764PlatformGLObject GraphicsContextGLOpenGL::getQuery(GCGLenum target, GCGLenum pname)
    23292765{
    2330     makeContextCurrent();
     2766    if (!makeContextCurrent())
     2767        return 0;
     2768
    23312769    GLint value;
    23322770    gl::GetQueryiv(target, pname, &value);
     
    23362774PlatformGLObject GraphicsContextGLOpenGL::createSampler()
    23372775{
    2338     makeContextCurrent();
     2776    if (!makeContextCurrent())
     2777        return 0;
     2778
    23392779    GLuint name = 0;
    23402780    gl::GenSamplers(1, &name);
     
    23442784void GraphicsContextGLOpenGL::deleteSampler(PlatformGLObject sampler)
    23452785{
    2346     makeContextCurrent();
     2786    if (!makeContextCurrent())
     2787        return;
     2788
    23472789    gl::DeleteSamplers(1, &sampler);
    23482790}
     
    23502792GCGLboolean GraphicsContextGLOpenGL::isSampler(PlatformGLObject sampler)
    23512793{
    2352     makeContextCurrent();
     2794    if (!makeContextCurrent())
     2795        return GL_FALSE;
     2796
    23532797    return gl::IsSampler(sampler);
    23542798}
     
    23562800void GraphicsContextGLOpenGL::bindSampler(GCGLuint unit, PlatformGLObject sampler)
    23572801{
    2358     makeContextCurrent();
     2802    if (!makeContextCurrent())
     2803        return;
     2804
    23592805    gl::BindSampler(unit, sampler);
    23602806}
     
    23622808void GraphicsContextGLOpenGL::samplerParameteri(PlatformGLObject sampler, GCGLenum pname, GCGLint param)
    23632809{
    2364     makeContextCurrent();
     2810    if (!makeContextCurrent())
     2811        return;
     2812
    23652813    gl::SamplerParameteri(sampler, pname, param);
    23662814}
     
    23682816void GraphicsContextGLOpenGL::samplerParameterf(PlatformGLObject sampler, GCGLenum pname, GCGLfloat param)
    23692817{
    2370     makeContextCurrent();
     2818    if (!makeContextCurrent())
     2819        return;
     2820
    23712821    gl::SamplerParameterf(sampler, pname, param);
    23722822}
     
    23742824void GraphicsContextGLOpenGL::getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value)
    23752825{
    2376     makeContextCurrent();
     2826    if (!makeContextCurrent())
     2827        return;
     2828
    23772829    gl::GetSamplerParameterfv(sampler, pname, value);
    23782830}
     
    23802832void GraphicsContextGLOpenGL::getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value)
    23812833{
    2382     makeContextCurrent();
     2834    if (!makeContextCurrent())
     2835        return;
     2836
    23832837    gl::GetSamplerParameteriv(sampler, pname, value);
    23842838}
     
    23862840GCGLsync GraphicsContextGLOpenGL::fenceSync(GCGLenum condition, GCGLbitfield flags)
    23872841{
    2388     makeContextCurrent();
     2842    if (!makeContextCurrent())
     2843        return 0;
     2844
    23892845    return gl::FenceSync(condition, flags);
    23902846}
     
    23922848GCGLboolean GraphicsContextGLOpenGL::isSync(GCGLsync sync)
    23932849{
    2394     makeContextCurrent();
     2850    if (!makeContextCurrent())
     2851        return GL_FALSE;
     2852
    23952853    return gl::IsSync(sync);
    23962854}
     
    23982856void GraphicsContextGLOpenGL::deleteSync(GCGLsync sync)
    23992857{
    2400     makeContextCurrent();
     2858    if (!makeContextCurrent())
     2859        return;
     2860
    24012861    gl::DeleteSync(sync);
    24022862}
     
    24042864GCGLenum GraphicsContextGLOpenGL::clientWaitSync(GCGLsync sync, GCGLbitfield flags, GCGLuint64 timeout)
    24052865{
    2406     makeContextCurrent();
     2866    if (!makeContextCurrent())
     2867        return GL_WAIT_FAILED;
     2868
    24072869    return gl::ClientWaitSync(sync, flags, timeout);
    24082870}
     
    24102872void GraphicsContextGLOpenGL::waitSync(GCGLsync sync, GCGLbitfield flags, GCGLint64 timeout)
    24112873{
    2412     makeContextCurrent();
     2874    if (!makeContextCurrent())
     2875        return;
     2876
    24132877    gl::WaitSync(sync, flags, timeout);
    24142878}
     
    24162880void GraphicsContextGLOpenGL::getSynciv(GCGLsync sync, GCGLenum pname, GCGLsizei bufSize, GCGLint *value)
    24172881{
    2418     makeContextCurrent();
     2882    if (!makeContextCurrent())
     2883        return;
     2884
    24192885    gl::GetSynciv(sync, pname, bufSize, nullptr, value);
    24202886}
     
    24222888void GraphicsContextGLOpenGL::pauseTransformFeedback()
    24232889{
    2424     makeContextCurrent();
     2890    if (!makeContextCurrent())
     2891        return;
     2892
    24252893    gl::PauseTransformFeedback();
    24262894}
     
    24282896void GraphicsContextGLOpenGL::resumeTransformFeedback()
    24292897{
    2430     makeContextCurrent();
     2898    if (!makeContextCurrent())
     2899        return;
     2900
    24312901    gl::ResumeTransformFeedback();
    24322902}
     
    24342904void GraphicsContextGLOpenGL::bindBufferRange(GCGLenum target, GCGLuint index, PlatformGLObject buffer, GCGLintptr offset, GCGLsizeiptr size)
    24352905{
    2436     makeContextCurrent();
     2906    if (!makeContextCurrent())
     2907        return;
     2908
    24372909    gl::BindBufferRange(target, index, buffer, offset, size);
    24382910}
     
    24412913{
    24422914    ASSERT(program);
    2443     makeContextCurrent();
     2915    if (!makeContextCurrent())
     2916        return { };
     2917
    24442918    Vector<CString> utf8 = uniformNames.map([](auto& x) { return x.utf8(); });
    24452919    Vector<const char*> cstr = utf8.map([](auto& x) { return x.data(); });
     
    25032977void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25042978{
    2505     makeContextCurrent();
     2979    if (!makeContextCurrent())
     2980        return;
     2981
    25062982    gl::Uniform1fv(location, srcLength, data + srcOffset);
    25072983}
     
    25092985void GraphicsContextGLOpenGL::uniform2fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25102986{
    2511     makeContextCurrent();
     2987    if (!makeContextCurrent())
     2988        return;
     2989
    25122990    gl::Uniform2fv(location, srcLength, data + srcOffset);
    25132991}
     
    25152993void GraphicsContextGLOpenGL::uniform3fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25162994{
    2517     makeContextCurrent();
     2995    if (!makeContextCurrent())
     2996        return;
     2997
    25182998    gl::Uniform3fv(location, srcLength, data + srcOffset);
    25192999}
     
    25213001void GraphicsContextGLOpenGL::uniform4fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25223002{
    2523     makeContextCurrent();
     3003    if (!makeContextCurrent())
     3004        return;
     3005
    25243006    gl::Uniform4fv(location, srcLength, data + srcOffset);
    25253007}
     
    25273009void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
    25283010{
    2529     makeContextCurrent();
     3011    if (!makeContextCurrent())
     3012        return;
     3013
    25303014    gl::Uniform1iv(location, srcLength, data + srcOffset);
    25313015}
     
    25333017void GraphicsContextGLOpenGL::uniform2iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
    25343018{
    2535     makeContextCurrent();
     3019    if (!makeContextCurrent())
     3020        return;
     3021
    25363022    gl::Uniform2iv(location, srcLength, data + srcOffset);
    25373023}
     
    25393025void GraphicsContextGLOpenGL::uniform3iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
    25403026{
    2541     makeContextCurrent();
     3027    if (!makeContextCurrent())
     3028        return;
     3029
    25423030    gl::Uniform3iv(location, srcLength, data + srcOffset);
    25433031}
     
    25453033void GraphicsContextGLOpenGL::uniform4iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength)
    25463034{
    2547     makeContextCurrent();
     3035    if (!makeContextCurrent())
     3036        return;
     3037
    25483038    gl::Uniform4iv(location, srcLength, data + srcOffset);
    25493039}
     
    25513041void GraphicsContextGLOpenGL::uniformMatrix2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25523042{
    2553     makeContextCurrent();
     3043    if (!makeContextCurrent())
     3044        return;
     3045
    25543046    gl::UniformMatrix2fv(location, srcLength, transpose, data + srcOffset);
    25553047}
     
    25573049void GraphicsContextGLOpenGL::uniformMatrix3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25583050{
    2559     makeContextCurrent();
     3051    if (!makeContextCurrent())
     3052        return;
     3053
    25603054    gl::UniformMatrix3fv(location, srcLength, transpose, data + srcOffset);
    25613055}
     
    25633057void GraphicsContextGLOpenGL::uniformMatrix4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength)
    25643058{
    2565     makeContextCurrent();
     3059    if (!makeContextCurrent())
     3060        return;
     3061
    25663062    gl::UniformMatrix4fv(location, srcLength, transpose, data + srcOffset);
    25673063}
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm

    r269678 r269680  
    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

    r268198 r269680  
    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

    r254214 r269680  
    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

    r269678 r269680  
    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

    r268386 r269680  
    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

    r268578 r269680  
    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

    r268198 r269680  
    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

    r263076 r269680  
    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.