Signed-off-by: Samuel Iglesias Gonsálvez <sigles...@igalia.com> --- src/compiler/spirv/vtn_glsl450.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c index b0092bcb2ad..b62641f3db5 100644 --- a/src/compiler/spirv/vtn_glsl450.c +++ b/src/compiler/spirv/vtn_glsl450.c @@ -513,7 +513,9 @@ build_frexp64(nir_builder *b, nir_ssa_def *x, nir_ssa_def **exponent) static nir_op vtn_nir_alu_op_for_spirv_glsl_opcode(struct vtn_builder *b, - enum GLSLstd450 opcode) + enum GLSLstd450 opcode, + unsigned execution_mode, + unsigned bit_size) { switch (opcode) { case GLSLstd450Round: return nir_op_fround_even; @@ -543,7 +545,13 @@ vtn_nir_alu_op_for_spirv_glsl_opcode(struct vtn_builder *b, case GLSLstd450SMax: return nir_op_imax; case GLSLstd450FMix: return nir_op_flrp; case GLSLstd450Fma: return nir_op_ffma; - case GLSLstd450Ldexp: return nir_op_ldexp; + case GLSLstd450Ldexp: + if (nir_is_rounding_mode_rtne(execution_mode, bit_size)) + return nir_op_ldexp_rtne; + else if (nir_is_rounding_mode_rtz(execution_mode, bit_size)) + return nir_op_ldexp_rtz; + else + return nir_op_ldexp; case GLSLstd450FindILsb: return nir_op_find_lsb; case GLSLstd450FindSMsb: return nir_op_ifind_msb; case GLSLstd450FindUMsb: return nir_op_ufind_msb; @@ -821,13 +829,17 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint, return; } - default: + default: { + unsigned execution_mode = + b->shader->info.shader_float_controls_execution_mode; + val->ssa->def = nir_build_alu(&b->nb, - vtn_nir_alu_op_for_spirv_glsl_opcode(b, entrypoint), + vtn_nir_alu_op_for_spirv_glsl_opcode(b, entrypoint, execution_mode, glsl_get_bit_size(dest_type)), src[0], src[1], src[2], NULL); return; } + } } static void -- 2.19.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev