mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Emit fixme on non-direct resource stores.
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com> These may happen when storing to structured buffers, and we are not handling them properly yet. The included test reaches unreacheable code before this patch. Storing to buffers is complicated since we need to split the index chain in two paths: - The path within the variable where the resource is. - The subpath to the part of the resource element that is being stored to. For now, we will emit a fixme when the index chain in the lhs is not a direct resource access.
This commit is contained in:
parent
315b7c5a42
commit
8df34fce62
Notes:
Alexandre Julliard
2024-02-19 22:59:52 +01: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/655
@ -1554,6 +1554,15 @@ bool hlsl_index_is_resource_access(struct hlsl_ir_index *index)
|
||||
return index->val.node->data_type->class == HLSL_CLASS_OBJECT;
|
||||
}
|
||||
|
||||
bool hlsl_index_chain_has_resource_access(struct hlsl_ir_index *index)
|
||||
{
|
||||
if (hlsl_index_is_resource_access(index))
|
||||
return true;
|
||||
if (index->val.node->type == HLSL_IR_INDEX)
|
||||
return hlsl_index_chain_has_resource_access(hlsl_ir_index(index->val.node));
|
||||
return false;
|
||||
}
|
||||
|
||||
struct hlsl_ir_node *hlsl_new_index(struct hlsl_ctx *ctx, struct hlsl_ir_node *val,
|
||||
struct hlsl_ir_node *idx, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
|
@ -1258,6 +1258,7 @@ bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
|
||||
bool hlsl_index_is_noncontiguous(struct hlsl_ir_index *index);
|
||||
bool hlsl_index_is_resource_access(struct hlsl_ir_index *index);
|
||||
bool hlsl_index_chain_has_resource_access(struct hlsl_ir_index *index);
|
||||
|
||||
struct hlsl_ir_node *hlsl_new_index(struct hlsl_ctx *ctx, struct hlsl_ir_node *val,
|
||||
struct hlsl_ir_node *idx, const struct vkd3d_shader_location *loc);
|
||||
|
@ -1915,7 +1915,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_blo
|
||||
}
|
||||
}
|
||||
|
||||
if (lhs->type == HLSL_IR_INDEX && hlsl_index_is_resource_access(hlsl_ir_index(lhs)))
|
||||
if (lhs->type == HLSL_IR_INDEX && hlsl_index_chain_has_resource_access(hlsl_ir_index(lhs)))
|
||||
{
|
||||
struct hlsl_ir_node *coords = hlsl_ir_index(lhs)->idx.node;
|
||||
struct hlsl_deref resource_deref;
|
||||
@ -1923,6 +1923,12 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_blo
|
||||
struct hlsl_ir_node *store;
|
||||
unsigned int dim_count;
|
||||
|
||||
if (!hlsl_index_is_resource_access(hlsl_ir_index(lhs)))
|
||||
{
|
||||
hlsl_fixme(ctx, &lhs->loc, "Non-direct structured resource store.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!hlsl_init_deref_from_index_chain(ctx, &resource_deref, hlsl_ir_index(lhs)->val.node))
|
||||
return NULL;
|
||||
|
||||
|
@ -108,3 +108,18 @@ float4 main() : sv_target1
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
[pixel shader todo]
|
||||
struct apple
|
||||
{
|
||||
float3 a, x;
|
||||
};
|
||||
|
||||
RWStructuredBuffer<apple> u;
|
||||
|
||||
float4 main() : sv_target
|
||||
{
|
||||
u[0].x = float3(30.0, 40.0, 50.0);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user