1 # Test the gl_PrimitiveID input in the TCS.
5 GL_ARB_tessellation_shader
6 GL_ARB_shader_atomic_counters
18 [tessellation control shader]
20 #extension GL_ARB_tessellation_shader : require
21 #extension GL_ARB_shader_atomic_counters: require
23 layout(vertices = 4) out;
26 layout(binding=0) uniform atomic_uint matches;
27 layout(binding=0, offset=4) uniform atomic_uint mismatches;
31 /* we have single-vertex patches. primitive id == vertex id */
32 if (id[0] == gl_PrimitiveID)
33 atomicCounterIncrement(matches);
35 atomicCounterIncrement(mismatches);
38 gl_TessLevelInner[0] = 0.0;
39 gl_TessLevelInner[1] = 0.0;
41 gl_TessLevelOuter[0] = 0.0;
42 gl_TessLevelOuter[1] = 0.0;
43 gl_TessLevelOuter[2] = 0.0;
44 gl_TessLevelOuter[3] = 0.0;
47 [tessellation evaluation shader]
49 #extension GL_ARB_tessellation_shader : require
51 layout(quads, equal_spacing) in;
55 gl_Position = vec4(0);
63 gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
68 patch parameter vertices 1
69 draw arrays GL_PATCHES 0 4
71 probe atomic counter 0 == 16
72 probe atomic counter 1 == 0