mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-03-04 13:47:50 +00:00
aux/vk: Add vk_check_error macro.
This commit is contained in:
parent
6aa1b4e571
commit
06ce79272d
src/xrt/auxiliary/vk
|
@ -115,6 +115,16 @@ vk_color_space_string(VkColorSpaceKHR code)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
vk_has_error(VkResult res, const char *fun, const char *file, int line)
|
||||
{
|
||||
if (res != VK_SUCCESS) {
|
||||
fprintf(stderr, "ERROR: %s failed with %s in %s:%d\n", fun,
|
||||
vk_result_string(res), file, line);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -224,6 +224,13 @@ vk_color_space_string(VkColorSpaceKHR code);
|
|||
fprintf(stderr, "\n"); \
|
||||
} while (false)
|
||||
|
||||
bool
|
||||
vk_has_error(VkResult res, const char *fun, const char *file, int line);
|
||||
|
||||
#define vk_check_error(fun, res, ret) \
|
||||
if (vk_has_error(res, fun, __FILE__, __LINE__)) \
|
||||
return ret
|
||||
|
||||
/*!
|
||||
* @ingroup aux_vk
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue