Mesa (glsl-to-tgsi): glsl_to_tgsi: use swizzle_for_size for src reg in conditional moves
Bryan Cain
bryanc at kemper.freedesktop.org
Fri Jun 24 00:42:01 UTC 2011
Module: Mesa
Branch: glsl-to-tgsi
Commit: 4e09dfa44dc1942742c55f82cf37b6910d8a2db2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e09dfa44dc1942742c55f82cf37b6910d8a2db2
Author: Bryan Cain <bryancain3 at gmail.com>
Date: Thu Jun 23 19:35:36 2011 -0500
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.
---
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index abeb44a..6d76686 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -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++;
More information about the mesa-commit
mailing list