a/vk: Add vk_print_result helper

This commit is contained in:
Jakob Bornecrantz 2023-09-30 12:19:43 +01:00
parent 9d92720960
commit 6316bf39a9
2 changed files with 19 additions and 0 deletions

View file

@ -624,6 +624,15 @@ vk_name_object(struct vk_bundle *vk, VkDebugReportObjectTypeEXT object_type, uin
*
*/
/*!
* Print the result of a function, info level if ret == `VK_SUCCESS` and error
* level otherwise. Also prints file and line.
*
* @ingroup aux_vk
*/
void
vk_print_result(struct vk_bundle *vk, VkResult ret, const char *fun, const char *file, int line);
/*!
* Print device information to the logger at the given logging level,
* if the vk_bundle has that level enabled.

View file

@ -45,6 +45,16 @@
*
*/
void
vk_print_result(struct vk_bundle *vk, VkResult ret, const char *fun, const char *file, int line)
{
if (ret == VK_SUCCESS) {
VK_INFO(vk, "%s: %s [%s:%d]", fun, vk_result_string(ret), file, line);
} else {
VK_ERROR(vk, "%s failed: %s [%s:%d]", fun, vk_result_string(ret), file, line);
}
}
void
vk_print_device_info(struct vk_bundle *vk,
enum u_logging_level log_level,