vkd3d-shader/hlsl: Don't create semantic vars more than once.

This commit is contained in:
Francisco Casas 2023-04-05 11:58:23 -04:00 committed by Alexandre Julliard
parent b589c2b32d
commit a488889494
Notes: Alexandre Julliard 2023-05-01 22:24:44 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/148

View File

@ -231,6 +231,16 @@ static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir
if (!(name = hlsl_get_string_buffer(ctx)))
return NULL;
vkd3d_string_buffer_printf(name, "<%s-%s%u>", output ? "output" : "input", semantic->name, semantic->index);
LIST_FOR_EACH_ENTRY(ext_var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
{
if (!ascii_strcasecmp(ext_var->name, name->buffer))
{
hlsl_release_string_buffer(ctx, name);
return ext_var;
}
}
if (!(new_semantic.name = hlsl_strdup(ctx, semantic->name)))
{
hlsl_release_string_buffer(ctx, name);