diff options
author | Dylan Baker <[email protected]> | 2017-02-15 15:41:50 -0800 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2017-02-22 13:12:02 -0800 |
commit | e9dcb17962f7e58a81c93bae7bd33885675b1043 (patch) | |
tree | 55332d8cdb6783ab65fc8d34e4df8168fb38dcab /src/intel/vulkan/anv_util.c | |
parent | bda59f6e417b68985ffc8dbb92fcfe19ba12f7bf (diff) |
vulkan/util: Add generator for enum_to_str functions
This adds a python generator to produce enum_to_str functions for
Vulkan from the vk.xml API description. It supports extensions as well
as core API features, and the generator works with both python2 and
python3.
Signed-off-by: Dylan Baker <[email protected]>
Acked-by: Matt Turner <[email protected]>
Acked-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_util.c')
-rw-r--r-- | src/intel/vulkan/anv_util.c | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/src/intel/vulkan/anv_util.c b/src/intel/vulkan/anv_util.c index 6d751870654..ec5c9486d8c 100644 --- a/src/intel/vulkan/anv_util.c +++ b/src/intel/vulkan/anv_util.c @@ -29,6 +29,7 @@ #include <assert.h> #include "anv_private.h" +#include "vk_enum_to_str.h" /** Log an error message. */ void anv_printflike(1, 2) @@ -69,40 +70,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); |