nir: fix uniform cloning helper

glsl allows for ubos to have the same name but different bindings.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Fixes: b47b8d16d9 ("nir: expose reusable linking helpers for cloning uniform loads")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12852
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34138>
This commit is contained in:
Timothy Arceri 2025-03-24 15:20:55 +11:00 committed by Marge Bot
parent 786b8b2d34
commit 2b2132d2ac

View file

@ -1171,7 +1171,9 @@ nir_clone_uniform_variable(nir_shader *nir, nir_variable *uniform, bool spirv)
nir_foreach_variable_with_modes(v, nir, uniform->data.mode) { nir_foreach_variable_with_modes(v, nir, uniform->data.mode) {
if ((spirv && uniform->data.mode & nir_var_mem_ubo && if ((spirv && uniform->data.mode & nir_var_mem_ubo &&
v->data.binding == uniform->data.binding) || v->data.binding == uniform->data.binding) ||
(!spirv && !strcmp(uniform->name, v->name))) { (!spirv &&
((!strcmp(uniform->name, v->name) && !uniform->data.explicit_binding && !v->data.explicit_binding) ||
(uniform->data.explicit_binding && v->data.explicit_binding && v->data.binding == uniform->data.binding)))) {
new_var = v; new_var = v;
break; break;
} }