KhronosGroup / OpenXR-SDK-Source

Sources for OpenXR loader, basic API layers, and example code.
https://khronos.org/openxr
Apache License 2.0
679 stars 249 forks source link

xrCreateInstance failed when trying to run a C++/OpenGL application using OpenXR SDK >= 1.1.36 with SteamVR #498

Closed S-Dafarra closed 1 month ago

S-Dafarra commented 2 months ago

I have a C++ application that tries to launch an OpenXR instance, but it fails with the error

xrNegotiateLoaderRuntimeInterface bRunningInAppContainer: 0
Error [GENERAL | xrCreateInstance | OpenXR-Loader] : LoaderInstance::CreateInstance chained CreateInstance call failed
Error [GENERAL | xrCreateInstance | OpenXR-Loader] : xrCreateInstance failed

The code that initializes the instance is https://github.com/ami-iit/yarp-device-openxrheadset/blob/ad4ec150174ce527a2af0e909196c25350374c9b/src/devices/openxrheadset/OpenXrInterface.cpp#L113-L194

With the SDK version 1.0.34 it works fine.

I am using SteamVR beta 2.8.4

I am not sure on which side the issue could be, but I also opened a discussion on Steam community: https://steamcommunity.com/app/250820/discussions/8/4757578099473958078/

ChristophHaag commented 2 months ago

I don't think SteamVR supports OpenXR 1.1 yet. Try .apiVersion = XR_API_VERSION_1_0, instead of .apiVersion = XR_CURRENT_API_VERSION,

S-Dafarra commented 2 months ago

Thanks a lot for the super fast response, that worked like a charm!

Would have been possible to display an error message hinting to use a different API version?

ChristophHaag commented 2 months ago

The return value of xrCreeateInstance was most likely XR_ERROR_API_VERSION_UNSUPPORTED = -4. Other than that it's up to the runtime to report errors or provide further messages with XR_EXT_debug_utils.

S-Dafarra commented 2 months ago

That's clear, thanks a lot!

S-Dafarra commented 2 months ago

Hi @ChristophHaag, is there a way to query the runtime about the supported API versions?

ChristophHaag commented 2 months ago

Not really. See also https://github.com/KhronosGroup/OpenXR-Docs/issues/167