Handle logic not in constant expression evaluation.
authorEric Anholt <eric@anholt.net>
Thu, 1 Apr 2010 07:09:02 +0000 (21:09 -1000)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 2 Apr 2010 18:22:41 +0000 (11:22 -0700)
ir_constant_expression.cpp

index 942bd8097e1c4d9e05ce2952218bc88b4d77e2a0..c7c4d7b2449784d6b17cd6e072d491c093db6117 100644 (file)
@@ -135,6 +135,13 @@ ir_constant_visitor::visit(ir_expression *ir)
    ir_constant *op[2];
 
    switch (ir->operation) {
+   case ir_unop_logic_not:
+      op[0] = ir->operands[0]->constant_expression_value();
+      if (op[0]) {
+        value = new ir_constant(!op[0]->value.b[0]);
+        value->type = glsl_type::bool_type;
+      }
+      break;
    case ir_binop_mul:
       op[0] = ir->operands[0]->constant_expression_value();
       op[1] = ir->operands[1]->constant_expression_value();