[Mesa-dev] [PATCH 05/13] glsl: Add built-in functions for INTEL_shader_atomic_float_minmax
Ian Romanick
idr at freedesktop.org
Sat Jun 23 05:03:50 UTC 2018
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/glsl/builtin_functions.cpp | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
index 2a81a27fb83..d30f39c0c17 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -670,7 +670,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;
}
/** @} */
@@ -1172,6 +1185,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);
@@ -1182,6 +1198,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);
@@ -1235,6 +1254,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);
@@ -3180,6 +3202,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",
@@ -3188,6 +3213,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",
@@ -3231,6 +3259,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",
--
2.14.4
More information about the mesa-dev
mailing list