From 6eda7750475ebfe1677c97326af125c2bef943e4 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Wed, 30 Oct 2024 13:02:18 -0300 Subject: [PATCH] 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. --- libs/vkd3d-shader/hlsl_codegen.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index dfb73bbc..e8283379 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -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);