[Piglit] [PATCH 2/2] glsl-1.50: Add shader tests to verify gl_FragCoord redeclarations
Anuj Phogat
anuj.phogat at gmail.com
Tue Feb 25 12:55:10 PST 2014
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
...ayout-qualifiers-conflicting-case-5.shader_test | 63 ++++++++++++++++++++++
...ayout-qualifiers-conflicting-case-6.shader_test | 62 +++++++++++++++++++++
...ayout-qualifiers-conflicting-case-7.shader_test | 50 +++++++++++++++++
3 files changed, 175 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
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..5330abc
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-5.shader_test
@@ -0,0 +1,63 @@
+/* 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. 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(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(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha()
+{
+ fragcolor.a = gl_FragCoord.z;
+}
+
+
+[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..b705973
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-6.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 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(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void blue()
+{
+ fragcolor.b = 1.0;
+}
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+void alpha()
+{
+ fragcolor.a = gl_FragCoord.z;
+}
+
+
+[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
--
1.8.3.1
More information about the Piglit
mailing list