perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / glsl-1.50 / execution / primitive-id-no-gs-strip-first-vertex.shader_test
blob36c16e8ef363da638ad6a7b6e99dd7d90c0aa1c7
1 # Check proper functioning of the gl_PrimitiveID fragment shader
2 # input, in the case where there is no geometry shader.
4 [require]
5 GLSL >= 1.50
6 GL_EXT_provoking_vertex
8 [vertex shader]
9 #version 150
11 in vec4 piglit_vertex;
12 flat out int vertex_id;
14 void main()
16   gl_Position = piglit_vertex;
17   vertex_id = gl_VertexID;
20 [fragment shader]
21 #version 150
23 flat in int vertex_id;
25 void main()
27   /* We draw a triangle strip containing 6 vertices, so the relationship between
28    * the primitive ID and the input vertex ID's should be:
29    *
30    * Primitive ID  Vertex ID's  Provoking vertex ID
31    *  0             0 1 2        0
32    *  1             1 3 2        1
33    *  2             2 3 4        2
34    *  3             3 5 4        3
35    *
36    * Since vertex_id uses interpolation qualifier "flat", it should
37    * always receive the value from the provoking vertex.  Therefore,
38    * by the table above, it should always be the same as the
39    * expected value of gl_PrimitiveID.
40    */
41   int expected_primitive_id = vertex_id;
42   if (expected_primitive_id == gl_PrimitiveID)
43     gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
44   else
45     gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
48 [vertex data]
49 piglit_vertex/float/2
50 -1.0 -1.0
51  1.0 -1.0
52 -1.0  0.0
53  1.0  0.0
54 -1.0  1.0
55  1.0  1.0
57 [test]
58 clear color 0.0 0.0 0.0 0.0
59 clear
60 provoking vertex first
61 draw arrays GL_TRIANGLE_STRIP 0 6
62 probe all rgba 0.0 1.0 0.0 1.0