summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Cain <[email protected]>2011-06-24 22:32:26 -0500
committerBryan Cain <[email protected]>2011-08-01 17:59:09 -0500
commit3bd06e5b82b438041f50e2469be9ea68bf3b4300 (patch)
tree6a4b423666cd6ed927af335e8b4a1b5f44cc3ab1
parent194732fd7299481dd57815f46a594d155260ce17 (diff)
glsl_to_tgsi: use the correct writemask in try_emit_mad() and try_emit_sat()
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp9
1 files changed, 7 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 5f22f7091d6..13573fc1b94 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1133,6 +1133,7 @@ glsl_to_tgsi_visitor::try_emit_mad(ir_expression *ir, int mul_operand)
{
int nonmul_operand = 1 - mul_operand;
st_src_reg a, b, c;
+ st_dst_reg result_dst;
ir_expression *expr = ir->operands[mul_operand]->as_expression();
if (!expr || expr->operation != ir_binop_mul)
@@ -1146,7 +1147,9 @@ glsl_to_tgsi_visitor::try_emit_mad(ir_expression *ir, int mul_operand)
c = this->result;
this->result = get_temp(ir->type);
- emit(ir, TGSI_OPCODE_MAD, st_dst_reg(this->result), a, b, c);
+ result_dst = st_dst_reg(this->result);
+ result_dst.writemask = (1 << ir->type->vector_elements) - 1;
+ emit(ir, TGSI_OPCODE_MAD, result_dst, a, b, c);
return true;
}
@@ -1168,8 +1171,10 @@ glsl_to_tgsi_visitor::try_emit_sat(ir_expression *ir)
st_src_reg src = this->result;
this->result = get_temp(ir->type);
+ st_dst_reg result_dst = st_dst_reg(this->result);
+ result_dst.writemask = (1 << ir->type->vector_elements) - 1;
glsl_to_tgsi_instruction *inst;
- inst = emit(ir, TGSI_OPCODE_MOV, st_dst_reg(this->result), src);
+ inst = emit(ir, TGSI_OPCODE_MOV, result_dst, src);
inst->saturate = true;
return true;