summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-03-31 16:50:55 -1000
committerIan Romanick <ian.d.romanick@intel.com>2010-04-02 11:22:41 -0700
commita5827fe8d06a1161ef3b4e2b3296431a55d4ba2e (patch)
treefe5da1981854bd30108d7f94e5cde8b2cade9780 /ast_to_hir.cpp
parent65e1a7ac6a6735e135851ddb87e48361d4677000 (diff)
Fix ast_logic_not handling to be unary, not binary.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index ca5ae86645..3166a75cf5 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -726,7 +726,6 @@ ast_expression::hir(exec_list *instructions,
case ast_logic_and:
case ast_logic_xor:
case ast_logic_or:
- case ast_logic_not:
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
@@ -748,6 +747,20 @@ ast_expression::hir(exec_list *instructions,
op[0], op[1]);
break;
+ case ast_logic_not:
+ op[0] = this->subexpressions[0]->hir(instructions, state);
+
+ if (!op[0]->type->is_boolean() || !op[0]->type->is_scalar()) {
+ YYLTYPE loc = this->subexpressions[0]->get_location();
+
+ _mesa_glsl_error(& loc, state,
+ "operand of `!' must be scalar boolean");
+ }
+
+ result = new ir_expression(operations[this->oper], glsl_type::bool_type,
+ op[0], NULL);
+ break;
+
case ast_mul_assign:
case ast_div_assign:
case ast_add_assign: