mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Reuse the "init" instruction list if possible in create_loop().
This commit is contained in:
parent
3f8aa0e272
commit
e848c57b46
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
@ -458,7 +458,6 @@ static bool attribute_list_has_duplicates(const struct parse_attribute_list *att
|
|||||||
static struct list *create_loop(struct hlsl_ctx *ctx, enum loop_type type, const struct parse_attribute_list *attributes, struct list *init, struct list *cond,
|
static struct list *create_loop(struct hlsl_ctx *ctx, enum loop_type type, const struct parse_attribute_list *attributes, struct list *init, struct list *cond,
|
||||||
struct list *iter, struct list *body, const struct vkd3d_shader_location *loc)
|
struct list *iter, struct list *body, const struct vkd3d_shader_location *loc)
|
||||||
{
|
{
|
||||||
struct list *list = NULL;
|
|
||||||
struct hlsl_ir_loop *loop = NULL;
|
struct hlsl_ir_loop *loop = NULL;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -492,15 +491,12 @@ static struct list *create_loop(struct hlsl_ctx *ctx, enum loop_type type, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(list = make_empty_list(ctx)))
|
if (!init && !(init = make_empty_list(ctx)))
|
||||||
goto oom;
|
goto oom;
|
||||||
|
|
||||||
if (init)
|
|
||||||
list_move_head(list, init);
|
|
||||||
|
|
||||||
if (!(loop = hlsl_new_loop(ctx, loc)))
|
if (!(loop = hlsl_new_loop(ctx, loc)))
|
||||||
goto oom;
|
goto oom;
|
||||||
list_add_tail(list, &loop->node.entry);
|
list_add_tail(init, &loop->node.entry);
|
||||||
|
|
||||||
if (!append_conditional_break(ctx, cond))
|
if (!append_conditional_break(ctx, cond))
|
||||||
goto oom;
|
goto oom;
|
||||||
@ -516,14 +512,12 @@ static struct list *create_loop(struct hlsl_ctx *ctx, enum loop_type type, const
|
|||||||
if (type == LOOP_DO_WHILE)
|
if (type == LOOP_DO_WHILE)
|
||||||
list_move_tail(&loop->body.instrs, cond);
|
list_move_tail(&loop->body.instrs, cond);
|
||||||
|
|
||||||
vkd3d_free(init);
|
|
||||||
vkd3d_free(cond);
|
vkd3d_free(cond);
|
||||||
vkd3d_free(body);
|
vkd3d_free(body);
|
||||||
return list;
|
return init;
|
||||||
|
|
||||||
oom:
|
oom:
|
||||||
vkd3d_free(loop);
|
vkd3d_free(loop);
|
||||||
vkd3d_free(list);
|
|
||||||
destroy_instr_list(init);
|
destroy_instr_list(init);
|
||||||
destroy_instr_list(cond);
|
destroy_instr_list(cond);
|
||||||
destroy_instr_list(iter);
|
destroy_instr_list(iter);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user