vkd3d-shader/hlsl: Run sm4_generate_vsir_block() recursively.

This allows us to remove the HLSL IR version of an instruction when
the vsir version is properly implemented.
This commit is contained in:
Francisco Casas 2024-10-30 13:02:18 -03:00 committed by Henri Verbeet
parent 64c4a3a442
commit 6eda775047
Notes: Henri Verbeet 2024-11-05 20:06:02 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1246

View File

@ -7808,6 +7808,7 @@ static bool sm4_generate_vsir_instr_expr(struct hlsl_ctx *ctx,
static void sm4_generate_vsir_block(struct hlsl_ctx *ctx, struct hlsl_block *block, struct vsir_program *program)
{
struct hlsl_ir_node *instr, *next;
struct hlsl_ir_switch_case *c;
LIST_FOR_EACH_ENTRY_SAFE(instr, next, &block->instrs, struct hlsl_ir_node, entry)
{
@ -7834,6 +7835,20 @@ static void sm4_generate_vsir_block(struct hlsl_ctx *ctx, struct hlsl_block *blo
replace_instr_with_last_vsir_instr(ctx, program, instr);
break;
case HLSL_IR_IF:
sm4_generate_vsir_block(ctx, &hlsl_ir_if(instr)->then_block, program);
sm4_generate_vsir_block(ctx, &hlsl_ir_if(instr)->else_block, program);
break;
case HLSL_IR_LOOP:
sm4_generate_vsir_block(ctx, &hlsl_ir_loop(instr)->body, program);
break;
case HLSL_IR_SWITCH:
LIST_FOR_EACH_ENTRY(c, &hlsl_ir_switch(instr)->cases, struct hlsl_ir_switch_case, entry)
sm4_generate_vsir_block(ctx, &c->body, program);
break;
case HLSL_IR_SWIZZLE:
generate_vsir_instr_swizzle(ctx, program, hlsl_ir_swizzle(instr));
replace_instr_with_last_vsir_instr(ctx, program, instr);