Re: [Piglit] [PATCH] Test that the fs gl_PrimitiveID input works even when there's no gs.

2013-11-04 Thread Eric Anholt
Paul Berry  writes:

> For i965/gen7 hardware, the driver has to go to extra work to make
> gl_PrimitiveID work in the case where there is no geometry shader.  So
> we need a separate test to make sure that works properly.

Reviewed-by: Eric Anholt 


pgpoMbgEA32B4.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] Test that the fs gl_PrimitiveID input works even when there's no gs.

2013-10-22 Thread Paul Berry
For i965/gen7 hardware, the driver has to go to extra work to make
gl_PrimitiveID work in the case where there is no geometry shader.  So
we need a separate test to make sure that works properly.
---
 .../execution/primitive-id-no-gs.shader_test   | 60 ++
 1 file changed, 60 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test

diff --git a/tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test 
b/tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test
new file mode 100644
index 000..7f89a8a
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/primitive-id-no-gs.shader_test
@@ -0,0 +1,60 @@
+# Check proper functioning of the gl_PrimitiveID fragment shader
+# input, in the case where there is no geometry shader.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 piglit_vertex;
+flat out int vertex_id;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  vertex_id = gl_VertexID;
+}
+
+[fragment shader]
+#version 150
+
+flat in int vertex_id;
+
+void main()
+{
+  /* We draw a triangle fan containing 6 vertices, so the relationship between
+   * the primitive ID and the input vertex ID's should be:
+   *
+   * Primitive ID  Vertex ID's  Provoking vertex ID
+   *  0 0 1 22
+   *  1 0 2 33
+   *  2 0 3 44
+   *  3 0 4 55
+   *
+   * Since vertex_id uses interpolation qualifier "flat", it should
+   * always receive the value from the provoking vertex.  Therefore,
+   * by the table above, it should always be 2 greater than the
+   * expected value of gl_PrimitiveID.
+   */
+  int expected_primitive_id = vertex_id - 2;
+  if (expected_primitive_id == gl_PrimitiveID)
+gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+  else
+gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[vertex data]
+piglit_vertex/float/2
+-1.0 -1.0
+-1.0  1.0
+ 0.0  1.0
+ 1.0  1.0
+ 1.0  0.0
+ 1.0 -1.0
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLE_FAN 0 6
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.8.4.1

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