summaryrefslogtreecommitdiff
path: root/dom/canvas
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-04-08 22:55:27 +0200
committerMoonchild <moonchild@palemoon.org>2022-04-08 22:55:27 +0200
commite6101f7fa64a81c0617a83bbd82e95717d87e2af (patch)
treeceb7cca5eec1787edfb15b817aebe34fee9c515c /dom/canvas
parent52bcfa36bf35ca6af5a914e266585180f116007f (diff)
downloaduxp-e6101f7fa64a81c0617a83bbd82e95717d87e2af.tar.gz
No issue - Avoid WebGL crash on Mesa
This prevents too high vert-count draws that Mesa doesn't handle.
Diffstat (limited to 'dom/canvas')
-rw-r--r--dom/canvas/WebGLContextDraw.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/dom/canvas/WebGLContextDraw.cpp b/dom/canvas/WebGLContextDraw.cpp
index 8e437a07f3..e7c188ac10 100644
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -1066,6 +1066,15 @@ WebGLContext::DoFakeVertexAttrib0(const char* funcName, GLuint vertexCount)
vertexCount = 1;
}
+ if (gl->WorkAroundDriverBugs() && gl->IsMesa()) {
+ // Padded/strided to vec4, so 4x4bytes.
+ const auto effectiveVertAttribBytes = CheckedInt<int32_t>(vertexCount) * 4 * 4;
+ if (!effectiveVertAttribBytes.isValid()) {
+ ErrorOutOfMemory("`offset + count` too large for Mesa.");
+ return false;
+ }
+ }
+
const auto whatDoesAttrib0Need = WhatDoesVertexAttrib0Need();
if (MOZ_LIKELY(whatDoesAttrib0Need == WebGLVertexAttrib0Status::Default))
return true;