diff --git a/src/gallium/drivers/r300/compiler/radeon_optimize.c b/src/gallium/drivers/r300/compiler/radeon_optimize.c index 4d2efd7b86d..14d8eb6bb4e 100644 --- a/src/gallium/drivers/r300/compiler/radeon_optimize.c +++ b/src/gallium/drivers/r300/compiler/radeon_optimize.c @@ -1030,6 +1030,14 @@ static void merge_channels(struct radeon_compiler * c, struct rc_instruction * i cur->U.I.SaturateMode == inst->U.I.SaturateMode && (cur->U.I.DstReg.WriteMask & orig_dst_wmask) == 0) { + /* Skip the merge if one of the instructions writes just w channel + * and we are compiling a fragment shader. We can pair-schedule it together + * later anyway and it will also give the scheduler a bit more flexibility. + */ + if (c->has_omod && (cur->U.I.DstReg.WriteMask == RC_MASK_W || + inst->U.I.DstReg.WriteMask == RC_MASK_W)) + continue; + if (inst_combination(cur, inst, RC_OPCODE_MOV, RC_OPCODE_MOV)) { if (merge_movs(c, inst, cur)) return;