Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
ce546cd
Read overlay apps' Vulkan and OpenGL textures back on Linux
claude Nov 20, 2026
07029e0
Answer GetRuntimeVersion as 2.15.6 and log the runtime's version
claude Nov 20, 2026
e647899
Share one play area between chaperone getters and drawn bounds
claude Nov 20, 2026
5aef04c
Take the headset's manufacturer from the system's vendor
claude Nov 20, 2026
72cd1af
Recentre on release, not when turning a controller off
claude Nov 20, 2026
1410daf
Find legacy-input controllers from the game's first frames
claude Nov 20, 2026
7cbb302
Index controller: grip force axis and SteamVR's supported buttons
claude Nov 20, 2026
59ec6fd
Compressed skeleton within the size the OpenVR header allows
claude Nov 20, 2026
8461dd1
Binding info for poses, skeletons and vibrations; origins with no set
claude Nov 20, 2026
90cdb00
End frames by the timing mode; serialise Submit; dump eye images
claude Nov 20, 2026
3afdf33
Make the OpenXR session again after a loss instead of quitting
claude Nov 20, 2026
dd1eb5c
Force-quit only known programs, and an old app ignoring a launch
claude Nov 20, 2026
8875d20
Send other programs' overlay changes to the program that owns them
claude Nov 20, 2026
ede4d49
Generate how real each interface is, and why custom ones exist
claude Nov 20, 2026
72139e5
Vulkan on runtimes with XR_KHR_vulkan_enable2 alone
claude Nov 20, 2026
eb0e958
Draw fades on own frames
claude Nov 20, 2026
f47a152
Write the store's frame edits on a writer thread
claude Nov 20, 2026
1057e5f
Make the OpenXR instance again when the runtime loses it
claude Nov 20, 2026
85fdfb9
Run own frames inside the game's calls on Vulkan and OpenGL
claude Nov 20, 2026
77907aa
Test the frame loop that runs only inside the game's calls
claude Nov 20, 2026
4132464
Allow killing another known program; format
claude Nov 20, 2026
f9f3d2c
Make a helper program's lost session again from its own loop
claude Nov 20, 2026
fdeb8ed
Vive trackers by role, and hands shown as controllers
claude Nov 20, 2026
a109965
Read openlamina.ini on Linux from bin/, the user's config and work dir
claude Nov 20, 2026
40c155d
Point Linux runtime choice at VR_OVERRIDE in logs and README
claude Nov 20, 2026
68b5dc8
install.sh: dated backups, VR server hints, OpenXR runtime import
claude Nov 20, 2026
a029b60
Shut down before the OpenXR loader's teardown when a game exits
claude Nov 20, 2026
a33354e
Refuse application binaries that are Windows programs on Linux
claude Nov 20, 2026
444ccef
Conformance case for each application type's answers
claude Nov 20, 2026
5631e40
CI build variants: library assertions and system libraries
claude Nov 20, 2026
7ddae24
Weekly check of Valve's SDK tags against the interface list
claude Nov 20, 2026
26fe8a7
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
ff1eff9
Test a helper program's instance loss on the stand-in runtime
claude Nov 20, 2026
3a56d0b
Baselines: GetRuntimeVersion answers 2.15.6
claude Nov 20, 2026
dbd88ad
Share overlay apps' Vulkan and OpenGL textures with the session's device
claude Nov 20, 2026
d228968
Name the read-only folder; keep the exit handler to Linux
claude Nov 20, 2026
6d7f159
Validate GetActionOrigins arguments before the set; tidy binding info
claude Nov 20, 2026
ab0f93c
test-install.sh: clean up after a failed read-only check
claude Nov 20, 2026
0eded44
Keep the stand-in baselines' GetActionOrigins answers
claude Nov 20, 2026
eeba8ab
Name the config file a line can't be read in
claude Nov 20, 2026
673515e
Recover a lost session without lock inversion or a frame-count guess
claude Nov 20, 2026
a85ca22
README: what Flatpak Steam needs besides the launch option
claude Nov 20, 2026
c1a6a5c
Hand data sources asked for, tracker spaces after attach, hands kept
claude Nov 20, 2026
fbafb01
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
418e554
Interop: array slices, renderbuffers, more formats, GPU-side waits
claude Nov 20, 2026
dc81682
Leave out Vulkan device extensions the game's GPU lacks
claude Nov 20, 2026
42c4d26
Draw six-face skyboxes into one lat-long image on the GPU (D3D11)
claude Nov 20, 2026
12009a5
Turn the D3D11 mirror texture round for flipped bounds
claude Nov 20, 2026
68fe2f7
Test a Vive tracker without a role alongside its xdev
claude Nov 20, 2026
27f3ba3
Keep frame edits until written; Vulkan own frames on the render thread
claude Nov 20, 2026
bdea1ca
Drop the repeated GetActionOrigins buffer check
claude Nov 20, 2026
fab9102
Look up paths again and keep readers safe across an instance remake
claude Nov 20, 2026
f1ab8d1
Overlays: copy GL and Vulkan textures through the interop's CopyIn
claude Nov 20, 2026
c2c7c3e
Check overlay texture sharing by driver too, and per context
claude Nov 20, 2026
d9fa6c0
Refuse commands for overlays that are gone and skip unchanged ones
claude Nov 20, 2026
8924064
Conformance cases for calls whose answers wait on SteamVR
claude Nov 20, 2026
72c227c
Test a vibration's binding info without a binding file
claude Nov 20, 2026
503b591
Trackers by role after the attach and when one goes; hands only ours
claude Nov 20, 2026
29cad74
Attach inputs to a game that never submits after two seconds
claude Nov 20, 2026
a0ab4ec
Own frames on the game's OpenGL context; retry stage bounds until app…
claude Nov 20, 2026
1102487
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
d5cdc07
Send every Hide of another program's overlay
claude Nov 20, 2026
41e11ef
Submit frames in the SteamVR-run cases, as a game does
claude Nov 20, 2026
56b954e
Ask the graphics requirements again for every recovered system
claude Nov 20, 2026
0ab7535
Compare overlay values as they're published before sending
claude Nov 20, 2026
97eb1be
Quieter profile and force-quit logs; frame state read safely
claude Nov 20, 2026
c93ab1d
Share overlay textures only on a Vulkan 1.1 session instance
claude Nov 20, 2026
7632694
Say why flags past the mask aren't sent
claude Nov 20, 2026
1956cfd
Never wait for the session lock in a helper loop or bind to a lost se…
claude Nov 20, 2026
5805fda
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
a774a7a
Tracker spaces forgotten before the attach; xdev list failures kept
claude Nov 20, 2026
c013986
Bound the store's write lock; stage bounds asked after the change
claude Nov 20, 2026
2ca10af
Refuse to read back a shared Vulkan overlay texture
claude Nov 20, 2026
22f8ab6
Keep the game's device for a first Submit that comes during a loss
claude Nov 20, 2026
d98a225
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
df1cff8
Bring the controllers up for overlay and background apps
claude Nov 20, 2026
1b69fbb
Change an overlay only once its texture is sure to be shared
claude Nov 20, 2026
32d9fe6
Tracker origins name their device; no hand data sources asked for
claude Nov 20, 2026
19227f9
Windows: leave a session still up at process exit undestroyed
claude Nov 20, 2026
cdef64c
Bind the game's actions to the session made after a loss
claude Nov 20, 2026
07e9c96
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
26e7d96
Defer the game's input calls while a lost instance is made again
claude Nov 20, 2026
d4e26bc
XR_EXT_hand_interaction not enabled with handController off
claude Nov 20, 2026
f166a9f
Run empty frames for a background app's session until it runs one
claude Nov 20, 2026
faa5117
Add the WebXR Input Profiles controller models
claude Nov 20, 2026
5730898
Convert the controller models to SteamVR's render-model layout
claude Nov 20, 2026
b9c45b1
Answer render models from the own controller models
claude Nov 20, 2026
e26fe4e
Ship the controller models and their licence
claude Nov 20, 2026
4bf4a1b
Check the backend's type and keep the info set off once legacy is asked
claude Nov 20, 2026
cc8793b
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
3856941
Windows baselines with the new conformance cases
claude Nov 20, 2026
b37b571
Attach inputs only on the game's device or after two seconds
claude Nov 20, 2026
8e6bdb5
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
2889df9
Ask for the interaction profile only under the session lock
claude Nov 20, 2026
5f63feb
Merge branch 'session-lifecycle' into session-instance-loss
claude Nov 20, 2026
38304ac
Interop: read the copy's only slice, not SubmitWithArrayIndex's again
claude Nov 20, 2026
c2898ff
Vulkan interop: copies take turns in a ring of command buffers and fe…
claude Nov 20, 2026
51289ff
Stand-in runtime: a grid of samples on lat-long layers
claude Nov 20, 2026
934d63a
Conformance: interop arrays, renderbuffers, multisampled textures, fo…
claude Nov 20, 2026
94817de
Interop: GL names of another kind, resolves that would change the for…
claude Nov 20, 2026
6b85ef0
Six-face skybox pass for D3D11 textures only; the mirror's texture fo…
claude Nov 20, 2026
0ead284
Conformance: a texture bound in the GL interop cases, frames cleared …
claude Nov 20, 2026
b89f7f5
Merge remote-tracking branch 'origin/controller-models' into merge-all
claude Nov 20, 2026
277401b
Merge remote-tracking branch 'origin/overlay-textures-linux' into mer…
claude Nov 20, 2026
85d8c20
Merge remote-tracking branch 'origin/overlay-commands' into merge-all
claude Nov 20, 2026
50a825d
Merge remote-tracking branch 'origin/input-small-fixes' into merge-all
claude Nov 20, 2026
61a0258
Merge remote-tracking branch 'origin/runtime-small-items' into merge-all
claude Nov 20, 2026
6dce355
Merge remote-tracking branch 'origin/trackers-and-hands' into merge-all
claude Nov 20, 2026
e5dcea1
Merge remote-tracking branch 'origin/linux-tooling-packaging' into me…
claude Nov 20, 2026
79a5687
Merge remote-tracking branch 'origin/session-lifecycle' into merge-all
claude Nov 20, 2026
334cc68
Merge remote-tracking branch 'origin/session-instance-loss' into merg…
claude Nov 20, 2026
290838c
Vulkan interop: a copy per array layer; the semaphore capabilities in…
claude Nov 21, 2026
cef6b6d
Conformance: the painted frames' expectation, comment wording
claude Nov 21, 2026
2616dcb
Vulkan: resolve before blits, other queues, growing swapchains
claude Nov 20, 2026
21a8455
Interop: single-sampled GL renderbuffers turned round like textures; …
claude Nov 21, 2026
8ff2d18
Conformance: the semaphore capabilities extension in the baseline; co…
claude Nov 21, 2026
7df4812
Make the session again when eye textures move to another device
claude Nov 20, 2026
cb84a06
Stand-in runtime: a scriptable maximum swapchain sample count
claude Nov 20, 2026
09dcb52
Conformance: Vulkan multisampled and second-queue textures, dynamic r…
claude Nov 20, 2026
94bbcc5
Interop: a renderbuffer of one sample isn't a resolve; an array's GL …
claude Nov 21, 2026
32b0a30
Merge remote-tracking branch 'origin/compositor-resolve-devices' into…
claude Nov 21, 2026
9bae562
Merge remote-tracking branch 'origin/interop-mirror-textures' into me…
claude Nov 21, 2026
d322db7
Record SteamVR with the real controllers too, and recount how real ea…
claude Nov 20, 2026
5b31d1a
Baselines for the controller models' render model names
claude Nov 21, 2026
d9929f5
SteamVR recordings: restart a hung SteamVR, resume a stopped run, ski…
claude Nov 21, 2026
9f3e65b
SteamVR recordings: restart SteamVR at once when a program hangs in I…
claude Nov 21, 2026
b812144
Conformance README: when SteamVR is restarted
claude Nov 21, 2026
5009df0
Conformance: a background app's IsInputAvailable is timing
claude Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 91 additions & 5 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions .github/workflows/openvr-inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Once a week: the OpenVR interface versions in every tag of Valve's SDK (github.com/ValveSoftware/openvr) against
# tests/conformance/interfaces.txt. Fails on anything new (a version not listed, or a newer tag still shipping one); the
# log says what, and how to update the list (scripts/openvr_inventory.py --write).
name: OpenVR inventory

on:
schedule:
- cron: '17 4 * * 1'
workflow_dispatch:

permissions:
contents: read

jobs:
inventory:
name: Valve's SDK tags
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v7

# Blobless: the headers each tag needs are fetched as they're read
- name: Valve's SDK
run: git clone -q --filter=blob:none --no-checkout https://github.com/ValveSoftware/openvr.git "$RUNNER_TEMP/openvr"

- name: Compare
run: python3 scripts/openvr_inventory.py --valve-repo "$RUNNER_TEMP/openvr" --compare tests/conformance/interfaces.txt
7,988 changes: 7,988 additions & 0 deletions BundledLibs/stb_image.h

Large diffs are not rendered by default.

26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ add_library(DrvOpenXR STATIC
DrvOpenXR/GfxInterop.h
DrvOpenXR/OverlayTextureCopy.cpp
DrvOpenXR/OverlayTextureCopy.h
DrvOpenXR/OverlayTextureShare.cpp
DrvOpenXR/OverlayTextureShare.h

DrvOpenXR/tmp_gfx/TemporaryGraphics.cpp
DrvOpenXR/tmp_gfx/TemporaryGraphics.h
Expand Down Expand Up @@ -298,6 +300,7 @@ endif ()
set(OVR_PCH_EXCLUDED
OpenOVR/Misc/ini.c
OpenOVR/Misc/lodepng.cpp
OpenOVR/Misc/stb_image.cpp
)

# Generate version string from git revision, or supplied OC_VERSION setting
Expand Down Expand Up @@ -410,6 +413,8 @@ add_library(OCCore STATIC
OpenOVR/Misc/Input/ViveFocus3InteractionProfile.cpp
OpenOVR/Misc/Input/PicoInteractionProfile.cpp
OpenOVR/Misc/Input/MsftHandInteractionProfile.cpp
OpenOVR/Misc/Input/ExtHandInteractionProfile.cpp
OpenOVR/Misc/Input/ViveTrackerRoles.cpp
OpenOVR/Reimpl/BaseApplications.cpp
OpenOVR/Reimpl/BaseChaperone.cpp
OpenOVR/Reimpl/BaseChaperoneSetup.cpp
Expand Down Expand Up @@ -486,7 +491,10 @@ add_library(OCCore STATIC
OpenOVR/Misc/Input/ViveFocus3InteractionProfile.h
OpenOVR/Misc/Input/PicoInteractionProfile.h
OpenOVR/Misc/Input/MsftHandInteractionProfile.h
OpenOVR/Misc/Input/ExtHandInteractionProfile.h
OpenOVR/Misc/Input/ViveTrackerRoles.h
OpenOVR/Misc/lodepng.h
OpenOVR/Misc/StbJpeg.h
OpenOVR/Misc/ScopeGuard.h
OpenOVR/Reimpl/BaseApplications.h
OpenOVR/Reimpl/BaseChaperone.h
Expand Down Expand Up @@ -543,7 +551,7 @@ target_include_directories(OCCore PUBLIC OpenOVR ${CMAKE_BINARY_DIR}) # TODO ma
target_include_directories(OCCore PRIVATE BundledLibs OpenVRHeaders)
target_compile_definitions(OCCore PRIVATE ${GRAPHICS_API_SUPPORT_FLAGS})

target_link_libraries(OCCore PRIVATE OpenVR Vulkan ${XrLib} ${glmLib})
target_link_libraries(OCCore PRIVATE OpenVR Vulkan ${XrLib} ${jsoncppLib} ${glmLib})

if (NOT WIN32 AND NOT ANDROID)
find_package(OpenGL REQUIRED) # for glGetError()
Expand Down Expand Up @@ -781,6 +789,21 @@ get_target_property(output_dir OCOVR LIBRARY_OUTPUT_DIRECTORY)
add_custom_command(TARGET OCOVR
PRE_LINK COMMAND ${CMAKE_COMMAND} -E make_directory ${output_dir})

# The controller models (assets/controllers, the WebXR Input Profiles') in SteamVR's render-model layout, beside the
# libraries: bin/rendermodels serves bin/ and bin/linux64/. The conversion checks each model's motion as it goes.
file(GLOB_RECURSE OC_CONTROLLER_ASSETS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/assets/controllers/*)
set(OC_RENDERMODELS_DIR ${CMAKE_BINARY_DIR}/bin/rendermodels)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/rendermodels.stamp
COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/rendermodels.py --quiet
--assets ${CMAKE_SOURCE_DIR}/assets/controllers --out ${OC_RENDERMODELS_DIR}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/rendermodels.stamp
DEPENDS ${CMAKE_SOURCE_DIR}/scripts/rendermodels.py ${OC_CONTROLLER_ASSETS}
COMMENT "Converting the controller models"
)
add_custom_target(OCRenderModels ALL DEPENDS ${CMAKE_BINARY_DIR}/rendermodels.stamp)
add_dependencies(OCOVR OCRenderModels)

# Installation
include(GNUInstallDirs)
install(TARGETS OCOVR
Expand All @@ -792,6 +815,7 @@ install(FILES ${CMAKE_BINARY_DIR}/openvrpaths.vrpath DESTINATION ${PROJECT_NAME}
install(FILES ${CMAKE_BINARY_DIR}/bin/version.txt
DESTINATION "${PROJECT_NAME}/bin"
)
install(DIRECTORY ${OC_RENDERMODELS_DIR} DESTINATION "${PROJECT_NAME}/bin")

# === Tests ===
if (OC_BUILD_TESTS)
Expand Down
34 changes: 31 additions & 3 deletions DrvOpenXR/DeviceIdentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "../OpenOVR/Misc/Input/Bindings/LegacyBindings.h"

#include <array>
#include <cctype>
#include <map>
#include <mutex>

Expand Down Expand Up @@ -55,7 +56,32 @@ uint64_t ButtonsForComponent(const std::string& component)

} // namespace

DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& device)
std::string HmdManufacturer(uint32_t vendorId, const std::string& runtimeName)
{
// The USB vendor IDs runtimes give, as SteamVR's drivers name those makers
switch (vendorId) {
case 0x2833:
return "Oculus";
case 0x28de:
return "Valve";
case 0x0bb4:
return "HTC";
case 0x045e:
return "WindowsMR";
default:
break;
}
// Else the runtime's name, as far as its first word ("Monado" of "Monado(XRT) by Collabora et al ...")
std::string name;
for (char c : runtimeName) {
if (isspace((unsigned char)c) || c == '(' || c == ':' || c == '/')
break;
name += c;
}
return name;
}

DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& device, uint32_t vendorId, const std::string& runtimeName)
{
auto it = HmdRows().find(xrSystemName);
if (it != HmdRows().end())
Expand All @@ -64,8 +90,10 @@ DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice&
DeviceIdentity id = DefaultHmd();
if (xrSystemName.empty())
return id;
// The runtime's own words: the system name is all OpenXR says of who made it
id.manufacturer = xrSystemName;
// Who made it from the system's vendor ID (the system name is its model), else the runtime's name
std::string maker = HmdManufacturer(vendorId, runtimeName);
if (!maker.empty())
id.manufacturer = maker;
id.modelNumber = device.name.empty() ? xrSystemName : device.name;
id.serial = device.serial.empty() ? xrSystemName + "-head" : device.serial;
return id;
Expand Down
15 changes: 10 additions & 5 deletions DrvOpenXR/DeviceIdentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ struct RuntimeDevice {
std::string name, serial;
};

/** The HMD of the OpenXR system of that name: its row if the table has one, else what the runtime says (the system
* name as the manufacturer and model number, the device's name and serial where libmonado gives them) on the generic
* answers that games branch on (tracking system, controller type, render model). With no system name (no runtime
* yet) the generic answers alone. */
DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& device = {});
/** The HMD's manufacturer for an OpenXR system's vendor ID (XrSystemProperties::vendorId): the maker's name as
* SteamVR gives it for the vendors known, else the first word of the runtime's name; empty without either */
std::string HmdManufacturer(uint32_t vendorId, const std::string& runtimeName);

/** The HMD of the OpenXR system of that name: its row if the table has one, else what the runtime says (the
* manufacturer from the system's vendor ID, else the runtime's name; the system name as the model number, the
* device's name and serial where libmonado gives them) on the generic answers that games branch on (tracking system,
* controller type, render model). With no system name (no runtime yet) the generic answers alone. */
DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& device = {}, uint32_t vendorId = 0,
const std::string& runtimeName = std::string());

/** A controller of that profile in that hand: the profile's OpenVR name and render models, its buttons. The serial is
* the runtime's where libmonado gives one, else one that is the hand's own. */
Expand Down
72 changes: 71 additions & 1 deletion DrvOpenXR/DrvOpenXR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ struct InstancePlan {
XrGraphicsApiSupportedFlags apiFlags = 0;
};

// The running instance's plan, set once at start-up: an instance made again after a loss has the same
static InstancePlan currentPlan;
// A new instance after a loss whose headset isn't there yet (RemakeInstance keeps it); until FullShutdown
static bool madeAgain = false;

// The extensions OpenLamina enables, of those available, for a session of that kind
InstancePlan PlanInstance(const std::set<std::string>& available, SessionKind kind)
{
Expand All @@ -207,9 +212,13 @@ InstancePlan PlanInstance(const std::set<std::string>& available, SessionKind ki
}
#endif
#if defined(SUPPORT_VK)
// XR_KHR_vulkan_enable where it's there (its extension lists are what a game's own device needs), else enable2
if (available.count(XR_KHR_VULKAN_ENABLE_EXTENSION_NAME)) {
plan.extensions.push_back(XR_KHR_VULKAN_ENABLE_EXTENSION_NAME);
plan.apiFlags |= XR_SUPPORTED_GRAPHICS_API_VK;
} else if (available.count(XR_KHR_VULKAN_ENABLE2_EXTENSION_NAME)) {
plan.extensions.push_back(XR_KHR_VULKAN_ENABLE2_EXTENSION_NAME);
plan.apiFlags |= XR_SUPPORTED_GRAPHICS_API_VK;
}
#endif
#if defined(SUPPORT_GL)
Expand Down Expand Up @@ -238,6 +247,10 @@ InstancePlan PlanInstance(const std::set<std::string>& available, SessionKind ki
if (available.count(XR_EXT_HAND_TRACKING_EXTENSION_NAME))
plan.extensions.push_back(XR_EXT_HAND_TRACKING_EXTENSION_NAME);

// Vive trackers by their role (/user/vive_tracker_htcx/role/waist), poses only
if (available.contains(OC_XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME))
plan.extensions.push_back(OC_XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);

if (available.count(XR_MNDX_XDEV_SPACE_EXTENSION_NAME))
plan.extensions.push_back(XR_MNDX_XDEV_SPACE_EXTENSION_NAME);

Expand All @@ -259,6 +272,9 @@ InstancePlan PlanInstance(const std::set<std::string>& available, SessionKind ki
OC_XR_FB_TOUCH_CONTROLLER_PROXIMITY_EXTENSION_NAME, XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME, XR_MSFT_HAND_INTERACTION_EXTENSION_NAME })
if (available.contains(profileExtension))
plan.extensions.push_back(profileExtension);
// XR_EXT_hand_interaction's hands are shown as a controller unless handController is off
if (oovr_global_configuration.HandController() != "off" && available.contains(OC_XR_EXT_HAND_INTERACTION_EXTENSION_NAME))
plan.extensions.push_back(OC_XR_EXT_HAND_INTERACTION_EXTENSION_NAME);

if (available.contains(XR_KHR_COMPOSITION_LAYER_CYLINDER_EXTENSION_NAME))
plan.extensions.push_back(XR_KHR_COMPOSITION_LAYER_CYLINDER_EXTENSION_NAME);
Expand Down Expand Up @@ -351,8 +367,14 @@ XrResult MakeInstance(const InstancePlan& plan, XrInstance* instance, XrVersion*
#endif

XrResult res = DrvOpenXR::CreateInstanceNewestVersion(createInfo, instance, version, xrCreateInstance);
if (XR_SUCCEEDED(res))
if (XR_SUCCEEDED(res)) {
OOVR_LOGF("Created the OpenXR instance for OpenXR %d.%d", (int)XR_VERSION_MAJOR(*version), (int)XR_VERSION_MINOR(*version));
XrInstanceProperties properties = { XR_TYPE_INSTANCE_PROPERTIES };
if (XR_SUCCEEDED(xrGetInstanceProperties(*instance, &properties))) {
OOVR_LOGF("OpenXR runtime: %s %d.%d.%d", properties.runtimeName, (int)XR_VERSION_MAJOR(properties.runtimeVersion),
(int)XR_VERSION_MINOR(properties.runtimeVersion), (int)XR_VERSION_PATCH(properties.runtimeVersion));
}
}
return res;
}

Expand Down Expand Up @@ -521,6 +543,7 @@ IBackend* DrvOpenXR::CreateOpenXRBackend(const char* startupInfo, vr::EVRInitErr
// Create the OpenXR instance - this is the overall handle that connects us to the runtime, or take the one
// VR_IsHmdPresent made for a scene application
const InstancePlan plan = PlanInstance(availableExtensions, choice.kind);
currentPlan = plan;
const std::vector<const char*>& extensions = plan.extensions;
const XrGraphicsApiSupportedFlags apiFlags = plan.apiFlags;
xr_instance = TakeProbedInstance(plan, &xr_instance_version);
Expand Down Expand Up @@ -642,6 +665,8 @@ XrResult DrvOpenXR::SetupSession()
OOVR_LOGF("Started OpenXR session on runtime '%s', hand tracking supported: %d",
xr_gbl->systemProperties.systemName, xr_gbl->handTrackingProperties.supportsHandTracking);

currentBackend->ForgetTrackerSpaces();

// If required, re-setup the input system for this new session
BaseInput* input = GetUnsafeBaseInput();
if (input)
Expand All @@ -651,6 +676,50 @@ XrResult DrvOpenXR::SetupSession()
return XR_SUCCESS;
}

XrResult DrvOpenXR::FindSystem()
{
return CreateSystemID();
}

XrResult DrvOpenXR::RemakeInstance()
{
#ifdef _DEBUG
// It went with the old instance
dbgMessenger = NULL;
#endif
// A new instance made at an earlier try is kept while the headset isn't there yet
if (!madeAgain) {
if (xr_instance) {
if (XR_FAILED(xrDestroyInstance(xr_instance)))
OOVR_LOG("xrDestroyInstance of the lost instance failed");
xr_instance = XR_NULL_HANDLE;
}
if (XrResult res = MakeInstance(currentPlan, &xr_instance, &xr_instance_version); XR_FAILED(res)) {
OOVR_LOGF("The OpenXR instance can't be made again yet: %d", (int)res);
xr_instance = XR_NULL_HANDLE;
return res;
}
// The old function table isn't freed: a thread outside the session lock may still be reading it
xr_ext = new XrExt(currentPlan.apiFlags, currentPlan.extensions);
madeAgain = true;
}
if (XrResult res = CreateSystemID(); XR_FAILED(res))
return res;
uint32_t viewCount = 0;
if (XrResult res = xrEnumerateViewConfigurationViews(xr_instance, xr_system, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, 0, &viewCount, nullptr); XR_FAILED(res))
return res;
std::vector<XrViewConfigurationView> views(viewCount, { XR_TYPE_VIEW_CONFIGURATION_VIEW });
if (XrResult res = xrEnumerateViewConfigurationViews(xr_instance, xr_system, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, viewCount, &viewCount, views.data()); XR_FAILED(res))
return res;
// The game sized its textures for two views: a headset with another count isn't one to go on with
if (viewCount != XruEyeCount)
return XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED;
xr_views_list = views;
madeAgain = false; // the next loss makes another
OOVR_LOG("Made the OpenXR instance again");
return XR_SUCCESS;
}

void DrvOpenXR::KeepOverlaysInstance()
{
if (currentBackend)
Expand Down Expand Up @@ -721,6 +790,7 @@ void DrvOpenXR::FullShutdown()
}

initialised = false;
madeAgain = false;
currentBackend = nullptr;
SetCurrentSessionKind(SessionKind::Scene);
}
Loading
Loading