diff options
author | Moonchild <moonchild@palemoon.org> | 2022-04-08 22:55:27 +0200 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-09 09:59:09 +0200 |
commit | f2f41a668ff1221bc0d274ed907a11890db3c55c (patch) | |
tree | 69019d9401059c8f89574e9ff7c2ce329982edcb | |
parent | 8e38c7bdfb281b1212f53d47d842a6b0977718cc (diff) | |
download | uxp-f2f41a668ff1221bc0d274ed907a11890db3c55c.tar.gz |
No issue - Avoid WebGL crash on Mesa
This prevents too high vert-count draws that Mesa doesn't handle.
-rw-r--r-- | dom/canvas/WebGLContextDraw.cpp | 9 |
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; |