From 1132080d5d5ea4c337a5fc4e4a24a06e14a7d9cd Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Thu, 28 May 2015 08:07:54 -0700 Subject: [PATCH] vk/util: Add anv_loge() for logging error messages --- src/vulkan/private.h | 2 ++ src/vulkan/util.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 0d199c836a3..fc7f65598f5 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -119,6 +119,8 @@ vk_error(VkResult error) void __anv_finishme(const char *file, int line, const char *format, ...) anv_printflike(3, 4); +void anv_loge(const char *format, ...) anv_printflike(1, 2); +void anv_loge_v(const char *format, va_list va); /** * Print a FINISHME message, including its source location. diff --git a/src/vulkan/util.c b/src/vulkan/util.c index 13af882cffd..cbeb663b5ef 100644 --- a/src/vulkan/util.c +++ b/src/vulkan/util.c @@ -30,6 +30,26 @@ #include "private.h" +/** Log an error message. */ +void anv_printflike(1, 2) +anv_loge(const char *format, ...) +{ + va_list va; + + va_start(va, format); + anv_loge_v(format, va); + va_end(va); +} + +/** \see anv_loge() */ +void +anv_loge_v(const char *format, va_list va) +{ + fprintf(stderr, "vk: error: "); + vfprintf(stderr, format, va); + fprintf(stderr, "\n"); +} + void anv_printflike(3, 4) __anv_finishme(const char *file, int line, const char *format, ...) { -- 2.30.2