Mesa (master): anv/util: Split a vk_errorv helper out of vk_errorf

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 26 18:27:50 UTC 2018


Module: Mesa
Branch: master
Commit: ade22ae1ace051422b972ef057e57aab6fdfa024
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ade22ae1ace051422b972ef057e57aab6fdfa024

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Fri Oct 26 08:24:49 2018 -0500

anv/util: Split a vk_errorv helper out of vk_errorf

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>

---

 src/intel/vulkan/anv_private.h |  8 ++++++++
 src/intel/vulkan/anv_util.c    | 23 +++++++++++++++++------
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index a3ab971b6f..c5d636fef8 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -381,6 +381,11 @@ vk_to_isl_color(VkClearColorValue color)
  * propagating errors. Might be useful to plug in a stack trace here.
  */
 
+VkResult __vk_errorv(struct anv_instance *instance, const void *object,
+                     VkDebugReportObjectTypeEXT type, VkResult error,
+                     const char *file, int line, const char *format,
+                     va_list args);
+
 VkResult __vk_errorf(struct anv_instance *instance, const void *object,
                      VkDebugReportObjectTypeEXT type, VkResult error,
                      const char *file, int line, const char *format, ...);
@@ -389,6 +394,9 @@ VkResult __vk_errorf(struct anv_instance *instance, const void *object,
 #define vk_error(error) __vk_errorf(NULL, NULL,\
                                     VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,\
                                     error, __FILE__, __LINE__, NULL)
+#define vk_errorv(instance, obj, error, format, args)\
+    __vk_errorv(instance, obj, REPORT_OBJECT_TYPE(obj), error,\
+                __FILE__, __LINE__, format, args)
 #define vk_errorf(instance, obj, error, format, ...)\
     __vk_errorf(instance, obj, REPORT_OBJECT_TYPE(obj), error,\
                 __FILE__, __LINE__, format, ## __VA_ARGS__)
diff --git a/src/intel/vulkan/anv_util.c b/src/intel/vulkan/anv_util.c
index 8ccb61b35c..1159ccecc6 100644
--- a/src/intel/vulkan/anv_util.c
+++ b/src/intel/vulkan/anv_util.c
@@ -77,20 +77,17 @@ __anv_perf_warn(struct anv_instance *instance, const void *object,
 }
 
 VkResult
-__vk_errorf(struct anv_instance *instance, const void *object,
-                     VkDebugReportObjectTypeEXT type, VkResult error,
-                     const char *file, int line, const char *format, ...)
+__vk_errorv(struct anv_instance *instance, const void *object,
+            VkDebugReportObjectTypeEXT type, VkResult error,
+            const char *file, int line, const char *format, va_list ap)
 {
-   va_list ap;
    char buffer[256];
    char report[512];
 
    const char *error_str = vk_Result_to_str(error);
 
    if (format) {
-      va_start(ap, format);
       vsnprintf(buffer, sizeof(buffer), format, ap);
-      va_end(ap);
 
       snprintf(report, sizeof(report), "%s:%d: %s (%s)", file, line, buffer,
                error_str);
@@ -113,3 +110,17 @@ __vk_errorf(struct anv_instance *instance, const void *object,
 
    return error;
 }
+
+VkResult
+__vk_errorf(struct anv_instance *instance, const void *object,
+            VkDebugReportObjectTypeEXT type, VkResult error,
+            const char *file, int line, const char *format, ...)
+{
+   va_list ap;
+
+   va_start(ap, format);
+   __vk_errorv(instance, object, type, error, file, line, format, ap);
+   va_end(ap);
+
+   return error;
+}




More information about the mesa-commit mailing list