summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-04-09 14:57:17 -1000
committerEric Anholt <[email protected]>2011-04-13 17:57:43 -0700
commit756c262756b2434efeb2c2a33a180fda0757a6e5 (patch)
treebf74d1e011039afe73da3de0f8267b77778bfe5c /src/glsl/ast_to_hir.cpp
parent175829f1a8ab0df7594131cc569462e45c1974ec (diff)
glsl: Perform type checking on "^^" operands.
We were letting any old operand through, which generally resulted in assertion failures later. Fixes array-logical-xor.vert. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r--src/glsl/ast_to_hir.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index ea20ebae114..a11bfbab887 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1196,9 +1196,16 @@ ast_expression::hir(exec_list *instructions,
}
case ast_logic_xor:
- op[0] = this->subexpressions[0]->hir(instructions, state);
- op[1] = this->subexpressions[1]->hir(instructions, state);
-
+ /* From page 33 (page 39 of the PDF) of the GLSL 1.10 spec:
+ *
+ * "The logical binary operators and (&&), or ( | | ), and
+ * exclusive or (^^). They operate only on two Boolean
+ * expressions and result in a Boolean expression."
+ */
+ op[0] = get_scalar_boolean_operand(instructions, state, this, 0, "LHS",
+ &error_emitted);
+ op[1] = get_scalar_boolean_operand(instructions, state, this, 1, "RHS",
+ &error_emitted);
result = new(ctx) ir_expression(operations[this->oper], glsl_type::bool_type,
op[0], op[1]);