summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-06-28 12:16:03 -0700
committerEric Anholt <[email protected]>2010-06-28 12:17:25 -0700
commitcbe52c8012659abe5d81cf1180659820e704d290 (patch)
treee6c3d518d51feb013b2055e1f601384b3f6bba6a /src/mesa
parent854fd66cbb569cb3d4768196f4c680eff489733e (diff)
ir_to_mesa: Fix EmitCondCodes for boolean vars as condition.
Fixes glsl-vs-if-bool.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/ir_to_mesa.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/shader/ir_to_mesa.cpp b/src/mesa/shader/ir_to_mesa.cpp
index 3141a53f5d2..85aedd69676 100644
--- a/src/mesa/shader/ir_to_mesa.cpp
+++ b/src/mesa/shader/ir_to_mesa.cpp
@@ -1146,12 +1146,26 @@ void
ir_to_mesa_visitor::visit(ir_if *ir)
{
ir_to_mesa_instruction *cond_inst, *if_inst, *else_inst = NULL;
+ ir_to_mesa_instruction *prev_inst;
+
+ prev_inst = (ir_to_mesa_instruction *)this->instructions.get_tail();
ir->condition->accept(this);
assert(this->result.file != PROGRAM_UNDEFINED);
if (ctx->Shader.EmitCondCodes) {
cond_inst = (ir_to_mesa_instruction *)this->instructions.get_tail();
+
+ /* See if we actually generated any instruction for generating
+ * the condition. If not, then cook up a move to a temp so we
+ * have something to set cond_update on.
+ */
+ if (cond_inst == prev_inst) {
+ ir_to_mesa_src_reg temp = get_temp(glsl_type::bool_type);
+ cond_inst = ir_to_mesa_emit_op1(ir->condition, OPCODE_MOV,
+ ir_to_mesa_dst_reg_from_src(temp),
+ result);
+ }
cond_inst->cond_update = GL_TRUE;
if_inst = ir_to_mesa_emit_op1(ir->condition,