arb_tessellation_shader: Test unmatched TCS output usage

Submitted by Danylo Piliaiev on Jan. 2, 2019, 3:39 p.m.

Details

Message ID 20190102153912.11640-1-danylo.piliaiev@globallogic.com
State New
Headers show
Series "arb_tessellation_shader: Test unmatched TCS output usage" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Danylo Piliaiev Jan. 2, 2019, 3:39 p.m.
Test that TCS per-vertex outputs which are used only in
TCS stage are not converted to local variables and indeed
share data within the patch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104297
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
---
 .../tcs-output-unmatched.shader_test          | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
new file mode 100644
index 000000000..de1b0143b
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
@@ -0,0 +1,65 @@ 
+# Test that TCS per-vertex outputs which are used only in
+# TCS stage are not converted to local variables
+# and indeed share data within the patch.
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+GL_ARB_separate_shader_objects
+
+[vertex shader passthrough]
+
+
+[tessellation control shader]
+#extension GL_ARB_tessellation_shader: require
+#extension GL_ARB_separate_shader_objects: require
+#extension GL_ARB_shader_atomic_counters: require
+#extension GL_ARB_shader_atomic_counter_ops: require
+layout(vertices = 3) out;
+
+layout(location=0) out vec4 out_unused_in_tes[];
+
+layout(binding = 0) uniform atomic_uint mismatches;
+
+void main() {
+	out_unused_in_tes[gl_InvocationID] = gl_in[gl_InvocationID].gl_Position;
+
+	barrier();
+
+	if(out_unused_in_tes[0] != gl_in[0].gl_Position ||
+	   out_unused_in_tes[1] != gl_in[1].gl_Position ||
+	   out_unused_in_tes[2] != gl_in[2].gl_Position) {
+		atomicCounterIncrement(mismatches);
+     }
+}
+
+
+[tessellation evaluation shader]
+#extension GL_ARB_tessellation_shader: require
+layout(triangles) in;
+
+void main() {
+	gl_Position = vec4(0);
+}
+
+
+[fragment shader]
+
+void main()
+{
+	gl_FragColor = vec4(1.0);
+}
+
+[vertex data]
+piglit_vertex/float/4
+1 1 1 1
+2 2 2 2
+3 3 3 3
+
+[test]
+atomic counters 1
+
+patch parameter vertices 3
+draw arrays GL_PATCHES 0 3
+
+probe atomic counter 0 == 0

Comments

On 1/2/19 7:39 AM, Danylo Piliaiev wrote:
> Test that TCS per-vertex outputs which are used only in
> TCS stage are not converted to local variables and indeed
> share data within the patch.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104297
> Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
> ---
>  .../tcs-output-unmatched.shader_test          | 65 +++++++++++++++++++
>  1 file changed, 65 insertions(+)
>  create mode 100644 tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
> 
> diff --git a/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test b/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
> new file mode 100644
> index 000000000..de1b0143b
> --- /dev/null
> +++ b/tests/spec/arb_tessellation_shader/execution/tcs-output-unmatched.shader_test
> @@ -0,0 +1,65 @@
> +# Test that TCS per-vertex outputs which are used only in
> +# TCS stage are not converted to local variables
> +# and indeed share data within the patch.
> +
> +[require]
> +GLSL >= 1.50
> +GL_ARB_tessellation_shader
> +GL_ARB_separate_shader_objects
> +
> +[vertex shader passthrough]
> +
> +
> +[tessellation control shader]
> +#extension GL_ARB_tessellation_shader: require
> +#extension GL_ARB_separate_shader_objects: require
> +#extension GL_ARB_shader_atomic_counters: require

This should be listed in the [require] section.

> +#extension GL_ARB_shader_atomic_counter_ops: require

Only atomicCounterIncrement is used, so GL_ARB_shader_atomic_counter_ops
is not needed.

> +layout(vertices = 3) out;
> +
> +layout(location=0) out vec4 out_unused_in_tes[];

For consistency, 'location = 0'.

> +
> +layout(binding = 0) uniform atomic_uint mismatches;
> +
> +void main() {
> +	out_unused_in_tes[gl_InvocationID] = gl_in[gl_InvocationID].gl_Position;
> +
> +	barrier();
> +
> +	if(out_unused_in_tes[0] != gl_in[0].gl_Position ||
          ^ space here

> +	   out_unused_in_tes[1] != gl_in[1].gl_Position ||
> +	   out_unused_in_tes[2] != gl_in[2].gl_Position) {
> +		atomicCounterIncrement(mismatches);
> +     }
> +}
> +
> +
> +[tessellation evaluation shader]
> +#extension GL_ARB_tessellation_shader: require
> +layout(triangles) in;
> +
> +void main() {
> +	gl_Position = vec4(0);
> +}
> +
> +
> +[fragment shader]
> +
> +void main()
> +{
> +	gl_FragColor = vec4(1.0);
> +}
> +
> +[vertex data]
> +piglit_vertex/float/4
> +1 1 1 1
> +2 2 2 2
> +3 3 3 3
> +
> +[test]
> +atomic counters 1
> +
> +patch parameter vertices 3
> +draw arrays GL_PATCHES 0 3
> +
> +probe atomic counter 0 == 0
>