1 # Check proper functioning of the gl_PrimitiveID fragment shader
2 # input, in the case where there is no geometry shader.
6 GL_EXT_provoking_vertex
11 in vec4 piglit_vertex;
12 flat out int vertex_id;
16 gl_Position = piglit_vertex;
17 vertex_id = gl_VertexID;
23 flat in int vertex_id;
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:
30 * Primitive ID Vertex ID's Provoking vertex ID
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.
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);
45 gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
58 clear color 0.0 0.0 0.0 0.0
60 provoking vertex first
61 draw arrays GL_TRIANGLE_STRIP 0 6
62 probe all rgba 0.0 1.0 0.0 1.0