Change Validation For Indexed Draw Without ELEMENT_ARRAY_BUFFER
Changed WebGL Validation to return INVALID_OPERATION any time an
indexed draw call is made without a bound ELEMENT_ARRAY_BUFFER. Spec
was changed to no longer require count > 0 in order to cause error.
Make same spec change to GL_ANGLE_client_arrays extension.
BUG:angleproject:2639
Change-Id: I23963f357119d081890aa5387b2863e1d42b92a5
Reviewed-on: https://chromium-review.googlesource.com/1093984
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index 3249c4b..e55cba7 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -1470,6 +1470,26 @@
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
+// Test for drawing with a null index buffer
+TEST_P(WebGLCompatibilityTest, NullIndexBuffer)
+{
+ const std::string &vert =
+ "attribute float a_pos;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = vec4(a_pos, a_pos, a_pos, 1.0);\n"
+ "}\n";
+
+ ANGLE_GL_PROGRAM(program, vert, essl1_shaders::fs::Red());
+ glUseProgram(program.get());
+
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ glEnableVertexAttribArray(0);
+
+ glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_BYTE, 0);
+ EXPECT_GL_ERROR(GL_INVALID_OPERATION);
+}
+
// Test the checks for OOB reads in the vertex buffers, instanced version
TEST_P(WebGL2CompatibilityTest, DrawArraysBufferOutOfBoundsInstanced)
{