From 88ec73e5e8384a7671838518c987889ffb02ad3e Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 5 Feb 2022 23:03:32 +0100 Subject: [PATCH] nir/fold_16bit_sampler_conversions: Fix dest type mismatches. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5996 Fixes: fb29cef8dda ("nir: add many passes that lower and optimize 16-bit input/outputs and samplers") Signed-off-by: Georg Lehmann Reviewed-by: Daniel Schürmann Part-of: --- src/compiler/nir/nir_lower_mediump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_lower_mediump.c b/src/compiler/nir/nir_lower_mediump.c index 04823df6642..3ebb6dcd06d 100644 --- a/src/compiler/nir/nir_lower_mediump.c +++ b/src/compiler/nir/nir_lower_mediump.c @@ -517,8 +517,9 @@ nir_fold_16bit_sampler_conversions(nir_shader *nir, } /* Optimize the destination. */ - bool is_f32_to_f16 = true; - bool is_i32_to_i16 = true; /* same behavior for int and uint */ + bool is_f32_to_f16 = tex->dest_type & nir_type_float; + /* same behavior for int and uint */ + bool is_i32_to_i16 = tex->dest_type & (nir_type_int | nir_type_uint); nir_foreach_use(use, &tex->dest.ssa) { is_f32_to_f16 &= is_f32_to_f16_conversion(use->parent_instr);