diff --git a/src/compiler/nir/nir_lower_mediump.c b/src/compiler/nir/nir_lower_mediump.c index c1baabf27ed..2e7a40d2359 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