nir/load_libclc: Don't add generic variants that already exist

At some point in the future, adding generic variants to libclc will
hopefully no longer be needed.  At that point, we don't want the NIR
code adding duplicates.  Check if the generic version already exists
and, if it does, don't re-add it.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18675>
This commit is contained in:
Jason Ekstrand
2022-04-07 16:45:22 -05:00
committed by Marge Bot
parent 2aa9eb497d
commit 8f4af4d700
+3
View File
@@ -266,6 +266,9 @@ libclc_add_generic_variants(nir_shader *shader)
assert(generic_name[offset_1] == '1');
generic_name[offset_1] = '4';
if (nir_shader_get_function_for_name(shader, generic_name))
continue;
nir_function *gfunc = nir_function_create(shader, generic_name);
gfunc->num_params = func->num_params;
gfunc->params = ralloc_array(shader, nir_parameter, gfunc->num_params);