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_simple_store() helper.
This commit is contained in:
committed by
Henri Verbeet
parent
fc4f440245
commit
e76c596d56
Notes:
Henri Verbeet
2025-03-03 18:05:08 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1394
@@ -1541,6 +1541,15 @@ void hlsl_block_add_store_index(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
append_new_instr(ctx, block, hlsl_new_store_index(ctx, lhs, idx, rhs, writemask, loc));
|
||||
}
|
||||
|
||||
void hlsl_block_add_simple_store(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs)
|
||||
{
|
||||
struct hlsl_deref lhs_deref;
|
||||
|
||||
hlsl_init_simple_deref_from_var(&lhs_deref, lhs);
|
||||
hlsl_block_add_store_index(ctx, block, &lhs_deref, NULL, rhs, 0, &rhs->loc);
|
||||
}
|
||||
|
||||
bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block,
|
||||
const struct hlsl_deref *lhs, unsigned int comp, struct hlsl_ir_node *rhs)
|
||||
{
|
||||
@@ -2739,8 +2748,8 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx,
|
||||
struct hlsl_type *return_type, const struct hlsl_func_parameters *parameters,
|
||||
const struct hlsl_semantic *semantic, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_ir_node *constant, *store;
|
||||
struct hlsl_ir_function_decl *decl;
|
||||
struct hlsl_ir_node *constant;
|
||||
|
||||
if (!(decl = hlsl_alloc(ctx, sizeof(*decl))))
|
||||
return NULL;
|
||||
@@ -2768,9 +2777,7 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx,
|
||||
return decl;
|
||||
hlsl_block_add_instr(&decl->body, constant);
|
||||
|
||||
if (!(store = hlsl_new_simple_store(ctx, decl->early_return_var, constant)))
|
||||
return decl;
|
||||
hlsl_block_add_instr(&decl->body, store);
|
||||
hlsl_block_add_simple_store(ctx, &decl->body, decl->early_return_var, constant);
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user