The open source OpenXR runtime
0
fork

Configure Feed

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

c/client: rm client swapchain layout transition;

This was only there to satisfy a validation layer bug, which appears
to have since been fixed. It doesn't make sense to transition an XR
swapchain image to PRESENT_SRC, and the client transitions from
UNDEFINED anyway when acquiring the image.

This also fixes a case where monado violates the OpenXR specification:

> The list of OpenXR functions where the OpenXR runtime may access the
> VkQueue are:
> - xrBeginFrame
> - xrEndFrame
> - xrAcquireSwapchainImage
> - xrReleaseSwapchainImage
> The runtime must not access the VkQueue in any OpenXR function that is
> not listed above or in an extension definition.

authored by

bjorn and committed by
Jakob Bornecrantz
d3a0f10a 2d954d84

-35
-35
src/xrt/compositor/client/comp_vk_client.c
··· 609 609 610 610 struct client_vk_compositor *c = client_vk_compositor(xc); 611 611 struct vk_bundle *vk = &c->vk; 612 - VkCommandBuffer cmd_buffer; 613 612 VkResult ret; 614 613 xrt_result_t xret; 615 614 ··· 623 622 624 623 struct xrt_swapchain *xsc = &xscn->base; 625 624 626 - ret = vk_init_cmd_buffer(vk, &cmd_buffer); 627 - if (ret != VK_SUCCESS) { 628 - return XRT_ERROR_VULKAN; 629 - } 630 - 631 625 VkAccessFlags barrier_access_mask = vk_csci_get_barrier_access_mask(info->bits); 632 626 VkImageLayout barrier_optimal_layout = vk_csci_get_barrier_optimal_layout(info->format); 633 627 VkImageAspectFlags barrier_aspect_mask = vk_csci_get_barrier_aspect_mask(info->format); 634 628 635 - VkImageSubresourceRange subresource_range = { 636 - .aspectMask = barrier_aspect_mask, 637 - .baseMipLevel = 0, 638 - .levelCount = VK_REMAINING_MIP_LEVELS, 639 - .baseArrayLayer = 0, 640 - .layerCount = VK_REMAINING_ARRAY_LAYERS, 641 - }; 642 - 643 629 struct client_vk_swapchain *sc = U_TYPED_CALLOC(struct client_vk_swapchain); 644 630 sc->base.base.destroy = client_vk_swapchain_destroy; 645 631 sc->base.base.acquire_image = client_vk_swapchain_acquire_image; ··· 653 639 for (uint32_t i = 0; i < xsc->image_count; i++) { 654 640 ret = vk_create_image_from_native(vk, info, &xscn->images[i], &sc->base.images[i], &sc->mems[i]); 655 641 656 - 657 642 if (ret != VK_SUCCESS) { 658 643 return XRT_ERROR_VULKAN; 659 644 } 660 - 661 - /* 662 - * This is only to please the validation layer, that may or may 663 - * not be a bug in the validation layer. That may or may not be 664 - * fixed in the future version of the validation layer. 665 - */ 666 - vk_cmd_image_barrier_gpu( // 667 - vk, // vk_bundle 668 - cmd_buffer, // cmd_buffer 669 - sc->base.images[i], // image 670 - 0, // src_access_mask 671 - barrier_access_mask, // dst_access_mask 672 - VK_IMAGE_LAYOUT_UNDEFINED, // old_layout 673 - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, // new_layout 674 - subresource_range); // subresource_range 675 - } 676 - 677 - ret = vk_submit_cmd_buffer(vk, cmd_buffer); 678 - if (ret != VK_SUCCESS) { 679 - return XRT_ERROR_FAILED_TO_SUBMIT_VULKAN_COMMANDS; 680 645 } 681 646 682 647 // Prerecord command buffers for swapchain image ownership/layout transitions