anv: wire up anv_perf_warn macro to do debug reporting
[mesa.git] / src / intel / vulkan / anv_util.c
index 4b916e27f2c910c20d75ea199b90bf6510c688f3..45ce0a3aa0e88b1602b33f64b60ce36b011d2a3a 100644 (file)
@@ -65,16 +65,30 @@ __anv_finishme(const char *file, int line, const char *format, ...)
    fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer);
 }
 
-void anv_printflike(3, 4)
-__anv_perf_warn(const char *file, int line, const char *format, ...)
+void anv_printflike(6, 7)
+__anv_perf_warn(struct anv_instance *instance, const void *object,
+                VkDebugReportObjectTypeEXT type,
+                const char *file, int line, const char *format, ...)
 {
    va_list ap;
    char buffer[256];
+   char report[256];
 
    va_start(ap, format);
    vsnprintf(buffer, sizeof(buffer), format, ap);
    va_end(ap);
 
+   snprintf(report, sizeof(report), "%s: %s", file, buffer);
+
+   anv_debug_report(instance,
+                    VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
+                    type,
+                    (uint64_t) (uintptr_t) object,
+                    line,
+                    0,
+                    "anv",
+                    report);
+
    fprintf(stderr, "%s:%d: PERF: %s\n", file, line, buffer);
 }