a/vk: Add function to check timeline semaphore import/export cap

This commit is contained in:
Jakob Bornecrantz 2022-04-28 10:53:23 +01:00
parent 3492c9e948
commit 0dbe9857c3
2 changed files with 37 additions and 0 deletions

View file

@ -1148,6 +1148,15 @@ vk_csci_get_image_external_handle_type(struct vk_bundle *vk);
*
*/
/*!
* Is there a good likelihood that the import/export of a timeline semaphore
* will succeed, in other words will the below functions work.
*
* @ingroup aux_vk
*/
XRT_CHECK_RESULT bool
vk_can_import_and_export_timeline_semaphore(struct vk_bundle *vk);
/*!
* @brief Creates a Vulkan fence, submits it to the default VkQueue and return
* its native graphics sync handle.

View file

@ -61,6 +61,34 @@ vk_get_timeline_semaphore_handle_type(struct vk_bundle *vk)
#endif
/*
*
* Check functions.
*
*/
bool
vk_can_import_and_export_timeline_semaphore(struct vk_bundle *vk)
{
#ifdef VK_KHR_timeline_semaphore
// Timeline semaphore extension and feature been enabled?
if (!vk->features.timeline_semaphore) {
return false;
}
// Supported handle type for import/export?
if (vk_get_timeline_semaphore_handle_type(vk) == 0) {
return false;
}
// Everything points to yes!
return true;
#else
return false;
#endif
}
/*
*
* Export.