diff options
Diffstat (limited to 'tests/spec/arb_tessellation_shader/execution/tes-primitiveid.shader_test')
-rw-r--r-- | tests/spec/arb_tessellation_shader/execution/tes-primitiveid.shader_test | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/spec/arb_tessellation_shader/execution/tes-primitiveid.shader_test b/tests/spec/arb_tessellation_shader/execution/tes-primitiveid.shader_test new file mode 100644 index 000000000..2ff96d34b --- /dev/null +++ b/tests/spec/arb_tessellation_shader/execution/tes-primitiveid.shader_test @@ -0,0 +1,68 @@ +# Test the gl_PrimitiveID input in the TES. + +[require] +GLSL >= 1.50 +GL_ARB_tessellation_shader +GL_ARB_shader_atomic_counters + +[vertex shader passthrough] + +[tessellation control shader] +#version 150 +#extension GL_ARB_tessellation_shader : require + +layout(vertices = 1) out; +patch out int id; + +void main() +{ + id = gl_PrimitiveID; + + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; + + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + gl_TessLevelOuter[3] = 1.0; +} + +[tessellation evaluation shader] +#version 150 +#extension GL_ARB_tessellation_shader : require +#extension GL_ARB_shader_atomic_counters: require + +layout(quads, equal_spacing) in; +patch in int id; + +layout(binding=0) uniform atomic_uint matches; +layout(binding=0, offset=4) uniform atomic_uint mismatches; + +void main() +{ + gl_Position = vec4(0); + + /* primitive ID observed in TES should be the same as in TCS */ + if (id == gl_PrimitiveID) + atomicCounterIncrement(matches); + else + atomicCounterIncrement(mismatches); + +} + +[fragment shader] +#version 150 + +void main() +{ + gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); +} + +[test] +atomic counters 2 +patch parameter vertices 1 +draw arrays GL_PATCHES 0 4 + +probe atomic counter 0 == 16 +probe atomic counter 1 == 0 + |