Fix WebGL compat feedback loop null deref.
This regressed in "Optimize ValidateDrawAttribs: Part 2."
Bug: chromium:834943
Bug: angleproject:1391
Change-Id: I217719d76b0524ed7900e18bcc4ca1280ec7b6ff
Reviewed-on: https://chromium-review.googlesource.com/1020280
Commit-Queue: Jamie Madill <jmadill@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 1cde5d7..3249c4b 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -4135,6 +4135,23 @@
EXPECT_GL_ERROR(GL_INVALID_VALUE);
}
+// Covers a bug in transform feedback loop detection.
+TEST_P(WebGL2CompatibilityTest, TransformFeedbackCheckNullDeref)
+{
+ constexpr char kVS[] = R"(attribute vec4 color; void main() { color.r; })";
+ constexpr char kFS[] = R"(void main(){})";
+ ANGLE_GL_PROGRAM(program, kVS, kFS);
+ glUseProgram(program);
+
+ GLBuffer buffer;
+ glBindBuffer(GL_ARRAY_BUFFER, buffer);
+ glEnableVertexAttribArray(0);
+ glDrawArrays(GL_POINTS, 0, 1);
+
+ // This should fail because it is trying to pull one vertex from an empty buffer.
+ EXPECT_GL_ERROR(GL_INVALID_OPERATION);
+}
+
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest,