Module: vkd3d Branch: master Commit: b20e182da14f43c99111c9bbfce2f870f6aabacd URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=b20e182da14f43c99111c9bb...
Author: Zebediah Figura zfigura@codeweavers.com Date: Sun May 16 12:47:50 2021 -0500
vkd3d-shader: Mark all declared non-static global variables as HLSL_STORAGE_UNIFORM.
Fixes: 549be35c0aff6aa78f1dc9a08df89ce8de16db2c Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
libs/vkd3d-shader/hlsl.y | 6 ++++++ libs/vkd3d-shader/hlsl_codegen.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 2c9fe55..bcb1c20 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1427,6 +1427,12 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t hlsl_error(ctx, var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER, "Variable '%s' is declared as both "uniform" and "static".", var->name);
+ /* Mark it as uniform. We need to do this here since synthetic + * variables also get put in the global scope, but shouldn't be + * considered uniforms, and we have no way of telling otherwise. */ + if (!(modifiers & HLSL_STORAGE_STATIC)) + var->modifiers |= HLSL_STORAGE_UNIFORM; + if ((func = hlsl_get_func_decl(ctx, var->name))) { hlsl_error(ctx, var->loc, VKD3D_SHADER_ERROR_HLSL_REDEFINED, diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 0dfbfb9..716824a 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -1757,7 +1757,7 @@ int hlsl_emit_dxbc(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_fun { if (var->data_type->type == HLSL_CLASS_OBJECT) list_add_tail(&ctx->extern_vars, &var->extern_entry); - else if (!(var->modifiers & HLSL_STORAGE_STATIC)) + else if (var->modifiers & HLSL_STORAGE_UNIFORM) prepend_uniform_copy(ctx, entry_func->body, var); }