1 # Test the gl_PrimitiveID input in the TES.
5 GL_ARB_tessellation_shader
6 GL_ARB_shader_atomic_counters
7 INT GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS >= 1
9 [vertex shader passthrough]
11 [tessellation control shader]
13 #extension GL_ARB_tessellation_shader : require
15 layout(vertices = 1) out;
22 gl_TessLevelInner[0] = 1.0;
23 gl_TessLevelInner[1] = 1.0;
25 gl_TessLevelOuter[0] = 1.0;
26 gl_TessLevelOuter[1] = 1.0;
27 gl_TessLevelOuter[2] = 1.0;
28 gl_TessLevelOuter[3] = 1.0;
31 [tessellation evaluation shader]
33 #extension GL_ARB_tessellation_shader : require
34 #extension GL_ARB_shader_atomic_counters: require
36 layout(quads, equal_spacing) in;
39 layout(binding=0) uniform atomic_uint matches;
40 layout(binding=0, offset=4) uniform atomic_uint mismatches;
44 gl_Position = vec4(0);
46 /* primitive ID observed in TES should be the same as in TCS */
47 if (id == gl_PrimitiveID)
48 atomicCounterIncrement(matches);
50 atomicCounterIncrement(mismatches);
59 gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
64 patch parameter vertices 1
65 draw arrays GL_PATCHES 0 4
67 probe atomic counter 0 == 16
68 probe atomic counter 1 == 0