diff options
Diffstat (limited to 'lib/mesa/src/amd/vulkan/radv_util.c')
-rw-r--r-- | lib/mesa/src/amd/vulkan/radv_util.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/lib/mesa/src/amd/vulkan/radv_util.c b/lib/mesa/src/amd/vulkan/radv_util.c index b892eb788..8c7a948bc 100644 --- a/lib/mesa/src/amd/vulkan/radv_util.c +++ b/lib/mesa/src/amd/vulkan/radv_util.c @@ -29,7 +29,6 @@ #include <assert.h> #include "radv_private.h" -#include "vk_enum_to_str.h" #include "util/u_math.h" @@ -66,13 +65,55 @@ void radv_printflike(3, 4) fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer); } +void radv_noreturn radv_printflike(1, 2) + radv_abortf(const char *format, ...) +{ + va_list va; + + va_start(va, format); + radv_abortfv(format, va); + va_end(va); +} + +void radv_noreturn +radv_abortfv(const char *format, va_list va) +{ + fprintf(stderr, "vk: error: "); + vfprintf(stderr, format, va); + fprintf(stderr, "\n"); + abort(); +} + VkResult __vk_errorf(VkResult error, const char *file, int line, const char *format, ...) { va_list ap; char buffer[256]; - const char *error_str = vk_Result_to_str(error); +#define ERROR_CASE(error) case error: error_str = #error; break; + + const char *error_str; + switch ((int32_t)error) { + + /* Core errors */ + ERROR_CASE(VK_ERROR_OUT_OF_HOST_MEMORY) + ERROR_CASE(VK_ERROR_OUT_OF_DEVICE_MEMORY) + ERROR_CASE(VK_ERROR_INITIALIZATION_FAILED) + ERROR_CASE(VK_ERROR_DEVICE_LOST) + ERROR_CASE(VK_ERROR_MEMORY_MAP_FAILED) + ERROR_CASE(VK_ERROR_LAYER_NOT_PRESENT) + ERROR_CASE(VK_ERROR_EXTENSION_NOT_PRESENT) + ERROR_CASE(VK_ERROR_INCOMPATIBLE_DRIVER) + + /* Extension errors */ + ERROR_CASE(VK_ERROR_OUT_OF_DATE_KHR) + + default: + assert(!"Unknown error"); + error_str = "unknown error"; + } + +#undef ERROR_CASE if (format) { va_start(ap, format); |