[Piglit] [PATCH] Add gl_TessLevelInner/Outer tests that use non-constant array indices.

Kenneth Graunke kenneth at whitecape.org
Wed Jun 1 02:22:02 UTC 2016


Constant indexing is easy.  Indirect addressing is easier to mess up.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 ...ner-tessouter-inputs-quads-indirect.shader_test | 75 +++++++++++++++++++
 ...nner-tessouter-inputs-tris-indirect.shader_test | 84 ++++++++++++++++++++++
 2 files changed, 159 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/execution/vs-tcs-tes-tessinner-tessouter-inputs-quads-indirect.shader_test
 create mode 100644 tests/spec/arb_tessellation_shader/execution/vs-tcs-tes-tessinner-tessouter-inputs-tris-indirect.shader_test

Apparently I wrote this test in November 2015 but never sent it...

diff --git a/tests/spec/arb_tessellation_shader/execution/vs-tcs-tes-tessinner-tessouter-inputs-quads-indirect.shader_test b/tests/spec/arb_tessellation_shader/execution/vs-tcs-tes-tessinner-tessouter-inputs-quads-indirect.shader_test
new file mode 100644
index 0000000..41487ab
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/vs-tcs-tes-tessinner-tessouter-inputs-quads-indirect.shader_test
@@ -0,0 +1,75 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+
+[vertex shader]
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader: require
+layout(vertices = 1) out;
+
+uniform int zero;
+uniform int one;
+uniform int two;
+uniform int three;
+
+void main() {
+	gl_TessLevelOuter[zero]  = 3.0;
+	gl_TessLevelOuter[one]   = 2.0;
+	gl_TessLevelOuter[two]   = 4.0;
+	gl_TessLevelOuter[three] = 5.0;
+
+	gl_TessLevelInner[zero]  = 6.0;
+	gl_TessLevelInner[one]   = 7.0;
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader: require
+layout(quads) in;
+
+uniform int zero;
+uniform int one;
+uniform int two;
+uniform int three;
+
+out vec4 color;
+
+void main() {
+	gl_Position = vec4(gl_TessCoord.xy * 2 - 1, 0, 1);
+	color = gl_TessLevelOuter[zero]  == 3.0 &&
+	        gl_TessLevelOuter[one]   == 2.0 &&
+	        gl_TessLevelOuter[two]   == 4.0 &&
+	        gl_TessLevelOuter[three] == 5.0 &&
+		gl_TessLevelInner[zero]  == 6.0 &&
+		gl_TessLevelInner[one]   == 7.0 ?
+			vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+	gl_FragColor = color;
+}
+
+[test]
+uniform int zero  0
+uniform int one   1
+uniform int two   2
+uniform int three 3
+clear color 0.1 0.1 0.1 0.1
+clear
+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/vs-tcs-tes-tessinner-tessouter-inputs-tris-indirect.shader_test b/tests/spec/arb_tessellation_shader/execution/vs-tcs-tes-tessinner-tessouter-inputs-tris-indirect.shader_test
new file mode 100644
index 0000000..3d55e1e
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/vs-tcs-tes-tessinner-tessouter-inputs-tris-indirect.shader_test
@@ -0,0 +1,84 @@
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+
+[vertex shader]
+in vec4 vertex;
+
+void main()
+{
+	gl_Position = vertex;
+}
+
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader: require
+layout(vertices = 3) out;
+
+uniform int zero;
+uniform int one;
+uniform int two;
+uniform int three;
+
+void main() {
+	gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
+	gl_TessLevelOuter[zero]  = 3.0;
+	gl_TessLevelOuter[one]   = 2.0;
+	gl_TessLevelOuter[two]   = 4.0;
+	gl_TessLevelOuter[three] = 5.0;
+
+	gl_TessLevelInner[zero]  = 6.0;
+	gl_TessLevelInner[one]   = 7.0;
+}
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader: require
+layout(triangles) in;
+
+uniform int zero;
+uniform int one;
+uniform int two;
+
+out vec4 color;
+
+void main() {
+	gl_Position = gl_in[0].gl_Position * gl_TessCoord[0]
+	            + gl_in[1].gl_Position * gl_TessCoord[1]
+	            + gl_in[2].gl_Position * gl_TessCoord[2];
+	color = gl_TessLevelOuter[zero] == 3.0 &&
+	        gl_TessLevelOuter[one]  == 2.0 &&
+	        gl_TessLevelOuter[two]  == 4.0 &&
+		gl_TessLevelInner[zero] == 6.0 ?
+			vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+
+}
+
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+	gl_FragColor = color;
+}
+
+[vertex data]
+vertex/float/2
+-1.0 -1.0
+ 1.0 -1.0
+-1.0  1.0
+-1.0  1.0
+ 1.0 -1.0
+ 1.0  1.0
+
+[test]
+uniform int zero  0
+uniform int one   1
+uniform int two   2
+uniform int three 3
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 6
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.8.3



More information about the Piglit mailing list