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