glsl_to_tgsi: use swizzle_for_size for src reg in conditional moves

This prevents the copy propagation pass from being confused by undefined
channels and thus missing optimization opportunities.
This commit is contained in:
Bryan Cain
2011-06-23 19:35:36 -05:00
parent 8c50f18b29
commit 8b881ad1c3
+5 -2
View File
@@ -1882,10 +1882,13 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
st_src_reg condition = this->result;
for (i = 0; i < type_size(ir->lhs->type); i++) {
st_src_reg l_src = st_src_reg(l);
l_src.swizzle = swizzle_for_size(ir->lhs->type->vector_elements);
if (switch_order) {
emit(ir, TGSI_OPCODE_CMP, l, condition, st_src_reg(l), r);
emit(ir, TGSI_OPCODE_CMP, l, condition, l_src, r);
} else {
emit(ir, TGSI_OPCODE_CMP, l, condition, r, st_src_reg(l));
emit(ir, TGSI_OPCODE_CMP, l, condition, r, l_src);
}
l.index++;