glsl/linker: check for xfb_offset aliasing
[mesa.git] / src / compiler / glsl / ir_function.cpp
index 0b4cb4bd30d398a13627839eff88060f99693316..97262f0f4b93c84c8903d830432a76e55a0b6169 100644 (file)
@@ -43,8 +43,8 @@ static parameter_list_match_t
 parameter_lists_match(_mesa_glsl_parse_state *state,
                       const exec_list *list_a, const exec_list *list_b)
 {
-   const exec_node *node_a = list_a->head;
-   const exec_node *node_b = list_b->head;
+   const exec_node *node_a = list_a->get_head_raw();
+   const exec_node *node_b = list_b->get_head_raw();
 
    /* This is set to true if there is an inexact match requiring an implicit
     * conversion. */
@@ -149,13 +149,13 @@ get_parameter_match_type(const ir_variable *param,
    if (from_type == to_type)
       return PARAMETER_EXACT_MATCH;
 
-   if (to_type->base_type == GLSL_TYPE_DOUBLE) {
-      if (from_type->base_type == GLSL_TYPE_FLOAT)
+   if (to_type->is_double()) {
+      if (from_type->is_float())
          return PARAMETER_FLOAT_TO_DOUBLE;
       return PARAMETER_INT_TO_DOUBLE;
    }
 
-   if (to_type->base_type == GLSL_TYPE_FLOAT)
+   if (to_type->is_float())
       return PARAMETER_INT_TO_FLOAT;
 
    /* int -> uint and any other oddball conversions */
@@ -222,9 +222,9 @@ is_best_inexact_overload(const exec_list *actual_parameters,
       if (*other == sig)
          continue;
 
-      const exec_node *node_a = sig->parameters.head;
-      const exec_node *node_b = (*other)->parameters.head;
-      const exec_node *node_p = actual_parameters->head;
+      const exec_node *node_a = sig->parameters.get_head_raw();
+      const exec_node *node_b = (*other)->parameters.get_head_raw();
+      const exec_node *node_p = actual_parameters->get_head_raw();
 
       bool better_for_some_parameter = false;
 
@@ -268,11 +268,14 @@ choose_best_inexact_overload(_mesa_glsl_parse_state *state,
    if (num_matches == 1)
       return *matches;
 
-   /* Without GLSL 4.0 / ARB_gpu_shader5, there is no overload resolution
-    * among multiple inexact matches. Note that state may be NULL here if
-    * called from the linker; in that case we assume everything supported in
-    * any GLSL version is available. */
-   if (!state || state->is_version(400, 0) || state->ARB_gpu_shader5_enable) {
+   /* Without GLSL 4.0, ARB_gpu_shader5, or MESA_shader_integer_functions,
+    * there is no overload resolution among multiple inexact matches. Note
+    * that state may be NULL here if called from the linker; in that case we
+    * assume everything supported in any GLSL version is available.
+    */
+   if (!state || state->is_version(400, 0) || state->ARB_gpu_shader5_enable ||
+       state->MESA_shader_integer_functions_enable ||
+       state->EXT_shader_implicit_conversions_enable) {
       for (ir_function_signature **sig = matches; sig < matches + num_matches; sig++) {
          if (is_best_inexact_overload(actual_parameters, matches, num_matches, *sig))
             return *sig;
@@ -366,8 +369,8 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state,
 static bool
 parameter_lists_match_exact(const exec_list *list_a, const exec_list *list_b)
 {
-   const exec_node *node_a = list_a->head;
-   const exec_node *node_b = list_b->head;
+   const exec_node *node_a = list_a->get_head_raw();
+   const exec_node *node_b = list_b->get_head_raw();
 
    for (/* empty */
        ; !node_a->is_tail_sentinel() && !node_b->is_tail_sentinel()