From 280ab4afa8a4a4b90a70df2337e5fcad485239ec Mon Sep 17 00:00:00 2001 From: Ian Romanick <ian.d.romanick@intel.com> Date: Wed, 18 Apr 2018 13:20:25 -0700 Subject: glsl: Add built-in functions for INTEL_shader_atomic_float_minmax Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> --- src/compiler/glsl/builtin_functions.cpp | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index 88a6ccecb75..2a3138ad0a5 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -676,7 +676,20 @@ shader_atomic_float_add(const _mesa_glsl_parse_state *state) static bool shader_atomic_float_exchange(const _mesa_glsl_parse_state *state) { - return state->NV_shader_atomic_float_enable; + return state->NV_shader_atomic_float_enable || + state->INTEL_shader_atomic_float_minmax_enable; +} + +static bool +INTEL_shader_atomic_float_minmax_supported(const _mesa_glsl_parse_state *state) +{ + return state->extensions->INTEL_shader_atomic_float_minmax; +} + +static bool +shader_atomic_float_minmax(const _mesa_glsl_parse_state *state) +{ + return state->INTEL_shader_atomic_float_minmax_enable; } /** @} */ @@ -1178,6 +1191,9 @@ builtin_builder::create_intrinsics() _atomic_intrinsic2(buffer_atomics_supported, glsl_type::int_type, ir_intrinsic_generic_atomic_min), + _atomic_intrinsic2(INTEL_shader_atomic_float_minmax_supported, + glsl_type::float_type, + ir_intrinsic_generic_atomic_min), _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop, ir_intrinsic_atomic_counter_min), NULL); @@ -1188,6 +1204,9 @@ builtin_builder::create_intrinsics() _atomic_intrinsic2(buffer_atomics_supported, glsl_type::int_type, ir_intrinsic_generic_atomic_max), + _atomic_intrinsic2(INTEL_shader_atomic_float_minmax_supported, + glsl_type::float_type, + ir_intrinsic_generic_atomic_max), _atomic_counter_intrinsic1(shader_atomic_counter_ops_or_v460_desktop, ir_intrinsic_atomic_counter_max), NULL); @@ -1241,6 +1260,9 @@ builtin_builder::create_intrinsics() _atomic_intrinsic3(buffer_atomics_supported, glsl_type::int_type, ir_intrinsic_generic_atomic_comp_swap), + _atomic_intrinsic3(INTEL_shader_atomic_float_minmax_supported, + glsl_type::float_type, + ir_intrinsic_generic_atomic_comp_swap), _atomic_counter_intrinsic2(shader_atomic_counter_ops_or_v460_desktop, ir_intrinsic_atomic_counter_comp_swap), NULL); @@ -3186,6 +3208,9 @@ builtin_builder::create_builtins() _atomic_op2("__intrinsic_atomic_min", buffer_atomics_supported, glsl_type::int_type), + _atomic_op2("__intrinsic_atomic_min", + shader_atomic_float_minmax, + glsl_type::float_type), NULL); add_function("atomicMax", _atomic_op2("__intrinsic_atomic_max", @@ -3194,6 +3219,9 @@ builtin_builder::create_builtins() _atomic_op2("__intrinsic_atomic_max", buffer_atomics_supported, glsl_type::int_type), + _atomic_op2("__intrinsic_atomic_max", + shader_atomic_float_minmax, + glsl_type::float_type), NULL); add_function("atomicAnd", _atomic_op2("__intrinsic_atomic_and", @@ -3237,6 +3265,9 @@ builtin_builder::create_builtins() _atomic_op3("__intrinsic_atomic_comp_swap", buffer_atomics_supported, glsl_type::int_type), + _atomic_op3("__intrinsic_atomic_comp_swap", + shader_atomic_float_minmax, + glsl_type::float_type), NULL); add_function("min3", -- cgit v1.2.3