diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp index 0a56d4b9fba..a9e1b7e07c1 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp @@ -2819,12 +2819,10 @@ emit_alu_trans_op1_cayman(const nir_alu_instr& alu, EAluOp opcode, Shader& shade auto pin = pin_for_components(alu); - unsigned ncomp = 4; //nir_dest_num_components(alu.dest.dest) == 4 ? 4 : 3; - - /* todo: Actually we need only three channels, but then we have - * to make sure that we don't hava w dest */ - for (unsigned j = 0; j < ncomp; ++j) { + for (unsigned j = 0; j < nir_dest_num_components(alu.dest.dest); ++j) { if (alu.dest.write_mask & (1 << j)) { + unsigned ncomp = j == 3 ? 4 : 3; + AluInstr::SrcValues srcs(ncomp); PRegister dest = value_factory.dest(alu.dest.dest, j, pin, (1 << ncomp) - 1);