ir_constant_expression: Add support for ir_unop_u2f.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 20 Jul 2010 20:01:56 +0000 (13:01 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 21 Jul 2010 23:38:32 +0000 (16:38 -0700)
Also make ir_unop_i2f only operate on signed integers.

src/glsl/ir_constant_expression.cpp

index b0333dbebb75db120e9de9317f40235730b7f469..acfbb8645972609ce59af47d554f1579592f1938 100644 (file)
@@ -87,13 +87,15 @@ ir_expression::constant_expression_value()
       }
       break;
    case ir_unop_i2f:
-      assert(op[0]->type->base_type == GLSL_TYPE_UINT ||
-            op[0]->type->base_type == GLSL_TYPE_INT);
+      assert(op[0]->type->base_type == GLSL_TYPE_INT);
       for (unsigned c = 0; c < op[0]->type->components(); c++) {
-        if (op[0]->type->base_type == GLSL_TYPE_INT)
-           data.f[c] = op[0]->value.i[c];
-        else
-           data.f[c] = op[0]->value.u[c];
+        data.f[c] = op[0]->value.i[c];
+      }
+      break;
+   case ir_unop_u2f:
+      assert(op[0]->type->base_type == GLSL_TYPE_UINT);
+      for (unsigned c = 0; c < op[0]->type->components(); c++) {
+        data.f[c] = op[0]->value.u[c];
       }
       break;
    case ir_unop_b2f: