mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/hlsl: Add a hlsl_block_add_resource_store() helper.
This commit is contained in:
committed by
Henri Verbeet
parent
e7ff5da5b1
commit
f4042ba752
Notes:
Henri Verbeet
2025-03-10 15:23:02 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1404
@ -1978,7 +1978,7 @@ struct hlsl_ir_node *hlsl_new_resource_load(struct hlsl_ctx *ctx,
|
||||
return &load->node;
|
||||
}
|
||||
|
||||
struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct hlsl_deref *resource,
|
||||
static struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct hlsl_deref *resource,
|
||||
struct hlsl_ir_node *coords, struct hlsl_ir_node *value, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_resource_store *store;
|
||||
@ -1992,6 +1992,12 @@ struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct
|
||||
return &store->node;
|
||||
}
|
||||
|
||||
void hlsl_block_add_resource_store(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *resource,
|
||||
struct hlsl_ir_node *coords, struct hlsl_ir_node *value, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
append_new_instr(ctx, block, hlsl_new_resource_store(ctx, resource, coords, value, loc));
|
||||
}
|
||||
|
||||
struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, uint32_t s, unsigned int component_count,
|
||||
struct hlsl_ir_node *val, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
|
@ -1530,6 +1530,8 @@ struct hlsl_ir_node *hlsl_block_add_load_index(struct hlsl_ctx *ctx, struct hlsl
|
||||
void hlsl_block_add_loop(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
struct hlsl_block *iter, struct hlsl_block *body, enum hlsl_loop_unroll_type unroll_type,
|
||||
unsigned int unroll_limit, const struct vkd3d_shader_location *loc);
|
||||
void hlsl_block_add_resource_store(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *resource,
|
||||
struct hlsl_ir_node *coords, struct hlsl_ir_node *value, const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_node *hlsl_block_add_simple_load(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
struct hlsl_ir_var *var, const struct vkd3d_shader_location *loc);
|
||||
void hlsl_block_add_simple_store(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
@ -1653,8 +1655,6 @@ struct hlsl_ir_node *hlsl_new_matrix_swizzle(struct hlsl_ctx *ctx, struct hlsl_m
|
||||
unsigned int width, struct hlsl_ir_node *val, const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_node *hlsl_new_resource_load(struct hlsl_ctx *ctx,
|
||||
const struct hlsl_resource_load_params *params, const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct hlsl_deref *resource,
|
||||
struct hlsl_ir_node *coords, struct hlsl_ir_node *value, const struct vkd3d_shader_location *loc);
|
||||
struct hlsl_type *hlsl_new_struct_type(struct hlsl_ctx *ctx, const char *name,
|
||||
struct hlsl_struct_field *fields, size_t field_count);
|
||||
struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, uint32_t s, unsigned int components,
|
||||
|
@ -2110,7 +2110,6 @@ static bool add_assignment(struct hlsl_ctx *ctx, struct hlsl_block *block, struc
|
||||
struct hlsl_ir_node *coords = hlsl_ir_index(lhs)->idx.node;
|
||||
struct hlsl_deref resource_deref;
|
||||
struct hlsl_type *resource_type;
|
||||
struct hlsl_ir_node *store;
|
||||
unsigned int dim_count;
|
||||
|
||||
if (!hlsl_index_is_resource_access(hlsl_ir_index(lhs)))
|
||||
@ -2139,12 +2138,7 @@ static bool add_assignment(struct hlsl_ctx *ctx, struct hlsl_block *block, struc
|
||||
VKD3D_ASSERT(coords->data_type->e.numeric.type == HLSL_TYPE_UINT);
|
||||
VKD3D_ASSERT(coords->data_type->e.numeric.dimx == dim_count);
|
||||
|
||||
if (!(store = hlsl_new_resource_store(ctx, &resource_deref, coords, rhs, &lhs->loc)))
|
||||
{
|
||||
hlsl_cleanup_deref(&resource_deref);
|
||||
return false;
|
||||
}
|
||||
hlsl_block_add_instr(block, store);
|
||||
hlsl_block_add_resource_store(ctx, block, &resource_deref, coords, rhs, &lhs->loc);
|
||||
hlsl_cleanup_deref(&resource_deref);
|
||||
}
|
||||
else if (matrix_writemask)
|
||||
@ -6441,7 +6435,7 @@ static bool add_sample_grad_method_call(struct hlsl_ctx *ctx, struct hlsl_block
|
||||
static bool add_store_method_call(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_node *object,
|
||||
const char *name, const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *offset, *rhs, *store;
|
||||
struct hlsl_ir_node *offset, *rhs;
|
||||
struct hlsl_deref resource_deref;
|
||||
unsigned int value_dim;
|
||||
|
||||
@ -6472,13 +6466,7 @@ static bool add_store_method_call(struct hlsl_ctx *ctx, struct hlsl_block *block
|
||||
if (!hlsl_init_deref_from_index_chain(ctx, &resource_deref, object))
|
||||
return false;
|
||||
|
||||
if (!(store = hlsl_new_resource_store(ctx, &resource_deref, offset, rhs, loc)))
|
||||
{
|
||||
hlsl_cleanup_deref(&resource_deref);
|
||||
return false;
|
||||
}
|
||||
|
||||
hlsl_block_add_instr(block, store);
|
||||
hlsl_block_add_resource_store(ctx, block, &resource_deref, offset, rhs, loc);
|
||||
hlsl_cleanup_deref(&resource_deref);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user