[Piglit] [PATCH V2 2/2] glsl-1.50: Add shader tests to verify gl_FragCoord redeclarations

Anuj Phogat anuj.phogat at gmail.com
Thu Mar 6 16:11:32 PST 2014


V2: Add few more shader tests and do minor changes in tests added in V1.

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 ...ayout-qualifiers-conflicting-case-5.shader_test | 62 ++++++++++++++++++++++
 ...ayout-qualifiers-conflicting-case-6.shader_test | 61 +++++++++++++++++++++
 ...ayout-qualifiers-conflicting-case-7.shader_test | 50 +++++++++++++++++
 ...ayout-qualifiers-conflicting-case-8.shader_test | 61 +++++++++++++++++++++
 ...ayout-qualifiers-conflicting-case-9.shader_test | 49 +++++++++++++++++
 5 files changed, 283 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-5.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-6.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-7.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-8.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-9.shader_test

diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-5.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-5.shader_test
new file mode 100644
index 0000000..d06c7d9
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-5.shader_test
@@ -0,0 +1,62 @@
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *     "Fragment shaders can have an input layout only for redeclaring the
+ *     built-in variable gl_FragCoord (see section 7.2 Fragment Shader
+ *     Special Variables). The layout qualifier identifiers for
+ *     gl_FragCoord are
+ *
+ *     layout-qualifier-id:
+ *         origin_upper_left
+ *         pixel_center_integer"
+ *
+ *
+ *     "If gl_FragCoord is redeclared in any fragment shader in a program,
+ *      it must be redeclared in all the fragment shaders in that program
+ *      that have a static use gl_FragCoord. All redeclarations of
+ *      gl_FragCoord in all fragment shaders in a single program must have
+ *      the same set of qualifiers."
+ *
+ * Tests the case when only the fragment shaders which don't use gl_FragCoord,
+ * redeclare it with matching layout qualifiers. GLSL 1.50 expects the
+ * redeclarations in all the fragment shaders to match. The order of fragment
+ * shaders is important here.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void blue()
+{
+     fragcolor.b = 1.0;
+}
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha()
+{
+     fragcolor.a = 1.0;
+}
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha();
+void blue();
+void main()
+{
+     fragcolor = vec4(gl_FragCoord.xy, 0.0, 1.0);
+     blue();
+     alpha();
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-6.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-6.shader_test
new file mode 100644
index 0000000..24884d5
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-6.shader_test
@@ -0,0 +1,61 @@
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *     "Fragment shaders can have an input layout only for redeclaring the
+ *     built-in variable gl_FragCoord (see section 7.2 Fragment Shader
+ *     Special Variables). The layout qualifier identifiers for
+ *     gl_FragCoord are
+ *
+ *     layout-qualifier-id:
+ *         origin_upper_left
+ *         pixel_center_integer"
+ *
+ *
+ *     "If gl_FragCoord is redeclared in any fragment shader in a program,
+ *      it must be redeclared in all the fragment shaders in that program
+ *      that have a static use gl_FragCoord. All redeclarations of
+ *      gl_FragCoord in all fragment shaders in a single program must have
+ *      the same set of qualifiers."
+ *
+ * Tests the case when only the fragment shaders which don't use gl_FragCoord,
+ * redeclare it with conflicting layout qualifiers. GLSL 1.50 expects the
+ * redeclarations in all the fragment shaders to match.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha();
+void blue();
+void main()
+{
+     fragcolor = vec4(gl_FragCoord.xy, 0.0, 1.0);
+     blue();
+     alpha();
+}
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha()
+{
+     fragcolor.a = gl_FragCoord.z;
+}
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void blue()
+{
+     fragcolor.b = 1.0;
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-7.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-7.shader_test
new file mode 100644
index 0000000..259e095
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-7.shader_test
@@ -0,0 +1,50 @@
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *     "Fragment shaders can have an input layout only for redeclaring the
+ *     built-in variable gl_FragCoord (see section 7.2 Fragment Shader
+ *     Special Variables). The layout qualifier identifiers for
+ *     gl_FragCoord are
+ *
+ *     layout-qualifier-id:
+ *         origin_upper_left
+ *         pixel_center_integer"
+ *
+ *
+ *     "If gl_FragCoord is redeclared in any fragment shader in a program,
+ *      it must be redeclared in all the fragment shaders in that program
+ *      that have a static use gl_FragCoord. All redeclarations of
+ *      gl_FragCoord in all fragment shaders in a single program must have
+ *      the same set of qualifiers."
+ *
+ * Tests the case when one fragment shader redeclares gl_FragCoord without
+ * any qualifiers and other one has missing redeclaration. Spec is not very
+ * clear about this case but making this case fail to link would be wrong.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha();
+void main()
+{
+     fragcolor = vec4(gl_FragCoord.xyz, 1.0);
+     alpha();
+}
+
+[fragment shader]
+
+out vec4 fragcolor;
+void alpha()
+{
+     fragcolor.a = gl_FragCoord.z;
+}
+
+
+[test]
+link success
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-8.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-8.shader_test
new file mode 100644
index 0000000..5f0b6b6
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-8.shader_test
@@ -0,0 +1,61 @@
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *     "Fragment shaders can have an input layout only for redeclaring the
+ *     built-in variable gl_FragCoord (see section 7.2 Fragment Shader
+ *     Special Variables). The layout qualifier identifiers for
+ *     gl_FragCoord are
+ *
+ *     layout-qualifier-id:
+ *         origin_upper_left
+ *         pixel_center_integer"
+ *
+ *
+ *     "If gl_FragCoord is redeclared in any fragment shader in a program,
+ *      it must be redeclared in all the fragment shaders in that program
+ *      that have a static use gl_FragCoord. All redeclarations of
+ *      gl_FragCoord in all fragment shaders in a single program must have
+ *      the same set of qualifiers."
+ *
+ * Tests the case when none of the fragment shaders use gl_FragCoord, but
+ * redeclare it with conflicting layout qualifiers. GLSL 1.50 expects the
+ * redeclarations in all the fragment shaders to match.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha();
+void blue();
+void main()
+{
+     fragcolor.rg = vec2(0.0 , 1.0);
+     blue();
+     alpha();
+}
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha()
+{
+     fragcolor.a = 1.0;
+}
+
+[fragment shader]
+
+layout(origin_upper_left) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void blue()
+{
+     fragcolor.b = 0.0;
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-9.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-9.shader_test
new file mode 100644
index 0000000..76ebd3c
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-9.shader_test
@@ -0,0 +1,49 @@
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *     "Fragment shaders can have an input layout only for redeclaring the
+ *     built-in variable gl_FragCoord (see section 7.2 Fragment Shader
+ *     Special Variables). The layout qualifier identifiers for
+ *     gl_FragCoord are
+ *
+ *     layout-qualifier-id:
+ *         origin_upper_left
+ *         pixel_center_integer"
+ *
+ *
+ *     "If gl_FragCoord is redeclared in any fragment shader in a program,
+ *      it must be redeclared in all the fragment shaders in that program
+ *      that have a static use gl_FragCoord. All redeclarations of
+ *      gl_FragCoord in all fragment shaders in a single program must have
+ *      the same set of qualifiers."
+ *
+ * Tests the case when one fragment shader redeclares gl_FragCoord but doesn't
+ * use it and other one has missing redeclaration.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+layout(origin_upper_left) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha()
+{
+     fragcolor.a = 1.0;
+}
+
+[fragment shader]
+
+out vec4 fragcolor;
+void alpha();
+void main()
+{
+     fragcolor = vec4(gl_FragCoord.xyz, 1.0);
+     alpha();
+}
+
+
+[test]
+link error
-- 
1.8.3.1



More information about the Piglit mailing list