From e78908d1521dcc744a17d13eb3a716cdb3b8d2b3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 9 Apr 2011 14:57:17 -1000 Subject: 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 Reviewed-by: Chad Versace Reviewed-by: Ian Romanick (cherry picked from commit 756c262756b2434efeb2c2a33a180fda0757a6e5) --- src/glsl/ast_to_hir.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index e016e10fd73..c88a745302b 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1192,9 +1192,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]); -- cgit v1.2.3