Re: [Piglit] [PATCH] Add a test for instanced GS inputs.

2016-05-08 Thread Kenneth Graunke
On Sunday, May 8, 2016 10:55:11 AM PDT Ilia Mirkin wrote:
> On Sun, May 8, 2016 at 8:33 AM, Kenneth Graunke  
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 000..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.


signature.asc
Description: This is a digitally signed message part.
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] One additional test for arb_cull_distance + a fix

2016-05-08 Thread Tobias Klausmann
New test: Make sure gl_ClipDistance and gl_CullDistance can have arrays sizes
different to 4,8 (this is makes sure the lowering pass for those arrays are
working correct).

Fix: Make sure gl_ClipDistance & gl_CullDistance are actually used and not
thrown away by optimizations.

Signed-off-by: Tobias Klausmann 
---
 ...-distance-different-different-sized.shader_test | 55 ++
 ...s-cull-and-clip-distance-exceed-max.shader_test |  4 ++
 2 files changed, 59 insertions(+)
 create mode 100644 
tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different-different-sized.shader_test

diff --git 
a/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different-different-sized.shader_test
 
b/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different-different-sized.shader_test
new file mode 100644
index 000..c723afe
--- /dev/null
+++ 
b/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different-different-sized.shader_test
@@ -0,0 +1,55 @@
+# From the ARB_cull_distance spec:
+#
+#   The built-in output variables gl_ClipDistance and glCullDistance hold the
+#   clip distance(s) and cull distance(s), respectively, used in the culling
+#   stage, as described in section 13.5.
+#
+# This test checks that the arrays gl_ClipDistance and gl_CullDistance only
+# interfer by gl_MaxCombinedClipAndCullDistances and not by its entrys.
+#
+# This additionally checks if gl_ClipDistance and gl_CullDistance can have a
+# size different to 4 or 8.
+
+[require]
+GLSL >= 1.30
+GL_ARB_cull_distance
+
+[vertex shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+out float gl_ClipDistance[5];
+out float gl_CullDistance[2];
+
+void main()
+{
+  gl_Position = gl_Vertex;
+  for (int i = 1; i <= 5; ++i) {
+gl_ClipDistance[i-1] = i;
+  }
+  for (int j = 1; j <= 2; ++j) {
+gl_CullDistance[j-1] = j*6;
+  }
+}
+
+[fragment shader]
+#version 130
+#extension GL_ARB_cull_distance: enable
+in float gl_ClipDistance[5];
+in float gl_CullDistance[2];
+
+void main()
+{
+  gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+  for (int i = 1; i <= 5; ++i) {
+if (gl_ClipDistance[i-1] != i)
+  gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
+  }
+  for (int j = 1; j <= 2; ++j) {
+   if (gl_CullDistance[j-1] != (j*6))
+  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+  }
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-exceed-max.shader_test 
b/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-exceed-max.shader_test
index 8106092..e0a6ca0 100644
--- 
a/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-exceed-max.shader_test
+++ 
b/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-exceed-max.shader_test
@@ -22,6 +22,10 @@ out float 
gl_CullDistance[gl_MaxCombinedClipAndCullDistances];
 void main()
 {
   gl_Position = gl_Vertex;
+  for (int i = 0; i < gl_MaxCombinedClipAndCullDistances; ++i) {
+gl_ClipDistance[i] = i;
+gl_CullDistance[i] = i*5;
+  }
 }
 
 [fragment shader]
-- 
2.8.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] Add a test for instanced GS inputs.

2016-05-08 Thread Ilia Mirkin
On Sun, May 8, 2016 at 8:33 AM, Kenneth Graunke  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 000..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
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Add a test for instanced GS inputs.

2016-05-08 Thread Kenneth Graunke
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 000..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
-- 
2.8.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit