Enable shader validation with WebGL compatibility extension.
The change configures shaders to be of a compatible spec upon creation.
BUG=angleproject:1523
Change-Id: Id345d0b8f0abad8ed3c4fb3117d0fdfeab9fea53
Reviewed-on: https://chromium-review.googlesource.com/405778
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 087247f..48a9d2b 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -112,6 +112,33 @@
}
}
+// Verify that shaders are of a compatible spec when the extension is enabled.
+TEST_P(WebGLCompatibilityTest, ExtensionCompilerSpec)
+{
+ EXPECT_TRUE(extensionEnabled("GL_ANGLE_webgl_compatibility"));
+
+ // Use of reserved _webgl prefix should fail when the shader specification is for WebGL.
+ const std::string &vert =
+ "struct Foo {\n"
+ " int _webgl_bar;\n"
+ "};\n"
+ "void main()\n"
+ "{\n"
+ " Foo foo = Foo(1);\n"
+ "}";
+
+ // Default fragement shader.
+ const std::string &frag =
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = vec4(1.0,0.0,0.0,1.0);\n"
+ "}";
+
+ GLuint program = CompileProgram(vert, frag);
+ EXPECT_EQ(0u, program);
+ glDeleteProgram(program);
+}
+
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest,