diff --git a/src/vulkan/runtime/vk_debug_utils.c b/src/vulkan/runtime/vk_debug_utils.c index 556f3de1afd..0aa4c05d7b2 100644 --- a/src/vulkan/runtime/vk_debug_utils.c +++ b/src/vulkan/runtime/vk_debug_utils.c @@ -32,6 +32,7 @@ #include "vk_util.h" #include "stdarg.h" #include "util/u_dynarray.h" +#include "util/u_printf.h" void vk_debug_message(struct vk_instance *instance, @@ -459,3 +460,15 @@ vk_common_QueueInsertDebugUtilsLabelEXT( pLabelInfo); queue->region_begin = false; } + +VkResult +vk_check_printf_status(struct vk_device *dev, struct u_printf_ctx *ctx, + struct u_printf_info *info, uint32_t count) +{ + if (u_printf_check_abort(stdout, ctx, info, count)) { + vk_device_set_lost(dev, "GPU abort."); + return VK_ERROR_DEVICE_LOST; + } else { + return VK_SUCCESS; + } +} diff --git a/src/vulkan/runtime/vk_debug_utils.h b/src/vulkan/runtime/vk_debug_utils.h index 7f27be47461..403ff169ab3 100644 --- a/src/vulkan/runtime/vk_debug_utils.h +++ b/src/vulkan/runtime/vk_debug_utils.h @@ -24,6 +24,7 @@ #ifndef VK_DEBUG_UTILS_H #define VK_DEBUG_UTILS_H +#include "vk_device.h" #include "vk_instance.h" #ifdef __cplusplus @@ -67,6 +68,13 @@ vk_address_binding_report(struct vk_instance *instance, uint64_t size, VkDeviceAddressBindingTypeEXT type); +struct u_printf_ctx; +struct u_printf_info; + +VkResult +vk_check_printf_status(struct vk_device *dev, struct u_printf_ctx *ctx, + struct u_printf_info *info, uint32_t count); + #ifdef __cplusplus } #endif