fix add_space locate_spaces check, load xrLocateSpacesKHR on OpenXR 1.0 if supported

This commit is contained in:
Sapphire
2025-07-03 09:26:02 +02:00
committed by xytovl
parent 1ad015ff65
commit 66878a259d
2 changed files with 10 additions and 9 deletions
+1
View File
@@ -1088,6 +1088,7 @@ void application::initialize()
// Optional extensions // Optional extensions
std::vector<std::string> opt_extensions; std::vector<std::string> opt_extensions;
opt_extensions.push_back(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME); opt_extensions.push_back(XR_FB_DISPLAY_REFRESH_RATE_EXTENSION_NAME);
opt_extensions.push_back(XR_KHR_LOCATE_SPACES_EXTENSION_NAME);
opt_extensions.push_back(XR_EXT_HAND_TRACKING_EXTENSION_NAME); opt_extensions.push_back(XR_EXT_HAND_TRACKING_EXTENSION_NAME);
opt_extensions.push_back(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME); opt_extensions.push_back(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
opt_extensions.push_back(XR_FB_PASSTHROUGH_EXTENSION_NAME); opt_extensions.push_back(XR_FB_PASSTHROUGH_EXTENSION_NAME);
+9 -9
View File
@@ -114,22 +114,22 @@ public:
locate_spaces_functor(xr::instance & instance, XrSpace reference) : locate_spaces_functor(xr::instance & instance, XrSpace reference) :
reference(reference) reference(reference)
{ {
if (instance.get_api_version() >= XR_MAKE_VERSION(1, 1, 0)) try
{ {
try if (instance.get_api_version() >= XR_MAKE_VERSION(1, 1, 0))
{
locate_spaces = instance.get_proc<PFN_xrLocateSpaces>("xrLocateSpaces"); locate_spaces = instance.get_proc<PFN_xrLocateSpaces>("xrLocateSpaces");
} else
catch (std::exception & e) locate_spaces = instance.get_proc<PFN_xrLocateSpacesKHR>("xrLocateSpacesKHR");
{ }
spdlog::warn("Failed to load xrLocateSpaces function, fallback to xrLocateSpace"); catch (std::exception & e)
} {
spdlog::warn("Failed to load xrLocateSpaces function, fallback to xrLocateSpace");
} }
} }
void add_space(wivrn::device_id device, XrSpace space, XrTime t, std::vector<from_headset::tracking::pose> & out) void add_space(wivrn::device_id device, XrSpace space, XrTime t, std::vector<from_headset::tracking::pose> & out)
{ {
if (not locate_spaces) if (locate_spaces)
{ {
// store, will be located later // store, will be located later
devices.push_back(device); devices.push_back(device);