diff options
Diffstat (limited to 'src/compiler/glsl/builtin_functions.cpp')
-rw-r--r-- | src/compiler/glsl/builtin_functions.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index e1ee9943172..efe90346d0e 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -513,6 +513,12 @@ shader_ballot(const _mesa_glsl_parse_state *state) } static bool +supports_arb_fragment_shader_interlock(const _mesa_glsl_parse_state *state) +{ + return state->ARB_fragment_shader_interlock_enable; +} + +static bool shader_clock(const _mesa_glsl_parse_state *state) { return state->ARB_shader_clock_enable; @@ -982,6 +988,14 @@ private: ir_function_signature *_read_invocation_intrinsic(const glsl_type *type); ir_function_signature *_read_invocation(const glsl_type *type); + + ir_function_signature *_invocation_interlock_intrinsic( + builtin_available_predicate avail, + enum ir_intrinsic_id id); + ir_function_signature *_invocation_interlock( + const char *intrinsic_name, + builtin_available_predicate avail); + ir_function_signature *_shader_clock_intrinsic(builtin_available_predicate avail, const glsl_type *type); ir_function_signature *_shader_clock(builtin_available_predicate avail, @@ -1219,6 +1233,16 @@ builtin_builder::create_intrinsics() ir_intrinsic_memory_barrier_shared), NULL); + add_function("__intrinsic_begin_invocation_interlock", + _invocation_interlock_intrinsic( + supports_arb_fragment_shader_interlock, + ir_intrinsic_begin_invocation_interlock), NULL); + + add_function("__intrinsic_end_invocation_interlock", + _invocation_interlock_intrinsic( + supports_arb_fragment_shader_interlock, + ir_intrinsic_end_invocation_interlock), NULL); + add_function("__intrinsic_shader_clock", _shader_clock_intrinsic(shader_clock, glsl_type::uvec2_type), @@ -3294,6 +3318,18 @@ builtin_builder::create_builtins() glsl_type::uint64_t_type), NULL); + add_function("beginInvocationInterlockARB", + _invocation_interlock( + "__intrinsic_begin_invocation_interlock", + supports_arb_fragment_shader_interlock), + NULL); + + add_function("endInvocationInterlockARB", + _invocation_interlock( + "__intrinsic_end_invocation_interlock", + supports_arb_fragment_shader_interlock), + NULL); + add_function("anyInvocationARB", _vote("__intrinsic_vote_any", vote), NULL); @@ -6228,6 +6264,24 @@ builtin_builder::_read_invocation(const glsl_type *type) } ir_function_signature * +builtin_builder::_invocation_interlock_intrinsic(builtin_available_predicate avail, + enum ir_intrinsic_id id) +{ + MAKE_INTRINSIC(glsl_type::void_type, id, avail, 0); + return sig; +} + +ir_function_signature * +builtin_builder::_invocation_interlock(const char *intrinsic_name, + builtin_available_predicate avail) +{ + MAKE_SIG(glsl_type::void_type, avail, 0); + body.emit(call(shader->symbols->get_function(intrinsic_name), + NULL, sig->parameters)); + return sig; +} + +ir_function_signature * builtin_builder::_shader_clock_intrinsic(builtin_available_predicate avail, const glsl_type *type) { |