KhronosGroup / OpenXR-Tutorials

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

Vulkan build on Linux doesn't work with Monado runtime #91

Closed wsherman64 closed 9 months ago

wsherman64 commented 9 months ago

So this may or may not be an issue with the tutorial, I'm not versed enough to know. But I do know that I can run hello_xr with both OpenGL and the Vulkan option and monado-service handles both of them just fine.

So my issue is that when I build the tutorial programs (using the cloned git version), then when I run for example OpenXRTutorialChapter3, I get these error messages after the connection is made with the runtime:

OpenXR Runtime: Monado(XRT) by Collabora et al 'v21.0.0-3880-g026dea5c' - 21.0.0
ERROR: VULKAN: 0xfffffff3
ERROR: VULKAN: Failed to create Graphics Pipeline.
Segmentation fault (core dumped)

When I build with OpenGL I don't get those messages, and it runs fine.

It's certainly possible I'm doing something wrong, but figured it was worth asking.

Thoughts (@rpavlik )?

Bill

rvkennedy commented 9 months ago

Well this is interesting. @wsherman64 you're seeing this error because you have glslangValidator, but not glslc. Something is different in how the two tools compile our vertex shader, and the former seems to compile something the driver doesn't like in this case. Adding @AndrewRichards-Code to take a look.

wsherman64 commented 9 months ago

Hmmm, that's interesting. I was reading a bit about glslangValidator earlier, and one of the things I read said that as the "reference" compiler, all other compilers need to result in the exact same output (perhaps apart from extensions). So sounds like glslc isn't living up to that.

AndrewRichards-Code commented 9 months ago

Hi @rvkennedy and @wsherman64

Here's some info on that error code: 0xfffffff3 as int32_t is -13 and this corresponds to VK_ERROR_UNKNOWN = -13 The Vulkan Spec states that: "VK_ERROR_UNKNOWN An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.". It goes on further to say: "VK_ERROR_UNKNOWN is not expected to ever be returned if the application behavior is valid, and if the implementation is bug-free. If VK_ERROR_UNKNOWN is received, the application should be checked against the latest validation layers to verify correct behavior as much as possible. If no issues are identified it could be an implementation issue, and the implementor should be contacted for support." https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkResult.html

So, in short, the input to vkCreateGraphicsPipelines() is either invalid or the Vulkan implementation doesn't understand it and throws this error. Running the VK_LAYER_KHRONOS_validation layer (https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/main/docs/khronos_validation_layer.md) should tell us whether it's an application or implementation side issue.

It seems likely then it's an issue in the differing SPIR-V binaries from glslangValidator and glslc.

rvkennedy commented 9 months ago

Commit 8d48569 to fix this, by removing the parameter "-x" from the calls to glslangValidator.

wsherman64 commented 9 months ago

Okay, I did a test with the current git clone version with VULKAN selected as the XR_TUTORIAL_GRAPHICS_API, and ran that with monado-service, and it worked!

Thanks!