diff options
author | Plamena Manolova <[email protected]> | 2018-04-27 14:12:30 +0100 |
---|---|---|
committer | Plamena Manolova <[email protected]> | 2018-06-01 16:36:36 +0100 |
commit | 60e843c4d5a5688196d13611a357cdc5b1b1141d (patch) | |
tree | d8df5f37248c6b7f8622b0e8bf1fa643b9f147f5 /src/compiler/glsl/glsl_parser.yy | |
parent | 53719f818cf320add55dc7ed3612725c2f6128ce (diff) |
mesa: Add GL/GLSL plumbing for ARB_fragment_shader_interlock.
This extension provides new GLSL built-in functions
beginInvocationInterlockARB() and endInvocationInterlockARB()
that delimit a critical section of fragment shader code. For
pairs of shader invocations with "overlapping" coverage in a
given pixel, the OpenGL implementation will guarantee that the
critical section of the fragment shader will be executed for
only one fragment at a time.
Signed-off-by: Plamena Manolova <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glsl_parser.yy')
-rw-r--r-- | src/compiler/glsl/glsl_parser.yy | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_parser.yy b/src/compiler/glsl/glsl_parser.yy index b4951a258aa..91c10ce1a60 100644 --- a/src/compiler/glsl/glsl_parser.yy +++ b/src/compiler/glsl/glsl_parser.yy @@ -1432,6 +1432,36 @@ layout_qualifier_id: } } + const bool pixel_interlock_ordered = match_layout_qualifier($1, + "pixel_interlock_ordered", state) == 0; + const bool pixel_interlock_unordered = match_layout_qualifier($1, + "pixel_interlock_unordered", state) == 0; + const bool sample_interlock_ordered = match_layout_qualifier($1, + "sample_interlock_ordered", state) == 0; + const bool sample_interlock_unordered = match_layout_qualifier($1, + "sample_interlock_unordered", state) == 0; + + if (pixel_interlock_ordered + pixel_interlock_unordered + + sample_interlock_ordered + sample_interlock_unordered > 0 && + state->stage != MESA_SHADER_FRAGMENT) { + _mesa_glsl_error(& @1, state, "interlock layout qualifiers: " + "pixel_interlock_ordered, pixel_interlock_unordered, " + "sample_interlock_ordered and sample_interlock_unordered, " + "only valid in fragment shader input layout declaration."); + } else if (pixel_interlock_ordered + pixel_interlock_unordered + + sample_interlock_ordered + sample_interlock_unordered > 0 && + !state->ARB_fragment_shader_interlock_enable) { + _mesa_glsl_error(& @1, state, + "interlock layout qualifier present, but the " + "GL_ARB_fragment_shader_interlock extension is not " + "enabled."); + } else { + $$.flags.q.pixel_interlock_ordered = pixel_interlock_ordered; + $$.flags.q.pixel_interlock_unordered = pixel_interlock_unordered; + $$.flags.q.sample_interlock_ordered = sample_interlock_ordered; + $$.flags.q.sample_interlock_unordered = sample_interlock_unordered; + } + /* Layout qualifiers for tessellation evaluation shaders. */ if (!$$.flags.i) { static const struct { |