Mesa (master): r600/sfn: save some instructions when doing multisample on sample 0
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Sep 28 18:23:24 UTC 2020
Module: Mesa
Branch: master
Commit: 8540523610e29e983375fbd879c31ae4debf5c8d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8540523610e29e983375fbd879c31ae4debf5c8d
Author: Gert Wollny <gert.wollny at collabora.com>
Date: Thu Sep 24 20:04:30 2020 +0200
r600/sfn: save some instructions when doing multisample on sample 0
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6879>
---
.../drivers/r600/sfn/sfn_emittexinstruction.cpp | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp
index 09ba7ba9e6f..1df96f6432e 100644
--- a/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_emittexinstruction.cpp
@@ -820,16 +820,20 @@ bool EmitTexInstruction::emit_tex_txf_ms(nir_tex_instr* instr, TexInputs& src)
emit_instruction(tex_sample_id_ir);
- emit_instruction(new AluInstruction(op2_mullo_int, help,
- {src.ms_index, PValue(new LiteralValue(4))},
- {alu_write, alu_last_instr}));
- emit_instruction(new AluInstruction(op2_lshr_int, src.coord.reg_i(3),
- {sample_id_dest.reg_i(0), help},
- {alu_write, alu_last_instr}));
+ if (src.ms_index->type() != Value::literal ||
+ static_cast<const LiteralValue&>(*src.ms_index).value() != 0) {
+ emit_instruction(new AluInstruction(op2_lshl_int, help,
+ src.ms_index, literal(2),
+ {alu_write, alu_last_instr}));
+
+ emit_instruction(new AluInstruction(op2_lshr_int, sample_id_dest.reg_i(0),
+ {sample_id_dest.reg_i(0), help},
+ {alu_write, alu_last_instr}));
+ }
emit_instruction(new AluInstruction(op2_and_int, src.coord.reg_i(3),
- {src.coord.reg_i(3), PValue(new LiteralValue(15))},
+ {sample_id_dest.reg_i(0), PValue(new LiteralValue(15))},
{alu_write, alu_last_instr}));
auto dst = make_dest(*instr);
More information about the mesa-commit
mailing list