Add unary operator to convert unsigned integer to float
[mesa.git] / ir_function.cpp
index a14b546bc6e2944bc128b0c06cdb1fdf23f26fc6..b6139c4a9fed479869d5973835469671033a29cd 100644 (file)
 int
 type_compare(const glsl_type *a, const glsl_type *b)
 {
+   /* If the types are the same, they trivially match.
+    */
+   if (a == b)
+      return 0;
+
    switch (a->base_type) {
    case GLSL_TYPE_UINT:
    case GLSL_TYPE_INT:
    case GLSL_TYPE_FLOAT:
    case GLSL_TYPE_BOOL:
       if ((a->vector_elements != b->vector_elements)
-         || (a->matrix_rows != b->matrix_rows))
+         || (a->matrix_columns != b->matrix_columns))
         return -1;
 
-      if (a->base_type == b->base_type)
-        return 0;
-
       /* There is no implicit conversion to or from bool.
        */
       if ((a->base_type == GLSL_TYPE_BOOL)
@@ -48,14 +50,10 @@ type_compare(const glsl_type *a, const glsl_type *b)
       return 1;
 
    case GLSL_TYPE_SAMPLER:
-      return ((a->sampler_dimensionality == b->sampler_dimensionality)
-             && (a->sampler_shadow == b->sampler_shadow)
-             && (a->sampler_array == b->sampler_array)
-             && (a->sampler_type == b->sampler_type))
-        ? 0 : -1;
-
    case GLSL_TYPE_STRUCT:
-      return (strcmp(a->name, b->name) == 0) ? 0 : -1;
+      /* Samplers and structures must match exactly.
+       */
+      return -1;
 
    case GLSL_TYPE_ARRAY:
       if ((b->base_type != GLSL_TYPE_ARRAY)