[Piglit] [PATCH 08/12] arb_tessellation_shader: Add tests for TCS output l-value indexing

Chris Forbes chrisf at ijw.co.nz
Wed Sep 17 00:42:21 PDT 2014


Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 .../compiler/custom-block-out-indexing-const.tesc  | 24 +++++++++++++++++++++
 .../compiler/custom-out-indexing-const.tesc        | 22 +++++++++++++++++++
 .../compiler/custom-out-indexing-strict.tesc       | 25 ++++++++++++++++++++++
 .../compiler/custom-out-indexing-uniform.tesc      | 23 ++++++++++++++++++++
 .../compiler/gl_out-indexing-const.tesc            | 20 +++++++++++++++++
 .../compiler/gl_out-indexing-strict.tesc           | 24 +++++++++++++++++++++
 .../compiler/gl_out-indexing-uniform.tesc          | 21 ++++++++++++++++++
 7 files changed, 159 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-block-out-indexing-const.tesc
 create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-const.tesc
 create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-strict.tesc
 create mode 100644 tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-uniform.tesc
 create mode 100644 tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-const.tesc
 create mode 100644 tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-strict.tesc
 create mode 100644 tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-uniform.tesc

diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-block-out-indexing-const.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-block-out-indexing-const.tesc
new file mode 100644
index 0000000..e7a44e0
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/custom-block-out-indexing-const.tesc
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// [end config]
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+
+out block {
+	vec4 y[4];
+} x[];
+
+/* If a per-vertex output variable is used as an l-value, it is an
+ * error if the expression indicating the vertex number is not the
+ * identifier "gl_InvocationID".
+ */
+
+void main()
+{
+	x[0].y[0] = vec4(0);
+}
diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-const.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-const.tesc
new file mode 100644
index 0000000..fb8ff88
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-const.tesc
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// [end config]
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+
+out vec4 x[];
+
+/* If a per-vertex output variable is used as an l-value, it is an
+ * error if the expression indicating the vertex number is not the
+ * identifier "gl_InvocationID".
+ */
+
+void main()
+{
+	x[0] = vec4(0);
+}
diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-strict.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-strict.tesc
new file mode 100644
index 0000000..92461c5
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-strict.tesc
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// [end config]
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+out vec4 x[];
+
+/* If a per-vertex output variable is used as an l-value, it is an
+ * error if the expression indicating the vertex number is not the
+ * identifier "gl_InvocationID".
+ *
+ * This test interprets the requirement strictly -- even though `n`
+ * will take the correct value, this is not allowed.
+ */
+
+void main()
+{
+	int n = gl_InvocationID;
+	x[n] = vec4(0);
+}
diff --git a/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-uniform.tesc b/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-uniform.tesc
new file mode 100644
index 0000000..71e0cd1
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/custom-out-indexing-uniform.tesc
@@ -0,0 +1,23 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// [end config]
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+
+uniform int n;
+out vec4 x[];
+
+/* If a per-vertex output variable is used as an l-value, it is an
+ * error if the expression indicating the vertex number is not the
+ * identifier "gl_InvocationID".
+ */
+
+void main()
+{
+	x[n] = vec4(0);
+}
diff --git a/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-const.tesc b/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-const.tesc
new file mode 100644
index 0000000..e1a424e
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-const.tesc
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// [end config]
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+
+/* If a per-vertex output variable is used as an l-value, it is an
+ * error if the expression indicating the vertex number is not the
+ * identifier "gl_InvocationID".
+ */
+
+void main()
+{
+	gl_out[0].gl_Position = vec4(0);
+}
diff --git a/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-strict.tesc b/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-strict.tesc
new file mode 100644
index 0000000..a328b57
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-strict.tesc
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// [end config]
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+
+/* If a per-vertex output variable is used as an l-value, it is an
+ * error if the expression indicating the vertex number is not the
+ * identifier "gl_InvocationID".
+ *
+ * This test interprets the requirement strictly -- even though `n`
+ * will take the correct value, this is not allowed.
+ */
+
+void main()
+{
+	int n = gl_InvocationID;
+	gl_out[n].gl_Position = vec4(0);
+}
diff --git a/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-uniform.tesc b/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-uniform.tesc
new file mode 100644
index 0000000..1bc8f65
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/compiler/gl_out-indexing-uniform.tesc
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_tessellation_shader
+// [end config]
+
+#version 150
+#extension GL_ARB_tessellation_shader: require
+
+layout(vertices = 3) out;
+uniform int n;
+
+/* If a per-vertex output variable is used as an l-value, it is an
+ * error if the expression indicating the vertex number is not the
+ * identifier "gl_InvocationID".
+ */
+
+void main()
+{
+	gl_out[n].gl_Position = vec4(0);
+}
-- 
2.1.0



More information about the Piglit mailing list