Bug 790879 - work around Mac bufferData bug - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 28 Sep 2012 07:41:44 -0400
changeset 108584 3e9d3ac81cb00bfc459b81617cb0dc8b91933b05
parent 108583 d08437736a601d003221f0cf0ed4786900802fa0
child 108585 a0bae754ad5db339d4baa377ae6491df9434257a
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersjgilbert
bugs790879
milestone18.0a1
Bug 790879 - work around Mac bufferData bug - r=jgilbert
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -298,16 +298,25 @@ WebGLContext::BlendFuncSeparate(WebGLenu
     gl->fBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
 }
 
 GLenum WebGLContext::CheckedBufferData(GLenum target,
                                        GLsizeiptr size,
                                        const GLvoid *data,
                                        GLenum usage)
 {
+#ifdef XP_MACOSX
+    // bug 790879
+    if (gl->WorkAroundDriverBugs() &&
+        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 != nullptr, "no buffer bound for this target");