anv: wire up vk_errorf macro to do debug reporting
Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -93,10 +93,13 @@ __anv_perf_warn(struct anv_instance *instance, const void *object,
|
||||
}
|
||||
|
||||
VkResult
|
||||
__vk_errorf(VkResult error, const char *file, int line, const char *format, ...)
|
||||
__vk_errorf(struct anv_instance *instance, const void *object,
|
||||
VkDebugReportObjectTypeEXT type, VkResult error,
|
||||
const char *file, int line, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buffer[256];
|
||||
char report[256];
|
||||
|
||||
const char *error_str = vk_Result_to_str(error);
|
||||
|
||||
@@ -105,11 +108,23 @@ __vk_errorf(VkResult error, const char *file, int line, const char *format, ...)
|
||||
vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||
va_end(ap);
|
||||
|
||||
fprintf(stderr, "%s:%d: %s (%s)\n", file, line, buffer, error_str);
|
||||
snprintf(report, sizeof(report), "%s:%d: %s (%s)", file, line, buffer,
|
||||
error_str);
|
||||
} else {
|
||||
fprintf(stderr, "%s:%d: %s\n", file, line, error_str);
|
||||
snprintf(report, sizeof(report), "%s:%d: %s", file, line, error_str);
|
||||
}
|
||||
|
||||
anv_debug_report(instance,
|
||||
VK_DEBUG_REPORT_ERROR_BIT_EXT,
|
||||
type,
|
||||
(uint64_t) (uintptr_t) object,
|
||||
line,
|
||||
0,
|
||||
"anv",
|
||||
report);
|
||||
|
||||
fprintf(stderr, "%s\n", report);
|
||||
|
||||
if (error == VK_ERROR_DEVICE_LOST &&
|
||||
env_var_as_boolean("ANV_ABORT_ON_DEVICE_LOSS", false))
|
||||
abort();
|
||||
|
Reference in New Issue
Block a user