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

Anuj Phogat anuj.phogat at gmail.com
Tue Feb 25 12:55:09 PST 2014


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 .../layout-qualifiers-conflicting-case-3.frag      | 38 +++++++++++++++++++++
 .../layout-qualifiers-conflicting-case-4.frag      | 39 ++++++++++++++++++++++
 .../layout-qualifiers-conflicting-case-5.frag      | 39 ++++++++++++++++++++++
 .../layout-qualifiers-conflicting-case-6.frag      | 37 ++++++++++++++++++++
 .../layout-qualifiers-missing.frag                 | 36 ++++++++++++++++++++
 .../use-before-redeclaration-1.frag                | 24 +++++++++++++
 .../use-before-redeclaration-2.frag                | 24 +++++++++++++
 .../use-between-redeclarations-1.frag              | 25 ++++++++++++++
 .../use-between-redeclarations-2.frag              | 26 +++++++++++++++
 9 files changed, 288 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-3.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-4.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-5.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-6.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-missing.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-before-redeclaration-1.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-before-redeclaration-2.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-between-redeclarations-1.frag
 create mode 100644 tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-between-redeclarations-2.frag

diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-3.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-3.frag
new file mode 100644
index 0000000..d4b319e
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-3.frag
@@ -0,0 +1,38 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* 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 conflicting redeclarations of gl_FragCoord within same fragment
+ * shader. The specific order of redeclarations is important in this test.
+ */
+
+#version 150
+
+layout(origin_upper_left) in vec4 gl_FragCoord;
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+
+void main()
+{
+     fragcolor = gl_FragCoord.xyzz;
+}
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-4.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-4.frag
new file mode 100644
index 0000000..b5fec73
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-4.frag
@@ -0,0 +1,39 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* 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 conflicting redeclarations of gl_FragCoord within same fragment
+ * shader. Notice the first redeclaration is made without any layout
+ * qualifiers.
+ */
+
+#version 150
+
+in vec4 gl_FragCoord;
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+out vec4 fragcolor;
+
+void main()
+{
+     fragcolor = gl_FragCoord.xyzz;
+}
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-5.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-5.frag
new file mode 100644
index 0000000..4d4e9ee
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-5.frag
@@ -0,0 +1,39 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* 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 conflicting redeclarations of gl_FragCoord within same fragment
+ * shader. Notice the second redeclaration is made without any layout
+ * qualifiers.
+ */
+
+#version 150
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+in vec4 gl_FragCoord;
+out vec4 fragcolor;
+
+void main()
+{
+     fragcolor = gl_FragCoord.xyzz;
+}
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-6.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-6.frag
new file mode 100644
index 0000000..5c6ad92
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-conflicting-case-6.frag
@@ -0,0 +1,37 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* 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 conflicting redeclarations of gl_FragCoord within same fragment
+ * shader. Notice the first redeclaration is made without any layout
+ * qualifiers and gl_FragCoord is not actually used in the shader.
+ */
+
+#version 150
+
+in vec4 gl_FragCoord;
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-missing.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-missing.frag
new file mode 100644
index 0000000..f8b0c09
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/layout-qualifiers-missing.frag
@@ -0,0 +1,36 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* 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 redeclarations of gl_FragCoord with no layout qualifiers.
+ */
+
+#version 150
+
+in vec4 gl_FragCoord;
+out vec4 fragcolor;
+
+void main()
+{
+     fragcolor = gl_FragCoord.xyzz;
+}
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-before-redeclaration-1.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-before-redeclaration-1.frag
new file mode 100644
index 0000000..cffbbc6
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-before-redeclaration-1.frag
@@ -0,0 +1,24 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *
+ *    "Within any shader, the first redeclarations of gl_FragCoord must appear
+ *     before any use of gl_FragCoord."
+ *
+ * Tests using gl_FragCoord before the redeclaration.
+ */
+
+#version 150
+
+vec4 p = gl_FragCoord;
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-before-redeclaration-2.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-before-redeclaration-2.frag
new file mode 100644
index 0000000..0755fe6
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-before-redeclaration-2.frag
@@ -0,0 +1,24 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *
+ *    "Within any shader, the first redeclarations of gl_FragCoord must appear
+ *     before any use of gl_FragCoord."
+ *
+ * Tests using gl_FragCoord before the redeclaration with no layout qualifiers.
+ */
+
+#version 150
+
+vec4 p = gl_FragCoord;
+in vec4 gl_FragCoord;
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-between-redeclarations-1.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-between-redeclarations-1.frag
new file mode 100644
index 0000000..a306570
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-between-redeclarations-1.frag
@@ -0,0 +1,25 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *
+ *    "Within any shader, the first redeclarations of gl_FragCoord must appear
+ *     before any use of gl_FragCoord."
+ *
+ * Tests using gl_FragCoord between two redeclarations of gl_FragCoord.
+ */
+
+#version 150
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+vec4 p = gl_FragCoord;
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+
+void main()
+{
+}
diff --git a/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-between-redeclarations-2.frag b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-between-redeclarations-2.frag
new file mode 100644
index 0000000..3beea42
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/fragment_coord_conventions/use-between-redeclarations-2.frag
@@ -0,0 +1,26 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.50
+ * check_link: false
+ * [end config]
+ */
+
+/* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+ *
+ *
+ *    "Within any shader, the first redeclarations of gl_FragCoord must appear
+ *     before any use of gl_FragCoord."
+ *
+ * Tests using gl_FragCoord between two redeclarations of gl_FragCoord with
+ * no layout qualifiers.
+ */
+
+#version 150
+
+in vec4 gl_FragCoord;
+vec4 p = gl_FragCoord;
+in vec4 gl_FragCoord;
+
+void main()
+{
+}
-- 
1.8.3.1



More information about the Piglit mailing list