glsl: Make sure to not cast ir_dereference_variable into ir_variable
The parameter_lists_match_exact function was wrongly assuming that all the elements were ir_variable when there can also be ir_dereference_variable elements. Add case taking this into account. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26144>
This commit is contained in:
@@ -370,6 +370,18 @@ ir_function::matching_signature(_mesa_glsl_parse_state *state,
|
||||
}
|
||||
|
||||
|
||||
static inline const glsl_type *
|
||||
get_param_type(ir_instruction *inst)
|
||||
{
|
||||
ir_variable *var = inst->as_variable();
|
||||
if (var)
|
||||
return var->type;
|
||||
|
||||
ir_rvalue *rvalue = inst->as_rvalue();
|
||||
assert(rvalue != NULL);
|
||||
return rvalue->type;
|
||||
}
|
||||
|
||||
static bool
|
||||
parameter_lists_match_exact(const exec_list *list_a, const exec_list *list_b)
|
||||
{
|
||||
@@ -379,13 +391,13 @@ parameter_lists_match_exact(const exec_list *list_a, const exec_list *list_b)
|
||||
for (/* empty */
|
||||
; !node_a->is_tail_sentinel() && !node_b->is_tail_sentinel()
|
||||
; node_a = node_a->next, node_b = node_b->next) {
|
||||
ir_variable *a = (ir_variable *) node_a;
|
||||
ir_variable *b = (ir_variable *) node_b;
|
||||
ir_instruction *inst_a = (ir_instruction *) node_a;
|
||||
ir_instruction *inst_b = (ir_instruction *) node_b;
|
||||
|
||||
/* If the types of the parameters do not match, the parameters lists
|
||||
* are different.
|
||||
*/
|
||||
if (a->type != b->type)
|
||||
if (get_param_type (inst_a) != get_param_type (inst_b))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user