r600/sfn: take number of dest values into account
authorGert Wollny <gert.wollny@collabora.com>
Mon, 7 Aug 2023 06:51:23 +0000 (08:51 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 8 Aug 2023 00:02:18 +0000 (00:02 +0000)
With the write mask removed we have to run the loop correctly.

Fixes: b870988b77f70acd69feb1d4e52343b7c3d4e328
    r600/sfn: Stop referencing legacy functionality

Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9490
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24533>

src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp

index ac050aa..d5e00ea 100644 (file)
@@ -2719,7 +2719,7 @@ emit_alu_comb_with_zero(const nir_alu_instr& alu, EAluOp opcode, Shader& shader)
    auto& value_factory = shader.value_factory();
    AluInstr *ir = nullptr;
    auto pin = pin_for_components(alu);
-   for (int i = 0; i < 4; ++i) {
+   for (unsigned i = 0; i < nir_dest_num_components(alu.dest.dest); ++i) {
       ir = new AluInstr(opcode,
                         value_factory.dest(alu.dest, i, pin),
                         value_factory.zero(),
@@ -2961,7 +2961,7 @@ emit_alu_trans_op2_eg(const nir_alu_instr& alu, EAluOp opcode, Shader& shader)
    AluInstr *ir = nullptr;
 
    auto pin = pin_for_components(alu);
-   for (int i = 0; i < 4; ++i) {
+   for (unsigned i = 0; i < nir_dest_num_components(alu.dest.dest); ++i) {
       ir = new AluInstr(opcode,
                         value_factory.dest(alu.dest.dest, i, pin),
                         value_factory.src(src0, i),