Bug 790879 - work around Mac bufferData bug - r=jgilbert, a=akeybl
☠☠ backed out by 7ded7f96bbbe ☠ ☠
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 28 Sep 2012 07:41:44 -0400
changeset 82072 a04c49a2a2388332ead1850681683eb09b4c7a35
parent 82071 331ec7c812f024a60b172fbcc2ddcca824ba9eba
child 82073 b271fc88cf090c7271d4437476ca17db6bc144ee
push id325
push userryanvm@gmail.com
push dateSat, 03 Nov 2012 13:37:49 +0000
reviewersjgilbert, akeybl
bugs790879
milestone10.0.11esrpre
Bug 790879 - work around Mac bufferData bug - r=jgilbert, a=akeybl
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -431,16 +431,24 @@ WebGLContext::BlendFuncSeparate(WebGLenu
     return NS_OK;
 }
 
 GLenum WebGLContext::CheckedBufferData(GLenum target,
                                        GLsizeiptr size,
                                        const GLvoid *data,
                                        GLenum usage)
 {
+#ifdef XP_MACOSX
+    // bug 790879
+    if (int64_t(size) > INT32_MAX) // the cast avoids a potential always-true warning on 32bit
+    {
+        GenerateWarning("Rejecting valid bufferData call with size %lu to avoid a Mac bug", size);
+        return LOCAL_GL_INVALID_VALUE;
+    }
+#endif
     WebGLBuffer *boundBuffer = NULL;
     if (target == LOCAL_GL_ARRAY_BUFFER) {
         boundBuffer = mBoundArrayBuffer;
     } else if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
         boundBuffer = mBoundElementArrayBuffer;
     }
     NS_ABORT_IF_FALSE(boundBuffer != nsnull, "no buffer bound for this target");