summaryrefslogtreecommitdiff
path: root/dom/canvas/WebGLContextDraw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/canvas/WebGLContextDraw.cpp')
-rw-r--r--dom/canvas/WebGLContextDraw.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/dom/canvas/WebGLContextDraw.cpp b/dom/canvas/WebGLContextDraw.cpp
index 6c684b2ff8..a01e38c5c6 100644
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -607,6 +607,12 @@ WebGLContext::DrawArraysInstanced(GLenum mode, GLint first, GLsizei vertCount,
return;
MakeContextCurrent();
+
+ if (vertCount > mMaxVertIdsPerDraw) {
+ ErrorOutOfMemory(
+ "Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
+ return;
+ }
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
@@ -849,6 +855,12 @@ WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei vertCount, GLenum type,
return;
MakeContextCurrent();
+
+ if (vertCount > mMaxVertIdsPerDraw) {
+ ErrorOutOfMemory(
+ "Context's max vertCount is %u, but %u requested. [webgl.max-vert-ids-per-draw]", mMaxVertIdsPerDraw, vertCount);
+ return;
+ }
bool error = false;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);