[Piglit] [PATCH] arb_gpu_shader5: add some compiler/linker tests for sample qualifier

Chris Forbes chrisf at ijw.co.nz
Fri Nov 29 11:35:50 PST 2013


Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 .../sample-qualifier/fs-sample-in-no-writes.frag   | 21 +++++++++++++++
 .../sample-qualifier/fs-sample-in-qualifier.frag   | 16 +++++++++++
 .../sample-qualifier/fs-sample-out-qualifier.frag  | 19 +++++++++++++
 .../sample-qualifier/gs-sample-in-qualifier.geom   | 16 +++++++++++
 .../sample-qualifier/gs-sample-out-qualifier.geom  | 21 +++++++++++++++
 .../sample-qualifier/vs-sample-in-qualifier.vert   | 17 ++++++++++++
 .../sample-qualifier/vs-sample-out-qualifier.vert  | 17 ++++++++++++
 .../sample-qualifier-unqualified-vs-fs.shader_test | 30 +++++++++++++++++++++
 .../linker/sample-qualifier-vs-fs.shader_test      | 31 ++++++++++++++++++++++
 9 files changed, 188 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-no-writes.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-qualifier.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-out-qualifier.frag
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-in-qualifier.geom
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-out-qualifier.geom
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-in-qualifier.vert
 create mode 100644 tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-out-qualifier.vert
 create mode 100644 tests/spec/arb_gpu_shader5/linker/sample-qualifier-unqualified-vs-fs.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/linker/sample-qualifier-vs-fs.shader_test

diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-no-writes.frag b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-no-writes.frag
new file mode 100644
index 0000000..3c212d3
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-no-writes.frag
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+// From the ARB_gpu_shader5 spec:
+// "Variables declared as ..., or sample in may
+// not be written to during shader execution."
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+sample in vec4 x;
+
+void main()
+{
+	x = vec4(0);	/* not allowed */
+	gl_FragColor = vec4(1);
+}
+
diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-qualifier.frag b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-qualifier.frag
new file mode 100644
index 0000000..afcd8ac
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-qualifier.frag
@@ -0,0 +1,16 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+sample in vec4 x;
+
+void main()
+{
+	gl_FragColor = x;
+}
+
diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-out-qualifier.frag b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-out-qualifier.frag
new file mode 100644
index 0000000..bcb621d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-out-qualifier.frag
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+// From the ARB_gpu_shader5 spec:
+// "It is an error to use centroid out or sample out in a fragment shader"
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+sample out vec4 x;			/* not allowed */
+
+void main()
+{
+	gl_FragColor = x;
+}
+
diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-in-qualifier.geom b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-in-qualifier.geom
new file mode 100644
index 0000000..c9d4ce6
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-in-qualifier.geom
@@ -0,0 +1,16 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+sample in vec4 x;	/* not allowed */
+
+void main()
+{
+	gl_Position = x;
+	EmitVertex();
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-out-qualifier.geom b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-out-qualifier.geom
new file mode 100644
index 0000000..0e24b4d
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-out-qualifier.geom
@@ -0,0 +1,21 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+// From the ARB_gpu_shader5 spec:
+// "Vertex and geometry output variables output per-vertex data and
+// are declared using the ..., or sample out storage qualifiers, ..."
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+sample out vec4 x;
+
+void main()
+{
+	x = vec4(0);
+	gl_Position = vec4(1);
+	EmitVertex();
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-in-qualifier.vert b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-in-qualifier.vert
new file mode 100644
index 0000000..0586d6e
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-in-qualifier.vert
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec4 y;
+sample in vec4 x;	/* this is not allowed */
+
+void main()
+{
+	x = y;
+	gl_Position = y;
+}
diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-out-qualifier.vert b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-out-qualifier.vert
new file mode 100644
index 0000000..7615b97
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-out-qualifier.vert
@@ -0,0 +1,17 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_gpu_shader5
+// [end config]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+in vec4 y;
+sample out vec4 x;
+
+void main()
+{
+	x = y;
+	gl_Position = y;
+}
diff --git a/tests/spec/arb_gpu_shader5/linker/sample-qualifier-unqualified-vs-fs.shader_test b/tests/spec/arb_gpu_shader5/linker/sample-qualifier-unqualified-vs-fs.shader_test
new file mode 100644
index 0000000..a740e3f
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/sample-qualifier-unqualified-vs-fs.shader_test
@@ -0,0 +1,30 @@
+# Tests that the linking 'out' against 'sample in' produces an error
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+out vec4 per_sample_color;		/* unqualified */
+
+void main() {
+	per_sample_color = vec4(1);
+}
+
+[fragment shader]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+sample in vec4 per_sample_color;
+
+void main() {
+	gl_FragColor = per_sample_color;
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_gpu_shader5/linker/sample-qualifier-vs-fs.shader_test b/tests/spec/arb_gpu_shader5/linker/sample-qualifier-vs-fs.shader_test
new file mode 100644
index 0000000..5711394
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/linker/sample-qualifier-vs-fs.shader_test
@@ -0,0 +1,31 @@
+# Tests that variables in the vertex shader can be qualified with 'sample out'
+# and link against variables in the fragment shader qualified with 'sample in'
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+sample out vec4 per_sample_color;
+
+void main() {
+	per_sample_color = vec4(1);
+}
+
+[fragment shader]
+
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+sample in vec4 per_sample_color;
+
+void main() {
+	gl_FragColor = per_sample_color;
+}
+
+[test]
+
-- 
1.8.4.2



More information about the Piglit mailing list