radv: report errors back to the application via VK_EXT_debug_report
Help for debugging. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6230>
This commit is contained in:
@@ -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);
|
||||
radv_printflike(7, 8);
|
||||
|
||||
#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__);
|
||||
#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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user