vkd3d-shader: Pass a struct vsir_program to vkd3d_shader_parser_compile().

This commit is contained in:
Henri Verbeet 2024-04-18 23:51:54 +02:00 committed by Alexandre Julliard
parent fa7b623eac
commit 592e902d47
Notes: Alexandre Julliard 2024-05-02 22:40:50 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/844
3 changed files with 9 additions and 11 deletions

View File

@ -3976,7 +3976,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
} }
if (ret >= 0) 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_parser_destroy(parser);
} }
vkd3d_shader_free_shader_code(&info.source); vkd3d_shader_free_shader_code(&info.source);

View File

@ -1556,13 +1556,11 @@ int vkd3d_shader_scan(const struct vkd3d_shader_compile_info *compile_info, char
return ret; return ret;
} }
int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser, int vsir_program_compile(struct vsir_program *program, uint64_t config_flags,
const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out,
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context) struct vkd3d_shader_message_context *message_context)
{ {
struct vkd3d_shader_scan_descriptor_info1 scan_descriptor_info; 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; struct vkd3d_shader_compile_info scan_info;
int ret; int ret;
@ -1667,7 +1665,7 @@ int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info,
} }
else 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); vkd3d_shader_parser_destroy(parser);
} }
} }

View File

@ -1345,8 +1345,11 @@ struct vsir_program
size_t block_name_count; 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); 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, 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); 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, 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); 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, void vkd3d_shader_parser_error(struct vkd3d_shader_parser *parser,
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(3, 4); enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(3, 4);
bool vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser, bool vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser,