summaryrefslogtreecommitdiff
path: root/dom/canvas/WebGLContextBuffers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/canvas/WebGLContextBuffers.cpp')
-rw-r--r--dom/canvas/WebGLContextBuffers.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/dom/canvas/WebGLContextBuffers.cpp b/dom/canvas/WebGLContextBuffers.cpp
index 6f583c10c6..e787b99143 100644
--- a/dom/canvas/WebGLContextBuffers.cpp
+++ b/dom/canvas/WebGLContextBuffers.cpp
@@ -295,6 +295,16 @@ WebGLContext::BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer,
////
+#ifdef XP_MACOSX
+ if (buffer && buffer->Content() == WebGLBuffer::Kind::Undefined &&
+ gl->WorkAroundDriverBugs())
+ {
+ // BindBufferRange will fail if the buffer's contents is undefined.
+ // Bind so driver initializes the buffer.
+ gl->fBindBuffer(target, buffer->mGLName);
+ }
+#endif
+
gl->fBindBufferRange(target, index, buffer ? buffer->mGLName : 0, offset, size);
////
@@ -342,6 +352,12 @@ WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage)
if (!checkedSize.isValid())
return ErrorOutOfMemory("%s: Size too large for platform.", funcName);
+#if defined(XP_MACOSX)
+ if (gl->WorkAroundDriverBugs() && size > 1200000000) {
+ return ErrorOutOfMemory("Allocations larger than 1200000000 fail on MacOS.");
+ }
+#endif
+
const UniqueBuffer zeroBuffer(calloc(size, 1));
if (!zeroBuffer)
return ErrorOutOfMemory("%s: Failed to allocate zeros.", funcName);