vulkan: add vk_check_printf_status helper

to integrate debug printf/abort, vulkan drivers need to implement a device
status. we would need to thicken the runtime to do that entirely in common code,
but we can at least add a helper to make it easier for vk drivers to wire.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32564>
This commit is contained in:
Alyssa Rosenzweig
2024-12-06 10:46:34 -05:00
committed by Marge Bot
parent 33d839a72a
commit a667a5a5d6
2 changed files with 21 additions and 0 deletions
+13
View File
@@ -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;
}
}
+8
View File
@@ -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