vkd3d-shader/dxil: Do not use the parser before it is initialized.

This commit is contained in:
Giovanni Mascellani 2023-12-15 14:07:21 +01:00 committed by Alexandre Julliard
parent 111818eabb
commit a02cd1cf64
Notes: Alexandre Julliard 2024-01-03 23:09:56 +01: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/526
3 changed files with 14 additions and 2 deletions

View File

@ -6035,7 +6035,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if ((magic = sm6->start[0]) != BITCODE_MAGIC) if ((magic = sm6->start[0]) != BITCODE_MAGIC)
{ {
WARN("Unknown magic number 0x%08x.\n", magic); WARN("Unknown magic number 0x%08x.\n", magic);
vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_UNKNOWN_MAGIC_NUMBER, vkd3d_shader_warning(message_context, &location, VKD3D_SHADER_WARNING_DXIL_UNKNOWN_MAGIC_NUMBER,
"DXIL bitcode chunk magic number 0x%08x is not the expected 0x%08x.", magic, BITCODE_MAGIC); "DXIL bitcode chunk magic number 0x%08x is not the expected 0x%08x.", magic, BITCODE_MAGIC);
} }
@ -6044,7 +6044,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
if ((version.type = version_token >> 16) >= VKD3D_SHADER_TYPE_COUNT) if ((version.type = version_token >> 16) >= VKD3D_SHADER_TYPE_COUNT)
{ {
FIXME("Unknown shader type %#x.\n", version.type); FIXME("Unknown shader type %#x.\n", version.type);
vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_UNKNOWN_SHADER_TYPE, vkd3d_shader_warning(message_context, &location, VKD3D_SHADER_WARNING_DXIL_UNKNOWN_SHADER_TYPE,
"Unknown shader type %#x.", version.type); "Unknown shader type %#x.", version.type);
} }

View File

@ -307,6 +307,16 @@ void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const s
vkd3d_string_buffer_printf(&context->messages, "\n"); vkd3d_string_buffer_printf(&context->messages, "\n");
} }
void vkd3d_shader_warning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_error error, const char *format, ...)
{
va_list args;
va_start(args, format);
vkd3d_shader_vwarning(context, location, error, format, args);
va_end(args);
}
void vkd3d_shader_verror(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location, void vkd3d_shader_verror(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_error error, const char *format, va_list args) enum vkd3d_shader_error error, const char *format, va_list args)
{ {

View File

@ -1398,6 +1398,8 @@ void vkd3d_shader_verror(struct vkd3d_shader_message_context *context, const str
enum vkd3d_shader_error error, const char *format, va_list args); enum vkd3d_shader_error error, const char *format, va_list args);
void vkd3d_shader_vnote(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location, void vkd3d_shader_vnote(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_log_level level, const char *format, va_list args); enum vkd3d_shader_log_level level, const char *format, va_list args);
void vkd3d_shader_warning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(4, 5);
void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location, void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
enum vkd3d_shader_error error, const char *format, va_list args); enum vkd3d_shader_error error, const char *format, va_list args);