vkd3d-shader/msl: Call vsir_program_transform() before generating code.

This commit is contained in:
Feifan He 2024-08-29 01:21:39 +08:00 committed by Henri Verbeet
parent 47981def0d
commit 5df81049aa
Notes: Henri Verbeet 2024-09-12 18:55:53 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1055
4 changed files with 10 additions and 4 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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:

View File

@ -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
{