Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- libs/vkd3d-shader/hlsl.c | 6 +++++- libs/vkd3d-shader/vkd3d_shader_main.c | 20 ++++++++++++++++++++ libs/vkd3d-shader/vkd3d_shader_private.h | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index dbc6954e..52b3dd10 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -23,7 +23,11 @@ void hlsl_note(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc, enum vkd3d_shader_log_level level, const char *fmt, ...) { - /* FIXME */ + va_list args; + + va_start(args, fmt); + vkd3d_shader_vnote(ctx->message_context, &loc, level, fmt, args); + va_end(args); }
void hlsl_error(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc, diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 6f1482ab..bae2852a 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -144,6 +144,26 @@ bool vkd3d_shader_message_context_copy_messages(struct vkd3d_shader_message_cont return true; }
+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) +{ + if (context->log_level < level) + return; + + if (location) + { + const char *source_name = location->source_name ? location->source_name : "<anonymous>"; + + if (location->line) + vkd3d_string_buffer_printf(&context->messages, "%s:%u:%u: ", + source_name, location->line, location->column); + else + vkd3d_string_buffer_printf(&context->messages, "%s: ", source_name); + } + vkd3d_string_buffer_vprintf(&context->messages, format, args); + vkd3d_string_buffer_printf(&context->messages, "\n"); +} + 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) { diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 2d7eb05b..e837dbcd 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -906,6 +906,8 @@ void vkd3d_shader_error(struct vkd3d_shader_message_context *context, const stru enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(4, 5) DECLSPEC_HIDDEN; 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) DECLSPEC_HIDDEN; +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) DECLSPEC_HIDDEN; 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) DECLSPEC_HIDDEN;