ConstantUnion: Error on undefined shift.
BUG=chromium:648135
Change-Id: I41581f63af650564a0f61c1baeeb38017c8513ed
Reviewed-on: https://chromium-review.googlesource.com/387470
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/gl_tests/GLSLTest.cpp b/src/tests/gl_tests/GLSLTest.cpp
index 2a5ac12..bab16e2 100644
--- a/src/tests/gl_tests/GLSLTest.cpp
+++ b/src/tests/gl_tests/GLSLTest.cpp
@@ -2433,6 +2433,42 @@
glDeleteProgram(program);
}
+// Test that using an invalid constant right-shift produces an error.
+TEST_P(GLSLTest_ES3, FoldedInvalidRightShift)
+{
+ const std::string &fragmentShader =
+ "#version 300 es\n"
+ "precision mediump float;\n"
+ "out vec4 color;\n"
+ "void main(void)\n"
+ "{\n"
+ " int diff = -100 >> -100;\n"
+ " color = vec4(float(diff));\n"
+ "}\n";
+
+ GLuint program = CompileProgram(mSimpleVSSource, fragmentShader);
+ EXPECT_EQ(0u, program);
+ glDeleteProgram(program);
+}
+
+// Test that using an invalid constant left-shift produces an error.
+TEST_P(GLSLTest_ES3, FoldedInvalidLeftShift)
+{
+ const std::string &fragmentShader =
+ "#version 300 es\n"
+ "precision mediump float;\n"
+ "out vec4 color;\n"
+ "void main(void)\n"
+ "{\n"
+ " int diff = -100 << -100;\n"
+ " color = vec4(float(diff));\n"
+ "}\n";
+
+ GLuint program = CompileProgram(mSimpleVSSource, fragmentShader);
+ EXPECT_EQ(0u, program);
+ glDeleteProgram(program);
+}
+
} // anonymous namespace
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.