From: Samuel Pitoiset Date: Fri, 7 Aug 2020 14:21:31 +0000 (+0200) Subject: radv: report errors back to the application via VK_EXT_debug_report X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3691ef55961aa0c5125d59463fa3fa5f4f61b170;p=mesa.git radv: report errors back to the application via VK_EXT_debug_report Help for debugging. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 0634350701e..8c016bb4d4f 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -194,16 +194,24 @@ radv_clear_mask(uint32_t *inout_mask, uint32_t clear_mask) struct radv_image_view; struct radv_instance; -VkResult __vk_errorv(struct radv_instance *instance, VkResult error, +VkResult __vk_errorv(struct radv_instance *instance, const void *object, + VkDebugReportObjectTypeEXT type, VkResult error, const char *file, int line, const char *format, va_list args); -VkResult __vk_errorf(struct radv_instance *instance, VkResult error, +VkResult __vk_errorf(struct radv_instance *instance, const void *object, + VkDebugReportObjectTypeEXT type, VkResult error, const char *file, int line, const char *format, ...) - radv_printflike(5, 6); - -#define vk_error(instance, error) __vk_errorf(instance, error, __FILE__, __LINE__, NULL); -#define vk_errorf(instance, error, format, ...) __vk_errorf(instance, error, __FILE__, __LINE__, format, ## __VA_ARGS__); + radv_printflike(7, 8); + +#define vk_error(instance, error) \ + __vk_errorf(instance, NULL, \ + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, \ + error, __FILE__, __LINE__, NULL); +#define vk_errorf(instance, error, format, ...) \ + __vk_errorf(instance, NULL, \ + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, \ + error, __FILE__, __LINE__, format, ## __VA_ARGS__); void __radv_finishme(const char *file, int line, const char *format, ...) radv_printflike(3, 4); diff --git a/src/amd/vulkan/radv_util.c b/src/amd/vulkan/radv_util.c index 01224157e5e..bfab0cd6033 100644 --- a/src/amd/vulkan/radv_util.c +++ b/src/amd/vulkan/radv_util.c @@ -88,7 +88,8 @@ void radv_printflike(3, 4) } VkResult -__vk_errorv(struct radv_instance *instance, VkResult error, const char *file, +__vk_errorv(struct radv_instance *instance, const void *object, + VkDebugReportObjectTypeEXT type, VkResult error, const char *file, int line, const char *format, va_list ap) { char buffer[256]; @@ -111,19 +112,27 @@ __vk_errorv(struct radv_instance *instance, VkResult error, const char *file, error_str); } + if (instance) { + vk_debug_report(&instance->debug_report_callbacks, + VK_DEBUG_REPORT_ERROR_BIT_EXT, type, + (uint64_t)(uintptr_t) object, line, 0, "radv", + report); + } + fprintf(stderr, "%s\n", report); return error; } VkResult -__vk_errorf(struct radv_instance *instance, VkResult error, const char *file, +__vk_errorf(struct radv_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, error, file, line, format, ap); + __vk_errorv(instance, object, type, error, file, line, format, ap); va_end(ap); return error;