freedreno/rnn: Fix addvariant being set effectively once

Each time addvariant was added it was added to the end of ctx->vars
list, without previous variant being removed. While the check for
variant tests only the first one that has expected enum name.

Fix this by updating `variant` instead of appending new one if variant
with such enum already exists.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23881>
This commit is contained in:
Danylo Piliaiev 2023-05-11 13:28:58 +02:00 committed by Marge Bot
parent 148f214dae
commit 15db60fbbc

View file

@ -48,11 +48,7 @@ int rnndec_varadd(struct rnndeccontext *ctx, char *varset, const char *variant)
int i, j;
for (i = 0; i < en->valsnum; i++)
if (!strcasecmp(en->vals[i]->name, variant)) {
struct rnndecvariant *ci = calloc (sizeof *ci, 1);
ci->en = en;
ci->variant = i;
ADDARRAY(ctx->vars, ci);
return 1;
break;
}
if (i == en->valsnum) {
@ -67,7 +63,7 @@ int rnndec_varadd(struct rnndeccontext *ctx, char *varset, const char *variant)
}
}
if (i == ctx->varsnum) {
if (j == ctx->varsnum) {
struct rnndecvariant *ci = calloc (sizeof *ci, 1);
ci->en = en;
ci->variant = i;