spirv: move NoContraction handling into vtn_handle_fp_fast_math

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39460>
This commit is contained in:
Georg Lehmann 2026-01-22 15:44:13 +01:00 committed by Marge Bot
parent 5b48805b42
commit 836efa8c3c
2 changed files with 5 additions and 5 deletions

View file

@ -451,6 +451,9 @@ vtn_handle_fp_fast_math(struct vtn_builder *b, struct vtn_value *val)
}
vtn_foreach_decoration(b, val, handle_fp_fast_math, NULL);
if (b->exact || vtn_has_decoration(b, val, SpvDecorationNoContraction))
b->nb.fp_math_ctrl |= nir_fp_exact;
}
nir_rounding_mode
@ -729,8 +732,6 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
vtn_handle_fp_fast_math(b, dest_val);
if (b->exact || vtn_has_decoration(b, dest_val, SpvDecorationNoContraction))
b->nb.fp_math_ctrl |= nir_fp_exact;
bool mediump_16bit = vtn_alu_op_mediump_16bit(b, opcode, dest_val);
/* Collect the various SSA sources */

View file

@ -325,8 +325,6 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
struct vtn_ssa_value *dest = vtn_create_ssa_value(b, dest_type);
if (b->exact || vtn_has_decoration(b, dest_val, SpvDecorationNoContraction))
b->nb.fp_math_ctrl |= nir_fp_exact;
switch (entrypoint) {
case GLSLstd450Radians:
dest->def = nir_radians(nb, src[0]);
@ -637,7 +635,6 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
break;
}
}
b->nb.fp_math_ctrl = b->exact ? nir_fp_exact : nir_fp_fast_math;
if (mediump_16bit)
vtn_mediump_upconvert_value(b, dest);
@ -734,7 +731,9 @@ vtn_handle_glsl450_instruction(struct vtn_builder *b, SpvOp ext_opcode,
default:
handle_glsl450_alu(b, (enum GLSLstd450)ext_opcode, w, count);
break;
}
b->nb.fp_math_ctrl = b->exact ? nir_fp_exact : nir_fp_fast_math;
return true;
}