vkd3d-shader/hlsl: Add a hlsl_block_add_loop() helper.

This commit is contained in:
Elizabeth Figura
2024-12-09 15:11:20 -06:00
committed by Henri Verbeet
parent 62196b2bf1
commit e5cabeafe5
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
3 changed files with 17 additions and 8 deletions

View File

@@ -2253,7 +2253,7 @@ void hlsl_block_add_jump(struct hlsl_ctx *ctx, struct hlsl_block *block, enum hl
append_new_instr(ctx, block, hlsl_new_jump(ctx, type, condition, loc));
}
struct hlsl_ir_node *hlsl_new_loop(struct hlsl_ctx *ctx, struct hlsl_block *iter,
static struct hlsl_ir_node *hlsl_new_loop(struct hlsl_ctx *ctx, struct hlsl_block *iter,
struct hlsl_block *block, enum hlsl_loop_unroll_type unroll_type,
unsigned int unroll_limit, const struct vkd3d_shader_location *loc)
{
@@ -2274,6 +2274,18 @@ struct hlsl_ir_node *hlsl_new_loop(struct hlsl_ctx *ctx, struct hlsl_block *iter
return &loop->node;
}
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)
{
struct hlsl_ir_node *instr = hlsl_new_loop(ctx, iter, body, unroll_type, unroll_limit, loc);
if (instr)
hlsl_block_add_instr(block, instr);
else
hlsl_block_cleanup(body);
}
struct clone_instr_map
{
struct