WebGL Compat: forbid client side arrays, even unused
BUG=angleproject:2064
Change-Id: I9a9c2df9a158799dbdc490446352cdf30fb87ca6
Reviewed-on: https://chromium-review.googlesource.com/537812
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index 874eb38..9f4b423 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -573,6 +573,35 @@
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
+// Test that client-side array buffers are forbidden even if the program doesn't use the attribute
+TEST_P(WebGLCompatibilityTest, ForbidsClientSideArrayBufferEvenNotUsedOnes)
+{
+ const std::string &vert =
+ "void main()\n"
+ "{\n"
+ " gl_Position = vec4(1.0);\n"
+ "}\n";
+
+ const std::string &frag =
+ "precision highp float;\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = vec4(1.0);\n"
+ "}\n";
+
+ ANGLE_GL_PROGRAM(program, vert, frag);
+
+ glUseProgram(program.get());
+
+ const auto &vertices = GetQuadVertices();
+ glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 4, vertices.data());
+ glEnableVertexAttribArray(0);
+
+ ASSERT_GL_NO_ERROR();
+ glDrawArrays(GL_TRIANGLES, 0, 6);
+ EXPECT_GL_ERROR(GL_INVALID_OPERATION);
+}
+
// Tests the WebGL requirement of having the same stencil mask, writemask and ref for fron and back
TEST_P(WebGLCompatibilityTest, RequiresSameStencilMaskAndRef)
{