struct radv_image_view;
struct radv_instance;
-VkResult __vk_errorf(struct radv_instance *instance, VkResult error, const char *file, int line, const char *format, ...);
+VkResult __vk_errorv(struct radv_instance *instance, VkResult error,
+ const char *file, int line, const char *format,
+ va_list args);
+
+VkResult __vk_errorf(struct radv_instance *instance, 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__);
}
VkResult
-__vk_errorf(struct radv_instance *instance, VkResult error, const char *file,
- int line, const char *format, ...)
+__vk_errorv(struct radv_instance *instance, 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);
#endif
if (format) {
- va_start(ap, 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);
}
+ fprintf(stderr, "%s\n", report);
+
return error;
}
+VkResult
+__vk_errorf(struct radv_instance *instance, 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);
+ va_end(ap);
+
+ return error;
+}