From 592e902d47921db9f1386b461cc9796e258d077a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 18 Apr 2024 23:51:54 +0200 Subject: [PATCH] vkd3d-shader: Pass a struct vsir_program to vkd3d_shader_parser_compile(). --- libs/vkd3d-shader/hlsl.c | 2 +- libs/vkd3d-shader/vkd3d_shader_main.c | 10 ++++------ libs/vkd3d-shader/vkd3d_shader_private.h | 8 ++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 5edebb60..0b48b17d 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -3976,7 +3976,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d } if (ret >= 0) { - ret = vkd3d_shader_parser_compile(parser, &info, out, message_context); + ret = vsir_program_compile(&parser->program, parser->config_flags, &info, out, message_context); vkd3d_shader_parser_destroy(parser); } vkd3d_shader_free_shader_code(&info.source); diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index d58a19a2..a7b42217 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -1556,13 +1556,11 @@ int vkd3d_shader_scan(const struct vkd3d_shader_compile_info *compile_info, char return ret; } -int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser, - const struct vkd3d_shader_compile_info *compile_info, - struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context) +int vsir_program_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) { struct vkd3d_shader_scan_descriptor_info1 scan_descriptor_info; - struct vsir_program *program = &parser->program; - uint64_t config_flags = parser->config_flags; struct vkd3d_shader_compile_info scan_info; int ret; @@ -1667,7 +1665,7 @@ int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info, } else { - ret = vkd3d_shader_parser_compile(parser, compile_info, out, &message_context); + ret = vsir_program_compile(&parser->program, parser->config_flags, compile_info, out, &message_context); vkd3d_shader_parser_destroy(parser); } } diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 79a69daf..04344586 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -1345,8 +1345,11 @@ struct vsir_program size_t block_name_count; }; -bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_version *version, unsigned int reserve); void vsir_program_cleanup(struct vsir_program *program); +int vsir_program_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); +bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_version *version, unsigned int reserve); enum vkd3d_result vsir_program_normalise(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_result vsir_program_validate(struct vsir_program *program, uint64_t config_flags, @@ -1381,9 +1384,6 @@ struct vkd3d_shader_parser_ops void (*parser_destroy)(struct vkd3d_shader_parser *parser); }; -int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser, - const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out, - struct vkd3d_shader_message_context *message_context); void vkd3d_shader_parser_error(struct vkd3d_shader_parser *parser, enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(3, 4); bool vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser,