summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2014-02-10 18:02:27 -0800
committerAnuj Phogat <anuj.phogat@gmail.com>2014-02-20 13:09:11 -0800
commitf82ec911dea1d6ca97d3929a8fa50a789d723818 (patch)
tree2f837af6d63387d83c87455b8f9ec900949bc714
parentcae3de343eaccc840373f75c2b236f4543b28d8c (diff)
glsl-1.50: Add shader tests to verify gl_FragCoord layout qualifiers
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-1.shader_test47
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test59
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test58
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-4.shader_test57
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-1.shader_test58
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test59
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-3.shader_test60
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-4.shader_test58
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-missing.shader_test45
9 files changed, 501 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-1.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-1.shader_test
new file mode 100644
index 000000000..e560a6923
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-1.shader_test
@@ -0,0 +1,47 @@
+/* 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 all the fragment shaders redeclare gl_FragCoord
+ * but with conflicting layout qualifiers.
+ */
+[require]
+GLSL >= 1.50
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+
+void foo();
+void main()
+{
+ gl_FragColor = vec4(gl_FragCoord.xyz, 1.0);
+ foo();
+}
+
+[fragment shader]
+
+layout(origin_upper_left) in vec4 gl_FragCoord;
+void foo()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test
new file mode 100644
index 000000000..3350e0fb4
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test
@@ -0,0 +1,59 @@
+/* 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 all the fragment shaders which use gl_FragCoord,
+ * redeclare it with conflicting layout qualifiers. It varifies that
+ * link error is not effected by the presence of a fragment shader which
+ * doesn't use gl_FragCoord.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+void alpha();
+void blue();
+void main()
+{
+ gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
+ blue();
+ alpha();
+}
+
+[fragment shader]
+
+void blue()
+{
+ gl_FragColor.b = 1.0;
+}
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+void alpha()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test
new file mode 100644
index 000000000..a21f918d5
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test
@@ -0,0 +1,58 @@
+/* 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 all the fragment shaders which use gl_FragCoord,
+ * redeclare it with conflicting layout qualifiers. It varifies that
+ * link error is generated even if gl_FragCoord is redeclared by the
+ * last fragment shader attached.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+void alpha();
+void blue();
+void main()
+{
+ gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
+ blue();
+ alpha();
+}
+
+[fragment shader]
+
+void blue()
+{
+ gl_FragColor.b = 1.0;
+}
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+void alpha()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-4.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-4.shader_test
new file mode 100644
index 000000000..c66de074f
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-4.shader_test
@@ -0,0 +1,57 @@
+/* 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. GLSL 1.50 expects the redeclaration to be present in all
+ * fragment shaders that use gl_FragCoord.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+void alpha();
+void blue();
+void main()
+{
+ gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
+ blue();
+ alpha();
+}
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+void blue()
+{
+ gl_FragColor.b = 1.0;
+}
+
+[fragment shader]
+
+void alpha()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-1.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-1.shader_test
new file mode 100644
index 000000000..d8c3b78c0
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-1.shader_test
@@ -0,0 +1,58 @@
+/* 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 all the fragment shaders which use gl_FragCoord,
+ * redeclare it with matching layout qualifiers.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+void alpha();
+void blue();
+void main()
+{
+ gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
+ blue();
+ alpha();
+}
+
+[fragment shader]
+
+void blue()
+{
+ gl_FragColor.b = 1.0;
+}
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+void alpha()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+
+[test]
+link success
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test
new file mode 100644
index 000000000..f78ec3f15
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test
@@ -0,0 +1,59 @@
+/* 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 all the fragment shaders which use gl_FragCoord,
+ * redeclare it with matching layout qualifiers. The specfic order of
+ * attached fragment shaders is important here.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+void blue()
+{
+ gl_FragColor.b = 1.0;
+}
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+void alpha();
+void blue();
+void main()
+{
+ gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
+ blue();
+ alpha();
+}
+
+[fragment shader]
+
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+void alpha()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+
+[test]
+link success
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-3.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-3.shader_test
new file mode 100644
index 000000000..1ab9c7a71
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-3.shader_test
@@ -0,0 +1,60 @@
+/* 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 all the fragment shaders redeclare gl_FragCoord with
+ * matching layout qualifiers. It also tests that redeclaring gl_FragCoord
+ * in a shader which doesn't use it, causes no link error.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+layout(origin_upper_left) in vec4 gl_FragCoord;
+void alpha();
+void blue();
+void main()
+{
+ gl_FragColor = vec4(gl_FragCoord.xy, 0.0, 1.0);
+ blue();
+ alpha();
+}
+
+[fragment shader]
+layout(origin_upper_left) in vec4 gl_FragCoord;
+
+void blue()
+{
+ gl_FragColor.b = 1.0;
+}
+
+[fragment shader]
+
+layout(origin_upper_left) in vec4 gl_FragCoord;
+void alpha()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+
+[test]
+link success
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-4.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-4.shader_test
new file mode 100644
index 000000000..8d5c6b95c
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-4.shader_test
@@ -0,0 +1,58 @@
+/* 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 one of the fragment shaders which don't use
+ * gl_FragCoord, redeclare it. Specific order of fragment shaders is
+ * important here.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+
+void alpha();
+void blue();
+void main()
+{
+ gl_FragColor = vec4(0.0);
+ blue();
+ alpha();
+}
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+void blue()
+{
+ gl_FragColor.b = 1.0;
+}
+
+[fragment shader]
+
+layout(pixel_center_integer) in vec4 gl_FragCoord;
+void alpha()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+
+[test]
+link success
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-missing.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-missing.shader_test
new file mode 100644
index 000000000..b5f9fa328
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-missing.shader_test
@@ -0,0 +1,45 @@
+/* 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 of the fragment shader redeclares gl_FragCoord
+ * and other doesn't.
+ */
+[require]
+GLSL >= 1.50
+
+
+[vertex shader passthrough]
+
+[fragment shader]
+layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
+
+void foo();
+void main()
+{
+ gl_FragColor = vec4(gl_FragCoord.xyz, 1.0);
+ foo();
+}
+
+[fragment shader]
+void foo()
+{
+ gl_FragColor.a = gl_FragCoord.z;
+}
+
+[test]
+link error