diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 6cef85fd..4b7b1a47 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -6685,7 +6685,8 @@ enum vkd3d_result vsir_program_transform(struct vsir_program *program, uint64_t vsir_transform(&ctx, vsir_program_remove_dead_code); vsir_transform(&ctx, vsir_program_normalise_combined_samplers); - if (compile_info->target_type != VKD3D_SHADER_TARGET_GLSL) + if (compile_info->target_type != VKD3D_SHADER_TARGET_GLSL + && compile_info->target_type != VKD3D_SHADER_TARGET_MSL) vsir_transform(&ctx, vsir_program_flatten_control_flow_constructs); } diff --git a/libs/vkd3d-shader/msl.c b/libs/vkd3d-shader/msl.c index 82619ca1..5178604e 100644 --- a/libs/vkd3d-shader/msl.c +++ b/libs/vkd3d-shader/msl.c @@ -88,11 +88,15 @@ static int msl_generator_init(struct msl_generator *gen, struct vsir_program *pr return VKD3D_OK; } -int msl_compile(struct vsir_program *program, struct vkd3d_shader_message_context *message_context) +int msl_compile(struct vsir_program *program, uint64_t config_flags, + const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context) { struct msl_generator generator; int ret; + if ((ret = vsir_program_transform(program, config_flags, compile_info, message_context)) < 0) + return ret; + if ((ret = msl_generator_init(&generator, program, message_context)) < 0) return ret; msl_generator_generate(&generator); diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index ad924599..4444f4bc 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -1649,7 +1649,7 @@ int vsir_program_compile(struct vsir_program *program, uint64_t config_flags, break; case VKD3D_SHADER_TARGET_MSL: - ret = msl_compile(program, message_context); + ret = msl_compile(program, config_flags, compile_info, message_context); break; default: diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 248eac2f..72f46456 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1595,7 +1595,8 @@ int spirv_compile(struct vsir_program *program, uint64_t config_flags, const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context); -int msl_compile(struct vsir_program *program, struct vkd3d_shader_message_context *message_context); +int msl_compile(struct vsir_program *program, uint64_t config_flags, + const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context); enum vkd3d_md5_variant {