1 # Test that the gl_PrimitiveID input in the FS is correctly set up and starts
2 # at 0 for each instance in instanced draws.
6 GL_ARB_tessellation_shader
12 out int vs_tcs_instance;
16 vs_tcs_id = gl_VertexID;
17 vs_tcs_instance = gl_InstanceID;
20 [tessellation control shader]
22 #extension GL_ARB_tessellation_shader : require
24 layout(vertices = 1) out;
26 in int vs_tcs_instance[];
27 out vec2 tcs_tes_position[];
31 tcs_tes_position[gl_InvocationID].x = -1.0 + vs_tcs_id[gl_InvocationID];
32 tcs_tes_position[gl_InvocationID].y = -1.0 + vs_tcs_instance[gl_InvocationID];
34 gl_TessLevelInner[0] = 1.0;
35 gl_TessLevelInner[1] = 1.0;
37 gl_TessLevelOuter[0] = 1.0;
38 gl_TessLevelOuter[1] = 1.0;
39 gl_TessLevelOuter[2] = 1.0;
40 gl_TessLevelOuter[3] = 1.0;
43 [tessellation evaluation shader]
45 #extension GL_ARB_tessellation_shader : require
47 layout(quads, equal_spacing) in;
49 in vec2 tcs_tes_position[];
53 gl_Position = vec4(tcs_tes_position[0].x + gl_TessCoord.x,
54 tcs_tes_position[0].y + gl_TessCoord.y,
63 gl_FragColor = vec4(0.0, 1.0, gl_PrimitiveID * 0.1, 1.0);
67 clear color 0.0 0.0 0.0 0.0
70 patch parameter vertices 1
71 draw arrays instanced GL_PATCHES 0 2 2
74 relative probe rect rgba (0.0, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0, 1.0)
75 relative probe rect rgba (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.1, 1.0)
78 relative probe rect rgba (0.0, 0.5, 0.5, 0.5) (0.0, 1.0, 0.0, 1.0)
79 relative probe rect rgba (0.5, 0.5, 0.5, 0.5) (0.0, 1.0, 0.1, 1.0)