Changeset 269768 in webkit
- Timestamp:
- Nov 13, 2020 1:53:03 AM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269765 r269768 1 2020-11-13 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 Remove uses of MakeCurrent from WebGL implementation 4 https://bugs.webkit.org/show_bug.cgi?id=218178 5 <rdar://problem/70714561> 6 7 Reviewed by Dean Jackson. 8 9 Work towards WebGL implementation which uses 10 GraphicsContextGL abstract base class instead of 11 GraphicsContextGLOpenGL concrete class. 12 13 Move GraphicsContextGLOpenGL::makeContextCurrent() to 14 private section, as it is an implementation detail of 15 the class. The function is intended to be called at the 16 start of all public functions that might call into OpenGL 17 to ensure that OpenGL uses the right context. 18 19 Check all return values of makeCurrentContext(). We 20 should not call into OpenGL if the context is not current, 21 as that can lead to corruption, crashes or incorrect results. 22 Add a compile-time warning if the return value is not used. 23 Non-EWS compiled flavors of GraphicsContextGLOpenGL are changed 24 only in best effort manner. 25 26 Ensure that all functions actually call the makeCurrentContext() 27 function before calling into OpenGL. Non-ANGLE flavors of 28 GraphicsContextGLOpenGL are ensured only in best effort manner. 29 30 ANGLE flavor of GraphicsContextGLOpenGL function implementations 31 should call directly the ANGLE functions instead of calling them 32 through getExtensions() interface. There is no conditional code 33 inside and the implementation knows exactly which function to 34 call in all situations. There is no abstraction between 35 GraphicsContextGLOpenGL and ExtensionsGL, rather they are 36 in practice the same object currently, semi-artificially split to 37 two. This is true of other flavors of GraphicsContextGLOpenGL, 38 but those are left unchanged in this regard. 39 40 No new tests, a refactor. 41 42 * html/canvas/WebGLRenderingContextBase.cpp: 43 (WebCore::WebGLRenderingContextBase::create): 44 (WebCore::WebGLRenderingContextBase::initializeNewContext): 45 (WebCore::WebGLRenderingContextBase::validateElementArraySize): 46 (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise): 47 (WebCore::WebGLRenderingContextBase::validateDrawElements): 48 (WebCore::WebGLRenderingContextBase::readPixels): 49 (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl): 50 (WebCore::WebGLRenderingContextBase::initVertexAttrib0): 51 * platform/graphics/angle/ExtensionsGLANGLE.cpp: 52 (WebCore::ExtensionsGLANGLE::supports): 53 (WebCore::ExtensionsGLANGLE::ensureEnabled): 54 (WebCore::ExtensionsGLANGLE::getTranslatedShaderSourceANGLE): 55 (WebCore::ExtensionsGLANGLE::blitFramebuffer): 56 (WebCore::ExtensionsGLANGLE::renderbufferStorageMultisample): 57 (WebCore::ExtensionsGLANGLE::createVertexArrayOES): 58 (WebCore::ExtensionsGLANGLE::deleteVertexArrayOES): 59 (WebCore::ExtensionsGLANGLE::isVertexArrayOES): 60 (WebCore::ExtensionsGLANGLE::bindVertexArrayOES): 61 (WebCore::ExtensionsGLANGLE::drawBuffersEXT): 62 (WebCore::ExtensionsGLANGLE::drawArraysInstanced): 63 (WebCore::ExtensionsGLANGLE::drawElementsInstanced): 64 (WebCore::ExtensionsGLANGLE::vertexAttribDivisor): 65 (WebCore::ExtensionsGLANGLE::getBooleanvRobustANGLE): 66 (WebCore::ExtensionsGLANGLE::getBufferParameterivRobustANGLE): 67 (WebCore::ExtensionsGLANGLE::getFloatvRobustANGLE): 68 (WebCore::ExtensionsGLANGLE::getFramebufferAttachmentParameterivRobustANGLE): 69 (WebCore::ExtensionsGLANGLE::getIntegervRobustANGLE): 70 (WebCore::ExtensionsGLANGLE::getProgramivRobustANGLE): 71 (WebCore::ExtensionsGLANGLE::getRenderbufferParameterivRobustANGLE): 72 (WebCore::ExtensionsGLANGLE::getShaderivRobustANGLE): 73 (WebCore::ExtensionsGLANGLE::getTexParameterfvRobustANGLE): 74 (WebCore::ExtensionsGLANGLE::getTexParameterivRobustANGLE): 75 (WebCore::ExtensionsGLANGLE::getUniformfvRobustANGLE): 76 (WebCore::ExtensionsGLANGLE::getUniformivRobustANGLE): 77 (WebCore::ExtensionsGLANGLE::getVertexAttribfvRobustANGLE): 78 (WebCore::ExtensionsGLANGLE::getVertexAttribivRobustANGLE): 79 (WebCore::ExtensionsGLANGLE::getVertexAttribPointervRobustANGLE): 80 (WebCore::ExtensionsGLANGLE::readPixelsRobustANGLE): 81 (WebCore::ExtensionsGLANGLE::texImage2DRobustANGLE): 82 (WebCore::ExtensionsGLANGLE::texParameterfvRobustANGLE): 83 (WebCore::ExtensionsGLANGLE::texParameterivRobustANGLE): 84 (WebCore::ExtensionsGLANGLE::texSubImage2DRobustANGLE): 85 (WebCore::ExtensionsGLANGLE::compressedTexImage2DRobustANGLE): 86 (WebCore::ExtensionsGLANGLE::compressedTexSubImage2DRobustANGLE): 87 (WebCore::ExtensionsGLANGLE::compressedTexImage3DRobustANGLE): 88 (WebCore::ExtensionsGLANGLE::compressedTexSubImage3DRobustANGLE): 89 (WebCore::ExtensionsGLANGLE::texImage3DRobustANGLE): 90 (WebCore::ExtensionsGLANGLE::texSubImage3DRobustANGLE): 91 (WebCore::ExtensionsGLANGLE::getQueryivRobustANGLE): 92 (WebCore::ExtensionsGLANGLE::getQueryObjectuivRobustANGLE): 93 (WebCore::ExtensionsGLANGLE::getBufferPointervRobustANGLE): 94 (WebCore::ExtensionsGLANGLE::getIntegeri_vRobustANGLE): 95 (WebCore::ExtensionsGLANGLE::getInternalformativRobustANGLE): 96 (WebCore::ExtensionsGLANGLE::getVertexAttribIivRobustANGLE): 97 (WebCore::ExtensionsGLANGLE::getVertexAttribIuivRobustANGLE): 98 (WebCore::ExtensionsGLANGLE::getUniformuivRobustANGLE): 99 (WebCore::ExtensionsGLANGLE::getActiveUniformBlockivRobustANGLE): 100 (WebCore::ExtensionsGLANGLE::getInteger64vRobustANGLE): 101 (WebCore::ExtensionsGLANGLE::getInteger64i_vRobustANGLE): 102 (WebCore::ExtensionsGLANGLE::getBufferParameteri64vRobustANGLE): 103 (WebCore::ExtensionsGLANGLE::samplerParameterivRobustANGLE): 104 (WebCore::ExtensionsGLANGLE::samplerParameterfvRobustANGLE): 105 (WebCore::ExtensionsGLANGLE::getSamplerParameterivRobustANGLE): 106 (WebCore::ExtensionsGLANGLE::getSamplerParameterfvRobustANGLE): 107 (WebCore::ExtensionsGLANGLE::getFramebufferParameterivRobustANGLE): 108 (WebCore::ExtensionsGLANGLE::getProgramInterfaceivRobustANGLE): 109 (WebCore::ExtensionsGLANGLE::getBooleani_vRobustANGLE): 110 (WebCore::ExtensionsGLANGLE::getMultisamplefvRobustANGLE): 111 (WebCore::ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE): 112 (WebCore::ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE): 113 (WebCore::ExtensionsGLANGLE::getPointervRobustANGLERobustANGLE): 114 (WebCore::ExtensionsGLANGLE::readnPixelsRobustANGLE): 115 (WebCore::ExtensionsGLANGLE::getnUniformfvRobustANGLE): 116 (WebCore::ExtensionsGLANGLE::getnUniformivRobustANGLE): 117 (WebCore::ExtensionsGLANGLE::getnUniformuivRobustANGLE): 118 (WebCore::ExtensionsGLANGLE::texParameterIivRobustANGLE): 119 (WebCore::ExtensionsGLANGLE::texParameterIuivRobustANGLE): 120 (WebCore::ExtensionsGLANGLE::getTexParameterIivRobustANGLE): 121 (WebCore::ExtensionsGLANGLE::getTexParameterIuivRobustANGLE): 122 (WebCore::ExtensionsGLANGLE::samplerParameterIivRobustANGLE): 123 (WebCore::ExtensionsGLANGLE::samplerParameterIuivRobustANGLE): 124 (WebCore::ExtensionsGLANGLE::getSamplerParameterIivRobustANGLE): 125 (WebCore::ExtensionsGLANGLE::getSamplerParameterIuivRobustANGLE): 126 (WebCore::ExtensionsGLANGLE::getQueryObjectivRobustANGLE): 127 (WebCore::ExtensionsGLANGLE::getQueryObjecti64vRobustANGLE): 128 (WebCore::ExtensionsGLANGLE::getQueryObjectui64vRobustANGLE): 129 * platform/graphics/angle/GraphicsContextGLANGLE.cpp: 130 (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): 131 (WebCore::GraphicsContextGLOpenGL::renderbufferStorage): 132 (WebCore::GraphicsContextGLOpenGL::getIntegerv): 133 (WebCore::GraphicsContextGLOpenGL::getIntegeri_v): 134 (WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat): 135 (WebCore::GraphicsContextGLOpenGL::depthRange): 136 (WebCore::GraphicsContextGLOpenGL::clearDepth): 137 (WebCore::GraphicsContextGLOpenGL::readPixels): 138 (WebCore::GraphicsContextGLOpenGL::prepareTexture): 139 (WebCore::GraphicsContextGLOpenGL::readRenderingResults): 140 (WebCore::GraphicsContextGLOpenGL::reshape): 141 (WebCore::GraphicsContextGLOpenGL::activeTexture): 142 (WebCore::GraphicsContextGLOpenGL::attachShader): 143 (WebCore::GraphicsContextGLOpenGL::bindAttribLocation): 144 (WebCore::GraphicsContextGLOpenGL::bindBuffer): 145 (WebCore::GraphicsContextGLOpenGL::bindFramebuffer): 146 (WebCore::GraphicsContextGLOpenGL::bindRenderbuffer): 147 (WebCore::GraphicsContextGLOpenGL::bindTexture): 148 (WebCore::GraphicsContextGLOpenGL::blendColor): 149 (WebCore::GraphicsContextGLOpenGL::blendEquation): 150 (WebCore::GraphicsContextGLOpenGL::blendEquationSeparate): 151 (WebCore::GraphicsContextGLOpenGL::blendFunc): 152 (WebCore::GraphicsContextGLOpenGL::blendFuncSeparate): 153 (WebCore::GraphicsContextGLOpenGL::bufferData): 154 (WebCore::GraphicsContextGLOpenGL::bufferSubData): 155 (WebCore::GraphicsContextGLOpenGL::mapBufferRange): 156 (WebCore::GraphicsContextGLOpenGL::unmapBuffer): 157 (WebCore::GraphicsContextGLOpenGL::copyBufferSubData): 158 (WebCore::GraphicsContextGLOpenGL::getInternalformativ): 159 (WebCore::GraphicsContextGLOpenGL::renderbufferStorageMultisample): 160 (WebCore::GraphicsContextGLOpenGL::texStorage2D): 161 (WebCore::GraphicsContextGLOpenGL::texStorage3D): 162 (WebCore::GraphicsContextGLOpenGL::getActiveUniforms): 163 (WebCore::GraphicsContextGLOpenGL::checkFramebufferStatus): 164 (WebCore::GraphicsContextGLOpenGL::clearColor): 165 (WebCore::GraphicsContextGLOpenGL::clear): 166 (WebCore::GraphicsContextGLOpenGL::clearStencil): 167 (WebCore::GraphicsContextGLOpenGL::colorMask): 168 (WebCore::GraphicsContextGLOpenGL::compileShader): 169 (WebCore::GraphicsContextGLOpenGL::compileShaderDirect): 170 (WebCore::GraphicsContextGLOpenGL::copyTexImage2D): 171 (WebCore::GraphicsContextGLOpenGL::copyTexSubImage2D): 172 (WebCore::GraphicsContextGLOpenGL::cullFace): 173 (WebCore::GraphicsContextGLOpenGL::depthFunc): 174 (WebCore::GraphicsContextGLOpenGL::depthMask): 175 (WebCore::GraphicsContextGLOpenGL::detachShader): 176 (WebCore::GraphicsContextGLOpenGL::disable): 177 (WebCore::GraphicsContextGLOpenGL::disableVertexAttribArray): 178 (WebCore::GraphicsContextGLOpenGL::drawArrays): 179 (WebCore::GraphicsContextGLOpenGL::drawElements): 180 (WebCore::GraphicsContextGLOpenGL::enable): 181 (WebCore::GraphicsContextGLOpenGL::enableVertexAttribArray): 182 (WebCore::GraphicsContextGLOpenGL::finish): 183 (WebCore::GraphicsContextGLOpenGL::flush): 184 (WebCore::GraphicsContextGLOpenGL::framebufferRenderbuffer): 185 (WebCore::GraphicsContextGLOpenGL::framebufferTexture2D): 186 (WebCore::GraphicsContextGLOpenGL::frontFace): 187 (WebCore::GraphicsContextGLOpenGL::generateMipmap): 188 (WebCore::GraphicsContextGLOpenGL::getActiveAttribImpl): 189 (WebCore::GraphicsContextGLOpenGL::getActiveUniformImpl): 190 (WebCore::GraphicsContextGLOpenGL::getAttachedShaders): 191 (WebCore::GraphicsContextGLOpenGL::getAttribLocation): 192 (WebCore::GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList): 193 (WebCore::GraphicsContextGLOpenGL::getError): 194 (WebCore::GraphicsContextGLOpenGL::getString): 195 (WebCore::GraphicsContextGLOpenGL::hint): 196 (WebCore::GraphicsContextGLOpenGL::isBuffer): 197 (WebCore::GraphicsContextGLOpenGL::isEnabled): 198 (WebCore::GraphicsContextGLOpenGL::isFramebuffer): 199 (WebCore::GraphicsContextGLOpenGL::isProgram): 200 (WebCore::GraphicsContextGLOpenGL::isRenderbuffer): 201 (WebCore::GraphicsContextGLOpenGL::isShader): 202 (WebCore::GraphicsContextGLOpenGL::isTexture): 203 (WebCore::GraphicsContextGLOpenGL::lineWidth): 204 (WebCore::GraphicsContextGLOpenGL::linkProgram): 205 (WebCore::GraphicsContextGLOpenGL::pixelStorei): 206 (WebCore::GraphicsContextGLOpenGL::polygonOffset): 207 (WebCore::GraphicsContextGLOpenGL::sampleCoverage): 208 (WebCore::GraphicsContextGLOpenGL::scissor): 209 (WebCore::GraphicsContextGLOpenGL::shaderSource): 210 (WebCore::GraphicsContextGLOpenGL::stencilFunc): 211 (WebCore::GraphicsContextGLOpenGL::stencilFuncSeparate): 212 (WebCore::GraphicsContextGLOpenGL::stencilMask): 213 (WebCore::GraphicsContextGLOpenGL::stencilMaskSeparate): 214 (WebCore::GraphicsContextGLOpenGL::stencilOp): 215 (WebCore::GraphicsContextGLOpenGL::stencilOpSeparate): 216 (WebCore::GraphicsContextGLOpenGL::texParameterf): 217 (WebCore::GraphicsContextGLOpenGL::texParameteri): 218 (WebCore::GraphicsContextGLOpenGL::uniform1f): 219 (WebCore::GraphicsContextGLOpenGL::uniform1fv): 220 (WebCore::GraphicsContextGLOpenGL::uniform2f): 221 (WebCore::GraphicsContextGLOpenGL::uniform2fv): 222 (WebCore::GraphicsContextGLOpenGL::uniform3f): 223 (WebCore::GraphicsContextGLOpenGL::uniform3fv): 224 (WebCore::GraphicsContextGLOpenGL::uniform4f): 225 (WebCore::GraphicsContextGLOpenGL::uniform4fv): 226 (WebCore::GraphicsContextGLOpenGL::uniform1i): 227 (WebCore::GraphicsContextGLOpenGL::uniform1iv): 228 (WebCore::GraphicsContextGLOpenGL::uniform2i): 229 (WebCore::GraphicsContextGLOpenGL::uniform2iv): 230 (WebCore::GraphicsContextGLOpenGL::uniform3i): 231 (WebCore::GraphicsContextGLOpenGL::uniform3iv): 232 (WebCore::GraphicsContextGLOpenGL::uniform4i): 233 (WebCore::GraphicsContextGLOpenGL::uniform4iv): 234 (WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv): 235 (WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv): 236 (WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv): 237 (WebCore::GraphicsContextGLOpenGL::useProgram): 238 (WebCore::GraphicsContextGLOpenGL::validateProgram): 239 (WebCore::GraphicsContextGLOpenGL::vertexAttrib1f): 240 (WebCore::GraphicsContextGLOpenGL::vertexAttrib1fv): 241 (WebCore::GraphicsContextGLOpenGL::vertexAttrib2f): 242 (WebCore::GraphicsContextGLOpenGL::vertexAttrib2fv): 243 (WebCore::GraphicsContextGLOpenGL::vertexAttrib3f): 244 (WebCore::GraphicsContextGLOpenGL::vertexAttrib3fv): 245 (WebCore::GraphicsContextGLOpenGL::vertexAttrib4f): 246 (WebCore::GraphicsContextGLOpenGL::vertexAttrib4fv): 247 (WebCore::GraphicsContextGLOpenGL::vertexAttribPointer): 248 (WebCore::GraphicsContextGLOpenGL::vertexAttribIPointer): 249 (WebCore::GraphicsContextGLOpenGL::viewport): 250 (WebCore::GraphicsContextGLOpenGL::createVertexArray): 251 (WebCore::GraphicsContextGLOpenGL::deleteVertexArray): 252 (WebCore::GraphicsContextGLOpenGL::isVertexArray): 253 (WebCore::GraphicsContextGLOpenGL::bindVertexArray): 254 (WebCore::GraphicsContextGLOpenGL::getBooleanv): 255 (WebCore::GraphicsContextGLOpenGL::getBufferParameteriv): 256 (WebCore::GraphicsContextGLOpenGL::getFloatv): 257 (WebCore::GraphicsContextGLOpenGL::getInteger64v): 258 (WebCore::GraphicsContextGLOpenGL::getInteger64i_v): 259 (WebCore::GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv): 260 (WebCore::GraphicsContextGLOpenGL::getProgramiv): 261 (WebCore::GraphicsContextGLOpenGL::getProgramInfoLog): 262 (WebCore::GraphicsContextGLOpenGL::getRenderbufferParameteriv): 263 (WebCore::GraphicsContextGLOpenGL::getShaderiv): 264 (WebCore::GraphicsContextGLOpenGL::getShaderInfoLog): 265 (WebCore::GraphicsContextGLOpenGL::getTexParameterfv): 266 (WebCore::GraphicsContextGLOpenGL::getTexParameteriv): 267 (WebCore::GraphicsContextGLOpenGL::getUniformfv): 268 (WebCore::GraphicsContextGLOpenGL::getUniformiv): 269 (WebCore::GraphicsContextGLOpenGL::getUniformuiv): 270 (WebCore::GraphicsContextGLOpenGL::getUniformLocation): 271 (WebCore::GraphicsContextGLOpenGL::getVertexAttribfv): 272 (WebCore::GraphicsContextGLOpenGL::getVertexAttribiv): 273 (WebCore::GraphicsContextGLOpenGL::getVertexAttribOffset): 274 (WebCore::GraphicsContextGLOpenGL::texSubImage2D): 275 (WebCore::GraphicsContextGLOpenGL::compressedTexImage2D): 276 (WebCore::GraphicsContextGLOpenGL::compressedTexSubImage2D): 277 (WebCore::GraphicsContextGLOpenGL::createBuffer): 278 (WebCore::GraphicsContextGLOpenGL::createFramebuffer): 279 (WebCore::GraphicsContextGLOpenGL::createProgram): 280 (WebCore::GraphicsContextGLOpenGL::createRenderbuffer): 281 (WebCore::GraphicsContextGLOpenGL::createShader): 282 (WebCore::GraphicsContextGLOpenGL::createTexture): 283 (WebCore::GraphicsContextGLOpenGL::deleteBuffer): 284 (WebCore::GraphicsContextGLOpenGL::deleteFramebuffer): 285 (WebCore::GraphicsContextGLOpenGL::deleteProgram): 286 (WebCore::GraphicsContextGLOpenGL::deleteRenderbuffer): 287 (WebCore::GraphicsContextGLOpenGL::deleteShader): 288 (WebCore::GraphicsContextGLOpenGL::deleteTexture): 289 (WebCore::GraphicsContextGLOpenGL::texImage2DDirect): 290 (WebCore::GraphicsContextGLOpenGL::drawArraysInstanced): 291 (WebCore::GraphicsContextGLOpenGL::drawElementsInstanced): 292 (WebCore::GraphicsContextGLOpenGL::vertexAttribDivisor): 293 (WebCore::GraphicsContextGLOpenGL::getUniformBlockIndex): 294 (WebCore::GraphicsContextGLOpenGL::getActiveUniformBlockName): 295 (WebCore::GraphicsContextGLOpenGL::uniformBlockBinding): 296 (WebCore::GraphicsContextGLOpenGL::createQuery): 297 (WebCore::GraphicsContextGLOpenGL::beginQuery): 298 (WebCore::GraphicsContextGLOpenGL::endQuery): 299 (WebCore::GraphicsContextGLOpenGL::getQueryObjectuiv): 300 (WebCore::GraphicsContextGLOpenGL::createTransformFeedback): 301 (WebCore::GraphicsContextGLOpenGL::deleteTransformFeedback): 302 (WebCore::GraphicsContextGLOpenGL::isTransformFeedback): 303 (WebCore::GraphicsContextGLOpenGL::bindTransformFeedback): 304 (WebCore::GraphicsContextGLOpenGL::beginTransformFeedback): 305 (WebCore::GraphicsContextGLOpenGL::endTransformFeedback): 306 (WebCore::GraphicsContextGLOpenGL::transformFeedbackVaryings): 307 (WebCore::GraphicsContextGLOpenGL::getTransformFeedbackVarying): 308 (WebCore::GraphicsContextGLOpenGL::bindBufferBase): 309 (WebCore::GraphicsContextGLOpenGL::blitFramebuffer): 310 (WebCore::GraphicsContextGLOpenGL::framebufferTextureLayer): 311 (WebCore::GraphicsContextGLOpenGL::invalidateFramebuffer): 312 (WebCore::GraphicsContextGLOpenGL::invalidateSubFramebuffer): 313 (WebCore::GraphicsContextGLOpenGL::readBuffer): 314 (WebCore::GraphicsContextGLOpenGL::copyTexSubImage3D): 315 (WebCore::GraphicsContextGLOpenGL::getFragDataLocation): 316 (WebCore::GraphicsContextGLOpenGL::uniform1ui): 317 (WebCore::GraphicsContextGLOpenGL::uniform2ui): 318 (WebCore::GraphicsContextGLOpenGL::uniform3ui): 319 (WebCore::GraphicsContextGLOpenGL::uniform4ui): 320 (WebCore::GraphicsContextGLOpenGL::uniform1uiv): 321 (WebCore::GraphicsContextGLOpenGL::uniform2uiv): 322 (WebCore::GraphicsContextGLOpenGL::uniform3uiv): 323 (WebCore::GraphicsContextGLOpenGL::uniform4uiv): 324 (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x3fv): 325 (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x2fv): 326 (WebCore::GraphicsContextGLOpenGL::uniformMatrix2x4fv): 327 (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x2fv): 328 (WebCore::GraphicsContextGLOpenGL::uniformMatrix3x4fv): 329 (WebCore::GraphicsContextGLOpenGL::uniformMatrix4x3fv): 330 (WebCore::GraphicsContextGLOpenGL::vertexAttribI4i): 331 (WebCore::GraphicsContextGLOpenGL::vertexAttribI4iv): 332 (WebCore::GraphicsContextGLOpenGL::vertexAttribI4ui): 333 (WebCore::GraphicsContextGLOpenGL::vertexAttribI4uiv): 334 (WebCore::GraphicsContextGLOpenGL::drawRangeElements): 335 (WebCore::GraphicsContextGLOpenGL::drawBuffers): 336 (WebCore::GraphicsContextGLOpenGL::clearBufferiv): 337 (WebCore::GraphicsContextGLOpenGL::clearBufferuiv): 338 (WebCore::GraphicsContextGLOpenGL::clearBufferfv): 339 (WebCore::GraphicsContextGLOpenGL::clearBufferfi): 340 (WebCore::GraphicsContextGLOpenGL::deleteQuery): 341 (WebCore::GraphicsContextGLOpenGL::isQuery): 342 (WebCore::GraphicsContextGLOpenGL::getQuery): 343 (WebCore::GraphicsContextGLOpenGL::createSampler): 344 (WebCore::GraphicsContextGLOpenGL::deleteSampler): 345 (WebCore::GraphicsContextGLOpenGL::isSampler): 346 (WebCore::GraphicsContextGLOpenGL::bindSampler): 347 (WebCore::GraphicsContextGLOpenGL::samplerParameteri): 348 (WebCore::GraphicsContextGLOpenGL::samplerParameterf): 349 (WebCore::GraphicsContextGLOpenGL::getSamplerParameterfv): 350 (WebCore::GraphicsContextGLOpenGL::getSamplerParameteriv): 351 (WebCore::GraphicsContextGLOpenGL::fenceSync): 352 (WebCore::GraphicsContextGLOpenGL::isSync): 353 (WebCore::GraphicsContextGLOpenGL::deleteSync): 354 (WebCore::GraphicsContextGLOpenGL::clientWaitSync): 355 (WebCore::GraphicsContextGLOpenGL::waitSync): 356 (WebCore::GraphicsContextGLOpenGL::getSynciv): 357 (WebCore::GraphicsContextGLOpenGL::pauseTransformFeedback): 358 (WebCore::GraphicsContextGLOpenGL::resumeTransformFeedback): 359 (WebCore::GraphicsContextGLOpenGL::bindBufferRange): 360 (WebCore::GraphicsContextGLOpenGL::getUniformIndices): 361 * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: 362 (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): 363 (WebCore::GraphicsContextGLOpenGL::updateCGLContext): 364 * platform/graphics/opengl/ExtensionsGLOpenGL.cpp: 365 (WebCore::ExtensionsGLOpenGL::blitFramebuffer): 366 (WebCore::ExtensionsGLOpenGL::renderbufferStorageMultisample): 367 (WebCore::ExtensionsGLOpenGL::createVertexArrayOES): 368 (WebCore::ExtensionsGLOpenGL::deleteVertexArrayOES): 369 (WebCore::ExtensionsGLOpenGL::isVertexArrayOES): 370 (WebCore::ExtensionsGLOpenGL::bindVertexArrayOES): 371 (WebCore::ExtensionsGLOpenGL::supportsExtension): 372 (WebCore::ExtensionsGLOpenGL::drawBuffersEXT): 373 (WebCore::ExtensionsGLOpenGL::drawArraysInstanced): 374 (WebCore::ExtensionsGLOpenGL::drawElementsInstanced): 375 (WebCore::ExtensionsGLOpenGL::vertexAttribDivisor): 376 * platform/graphics/opengl/ExtensionsGLOpenGLES.cpp: 377 (WebCore::ExtensionsGLOpenGLES::framebufferTexture2DMultisampleIMG): 378 (WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisampleIMG): 379 (WebCore::ExtensionsGLOpenGLES::renderbufferStorageMultisample): 380 (WebCore::ExtensionsGLOpenGLES::createVertexArrayOES): 381 (WebCore::ExtensionsGLOpenGLES::deleteVertexArrayOES): 382 (WebCore::ExtensionsGLOpenGLES::isVertexArrayOES): 383 (WebCore::ExtensionsGLOpenGLES::bindVertexArrayOES): 384 (WebCore::ExtensionsGLOpenGLES::getGraphicsResetStatusARB): 385 (WebCore::ExtensionsGLOpenGLES::readnPixelsEXT): 386 (WebCore::ExtensionsGLOpenGLES::getnUniformfvEXT): 387 (WebCore::ExtensionsGLOpenGLES::getnUniformivEXT): 388 (WebCore::ExtensionsGLOpenGLES::drawArraysInstanced): 389 (WebCore::ExtensionsGLOpenGLES::drawElementsInstanced): 390 (WebCore::ExtensionsGLOpenGLES::vertexAttribDivisor): 391 * platform/graphics/opengl/GraphicsContextGLOpenGL.h: 392 * platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp: 393 (WebCore::GraphicsContextGLOpenGL::renderbufferStorage): 394 (WebCore::GraphicsContextGLOpenGL::getIntegerv): 395 (WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat): 396 (WebCore::GraphicsContextGLOpenGL::depthRange): 397 (WebCore::GraphicsContextGLOpenGL::clearDepth): 398 (WebCore::GraphicsContextGLOpenGL::readPixels): 399 * platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp: 400 (WebCore::GraphicsContextGLOpenGL::prepareTexture): 401 (WebCore::GraphicsContextGLOpenGL::readRenderingResults): 402 (WebCore::GraphicsContextGLOpenGL::reshape): 403 (WebCore::GraphicsContextGLOpenGL::activeTexture): 404 (WebCore::GraphicsContextGLOpenGL::attachShader): 405 (WebCore::GraphicsContextGLOpenGL::bindAttribLocation): 406 (WebCore::GraphicsContextGLOpenGL::bindBuffer): 407 (WebCore::GraphicsContextGLOpenGL::bindFramebuffer): 408 (WebCore::GraphicsContextGLOpenGL::bindRenderbuffer): 409 (WebCore::GraphicsContextGLOpenGL::bindTexture): 410 (WebCore::GraphicsContextGLOpenGL::blendColor): 411 (WebCore::GraphicsContextGLOpenGL::blendEquation): 412 (WebCore::GraphicsContextGLOpenGL::blendEquationSeparate): 413 (WebCore::GraphicsContextGLOpenGL::blendFunc): 414 (WebCore::GraphicsContextGLOpenGL::blendFuncSeparate): 415 (WebCore::GraphicsContextGLOpenGL::bufferData): 416 (WebCore::GraphicsContextGLOpenGL::bufferSubData): 417 (WebCore::GraphicsContextGLOpenGL::checkFramebufferStatus): 418 (WebCore::GraphicsContextGLOpenGL::clearColor): 419 (WebCore::GraphicsContextGLOpenGL::clear): 420 (WebCore::GraphicsContextGLOpenGL::clearStencil): 421 (WebCore::GraphicsContextGLOpenGL::colorMask): 422 (WebCore::GraphicsContextGLOpenGL::compileShader): 423 (WebCore::GraphicsContextGLOpenGL::compileShaderDirect): 424 (WebCore::GraphicsContextGLOpenGL::copyTexImage2D): 425 (WebCore::GraphicsContextGLOpenGL::copyTexSubImage2D): 426 (WebCore::GraphicsContextGLOpenGL::cullFace): 427 (WebCore::GraphicsContextGLOpenGL::depthFunc): 428 (WebCore::GraphicsContextGLOpenGL::depthMask): 429 (WebCore::GraphicsContextGLOpenGL::detachShader): 430 (WebCore::GraphicsContextGLOpenGL::disable): 431 (WebCore::GraphicsContextGLOpenGL::disableVertexAttribArray): 432 (WebCore::GraphicsContextGLOpenGL::drawArrays): 433 (WebCore::GraphicsContextGLOpenGL::drawElements): 434 (WebCore::GraphicsContextGLOpenGL::enable): 435 (WebCore::GraphicsContextGLOpenGL::enableVertexAttribArray): 436 (WebCore::GraphicsContextGLOpenGL::finish): 437 (WebCore::GraphicsContextGLOpenGL::flush): 438 (WebCore::GraphicsContextGLOpenGL::framebufferRenderbuffer): 439 (WebCore::GraphicsContextGLOpenGL::framebufferTexture2D): 440 (WebCore::GraphicsContextGLOpenGL::frontFace): 441 (WebCore::GraphicsContextGLOpenGL::generateMipmap): 442 (WebCore::GraphicsContextGLOpenGL::getActiveAttribImpl): 443 (WebCore::GraphicsContextGLOpenGL::getActiveUniformImpl): 444 (WebCore::GraphicsContextGLOpenGL::getAttachedShaders): 445 (WebCore::GraphicsContextGLOpenGL::getAttribLocation): 446 (WebCore::GraphicsContextGLOpenGL::getAttribLocationDirect): 447 (WebCore::GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList): 448 (WebCore::GraphicsContextGLOpenGL::getError): 449 (WebCore::GraphicsContextGLOpenGL::getString): 450 (WebCore::GraphicsContextGLOpenGL::hint): 451 (WebCore::GraphicsContextGLOpenGL::isBuffer): 452 (WebCore::GraphicsContextGLOpenGL::isEnabled): 453 (WebCore::GraphicsContextGLOpenGL::isFramebuffer): 454 (WebCore::GraphicsContextGLOpenGL::isProgram): 455 (WebCore::GraphicsContextGLOpenGL::isRenderbuffer): 456 (WebCore::GraphicsContextGLOpenGL::isShader): 457 (WebCore::GraphicsContextGLOpenGL::isTexture): 458 (WebCore::GraphicsContextGLOpenGL::lineWidth): 459 (WebCore::GraphicsContextGLOpenGL::linkProgram): 460 (WebCore::GraphicsContextGLOpenGL::pixelStorei): 461 (WebCore::GraphicsContextGLOpenGL::polygonOffset): 462 (WebCore::GraphicsContextGLOpenGL::sampleCoverage): 463 (WebCore::GraphicsContextGLOpenGL::scissor): 464 (WebCore::GraphicsContextGLOpenGL::shaderSource): 465 (WebCore::GraphicsContextGLOpenGL::stencilFunc): 466 (WebCore::GraphicsContextGLOpenGL::stencilFuncSeparate): 467 (WebCore::GraphicsContextGLOpenGL::stencilMask): 468 (WebCore::GraphicsContextGLOpenGL::stencilMaskSeparate): 469 (WebCore::GraphicsContextGLOpenGL::stencilOp): 470 (WebCore::GraphicsContextGLOpenGL::stencilOpSeparate): 471 (WebCore::GraphicsContextGLOpenGL::texParameterf): 472 (WebCore::GraphicsContextGLOpenGL::texParameteri): 473 (WebCore::GraphicsContextGLOpenGL::uniform1f): 474 (WebCore::GraphicsContextGLOpenGL::uniform1fv): 475 (WebCore::GraphicsContextGLOpenGL::uniform2f): 476 (WebCore::GraphicsContextGLOpenGL::uniform2fv): 477 (WebCore::GraphicsContextGLOpenGL::uniform3f): 478 (WebCore::GraphicsContextGLOpenGL::uniform3fv): 479 (WebCore::GraphicsContextGLOpenGL::uniform4f): 480 (WebCore::GraphicsContextGLOpenGL::uniform4fv): 481 (WebCore::GraphicsContextGLOpenGL::uniform1i): 482 (WebCore::GraphicsContextGLOpenGL::uniform1iv): 483 (WebCore::GraphicsContextGLOpenGL::uniform2i): 484 (WebCore::GraphicsContextGLOpenGL::uniform2iv): 485 (WebCore::GraphicsContextGLOpenGL::uniform3i): 486 (WebCore::GraphicsContextGLOpenGL::uniform3iv): 487 (WebCore::GraphicsContextGLOpenGL::uniform4i): 488 (WebCore::GraphicsContextGLOpenGL::uniform4iv): 489 (WebCore::GraphicsContextGLOpenGL::uniformMatrix2fv): 490 (WebCore::GraphicsContextGLOpenGL::uniformMatrix3fv): 491 (WebCore::GraphicsContextGLOpenGL::uniformMatrix4fv): 492 (WebCore::GraphicsContextGLOpenGL::useProgram): 493 (WebCore::GraphicsContextGLOpenGL::validateProgram): 494 (WebCore::GraphicsContextGLOpenGL::vertexAttrib1f): 495 (WebCore::GraphicsContextGLOpenGL::vertexAttrib1fv): 496 (WebCore::GraphicsContextGLOpenGL::vertexAttrib2f): 497 (WebCore::GraphicsContextGLOpenGL::vertexAttrib2fv): 498 (WebCore::GraphicsContextGLOpenGL::vertexAttrib3f): 499 (WebCore::GraphicsContextGLOpenGL::vertexAttrib3fv): 500 (WebCore::GraphicsContextGLOpenGL::vertexAttrib4f): 501 (WebCore::GraphicsContextGLOpenGL::vertexAttrib4fv): 502 (WebCore::GraphicsContextGLOpenGL::vertexAttribPointer): 503 (WebCore::GraphicsContextGLOpenGL::viewport): 504 (WebCore::GraphicsContextGLOpenGL::createVertexArray): 505 (WebCore::GraphicsContextGLOpenGL::deleteVertexArray): 506 (WebCore::GraphicsContextGLOpenGL::isVertexArray): 507 (WebCore::GraphicsContextGLOpenGL::bindVertexArray): 508 (WebCore::GraphicsContextGLOpenGL::getBooleanv): 509 (WebCore::GraphicsContextGLOpenGL::getBufferParameteriv): 510 (WebCore::GraphicsContextGLOpenGL::getFloatv): 511 (WebCore::GraphicsContextGLOpenGL::getIntegeri_v): 512 (WebCore::GraphicsContextGLOpenGL::getInteger64v): 513 (WebCore::GraphicsContextGLOpenGL::getInteger64i_v): 514 (WebCore::GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv): 515 (WebCore::GraphicsContextGLOpenGL::getProgramiv): 516 (WebCore::GraphicsContextGLOpenGL::getNonBuiltInActiveSymbolCount): 517 (WebCore::GraphicsContextGLOpenGL::getProgramInfoLog): 518 (WebCore::GraphicsContextGLOpenGL::getRenderbufferParameteriv): 519 (WebCore::GraphicsContextGLOpenGL::getShaderiv): 520 (WebCore::GraphicsContextGLOpenGL::getShaderInfoLog): 521 (WebCore::GraphicsContextGLOpenGL::getShaderSource): 522 (WebCore::GraphicsContextGLOpenGL::getTexParameterfv): 523 (WebCore::GraphicsContextGLOpenGL::getTexParameteriv): 524 (WebCore::GraphicsContextGLOpenGL::getUniformfv): 525 (WebCore::GraphicsContextGLOpenGL::getUniformiv): 526 (WebCore::GraphicsContextGLOpenGL::getUniformLocation): 527 (WebCore::GraphicsContextGLOpenGL::getVertexAttribfv): 528 (WebCore::GraphicsContextGLOpenGL::getVertexAttribiv): 529 (WebCore::GraphicsContextGLOpenGL::getVertexAttribOffset): 530 (WebCore::GraphicsContextGLOpenGL::texSubImage2D): 531 (WebCore::GraphicsContextGLOpenGL::compressedTexImage2D): 532 (WebCore::GraphicsContextGLOpenGL::compressedTexSubImage2D): 533 (WebCore::GraphicsContextGLOpenGL::createBuffer): 534 (WebCore::GraphicsContextGLOpenGL::createFramebuffer): 535 (WebCore::GraphicsContextGLOpenGL::createProgram): 536 (WebCore::GraphicsContextGLOpenGL::createRenderbuffer): 537 (WebCore::GraphicsContextGLOpenGL::createShader): 538 (WebCore::GraphicsContextGLOpenGL::createTexture): 539 (WebCore::GraphicsContextGLOpenGL::deleteBuffer): 540 (WebCore::GraphicsContextGLOpenGL::deleteFramebuffer): 541 (WebCore::GraphicsContextGLOpenGL::deleteProgram): 542 (WebCore::GraphicsContextGLOpenGL::deleteRenderbuffer): 543 (WebCore::GraphicsContextGLOpenGL::deleteShader): 544 (WebCore::GraphicsContextGLOpenGL::deleteTexture): 545 (WebCore::GraphicsContextGLOpenGL::texImage2DDirect): 546 (WebCore::GraphicsContextGLOpenGL::primitiveRestartIndex): 547 (WebCore::GraphicsContextGLOpenGL::copyBufferSubData): 548 (WebCore::GraphicsContextGLOpenGL::mapBufferRange): 549 (WebCore::GraphicsContextGLOpenGL::unmapBuffer): 550 (WebCore::GraphicsContextGLOpenGL::getInternalformativ): 551 (WebCore::GraphicsContextGLOpenGL::renderbufferStorageMultisample): 552 (WebCore::GraphicsContextGLOpenGL::texStorage2D): 553 (WebCore::GraphicsContextGLOpenGL::texStorage3D): 554 (WebCore::GraphicsContextGLOpenGL::getActiveUniforms): 555 * platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp: 556 (WebCore::GraphicsContextGLOpenGL::readPixels): 557 (WebCore::GraphicsContextGLOpenGL::reshapeFBOs): 558 (WebCore::GraphicsContextGLOpenGL::renderbufferStorage): 559 (WebCore::GraphicsContextGLOpenGL::getIntegerv): 560 (WebCore::GraphicsContextGLOpenGL::getShaderPrecisionFormat): 561 (WebCore::GraphicsContextGLOpenGL::depthRange): 562 (WebCore::GraphicsContextGLOpenGL::clearDepth): 563 (WebCore::GraphicsContextGLOpenGL::create): 564 (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): 565 (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): 566 * platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp: 567 (WebCore::GraphicsContextGLOpenGL::GraphicsContextGLOpenGL): 568 (WebCore::GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL): 569 1 570 2020-11-13 Miguel Gomez <magomez@igalia.com> 2 571 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r269686 r269768 712 712 713 713 auto context = GraphicsContextGLOpenGL::create(attributes, hostWindow); 714 if (!context || !context->makeContextCurrent()) {714 if (!context) { 715 715 if (canvasElement) { 716 716 canvasElement->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, … … 4350 4350 4351 4351 #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); 4355 4356 #else 4356 4357 if (m_isRobustnessEXTSupported) -
trunk/Source/WebCore/platform/graphics/angle/ExtensionsGLANGLE.cpp
r269686 r269768 75 75 bool ExtensionsGLANGLE::supports(const String& name) 76 76 { 77 if (!m_initializedAvailableExtensions) 77 if (!m_initializedAvailableExtensions) { 78 if (!m_context->makeContextCurrent()) 79 return false; 78 80 initializeAvailableExtensions(); 79 81 } 80 82 return supportsExtension(name); 81 83 } … … 85 87 // Enable support in ANGLE (if not enabled already). 86 88 if (m_requestableExtensions.contains(name) && !m_enabledExtensions.contains(name)) { 87 m_context->makeContextCurrent(); 89 if (!m_context->makeContextCurrent()) 90 return; 88 91 gl::RequestExtensionANGLE(name.ascii().data()); 89 92 m_enabledExtensions.add(name); … … 108 111 String ExtensionsGLANGLE::getTranslatedShaderSourceANGLE(PlatformGLObject shader) 109 112 { 110 m_context->makeContextCurrent(); 113 if (!m_context->makeContextCurrent()) 114 return String(); 115 111 116 int sourceLength = 0; 112 117 m_context->getShaderiv(shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &sourceLength); … … 162 167 { 163 168 // FIXME: consider adding support for APPLE_framebuffer_multisample. 164 m_context->makeContextCurrent(); 169 if (!m_context->makeContextCurrent()) 170 return; 171 165 172 gl::BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); 166 173 } … … 168 175 void ExtensionsGLANGLE::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) 169 176 { 170 m_context->makeContextCurrent(); 177 if (!m_context->makeContextCurrent()) 178 return; 179 171 180 gl::RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height); 172 181 } … … 174 183 PlatformGLObject ExtensionsGLANGLE::createVertexArrayOES() 175 184 { 176 m_context->makeContextCurrent(); 185 if (!m_context->makeContextCurrent()) 186 return 0; 187 177 188 GLuint array = 0; 178 189 gl::GenVertexArraysOES(1, &array); … … 185 196 return; 186 197 187 m_context->makeContextCurrent(); 198 if (!m_context->makeContextCurrent()) 199 return; 200 188 201 gl::DeleteVertexArraysOES(1, &array); 189 202 } … … 194 207 return GL_FALSE; 195 208 196 m_context->makeContextCurrent(); 209 if (!m_context->makeContextCurrent()) 210 return GL_FALSE; 211 197 212 return gl::IsVertexArrayOES(array); 198 213 } … … 200 215 void ExtensionsGLANGLE::bindVertexArrayOES(PlatformGLObject array) 201 216 { 202 m_context->makeContextCurrent(); 217 if (!m_context->makeContextCurrent()) 218 return; 219 203 220 gl::BindVertexArrayOES(array); 204 221 } … … 229 246 void ExtensionsGLANGLE::drawBuffersEXT(GCGLsizei n, const GCGLenum* bufs) 230 247 { 231 m_context->makeContextCurrent(); 248 if (!m_context->makeContextCurrent()) 249 return; 250 232 251 gl::DrawBuffersEXT(n, bufs); 233 252 } … … 235 254 void ExtensionsGLANGLE::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) 236 255 { 237 m_context->makeContextCurrent(); 256 if (!m_context->makeContextCurrent()) 257 return; 258 238 259 gl::DrawArraysInstancedANGLE(mode, first, count, primcount); 239 260 } … … 241 262 void ExtensionsGLANGLE::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount) 242 263 { 243 m_context->makeContextCurrent(); 264 if (!m_context->makeContextCurrent()) 265 return; 266 244 267 gl::DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount); 245 268 } … … 247 270 void ExtensionsGLANGLE::vertexAttribDivisor(GCGLuint index, GCGLuint divisor) 248 271 { 249 m_context->makeContextCurrent(); 272 if (!m_context->makeContextCurrent()) 273 return; 274 250 275 gl::VertexAttribDivisorANGLE(index, divisor); 251 276 } … … 272 297 void ExtensionsGLANGLE::getBooleanvRobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLboolean *data) 273 298 { 274 m_context->makeContextCurrent(); 299 if (!m_context->makeContextCurrent()) 300 return; 301 275 302 gl::GetBooleanvRobustANGLE(pname, bufSize, length, data); 276 303 } … … 278 305 void ExtensionsGLANGLE::getBufferParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 279 306 { 280 m_context->makeContextCurrent(); 307 if (!m_context->makeContextCurrent()) 308 return; 309 281 310 gl::GetBufferParameterivRobustANGLE(target, pname, bufSize, length, params); 282 311 } … … 284 313 void ExtensionsGLANGLE::getFloatvRobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *data) 285 314 { 286 m_context->makeContextCurrent(); 315 if (!m_context->makeContextCurrent()) 316 return; 317 287 318 gl::GetFloatvRobustANGLE(pname, bufSize, length, data); 288 319 } … … 290 321 void ExtensionsGLANGLE::getFramebufferAttachmentParameterivRobustANGLE(GCGLenum target, GCGLenum attachment, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 291 322 { 292 m_context->makeContextCurrent(); 323 if (!m_context->makeContextCurrent()) 324 return; 325 293 326 gl::GetFramebufferAttachmentParameterivRobustANGLE(target, attachment, pname, bufSize, length, params); 294 327 } … … 296 329 void ExtensionsGLANGLE::getIntegervRobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *data) 297 330 { 298 m_context->makeContextCurrent(); 331 if (!m_context->makeContextCurrent()) 332 return; 333 299 334 gl::GetIntegervRobustANGLE(pname, bufSize, length, data); 300 335 } … … 302 337 void ExtensionsGLANGLE::getProgramivRobustANGLE(GCGLuint program, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 303 338 { 304 m_context->makeContextCurrent(); 339 if (!m_context->makeContextCurrent()) 340 return; 341 305 342 gl::GetProgramivRobustANGLE(program, pname, bufSize, length, params); 306 343 } … … 308 345 void ExtensionsGLANGLE::getRenderbufferParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 309 346 { 310 m_context->makeContextCurrent(); 347 if (!m_context->makeContextCurrent()) 348 return; 349 311 350 gl::GetRenderbufferParameterivRobustANGLE(target, pname, bufSize, length, params); 312 351 } … … 314 353 void ExtensionsGLANGLE::getShaderivRobustANGLE(GCGLuint shader, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 315 354 { 316 m_context->makeContextCurrent(); 355 if (!m_context->makeContextCurrent()) 356 return; 357 317 358 gl::GetShaderivRobustANGLE(shader, pname, bufSize, length, params); 318 359 } … … 320 361 void ExtensionsGLANGLE::getTexParameterfvRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) 321 362 { 322 m_context->makeContextCurrent(); 363 if (!m_context->makeContextCurrent()) 364 return; 365 323 366 gl::GetTexParameterfvRobustANGLE(target, pname, bufSize, length, params); 324 367 } … … 326 369 void ExtensionsGLANGLE::getTexParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 327 370 { 328 m_context->makeContextCurrent(); 371 if (!m_context->makeContextCurrent()) 372 return; 373 329 374 gl::GetTexParameterivRobustANGLE(target, pname, bufSize, length, params); 330 375 } … … 332 377 void ExtensionsGLANGLE::getUniformfvRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) 333 378 { 334 m_context->makeContextCurrent(); 379 if (!m_context->makeContextCurrent()) 380 return; 381 335 382 gl::GetUniformfvRobustANGLE(program, location, bufSize, length, params); 336 383 } … … 338 385 void ExtensionsGLANGLE::getUniformivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 339 386 { 340 m_context->makeContextCurrent(); 387 if (!m_context->makeContextCurrent()) 388 return; 389 341 390 gl::GetUniformivRobustANGLE(program, location, bufSize, length, params); 342 391 } … … 344 393 void ExtensionsGLANGLE::getVertexAttribfvRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) 345 394 { 346 m_context->makeContextCurrent(); 395 if (!m_context->makeContextCurrent()) 396 return; 397 347 398 gl::GetVertexAttribfvRobustANGLE(index, pname, bufSize, length, params); 348 399 } … … 350 401 void ExtensionsGLANGLE::getVertexAttribivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 351 402 { 352 m_context->makeContextCurrent(); 403 if (!m_context->makeContextCurrent()) 404 return; 405 353 406 gl::GetVertexAttribivRobustANGLE(index, pname, bufSize, length, params); 354 407 } … … 356 409 void ExtensionsGLANGLE::getVertexAttribPointervRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **pointer) 357 410 { 358 m_context->makeContextCurrent(); 411 if (!m_context->makeContextCurrent()) 412 return; 413 359 414 gl::GetVertexAttribPointervRobustANGLE(index, pname, bufSize, length, pointer); 360 415 } … … 362 417 void ExtensionsGLANGLE::readPixelsRobustANGLE(int x, int y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, GCGLsizei *length, GCGLsizei *columns, GCGLsizei *rows, void *pixels) 363 418 { 364 m_context->makeContextCurrent(); 419 if (!m_context->makeContextCurrent()) 420 return; 421 365 422 gl::ReadPixelsRobustANGLE(x, y, width, height, format, type, bufSize, length, columns, rows, pixels); 366 423 } … … 370 427 if (!m_context->m_isForWebGL2) 371 428 internalformat = adjustWebGL1TextureInternalFormat(internalformat, format, type); 372 m_context->makeContextCurrent(); 429 if (!m_context->makeContextCurrent()) 430 return; 431 373 432 gl::TexImage2DRobustANGLE(target, level, internalformat, width, height, border, format, type, bufSize, pixels); 374 433 } … … 376 435 void ExtensionsGLANGLE::texParameterfvRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLfloat *params) 377 436 { 378 m_context->makeContextCurrent(); 437 if (!m_context->makeContextCurrent()) 438 return; 439 379 440 gl::TexParameterfvRobustANGLE(target, pname, bufSize, params); 380 441 } … … 382 443 void ExtensionsGLANGLE::texParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLint *params) 383 444 { 384 m_context->makeContextCurrent(); 445 if (!m_context->makeContextCurrent()) 446 return; 447 385 448 gl::TexParameterivRobustANGLE(target, pname, bufSize, params); 386 449 } … … 388 451 void ExtensionsGLANGLE::texSubImage2DRobustANGLE(GCGLenum target, int level, int xoffset, int yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, GCGLsizei bufSize, const void *pixels) 389 452 { 390 m_context->makeContextCurrent(); 453 if (!m_context->makeContextCurrent()) 454 return; 455 391 456 gl::TexSubImage2DRobustANGLE(target, level, xoffset, yoffset, width, height, format, type, bufSize, pixels); 392 457 } … … 394 459 void ExtensionsGLANGLE::compressedTexImage2DRobustANGLE(GCGLenum target, int level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, int border, GCGLsizei imageSize, GCGLsizei bufSize, const void* data) 395 460 { 396 m_context->makeContextCurrent(); 461 if (!m_context->makeContextCurrent()) 462 return; 463 397 464 gl::CompressedTexImage2DRobustANGLE(target, level, internalformat, width, height, border, imageSize, bufSize, data); 398 465 } … … 400 467 void ExtensionsGLANGLE::compressedTexSubImage2DRobustANGLE(GCGLenum target, int level, int xoffset, int yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLsizei imageSize, GCGLsizei bufSize, const void* data) 401 468 { 402 m_context->makeContextCurrent(); 469 if (!m_context->makeContextCurrent()) 470 return; 471 403 472 gl::CompressedTexSubImage2DRobustANGLE(target, level, xoffset, yoffset, width, height, format, imageSize, bufSize, data); 404 473 } … … 406 475 void ExtensionsGLANGLE::compressedTexImage3DRobustANGLE(GCGLenum target, int level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth, int border, GCGLsizei imageSize, GCGLsizei bufSize, const void* data) 407 476 { 408 m_context->makeContextCurrent(); 477 if (!m_context->makeContextCurrent()) 478 return; 479 409 480 gl::CompressedTexImage3DRobustANGLE(target, level, internalformat, width, height, depth, border, imageSize, bufSize, data); 410 481 } … … 412 483 void 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) 413 484 { 414 m_context->makeContextCurrent(); 485 if (!m_context->makeContextCurrent()) 486 return; 487 415 488 gl::CompressedTexSubImage3DRobustANGLE(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, bufSize, data); 416 489 } … … 419 492 void 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) 420 493 { 421 m_context->makeContextCurrent(); 494 if (!m_context->makeContextCurrent()) 495 return; 496 422 497 gl::TexImage3DRobustANGLE(target, level, internalformat, width, height, depth, border, format, type, bufSize, pixels); 423 498 } … … 425 500 void 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) 426 501 { 427 m_context->makeContextCurrent(); 502 if (!m_context->makeContextCurrent()) 503 return; 504 428 505 gl::TexSubImage3DRobustANGLE(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, pixels); 429 506 } … … 431 508 void ExtensionsGLANGLE::getQueryivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 432 509 { 433 m_context->makeContextCurrent(); 510 if (!m_context->makeContextCurrent()) 511 return; 512 434 513 gl::GetQueryivRobustANGLE(target, pname, bufSize, length, params); 435 514 } … … 437 516 void ExtensionsGLANGLE::getQueryObjectuivRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) 438 517 { 439 m_context->makeContextCurrent(); 518 if (!m_context->makeContextCurrent()) 519 return; 520 440 521 gl::GetQueryObjectuivRobustANGLE(id, pname, bufSize, length, params); 441 522 } … … 443 524 void ExtensionsGLANGLE::getBufferPointervRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **params) 444 525 { 445 m_context->makeContextCurrent(); 526 if (!m_context->makeContextCurrent()) 527 return; 528 446 529 gl::GetBufferPointervRobustANGLE(target, pname, bufSize, length, params); 447 530 } … … 449 532 void ExtensionsGLANGLE::getIntegeri_vRobustANGLE(GCGLenum target, GCGLuint index, GCGLsizei bufSize, GCGLsizei *length, GCGLint *data) 450 533 { 451 m_context->makeContextCurrent(); 534 if (!m_context->makeContextCurrent()) 535 return; 536 452 537 gl::GetIntegeri_vRobustANGLE(target, index, bufSize, length, data); 453 538 } … … 455 540 void ExtensionsGLANGLE::getInternalformativRobustANGLE(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 456 541 { 457 m_context->makeContextCurrent(); 542 if (!m_context->makeContextCurrent()) 543 return; 544 458 545 gl::GetInternalformativRobustANGLE(target, internalformat, pname, bufSize, length, params); 459 546 } … … 461 548 void ExtensionsGLANGLE::getVertexAttribIivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 462 549 { 463 m_context->makeContextCurrent(); 550 if (!m_context->makeContextCurrent()) 551 return; 552 464 553 gl::GetVertexAttribIivRobustANGLE(index, pname, bufSize, length, params); 465 554 } … … 467 556 void ExtensionsGLANGLE::getVertexAttribIuivRobustANGLE(GCGLuint index, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) 468 557 { 469 m_context->makeContextCurrent(); 558 if (!m_context->makeContextCurrent()) 559 return; 560 470 561 gl::GetVertexAttribIuivRobustANGLE(index, pname, bufSize, length, params); 471 562 } … … 473 564 void ExtensionsGLANGLE::getUniformuivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) 474 565 { 475 m_context->makeContextCurrent(); 566 if (!m_context->makeContextCurrent()) 567 return; 568 476 569 gl::GetUniformuivRobustANGLE(program, location, bufSize, length, params); 477 570 } … … 479 572 void ExtensionsGLANGLE::getActiveUniformBlockivRobustANGLE(GCGLuint program, GCGLuint uniformBlockIndex, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 480 573 { 481 m_context->makeContextCurrent(); 574 if (!m_context->makeContextCurrent()) 575 return; 576 482 577 gl::GetActiveUniformBlockivRobustANGLE(program, uniformBlockIndex, pname, bufSize, length, params); 483 578 } … … 485 580 void ExtensionsGLANGLE::getInteger64vRobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint64 *data) 486 581 { 487 m_context->makeContextCurrent(); 582 if (!m_context->makeContextCurrent()) 583 return; 584 488 585 gl::GetInteger64vRobustANGLE(pname, bufSize, length, reinterpret_cast<GLint64*>(data)); 489 586 } … … 491 588 void ExtensionsGLANGLE::getInteger64i_vRobustANGLE(GCGLenum target, GCGLuint index, GCGLsizei bufSize, GCGLsizei *length, GCGLint64 *data) 492 589 { 493 m_context->makeContextCurrent(); 590 if (!m_context->makeContextCurrent()) 591 return; 592 494 593 gl::GetInteger64i_vRobustANGLE(target, index, bufSize, length, reinterpret_cast<GLint64*>(data)); 495 594 } … … 497 596 void ExtensionsGLANGLE::getBufferParameteri64vRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint64 *params) 498 597 { 499 m_context->makeContextCurrent(); 598 if (!m_context->makeContextCurrent()) 599 return; 600 500 601 gl::GetBufferParameteri64vRobustANGLE(target, pname, bufSize, length, reinterpret_cast<GLint64*>(params)); 501 602 } … … 503 604 void ExtensionsGLANGLE::samplerParameterivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, const GCGLint *param) 504 605 { 505 m_context->makeContextCurrent(); 606 if (!m_context->makeContextCurrent()) 607 return; 608 506 609 gl::SamplerParameterivRobustANGLE(sampler, pname, bufSize, param); 507 610 } … … 509 612 void ExtensionsGLANGLE::samplerParameterfvRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, const GCGLfloat *param) 510 613 { 511 m_context->makeContextCurrent(); 614 if (!m_context->makeContextCurrent()) 615 return; 616 512 617 gl::SamplerParameterfvRobustANGLE(sampler, pname, bufSize, param); 513 618 } … … 515 620 void ExtensionsGLANGLE::getSamplerParameterivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 516 621 { 517 m_context->makeContextCurrent(); 622 if (!m_context->makeContextCurrent()) 623 return; 624 518 625 gl::GetSamplerParameterivRobustANGLE(sampler, pname, bufSize, length, params); 519 626 } … … 521 628 void ExtensionsGLANGLE::getSamplerParameterfvRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) 522 629 { 523 m_context->makeContextCurrent(); 630 if (!m_context->makeContextCurrent()) 631 return; 632 524 633 gl::GetSamplerParameterfvRobustANGLE(sampler, pname, bufSize, length, params); 525 634 } … … 528 637 void ExtensionsGLANGLE::getFramebufferParameterivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 529 638 { 530 m_context->makeContextCurrent(); 639 if (!m_context->makeContextCurrent()) 640 return; 641 531 642 gl::GetFramebufferParameterivRobustANGLE(target, pname, bufSize, length, params); 532 643 } … … 534 645 void ExtensionsGLANGLE::getProgramInterfaceivRobustANGLE(GCGLuint program, GCGLenum programInterface, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 535 646 { 536 m_context->makeContextCurrent(); 647 if (!m_context->makeContextCurrent()) 648 return; 649 537 650 gl::GetProgramInterfaceivRobustANGLE(program, programInterface, pname, bufSize, length, params); 538 651 } … … 540 653 void ExtensionsGLANGLE::getBooleani_vRobustANGLE(GCGLenum target, GCGLuint index, GCGLsizei bufSize, GCGLsizei *length, GCGLboolean *data) 541 654 { 542 m_context->makeContextCurrent(); 655 if (!m_context->makeContextCurrent()) 656 return; 657 543 658 gl::GetBooleani_vRobustANGLE(target, index, bufSize, length, data); 544 659 } … … 546 661 void ExtensionsGLANGLE::getMultisamplefvRobustANGLE(GCGLenum pname, GCGLuint index, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *val) 547 662 { 548 m_context->makeContextCurrent(); 663 if (!m_context->makeContextCurrent()) 664 return; 665 549 666 gl::GetMultisamplefvRobustANGLE(pname, index, bufSize, length, val); 550 667 } … … 552 669 void ExtensionsGLANGLE::getTexLevelParameterivRobustANGLE(GCGLenum target, int level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 553 670 { 554 m_context->makeContextCurrent(); 671 if (!m_context->makeContextCurrent()) 672 return; 673 555 674 gl::GetTexLevelParameterivRobustANGLE(target, level, pname, bufSize, length, params); 556 675 } … … 558 677 void ExtensionsGLANGLE::getTexLevelParameterfvRobustANGLE(GCGLenum target, int level, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) 559 678 { 560 m_context->makeContextCurrent(); 679 if (!m_context->makeContextCurrent()) 680 return; 681 561 682 gl::GetTexLevelParameterfvRobustANGLE(target, level, pname, bufSize, length, params); 562 683 } … … 565 686 void ExtensionsGLANGLE::getPointervRobustANGLERobustANGLE(GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, void **params) 566 687 { 567 m_context->makeContextCurrent(); 688 if (!m_context->makeContextCurrent()) 689 return; 690 568 691 gl::GetPointervRobustANGLERobustANGLE(pname, bufSize, length, params); 569 692 } … … 582 705 void 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) 583 706 { 584 m_context->makeContextCurrent(); 707 if (!m_context->makeContextCurrent()) 708 return; 709 585 710 // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., 586 711 // all previous rendering calls should be done before reading pixels. … … 617 742 void ExtensionsGLANGLE::getnUniformfvRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLfloat *params) 618 743 { 619 m_context->makeContextCurrent(); 744 if (!m_context->makeContextCurrent()) 745 return; 746 620 747 gl::GetnUniformfvRobustANGLE(program, location, bufSize, length, params); 621 748 } … … 623 750 void ExtensionsGLANGLE::getnUniformivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 624 751 { 625 m_context->makeContextCurrent(); 752 if (!m_context->makeContextCurrent()) 753 return; 754 626 755 gl::GetnUniformivRobustANGLE(program, location, bufSize, length, params); 627 756 } … … 629 758 void ExtensionsGLANGLE::getnUniformuivRobustANGLE(GCGLuint program, int location, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) 630 759 { 631 m_context->makeContextCurrent(); 760 if (!m_context->makeContextCurrent()) 761 return; 762 632 763 gl::GetnUniformuivRobustANGLE(program, location, bufSize, length, params); 633 764 } … … 635 766 void ExtensionsGLANGLE::texParameterIivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLint *params) 636 767 { 637 m_context->makeContextCurrent(); 768 if (!m_context->makeContextCurrent()) 769 return; 770 638 771 gl::TexParameterIivRobustANGLE(target, pname, bufSize, params); 639 772 } … … 641 774 void ExtensionsGLANGLE::texParameterIuivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, const GCGLuint *params) 642 775 { 643 m_context->makeContextCurrent(); 776 if (!m_context->makeContextCurrent()) 777 return; 778 644 779 gl::TexParameterIuivRobustANGLE(target, pname, bufSize, params); 645 780 } … … 647 782 void ExtensionsGLANGLE::getTexParameterIivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 648 783 { 649 m_context->makeContextCurrent(); 784 if (!m_context->makeContextCurrent()) 785 return; 786 650 787 gl::GetTexParameterIivRobustANGLE(target, pname, bufSize, length, params); 651 788 } … … 653 790 void ExtensionsGLANGLE::getTexParameterIuivRobustANGLE(GCGLenum target, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) 654 791 { 655 m_context->makeContextCurrent(); 792 if (!m_context->makeContextCurrent()) 793 return; 794 656 795 gl::GetTexParameterIuivRobustANGLE(target, pname, bufSize, length, params); 657 796 } … … 659 798 void ExtensionsGLANGLE::samplerParameterIivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, const GCGLint *param) 660 799 { 661 m_context->makeContextCurrent(); 800 if (!m_context->makeContextCurrent()) 801 return; 802 662 803 gl::SamplerParameterIivRobustANGLE(sampler, pname, bufSize, param); 663 804 } … … 665 806 void ExtensionsGLANGLE::samplerParameterIuivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, const GCGLuint *param) 666 807 { 667 m_context->makeContextCurrent(); 808 if (!m_context->makeContextCurrent()) 809 return; 810 668 811 gl::SamplerParameterIuivRobustANGLE(sampler, pname, bufSize, param); 669 812 } … … 671 814 void ExtensionsGLANGLE::getSamplerParameterIivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 672 815 { 673 m_context->makeContextCurrent(); 816 if (!m_context->makeContextCurrent()) 817 return; 818 674 819 gl::GetSamplerParameterIivRobustANGLE(sampler, pname, bufSize, length, params); 675 820 } … … 677 822 void ExtensionsGLANGLE::getSamplerParameterIuivRobustANGLE(GCGLuint sampler, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint *params) 678 823 { 679 m_context->makeContextCurrent(); 824 if (!m_context->makeContextCurrent()) 825 return; 826 680 827 gl::GetSamplerParameterIuivRobustANGLE(sampler, pname, bufSize, length, params); 681 828 } … … 684 831 void ExtensionsGLANGLE::getQueryObjectivRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint *params) 685 832 { 686 m_context->makeContextCurrent(); 833 if (!m_context->makeContextCurrent()) 834 return; 835 687 836 gl::GetQueryObjectivRobustANGLE(id, pname, bufSize, length, params); 688 837 } … … 690 839 void ExtensionsGLANGLE::getQueryObjecti64vRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLint64 *params) 691 840 { 692 m_context->makeContextCurrent(); 841 if (!m_context->makeContextCurrent()) 842 return; 843 693 844 gl::GetQueryObjecti64vRobustANGLE(id, pname, bufSize, length, reinterpret_cast<GLint64*>(params)); 694 845 } … … 696 847 void ExtensionsGLANGLE::getQueryObjectui64vRobustANGLE(GCGLuint id, GCGLenum pname, GCGLsizei bufSize, GCGLsizei *length, GCGLuint64 *params) 697 848 { 698 m_context->makeContextCurrent(); 849 if (!m_context->makeContextCurrent()) 850 return; 851 699 852 gl::GetQueryObjectui64vRobustANGLE(id, pname, bufSize, length, reinterpret_cast<GLuint64*>(params)); 700 853 } -
trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
r269686 r269768 186 186 gl::BindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); 187 187 gl::BindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer); 188 g etExtensions().renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, m_internalColorFormat, width, height);188 gl::RenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, m_internalColorFormat, width, height); 189 189 gl::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer); 190 190 if (attrs.stencil || attrs.depth) { 191 191 gl::BindRenderbuffer(GL_RENDERBUFFER, m_multisampleDepthStencilBuffer); 192 g etExtensions().renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, internalDepthStencilFormat, width, height);192 gl::RenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, sampleCount, internalDepthStencilFormat, width, height); 193 193 // WebGL 1.0's rules state that combined depth/stencil renderbuffers 194 194 // have to be attached to the synthetic DEPTH_STENCIL_ATTACHMENT point. … … 325 325 void GraphicsContextGLOpenGL::renderbufferStorage(GCGLenum target, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) 326 326 { 327 makeContextCurrent(); 327 if (!makeContextCurrent()) 328 return; 329 328 330 gl::RenderbufferStorage(target, internalformat, width, height); 329 331 } … … 331 333 void GraphicsContextGLOpenGL::getIntegerv(GCGLenum pname, GCGLint* value) 332 334 { 333 makeContextCurrent(); 335 if (!makeContextCurrent()) 336 return; 337 334 338 switch (pname) { 335 339 case MAX_TEXTURE_SIZE: … … 364 368 void GraphicsContextGLOpenGL::getIntegeri_v(GCGLenum pname, GCGLuint index, GCGLint* value) 365 369 { 366 makeContextCurrent(); 370 if (!makeContextCurrent()) 371 return; 372 367 373 gl::GetIntegeri_v(pname, index, value); 368 374 } … … 370 376 void GraphicsContextGLOpenGL::getShaderPrecisionFormat(GCGLenum shaderType, GCGLenum precisionType, GCGLint* range, GCGLint* precision) 371 377 { 372 makeContextCurrent(); 378 if (!makeContextCurrent()) 379 return; 380 373 381 gl::GetShaderPrecisionFormat(shaderType, precisionType, range, precision); 374 382 } … … 387 395 void GraphicsContextGLOpenGL::depthRange(GCGLclampf zNear, GCGLclampf zFar) 388 396 { 389 makeContextCurrent(); 397 if (!makeContextCurrent()) 398 return; 399 390 400 gl::DepthRangef(static_cast<float>(zNear), static_cast<float>(zFar)); 391 401 } … … 393 403 void GraphicsContextGLOpenGL::clearDepth(GCGLclampf depth) 394 404 { 395 makeContextCurrent(); 405 if (!makeContextCurrent()) 406 return; 407 396 408 gl::ClearDepthf(static_cast<float>(depth)); 397 409 } … … 408 420 // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., 409 421 // all previous rendering calls should be done before reading pixels. 410 makeContextCurrent(); 422 if (!makeContextCurrent()) 423 return; 424 411 425 gl::Flush(); 412 426 auto attrs = contextAttributes(); … … 523 537 return; 524 538 525 makeContextCurrent(); 539 if (!makeContextCurrent()) 540 return; 541 526 542 prepareTextureImpl(); 527 543 } … … 573 589 return; 574 590 575 makeContextCurrent(); 591 if (!makeContextCurrent()) 592 return; 593 576 594 577 595 GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER; … … 629 647 void GraphicsContextGLOpenGL::reshape(int width, int height) 630 648 { 631 if (!platformGraphicsContextGL())632 return;633 634 649 if (width == m_currentWidth && height == m_currentHeight) 635 650 return; … … 639 654 return; 640 655 656 if (!makeContextCurrent()) 657 return; 658 659 // FIXME: these may call makeContextCurrent again, we need to do this before changing the size. 660 moveErrorsToSyntheticErrorList(); 661 validateAttributes(); 662 641 663 markContextChanged(); 642 664 643 665 m_currentWidth = width; 644 666 m_currentHeight = height; 645 646 makeContextCurrent();647 moveErrorsToSyntheticErrorList();648 validateAttributes();649 667 650 668 TemporaryANGLESetting scopedScissor(GL_SCISSOR_TEST, GL_FALSE); … … 667 685 if (attrs.depth) { 668 686 gl::GetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth); 669 GraphicsContextGLOpenGL::clearDepth(1);687 gl::ClearDepthf(1.0f); 670 688 gl::GetBooleanv(GL_DEPTH_WRITEMASK, &depthMask); 671 689 gl::DepthMask(GL_TRUE); 672 690 clearMask |= GL_DEPTH_BUFFER_BIT; 673 691 } 692 674 693 if (attrs.stencil) { 675 694 gl::GetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil); … … 687 706 gl::ColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]); 688 707 if (attrs.depth) { 689 GraphicsContextGLOpenGL::clearDepth(clearDepth);708 gl::ClearDepthf(clearDepth); 690 709 gl::DepthMask(depthMask); 691 710 } … … 714 733 void GraphicsContextGLOpenGL::activeTexture(GCGLenum texture) 715 734 { 716 makeContextCurrent(); 735 if (!makeContextCurrent()) 736 return; 737 717 738 m_state.activeTextureUnit = texture; 718 739 gl::ActiveTexture(texture); … … 723 744 ASSERT(program); 724 745 ASSERT(shader); 725 makeContextCurrent(); 746 if (!makeContextCurrent()) 747 return; 748 726 749 gl::AttachShader(program, shader); 727 750 } … … 730 753 { 731 754 ASSERT(program); 732 makeContextCurrent(); 755 if (!makeContextCurrent()) 756 return; 757 733 758 gl::BindAttribLocation(program, index, name.utf8().data()); 734 759 } … … 736 761 void GraphicsContextGLOpenGL::bindBuffer(GCGLenum target, PlatformGLObject buffer) 737 762 { 738 makeContextCurrent(); 763 if (!makeContextCurrent()) 764 return; 765 739 766 gl::BindBuffer(target, buffer); 740 767 } … … 742 769 void GraphicsContextGLOpenGL::bindFramebuffer(GCGLenum target, PlatformGLObject buffer) 743 770 { 744 makeContextCurrent(); 771 if (!makeContextCurrent()) 772 return; 773 745 774 GLuint fbo; 746 775 if (buffer) … … 761 790 void GraphicsContextGLOpenGL::bindRenderbuffer(GCGLenum target, PlatformGLObject renderbuffer) 762 791 { 763 makeContextCurrent(); 792 if (!makeContextCurrent()) 793 return; 794 764 795 gl::BindRenderbuffer(target, renderbuffer); 765 796 } … … 768 799 void GraphicsContextGLOpenGL::bindTexture(GCGLenum target, PlatformGLObject texture) 769 800 { 770 makeContextCurrent(); 801 if (!makeContextCurrent()) 802 return; 803 771 804 m_state.setBoundTexture(m_state.activeTextureUnit, texture, target); 772 805 gl::BindTexture(target, texture); … … 775 808 void GraphicsContextGLOpenGL::blendColor(GCGLclampf red, GCGLclampf green, GCGLclampf blue, GCGLclampf alpha) 776 809 { 777 makeContextCurrent(); 810 if (!makeContextCurrent()) 811 return; 812 778 813 gl::BlendColor(red, green, blue, alpha); 779 814 } … … 781 816 void GraphicsContextGLOpenGL::blendEquation(GCGLenum mode) 782 817 { 783 makeContextCurrent(); 818 if (!makeContextCurrent()) 819 return; 820 784 821 gl::BlendEquation(mode); 785 822 } … … 787 824 void GraphicsContextGLOpenGL::blendEquationSeparate(GCGLenum modeRGB, GCGLenum modeAlpha) 788 825 { 789 makeContextCurrent(); 826 if (!makeContextCurrent()) 827 return; 828 790 829 gl::BlendEquationSeparate(modeRGB, modeAlpha); 791 830 } … … 794 833 void GraphicsContextGLOpenGL::blendFunc(GCGLenum sfactor, GCGLenum dfactor) 795 834 { 796 makeContextCurrent(); 835 if (!makeContextCurrent()) 836 return; 837 797 838 gl::BlendFunc(sfactor, dfactor); 798 839 } … … 800 841 void GraphicsContextGLOpenGL::blendFuncSeparate(GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha) 801 842 { 802 makeContextCurrent(); 843 if (!makeContextCurrent()) 844 return; 845 803 846 gl::BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); 804 847 } … … 806 849 void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, GCGLenum usage) 807 850 { 808 makeContextCurrent(); 851 if (!makeContextCurrent()) 852 return; 853 809 854 gl::BufferData(target, size, 0, usage); 810 855 } … … 812 857 void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, const void* data, GCGLenum usage) 813 858 { 814 makeContextCurrent(); 859 if (!makeContextCurrent()) 860 return; 861 815 862 gl::BufferData(target, size, data, usage); 816 863 } … … 818 865 void GraphicsContextGLOpenGL::bufferSubData(GCGLenum target, GCGLintptr offset, GCGLsizeiptr size, const void* data) 819 866 { 820 makeContextCurrent(); 867 if (!makeContextCurrent()) 868 return; 869 821 870 gl::BufferSubData(target, offset, size, data); 822 871 } … … 824 873 void* GraphicsContextGLOpenGL::mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access) 825 874 { 826 makeContextCurrent(); 875 if (!makeContextCurrent()) 876 return nullptr; 877 827 878 return gl::MapBufferRange(target, offset, length, access); 828 879 } … … 830 881 GCGLboolean GraphicsContextGLOpenGL::unmapBuffer(GCGLenum target) 831 882 { 832 makeContextCurrent(); 883 if (!makeContextCurrent()) 884 return GL_FALSE; 885 833 886 return gl::UnmapBuffer(target); 834 887 } … … 836 889 void GraphicsContextGLOpenGL::copyBufferSubData(GCGLenum readTarget, GCGLenum writeTarget, GCGLintptr readOffset, GCGLintptr writeOffset, GCGLsizeiptr size) 837 890 { 838 makeContextCurrent(); 891 if (!makeContextCurrent()) 892 return; 893 839 894 gl::CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size); 840 895 } … … 842 897 void GraphicsContextGLOpenGL::getInternalformativ(GCGLenum target, GCGLenum internalformat, GCGLenum pname, GCGLsizei bufSize, GCGLint* params) 843 898 { 844 makeContextCurrent(); 899 if (!makeContextCurrent()) 900 return; 901 845 902 gl::GetInternalformativ(target, internalformat, pname, bufSize, params); 846 903 } … … 848 905 void GraphicsContextGLOpenGL::renderbufferStorageMultisample(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) 849 906 { 850 makeContextCurrent(); 907 if (!makeContextCurrent()) 908 return; 909 851 910 gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height); 852 911 } … … 854 913 void GraphicsContextGLOpenGL::texStorage2D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) 855 914 { 856 makeContextCurrent(); 915 if (!makeContextCurrent()) 916 return; 917 857 918 gl::TexStorage2D(target, levels, internalformat, width, height); 858 919 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 861 922 void GraphicsContextGLOpenGL::texStorage3D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth) 862 923 { 863 makeContextCurrent(); 924 if (!makeContextCurrent()) 925 return; 926 864 927 gl::TexStorage3D(target, levels, internalformat, width, height, depth); 865 928 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 869 932 { 870 933 ASSERT(program); 871 makeContextCurrent(); 934 if (!makeContextCurrent()) 935 return; 936 872 937 873 938 gl::GetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, params.data()); … … 876 941 GCGLenum GraphicsContextGLOpenGL::checkFramebufferStatus(GCGLenum target) 877 942 { 878 makeContextCurrent(); 943 if (!makeContextCurrent()) 944 return GL_INVALID_OPERATION; 945 879 946 return gl::CheckFramebufferStatus(target); 880 947 } … … 882 949 void GraphicsContextGLOpenGL::clearColor(GCGLclampf r, GCGLclampf g, GCGLclampf b, GCGLclampf a) 883 950 { 884 makeContextCurrent(); 951 if (!makeContextCurrent()) 952 return; 953 885 954 gl::ClearColor(r, g, b, a); 886 955 } … … 888 957 void GraphicsContextGLOpenGL::clear(GCGLbitfield mask) 889 958 { 890 makeContextCurrent(); 959 if (!makeContextCurrent()) 960 return; 961 891 962 gl::Clear(mask); 892 963 checkGPUStatus(); … … 895 966 void GraphicsContextGLOpenGL::clearStencil(GCGLint s) 896 967 { 897 makeContextCurrent(); 968 if (!makeContextCurrent()) 969 return; 970 898 971 gl::ClearStencil(s); 899 972 } … … 901 974 void GraphicsContextGLOpenGL::colorMask(GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha) 902 975 { 903 makeContextCurrent(); 976 if (!makeContextCurrent()) 977 return; 978 904 979 gl::ColorMask(red, green, blue, alpha); 905 980 } … … 908 983 { 909 984 ASSERT(shader); 910 makeContextCurrent(); 985 if (!makeContextCurrent()) 986 return; 987 911 988 // We need the ANGLE_texture_rectangle extension to support IOSurface 912 989 // backbuffers, but we don't want it exposed to WebGL user shaders. … … 920 997 { 921 998 ASSERT(shader); 922 makeContextCurrent(); 999 if (!makeContextCurrent()) 1000 return; 1001 923 1002 gl::CompileShader(shader); 924 1003 } … … 926 1005 void GraphicsContextGLOpenGL::copyTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLint border) 927 1006 { 928 makeContextCurrent(); 1007 if (!makeContextCurrent()) 1008 return; 1009 929 1010 auto attrs = contextAttributes(); 930 1011 GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER; … … 941 1022 void GraphicsContextGLOpenGL::copyTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height) 942 1023 { 943 makeContextCurrent(); 1024 if (!makeContextCurrent()) 1025 return; 1026 944 1027 auto attrs = contextAttributes(); 945 1028 GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER; … … 956 1039 void GraphicsContextGLOpenGL::cullFace(GCGLenum mode) 957 1040 { 958 makeContextCurrent(); 1041 if (!makeContextCurrent()) 1042 return; 1043 959 1044 gl::CullFace(mode); 960 1045 } … … 962 1047 void GraphicsContextGLOpenGL::depthFunc(GCGLenum func) 963 1048 { 964 makeContextCurrent(); 1049 if (!makeContextCurrent()) 1050 return; 1051 965 1052 gl::DepthFunc(func); 966 1053 } … … 968 1055 void GraphicsContextGLOpenGL::depthMask(GCGLboolean flag) 969 1056 { 970 makeContextCurrent(); 1057 if (!makeContextCurrent()) 1058 return; 1059 971 1060 gl::DepthMask(flag); 972 1061 } … … 976 1065 ASSERT(program); 977 1066 ASSERT(shader); 978 makeContextCurrent(); 1067 if (!makeContextCurrent()) 1068 return; 1069 979 1070 gl::DetachShader(program, shader); 980 1071 } … … 982 1073 void GraphicsContextGLOpenGL::disable(GCGLenum cap) 983 1074 { 984 makeContextCurrent(); 1075 if (!makeContextCurrent()) 1076 return; 1077 985 1078 gl::Disable(cap); 986 1079 } … … 988 1081 void GraphicsContextGLOpenGL::disableVertexAttribArray(GCGLuint index) 989 1082 { 990 makeContextCurrent(); 1083 if (!makeContextCurrent()) 1084 return; 1085 991 1086 gl::DisableVertexAttribArray(index); 992 1087 } … … 994 1089 void GraphicsContextGLOpenGL::drawArrays(GCGLenum mode, GCGLint first, GCGLsizei count) 995 1090 { 996 makeContextCurrent(); 1091 if (!makeContextCurrent()) 1092 return; 1093 997 1094 gl::DrawArrays(mode, first, count); 998 1095 checkGPUStatus(); … … 1001 1098 void GraphicsContextGLOpenGL::drawElements(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset) 1002 1099 { 1003 makeContextCurrent(); 1100 if (!makeContextCurrent()) 1101 return; 1102 1004 1103 gl::DrawElements(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset))); 1005 1104 checkGPUStatus(); … … 1008 1107 void GraphicsContextGLOpenGL::enable(GCGLenum cap) 1009 1108 { 1010 makeContextCurrent(); 1109 if (!makeContextCurrent()) 1110 return; 1111 1011 1112 gl::Enable(cap); 1012 1113 } … … 1014 1115 void GraphicsContextGLOpenGL::enableVertexAttribArray(GCGLuint index) 1015 1116 { 1016 makeContextCurrent(); 1117 if (!makeContextCurrent()) 1118 return; 1119 1017 1120 gl::EnableVertexAttribArray(index); 1018 1121 } … … 1020 1123 void GraphicsContextGLOpenGL::finish() 1021 1124 { 1022 makeContextCurrent(); 1125 if (!makeContextCurrent()) 1126 return; 1127 1023 1128 gl::Finish(); 1024 1129 } … … 1026 1131 void GraphicsContextGLOpenGL::flush() 1027 1132 { 1028 makeContextCurrent(); 1133 if (!makeContextCurrent()) 1134 return; 1135 1029 1136 gl::Flush(); 1030 1137 } … … 1032 1139 void GraphicsContextGLOpenGL::framebufferRenderbuffer(GCGLenum target, GCGLenum attachment, GCGLenum renderbuffertarget, PlatformGLObject buffer) 1033 1140 { 1034 makeContextCurrent(); 1141 if (!makeContextCurrent()) 1142 return; 1143 1035 1144 gl::FramebufferRenderbuffer(target, attachment, renderbuffertarget, buffer); 1036 1145 } … … 1038 1147 void GraphicsContextGLOpenGL::framebufferTexture2D(GCGLenum target, GCGLenum attachment, GCGLenum textarget, PlatformGLObject texture, GCGLint level) 1039 1148 { 1040 makeContextCurrent(); 1149 if (!makeContextCurrent()) 1150 return; 1151 1041 1152 gl::FramebufferTexture2D(target, attachment, textarget, texture, level); 1042 1153 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 1045 1156 void GraphicsContextGLOpenGL::frontFace(GCGLenum mode) 1046 1157 { 1047 makeContextCurrent(); 1158 if (!makeContextCurrent()) 1159 return; 1160 1048 1161 gl::FrontFace(mode); 1049 1162 } … … 1051 1164 void GraphicsContextGLOpenGL::generateMipmap(GCGLenum target) 1052 1165 { 1053 makeContextCurrent(); 1166 if (!makeContextCurrent()) 1167 return; 1168 1054 1169 gl::GenerateMipmap(target); 1055 1170 } … … 1061 1176 return false; 1062 1177 } 1063 makeContextCurrent(); 1178 if (!makeContextCurrent()) 1179 return false; 1180 1064 1181 GLint maxAttributeSize = 0; 1065 1182 gl::GetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize); … … 1090 1207 } 1091 1208 1092 makeContextCurrent(); 1209 if (!makeContextCurrent()) 1210 return false; 1211 1093 1212 GLint maxUniformSize = 0; 1094 1213 gl::GetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize); … … 1119 1238 return; 1120 1239 } 1121 makeContextCurrent(); 1240 if (!makeContextCurrent()) 1241 return; 1242 1122 1243 gl::GetAttachedShaders(program, maxCount, count, shaders); 1123 1244 } … … 1128 1249 return -1; 1129 1250 1130 makeContextCurrent(); 1251 if (!makeContextCurrent()) 1252 return -1; 1253 1131 1254 1132 1255 return gl::GetAttribLocation(program, name.utf8().data()); … … 1140 1263 bool GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList() 1141 1264 { 1142 makeContextCurrent(); 1265 if (!makeContextCurrent()) 1266 return false; 1267 1143 1268 bool movedAnError = false; 1144 1269 … … 1167 1292 } 1168 1293 1169 makeContextCurrent(); 1294 if (!makeContextCurrent()) 1295 return GL_INVALID_OPERATION; 1296 1170 1297 return gl::GetError(); 1171 1298 } … … 1173 1300 String GraphicsContextGLOpenGL::getString(GCGLenum name) 1174 1301 { 1175 makeContextCurrent(); 1302 if (!makeContextCurrent()) 1303 return String(); 1304 1176 1305 return String(reinterpret_cast<const char*>(gl::GetString(name))); 1177 1306 } … … 1179 1308 void GraphicsContextGLOpenGL::hint(GCGLenum target, GCGLenum mode) 1180 1309 { 1181 makeContextCurrent(); 1310 if (!makeContextCurrent()) 1311 return; 1312 1182 1313 gl::Hint(target, mode); 1183 1314 } … … 1188 1319 return GL_FALSE; 1189 1320 1190 makeContextCurrent(); 1321 if (!makeContextCurrent()) 1322 return GL_FALSE; 1323 1191 1324 return gl::IsBuffer(buffer); 1192 1325 } … … 1194 1327 GCGLboolean GraphicsContextGLOpenGL::isEnabled(GCGLenum cap) 1195 1328 { 1196 makeContextCurrent(); 1329 if (!makeContextCurrent()) 1330 return GL_FALSE; 1331 1197 1332 return gl::IsEnabled(cap); 1198 1333 } … … 1203 1338 return GL_FALSE; 1204 1339 1205 makeContextCurrent(); 1340 if (!makeContextCurrent()) 1341 return GL_FALSE; 1342 1206 1343 return gl::IsFramebuffer(framebuffer); 1207 1344 } … … 1212 1349 return GL_FALSE; 1213 1350 1214 makeContextCurrent(); 1351 if (!makeContextCurrent()) 1352 return GL_FALSE; 1353 1215 1354 return gl::IsProgram(program); 1216 1355 } … … 1221 1360 return GL_FALSE; 1222 1361 1223 makeContextCurrent(); 1362 if (!makeContextCurrent()) 1363 return GL_FALSE; 1364 1224 1365 return gl::IsRenderbuffer(renderbuffer); 1225 1366 } … … 1230 1371 return GL_FALSE; 1231 1372 1232 makeContextCurrent(); 1373 if (!makeContextCurrent()) 1374 return GL_FALSE; 1375 1233 1376 return gl::IsShader(shader); 1234 1377 } … … 1239 1382 return GL_FALSE; 1240 1383 1241 makeContextCurrent(); 1384 if (!makeContextCurrent()) 1385 return GL_FALSE; 1386 1242 1387 return gl::IsTexture(texture); 1243 1388 } … … 1245 1390 void GraphicsContextGLOpenGL::lineWidth(GCGLfloat width) 1246 1391 { 1247 makeContextCurrent(); 1392 if (!makeContextCurrent()) 1393 return; 1394 1248 1395 gl::LineWidth(width); 1249 1396 } … … 1252 1399 { 1253 1400 ASSERT(program); 1254 makeContextCurrent(); 1401 if (!makeContextCurrent()) 1402 return; 1403 1255 1404 gl::LinkProgram(program); 1256 1405 } … … 1258 1407 void GraphicsContextGLOpenGL::pixelStorei(GCGLenum pname, GCGLint param) 1259 1408 { 1260 makeContextCurrent(); 1409 if (!makeContextCurrent()) 1410 return; 1411 1261 1412 gl::PixelStorei(pname, param); 1262 1413 } … … 1264 1415 void GraphicsContextGLOpenGL::polygonOffset(GCGLfloat factor, GCGLfloat units) 1265 1416 { 1266 makeContextCurrent(); 1417 if (!makeContextCurrent()) 1418 return; 1419 1267 1420 gl::PolygonOffset(factor, units); 1268 1421 } … … 1270 1423 void GraphicsContextGLOpenGL::sampleCoverage(GCGLclampf value, GCGLboolean invert) 1271 1424 { 1272 makeContextCurrent(); 1425 if (!makeContextCurrent()) 1426 return; 1427 1273 1428 gl::SampleCoverage(value, invert); 1274 1429 } … … 1276 1431 void GraphicsContextGLOpenGL::scissor(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height) 1277 1432 { 1278 makeContextCurrent(); 1433 if (!makeContextCurrent()) 1434 return; 1435 1279 1436 gl::Scissor(x, y, width, height); 1280 1437 } … … 1284 1441 ASSERT(shader); 1285 1442 1286 makeContextCurrent(); 1443 if (!makeContextCurrent()) 1444 return; 1287 1445 1288 1446 const CString& shaderSourceCString = string.utf8(); … … 1294 1452 void GraphicsContextGLOpenGL::stencilFunc(GCGLenum func, GCGLint ref, GCGLuint mask) 1295 1453 { 1296 makeContextCurrent(); 1454 if (!makeContextCurrent()) 1455 return; 1456 1297 1457 gl::StencilFunc(func, ref, mask); 1298 1458 } … … 1300 1460 void GraphicsContextGLOpenGL::stencilFuncSeparate(GCGLenum face, GCGLenum func, GCGLint ref, GCGLuint mask) 1301 1461 { 1302 makeContextCurrent(); 1462 if (!makeContextCurrent()) 1463 return; 1464 1303 1465 gl::StencilFuncSeparate(face, func, ref, mask); 1304 1466 } … … 1306 1468 void GraphicsContextGLOpenGL::stencilMask(GCGLuint mask) 1307 1469 { 1308 makeContextCurrent(); 1470 if (!makeContextCurrent()) 1471 return; 1472 1309 1473 gl::StencilMask(mask); 1310 1474 } … … 1312 1476 void GraphicsContextGLOpenGL::stencilMaskSeparate(GCGLenum face, GCGLuint mask) 1313 1477 { 1314 makeContextCurrent(); 1478 if (!makeContextCurrent()) 1479 return; 1480 1315 1481 gl::StencilMaskSeparate(face, mask); 1316 1482 } … … 1318 1484 void GraphicsContextGLOpenGL::stencilOp(GCGLenum fail, GCGLenum zfail, GCGLenum zpass) 1319 1485 { 1320 makeContextCurrent(); 1486 if (!makeContextCurrent()) 1487 return; 1488 1321 1489 gl::StencilOp(fail, zfail, zpass); 1322 1490 } … … 1324 1492 void GraphicsContextGLOpenGL::stencilOpSeparate(GCGLenum face, GCGLenum fail, GCGLenum zfail, GCGLenum zpass) 1325 1493 { 1326 makeContextCurrent(); 1494 if (!makeContextCurrent()) 1495 return; 1496 1327 1497 gl::StencilOpSeparate(face, fail, zfail, zpass); 1328 1498 } … … 1330 1500 void GraphicsContextGLOpenGL::texParameterf(GCGLenum target, GCGLenum pname, GCGLfloat value) 1331 1501 { 1332 makeContextCurrent(); 1502 if (!makeContextCurrent()) 1503 return; 1504 1333 1505 gl::TexParameterf(target, pname, value); 1334 1506 } … … 1336 1508 void GraphicsContextGLOpenGL::texParameteri(GCGLenum target, GCGLenum pname, GCGLint value) 1337 1509 { 1338 makeContextCurrent(); 1510 if (!makeContextCurrent()) 1511 return; 1512 1339 1513 gl::TexParameteri(target, pname, value); 1340 1514 } … … 1342 1516 void GraphicsContextGLOpenGL::uniform1f(GCGLint location, GCGLfloat v0) 1343 1517 { 1344 makeContextCurrent(); 1518 if (!makeContextCurrent()) 1519 return; 1520 1345 1521 gl::Uniform1f(location, v0); 1346 1522 } … … 1348 1524 void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, GCGLsizei size, const GCGLfloat* array) 1349 1525 { 1350 makeContextCurrent(); 1526 if (!makeContextCurrent()) 1527 return; 1528 1351 1529 gl::Uniform1fv(location, size, array); 1352 1530 } … … 1354 1532 void GraphicsContextGLOpenGL::uniform2f(GCGLint location, GCGLfloat v0, GCGLfloat v1) 1355 1533 { 1356 makeContextCurrent(); 1534 if (!makeContextCurrent()) 1535 return; 1536 1357 1537 gl::Uniform2f(location, v0, v1); 1358 1538 } … … 1361 1541 { 1362 1542 // FIXME: length needs to be a multiple of 2. 1363 makeContextCurrent(); 1543 if (!makeContextCurrent()) 1544 return; 1545 1364 1546 gl::Uniform2fv(location, size, array); 1365 1547 } … … 1367 1549 void GraphicsContextGLOpenGL::uniform3f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2) 1368 1550 { 1369 makeContextCurrent(); 1551 if (!makeContextCurrent()) 1552 return; 1553 1370 1554 gl::Uniform3f(location, v0, v1, v2); 1371 1555 } … … 1374 1558 { 1375 1559 // FIXME: length needs to be a multiple of 3. 1376 makeContextCurrent(); 1560 if (!makeContextCurrent()) 1561 return; 1562 1377 1563 gl::Uniform3fv(location, size, array); 1378 1564 } … … 1380 1566 void GraphicsContextGLOpenGL::uniform4f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3) 1381 1567 { 1382 makeContextCurrent(); 1568 if (!makeContextCurrent()) 1569 return; 1570 1383 1571 gl::Uniform4f(location, v0, v1, v2, v3); 1384 1572 } … … 1387 1575 { 1388 1576 // FIXME: length needs to be a multiple of 4. 1389 makeContextCurrent(); 1577 if (!makeContextCurrent()) 1578 return; 1579 1390 1580 gl::Uniform4fv(location, size, array); 1391 1581 } … … 1393 1583 void GraphicsContextGLOpenGL::uniform1i(GCGLint location, GCGLint v0) 1394 1584 { 1395 makeContextCurrent(); 1585 if (!makeContextCurrent()) 1586 return; 1587 1396 1588 gl::Uniform1i(location, v0); 1397 1589 } … … 1399 1591 void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, GCGLsizei size, const GCGLint* array) 1400 1592 { 1401 makeContextCurrent(); 1593 if (!makeContextCurrent()) 1594 return; 1595 1402 1596 gl::Uniform1iv(location, size, array); 1403 1597 } … … 1405 1599 void GraphicsContextGLOpenGL::uniform2i(GCGLint location, GCGLint v0, GCGLint v1) 1406 1600 { 1407 makeContextCurrent(); 1601 if (!makeContextCurrent()) 1602 return; 1603 1408 1604 gl::Uniform2i(location, v0, v1); 1409 1605 } … … 1412 1608 { 1413 1609 // FIXME: length needs to be a multiple of 2. 1414 makeContextCurrent(); 1610 if (!makeContextCurrent()) 1611 return; 1612 1415 1613 gl::Uniform2iv(location, size, array); 1416 1614 } … … 1418 1616 void GraphicsContextGLOpenGL::uniform3i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2) 1419 1617 { 1420 makeContextCurrent(); 1618 if (!makeContextCurrent()) 1619 return; 1620 1421 1621 gl::Uniform3i(location, v0, v1, v2); 1422 1622 } … … 1425 1625 { 1426 1626 // FIXME: length needs to be a multiple of 3. 1427 makeContextCurrent(); 1627 if (!makeContextCurrent()) 1628 return; 1629 1428 1630 gl::Uniform3iv(location, size, array); 1429 1631 } … … 1431 1633 void GraphicsContextGLOpenGL::uniform4i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2, GCGLint v3) 1432 1634 { 1433 makeContextCurrent(); 1635 if (!makeContextCurrent()) 1636 return; 1637 1434 1638 gl::Uniform4i(location, v0, v1, v2, v3); 1435 1639 } … … 1438 1642 { 1439 1643 // FIXME: length needs to be a multiple of 4. 1440 makeContextCurrent(); 1644 if (!makeContextCurrent()) 1645 return; 1646 1441 1647 gl::Uniform4iv(location, size, array); 1442 1648 } … … 1445 1651 { 1446 1652 // FIXME: length needs to be a multiple of 4. 1447 makeContextCurrent(); 1653 if (!makeContextCurrent()) 1654 return; 1655 1448 1656 gl::UniformMatrix2fv(location, size, transpose, array); 1449 1657 } … … 1452 1660 { 1453 1661 // FIXME: length needs to be a multiple of 9. 1454 makeContextCurrent(); 1662 if (!makeContextCurrent()) 1663 return; 1664 1455 1665 gl::UniformMatrix3fv(location, size, transpose, array); 1456 1666 } … … 1459 1669 { 1460 1670 // FIXME: length needs to be a multiple of 16. 1461 makeContextCurrent(); 1671 if (!makeContextCurrent()) 1672 return; 1673 1462 1674 gl::UniformMatrix4fv(location, size, transpose, array); 1463 1675 } … … 1465 1677 void GraphicsContextGLOpenGL::useProgram(PlatformGLObject program) 1466 1678 { 1467 makeContextCurrent(); 1679 if (!makeContextCurrent()) 1680 return; 1681 1468 1682 gl::UseProgram(program); 1469 1683 } … … 1473 1687 ASSERT(program); 1474 1688 1475 makeContextCurrent(); 1689 if (!makeContextCurrent()) 1690 return; 1691 1476 1692 gl::ValidateProgram(program); 1477 1693 } … … 1479 1695 void GraphicsContextGLOpenGL::vertexAttrib1f(GCGLuint index, GCGLfloat v0) 1480 1696 { 1481 makeContextCurrent(); 1697 if (!makeContextCurrent()) 1698 return; 1699 1482 1700 gl::VertexAttrib1f(index, v0); 1483 1701 } … … 1485 1703 void GraphicsContextGLOpenGL::vertexAttrib1fv(GCGLuint index, const GCGLfloat* array) 1486 1704 { 1487 makeContextCurrent(); 1705 if (!makeContextCurrent()) 1706 return; 1707 1488 1708 gl::VertexAttrib1fv(index, array); 1489 1709 } … … 1491 1711 void GraphicsContextGLOpenGL::vertexAttrib2f(GCGLuint index, GCGLfloat v0, GCGLfloat v1) 1492 1712 { 1493 makeContextCurrent(); 1713 if (!makeContextCurrent()) 1714 return; 1715 1494 1716 gl::VertexAttrib2f(index, v0, v1); 1495 1717 } … … 1497 1719 void GraphicsContextGLOpenGL::vertexAttrib2fv(GCGLuint index, const GCGLfloat* array) 1498 1720 { 1499 makeContextCurrent(); 1721 if (!makeContextCurrent()) 1722 return; 1723 1500 1724 gl::VertexAttrib2fv(index, array); 1501 1725 } … … 1503 1727 void GraphicsContextGLOpenGL::vertexAttrib3f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2) 1504 1728 { 1505 makeContextCurrent(); 1729 if (!makeContextCurrent()) 1730 return; 1731 1506 1732 gl::VertexAttrib3f(index, v0, v1, v2); 1507 1733 } … … 1509 1735 void GraphicsContextGLOpenGL::vertexAttrib3fv(GCGLuint index, const GCGLfloat* array) 1510 1736 { 1511 makeContextCurrent(); 1737 if (!makeContextCurrent()) 1738 return; 1739 1512 1740 gl::VertexAttrib3fv(index, array); 1513 1741 } … … 1515 1743 void GraphicsContextGLOpenGL::vertexAttrib4f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3) 1516 1744 { 1517 makeContextCurrent(); 1745 if (!makeContextCurrent()) 1746 return; 1747 1518 1748 gl::VertexAttrib4f(index, v0, v1, v2, v3); 1519 1749 } … … 1521 1751 void GraphicsContextGLOpenGL::vertexAttrib4fv(GCGLuint index, const GCGLfloat* array) 1522 1752 { 1523 makeContextCurrent(); 1753 if (!makeContextCurrent()) 1754 return; 1755 1524 1756 gl::VertexAttrib4fv(index, array); 1525 1757 } … … 1527 1759 void GraphicsContextGLOpenGL::vertexAttribPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLboolean normalized, GCGLsizei stride, GCGLintptr offset) 1528 1760 { 1529 makeContextCurrent(); 1761 if (!makeContextCurrent()) 1762 return; 1763 1530 1764 gl::VertexAttribPointer(index, size, type, normalized, stride, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset))); 1531 1765 } … … 1533 1767 void GraphicsContextGLOpenGL::vertexAttribIPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLsizei stride, GCGLintptr offset) 1534 1768 { 1535 makeContextCurrent(); 1769 if (!makeContextCurrent()) 1770 return; 1771 1536 1772 gl::VertexAttribIPointer(index, size, type, stride, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset))); 1537 1773 } … … 1539 1775 void GraphicsContextGLOpenGL::viewport(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height) 1540 1776 { 1541 makeContextCurrent(); 1777 if (!makeContextCurrent()) 1778 return; 1779 1542 1780 gl::Viewport(x, y, width, height); 1543 1781 } … … 1545 1783 PlatformGLObject GraphicsContextGLOpenGL::createVertexArray() 1546 1784 { 1547 makeContextCurrent(); 1785 if (!makeContextCurrent()) 1786 return 0; 1787 1548 1788 GLuint array = 0; 1549 1789 gl::GenVertexArrays(1, &array); … … 1555 1795 if (!array) 1556 1796 return; 1557 makeContextCurrent(); 1797 if (!makeContextCurrent()) 1798 return; 1799 1558 1800 gl::DeleteVertexArrays(1, &array); 1559 1801 } … … 1563 1805 if (!array) 1564 1806 return GL_FALSE; 1565 makeContextCurrent(); 1807 if (!makeContextCurrent()) 1808 return GL_FALSE; 1809 1566 1810 return gl::IsVertexArray(array); 1567 1811 } … … 1569 1813 void GraphicsContextGLOpenGL::bindVertexArray(PlatformGLObject array) 1570 1814 { 1571 makeContextCurrent(); 1815 if (!makeContextCurrent()) 1816 return; 1817 1572 1818 gl::BindVertexArray(array); 1573 1819 } … … 1575 1821 void GraphicsContextGLOpenGL::getBooleanv(GCGLenum pname, GCGLboolean* value) 1576 1822 { 1577 makeContextCurrent(); 1823 if (!makeContextCurrent()) 1824 return; 1825 1578 1826 gl::GetBooleanv(pname, value); 1579 1827 } … … 1581 1829 void GraphicsContextGLOpenGL::getBufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value) 1582 1830 { 1583 makeContextCurrent(); 1831 if (!makeContextCurrent()) 1832 return; 1833 1584 1834 gl::GetBufferParameteriv(target, pname, value); 1585 1835 } … … 1587 1837 void GraphicsContextGLOpenGL::getFloatv(GCGLenum pname, GCGLfloat* value) 1588 1838 { 1589 makeContextCurrent(); 1839 if (!makeContextCurrent()) 1840 return; 1841 1590 1842 gl::GetFloatv(pname, value); 1591 1843 } … … 1593 1845 void GraphicsContextGLOpenGL::getInteger64v(GCGLenum pname, GCGLint64* value) 1594 1846 { 1595 makeContextCurrent(); 1847 if (!makeContextCurrent()) 1848 return; 1849 1596 1850 *value = 0; 1597 1851 gl::GetInteger64v(pname, value); … … 1600 1854 void GraphicsContextGLOpenGL::getInteger64i_v(GCGLenum pname, GCGLuint index, GCGLint64* value) 1601 1855 { 1602 makeContextCurrent(); 1856 if (!makeContextCurrent()) 1857 return; 1858 1603 1859 *value = 0; 1604 1860 gl::GetInteger64i_v(pname, index, value); … … 1607 1863 void GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv(GCGLenum target, GCGLenum attachment, GCGLenum pname, GCGLint* value) 1608 1864 { 1609 makeContextCurrent(); 1865 if (!makeContextCurrent()) 1866 return; 1867 1610 1868 if (attachment == DEPTH_STENCIL_ATTACHMENT) 1611 1869 attachment = DEPTH_ATTACHMENT; // Or STENCIL_ATTACHMENT, either works. … … 1615 1873 void GraphicsContextGLOpenGL::getProgramiv(PlatformGLObject program, GCGLenum pname, GCGLint* value) 1616 1874 { 1617 makeContextCurrent(); 1875 if (!makeContextCurrent()) 1876 return; 1877 1618 1878 gl::GetProgramiv(program, pname, value); 1619 1879 } … … 1643 1903 ASSERT(program); 1644 1904 1645 makeContextCurrent(); 1905 if (!makeContextCurrent()) 1906 return String(); 1907 1646 1908 GLint length = 0; 1647 1909 gl::GetProgramiv(program, GL_INFO_LOG_LENGTH, &length); … … 1662 1924 void GraphicsContextGLOpenGL::getRenderbufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value) 1663 1925 { 1664 makeContextCurrent(); 1926 if (!makeContextCurrent()) 1927 return; 1928 1665 1929 gl::GetRenderbufferParameteriv(target, pname, value); 1666 1930 } … … 1670 1934 ASSERT(shader); 1671 1935 1672 makeContextCurrent(); 1936 if (!makeContextCurrent()) 1937 return; 1938 1673 1939 gl::GetShaderiv(shader, pname, value); 1674 1940 } … … 1678 1944 ASSERT(shader); 1679 1945 1680 makeContextCurrent(); 1946 if (!makeContextCurrent()) 1947 return String(); 1948 1681 1949 GLint length = 0; 1682 1950 gl::GetShaderiv(shader, GL_INFO_LOG_LENGTH, &length); … … 1699 1967 void GraphicsContextGLOpenGL::getTexParameterfv(GCGLenum target, GCGLenum pname, GCGLfloat* value) 1700 1968 { 1701 makeContextCurrent(); 1969 if (!makeContextCurrent()) 1970 return; 1971 1702 1972 gl::GetTexParameterfv(target, pname, value); 1703 1973 } … … 1705 1975 void GraphicsContextGLOpenGL::getTexParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value) 1706 1976 { 1707 makeContextCurrent(); 1977 if (!makeContextCurrent()) 1978 return; 1979 1708 1980 gl::GetTexParameteriv(target, pname, value); 1709 1981 } … … 1711 1983 void GraphicsContextGLOpenGL::getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value) 1712 1984 { 1713 makeContextCurrent(); 1985 if (!makeContextCurrent()) 1986 return; 1987 1714 1988 gl::GetUniformfv(program, location, value); 1715 1989 } … … 1717 1991 void GraphicsContextGLOpenGL::getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value) 1718 1992 { 1719 makeContextCurrent(); 1993 if (!makeContextCurrent()) 1994 return; 1995 1720 1996 gl::GetUniformiv(program, location, value); 1721 1997 } … … 1723 1999 void GraphicsContextGLOpenGL::getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) 1724 2000 { 1725 makeContextCurrent(); 2001 if (!makeContextCurrent()) 2002 return; 2003 1726 2004 gl::GetUniformuiv(program, location, value); 1727 2005 } … … 1731 2009 ASSERT(program); 1732 2010 1733 makeContextCurrent(); 2011 if (!makeContextCurrent()) 2012 return -1; 2013 1734 2014 return gl::GetUniformLocation(program, name.utf8().data()); 1735 2015 } … … 1737 2017 void GraphicsContextGLOpenGL::getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLfloat* value) 1738 2018 { 1739 makeContextCurrent(); 2019 if (!makeContextCurrent()) 2020 return; 2021 1740 2022 gl::GetVertexAttribfv(index, pname, value); 1741 2023 } … … 1743 2025 void GraphicsContextGLOpenGL::getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLint* value) 1744 2026 { 1745 makeContextCurrent(); 2027 if (!makeContextCurrent()) 2028 return; 2029 1746 2030 gl::GetVertexAttribiv(index, pname, value); 1747 2031 } … … 1749 2033 GCGLsizeiptr GraphicsContextGLOpenGL::getVertexAttribOffset(GCGLuint index, GCGLenum pname) 1750 2034 { 1751 makeContextCurrent(); 2035 if (!makeContextCurrent()) 2036 return 0; 1752 2037 1753 2038 GLvoid* pointer = 0; … … 1758 2043 void GraphicsContextGLOpenGL::texSubImage2D(GCGLenum target, GCGLint level, GCGLint xoff, GCGLint yoff, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, const void* pixels) 1759 2044 { 1760 makeContextCurrent(); 2045 if (!makeContextCurrent()) 2046 return; 1761 2047 1762 2048 // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size. … … 1767 2053 void GraphicsContextGLOpenGL::compressedTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLsizei imageSize, const void* data) 1768 2054 { 1769 makeContextCurrent(); 2055 if (!makeContextCurrent()) 2056 return; 2057 1770 2058 gl::CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); 1771 2059 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 1774 2062 void GraphicsContextGLOpenGL::compressedTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLsizei imageSize, const void* data) 1775 2063 { 1776 makeContextCurrent(); 2064 if (!makeContextCurrent()) 2065 return; 2066 1777 2067 gl::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); 1778 2068 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 1781 2071 PlatformGLObject GraphicsContextGLOpenGL::createBuffer() 1782 2072 { 1783 makeContextCurrent(); 2073 if (!makeContextCurrent()) 2074 return 0; 2075 1784 2076 GLuint o = 0; 1785 2077 gl::GenBuffers(1, &o); … … 1789 2081 PlatformGLObject GraphicsContextGLOpenGL::createFramebuffer() 1790 2082 { 1791 makeContextCurrent(); 2083 if (!makeContextCurrent()) 2084 return 0; 2085 1792 2086 GLuint o = 0; 1793 2087 gl::GenFramebuffers(1, &o); … … 1797 2091 PlatformGLObject GraphicsContextGLOpenGL::createProgram() 1798 2092 { 1799 makeContextCurrent(); 2093 if (!makeContextCurrent()) 2094 return 0; 2095 1800 2096 return gl::CreateProgram(); 1801 2097 } … … 1803 2099 PlatformGLObject GraphicsContextGLOpenGL::createRenderbuffer() 1804 2100 { 1805 makeContextCurrent(); 2101 if (!makeContextCurrent()) 2102 return 0; 2103 1806 2104 GLuint o = 0; 1807 2105 gl::GenRenderbuffers(1, &o); … … 1811 2109 PlatformGLObject GraphicsContextGLOpenGL::createShader(GCGLenum type) 1812 2110 { 1813 makeContextCurrent(); 2111 if (!makeContextCurrent()) 2112 return 0; 2113 1814 2114 return gl::CreateShader((type == FRAGMENT_SHADER) ? GL_FRAGMENT_SHADER : GL_VERTEX_SHADER); 1815 2115 } … … 1817 2117 PlatformGLObject GraphicsContextGLOpenGL::createTexture() 1818 2118 { 1819 makeContextCurrent(); 2119 if (!makeContextCurrent()) 2120 return 0; 2121 1820 2122 GLuint o = 0; 1821 2123 gl::GenTextures(1, &o); … … 1826 2128 void GraphicsContextGLOpenGL::deleteBuffer(PlatformGLObject buffer) 1827 2129 { 1828 makeContextCurrent(); 2130 if (!makeContextCurrent()) 2131 return; 2132 1829 2133 gl::DeleteBuffers(1, &buffer); 1830 2134 } … … 1832 2136 void GraphicsContextGLOpenGL::deleteFramebuffer(PlatformGLObject framebuffer) 1833 2137 { 1834 makeContextCurrent(); 2138 if (!makeContextCurrent()) 2139 return; 2140 1835 2141 // Make sure the framebuffer is not going to be used for drawing 1836 2142 // operations after it gets deleted. … … 1847 2153 void GraphicsContextGLOpenGL::deleteProgram(PlatformGLObject program) 1848 2154 { 1849 makeContextCurrent(); 2155 if (!makeContextCurrent()) 2156 return; 2157 1850 2158 gl::DeleteProgram(program); 1851 2159 } … … 1853 2161 void GraphicsContextGLOpenGL::deleteRenderbuffer(PlatformGLObject renderbuffer) 1854 2162 { 1855 makeContextCurrent(); 2163 if (!makeContextCurrent()) 2164 return; 2165 1856 2166 gl::DeleteRenderbuffers(1, &renderbuffer); 1857 2167 } … … 1859 2169 void GraphicsContextGLOpenGL::deleteShader(PlatformGLObject shader) 1860 2170 { 1861 makeContextCurrent(); 2171 if (!makeContextCurrent()) 2172 return; 2173 1862 2174 gl::DeleteShader(shader); 1863 2175 } … … 1865 2177 void GraphicsContextGLOpenGL::deleteTexture(PlatformGLObject texture) 1866 2178 { 1867 makeContextCurrent(); 2179 if (!makeContextCurrent()) 2180 return; 2181 1868 2182 m_state.boundTextureMap.removeIf([texture] (auto& keyValue) { 1869 2183 return keyValue.value.first == texture; … … 1921 2235 void GraphicsContextGLOpenGL::texImage2DDirect(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, const void* pixels) 1922 2236 { 1923 makeContextCurrent(); 2237 if (!makeContextCurrent()) 2238 return; 2239 1924 2240 if (!m_isForWebGL2 && m_extensions) 1925 2241 internalformat = m_extensions->adjustWebGL1TextureInternalFormat(internalformat, format, type); … … 1930 2246 void GraphicsContextGLOpenGL::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) 1931 2247 { 2248 if (!makeContextCurrent()) 2249 return; 2250 1932 2251 if (m_isForWebGL2) 1933 2252 gl::DrawArraysInstanced(mode, first, count, primcount); 1934 2253 else 1935 g etExtensions().drawArraysInstanced(mode, first, count, primcount);2254 gl::DrawArraysInstancedANGLE(mode, first, count, primcount); 1936 2255 checkGPUStatus(); 1937 2256 } … … 1939 2258 void GraphicsContextGLOpenGL::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset, GCGLsizei primcount) 1940 2259 { 2260 if (!makeContextCurrent()) 2261 return; 2262 1941 2263 if (m_isForWebGL2) 1942 2264 gl::DrawElementsInstanced(mode, count, type, reinterpret_cast<void*>(offset), primcount); 1943 2265 else 1944 g etExtensions().drawElementsInstanced(mode, count, type, offset, primcount);2266 gl::DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<void*>(offset), primcount); 1945 2267 checkGPUStatus(); 1946 2268 } … … 1948 2270 void GraphicsContextGLOpenGL::vertexAttribDivisor(GCGLuint index, GCGLuint divisor) 1949 2271 { 2272 if (!makeContextCurrent()) 2273 return; 2274 1950 2275 if (m_isForWebGL2) 1951 2276 gl::VertexAttribDivisor(index, divisor); 1952 2277 else 1953 g etExtensions().vertexAttribDivisor(index, divisor);2278 gl::VertexAttribDivisorANGLE(index, divisor); 1954 2279 } 1955 2280 … … 1957 2282 { 1958 2283 ASSERT(program); 1959 makeContextCurrent(); 2284 if (!makeContextCurrent()) 2285 return GL_INVALID_INDEX; 2286 1960 2287 return gl::GetUniformBlockIndex(program, uniformBlockName.utf8().data()); 1961 2288 } … … 1974 2301 { 1975 2302 ASSERT(program); 1976 makeContextCurrent(); 2303 if (!makeContextCurrent()) 2304 return String(); 2305 1977 2306 GLint maxLength = 0; 1978 2307 gl::GetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &maxLength); … … 1992 2321 { 1993 2322 ASSERT(program); 1994 makeContextCurrent(); 2323 if (!makeContextCurrent()) 2324 return; 2325 1995 2326 gl::UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding); 1996 2327 } … … 2000 2331 PlatformGLObject GraphicsContextGLOpenGL::createQuery() 2001 2332 { 2002 makeContextCurrent(); 2333 if (!makeContextCurrent()) 2334 return 0; 2335 2003 2336 GLuint name = 0; 2004 2337 gl::GenQueries(1, &name); … … 2008 2341 void GraphicsContextGLOpenGL::beginQuery(GCGLenum target, PlatformGLObject query) 2009 2342 { 2010 makeContextCurrent(); 2343 if (!makeContextCurrent()) 2344 return; 2345 2011 2346 gl::BeginQuery(target, query); 2012 2347 } … … 2014 2349 void GraphicsContextGLOpenGL::endQuery(GCGLenum target) 2015 2350 { 2016 makeContextCurrent(); 2351 if (!makeContextCurrent()) 2352 return; 2353 2017 2354 gl::EndQuery(target); 2018 2355 } … … 2020 2357 void GraphicsContextGLOpenGL::getQueryObjectuiv(GCGLuint id, GCGLenum pname, GCGLuint* params) 2021 2358 { 2022 makeContextCurrent(); 2359 if (!makeContextCurrent()) 2360 return; 2361 2023 2362 gl::GetQueryObjectuiv(id, pname, params); 2024 2363 } … … 2028 2367 PlatformGLObject GraphicsContextGLOpenGL::createTransformFeedback() 2029 2368 { 2030 makeContextCurrent(); 2369 if (!makeContextCurrent()) 2370 return 0; 2371 2031 2372 GLuint name = 0; 2032 2373 gl::GenTransformFeedbacks(1, &name); … … 2036 2377 void GraphicsContextGLOpenGL::deleteTransformFeedback(PlatformGLObject transformFeedback) 2037 2378 { 2038 makeContextCurrent(); 2379 if (!makeContextCurrent()) 2380 return; 2381 2039 2382 gl::DeleteTransformFeedbacks(1, &transformFeedback); 2040 2383 } … … 2042 2385 GCGLboolean GraphicsContextGLOpenGL::isTransformFeedback(PlatformGLObject transformFeedback) 2043 2386 { 2044 makeContextCurrent(); 2387 if (!makeContextCurrent()) 2388 return GL_FALSE; 2389 2045 2390 return gl::IsTransformFeedback(transformFeedback); 2046 2391 } … … 2048 2393 void GraphicsContextGLOpenGL::bindTransformFeedback(GCGLenum target, PlatformGLObject transformFeedback) 2049 2394 { 2050 makeContextCurrent(); 2395 if (!makeContextCurrent()) 2396 return; 2397 2051 2398 gl::BindTransformFeedback(target, transformFeedback); 2052 2399 } … … 2054 2401 void GraphicsContextGLOpenGL::beginTransformFeedback(GCGLenum primitiveMode) 2055 2402 { 2056 makeContextCurrent(); 2403 if (!makeContextCurrent()) 2404 return; 2405 2057 2406 gl::BeginTransformFeedback(primitiveMode); 2058 2407 } … … 2060 2409 void GraphicsContextGLOpenGL::endTransformFeedback() 2061 2410 { 2062 makeContextCurrent(); 2411 if (!makeContextCurrent()) 2412 return; 2413 2063 2414 gl::EndTransformFeedback(); 2064 2415 } … … 2066 2417 void GraphicsContextGLOpenGL::transformFeedbackVaryings(PlatformGLObject program, const Vector<String>& varyings, GCGLenum bufferMode) 2067 2418 { 2419 if (!makeContextCurrent()) 2420 return; 2421 2068 2422 Vector<CString> convertedVaryings = varyings.map([](const String& varying) { 2069 2423 return varying.utf8(); … … 2072 2426 return varying.data(); 2073 2427 }); 2074 makeContextCurrent(); 2428 2075 2429 gl::TransformFeedbackVaryings(program, pointersToVaryings.size(), pointersToVaryings.data(), bufferMode); 2076 2430 } … … 2078 2432 void GraphicsContextGLOpenGL::getTransformFeedbackVarying(PlatformGLObject program, GCGLuint index, ActiveInfo& info) 2079 2433 { 2080 makeContextCurrent(); 2434 if (!makeContextCurrent()) 2435 return; 2436 2081 2437 GCGLsizei bufSize = 0; 2082 2438 gl::GetProgramiv(program, GraphicsContextGLOpenGL::TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &bufSize); … … 2098 2454 void GraphicsContextGLOpenGL::bindBufferBase(GCGLenum target, GCGLuint index, PlatformGLObject buffer) 2099 2455 { 2100 makeContextCurrent(); 2456 if (!makeContextCurrent()) 2457 return; 2458 2101 2459 gl::BindBufferBase(target, index, buffer); 2102 2460 } … … 2132 2490 void GraphicsContextGLOpenGL::blitFramebuffer(GCGLint srcX0, GCGLint srcY0, GCGLint srcX1, GCGLint srcY1, GCGLint dstX0, GCGLint dstY0, GCGLint dstX1, GCGLint dstY1, GCGLbitfield mask, GCGLenum filter) 2133 2491 { 2492 if (!makeContextCurrent()) 2493 return; 2494 2134 2495 gl::BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); 2135 2496 } … … 2137 2498 void GraphicsContextGLOpenGL::framebufferTextureLayer(GCGLenum target, GCGLenum attachment, PlatformGLObject texture, GCGLint level, GCGLint layer) 2138 2499 { 2500 if (!makeContextCurrent()) 2501 return; 2502 2139 2503 gl::FramebufferTextureLayer(target, attachment, texture, level, layer); 2140 2504 } … … 2142 2506 void GraphicsContextGLOpenGL::invalidateFramebuffer(GCGLenum target, GCGLsizei numAttachments, const GCGLenum* attachments) 2143 2507 { 2508 if (!makeContextCurrent()) 2509 return; 2510 2144 2511 gl::InvalidateFramebuffer(target, numAttachments, attachments); 2145 2512 } … … 2147 2514 void GraphicsContextGLOpenGL::invalidateSubFramebuffer(GCGLenum target, GCGLsizei numAttachments, const GCGLenum* attachments, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height) 2148 2515 { 2516 if (!makeContextCurrent()) 2517 return; 2518 2149 2519 gl::InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height); 2150 2520 } … … 2152 2522 void GraphicsContextGLOpenGL::readBuffer(GCGLenum src) 2153 2523 { 2524 if (!makeContextCurrent()) 2525 return; 2526 2154 2527 gl::ReadBuffer(src); 2155 2528 } … … 2157 2530 void GraphicsContextGLOpenGL::copyTexSubImage3D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint zoffset, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height) 2158 2531 { 2159 makeContextCurrent(); 2532 if (!makeContextCurrent()) 2533 return; 2534 2160 2535 auto attrs = contextAttributes(); 2161 2536 GCGLenum framebufferTarget = m_isForWebGL2 ? GraphicsContextGL::READ_FRAMEBUFFER : GraphicsContextGL::FRAMEBUFFER; … … 2172 2547 GCGLint GraphicsContextGLOpenGL::getFragDataLocation(PlatformGLObject program, const String& name) 2173 2548 { 2174 makeContextCurrent(); 2549 if (!makeContextCurrent()) 2550 return -1; 2551 2175 2552 return gl::GetFragDataLocation(program, name.utf8().data()); 2176 2553 } … … 2178 2555 void GraphicsContextGLOpenGL::uniform1ui(GCGLint location, GCGLuint v0) 2179 2556 { 2180 makeContextCurrent(); 2557 if (!makeContextCurrent()) 2558 return; 2559 2181 2560 gl::Uniform1ui(location, v0); 2182 2561 } … … 2184 2563 void GraphicsContextGLOpenGL::uniform2ui(GCGLint location, GCGLuint v0, GCGLuint v1) 2185 2564 { 2186 makeContextCurrent(); 2565 if (!makeContextCurrent()) 2566 return; 2567 2187 2568 gl::Uniform2ui(location, v0, v1); 2188 2569 } … … 2190 2571 void GraphicsContextGLOpenGL::uniform3ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2) 2191 2572 { 2192 makeContextCurrent(); 2573 if (!makeContextCurrent()) 2574 return; 2575 2193 2576 gl::Uniform3ui(location, v0, v1, v2); 2194 2577 } … … 2196 2579 void GraphicsContextGLOpenGL::uniform4ui(GCGLint location, GCGLuint v0, GCGLuint v1, GCGLuint v2, GCGLuint v3) 2197 2580 { 2198 makeContextCurrent(); 2581 if (!makeContextCurrent()) 2582 return; 2583 2199 2584 gl::Uniform4ui(location, v0, v1, v2, v3); 2200 2585 } … … 2202 2587 void GraphicsContextGLOpenGL::uniform1uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength) 2203 2588 { 2204 makeContextCurrent(); 2589 if (!makeContextCurrent()) 2590 return; 2591 2205 2592 gl::Uniform1uiv(location, srcLength, data + srcOffset); 2206 2593 } … … 2208 2595 void GraphicsContextGLOpenGL::uniform2uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength) 2209 2596 { 2210 makeContextCurrent(); 2597 if (!makeContextCurrent()) 2598 return; 2599 2211 2600 gl::Uniform2uiv(location, srcLength, data + srcOffset); 2212 2601 } … … 2214 2603 void GraphicsContextGLOpenGL::uniform3uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength) 2215 2604 { 2216 makeContextCurrent(); 2605 if (!makeContextCurrent()) 2606 return; 2607 2217 2608 gl::Uniform3uiv(location, srcLength, data + srcOffset); 2218 2609 } … … 2220 2611 void GraphicsContextGLOpenGL::uniform4uiv(GCGLint location, const GCGLuint* data, GCGLuint srcOffset, GCGLuint srcLength) 2221 2612 { 2222 makeContextCurrent(); 2613 if (!makeContextCurrent()) 2614 return; 2615 2223 2616 gl::Uniform4uiv(location, srcLength, data + srcOffset); 2224 2617 } … … 2226 2619 void GraphicsContextGLOpenGL::uniformMatrix2x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2227 2620 { 2228 makeContextCurrent(); 2621 if (!makeContextCurrent()) 2622 return; 2623 2229 2624 gl::UniformMatrix2x3fv(location, srcLength, transpose, data + srcOffset); 2230 2625 } … … 2232 2627 void GraphicsContextGLOpenGL::uniformMatrix3x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2233 2628 { 2234 makeContextCurrent(); 2629 if (!makeContextCurrent()) 2630 return; 2631 2235 2632 gl::UniformMatrix3x2fv(location, srcLength, transpose, data + srcOffset); 2236 2633 } … … 2238 2635 void GraphicsContextGLOpenGL::uniformMatrix2x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2239 2636 { 2240 makeContextCurrent(); 2637 if (!makeContextCurrent()) 2638 return; 2639 2241 2640 gl::UniformMatrix2x4fv(location, srcLength, transpose, data + srcOffset); 2242 2641 } … … 2244 2643 void GraphicsContextGLOpenGL::uniformMatrix4x2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2245 2644 { 2246 makeContextCurrent(); 2645 if (!makeContextCurrent()) 2646 return; 2647 2247 2648 gl::UniformMatrix4x2fv(location, srcLength, transpose, data + srcOffset); 2248 2649 } … … 2250 2651 void GraphicsContextGLOpenGL::uniformMatrix3x4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2251 2652 { 2252 makeContextCurrent(); 2653 if (!makeContextCurrent()) 2654 return; 2655 2253 2656 gl::UniformMatrix3x4fv(location, srcLength, transpose, data + srcOffset); 2254 2657 } … … 2256 2659 void GraphicsContextGLOpenGL::uniformMatrix4x3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2257 2660 { 2258 makeContextCurrent(); 2661 if (!makeContextCurrent()) 2662 return; 2663 2259 2664 gl::UniformMatrix4x3fv(location, srcLength, transpose, data + srcOffset); 2260 2665 } … … 2262 2667 void GraphicsContextGLOpenGL::vertexAttribI4i(GCGLuint index, GCGLint x, GCGLint y, GCGLint z, GCGLint w) 2263 2668 { 2264 makeContextCurrent(); 2669 if (!makeContextCurrent()) 2670 return; 2671 2265 2672 gl::VertexAttribI4i(index, x, y, z, w); 2266 2673 } … … 2268 2675 void GraphicsContextGLOpenGL::vertexAttribI4iv(GCGLuint index, const GCGLint* values) 2269 2676 { 2270 makeContextCurrent(); 2677 if (!makeContextCurrent()) 2678 return; 2679 2271 2680 gl::VertexAttribI4iv(index, values); 2272 2681 } … … 2274 2683 void GraphicsContextGLOpenGL::vertexAttribI4ui(GCGLuint index, GCGLuint x, GCGLuint y, GCGLuint z, GCGLuint w) 2275 2684 { 2276 makeContextCurrent(); 2685 if (!makeContextCurrent()) 2686 return; 2687 2277 2688 gl::VertexAttribI4ui(index, x, y, z, w); 2278 2689 } … … 2280 2691 void GraphicsContextGLOpenGL::vertexAttribI4uiv(GCGLuint index, const GCGLuint* values) 2281 2692 { 2282 makeContextCurrent(); 2693 if (!makeContextCurrent()) 2694 return; 2695 2283 2696 gl::VertexAttribI4uiv(index, values); 2284 2697 } … … 2286 2699 void GraphicsContextGLOpenGL::drawRangeElements(GCGLenum mode, GCGLuint start, GCGLuint end, GCGLsizei count, GCGLenum type, GCGLintptr offset) 2287 2700 { 2701 if (!makeContextCurrent()) 2702 return; 2703 2288 2704 gl::DrawRangeElements(mode, start, end, count, type, reinterpret_cast<void*>(offset)); 2289 2705 } … … 2291 2707 void GraphicsContextGLOpenGL::drawBuffers(GCGLsizei n, const GCGLenum* bufs) 2292 2708 { 2709 if (!makeContextCurrent()) 2710 return; 2711 2293 2712 gl::DrawBuffers(n, bufs); 2294 2713 } … … 2296 2715 void GraphicsContextGLOpenGL::clearBufferiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLint* values, GCGLuint srcOffset) 2297 2716 { 2717 if (!makeContextCurrent()) 2718 return; 2719 2298 2720 gl::ClearBufferiv(buffer, drawbuffer, values + srcOffset); 2299 2721 } … … 2301 2723 void GraphicsContextGLOpenGL::clearBufferuiv(GCGLenum buffer, GCGLint drawbuffer, const GCGLuint* values, GCGLuint srcOffset) 2302 2724 { 2725 if (!makeContextCurrent()) 2726 return; 2727 2303 2728 gl::ClearBufferuiv(buffer, drawbuffer, values + srcOffset); 2304 2729 } … … 2306 2731 void GraphicsContextGLOpenGL::clearBufferfv(GCGLenum buffer, GCGLint drawbuffer, const GCGLfloat* values, GCGLuint srcOffset) 2307 2732 { 2733 if (!makeContextCurrent()) 2734 return; 2735 2308 2736 gl::ClearBufferfv(buffer, drawbuffer, values + srcOffset); 2309 2737 } … … 2311 2739 void GraphicsContextGLOpenGL::clearBufferfi(GCGLenum buffer, GCGLint drawbuffer, GCGLfloat depth, GCGLint stencil) 2312 2740 { 2741 if (!makeContextCurrent()) 2742 return; 2743 2313 2744 gl::ClearBufferfi(buffer, drawbuffer, depth, stencil); 2314 2745 } … … 2316 2747 void GraphicsContextGLOpenGL::deleteQuery(PlatformGLObject query) 2317 2748 { 2318 makeContextCurrent(); 2749 if (!makeContextCurrent()) 2750 return; 2751 2319 2752 gl::DeleteQueries(1, &query); 2320 2753 } … … 2322 2755 GCGLboolean GraphicsContextGLOpenGL::isQuery(PlatformGLObject query) 2323 2756 { 2324 makeContextCurrent(); 2757 if (!makeContextCurrent()) 2758 return GL_FALSE; 2759 2325 2760 return gl::IsQuery(query); 2326 2761 } … … 2328 2763 PlatformGLObject GraphicsContextGLOpenGL::getQuery(GCGLenum target, GCGLenum pname) 2329 2764 { 2330 makeContextCurrent(); 2765 if (!makeContextCurrent()) 2766 return 0; 2767 2331 2768 GLint value; 2332 2769 gl::GetQueryiv(target, pname, &value); … … 2336 2773 PlatformGLObject GraphicsContextGLOpenGL::createSampler() 2337 2774 { 2338 makeContextCurrent(); 2775 if (!makeContextCurrent()) 2776 return 0; 2777 2339 2778 GLuint name = 0; 2340 2779 gl::GenSamplers(1, &name); … … 2344 2783 void GraphicsContextGLOpenGL::deleteSampler(PlatformGLObject sampler) 2345 2784 { 2346 makeContextCurrent(); 2785 if (!makeContextCurrent()) 2786 return; 2787 2347 2788 gl::DeleteSamplers(1, &sampler); 2348 2789 } … … 2350 2791 GCGLboolean GraphicsContextGLOpenGL::isSampler(PlatformGLObject sampler) 2351 2792 { 2352 makeContextCurrent(); 2793 if (!makeContextCurrent()) 2794 return GL_FALSE; 2795 2353 2796 return gl::IsSampler(sampler); 2354 2797 } … … 2356 2799 void GraphicsContextGLOpenGL::bindSampler(GCGLuint unit, PlatformGLObject sampler) 2357 2800 { 2358 makeContextCurrent(); 2801 if (!makeContextCurrent()) 2802 return; 2803 2359 2804 gl::BindSampler(unit, sampler); 2360 2805 } … … 2362 2807 void GraphicsContextGLOpenGL::samplerParameteri(PlatformGLObject sampler, GCGLenum pname, GCGLint param) 2363 2808 { 2364 makeContextCurrent(); 2809 if (!makeContextCurrent()) 2810 return; 2811 2365 2812 gl::SamplerParameteri(sampler, pname, param); 2366 2813 } … … 2368 2815 void GraphicsContextGLOpenGL::samplerParameterf(PlatformGLObject sampler, GCGLenum pname, GCGLfloat param) 2369 2816 { 2370 makeContextCurrent(); 2817 if (!makeContextCurrent()) 2818 return; 2819 2371 2820 gl::SamplerParameterf(sampler, pname, param); 2372 2821 } … … 2374 2823 void GraphicsContextGLOpenGL::getSamplerParameterfv(PlatformGLObject sampler, GCGLenum pname, GCGLfloat* value) 2375 2824 { 2376 makeContextCurrent(); 2825 if (!makeContextCurrent()) 2826 return; 2827 2377 2828 gl::GetSamplerParameterfv(sampler, pname, value); 2378 2829 } … … 2380 2831 void GraphicsContextGLOpenGL::getSamplerParameteriv(PlatformGLObject sampler, GCGLenum pname, GCGLint* value) 2381 2832 { 2382 makeContextCurrent(); 2833 if (!makeContextCurrent()) 2834 return; 2835 2383 2836 gl::GetSamplerParameteriv(sampler, pname, value); 2384 2837 } … … 2386 2839 GCGLsync GraphicsContextGLOpenGL::fenceSync(GCGLenum condition, GCGLbitfield flags) 2387 2840 { 2388 makeContextCurrent(); 2841 if (!makeContextCurrent()) 2842 return 0; 2843 2389 2844 return gl::FenceSync(condition, flags); 2390 2845 } … … 2392 2847 GCGLboolean GraphicsContextGLOpenGL::isSync(GCGLsync sync) 2393 2848 { 2394 makeContextCurrent(); 2849 if (!makeContextCurrent()) 2850 return GL_FALSE; 2851 2395 2852 return gl::IsSync(sync); 2396 2853 } … … 2398 2855 void GraphicsContextGLOpenGL::deleteSync(GCGLsync sync) 2399 2856 { 2400 makeContextCurrent(); 2857 if (!makeContextCurrent()) 2858 return; 2859 2401 2860 gl::DeleteSync(sync); 2402 2861 } … … 2404 2863 GCGLenum GraphicsContextGLOpenGL::clientWaitSync(GCGLsync sync, GCGLbitfield flags, GCGLuint64 timeout) 2405 2864 { 2406 makeContextCurrent(); 2865 if (!makeContextCurrent()) 2866 return GL_WAIT_FAILED; 2867 2407 2868 return gl::ClientWaitSync(sync, flags, timeout); 2408 2869 } … … 2410 2871 void GraphicsContextGLOpenGL::waitSync(GCGLsync sync, GCGLbitfield flags, GCGLint64 timeout) 2411 2872 { 2412 makeContextCurrent(); 2873 if (!makeContextCurrent()) 2874 return; 2875 2413 2876 gl::WaitSync(sync, flags, timeout); 2414 2877 } … … 2416 2879 void GraphicsContextGLOpenGL::getSynciv(GCGLsync sync, GCGLenum pname, GCGLsizei bufSize, GCGLint *value) 2417 2880 { 2418 makeContextCurrent(); 2881 if (!makeContextCurrent()) 2882 return; 2883 2419 2884 gl::GetSynciv(sync, pname, bufSize, nullptr, value); 2420 2885 } … … 2422 2887 void GraphicsContextGLOpenGL::pauseTransformFeedback() 2423 2888 { 2424 makeContextCurrent(); 2889 if (!makeContextCurrent()) 2890 return; 2891 2425 2892 gl::PauseTransformFeedback(); 2426 2893 } … … 2428 2895 void GraphicsContextGLOpenGL::resumeTransformFeedback() 2429 2896 { 2430 makeContextCurrent(); 2897 if (!makeContextCurrent()) 2898 return; 2899 2431 2900 gl::ResumeTransformFeedback(); 2432 2901 } … … 2434 2903 void GraphicsContextGLOpenGL::bindBufferRange(GCGLenum target, GCGLuint index, PlatformGLObject buffer, GCGLintptr offset, GCGLsizeiptr size) 2435 2904 { 2436 makeContextCurrent(); 2905 if (!makeContextCurrent()) 2906 return; 2907 2437 2908 gl::BindBufferRange(target, index, buffer, offset, size); 2438 2909 } … … 2441 2912 { 2442 2913 ASSERT(program); 2443 makeContextCurrent(); 2914 if (!makeContextCurrent()) 2915 return { }; 2916 2444 2917 Vector<CString> utf8 = uniformNames.map([](auto& x) { return x.utf8(); }); 2445 2918 Vector<const char*> cstr = utf8.map([](auto& x) { return x.data(); }); … … 2503 2976 void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2504 2977 { 2505 makeContextCurrent(); 2978 if (!makeContextCurrent()) 2979 return; 2980 2506 2981 gl::Uniform1fv(location, srcLength, data + srcOffset); 2507 2982 } … … 2509 2984 void GraphicsContextGLOpenGL::uniform2fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2510 2985 { 2511 makeContextCurrent(); 2986 if (!makeContextCurrent()) 2987 return; 2988 2512 2989 gl::Uniform2fv(location, srcLength, data + srcOffset); 2513 2990 } … … 2515 2992 void GraphicsContextGLOpenGL::uniform3fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2516 2993 { 2517 makeContextCurrent(); 2994 if (!makeContextCurrent()) 2995 return; 2996 2518 2997 gl::Uniform3fv(location, srcLength, data + srcOffset); 2519 2998 } … … 2521 3000 void GraphicsContextGLOpenGL::uniform4fv(GCGLint location, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2522 3001 { 2523 makeContextCurrent(); 3002 if (!makeContextCurrent()) 3003 return; 3004 2524 3005 gl::Uniform4fv(location, srcLength, data + srcOffset); 2525 3006 } … … 2527 3008 void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength) 2528 3009 { 2529 makeContextCurrent(); 3010 if (!makeContextCurrent()) 3011 return; 3012 2530 3013 gl::Uniform1iv(location, srcLength, data + srcOffset); 2531 3014 } … … 2533 3016 void GraphicsContextGLOpenGL::uniform2iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength) 2534 3017 { 2535 makeContextCurrent(); 3018 if (!makeContextCurrent()) 3019 return; 3020 2536 3021 gl::Uniform2iv(location, srcLength, data + srcOffset); 2537 3022 } … … 2539 3024 void GraphicsContextGLOpenGL::uniform3iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength) 2540 3025 { 2541 makeContextCurrent(); 3026 if (!makeContextCurrent()) 3027 return; 3028 2542 3029 gl::Uniform3iv(location, srcLength, data + srcOffset); 2543 3030 } … … 2545 3032 void GraphicsContextGLOpenGL::uniform4iv(GCGLint location, const GCGLint* data, GCGLuint srcOffset, GCGLuint srcLength) 2546 3033 { 2547 makeContextCurrent(); 3034 if (!makeContextCurrent()) 3035 return; 3036 2548 3037 gl::Uniform4iv(location, srcLength, data + srcOffset); 2549 3038 } … … 2551 3040 void GraphicsContextGLOpenGL::uniformMatrix2fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2552 3041 { 2553 makeContextCurrent(); 3042 if (!makeContextCurrent()) 3043 return; 3044 2554 3045 gl::UniformMatrix2fv(location, srcLength, transpose, data + srcOffset); 2555 3046 } … … 2557 3048 void GraphicsContextGLOpenGL::uniformMatrix3fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2558 3049 { 2559 makeContextCurrent(); 3050 if (!makeContextCurrent()) 3051 return; 3052 2560 3053 gl::UniformMatrix3fv(location, srcLength, transpose, data + srcOffset); 2561 3054 } … … 2563 3056 void GraphicsContextGLOpenGL::uniformMatrix4fv(GCGLint location, GCGLboolean transpose, const GCGLfloat* data, GCGLuint srcOffset, GCGLuint srcLength) 2564 3057 { 2565 makeContextCurrent(); 3058 if (!makeContextCurrent()) 3059 return; 3060 2566 3061 gl::UniformMatrix4fv(location, srcLength, transpose, data + srcOffset); 2567 3062 } -
trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm
r269686 r269768 388 388 { 389 389 GraphicsContextGLOpenGLManager::sharedManager().removeContext(this); 390 391 if (m_contextObj) { 390 if (makeContextCurrent()) { 392 391 GraphicsContextGLAttributes attrs = contextAttributes(); 393 makeContextCurrent(); // TODO: check result.394 392 gl::DeleteTextures(1, &m_texture); 395 393 … … 408 406 if (m_preserveDrawingBufferFBO) 409 407 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) { 415 412 auto recycledBuffer = [m_webGLLayer recycleBuffer]; 416 413 if (recycledBuffer.handle) … … 419 416 if (contentsHandle) 420 417 EGL_DestroySurface(m_displayObj, contentsHandle); 421 418 } 419 if (m_contextObj) { 422 420 EGL_MakeCurrent(m_displayObj, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); 423 421 EGL_DestroyContext(m_displayObj, m_contextObj); … … 553 551 void GraphicsContextGLOpenGL::updateCGLContext() 554 552 { 555 if (!m_contextObj) 556 return; 557 553 if (!makeContextCurrent()) 554 return; 558 555 LOG(WebGL, "Detected a mux switch or display reconfiguration. Call CGLUpdateContext. (%p)", this); 559 556 560 makeContextCurrent();561 557 EGLDeviceEXT device = nullptr; 562 558 EGL_QueryDisplayAttribEXT(m_displayObj, EGL_DEVICE_EXT, reinterpret_cast<EGLAttrib*>(&device)); -
trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.cpp
r269686 r269768 51 51 void ExtensionsGLOpenGL::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) 52 52 { 53 if (!m_context->makeContextCurrent()) 54 return; 55 53 56 ::glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); 54 57 } … … 56 59 void ExtensionsGLOpenGL::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) 57 60 { 61 if (!m_context->makeContextCurrent()) 62 return; 63 58 64 ::glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height); 59 65 } … … 61 67 PlatformGLObject ExtensionsGLOpenGL::createVertexArrayOES() 62 68 { 63 m_context->makeContextCurrent(); 69 if (!m_context->makeContextCurrent()) 70 return 0; 71 64 72 GLuint array = 0; 65 73 #if PLATFORM(GTK) || PLATFORM(WIN) … … 77 85 return; 78 86 79 m_context->makeContextCurrent(); 87 if (!m_context->makeContextCurrent()) 88 return; 89 80 90 #if PLATFORM(GTK) || PLATFORM(WIN) 81 91 if (isVertexArrayObjectSupported()) … … 91 101 return GL_FALSE; 92 102 93 m_context->makeContextCurrent(); 103 if (!m_context->makeContextCurrent()) 104 return GL_FALSE; 105 94 106 #if PLATFORM(GTK) || PLATFORM(WIN) 95 107 if (isVertexArrayObjectSupported()) … … 103 115 void ExtensionsGLOpenGL::bindVertexArrayOES(PlatformGLObject array) 104 116 { 105 m_context->makeContextCurrent(); 117 if (!m_context->makeContextCurrent()) 118 return; 119 106 120 #if PLATFORM(GTK) || PLATFORM(WIN) 107 121 if (isVertexArrayObjectSupported()) … … 197 211 void ExtensionsGLOpenGL::drawBuffersEXT(GCGLsizei n, const GCGLenum* bufs) 198 212 { 213 if (!m_context->makeContextCurrent()) 214 return; 215 199 216 // FIXME: implement support for other platforms. 200 217 #if PLATFORM(GTK) … … 208 225 void ExtensionsGLOpenGL::drawArraysInstanced(GCGLenum mode, GCGLint first, GCGLsizei count, GCGLsizei primcount) 209 226 { 210 m_context->makeContextCurrent(); 227 if (!m_context->makeContextCurrent()) 228 return; 229 211 230 #if PLATFORM(GTK) 212 231 ::glDrawArraysInstanced(mode, first, count, primcount); … … 221 240 void ExtensionsGLOpenGL::drawElementsInstanced(GCGLenum mode, GCGLsizei count, GCGLenum type, long long offset, GCGLsizei primcount) 222 241 { 223 m_context->makeContextCurrent(); 242 if (!m_context->makeContextCurrent()) 243 return; 244 224 245 #if PLATFORM(GTK) 225 246 ::glDrawElementsInstanced(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount); … … 235 256 void ExtensionsGLOpenGL::vertexAttribDivisor(GCGLuint index, GCGLuint divisor) 236 257 { 237 m_context->makeContextCurrent(); 258 if (!m_context->makeContextCurrent()) 259 return; 260 238 261 #if PLATFORM(GTK) 239 262 ::glVertexAttribDivisor(index, divisor); -
trunk/Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp
r269686 r269768 86 86 void ExtensionsGLOpenGLES::framebufferTexture2DMultisampleIMG(unsigned long target, unsigned long attachment, unsigned long textarget, unsigned texture, int level, unsigned long samples) 87 87 { 88 if (!m_context->makeContextCurrent()) 89 return; 88 90 if (m_glFramebufferTexture2DMultisampleIMG) 89 91 m_glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples); … … 94 96 void ExtensionsGLOpenGLES::renderbufferStorageMultisampleIMG(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) 95 97 { 98 if (!m_context->makeContextCurrent()) 99 return; 96 100 if (m_glRenderbufferStorageMultisampleIMG) 97 101 m_glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); … … 107 111 void ExtensionsGLOpenGLES::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) 108 112 { 113 if (!m_context->makeContextCurrent()) 114 return; 109 115 if (m_glRenderbufferStorageMultisampleIMG) 110 116 renderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); … … 130 136 PlatformGLObject ExtensionsGLOpenGLES::createVertexArrayOES() 131 137 { 132 m_context->makeContextCurrent();133 138 if (m_glGenVertexArraysOES) { 139 if (!m_context->makeContextCurrent()) 140 return 0; 134 141 GLuint array = 0; 135 142 m_glGenVertexArraysOES(1, &array); … … 145 152 if (!array) 146 153 return; 147 148 m_context->makeContextCurrent();149 if (m_glDeleteVertexArraysOES)154 if (m_glDeleteVertexArraysOES) { 155 if (!m_context->makeContextCurrent()) 156 return; 150 157 m_glDeleteVertexArraysOES(1, &array); 151 else 152 m_context->synthesizeGLError(GL_INVALID_OPERATION); 158 return; 159 } 160 m_context->synthesizeGLError(GL_INVALID_OPERATION); 153 161 } 154 162 … … 157 165 if (!array) 158 166 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; 162 170 return m_glIsVertexArrayOES(array); 163 171 } 164 172 m_context->synthesizeGLError(GL_INVALID_OPERATION); 165 173 return false; … … 168 176 void ExtensionsGLOpenGLES::bindVertexArrayOES(PlatformGLObject array) 169 177 { 170 m_context->makeContextCurrent(); 171 if (m_glBindVertexArrayOES) 178 if (m_glBindVertexArrayOES) { 179 if (!m_context->makeContextCurrent()) 180 return; 172 181 m_glBindVertexArrayOES(array); 173 else182 } else 174 183 m_context->synthesizeGLError(GL_INVALID_OPERATION); 175 184 } … … 189 198 return m_contextResetStatus; 190 199 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(); 193 203 if (reasonForReset != GL_NO_ERROR) 194 204 m_contextResetStatus = reasonForReset; … … 203 213 { 204 214 if (m_glReadnPixelsEXT) { 205 m_context->makeContextCurrent(); 215 if (!m_context->makeContextCurrent()) 216 return; 217 206 218 // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., 207 219 // all previous rendering calls should be done before reading pixels. … … 220 232 { 221 233 if (m_glGetnUniformfvEXT) { 222 m_context->makeContextCurrent(); 234 if (!m_context->makeContextCurrent()) 235 return; 236 223 237 m_glGetnUniformfvEXT(program, location, bufSize, params); 224 238 return; … … 231 245 { 232 246 if (m_glGetnUniformivEXT) { 233 m_context->makeContextCurrent(); 247 if (!m_context->makeContextCurrent()) 248 return; 249 234 250 m_glGetnUniformivEXT(program, location, bufSize, params); 235 251 return; … … 246 262 } 247 263 248 m_context->makeContextCurrent(); 264 if (!m_context->makeContextCurrent()) 265 return; 266 249 267 m_glDrawArraysInstancedANGLE(mode, first, count, primcount); 250 268 } … … 257 275 } 258 276 259 m_context->makeContextCurrent(); 277 if (!m_context->makeContextCurrent()) 278 return; 279 260 280 m_glDrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset)), primcount); 261 281 } … … 268 288 } 269 289 270 m_context->makeContextCurrent(); 290 if (!m_context->makeContextCurrent()) 291 return; 292 271 293 m_glVertexAttribDivisorANGLE(index, divisor); 272 294 } -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h
r269686 r269768 109 109 #endif 110 110 111 bool makeContextCurrent();112 111 #if PLATFORM(IOS_FAMILY) 113 112 enum class ReleaseBehavior { … … 518 517 GraphicsContextGLOpenGL(GraphicsContextGLAttributes, HostWindow*, Destination = Destination::Offscreen, GraphicsContextGLOpenGL* sharedContext = nullptr); 519 518 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; 520 522 521 523 // Take into account the user's requested context creation attributes, -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLBase.cpp
r269686 r269768 238 238 void GraphicsContextGLOpenGL::renderbufferStorage(GCGLenum target, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) 239 239 { 240 makeContextCurrent(); 240 if (!makeContextCurrent()) 241 return; 242 241 243 #if USE(OPENGL) 242 244 switch (internalformat) { … … 265 267 // whereas GLES2 return the number of vectors (each vector has 4 components). 266 268 // Therefore, the value returned by desktop GL needs to be divided by 4. 267 makeContextCurrent(); 269 if (!makeContextCurrent()) 270 return; 271 268 272 switch (pname) { 269 273 #if USE(OPENGL) … … 311 315 ASSERT(precision); 312 316 313 makeContextCurrent(); 317 if (!makeContextCurrent()) 318 return; 319 314 320 315 321 switch (precisionType) { … … 404 410 void GraphicsContextGLOpenGL::depthRange(GCGLclampf zNear, GCGLclampf zFar) 405 411 { 406 makeContextCurrent(); 412 if (!makeContextCurrent()) 413 return; 414 407 415 ::glDepthRange(zNear, zFar); 408 416 } … … 410 418 void GraphicsContextGLOpenGL::clearDepth(GCGLclampf depth) 411 419 { 412 makeContextCurrent(); 420 if (!makeContextCurrent()) 421 return; 422 413 423 ::glClearDepth(depth); 414 424 } … … 429 439 // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., 430 440 // all previous rendering calls should be done before reading pixels. 431 makeContextCurrent(); 441 if (!makeContextCurrent()) 442 return; 443 432 444 ::glFlush(); 433 445 ASSERT(m_state.boundReadFBO == m_state.boundDrawFBO); -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLCommon.cpp
r269686 r269768 201 201 return; 202 202 203 makeContextCurrent(); 203 if (!makeContextCurrent()) 204 return; 205 204 206 205 207 #if !USE(COORDINATED_GRAPHICS) … … 240 242 return; 241 243 242 makeContextCurrent(); 244 if (!makeContextCurrent()) 245 return; 246 243 247 244 248 bool mustRestoreFBO = false; … … 274 278 void GraphicsContextGLOpenGL::reshape(int width, int height) 275 279 { 276 if (!platformGraphicsContextGL())277 return;278 279 280 if (width == m_currentWidth && height == m_currentHeight) 280 281 return; … … 284 285 return; 285 286 287 if (!makeContextCurrent()) 288 return; 289 286 290 markContextChanged(); 287 291 … … 289 293 m_currentHeight = height; 290 294 291 makeContextCurrent();292 295 validateAttributes(); 293 296 … … 428 431 void GraphicsContextGLOpenGL::activeTexture(GCGLenum texture) 429 432 { 430 makeContextCurrent(); 433 if (!makeContextCurrent()) 434 return; 435 431 436 m_state.activeTextureUnit = texture; 432 437 ::glActiveTexture(texture); … … 437 442 ASSERT(program); 438 443 ASSERT(shader); 439 makeContextCurrent(); 444 if (!makeContextCurrent()) 445 return; 446 440 447 m_shaderProgramSymbolCountMap.remove(program); 441 448 ::glAttachShader(program, shader); … … 445 452 { 446 453 ASSERT(program); 447 makeContextCurrent(); 454 if (!makeContextCurrent()) 455 return; 448 456 449 457 String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_ATTRIBUTE, name); … … 454 462 void GraphicsContextGLOpenGL::bindBuffer(GCGLenum target, PlatformGLObject buffer) 455 463 { 456 makeContextCurrent(); 464 if (!makeContextCurrent()) 465 return; 466 457 467 ::glBindBuffer(target, buffer); 458 468 } … … 460 470 void GraphicsContextGLOpenGL::bindFramebuffer(GCGLenum target, PlatformGLObject buffer) 461 471 { 462 makeContextCurrent(); 472 if (!makeContextCurrent()) 473 return; 474 463 475 GLuint fbo; 464 476 if (buffer) … … 476 488 void GraphicsContextGLOpenGL::bindRenderbuffer(GCGLenum target, PlatformGLObject renderbuffer) 477 489 { 478 makeContextCurrent(); 490 if (!makeContextCurrent()) 491 return; 492 479 493 ::glBindRenderbufferEXT(target, renderbuffer); 480 494 } … … 483 497 void GraphicsContextGLOpenGL::bindTexture(GCGLenum target, PlatformGLObject texture) 484 498 { 485 makeContextCurrent(); 499 if (!makeContextCurrent()) 500 return; 501 486 502 m_state.setBoundTexture(m_state.activeTextureUnit, texture, target); 487 503 ::glBindTexture(target, texture); … … 490 506 void GraphicsContextGLOpenGL::blendColor(GCGLclampf red, GCGLclampf green, GCGLclampf blue, GCGLclampf alpha) 491 507 { 492 makeContextCurrent(); 508 if (!makeContextCurrent()) 509 return; 510 493 511 ::glBlendColor(red, green, blue, alpha); 494 512 } … … 496 514 void GraphicsContextGLOpenGL::blendEquation(GCGLenum mode) 497 515 { 498 makeContextCurrent(); 516 if (!makeContextCurrent()) 517 return; 518 499 519 ::glBlendEquation(mode); 500 520 } … … 502 522 void GraphicsContextGLOpenGL::blendEquationSeparate(GCGLenum modeRGB, GCGLenum modeAlpha) 503 523 { 504 makeContextCurrent(); 524 if (!makeContextCurrent()) 525 return; 526 505 527 ::glBlendEquationSeparate(modeRGB, modeAlpha); 506 528 } … … 509 531 void GraphicsContextGLOpenGL::blendFunc(GCGLenum sfactor, GCGLenum dfactor) 510 532 { 511 makeContextCurrent(); 533 if (!makeContextCurrent()) 534 return; 535 512 536 ::glBlendFunc(sfactor, dfactor); 513 537 } … … 515 539 void GraphicsContextGLOpenGL::blendFuncSeparate(GCGLenum srcRGB, GCGLenum dstRGB, GCGLenum srcAlpha, GCGLenum dstAlpha) 516 540 { 517 makeContextCurrent(); 541 if (!makeContextCurrent()) 542 return; 543 518 544 ::glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); 519 545 } … … 521 547 void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, GCGLenum usage) 522 548 { 523 makeContextCurrent(); 549 if (!makeContextCurrent()) 550 return; 551 524 552 ::glBufferData(target, size, 0, usage); 525 553 } … … 527 555 void GraphicsContextGLOpenGL::bufferData(GCGLenum target, GCGLsizeiptr size, const void* data, GCGLenum usage) 528 556 { 529 makeContextCurrent(); 557 if (!makeContextCurrent()) 558 return; 559 530 560 ::glBufferData(target, size, data, usage); 531 561 } … … 533 563 void GraphicsContextGLOpenGL::bufferSubData(GCGLenum target, GCGLintptr offset, GCGLsizeiptr size, const void* data) 534 564 { 535 makeContextCurrent(); 565 if (!makeContextCurrent()) 566 return; 567 536 568 ::glBufferSubData(target, offset, size, data); 537 569 } … … 539 571 GCGLenum GraphicsContextGLOpenGL::checkFramebufferStatus(GCGLenum target) 540 572 { 541 makeContextCurrent(); 573 if (!makeContextCurrent()) 574 return GL_INVALID_OPERATION; 575 542 576 return ::glCheckFramebufferStatusEXT(target); 543 577 } … … 545 579 void GraphicsContextGLOpenGL::clearColor(GCGLclampf r, GCGLclampf g, GCGLclampf b, GCGLclampf a) 546 580 { 547 makeContextCurrent(); 581 if (!makeContextCurrent()) 582 return; 583 548 584 ::glClearColor(r, g, b, a); 549 585 } … … 551 587 void GraphicsContextGLOpenGL::clear(GCGLbitfield mask) 552 588 { 553 makeContextCurrent(); 589 if (!makeContextCurrent()) 590 return; 591 554 592 ::glClear(mask); 555 593 checkGPUStatus(); … … 558 596 void GraphicsContextGLOpenGL::clearStencil(GCGLint s) 559 597 { 560 makeContextCurrent(); 598 if (!makeContextCurrent()) 599 return; 600 561 601 ::glClearStencil(s); 562 602 } … … 564 604 void GraphicsContextGLOpenGL::colorMask(GCGLboolean red, GCGLboolean green, GCGLboolean blue, GCGLboolean alpha) 565 605 { 566 makeContextCurrent(); 606 if (!makeContextCurrent()) 607 return; 608 567 609 ::glColorMask(red, green, blue, alpha); 568 610 } … … 571 613 { 572 614 ASSERT(shader); 573 makeContextCurrent(); 615 if (!makeContextCurrent()) 616 return; 574 617 575 618 // Turn on name mapping. Due to the way ANGLE name hashing works, we … … 633 676 { 634 677 ASSERT(shader); 635 makeContextCurrent(); 678 if (!makeContextCurrent()) 679 return; 636 680 637 681 HashMap<PlatformGLObject, ShaderSourceEntry>::iterator result = m_shaderSourceMap.find(shader); … … 667 711 void GraphicsContextGLOpenGL::copyTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLint border) 668 712 { 669 makeContextCurrent(); 713 if (!makeContextCurrent()) 714 return; 715 670 716 auto attrs = contextAttributes(); 671 717 … … 682 728 void GraphicsContextGLOpenGL::copyTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height) 683 729 { 684 makeContextCurrent(); 730 if (!makeContextCurrent()) 731 return; 732 685 733 auto attrs = contextAttributes(); 686 734 … … 697 745 void GraphicsContextGLOpenGL::cullFace(GCGLenum mode) 698 746 { 699 makeContextCurrent(); 747 if (!makeContextCurrent()) 748 return; 749 700 750 ::glCullFace(mode); 701 751 } … … 703 753 void GraphicsContextGLOpenGL::depthFunc(GCGLenum func) 704 754 { 705 makeContextCurrent(); 755 if (!makeContextCurrent()) 756 return; 757 706 758 ::glDepthFunc(func); 707 759 } … … 709 761 void GraphicsContextGLOpenGL::depthMask(GCGLboolean flag) 710 762 { 711 makeContextCurrent(); 763 if (!makeContextCurrent()) 764 return; 765 712 766 ::glDepthMask(flag); 713 767 } … … 717 771 ASSERT(program); 718 772 ASSERT(shader); 719 makeContextCurrent(); 773 if (!makeContextCurrent()) 774 return; 775 720 776 m_shaderProgramSymbolCountMap.remove(program); 721 777 ::glDetachShader(program, shader); … … 724 780 void GraphicsContextGLOpenGL::disable(GCGLenum cap) 725 781 { 726 makeContextCurrent(); 782 if (!makeContextCurrent()) 783 return; 784 727 785 ::glDisable(cap); 728 786 } … … 730 788 void GraphicsContextGLOpenGL::disableVertexAttribArray(GCGLuint index) 731 789 { 732 makeContextCurrent(); 790 if (!makeContextCurrent()) 791 return; 792 733 793 ::glDisableVertexAttribArray(index); 734 794 } … … 736 796 void GraphicsContextGLOpenGL::drawArrays(GCGLenum mode, GCGLint first, GCGLsizei count) 737 797 { 738 makeContextCurrent(); 798 if (!makeContextCurrent()) 799 return; 800 739 801 ::glDrawArrays(mode, first, count); 740 802 checkGPUStatus(); … … 743 805 void GraphicsContextGLOpenGL::drawElements(GCGLenum mode, GCGLsizei count, GCGLenum type, GCGLintptr offset) 744 806 { 745 makeContextCurrent(); 807 if (!makeContextCurrent()) 808 return; 809 746 810 ::glDrawElements(mode, count, type, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset))); 747 811 checkGPUStatus(); … … 750 814 void GraphicsContextGLOpenGL::enable(GCGLenum cap) 751 815 { 752 makeContextCurrent(); 816 if (!makeContextCurrent()) 817 return; 818 753 819 ::glEnable(cap); 754 820 } … … 756 822 void GraphicsContextGLOpenGL::enableVertexAttribArray(GCGLuint index) 757 823 { 758 makeContextCurrent(); 824 if (!makeContextCurrent()) 825 return; 826 759 827 ::glEnableVertexAttribArray(index); 760 828 } … … 762 830 void GraphicsContextGLOpenGL::finish() 763 831 { 764 makeContextCurrent(); 832 if (!makeContextCurrent()) 833 return; 834 765 835 ::glFinish(); 766 836 } … … 768 838 void GraphicsContextGLOpenGL::flush() 769 839 { 770 makeContextCurrent(); 840 if (!makeContextCurrent()) 841 return; 842 771 843 ::glFlush(); 772 844 } … … 774 846 void GraphicsContextGLOpenGL::framebufferRenderbuffer(GCGLenum target, GCGLenum attachment, GCGLenum renderbuffertarget, PlatformGLObject buffer) 775 847 { 776 makeContextCurrent(); 848 if (!makeContextCurrent()) 849 return; 850 777 851 ::glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, buffer); 778 852 } … … 780 854 void GraphicsContextGLOpenGL::framebufferTexture2D(GCGLenum target, GCGLenum attachment, GCGLenum textarget, PlatformGLObject texture, GCGLint level) 781 855 { 782 makeContextCurrent(); 856 if (!makeContextCurrent()) 857 return; 858 783 859 ::glFramebufferTexture2DEXT(target, attachment, textarget, texture, level); 784 860 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 787 863 void GraphicsContextGLOpenGL::frontFace(GCGLenum mode) 788 864 { 789 makeContextCurrent(); 865 if (!makeContextCurrent()) 866 return; 867 790 868 ::glFrontFace(mode); 791 869 } … … 793 871 void GraphicsContextGLOpenGL::generateMipmap(GCGLenum target) 794 872 { 795 makeContextCurrent(); 873 if (!makeContextCurrent()) 874 return; 875 796 876 ::glGenerateMipmap(target); 797 877 } … … 803 883 return false; 804 884 } 805 makeContextCurrent(); 885 if (!makeContextCurrent()) 886 return false; 887 806 888 GLint maxAttributeSize = 0; 807 889 ::glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize); … … 849 931 } 850 932 851 makeContextCurrent(); 933 if (!makeContextCurrent()) 934 return false; 935 852 936 GLint maxUniformSize = 0; 853 937 ::glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize); … … 895 979 return; 896 980 } 897 makeContextCurrent(); 981 if (!makeContextCurrent()) 982 return; 983 898 984 ::glGetAttachedShaders(program, maxCount, count, shaders); 899 985 } … … 1038 1124 return -1; 1039 1125 1040 makeContextCurrent(); 1126 if (!makeContextCurrent()) 1127 return -1; 1128 1041 1129 1042 1130 String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_ATTRIBUTE, name); … … 1050 1138 return -1; 1051 1139 1052 makeContextCurrent(); 1140 if (!makeContextCurrent()) 1141 return -1; 1142 1053 1143 1054 1144 return ::glGetAttribLocation(program, name.utf8().data()); … … 1057 1147 bool GraphicsContextGLOpenGL::moveErrorsToSyntheticErrorList() 1058 1148 { 1059 makeContextCurrent(); 1149 if (!makeContextCurrent()) 1150 return false; 1151 1060 1152 bool movedAnError = false; 1061 1153 … … 1084 1176 } 1085 1177 1086 makeContextCurrent(); 1178 if (!makeContextCurrent()) 1179 return GL_INVALID_OPERATION; 1180 1087 1181 return ::glGetError(); 1088 1182 } … … 1090 1184 String GraphicsContextGLOpenGL::getString(GCGLenum name) 1091 1185 { 1092 makeContextCurrent(); 1186 if (!makeContextCurrent()) 1187 return String(); 1188 1093 1189 return String(reinterpret_cast<const char*>(::glGetString(name))); 1094 1190 } … … 1096 1192 void GraphicsContextGLOpenGL::hint(GCGLenum target, GCGLenum mode) 1097 1193 { 1098 makeContextCurrent(); 1194 if (!makeContextCurrent()) 1195 return; 1196 1099 1197 ::glHint(target, mode); 1100 1198 } … … 1105 1203 return GL_FALSE; 1106 1204 1107 makeContextCurrent(); 1205 if (!makeContextCurrent()) 1206 return GL_FALSE; 1207 1108 1208 return ::glIsBuffer(buffer); 1109 1209 } … … 1111 1211 GCGLboolean GraphicsContextGLOpenGL::isEnabled(GCGLenum cap) 1112 1212 { 1113 makeContextCurrent(); 1213 if (!makeContextCurrent()) 1214 return GL_FALSE; 1215 1114 1216 return ::glIsEnabled(cap); 1115 1217 } … … 1120 1222 return GL_FALSE; 1121 1223 1122 makeContextCurrent(); 1224 if (!makeContextCurrent()) 1225 return GL_FALSE; 1226 1123 1227 return ::glIsFramebufferEXT(framebuffer); 1124 1228 } … … 1129 1233 return GL_FALSE; 1130 1234 1131 makeContextCurrent(); 1235 if (!makeContextCurrent()) 1236 return GL_FALSE; 1237 1132 1238 return ::glIsProgram(program); 1133 1239 } … … 1138 1244 return GL_FALSE; 1139 1245 1140 makeContextCurrent(); 1246 if (!makeContextCurrent()) 1247 return GL_FALSE; 1248 1141 1249 return ::glIsRenderbufferEXT(renderbuffer); 1142 1250 } … … 1147 1255 return GL_FALSE; 1148 1256 1149 makeContextCurrent(); 1257 if (!makeContextCurrent()) 1258 return GL_FALSE; 1259 1150 1260 return ::glIsShader(shader); 1151 1261 } … … 1156 1266 return GL_FALSE; 1157 1267 1158 makeContextCurrent(); 1268 if (!makeContextCurrent()) 1269 return GL_FALSE; 1270 1159 1271 return ::glIsTexture(texture); 1160 1272 } … … 1162 1274 void GraphicsContextGLOpenGL::lineWidth(GCGLfloat width) 1163 1275 { 1164 makeContextCurrent(); 1276 if (!makeContextCurrent()) 1277 return; 1278 1165 1279 ::glLineWidth(width); 1166 1280 } … … 1169 1283 { 1170 1284 ASSERT(program); 1171 makeContextCurrent(); 1285 if (!makeContextCurrent()) 1286 return; 1287 1172 1288 1173 1289 GCGLsizei count = 0; … … 1183 1299 void GraphicsContextGLOpenGL::pixelStorei(GCGLenum pname, GCGLint param) 1184 1300 { 1185 makeContextCurrent(); 1301 if (!makeContextCurrent()) 1302 return; 1303 1186 1304 ::glPixelStorei(pname, param); 1187 1305 } … … 1189 1307 void GraphicsContextGLOpenGL::polygonOffset(GCGLfloat factor, GCGLfloat units) 1190 1308 { 1191 makeContextCurrent(); 1309 if (!makeContextCurrent()) 1310 return; 1311 1192 1312 ::glPolygonOffset(factor, units); 1193 1313 } … … 1195 1315 void GraphicsContextGLOpenGL::sampleCoverage(GCGLclampf value, GCGLboolean invert) 1196 1316 { 1197 makeContextCurrent(); 1317 if (!makeContextCurrent()) 1318 return; 1319 1198 1320 ::glSampleCoverage(value, invert); 1199 1321 } … … 1201 1323 void GraphicsContextGLOpenGL::scissor(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height) 1202 1324 { 1203 makeContextCurrent(); 1325 if (!makeContextCurrent()) 1326 return; 1327 1204 1328 ::glScissor(x, y, width, height); 1205 1329 } … … 1209 1333 ASSERT(shader); 1210 1334 1211 makeContextCurrent(); 1335 if (!makeContextCurrent()) 1336 return; 1337 1212 1338 1213 1339 ShaderSourceEntry entry; … … 1220 1346 void GraphicsContextGLOpenGL::stencilFunc(GCGLenum func, GCGLint ref, GCGLuint mask) 1221 1347 { 1222 makeContextCurrent(); 1348 if (!makeContextCurrent()) 1349 return; 1350 1223 1351 ::glStencilFunc(func, ref, mask); 1224 1352 } … … 1226 1354 void GraphicsContextGLOpenGL::stencilFuncSeparate(GCGLenum face, GCGLenum func, GCGLint ref, GCGLuint mask) 1227 1355 { 1228 makeContextCurrent(); 1356 if (!makeContextCurrent()) 1357 return; 1358 1229 1359 ::glStencilFuncSeparate(face, func, ref, mask); 1230 1360 } … … 1232 1362 void GraphicsContextGLOpenGL::stencilMask(GCGLuint mask) 1233 1363 { 1234 makeContextCurrent(); 1364 if (!makeContextCurrent()) 1365 return; 1366 1235 1367 ::glStencilMask(mask); 1236 1368 } … … 1238 1370 void GraphicsContextGLOpenGL::stencilMaskSeparate(GCGLenum face, GCGLuint mask) 1239 1371 { 1240 makeContextCurrent(); 1372 if (!makeContextCurrent()) 1373 return; 1374 1241 1375 ::glStencilMaskSeparate(face, mask); 1242 1376 } … … 1244 1378 void GraphicsContextGLOpenGL::stencilOp(GCGLenum fail, GCGLenum zfail, GCGLenum zpass) 1245 1379 { 1246 makeContextCurrent(); 1380 if (!makeContextCurrent()) 1381 return; 1382 1247 1383 ::glStencilOp(fail, zfail, zpass); 1248 1384 } … … 1250 1386 void GraphicsContextGLOpenGL::stencilOpSeparate(GCGLenum face, GCGLenum fail, GCGLenum zfail, GCGLenum zpass) 1251 1387 { 1252 makeContextCurrent(); 1388 if (!makeContextCurrent()) 1389 return; 1390 1253 1391 ::glStencilOpSeparate(face, fail, zfail, zpass); 1254 1392 } … … 1256 1394 void GraphicsContextGLOpenGL::texParameterf(GCGLenum target, GCGLenum pname, GCGLfloat value) 1257 1395 { 1258 makeContextCurrent(); 1396 if (!makeContextCurrent()) 1397 return; 1398 1259 1399 ::glTexParameterf(target, pname, value); 1260 1400 } … … 1262 1402 void GraphicsContextGLOpenGL::texParameteri(GCGLenum target, GCGLenum pname, GCGLint value) 1263 1403 { 1264 makeContextCurrent(); 1404 if (!makeContextCurrent()) 1405 return; 1406 1265 1407 ::glTexParameteri(target, pname, value); 1266 1408 } … … 1268 1410 void GraphicsContextGLOpenGL::uniform1f(GCGLint location, GCGLfloat v0) 1269 1411 { 1270 makeContextCurrent(); 1412 if (!makeContextCurrent()) 1413 return; 1414 1271 1415 ::glUniform1f(location, v0); 1272 1416 } … … 1274 1418 void GraphicsContextGLOpenGL::uniform1fv(GCGLint location, GCGLsizei size, const GCGLfloat* array) 1275 1419 { 1276 makeContextCurrent(); 1420 if (!makeContextCurrent()) 1421 return; 1422 1277 1423 ::glUniform1fv(location, size, array); 1278 1424 } … … 1280 1426 void GraphicsContextGLOpenGL::uniform2f(GCGLint location, GCGLfloat v0, GCGLfloat v1) 1281 1427 { 1282 makeContextCurrent(); 1428 if (!makeContextCurrent()) 1429 return; 1430 1283 1431 ::glUniform2f(location, v0, v1); 1284 1432 } … … 1287 1435 { 1288 1436 // FIXME: length needs to be a multiple of 2. 1289 makeContextCurrent(); 1437 if (!makeContextCurrent()) 1438 return; 1439 1290 1440 ::glUniform2fv(location, size, array); 1291 1441 } … … 1293 1443 void GraphicsContextGLOpenGL::uniform3f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2) 1294 1444 { 1295 makeContextCurrent(); 1445 if (!makeContextCurrent()) 1446 return; 1447 1296 1448 ::glUniform3f(location, v0, v1, v2); 1297 1449 } … … 1300 1452 { 1301 1453 // FIXME: length needs to be a multiple of 3. 1302 makeContextCurrent(); 1454 if (!makeContextCurrent()) 1455 return; 1456 1303 1457 ::glUniform3fv(location, size, array); 1304 1458 } … … 1306 1460 void GraphicsContextGLOpenGL::uniform4f(GCGLint location, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3) 1307 1461 { 1308 makeContextCurrent(); 1462 if (!makeContextCurrent()) 1463 return; 1464 1309 1465 ::glUniform4f(location, v0, v1, v2, v3); 1310 1466 } … … 1313 1469 { 1314 1470 // FIXME: length needs to be a multiple of 4. 1315 makeContextCurrent(); 1471 if (!makeContextCurrent()) 1472 return; 1473 1316 1474 ::glUniform4fv(location, size, array); 1317 1475 } … … 1319 1477 void GraphicsContextGLOpenGL::uniform1i(GCGLint location, GCGLint v0) 1320 1478 { 1321 makeContextCurrent(); 1479 if (!makeContextCurrent()) 1480 return; 1481 1322 1482 ::glUniform1i(location, v0); 1323 1483 } … … 1325 1485 void GraphicsContextGLOpenGL::uniform1iv(GCGLint location, GCGLsizei size, const GCGLint* array) 1326 1486 { 1327 makeContextCurrent(); 1487 if (!makeContextCurrent()) 1488 return; 1489 1328 1490 ::glUniform1iv(location, size, array); 1329 1491 } … … 1331 1493 void GraphicsContextGLOpenGL::uniform2i(GCGLint location, GCGLint v0, GCGLint v1) 1332 1494 { 1333 makeContextCurrent(); 1495 if (!makeContextCurrent()) 1496 return; 1497 1334 1498 ::glUniform2i(location, v0, v1); 1335 1499 } … … 1338 1502 { 1339 1503 // FIXME: length needs to be a multiple of 2. 1340 makeContextCurrent(); 1504 if (!makeContextCurrent()) 1505 return; 1506 1341 1507 ::glUniform2iv(location, size, array); 1342 1508 } … … 1344 1510 void GraphicsContextGLOpenGL::uniform3i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2) 1345 1511 { 1346 makeContextCurrent(); 1512 if (!makeContextCurrent()) 1513 return; 1514 1347 1515 ::glUniform3i(location, v0, v1, v2); 1348 1516 } … … 1351 1519 { 1352 1520 // FIXME: length needs to be a multiple of 3. 1353 makeContextCurrent(); 1521 if (!makeContextCurrent()) 1522 return; 1523 1354 1524 ::glUniform3iv(location, size, array); 1355 1525 } … … 1357 1527 void GraphicsContextGLOpenGL::uniform4i(GCGLint location, GCGLint v0, GCGLint v1, GCGLint v2, GCGLint v3) 1358 1528 { 1359 makeContextCurrent(); 1529 if (!makeContextCurrent()) 1530 return; 1531 1360 1532 ::glUniform4i(location, v0, v1, v2, v3); 1361 1533 } … … 1364 1536 { 1365 1537 // FIXME: length needs to be a multiple of 4. 1366 makeContextCurrent(); 1538 if (!makeContextCurrent()) 1539 return; 1540 1367 1541 ::glUniform4iv(location, size, array); 1368 1542 } … … 1371 1545 { 1372 1546 // FIXME: length needs to be a multiple of 4. 1373 makeContextCurrent(); 1547 if (!makeContextCurrent()) 1548 return; 1549 1374 1550 ::glUniformMatrix2fv(location, size, transpose, array); 1375 1551 } … … 1378 1554 { 1379 1555 // FIXME: length needs to be a multiple of 9. 1380 makeContextCurrent(); 1556 if (!makeContextCurrent()) 1557 return; 1558 1381 1559 ::glUniformMatrix3fv(location, size, transpose, array); 1382 1560 } … … 1385 1563 { 1386 1564 // FIXME: length needs to be a multiple of 16. 1387 makeContextCurrent(); 1565 if (!makeContextCurrent()) 1566 return; 1567 1388 1568 ::glUniformMatrix4fv(location, size, transpose, array); 1389 1569 } … … 1391 1571 void GraphicsContextGLOpenGL::useProgram(PlatformGLObject program) 1392 1572 { 1393 makeContextCurrent(); 1573 if (!makeContextCurrent()) 1574 return; 1575 1394 1576 ::glUseProgram(program); 1395 1577 } … … 1399 1581 ASSERT(program); 1400 1582 1401 makeContextCurrent(); 1583 if (!makeContextCurrent()) 1584 return; 1585 1402 1586 ::glValidateProgram(program); 1403 1587 } … … 1405 1589 void GraphicsContextGLOpenGL::vertexAttrib1f(GCGLuint index, GCGLfloat v0) 1406 1590 { 1407 makeContextCurrent(); 1591 if (!makeContextCurrent()) 1592 return; 1593 1408 1594 ::glVertexAttrib1f(index, v0); 1409 1595 } … … 1411 1597 void GraphicsContextGLOpenGL::vertexAttrib1fv(GCGLuint index, const GCGLfloat* array) 1412 1598 { 1413 makeContextCurrent(); 1599 if (!makeContextCurrent()) 1600 return; 1601 1414 1602 ::glVertexAttrib1fv(index, array); 1415 1603 } … … 1417 1605 void GraphicsContextGLOpenGL::vertexAttrib2f(GCGLuint index, GCGLfloat v0, GCGLfloat v1) 1418 1606 { 1419 makeContextCurrent(); 1607 if (!makeContextCurrent()) 1608 return; 1609 1420 1610 ::glVertexAttrib2f(index, v0, v1); 1421 1611 } … … 1423 1613 void GraphicsContextGLOpenGL::vertexAttrib2fv(GCGLuint index, const GCGLfloat* array) 1424 1614 { 1425 makeContextCurrent(); 1615 if (!makeContextCurrent()) 1616 return; 1617 1426 1618 ::glVertexAttrib2fv(index, array); 1427 1619 } … … 1429 1621 void GraphicsContextGLOpenGL::vertexAttrib3f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2) 1430 1622 { 1431 makeContextCurrent(); 1623 if (!makeContextCurrent()) 1624 return; 1625 1432 1626 ::glVertexAttrib3f(index, v0, v1, v2); 1433 1627 } … … 1435 1629 void GraphicsContextGLOpenGL::vertexAttrib3fv(GCGLuint index, const GCGLfloat* array) 1436 1630 { 1437 makeContextCurrent(); 1631 if (!makeContextCurrent()) 1632 return; 1633 1438 1634 ::glVertexAttrib3fv(index, array); 1439 1635 } … … 1441 1637 void GraphicsContextGLOpenGL::vertexAttrib4f(GCGLuint index, GCGLfloat v0, GCGLfloat v1, GCGLfloat v2, GCGLfloat v3) 1442 1638 { 1443 makeContextCurrent(); 1639 if (!makeContextCurrent()) 1640 return; 1641 1444 1642 ::glVertexAttrib4f(index, v0, v1, v2, v3); 1445 1643 } … … 1447 1645 void GraphicsContextGLOpenGL::vertexAttrib4fv(GCGLuint index, const GCGLfloat* array) 1448 1646 { 1449 makeContextCurrent(); 1647 if (!makeContextCurrent()) 1648 return; 1649 1450 1650 ::glVertexAttrib4fv(index, array); 1451 1651 } … … 1453 1653 void GraphicsContextGLOpenGL::vertexAttribPointer(GCGLuint index, GCGLint size, GCGLenum type, GCGLboolean normalized, GCGLsizei stride, GCGLintptr offset) 1454 1654 { 1455 makeContextCurrent(); 1655 if (!makeContextCurrent()) 1656 return; 1657 1456 1658 ::glVertexAttribPointer(index, size, type, normalized, stride, reinterpret_cast<GLvoid*>(static_cast<intptr_t>(offset))); 1457 1659 } … … 1459 1661 void GraphicsContextGLOpenGL::viewport(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height) 1460 1662 { 1461 makeContextCurrent(); 1663 if (!makeContextCurrent()) 1664 return; 1665 1462 1666 ::glViewport(x, y, width, height); 1463 1667 } … … 1465 1669 PlatformGLObject GraphicsContextGLOpenGL::createVertexArray() 1466 1670 { 1467 makeContextCurrent(); 1671 if (!makeContextCurrent()) 1672 return 0; 1673 1468 1674 GLuint array = 0; 1469 1675 #if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA) … … 1478 1684 return; 1479 1685 1480 makeContextCurrent(); 1686 if (!makeContextCurrent()) 1687 return; 1688 1481 1689 #if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA) 1482 1690 ::glDeleteVertexArrays(1, &array); … … 1489 1697 return GL_FALSE; 1490 1698 1491 makeContextCurrent(); 1699 if (!makeContextCurrent()) 1700 return GL_FALSE; 1701 1492 1702 #if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA) 1493 1703 return ::glIsVertexArray(array); … … 1498 1708 void GraphicsContextGLOpenGL::bindVertexArray(PlatformGLObject array) 1499 1709 { 1500 makeContextCurrent(); 1710 if (!makeContextCurrent()) 1711 return; 1712 1501 1713 #if (!USE(OPENGL_ES) && (PLATFORM(GTK) || PLATFORM(WIN))) || PLATFORM(COCOA) 1502 1714 ::glBindVertexArray(array); … … 1508 1720 void GraphicsContextGLOpenGL::getBooleanv(GCGLenum pname, GCGLboolean* value) 1509 1721 { 1510 makeContextCurrent(); 1722 if (!makeContextCurrent()) 1723 return; 1724 1511 1725 ::glGetBooleanv(pname, value); 1512 1726 } … … 1514 1728 void GraphicsContextGLOpenGL::getBufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value) 1515 1729 { 1516 makeContextCurrent(); 1730 if (!makeContextCurrent()) 1731 return; 1732 1517 1733 ::glGetBufferParameteriv(target, pname, value); 1518 1734 } … … 1520 1736 void GraphicsContextGLOpenGL::getFloatv(GCGLenum pname, GCGLfloat* value) 1521 1737 { 1522 makeContextCurrent(); 1738 if (!makeContextCurrent()) 1739 return; 1740 1523 1741 ::glGetFloatv(pname, value); 1524 1742 } … … 1528 1746 UNUSED_PARAM(pname); 1529 1747 UNUSED_PARAM(index); 1530 makeContextCurrent(); 1748 if (!makeContextCurrent()) 1749 return; 1750 1531 1751 *value = 0; 1532 1752 // 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. … … 1537 1757 { 1538 1758 UNUSED_PARAM(pname); 1539 makeContextCurrent(); 1759 if (!makeContextCurrent()) 1760 return; 1761 1540 1762 *value = 0; 1541 1763 // 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. … … 1547 1769 UNUSED_PARAM(pname); 1548 1770 UNUSED_PARAM(index); 1549 makeContextCurrent(); 1771 if (!makeContextCurrent()) 1772 return; 1773 1550 1774 *value = 0; 1551 1775 // 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. … … 1555 1779 void GraphicsContextGLOpenGL::getFramebufferAttachmentParameteriv(GCGLenum target, GCGLenum attachment, GCGLenum pname, GCGLint* value) 1556 1780 { 1557 makeContextCurrent(); 1781 if (!makeContextCurrent()) 1782 return; 1783 1558 1784 if (attachment == DEPTH_STENCIL_ATTACHMENT) 1559 1785 attachment = DEPTH_ATTACHMENT; // Or STENCIL_ATTACHMENT, either works. … … 1563 1789 void GraphicsContextGLOpenGL::getProgramiv(PlatformGLObject program, GCGLenum pname, GCGLint* value) 1564 1790 { 1565 makeContextCurrent(); 1791 if (!makeContextCurrent()) 1792 return; 1793 1566 1794 ::glGetProgramiv(program, pname, value); 1567 1795 } … … 1573 1801 return; 1574 1802 1575 makeContextCurrent(); 1803 if (!makeContextCurrent()) 1804 return; 1805 1576 1806 const auto& result = m_shaderProgramSymbolCountMap.find(program); 1577 1807 if (result != m_shaderProgramSymbolCountMap.end()) { … … 1651 1881 ASSERT(program); 1652 1882 1653 makeContextCurrent(); 1883 if (!makeContextCurrent()) 1884 return String(); 1885 1654 1886 GLint length = 0; 1655 1887 ::glGetProgramiv(program, GL_INFO_LOG_LENGTH, &length); … … 1670 1902 void GraphicsContextGLOpenGL::getRenderbufferParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value) 1671 1903 { 1672 makeContextCurrent(); 1904 if (!makeContextCurrent()) 1905 return; 1906 1673 1907 ::glGetRenderbufferParameterivEXT(target, pname, value); 1674 1908 } … … 1678 1912 ASSERT(shader); 1679 1913 1680 makeContextCurrent(); 1914 if (!makeContextCurrent()) 1915 return; 1916 1681 1917 1682 1918 const auto& result = m_shaderSourceMap.find(shader); … … 1713 1949 ASSERT(shader); 1714 1950 1715 makeContextCurrent(); 1951 if (!makeContextCurrent()) 1952 return String(); 1716 1953 1717 1954 const auto& result = m_shaderSourceMap.find(shader); … … 1740 1977 ASSERT(shader); 1741 1978 1742 makeContextCurrent(); 1979 if (!makeContextCurrent()) 1980 return String(); 1743 1981 1744 1982 const auto& result = m_shaderSourceMap.find(shader); … … 1751 1989 void GraphicsContextGLOpenGL::getTexParameterfv(GCGLenum target, GCGLenum pname, GCGLfloat* value) 1752 1990 { 1753 makeContextCurrent(); 1991 if (!makeContextCurrent()) 1992 return; 1993 1754 1994 ::glGetTexParameterfv(target, pname, value); 1755 1995 } … … 1757 1997 void GraphicsContextGLOpenGL::getTexParameteriv(GCGLenum target, GCGLenum pname, GCGLint* value) 1758 1998 { 1759 makeContextCurrent(); 1999 if (!makeContextCurrent()) 2000 return; 2001 1760 2002 ::glGetTexParameteriv(target, pname, value); 1761 2003 } … … 1763 2005 void GraphicsContextGLOpenGL::getUniformfv(PlatformGLObject program, GCGLint location, GCGLfloat* value) 1764 2006 { 1765 makeContextCurrent(); 2007 if (!makeContextCurrent()) 2008 return; 2009 1766 2010 ::glGetUniformfv(program, location, value); 1767 2011 } … … 1769 2013 void GraphicsContextGLOpenGL::getUniformiv(PlatformGLObject program, GCGLint location, GCGLint* value) 1770 2014 { 1771 makeContextCurrent(); 2015 if (!makeContextCurrent()) 2016 return; 2017 1772 2018 ::glGetUniformiv(program, location, value); 1773 2019 } … … 1784 2030 ASSERT(program); 1785 2031 1786 makeContextCurrent(); 2032 if (!makeContextCurrent()) 2033 return -1; 1787 2034 1788 2035 String mappedName = mappedSymbolName(program, SHADER_SYMBOL_TYPE_UNIFORM, name); … … 1793 2040 void GraphicsContextGLOpenGL::getVertexAttribfv(GCGLuint index, GCGLenum pname, GCGLfloat* value) 1794 2041 { 1795 makeContextCurrent(); 2042 if (!makeContextCurrent()) 2043 return; 2044 1796 2045 ::glGetVertexAttribfv(index, pname, value); 1797 2046 } … … 1799 2048 void GraphicsContextGLOpenGL::getVertexAttribiv(GCGLuint index, GCGLenum pname, GCGLint* value) 1800 2049 { 1801 makeContextCurrent(); 2050 if (!makeContextCurrent()) 2051 return; 2052 1802 2053 ::glGetVertexAttribiv(index, pname, value); 1803 2054 } … … 1805 2056 GCGLsizeiptr GraphicsContextGLOpenGL::getVertexAttribOffset(GCGLuint index, GCGLenum pname) 1806 2057 { 1807 makeContextCurrent(); 2058 if (!makeContextCurrent()) 2059 return 0; 1808 2060 1809 2061 GLvoid* pointer = 0; … … 1814 2066 void GraphicsContextGLOpenGL::texSubImage2D(GCGLenum target, GCGLint level, GCGLint xoff, GCGLint yoff, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, const void* pixels) 1815 2067 { 1816 makeContextCurrent(); 2068 if (!makeContextCurrent()) 2069 return; 1817 2070 1818 2071 #if !USE(OPENGL_ES) … … 1845 2098 void GraphicsContextGLOpenGL::compressedTexImage2D(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLsizei imageSize, const void* data) 1846 2099 { 1847 makeContextCurrent(); 2100 if (!makeContextCurrent()) 2101 return; 2102 1848 2103 ::glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); 1849 2104 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 1852 2107 void GraphicsContextGLOpenGL::compressedTexSubImage2D(GCGLenum target, GCGLint level, GCGLint xoffset, GCGLint yoffset, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLsizei imageSize, const void* data) 1853 2108 { 1854 makeContextCurrent(); 2109 if (!makeContextCurrent()) 2110 return; 2111 1855 2112 ::glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); 1856 2113 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 1859 2116 PlatformGLObject GraphicsContextGLOpenGL::createBuffer() 1860 2117 { 1861 makeContextCurrent(); 2118 if (!makeContextCurrent()) 2119 return 0; 2120 1862 2121 GLuint o = 0; 1863 2122 glGenBuffers(1, &o); … … 1867 2126 PlatformGLObject GraphicsContextGLOpenGL::createFramebuffer() 1868 2127 { 1869 makeContextCurrent(); 2128 if (!makeContextCurrent()) 2129 return 0; 2130 1870 2131 GLuint o = 0; 1871 2132 glGenFramebuffersEXT(1, &o); … … 1875 2136 PlatformGLObject GraphicsContextGLOpenGL::createProgram() 1876 2137 { 1877 makeContextCurrent(); 2138 if (!makeContextCurrent()) 2139 return 0; 2140 1878 2141 return glCreateProgram(); 1879 2142 } … … 1881 2144 PlatformGLObject GraphicsContextGLOpenGL::createRenderbuffer() 1882 2145 { 1883 makeContextCurrent(); 2146 if (!makeContextCurrent()) 2147 return 0; 2148 1884 2149 GLuint o = 0; 1885 2150 glGenRenderbuffersEXT(1, &o); … … 1889 2154 PlatformGLObject GraphicsContextGLOpenGL::createShader(GCGLenum type) 1890 2155 { 1891 makeContextCurrent(); 2156 if (!makeContextCurrent()) 2157 return 0; 2158 1892 2159 return glCreateShader((type == FRAGMENT_SHADER) ? GL_FRAGMENT_SHADER : GL_VERTEX_SHADER); 1893 2160 } … … 1895 2162 PlatformGLObject GraphicsContextGLOpenGL::createTexture() 1896 2163 { 1897 makeContextCurrent(); 2164 if (!makeContextCurrent()) 2165 return 0; 2166 1898 2167 GLuint o = 0; 1899 2168 glGenTextures(1, &o); … … 1904 2173 void GraphicsContextGLOpenGL::deleteBuffer(PlatformGLObject buffer) 1905 2174 { 1906 makeContextCurrent(); 2175 if (!makeContextCurrent()) 2176 return; 2177 1907 2178 glDeleteBuffers(1, &buffer); 1908 2179 } … … 1910 2181 void GraphicsContextGLOpenGL::deleteFramebuffer(PlatformGLObject framebuffer) 1911 2182 { 1912 makeContextCurrent(); 2183 if (!makeContextCurrent()) 2184 return; 2185 1913 2186 ASSERT(m_state.boundReadFBO == m_state.boundDrawFBO); 1914 2187 if (framebuffer == m_state.boundDrawFBO) { … … 1922 2195 void GraphicsContextGLOpenGL::deleteProgram(PlatformGLObject program) 1923 2196 { 1924 makeContextCurrent(); 2197 if (!makeContextCurrent()) 2198 return; 2199 1925 2200 m_shaderProgramSymbolCountMap.remove(program); 1926 2201 glDeleteProgram(program); … … 1929 2204 void GraphicsContextGLOpenGL::deleteRenderbuffer(PlatformGLObject renderbuffer) 1930 2205 { 1931 makeContextCurrent(); 2206 if (!makeContextCurrent()) 2207 return; 2208 1932 2209 glDeleteRenderbuffersEXT(1, &renderbuffer); 1933 2210 } … … 1935 2212 void GraphicsContextGLOpenGL::deleteShader(PlatformGLObject shader) 1936 2213 { 1937 makeContextCurrent(); 2214 if (!makeContextCurrent()) 2215 return; 2216 1938 2217 glDeleteShader(shader); 1939 2218 } … … 1941 2220 void GraphicsContextGLOpenGL::deleteTexture(PlatformGLObject texture) 1942 2221 { 1943 makeContextCurrent(); 2222 if (!makeContextCurrent()) 2223 return; 2224 1944 2225 m_state.boundTextureMap.removeIf([texture] (auto& keyValue) { 1945 2226 return keyValue.value.first == texture; … … 1997 2278 void GraphicsContextGLOpenGL::texImage2DDirect(GCGLenum target, GCGLint level, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLint border, GCGLenum format, GCGLenum type, const void* pixels) 1998 2279 { 1999 makeContextCurrent(); 2280 if (!makeContextCurrent()) 2281 return; 2282 2000 2283 ::glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); 2001 2284 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 2022 2305 void GraphicsContextGLOpenGL::primitiveRestartIndex(GCGLuint index) 2023 2306 { 2024 makeContextCurrent(); 2307 if (!makeContextCurrent()) 2308 return; 2309 2025 2310 ::glPrimitiveRestartIndex(index); 2026 2311 } … … 2048 2333 void GraphicsContextGLOpenGL::copyBufferSubData(GCGLenum readTarget, GCGLenum writeTarget, GCGLintptr readOffset, GCGLintptr writeOffset, GCGLsizeiptr size) 2049 2334 { 2050 makeContextCurrent(); 2335 if (!makeContextCurrent()) 2336 return; 2337 2051 2338 ::glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size); 2052 2339 } … … 2069 2356 void* GraphicsContextGLOpenGL::mapBufferRange(GCGLenum target, GCGLintptr offset, GCGLsizeiptr length, GCGLbitfield access) 2070 2357 { 2071 makeContextCurrent(); 2358 if (!makeContextCurrent()) 2359 return nullptr; 2360 2072 2361 return ::glMapBufferRange(target, offset, length, access); 2073 2362 } … … 2075 2364 GCGLboolean GraphicsContextGLOpenGL::unmapBuffer(GCGLenum target) 2076 2365 { 2077 makeContextCurrent(); 2366 if (!makeContextCurrent()) 2367 return GL_FALSE; 2368 2078 2369 return ::glUnmapBuffer(target); 2079 2370 } … … 2140 2431 { 2141 2432 #if USE(OPENGL_ES) 2142 makeContextCurrent(); 2433 if (!makeContextCurrent()) 2434 return; 2435 2143 2436 ::glGetInternalformativ(target, internalformat, pname, bufSize, params); 2144 2437 #else … … 2153 2446 void GraphicsContextGLOpenGL::renderbufferStorageMultisample(GCGLenum target, GCGLsizei samples, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) 2154 2447 { 2155 makeContextCurrent(); 2448 if (!makeContextCurrent()) 2449 return; 2450 2156 2451 ::glRenderbufferStorageMultisample(target, samples, internalformat, width, height); 2157 2452 } … … 2159 2454 void GraphicsContextGLOpenGL::texStorage2D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) 2160 2455 { 2161 makeContextCurrent(); 2456 if (!makeContextCurrent()) 2457 return; 2458 2162 2459 ::glTexStorage2D(target, levels, internalformat, width, height); 2163 2460 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 2166 2463 void GraphicsContextGLOpenGL::texStorage3D(GCGLenum target, GCGLsizei levels, GCGLenum internalformat, GCGLsizei width, GCGLsizei height, GCGLsizei depth) 2167 2464 { 2168 makeContextCurrent(); 2465 if (!makeContextCurrent()) 2466 return; 2467 2169 2468 ::glTexStorage3D(target, levels, internalformat, width, height, depth); 2170 2469 m_state.textureSeedCount.add(m_state.currentBoundTexture()); … … 2631 2930 { 2632 2931 ASSERT(program); 2633 makeContextCurrent(); 2932 if (!makeContextCurrent()) 2933 return; 2634 2934 2635 2935 ::glGetActiveUniformsiv(program, uniformIndices.size(), uniformIndices.data(), pname, params.data()); -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGLES.cpp
r269686 r269768 43 43 void GraphicsContextGLOpenGL::readPixels(GCGLint x, GCGLint y, GCGLsizei width, GCGLsizei height, GCGLenum format, GCGLenum type, void* data) 44 44 { 45 makeContextCurrent(); 45 if (!makeContextCurrent()) 46 return; 47 46 48 47 49 auto attributes = contextAttributes(); … … 189 191 void GraphicsContextGLOpenGL::renderbufferStorage(GCGLenum target, GCGLenum internalformat, GCGLsizei width, GCGLsizei height) 190 192 { 191 makeContextCurrent(); 193 if (!makeContextCurrent()) 194 return; 195 192 196 ::glRenderbufferStorage(target, internalformat, width, height); 193 197 } … … 195 199 void GraphicsContextGLOpenGL::getIntegerv(GCGLenum pname, GCGLint* value) 196 200 { 197 makeContextCurrent(); 201 if (!makeContextCurrent()) 202 return; 203 198 204 ::glGetIntegerv(pname, value); 199 205 } … … 204 210 ASSERT(precision); 205 211 206 makeContextCurrent(); 212 if (!makeContextCurrent()) 213 return; 214 207 215 ::glGetShaderPrecisionFormat(shaderType, precisionType, range, precision); 208 216 } … … 233 241 void GraphicsContextGLOpenGL::depthRange(GCGLclampf zNear, GCGLclampf zFar) 234 242 { 235 makeContextCurrent(); 243 if (!makeContextCurrent()) 244 return; 245 236 246 ::glDepthRangef(zNear, zFar); 237 247 } … … 239 249 void GraphicsContextGLOpenGL::clearDepth(GCGLclampf depth) 240 250 { 241 makeContextCurrent(); 251 if (!makeContextCurrent()) 252 return; 253 242 254 ::glClearDepthf(depth); 243 255 } … … 279 291 { 280 292 ASSERT_UNUSED(sharedContext, !sharedContext); 281 makeContextCurrent(); 293 if (!makeContextCurrent()) 294 return; 295 282 296 283 297 validateAttributes(); … … 344 358 GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL() 345 359 { 346 makeContextCurrent(); 360 if (!makeContextCurrent()) 361 return; 362 347 363 ::glDeleteTextures(1, &m_texture); 348 364 -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapper.cpp
r269686 r269768 140 140 m_texmapLayer = WTF::makeUnique<TextureMapperGCGLPlatformLayer>(*this, destination); 141 141 #endif 142 makeContextCurrent(); 142 bool success = makeContextCurrent(); 143 ASSERT_UNUSED(success, success); 143 144 144 145 validateAttributes(); … … 214 215 #endif 215 216 216 makeContextCurrent(); 217 bool success = makeContextCurrent(); 218 ASSERT_UNUSED(success, success); 217 219 218 220 validateAttributes(); … … 334 336 GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL() 335 337 { 336 makeContextCurrent(); 338 bool success = makeContextCurrent(); 339 ASSERT_UNUSED(success, success); 337 340 if (m_texture) 338 341 gl::DeleteTextures(1, &m_texture); … … 378 381 GraphicsContextGLOpenGL::~GraphicsContextGLOpenGL() 379 382 { 380 makeContextCurrent(); 383 bool success = makeContextCurrent(); 384 ASSERT_UNUSED(success, success); 381 385 if (m_texture) 382 386 ::glDeleteTextures(1, &m_texture);
Note: See TracChangeset
for help on using the changeset viewer.