vkd3d-shader/hlsl: Check is_uniform instead of HLSL_STORAGE_UNIFORM when validating object refs.

We are using the hlsl_ir_var.is_uniform flag to indicate when an object
is a uniform copy created from a variable with the HLSL_STORAGE_UNIFORM
modifier.

We should be checking for this instead of the HLSL_STORAGE_UNIFORM flag
which is also set to 1 for the original variables, and there should be
no reason to use this flag instead of "is_uniform" after the uniform
copies and combined/separated samplers are created.
This commit is contained in:
Francisco Casas 2023-01-20 20:37:15 -03:00 committed by Alexandre Julliard
parent b8a85c6ad5
commit 866c5d9531
Notes: Alexandre Julliard 2023-07-17 23:25:21 +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/209

View File

@ -1690,7 +1690,7 @@ static bool validate_static_object_references(struct hlsl_ctx *ctx, struct hlsl_
{ {
struct hlsl_ir_resource_load *load = hlsl_ir_resource_load(instr); struct hlsl_ir_resource_load *load = hlsl_ir_resource_load(instr);
if (!(load->resource.var->storage_modifiers & HLSL_STORAGE_UNIFORM)) if (!load->resource.var->is_uniform)
{ {
hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF, hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF,
"Loaded resource must have a single uniform source."); "Loaded resource must have a single uniform source.");
@ -1705,7 +1705,7 @@ static bool validate_static_object_references(struct hlsl_ctx *ctx, struct hlsl_
if (load->sampler.var) if (load->sampler.var)
{ {
if (!(load->sampler.var->storage_modifiers & HLSL_STORAGE_UNIFORM)) if (!load->sampler.var->is_uniform)
{ {
hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF, hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF,
"Resource load sampler must have a single uniform source."); "Resource load sampler must have a single uniform source.");
@ -1723,7 +1723,7 @@ static bool validate_static_object_references(struct hlsl_ctx *ctx, struct hlsl_
{ {
struct hlsl_ir_resource_store *store = hlsl_ir_resource_store(instr); struct hlsl_ir_resource_store *store = hlsl_ir_resource_store(instr);
if (!(store->resource.var->storage_modifiers & HLSL_STORAGE_UNIFORM)) if (!store->resource.var->is_uniform)
{ {
hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF, hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF,
"Accessed resource must have a single uniform source."); "Accessed resource must have a single uniform source.");