vkd3d-shader/spirv: Pass a struct vsir_program to spirv_compile().

This commit is contained in:
Henri Verbeet 2024-04-18 22:14:18 +02:00 committed by Alexandre Julliard
parent e21215f466
commit f948520504
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 7 additions and 6 deletions

View File

@ -10368,17 +10368,16 @@ static int spirv_compiler_generate_spirv(struct spirv_compiler *compiler, struct
return VKD3D_OK; return VKD3D_OK;
} }
int spirv_compile(struct vkd3d_shader_parser *parser, int spirv_compile(struct vsir_program *program, uint64_t config_flags,
const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info, const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info,
const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_compile_info *compile_info,
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context) struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context)
{ {
struct vsir_program *program = &parser->program;
struct spirv_compiler *spirv_compiler; struct spirv_compiler *spirv_compiler;
int ret; int ret;
if (!(spirv_compiler = spirv_compiler_create(program, compile_info, if (!(spirv_compiler = spirv_compiler_create(program, compile_info,
scan_descriptor_info, message_context, parser->config_flags))) scan_descriptor_info, message_context, config_flags)))
{ {
ERR("Failed to create SPIR-V compiler.\n"); ERR("Failed to create SPIR-V compiler.\n");
return VKD3D_ERROR; return VKD3D_ERROR;

View File

@ -1563,6 +1563,7 @@ int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
{ {
struct vkd3d_shader_scan_descriptor_info1 scan_descriptor_info; struct vkd3d_shader_scan_descriptor_info1 scan_descriptor_info;
struct vsir_program *program = &parser->program; 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;
@ -1577,7 +1578,7 @@ int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
case VKD3D_SHADER_TARGET_GLSL: case VKD3D_SHADER_TARGET_GLSL:
if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0) if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0)
return ret; return ret;
ret = glsl_compile(program, parser->config_flags, compile_info, out, message_context); ret = glsl_compile(program, config_flags, compile_info, out, message_context);
vkd3d_shader_free_scan_descriptor_info1(&scan_descriptor_info); vkd3d_shader_free_scan_descriptor_info1(&scan_descriptor_info);
break; break;
@ -1585,7 +1586,8 @@ int vkd3d_shader_parser_compile(struct vkd3d_shader_parser *parser,
case VKD3D_SHADER_TARGET_SPIRV_TEXT: case VKD3D_SHADER_TARGET_SPIRV_TEXT:
if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0) if ((ret = scan_with_parser(&scan_info, message_context, &scan_descriptor_info, parser)) < 0)
return ret; return ret;
ret = spirv_compile(parser, &scan_descriptor_info, compile_info, out, message_context); ret = spirv_compile(program, config_flags, &scan_descriptor_info,
compile_info, out, message_context);
vkd3d_shader_free_scan_descriptor_info1(&scan_descriptor_info); vkd3d_shader_free_scan_descriptor_info1(&scan_descriptor_info);
break; break;

View File

@ -1555,7 +1555,7 @@ int glsl_compile(struct vsir_program *program, uint64_t config_flags,
#define SPIRV_MAX_SRC_COUNT 6 #define SPIRV_MAX_SRC_COUNT 6
int spirv_compile(struct vkd3d_shader_parser *parser, int spirv_compile(struct vsir_program *program, uint64_t config_flags,
const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info, const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info,
const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_compile_info *compile_info,
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context); struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);