Add a test for instanced GS inputs.

Submitted by Kenneth Graunke on May 8, 2016, 12:33 p.m.

Details

Message ID 1462710829-5115-1-git-send-email-kenneth@whitecape.org
State New
Headers show
Series "Add a test for instanced GS inputs." ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Kenneth Graunke May 8, 2016, 12:33 p.m.
All of our other tests for instanced geometry shaders don't actually
read input variables.  This is currently broken with the i965 driver's
INTEL_SCALAR_GS=1 backend; I have patches to fix it.
---
 .../execution/instanced-inputs.shader_test         | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test b/tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test
new file mode 100644
index 0000000..eceb6c3
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test
@@ -0,0 +1,60 @@ 
+[require]
+GL >= 2.0
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+    vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#extension GL_ARB_gpu_shader5 : require
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+layout(invocations = 4) in;
+
+in vec4 vertex_to_gs[3];
+
+void main()
+{
+    vec2 offset;
+    if (gl_InvocationID == 0)
+        offset.xy = vec2(-0.5, -0.5);
+    else if (gl_InvocationID == 1)
+        offset.xy = vec2( 0.5, -0.5);
+    else if (gl_InvocationID == 2)
+        offset.xy = vec2(-0.5,  0.5);
+    else if (gl_InvocationID == 3)
+        offset.xy = vec2( 0.5,  0.5);
+
+    for (int i = 0; i < 3; i++) {
+        gl_Position = vertex_to_gs[i];
+        gl_Position.xy += offset;
+        EmitVertex();
+    }
+}
+
+[fragment shader]
+void main()
+{
+    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[vertex data]
+vertex/float/2
+-0.5 -0.5
+ 0.5 -0.5
+-0.5  0.0
+ 0.5  0.0
+-0.5  0.5
+ 0.5  0.5
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLE_STRIP 0 6
+probe all rgba 0.0 1.0 0.0 1.0

Comments

On Sun, May 8, 2016 at 8:33 AM, Kenneth Graunke <kenneth@whitecape.org> wrote:
> All of our other tests for instanced geometry shaders don't actually
> read input variables.  This is currently broken with the i965 driver's
> INTEL_SCALAR_GS=1 backend; I have patches to fix it.
> ---
>  .../execution/instanced-inputs.shader_test         | 60 ++++++++++++++++++++++
>  1 file changed, 60 insertions(+)
>  create mode 100644 tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test
>
> diff --git a/tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test b/tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test
> new file mode 100644
> index 0000000..eceb6c3
> --- /dev/null
> +++ b/tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test
> @@ -0,0 +1,60 @@
> +[require]
> +GL >= 2.0
> +GLSL >= 1.50

Should probably list the GL_ARB_gpu_shader5 require in here, no?
Otherwise this will fail on GPUs that don't support gs5.

> +
> +[vertex shader]
> +in vec4 vertex;
> +out vec4 vertex_to_gs;
> +
> +void main()
> +{
> +    vertex_to_gs = vertex;
> +}
> +
> +[geometry shader]
> +#extension GL_ARB_gpu_shader5 : require
> +layout(triangles) in;
> +layout(triangle_strip, max_vertices = 3) out;
> +layout(invocations = 4) in;
> +
> +in vec4 vertex_to_gs[3];
> +
> +void main()
> +{
> +    vec2 offset;
> +    if (gl_InvocationID == 0)
> +        offset.xy = vec2(-0.5, -0.5);
> +    else if (gl_InvocationID == 1)
> +        offset.xy = vec2( 0.5, -0.5);
> +    else if (gl_InvocationID == 2)
> +        offset.xy = vec2(-0.5,  0.5);
> +    else if (gl_InvocationID == 3)
> +        offset.xy = vec2( 0.5,  0.5);
> +
> +    for (int i = 0; i < 3; i++) {
> +        gl_Position = vertex_to_gs[i];
> +        gl_Position.xy += offset;
> +        EmitVertex();
> +    }
> +}
> +
> +[fragment shader]
> +void main()
> +{
> +    gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
> +}
> +
> +[vertex data]
> +vertex/float/2
> +-0.5 -0.5
> + 0.5 -0.5
> +-0.5  0.0
> + 0.5  0.0
> +-0.5  0.5
> + 0.5  0.5
> +
> +[test]
> +clear color 0.0 0.0 0.0 0.0
> +clear
> +draw arrays GL_TRIANGLE_STRIP 0 6
> +probe all rgba 0.0 1.0 0.0 1.0
> --
> 2.8.2
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
On Sunday, May 8, 2016 10:55:11 AM PDT Ilia Mirkin wrote:
> On Sun, May 8, 2016 at 8:33 AM, Kenneth Graunke <kenneth@whitecape.org> 
wrote:
> > All of our other tests for instanced geometry shaders don't actually
> > read input variables.  This is currently broken with the i965 driver's
> > INTEL_SCALAR_GS=1 backend; I have patches to fix it.
> > ---
> >  .../execution/instanced-inputs.shader_test         | 60 +++++++++++++++++
+++++
> >  1 file changed, 60 insertions(+)
> >  create mode 100644 tests/spec/arb_gpu_shader5/execution/instanced-
inputs.shader_test
> >
> > diff --git a/tests/spec/arb_gpu_shader5/execution/instanced-
inputs.shader_test b/tests/spec/arb_gpu_shader5/execution/instanced-
inputs.shader_test
> > new file mode 100644
> > index 0000000..eceb6c3
> > --- /dev/null
> > +++ b/tests/spec/arb_gpu_shader5/execution/instanced-inputs.shader_test
> > @@ -0,0 +1,60 @@
> > +[require]
> > +GL >= 2.0
> > +GLSL >= 1.50
> 
> Should probably list the GL_ARB_gpu_shader5 require in here, no?
> Otherwise this will fail on GPUs that don't support gs5.

D'oh!  Thanks!  I was hacking up a bunch of tests in the same afternoon,
and added it to the wrong one by mistake.  I've fixed that locally.