vkd3d-shader/hlsl: Partially defer continue resolution.

We need 'for' iter blocks to be separate for loop unrolling.
This commit is contained in:
Victor Chiletto
2024-10-16 17:19:36 -03:00
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
4 changed files with 139 additions and 36 deletions

View File

@@ -666,11 +666,20 @@ enum hlsl_ir_loop_unroll_type
HLSL_IR_LOOP_FORCE_LOOP
};
enum hlsl_loop_type
{
HLSL_LOOP_FOR,
HLSL_LOOP_WHILE,
HLSL_LOOP_DO_WHILE
};
struct hlsl_ir_loop
{
struct hlsl_ir_node node;
struct hlsl_block iter;
/* loop condition is stored in the body (as "if (!condition) break;") */
struct hlsl_block body;
enum hlsl_loop_type type;
unsigned int next_index; /* liveness index of the end of the loop */
unsigned int unroll_limit;
enum hlsl_ir_loop_unroll_type unroll_type;
@@ -1550,8 +1559,9 @@ struct hlsl_ir_node *hlsl_new_compile(struct hlsl_ctx *ctx, enum hlsl_compile_ty
struct hlsl_block *args_instrs, const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_index(struct hlsl_ctx *ctx, struct hlsl_ir_node *val,
struct hlsl_ir_node *idx, const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_loop(struct hlsl_ctx *ctx,
struct hlsl_block *block, enum hlsl_ir_loop_unroll_type unroll_type, unsigned int unroll_limit, const struct vkd3d_shader_location *loc);
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);
struct hlsl_ir_node *hlsl_new_resource_load(struct hlsl_ctx *ctx,
const struct hlsl_resource_load_params *params, const struct vkd3d_shader_location *loc);
struct hlsl_ir_node *hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct hlsl_deref *resource,