Add test for WebGL compatibility restriction on GL_FIXED and max stride
BUG=angleproject:1523
Change-Id: If3ab8fa9d7e80f7abb2f4ac864a936e93dfd902c
Reviewed-on: https://chromium-review.googlesource.com/422963
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index 86f4954..3e6aed6 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -272,6 +272,34 @@
ASSERT_GL_NO_ERROR();
}
+// Test that GL_FIXED is forbidden
+TEST_P(WebGLCompatibilityTest, ForbidsGLFixed)
+{
+ GLBuffer buffer;
+ glBindBuffer(GL_ARRAY_BUFFER, buffer.get());
+ glBufferData(GL_ARRAY_BUFFER, 16, nullptr, GL_STATIC_DRAW);
+
+ glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
+ ASSERT_GL_NO_ERROR();
+
+ glVertexAttribPointer(0, 1, GL_FIXED, GL_FALSE, 0, nullptr);
+ EXPECT_GL_ERROR(GL_INVALID_ENUM);
+}
+
+// Test the WebGL limit of 255 for the attribute stride
+TEST_P(WebGLCompatibilityTest, MaxStride)
+{
+ GLBuffer buffer;
+ glBindBuffer(GL_ARRAY_BUFFER, buffer.get());
+ glBufferData(GL_ARRAY_BUFFER, 1024, nullptr, GL_STATIC_DRAW);
+
+ glVertexAttribPointer(0, 1, GL_UNSIGNED_BYTE, GL_FALSE, 255, nullptr);
+ ASSERT_GL_NO_ERROR();
+
+ glVertexAttribPointer(0, 1, GL_UNSIGNED_BYTE, GL_FALSE, 256, nullptr);
+ EXPECT_GL_ERROR(GL_INVALID_VALUE);
+}
+
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest,