From 5c0d640d18a3ba7d4c5ecf053155a66c57b68410 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 5 Sep 2024 20:15:42 +0200 Subject: [PATCH] vkd3d-shader/ir: Run validation after flattening control flow constructs. --- libs/vkd3d-shader/ir.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index f9ea349d..47533b22 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -6668,9 +6668,6 @@ enum vkd3d_result vsir_program_normalise(struct vsir_program *program, uint64_t vsir_transform(&ctx, vsir_program_structurize); vsir_transform(&ctx, vsir_program_flatten_control_flow_constructs); vsir_transform(&ctx, vsir_program_materialize_undominated_ssas_to_temps); - - if (ctx.result < 0) - return ctx.result; } else { @@ -6688,14 +6685,13 @@ enum vkd3d_result vsir_program_normalise(struct vsir_program *program, uint64_t vsir_transform(&ctx, vsir_program_remove_dead_code); vsir_transform(&ctx, vsir_program_normalise_combined_samplers); - if (ctx.result < 0) - return ctx.result; - - if (compile_info->target_type != VKD3D_SHADER_TARGET_GLSL - && (result = vsir_program_flatten_control_flow_constructs(program, &ctx)) < 0) - return result; + if (compile_info->target_type != VKD3D_SHADER_TARGET_GLSL) + vsir_transform(&ctx, vsir_program_flatten_control_flow_constructs); } + if (ctx.result < 0) + return ctx.result; + if ((result = vsir_program_insert_alpha_test(program, message_context)) < 0) return result;