diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c index 31d8a230211..8d2256055f5 100644 --- a/src/compiler/spirv/vtn_alu.c +++ b/src/compiler/spirv/vtn_alu.c @@ -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 */ diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c index 486f637344e..fe81c34c4bd 100644 --- a/src/compiler/spirv/vtn_glsl450.c +++ b/src/compiler/spirv/vtn_glsl450.c @@ -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; }