The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

comp: Wait for release/acquire fence before destroying swapchain

Fixes validation warning when quitting Vulkan OpenXR applications
like hello_xr -G Vulkan2:

VUID-vkDestroyImage-image-01000(ERROR / SPEC): msgNum: -221078694 - Validation Error: [ VUID-vkDestroyImage-image-01000 ] Object 0: handle = 0x55d4d96e4960, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf2d29b5a | Cannot call vkDestroyImage on VkImage 0xcb1c7c000000001b[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to image, either directly or via a VkImageView, must have completed execution (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-vkDestroyImage-image-01000)
Objects: 1
[0] 0x55d4d96e4960, type: 3, name: NULL

This is an addition to commit 778515739fe522f7267c41f6fe5150fa0a44b41a that
introduced this fence.

+7
+7
src/xrt/compositor/client/comp_vk_client.c
··· 54 54 struct vk_bundle *vk = &c->vk; 55 55 56 56 for (uint32_t i = 0; i < sc->base.base.num_images; i++) { 57 + 58 + VkResult ret = vk->vkWaitForFences(vk->device, 1, &sc->acquire_release_fence[i], true, MS_TO_NS(500)); 59 + if (vk_has_error(ret, "vkWaitForFences", __FILE__, __LINE__)) { 60 + // don't really care, we are going to destroy anyway, just make sure it's not used anymore 61 + vk->vkDeviceWaitIdle(vk->device); 62 + } 63 + 57 64 if (sc->base.images[i] != VK_NULL_HANDLE) { 58 65 vk->vkDestroyImage(vk->device, sc->base.images[i], NULL); 59 66 sc->base.images[i] = VK_NULL_HANDLE;