Add GLSL ES 3.0 tests for default uniform precision mismatch
authorPyry Haulos <phaulos@google.com>
Fri, 19 Jun 2015 17:14:33 +0000 (10:14 -0700)
committerPyry Haulos <phaulos@google.com>
Fri, 19 Jun 2015 17:33:11 +0000 (10:33 -0700)
GLSL ES 3.0 specification requires linking to fail if there is a
precision mismatch between (default block) uniforms between shader
stages. This rule was only covered for struct members and this CL adds
coverage for uniforms of basic (scalar / vector) type.

Bug: 21947794
Change-Id: Ifab9cbd17726c01b987177df43d7248c34c9cf44

android/cts/master/com.drawelements.deqp.gles3.xml
android/cts/master/gles3-master.txt
data/gles3/shaders/linkage.test

index 3d5b377..28dd3d7 100644 (file)
                                                </TestCase>
                                        </TestSuite>
                                        <TestSuite name="uniform">
+                                               <TestCase name="basic">
+                                                       <Test name="precision_conflict_1">
+                                                               <TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+                                                       </Test>
+                                                       <Test name="precision_conflict_2">
+                                                               <TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+                                                       </Test>
+                                                       <Test name="precision_conflict_3">
+                                                               <TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+                                                       </Test>
+                                                       <Test name="precision_conflict_4">
+                                                               <TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
+                                                       </Test>
+                                               </TestCase>
                                                <TestCase name="struct">
                                                        <Test name="basic">
                                                                <TestInstance glconfig="rgba8888d24s8ms0" rotation="unspecified" surfacetype="window"/>
index a60a966..349a846 100644 (file)
@@ -1543,6 +1543,10 @@ dEQP-GLES3.functional.shaders.linkage.varying.interpolation.centroid
 dEQP-GLES3.functional.shaders.linkage.varying.interpolation.flat
 dEQP-GLES3.functional.shaders.linkage.varying.usage.readback_1
 dEQP-GLES3.functional.shaders.linkage.varying.usage.writeback_1
+dEQP-GLES3.functional.shaders.linkage.uniform.basic.precision_conflict_1
+dEQP-GLES3.functional.shaders.linkage.uniform.basic.precision_conflict_2
+dEQP-GLES3.functional.shaders.linkage.uniform.basic.precision_conflict_3
+dEQP-GLES3.functional.shaders.linkage.uniform.basic.precision_conflict_4
 dEQP-GLES3.functional.shaders.linkage.uniform.struct.basic
 dEQP-GLES3.functional.shaders.linkage.uniform.struct.vertex_only
 dEQP-GLES3.functional.shaders.linkage.uniform.struct.fragment_only
index 7e4b3d8..56acda6 100644 (file)
@@ -2342,6 +2342,125 @@ group varying "Varying linkage"
 end
 
 group uniform "Uniform linkage"
+       group basic "Default block uniforms of scalar and vector types"
+               case precision_conflict_1
+                       version 300 es
+                       desc "Vertex side uniform has highp, fragment side uniform mediump."
+                       expect link_fail
+                       values {output float out0 = 3.0;}
+                       vertex ""
+                               #version 300 es
+                               ${VERTEX_DECLARATIONS}
+                               uniform highp float u_val;
+                               out mediump float res;
+                               void main()
+                               {
+                                       res = u_val;
+                                       ${VERTEX_OUTPUT}
+                               }
+                       ""
+                       fragment ""
+                               #version 300 es
+                               precision mediump float;
+                               uniform float u_val;
+                               ${FRAGMENT_DECLARATIONS}
+                               in mediump float res;
+                               void main()
+                               {
+                                       out0 = u_val + res;
+                                       ${FRAGMENT_OUTPUT}
+                               }
+                       ""
+               end
+               case precision_conflict_2
+                       version 300 es
+                       desc "Vertex side uniform has highp, fragment side uniform mediump."
+                       expect link_fail
+                       values {output float out0 = 3.0;}
+                       vertex ""
+                               #version 300 es
+                               ${VERTEX_DECLARATIONS}
+                               uniform highp float u_val;
+                               out mediump float res;
+                               void main()
+                               {
+                                       res = u_val;
+                                       ${VERTEX_OUTPUT}
+                               }
+                       ""
+                       fragment ""
+                               #version 300 es
+                               precision highp float;
+                               uniform mediump float u_val;
+                               ${FRAGMENT_DECLARATIONS}
+                               in mediump float res;
+                               void main()
+                               {
+                                       out0 = u_val + res;
+                                       ${FRAGMENT_OUTPUT}
+                               }
+                       ""
+               end
+               case precision_conflict_3
+                       version 300 es
+                       desc "Vertex side uniform has lowp, fragment side uniform highp."
+                       expect link_fail
+                       values {output float out0 = 3.0;}
+                       vertex ""
+                               #version 300 es
+                               ${VERTEX_DECLARATIONS}
+                               uniform lowp int u_val;
+                               out mediump float res;
+                               void main()
+                               {
+                                       res = float(u_val);
+                                       ${VERTEX_OUTPUT}
+                               }
+                       ""
+                       fragment ""
+                               #version 300 es
+                               precision highp float;
+                               uniform highp int u_val;
+                               ${FRAGMENT_DECLARATIONS}
+                               in mediump float res;
+                               void main()
+                               {
+                                       out0 = float(u_val) + res;
+                                       ${FRAGMENT_OUTPUT}
+                               }
+                       ""
+               end
+               case precision_conflict_4
+                       version 300 es
+                       desc "Vertex side uniform has lowp, fragment side uniform mediump."
+                       expect link_fail
+                       values {output float out0 = 3.0;}
+                       vertex ""
+                               #version 300 es
+                               ${VERTEX_DECLARATIONS}
+                               uniform lowp vec3 u_val;
+                               out mediump float res;
+                               void main()
+                               {
+                                       res = u_val.y;
+                                       ${VERTEX_OUTPUT}
+                               }
+                       ""
+                       fragment ""
+                               #version 300 es
+                               precision highp float;
+                               uniform mediump vec3 u_val;
+                               ${FRAGMENT_DECLARATIONS}
+                               in mediump float res;
+                               void main()
+                               {
+                                       out0 = u_val.z + res;
+                                       ${FRAGMENT_OUTPUT}
+                               }
+                       ""
+               end
+       end
+
        group struct "Uniform structs"
                # Struct linkage handling
                case basic