summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorDylan Baker <[email protected]>2017-02-15 15:41:50 -0800
committerDylan Baker <[email protected]>2017-02-22 13:12:02 -0800
commite9dcb17962f7e58a81c93bae7bd33885675b1043 (patch)
tree55332d8cdb6783ab65fc8d34e4df8168fb38dcab /src/intel
parentbda59f6e417b68985ffc8dbb92fcfe19ba12f7bf (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')
-rw-r--r--src/intel/vulkan/Makefile.am2
-rw-r--r--src/intel/vulkan/anv_util.c36
2 files changed, 4 insertions, 34 deletions
diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
index 93f2ceb00f1..b9b79f44055 100644
--- a/src/intel/vulkan/Makefile.am
+++ b/src/intel/vulkan/Makefile.am
@@ -49,6 +49,7 @@ AM_CPPFLAGS = \
-I$(top_builddir)/src \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/vulkan/wsi \
+ -I$(top_builddir)/src/vulkan/util \
-I$(top_builddir)/src/compiler \
-I$(top_srcdir)/src/compiler \
-I$(top_builddir)/src/compiler/nir \
@@ -126,6 +127,7 @@ libvulkan_common_la_SOURCES = $(VULKAN_SOURCES)
VULKAN_LIB_DEPS += \
libvulkan_common.la \
+ $(top_builddir)/src/vulkan/util/libvulkan_util.la \
$(top_builddir)/src/vulkan/wsi/libvulkan_wsi.la \
$(top_builddir)/src/mesa/drivers/dri/i965/libi965_compiler.la \
$(top_builddir)/src/compiler/nir/libnir.la \
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);