From: Chris Forbes <[email protected]>

These are interesting basic cases for i965, even without per-vertex
outputs.

v2: fixed by Marek

Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
---
 .../execution/invocation-counting-even.shader_test | 60 ++++++++++++++++++++++
 .../execution/invocation-counting-odd.shader_test  | 60 ++++++++++++++++++++++
 2 files changed, 120 insertions(+)
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/invocation-counting-even.shader_test
 create mode 100644 
tests/spec/arb_tessellation_shader/execution/invocation-counting-odd.shader_test

diff --git 
a/tests/spec/arb_tessellation_shader/execution/invocation-counting-even.shader_test
 
b/tests/spec/arb_tessellation_shader/execution/invocation-counting-even.shader_test
new file mode 100644
index 0000000..0052572
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/invocation-counting-even.shader_test
@@ -0,0 +1,60 @@
+# Test that the correct set of invocations is dispatched
+# for an even number of output vertices
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+GL_ARB_shader_atomic_counters
+
+[vertex shader passthrough]
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+#extension GL_ARB_shader_atomic_counters : require
+
+layout(vertices = 4) out;
+
+layout(binding=0) uniform atomic_uint x;
+
+void main()
+{
+       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;
+
+       int i;
+       for (i=0; i<=gl_InvocationID; i++)
+               atomicCounterIncrement(x);
+}
+
+[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]
+atomic counters 1
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+
+probe atomic counter 0 == 10
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_tessellation_shader/execution/invocation-counting-odd.shader_test
 
b/tests/spec/arb_tessellation_shader/execution/invocation-counting-odd.shader_test
new file mode 100644
index 0000000..446c8d7
--- /dev/null
+++ 
b/tests/spec/arb_tessellation_shader/execution/invocation-counting-odd.shader_test
@@ -0,0 +1,60 @@
+# Test that the correct set of invocations is dispatched
+# for an odd number of output vertices
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+GL_ARB_shader_atomic_counters
+
+[vertex shader passthrough]
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+#extension GL_ARB_shader_atomic_counters : require
+
+layout(vertices = 3) out;
+
+layout(binding=0) uniform atomic_uint x;
+
+void main()
+{
+       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;
+
+       int i;
+       for (i=0; i<=gl_InvocationID; i++)
+               atomicCounterIncrement(x);
+}
+
+[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]
+atomic counters 1
+patch parameter vertices 1
+draw arrays GL_PATCHES 0 1
+
+probe atomic counter 0 == 6
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.1.4

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to