glsl: Add support for ir_unop_f2u to constant folding.
authorPaul Berry <stereotype441@gmail.com>
Wed, 13 Jun 2012 22:48:56 +0000 (15:48 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 15 Jun 2012 15:58:55 +0000 (08:58 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ir_constant_expression.cpp

index 38a1ed9..17b54b9 100644 (file)
@@ -182,6 +182,12 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
         data.i[c] = (int) op[0]->value.f[c];
       }
       break;
+   case ir_unop_f2u:
+      assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
+      for (unsigned c = 0; c < op[0]->type->components(); c++) {
+         data.i[c] = (unsigned) op[0]->value.f[c];
+      }
+      break;
    case ir_unop_i2f:
       assert(op[0]->type->base_type == GLSL_TYPE_INT);
       for (unsigned c = 0; c < op[0]->type->components(); c++) {