mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader/hlsl: Partially defer continue resolution.
We need 'for' iter blocks to be separate for loop unrolling.
This commit is contained in:
committed by
Henri Verbeet
parent
5d8448a44e
commit
351d58a95b
Notes:
Henri Verbeet
2024-12-12 17:48:02 +01:00
Approved-by: Francisco Casas (@fcasas) Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1053
@@ -2064,7 +2064,7 @@ struct hlsl_ir_node *hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type
|
||||
return &jump->node;
|
||||
}
|
||||
|
||||
struct hlsl_ir_node *hlsl_new_loop(struct hlsl_ctx *ctx,
|
||||
struct hlsl_ir_node *hlsl_new_loop(struct hlsl_ctx *ctx, struct hlsl_block *iter,
|
||||
struct hlsl_block *block, enum hlsl_ir_loop_unroll_type unroll_type,
|
||||
unsigned int unroll_limit, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
@@ -2076,6 +2076,10 @@ struct hlsl_ir_node *hlsl_new_loop(struct hlsl_ctx *ctx,
|
||||
hlsl_block_init(&loop->body);
|
||||
hlsl_block_add_block(&loop->body, block);
|
||||
|
||||
hlsl_block_init(&loop->iter);
|
||||
if (iter)
|
||||
hlsl_block_add_block(&loop->iter, iter);
|
||||
|
||||
loop->unroll_type = unroll_type;
|
||||
loop->unroll_limit = unroll_limit;
|
||||
return &loop->node;
|
||||
@@ -2231,14 +2235,21 @@ static struct hlsl_ir_node *clone_load(struct hlsl_ctx *ctx, struct clone_instr_
|
||||
|
||||
static struct hlsl_ir_node *clone_loop(struct hlsl_ctx *ctx, struct clone_instr_map *map, struct hlsl_ir_loop *src)
|
||||
{
|
||||
struct hlsl_block iter, body;
|
||||
struct hlsl_ir_node *dst;
|
||||
struct hlsl_block body;
|
||||
|
||||
if (!clone_block(ctx, &body, &src->body, map))
|
||||
if (!clone_block(ctx, &iter, &src->iter, map))
|
||||
return NULL;
|
||||
|
||||
if (!(dst = hlsl_new_loop(ctx, &body, src->unroll_type, src->unroll_limit, &src->node.loc)))
|
||||
if (!clone_block(ctx, &body, &src->body, map))
|
||||
{
|
||||
hlsl_block_cleanup(&iter);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(dst = hlsl_new_loop(ctx, &iter, &body, src->unroll_type, src->unroll_limit, &src->node.loc)))
|
||||
{
|
||||
hlsl_block_cleanup(&iter);
|
||||
hlsl_block_cleanup(&body);
|
||||
return NULL;
|
||||
}
|
||||
@@ -3713,6 +3724,7 @@ static void free_ir_load(struct hlsl_ir_load *load)
|
||||
static void free_ir_loop(struct hlsl_ir_loop *loop)
|
||||
{
|
||||
hlsl_block_cleanup(&loop->body);
|
||||
hlsl_block_cleanup(&loop->iter);
|
||||
vkd3d_free(loop);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user