diff options
author | Matt A. Tobin <email@mattatobin.com> | 2022-04-09 21:27:58 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2022-04-09 21:27:58 -0500 |
commit | a82ce63d9cd0bd1e2f42908cc293463f0e9c2038 (patch) | |
tree | 7f381d31ab9b41021234bb346ebce8c54c34630f /dom | |
parent | 4a097bddac3c013464775d592314f7a0e69eb929 (diff) | |
download | aura-central-a82ce63d9cd0bd1e2f42908cc293463f0e9c2038.tar.gz |
[DOM->Canvas] Avoid WebGL crash on Mesa
This prevents too high vert-count draws that Mesa doesn't handle.
Diffstat (limited to 'dom')
-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 8e437a07f..c0ba20301 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->Vendor() == gl::GLVendor::Nouveau) { + // 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; |