glsl: Fix assertion checking types of constant bitshift expressions.
authorEric Anholt <eric@anholt.net>
Tue, 27 Sep 2011 21:27:58 +0000 (14:27 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 28 Sep 2011 19:09:09 +0000 (12:09 -0700)
Bitshifts are one of the rare places that GLSL allows mixed base types
without an implicit conversion occurring.

Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ir_constant_expression.cpp

index f0299a2c4a0bfe5c11a095811c17935cbe5d10b0..56a423761b590863ee984d1893e85cdcd81bec44 100644 (file)
@@ -69,7 +69,9 @@ ir_expression::constant_expression_value()
    }
 
    if (op[1] != NULL)
-      assert(op[0]->type->base_type == op[1]->type->base_type);
+      assert(op[0]->type->base_type == op[1]->type->base_type ||
+            this->operation == ir_binop_lshift ||
+            this->operation == ir_binop_rshift);
 
    bool op0_scalar = op[0]->type->is_scalar();
    bool op1_scalar = op[1] != NULL && op[1]->type->is_scalar();