mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Check for non-static object references on resource stores.
This commit is contained in:
parent
dd1008867e
commit
f100f5b726
Notes:
Alexandre Julliard
2022-11-18 22:42:34 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/48
@ -1024,6 +1024,18 @@ static bool validate_static_object_references(struct hlsl_ctx *ctx, struct hlsl_
|
||||
note_non_static_deref_expressions(ctx, &load->sampler, "resource load sampler");
|
||||
}
|
||||
}
|
||||
else if (instr->type == HLSL_IR_RESOURCE_STORE)
|
||||
{
|
||||
struct hlsl_ir_resource_store *store = hlsl_ir_resource_store(instr);
|
||||
|
||||
if (!hlsl_component_index_range_from_deref(ctx, &store->resource, &start, &count))
|
||||
{
|
||||
hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF,
|
||||
"Accessed resource from \"%s\" must be determinable at compile time.",
|
||||
store->resource.var->name);
|
||||
note_non_static_deref_expressions(ctx, &store->resource, "accessed resource");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -120,6 +120,18 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
|
||||
[pixel shader fail]
|
||||
// Note: Only valid in shader model 5.1
|
||||
RWTexture2D<float4> tex[3];
|
||||
uniform int n;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
tex[n][int2(0, 0)] = 0.6;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
[pixel shader todo]
|
||||
Texture2D tex;
|
||||
uniform float f;
|
||||
|
Loading…
Reference in New Issue
Block a user