summaryrefslogtreecommitdiffstats
path: root/src/intel/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel/compiler')
-rw-r--r--src/intel/compiler/brw_nir_lower_image_load_store.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/intel/compiler/brw_nir_lower_image_load_store.c b/src/intel/compiler/brw_nir_lower_image_load_store.c
index 1a7671b74b1..269dbf8e283 100644
--- a/src/intel/compiler/brw_nir_lower_image_load_store.c
+++ b/src/intel/compiler/brw_nir_lower_image_load_store.c
@@ -555,27 +555,11 @@ convert_color_for_store(nir_builder *b, const struct gen_device_info *devinfo,
break;
case ISL_UINT:
- if (image.bits[0] < 32) {
- nir_const_value max;
- for (unsigned i = 0; i < image.chans; i++) {
- assert(image.bits[i] < 32);
- max.u32[i] = (1u << image.bits[i]) - 1;
- }
- color = nir_umin(b, color, nir_build_imm(b, image.chans, 32, max));
- }
+ color = nir_format_clamp_uint(b, color, image.bits);
break;
case ISL_SINT:
- if (image.bits[0] < 32) {
- nir_const_value min, max;
- for (unsigned i = 0; i < image.chans; i++) {
- assert(image.bits[i] < 32);
- max.i32[i] = (1 << (image.bits[i] - 1)) - 1;
- min.i32[i] = -(1 << (image.bits[i] - 1));
- }
- color = nir_imin(b, color, nir_build_imm(b, image.chans, 32, max));
- color = nir_imax(b, color, nir_build_imm(b, image.chans, 32, min));
- }
+ color = nir_format_clamp_sint(b, color, image.bits);
break;
default: