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 <marek.olsak@amd.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21622>
This commit is contained in:
@@ -749,7 +749,9 @@ static bool
|
|||||||
const_is_f16(nir_ssa_scalar scalar)
|
const_is_f16(nir_ssa_scalar scalar)
|
||||||
{
|
{
|
||||||
double value = nir_ssa_scalar_as_float(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
|
static bool
|
||||||
|
Reference in New Issue
Block a user