Test invalid precision specifier in initializer
authorSean Callanan <spyffe@google.com>
Mon, 29 Jan 2018 19:55:37 +0000 (11:55 -0800)
committerSean Callanan <spyffe@google.com>
Mon, 5 Feb 2018 18:42:26 +0000 (18:42 +0000)
The expression

mediump vec2 v = mediump vec2(...);

is not legal GLSL because of the "mediump" in the initializer.
Many implementations accept it, though.  This test verifies that they
catch the syntax error correctly.

Bug: 13881278
Test: Ran this on X11 GLX, saw the test case fail as desired
Change-Id: I12e59ce2d813e72f878ae5c8eaf384063b362cdf

android/cts/master/gles2-master.txt
data/gles2/shaders/invalid_constant_expressions.test [new file with mode: 0644]
modules/gles2/functional/es2fShaderConstExprTests.cpp

index 237433f..4803d8e 100644 (file)
@@ -7146,6 +7146,7 @@ dEQP-GLES2.functional.shaders.constant_expressions.builtin_functions.geometric.n
 dEQP-GLES2.functional.shaders.constant_expressions.builtin_functions.geometric.normalize_vec3_fragment
 dEQP-GLES2.functional.shaders.constant_expressions.builtin_functions.geometric.normalize_vec4_vertex
 dEQP-GLES2.functional.shaders.constant_expressions.builtin_functions.geometric.normalize_vec4_fragment
+dEQP-GLES2.functional.shaders.constant_expressions.invalid.precision_specifier
 dEQP-GLES2.functional.shaders.random.basic_expression.vertex.0
 dEQP-GLES2.functional.shaders.random.basic_expression.vertex.1
 dEQP-GLES2.functional.shaders.random.basic_expression.vertex.2
diff --git a/data/gles2/shaders/invalid_constant_expressions.test b/data/gles2/shaders/invalid_constant_expressions.test
new file mode 100644 (file)
index 0000000..9b79452
--- /dev/null
@@ -0,0 +1,21 @@
+case precision_specifier
+       expect compile_fail
+       values {}
+
+       vertex ""
+               ${VERTEX_DECLARATIONS}
+               uniform lowp sampler2D s;
+
+               void main()
+               {
+                       mediump vec2 v = mediump vec2(1.0, 1.0);
+                       ${VERTEX_OUTPUT}
+               }
+       ""
+       fragment ""
+               void main()
+               {
+                       gl_FragColor = vec4(1.0);
+               }
+       ""
+end
index 442d943..7135b7f 100644 (file)
@@ -225,6 +225,15 @@ void ShaderConstExprTests::init (void)
                addChild(children[i]);
 
        addChild(new ShaderConstExprBuiltinTests(m_context));
+
+       // Negative cases.
+       {
+               gls::ShaderLibrary library(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo());
+               std::vector<tcu::TestNode*> negativeCases = library.loadShaderFile("shaders/invalid_constant_expressions.test");
+
+               tcu::TestCaseGroup* group = new tcu::TestCaseGroup(m_testCtx, "invalid", "Invalid constant expressions", negativeCases);
+               addChild(group);
+       }
 }
 
 } // Functional