diff options
author | Ian Romanick <[email protected]> | 2010-07-12 15:18:55 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2010-07-12 15:19:29 -0700 |
commit | 81d664f099a5fd5fac777480532fb4307d591451 (patch) | |
tree | dec5dbec0fa4685bcbc60a8ce91ba2371da81c0d /src/glsl/ast_to_hir.cpp | |
parent | 10d222b70266a1b6e8dde90652156c6e18bcd3c8 (diff) |
glsl2: Move temp declaration to correct side of if-statement in IR
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index a9ab17f4216..98090d2b01b 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -805,6 +805,10 @@ ast_expression::hir(exec_list *instructions, } type = glsl_type::bool_type; } else { + ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, + "and_tmp"); + instructions->push_tail(tmp); + ir_if *const stmt = new(ctx) ir_if(op[0]); instructions->push_tail(stmt); @@ -819,10 +823,6 @@ ast_expression::hir(exec_list *instructions, error_emitted = true; } - ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, - "and_tmp"); - instructions->push_tail(tmp); - ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp); ir_assignment *const then_assign = new(ctx) ir_assignment(then_deref, op[1], NULL); @@ -869,13 +869,13 @@ ast_expression::hir(exec_list *instructions, } type = glsl_type::bool_type; } else { - ir_if *const stmt = new(ctx) ir_if(op[0]); - instructions->push_tail(stmt); - ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type, "or_tmp"); instructions->push_tail(tmp); + ir_if *const stmt = new(ctx) ir_if(op[0]); + instructions->push_tail(stmt); + op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state); if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) { |