mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Do not abort on variable redefinition.
There is no harm in defining two variables with the same name.
This commit is contained in:
committed by
Henri Verbeet
parent
e40d4a0e12
commit
fbd17266cf
Notes:
Henri Verbeet
2025-01-29 18:04:53 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1359
@@ -93,7 +93,7 @@ char *hlsl_sprintf_alloc(struct hlsl_ctx *ctx, const char *fmt, ...)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool hlsl_add_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl)
|
||||
void hlsl_add_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl)
|
||||
{
|
||||
struct hlsl_scope *scope = ctx->cur_scope;
|
||||
struct hlsl_ir_var *var;
|
||||
@@ -107,14 +107,12 @@ bool hlsl_add_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl)
|
||||
hlsl_error(ctx, &decl->loc, VKD3D_SHADER_ERROR_HLSL_REDEFINED,
|
||||
"Identifier \"%s\" was already declared in this scope.", var->name);
|
||||
hlsl_note(ctx, &var->loc, VKD3D_SHADER_LOG_ERROR, "\"%s\" was previously declared here.", var->name);
|
||||
hlsl_free_var(decl);
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list_add_tail(&scope->vars, &decl->scope_entry);
|
||||
return true;
|
||||
}
|
||||
|
||||
struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name)
|
||||
|
Reference in New Issue
Block a user