glcpp: Add test involving token pasting of INTEGER tokens.
[mesa.git] / src / glsl / ir_constant_expression.cpp
index 7a4d15f43fb52dfd70316a75f8b5d042c1a1639b..17b54b923a4918b6dcb2be2b889c49326c4baff2 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++) {
@@ -1322,8 +1328,11 @@ ir_function_signature::constant_expression_value(exec_list *actual_parameters, s
 
    foreach_list(n, actual_parameters) {
       ir_constant *constant = ((ir_rvalue *) n)->constant_expression_value(variable_context);
-      if (constant == NULL)
-        return NULL;
+      if (constant == NULL) {
+         hash_table_dtor(deref_hash);
+         return NULL;
+      }
+
 
       ir_variable *var = (ir_variable *)parameter_info;
       hash_table_insert(deref_hash, constant, var);