From: Emil Velikov Date: Wed, 1 Mar 2017 12:09:14 +0000 (+0000) Subject: radv: use enum_to_str util functions. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=342e5fdb6432e79e5ada2675c3eccf352b167474;p=mesa.git radv: use enum_to_str util functions. Port of e9dcb17962f7e58a81c93bae7bd33885675b1043 vulkan/util: Add generator for enum_to_str functions Cc: Bas Nieuwenhuizen Signed-off-by: Emil Velikov Reviewed-by: Eric Engestrom --- diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am index 740f2f92e7b..3379a3d6a89 100644 --- a/src/amd/vulkan/Makefile.am +++ b/src/amd/vulkan/Makefile.am @@ -34,6 +34,8 @@ AM_CPPFLAGS = \ -I$(top_builddir)/src \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/vulkan/wsi \ + -I$(top_builddir)/src/vulkan/util \ + -I$(top_srcdir)/src/vulkan/util \ -I$(top_srcdir)/src/amd \ -I$(top_srcdir)/src/amd/common \ -I$(top_builddir)/src/compiler \ @@ -92,6 +94,7 @@ libvulkan_common_la_SOURCES = $(VULKAN_SOURCES) VULKAN_LIB_DEPS += \ libvulkan_common.la \ + $(top_builddir)/src/vulkan/libvulkan_util.la \ $(top_builddir)/src/vulkan/libvulkan_wsi.la \ $(top_builddir)/src/amd/common/libamd_common.la \ $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la \ diff --git a/src/amd/vulkan/radv_util.c b/src/amd/vulkan/radv_util.c index 684956e9a41..b892eb78851 100644 --- a/src/amd/vulkan/radv_util.c +++ b/src/amd/vulkan/radv_util.c @@ -29,6 +29,7 @@ #include #include "radv_private.h" +#include "vk_enum_to_str.h" #include "util/u_math.h" @@ -71,40 +72,7 @@ __vk_errorf(VkResult error, const char *file, int line, const char *format, ...) va_list ap; char buffer[256]; -#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_FEATURE_NOT_PRESENT) - ERROR_CASE(VK_ERROR_INCOMPATIBLE_DRIVER) - ERROR_CASE(VK_ERROR_TOO_MANY_OBJECTS) - ERROR_CASE(VK_ERROR_FORMAT_NOT_SUPPORTED) - ERROR_CASE(VK_ERROR_FRAGMENTED_POOL) - - /* Extension errors */ - ERROR_CASE(VK_ERROR_SURFACE_LOST_KHR) - ERROR_CASE(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR) - ERROR_CASE(VK_ERROR_OUT_OF_DATE_KHR) - ERROR_CASE(VK_ERROR_INCOMPATIBLE_DISPLAY_KHR) - ERROR_CASE(VK_ERROR_VALIDATION_FAILED_EXT) - ERROR_CASE(VK_ERROR_INVALID_SHADER_NV) - ERROR_CASE(VK_ERROR_OUT_OF_POOL_MEMORY_KHR) - - default: - assert(!"Unknown error"); - error_str = "unknown error"; - } - -#undef ERROR_CASE + const char *error_str = vk_Result_to_str(error); if (format) { va_start(ap, format);