glsl2: Put side effects of the RHS of logic_or in the right branch.
authorEric Anholt <eric@anholt.net>
Thu, 22 Jul 2010 23:30:41 +0000 (16:30 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 22 Jul 2010 23:34:36 +0000 (16:34 -0700)
Kind of missing the point to only do the side effects if the LHS
evaluates as true.

Fixes:
glsl1-|| operator, short-circuit

src/glsl/ast_to_hir.cpp

index c03206fd2e5165815d85c769d7fd488800319b92..98ea789249dd89b89d69fa74abca651b11e94931 100644 (file)
@@ -898,7 +898,7 @@ ast_expression::hir(exec_list *instructions,
         ir_if *const stmt = new(ctx) ir_if(op[0]);
         instructions->push_tail(stmt);
 
-        op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state);
+        op[1] = this->subexpressions[1]->hir(&stmt->else_instructions, state);
 
         if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) {
            YYLTYPE loc = this->subexpressions[1]->get_location();