No issue - Avoid WebGL crash on Mesa

This prevents too high vert-count draws that Mesa doesn't handle.
This commit is contained in:
Moonchild 2022-04-08 22:55:27 +02:00 committed by roytam1
commit 943d76fa91

View file

@ -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;