diff options
author | Eric Anholt <[email protected]> | 2011-04-09 10:27:02 -1000 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-04-13 15:48:25 -0700 |
commit | 7ec0c9789669ac88fcdd66c562e6d58281b477ce (patch) | |
tree | 7a3f4611eeac4ae5d35a66f3b359f0295a5051a9 | |
parent | 01822706ec2c2501a2cd2431a90c56b334b79a5c (diff) |
glsl: Semantically check the RHS of `&&' even when short-circuiting.
We just do the AST-to-HIR processing, and only push the instructions
if needed in the constant true case.
Fixes glslparsertest/glsl2/logic-01.frag
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 42e7b5541fe..d92a437cbce 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1109,14 +1109,17 @@ ast_expression::hir(exec_list *instructions, break; case ast_logic_and: { + exec_list rhs_instructions; op[0] = get_scalar_boolean_operand(instructions, state, this, 0, "LHS", &error_emitted); + op[1] = get_scalar_boolean_operand(&rhs_instructions, state, this, 1, + "RHS", &error_emitted); ir_constant *op0_const = op[0]->constant_expression_value(); if (op0_const) { if (op0_const->value.b[0]) { - result = get_scalar_boolean_operand(instructions, state, this, 1, - "RHS", &error_emitted); + instructions->append_list(&rhs_instructions); + result = op[1]; } else { result = op0_const; } @@ -1130,10 +1133,7 @@ ast_expression::hir(exec_list *instructions, ir_if *const stmt = new(ctx) ir_if(op[0]); instructions->push_tail(stmt); - op[1] = get_scalar_boolean_operand(&stmt->then_instructions, - state, this, 1, - "RHS", &error_emitted); - + stmt->then_instructions.append_list(&rhs_instructions); 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); |