1 # Test the gl_PrimitiveID input in the TES.
5 GL_ARB_tessellation_shader
6 GL_ARB_shader_atomic_counters
8 [vertex shader passthrough]
10 [tessellation control shader]
12 #extension GL_ARB_tessellation_shader : require
14 layout(vertices = 1) out;
21 gl_TessLevelInner[0] = 1.0;
22 gl_TessLevelInner[1] = 1.0;
24 gl_TessLevelOuter[0] = 1.0;
25 gl_TessLevelOuter[1] = 1.0;
26 gl_TessLevelOuter[2] = 1.0;
27 gl_TessLevelOuter[3] = 1.0;
30 [tessellation evaluation shader]
32 #extension GL_ARB_tessellation_shader : require
33 #extension GL_ARB_shader_atomic_counters: require
35 layout(quads, equal_spacing) in;
38 layout(binding=0) uniform atomic_uint matches;
39 layout(binding=0, offset=4) uniform atomic_uint mismatches;
43 gl_Position = vec4(0);
45 /* primitive ID observed in TES should be the same as in TCS */
46 if (id == gl_PrimitiveID)
47 atomicCounterIncrement(matches);
49 atomicCounterIncrement(mismatches);
58 gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
63 patch parameter vertices 1
64 draw arrays GL_PATCHES 0 4
66 probe atomic counter 0 == 16
67 probe atomic counter 1 == 0