vkd3d-shader/hlsl: Pass an hlsl_block pointer to hlsl_new_loop().

This commit is contained in:
Zebediah Figura
2022-11-10 20:35:35 -06:00
committed by Alexandre Julliard
parent e848c57b46
commit 3ca9656e84
Notes: Alexandre Julliard 2023-05-02 22:25:49 +02: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/176
3 changed files with 22 additions and 14 deletions

View File

@@ -459,6 +459,7 @@ static struct list *create_loop(struct hlsl_ctx *ctx, enum loop_type type, const
struct list *iter, struct list *body, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_loop *loop = NULL;
struct hlsl_block body_block;
unsigned int i;
if (attribute_list_has_duplicates(attributes))
@@ -494,23 +495,25 @@ static struct list *create_loop(struct hlsl_ctx *ctx, enum loop_type type, const
if (!init && !(init = make_empty_list(ctx)))
goto oom;
if (!(loop = hlsl_new_loop(ctx, loc)))
goto oom;
list_add_tail(init, &loop->node.entry);
if (!append_conditional_break(ctx, cond))
goto oom;
if (type != LOOP_DO_WHILE)
list_move_tail(&loop->body.instrs, cond);
hlsl_block_init(&body_block);
list_move_tail(&loop->body.instrs, body);
if (type != LOOP_DO_WHILE)
list_move_tail(&body_block.instrs, cond);
list_move_tail(&body_block.instrs, body);
if (iter)
list_move_tail(&loop->body.instrs, iter);
list_move_tail(&body_block.instrs, iter);
if (type == LOOP_DO_WHILE)
list_move_tail(&loop->body.instrs, cond);
list_move_tail(&body_block.instrs, cond);
if (!(loop = hlsl_new_loop(ctx, &body_block, loc)))
goto oom;
list_add_tail(init, &loop->node.entry);
vkd3d_free(cond);
vkd3d_free(body);