From: Georg Lehmann Date: Wed, 1 Mar 2023 12:24:30 +0000 (+0100) Subject: nir/lower_mediump: don't use fp16 for constants if the result is denormal X-Git-Tag: upstream/23.3.3~12328 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a3387a190e9eef969ffc8a4f16ecde122e15c7e;p=platform%2Fupstream%2Fmesa.git nir/lower_mediump: don't use fp16 for constants if the result is denormal Image stores are not required to preserve denorms. Reviewed-by: Marek Olšák Reviewed-by: Emma Anholt Part-of: --- diff --git a/src/compiler/nir/nir_lower_mediump.c b/src/compiler/nir/nir_lower_mediump.c index c1baabf..2e7a40d 100644 --- a/src/compiler/nir/nir_lower_mediump.c +++ b/src/compiler/nir/nir_lower_mediump.c @@ -749,7 +749,9 @@ static bool const_is_f16(nir_ssa_scalar scalar) { double value = nir_ssa_scalar_as_float(scalar); - return value == _mesa_half_to_float(_mesa_float_to_half(value)); + uint16_t fp16_val = _mesa_float_to_half(value); + bool is_denorm = (fp16_val & 0x7fff) != 0 && (fp16_val & 0x7fff) <= 0x3ff; + return value == _mesa_half_to_float(fp16_val) && !is_denorm; } static bool