mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-17 01:50:35 +02:00
i965/fs: set rounding mode when emitting fadd, fmul and ffma instructions
v2: - Updated to renamed shader info member (Andres). Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Signed-off-by: Andres Gomez <agomez@igalia.com> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:
parent
9da56ffc52
commit
ba1e25e1aa
1 changed files with 34 additions and 1 deletions
|
|
@ -686,6 +686,16 @@ brw_rnd_mode_from_nir_op (const nir_op op) {
|
|||
}
|
||||
}
|
||||
|
||||
static brw_rnd_mode
|
||||
brw_rnd_mode_from_execution_mode(unsigned execution_mode)
|
||||
{
|
||||
if (nir_has_any_rounding_mode_rtne(execution_mode))
|
||||
return BRW_RND_MODE_RTNE;
|
||||
if (nir_has_any_rounding_mode_rtz(execution_mode))
|
||||
return BRW_RND_MODE_RTZ;
|
||||
return BRW_RND_MODE_UNSPECIFIED;
|
||||
}
|
||||
|
||||
fs_reg
|
||||
fs_visitor::prepare_alu_destination_and_sources(const fs_builder &bld,
|
||||
nir_alu_instr *instr,
|
||||
|
|
@ -989,6 +999,8 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr,
|
|||
{
|
||||
struct brw_wm_prog_key *fs_key = (struct brw_wm_prog_key *) this->key;
|
||||
fs_inst *inst;
|
||||
unsigned execution_mode =
|
||||
bld.shader->nir->info.float_controls_execution_mode;
|
||||
|
||||
fs_reg op[4];
|
||||
fs_reg result = prepare_alu_destination_and_sources(bld, instr, op, need_dest);
|
||||
|
|
@ -1198,8 +1210,15 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr,
|
|||
inst->saturate = instr->dest.saturate;
|
||||
break;
|
||||
|
||||
case nir_op_iadd:
|
||||
case nir_op_fadd:
|
||||
if (nir_has_any_rounding_mode_enabled(execution_mode)) {
|
||||
brw_rnd_mode rnd =
|
||||
brw_rnd_mode_from_execution_mode(execution_mode);
|
||||
bld.emit(SHADER_OPCODE_RND_MODE, bld.null_reg_ud(),
|
||||
brw_imm_d(rnd));
|
||||
}
|
||||
/* fallthrough */
|
||||
case nir_op_iadd:
|
||||
inst = bld.ADD(result, op[0], op[1]);
|
||||
inst->saturate = instr->dest.saturate;
|
||||
break;
|
||||
|
|
@ -1217,6 +1236,13 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr,
|
|||
}
|
||||
}
|
||||
|
||||
if (nir_has_any_rounding_mode_enabled(execution_mode)) {
|
||||
brw_rnd_mode rnd =
|
||||
brw_rnd_mode_from_execution_mode(execution_mode);
|
||||
bld.emit(SHADER_OPCODE_RND_MODE, bld.null_reg_ud(),
|
||||
brw_imm_d(rnd));
|
||||
}
|
||||
|
||||
inst = bld.MUL(result, op[0], op[1]);
|
||||
inst->saturate = instr->dest.saturate;
|
||||
break;
|
||||
|
|
@ -1750,6 +1776,13 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr,
|
|||
break;
|
||||
|
||||
case nir_op_ffma:
|
||||
if (nir_has_any_rounding_mode_enabled(execution_mode)) {
|
||||
brw_rnd_mode rnd =
|
||||
brw_rnd_mode_from_execution_mode(execution_mode);
|
||||
bld.emit(SHADER_OPCODE_RND_MODE, bld.null_reg_ud(),
|
||||
brw_imm_d(rnd));
|
||||
}
|
||||
|
||||
inst = bld.MAD(result, op[2], op[1], op[0]);
|
||||
inst->saturate = instr->dest.saturate;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue