3 GL_ARB_fragment_shader_interlock
11 Adam Czupryna, Mobica (adam.czupryna 'at' mobica.com)
19 January 31, 2017 (version 1)
23 OpenGL 4.5 is required.
25 ARB_fragment_shader_interlock extension is required.
27 This specification is written against:
28 - OpenGL 4.5 Core Profile Specification,
29 - version 4.50 (revision 5) Shading Language Specification,
30 - ARB_fragment_shader_interlock extension Specification.
34 This test verifies if new GLSL built-in functions
35 beginInvocationInterlockARB() and endInvocationInterlockARB() provides
36 functionality for pairs of shader invocations with "overlapping"
37 coverage in a given pixel, which guarantee that the critical section of
38 the fragment shader will be executed for only one fragment at a time.
39 Test verifies also two ordered interlock modes supported by this
40 extension because testing unordered interlock modes would be
47 * Create shader that require GL_ARB_fragment_shader_interlock extension
48 and check if GL_ARB_fragment_shader_interlock is defined and equal 1.
49 Check if shader compiles with no error.
51 Shader Execution Ordering Test
53 * Create 8x8 R8 texture and clear it.
55 * Create fragment shader for ordered layout qualifiers added by this
56 extension. Shader should read pixel value from the texture at current
57 position and compare it with gl_PrimitiveID value. If value read from
58 texture is lower then gl_PrimitiveID write (1, 1, 1, 1) into
59 renderbuffer and store gl_PrimitiveID in the texture at current
60 position, otherwise write (0, 0, 0, 0) into renderbuffer and value 255
61 into texture at current position. All operations should be executed
62 between beginInvocationInterlockARB and endInvocationInterlockARB
65 * Iterate through the fragment shaders, clear texture and for each shader
66 draw three triangles at once in the same position.
68 Expected result for ordered layout qualifires is renderbuffer filled with
69 (1, 1, 1, 1) if test passed.
71 In case of sample_interlock_* qualifier multisampled texture has to be
74 There is no method to test if unordered qualifiers works correctly
75 because for those qualifiers fragment shader invocations are generally
76 executed in undefined order, which means that it could be either
77 ordered or unordered. Tests for unordered qualifiers would be
80 Shader Critical Section Execution Test
82 * Create 1x1 R8UI texture.
84 * Create two fragment shaders for all layout qualifiers added by this
85 extension. Shader should read pixel value from the texture, increase it
86 and store. In first fragment shader all operations should be executed
87 between beginInvocationInterlockARB and endInvocationInterlockARB
88 functions calls, in second one those calls should be missed.
90 * Clear texture and draw 8x8 pixel sized polygon to the renderbuffer.
92 The expected result is value 64 stored in the texture if
93 beginInvocationInterlockARB and endInvocationInterlockARB functions were
96 In case of sample_interlock_* qualifier multisampled texture has to be
101 Revision 1, 31 January, 2016 (Adam Czupryna)