[Piglit] [PATCH 05/10] arb_tessellation_shader: Add various simple cases for TCS input reads

Marek Olšák maraeo at gmail.com
Mon Jul 27 17:02:34 PDT 2015


From: Chris Forbes <chrisf at ijw.co.nz>

v2: fixed by Marek

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
 .../tcs-input-read-array-interface.shader_test     | 70 +++++++++++++++++++++
 .../execution/tcs-input-read-mat.shader_test       | 68 ++++++++++++++++++++
 ...put-read-nonconst-interface-builtin.shader_test | 65 +++++++++++++++++++
 .../tcs-input-read-nonconst-interface.shader_test  | 72 ++++++++++++++++++++++
 .../execution/tcs-input-read-nonconst.shader_test  | 68 ++++++++++++++++++++
 .../tcs-input-read-simple-interface.shader_test    | 68 ++++++++++++++++++++
 .../execution/tcs-input-read-simple.shader_test    | 68 ++++++++++++++++++++
 7 files changed, 479 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-input-read-array-interface.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-input-read-mat.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst-interface-builtin.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst-interface.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-input-read-simple-interface.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-input-read-simple.shader_test

diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-input-read-array-interface.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-array-interface.shader_test
new file mode 100644
index 0000000..39c5399
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-array-interface.shader_test
@@ -0,0 +1,70 @@
+# Test a single per-vertex input read in a TCS.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+out block { vec4 v[2]; };
+
+void main()
+{
+	v[0].x = 24.0;
+	v[1].x = 42.0;
+}
+
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+uniform int k;
+in block { vec4 v[2]; } per_vertex[];
+layout(vertices = 1) out;
+
+void main()
+{
+	if (per_vertex[0].v[1].x == 42.0) {	/* constant index case */
+		gl_TessLevelInner[0] = 1.0;
+		gl_TessLevelInner[1] = 1.0;
+
+		gl_TessLevelOuter[0] = 1.0;
+		gl_TessLevelOuter[1] = 1.0;
+		gl_TessLevelOuter[2] = 1.0;
+		gl_TessLevelOuter[3] = 1.0;
+	} else {
+		gl_TessLevelInner[0] = 0.0;
+		gl_TessLevelInner[1] = 0.0;
+
+		gl_TessLevelOuter[0] = 0.0;
+		gl_TessLevelOuter[1] = 0.0;
+		gl_TessLevelOuter[2] = 0.0;
+		gl_TessLevelOuter[3] = 0.0;
+	}
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+void main()
+{
+	gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-input-read-mat.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-mat.shader_test
new file mode 100644
index 0000000..5e7858c
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-mat.shader_test
@@ -0,0 +1,68 @@
+# Test a single per-vertex input read in a TCS.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+out mat4 v;
+
+void main()
+{
+	v[2][2] = 42.0;
+}
+
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+in mat4 v[];
+layout(vertices = 1) out;
+
+void main()
+{
+	if (v[0][2][2] == 42.0) {	/* constant index case */
+		gl_TessLevelInner[0] = 1.0;
+		gl_TessLevelInner[1] = 1.0;
+
+		gl_TessLevelOuter[0] = 1.0;
+		gl_TessLevelOuter[1] = 1.0;
+		gl_TessLevelOuter[2] = 1.0;
+		gl_TessLevelOuter[3] = 1.0;
+	} else {
+		gl_TessLevelInner[0] = 0.0;
+		gl_TessLevelInner[1] = 0.0;
+
+		gl_TessLevelOuter[0] = 0.0;
+		gl_TessLevelOuter[1] = 0.0;
+		gl_TessLevelOuter[2] = 0.0;
+		gl_TessLevelOuter[3] = 0.0;
+	}
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+void main()
+{
+	gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst-interface-builtin.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst-interface-builtin.shader_test
new file mode 100644
index 0000000..569b372
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst-interface-builtin.shader_test
@@ -0,0 +1,65 @@
+# Test a single per-vertex input read in a TCS.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+void main()
+{
+	gl_Position = vec4(42.0);
+}
+
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(vertices = 1) out;
+
+void main()
+{
+	if (gl_in[gl_InvocationID].gl_Position.x == 42.0) {
+		gl_TessLevelInner[0] = 1.0;
+		gl_TessLevelInner[1] = 1.0;
+
+		gl_TessLevelOuter[0] = 1.0;
+		gl_TessLevelOuter[1] = 1.0;
+		gl_TessLevelOuter[2] = 1.0;
+		gl_TessLevelOuter[3] = 1.0;
+	} else {
+		gl_TessLevelInner[0] = 0.0;
+		gl_TessLevelInner[1] = 0.0;
+
+		gl_TessLevelOuter[0] = 0.0;
+		gl_TessLevelOuter[1] = 0.0;
+		gl_TessLevelOuter[2] = 0.0;
+		gl_TessLevelOuter[3] = 0.0;
+	}
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+void main()
+{
+	gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst-interface.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst-interface.shader_test
new file mode 100644
index 0000000..c83e6fb
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst-interface.shader_test
@@ -0,0 +1,72 @@
+# Test a single per-vertex input read in a TCS.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+out block {
+	float v;
+};
+
+void main()
+{
+	v = 42.0;
+}
+
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+in block {
+	float v;
+} verts[2];
+layout(vertices = 1) out;
+
+void main()
+{
+	if (verts[gl_InvocationID].v == 42.0) {
+		gl_TessLevelInner[0] = 1.0;
+		gl_TessLevelInner[1] = 1.0;
+
+		gl_TessLevelOuter[0] = 1.0;
+		gl_TessLevelOuter[1] = 1.0;
+		gl_TessLevelOuter[2] = 1.0;
+		gl_TessLevelOuter[3] = 1.0;
+	} else {
+		gl_TessLevelInner[0] = 0.0;
+		gl_TessLevelInner[1] = 0.0;
+
+		gl_TessLevelOuter[0] = 0.0;
+		gl_TessLevelOuter[1] = 0.0;
+		gl_TessLevelOuter[2] = 0.0;
+		gl_TessLevelOuter[3] = 0.0;
+	}
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+void main()
+{
+	gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst.shader_test
new file mode 100644
index 0000000..2e3d1ff
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-nonconst.shader_test
@@ -0,0 +1,68 @@
+# Test a single per-vertex input read in a TCS.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+out float v;
+
+void main()
+{
+	v = 42.0;
+}
+
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+in float v[2];
+layout(vertices = 1) out;
+
+void main()
+{
+	if (v[gl_InvocationID] == 42.0) {
+		gl_TessLevelInner[0] = 1.0;
+		gl_TessLevelInner[1] = 1.0;
+
+		gl_TessLevelOuter[0] = 1.0;
+		gl_TessLevelOuter[1] = 1.0;
+		gl_TessLevelOuter[2] = 1.0;
+		gl_TessLevelOuter[3] = 1.0;
+	} else {
+		gl_TessLevelInner[0] = 0.0;
+		gl_TessLevelInner[1] = 0.0;
+
+		gl_TessLevelOuter[0] = 0.0;
+		gl_TessLevelOuter[1] = 0.0;
+		gl_TessLevelOuter[2] = 0.0;
+		gl_TessLevelOuter[3] = 0.0;
+	}
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+void main()
+{
+	gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-input-read-simple-interface.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-simple-interface.shader_test
new file mode 100644
index 0000000..95696e2
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-simple-interface.shader_test
@@ -0,0 +1,68 @@
+# Test a single per-vertex input read in a TCS.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+out block { float v; };
+
+void main()
+{
+	v = 42.0;
+}
+
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+in block { float v; } per_vertex[];
+layout(vertices = 1) out;
+
+void main()
+{
+	if (per_vertex[0].v == 42.0) {	/* constant index case */
+		gl_TessLevelInner[0] = 1.0;
+		gl_TessLevelInner[1] = 1.0;
+
+		gl_TessLevelOuter[0] = 1.0;
+		gl_TessLevelOuter[1] = 1.0;
+		gl_TessLevelOuter[2] = 1.0;
+		gl_TessLevelOuter[3] = 1.0;
+	} else {
+		gl_TessLevelInner[0] = 0.0;
+		gl_TessLevelInner[1] = 0.0;
+
+		gl_TessLevelOuter[0] = 0.0;
+		gl_TessLevelOuter[1] = 0.0;
+		gl_TessLevelOuter[2] = 0.0;
+		gl_TessLevelOuter[3] = 0.0;
+	}
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+void main()
+{
+	gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-input-read-simple.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-simple.shader_test
new file mode 100644
index 0000000..d0a226c
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tcs-input-read-simple.shader_test
@@ -0,0 +1,68 @@
+# Test a single per-vertex input read in a TCS.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+out float v;
+
+void main()
+{
+	v = 42.0;
+}
+
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+in float v[];
+layout(vertices = 1) out;
+
+void main()
+{
+	if (v[0] == 42.0) {	/* constant index case */
+		gl_TessLevelInner[0] = 1.0;
+		gl_TessLevelInner[1] = 1.0;
+
+		gl_TessLevelOuter[0] = 1.0;
+		gl_TessLevelOuter[1] = 1.0;
+		gl_TessLevelOuter[2] = 1.0;
+		gl_TessLevelOuter[3] = 1.0;
+	} else {
+		gl_TessLevelInner[0] = 0.0;
+		gl_TessLevelInner[1] = 0.0;
+
+		gl_TessLevelOuter[0] = 0.0;
+		gl_TessLevelOuter[1] = 0.0;
+		gl_TessLevelOuter[2] = 0.0;
+		gl_TessLevelOuter[3] = 0.0;
+	}
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+void main()
+{
+	gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.1.4



More information about the Piglit mailing list