From 119435c8778dd26cb7c8bcde9f04b3982239fe60 Mon Sep 17 00:00:00 2001 From: Kevin Rogovin Date: Mon, 27 Aug 2018 09:54:23 +0300 Subject: mesa: Add GL/GLSL plumbing for INTEL_fragment_shader_ordering This extension provides new GLSL built-in function beginFragmentShaderOrderingIntel() that guarantees (taking wording of GL_INTEL_fragment_shader_ordering extension) that any memory transactions issued by shader invocations from previous primitives mapped to same xy window coordinates (and same sample when per-sample shading is active), complete and are visible to the shader invocation that called beginFragmentShaderOrderingINTEL(). One advantage of INTEL_fragment_shader_ordering over ARB_fragment_shader_interlock is that it provides a function that operates as a memory barrie (instead of a defining a critcial section) that can be called under arbitary control flow from any function (in contrast the begin/end of ARB_fragment_shader_interlock may only be called once, from main(), under no control flow. Signed-off-by: Kevin Rogovin Reviewed-by: Plamena Manolova --- src/compiler/glsl/builtin_functions.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/compiler/glsl/builtin_functions.cpp') diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index b6018806865..5650365d1d5 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -525,6 +525,12 @@ supports_nv_fragment_shader_interlock(const _mesa_glsl_parse_state *state) return state->NV_fragment_shader_interlock_enable; } +static bool +supports_intel_fragment_shader_ordering(const _mesa_glsl_parse_state *state) +{ + return state->INTEL_fragment_shader_ordering_enable; +} + static bool shader_clock(const _mesa_glsl_parse_state *state) { @@ -1305,6 +1311,11 @@ builtin_builder::create_intrinsics() supports_arb_fragment_shader_interlock, ir_intrinsic_end_invocation_interlock), NULL); + add_function("__intrinsic_begin_fragment_shader_ordering", + _invocation_interlock_intrinsic( + supports_intel_fragment_shader_ordering, + ir_intrinsic_begin_fragment_shader_ordering), NULL); + add_function("__intrinsic_shader_clock", _shader_clock_intrinsic(shader_clock, glsl_type::uvec2_type), @@ -3419,6 +3430,12 @@ builtin_builder::create_builtins() supports_nv_fragment_shader_interlock), NULL); + add_function("beginFragmentShaderOrderingINTEL", + _invocation_interlock( + "__intrinsic_begin_fragment_shader_ordering", + supports_intel_fragment_shader_ordering), + NULL); + add_function("anyInvocationARB", _vote("__intrinsic_vote_any", vote), NULL); -- cgit v1.2.3