KhronosGroup / OpenXR-Tutorials

OpenXR Tutorials
https://www.openxr-tutorial.com/
Apache License 2.0
72 stars 15 forks source link

Vulkan validation error when creating depth swapchain #129

Open gkarpa opened 6 months ago

gkarpa commented 6 months ago

Hi,

First of all congratulations and thank you for this tutorial. Tremendous work and has been very helpful and well organized.

I'm working through it using Vulkan on Windows, with the Mixed Reality Runtime from Microsoft. Reaching chapter 3.1 (Graphics - Creating Swapchains), one thing I noticed is that the Vulkan validation layer isn't being activated in the tutorial. It gets activated in the default constructor of GraphicsAPI_Vulkan::GraphicsAPI_Vulkan() , but not in the GraphicsAPI_Vulkan::GraphicsAPI_Vulkan(XrInstance m_xrInstance, XrSystemId systemId) constructor which is the one that actually gets called.

After activating the validation layer there, I get an error in the creation of the depth swapchain (the swapchain for the color is created without any problems). The error states:

UNASSIGNED-CoreValidation-DrawState-InvalidImageAspect(ERROR / SPEC): msgNum: -1863356067 - Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidImageAspect ] Object 0: handle = 0xe88693000000000c, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x90ef715d | vkCmdPipelineBarrier(): pImageMemoryBarriers[0].image Using format (VK_FORMAT_D32_SFLOAT) with aspect flags (VK_IMAGE_ASPECT_COLOR_BIT) but depth-only image formats must have the VK_IMAGE_ASPECT_DEPTH_BIT set.
    Objects: 1
        [0] 0xe88693000000000c, type: 10, name: NULL 

What would be the proper way to deal with it? Thanks a lot in advance.

johnkearney commented 4 months ago

@gkarpa : as I look at the OpenXR Inventory website: https://github.khronos.org/OpenXR-Inventory/extension_support.html#matrix, I see that Vulkan is not supported by the Mixed Reality Runtime from Microsoft; maybe you are testing this with a different runtime or you have some extra software that is offering OpenXR/Vulkan support?

gkarpa commented 4 months ago

@johnkearney Hmm yes, I'm using this layer https://github.com/mbucchia/OpenXR-Vk-D3D12 to translate Vulkan calls to DX12.

gkarpa commented 4 months ago

@johnkearney I tried running it with Meta XR Simulator and it works, so looks like a bug in that layer's code. Thanks for the catch!

rpavlik-bot commented 4 months ago

An issue (number 2267) has been filed to correspond to this issue in the internal Khronos GitLab (Khronos members only: KHR:openxr/openxr#2267 ), to facilitate working group processes.

This GitHub issue will continue to be the main site of discussion.