Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SteamVR violates the OpenXR standard when using a single swapchain with array layers #1822

Open
amini-allight opened this issue Mar 19, 2024 · 4 comments

Comments

@amini-allight
Copy link

When you construct an application that uses a single XrSwapchain with two array layers, one for each eye, SteamVR will emit a Vulkan validation error with every frame (provided validation layers are enabled). The error message reads

vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer expects VkImage (subresource: aspectMask 0x1 array layer 1, mip level 0) to be in layout VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL--instead, current layout is VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.

This originates from a call to vkQueueSubmit somewhere inside of SteamVR, not the application code. It occurs because SteamVR is expecting the second array layer to be in layout VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL. This violates the OpenXR standard which states in section 12.20 on the XR_KHR_vulkan_enable extension that:

When an application releases a swapchain image by calling xrReleaseSwapchainImage, in a session created using XrGraphicsBindingVulkanKHR, the OpenXR runtime must interpret the image as:

• Having a memory layout compatible with VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL for color images, or VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL for depth images.

I have written a demo program where this issue can be turned on and off by toggling between a single or dual swapchain setup, available on my GitLab here along with usage instructions and a description of its internal functionality.

@Rectus
Copy link

Rectus commented Mar 19, 2024

IIRC it has that behavior even without array layers, both with Vulkan and DirectX 12.

@amini-allight
Copy link
Author

With a single swapchain or dual?

@Rectus
Copy link

Rectus commented Mar 19, 2024

It's been a while, I think I mostly tested with dual under DX12. I don't think there has been any instance where I've attached the debugger and not having it spammed with the layout errors.

@amini-allight
Copy link
Author

It did also used to spam the console with performance warnings (2 per frame) about performing operations on images in VK_IMAGE_LAYOUT_GENERAL but those got fixed at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants