Page MenuHome

XR: Re-enable SteamVR OpenGL backend for non-NVIDIA gpus
ClosedPublic

Authored by Peter Kim (muxed-reality) on Sep 6 2021, 9:10 AM.

Details

Summary

Addresses T76082.

Since the DirectX backend does not work for AMD gpus
(wglDXRegisterObjectNV() fails to register the shared OpenGL-DirectX
render buffer, displaying a pink screen to the user), the original
solution was to use SteamVR's OpenGL backend, which, as tested
recently, seems to work without any issues on AMD hardware.

However, the SteamVR OpenGL backend (on Windows) was disabled in
fe492d922d6d since it resulted in crashes with NVIDIA gpus (and still
crashes, as tested recently), so currently SteamVR will always use
the AMD-incompatible DirectX backend (on Windows).

This patch restores use of the SteamVR OpenGL backend for non-NVIDIA
(AMD, etc.) gpus while maintaining the DirectX workaround for NVIDIA
gpus. In this way, issues are still resolved on the NVIDIA side but
AMD users can once again use the SteamVR runtime, which may be their
only viable option of using Blender in VR.

Diff Detail

Repository
rB Blender
Branch
xr-amd-fix (branched from master)
Build Status
Buildable 16829
Build 16829: arc lint + arc unit

Event Timeline

Peter Kim (muxed-reality) requested review of this revision.Sep 6 2021, 9:10 AM
Peter Kim (muxed-reality) created this revision.

Output from --debug-xr, showing the SteamVR OpenGL backend working on AMD Radeon RX Vega 64.

Vendor: ATI Technologies Inc.
Renderer: Radeon RX Vega
Version: 4.5.14739 Core Profile Context 21.6.1 27.20.22001.14011
Warning! Dummy Version: 4.6.14739 Compatibility Profile Context 21.6.1 27.20.22001.14011
Context Version: 4.5
Available OpenXR API-layers/extensions:
Extension: XR_KHR_vulkan_enable
Extension: XR_KHR_vulkan_enable2
Extension: XR_KHR_D3D11_enable
Extension: XR_KHR_D3D12_enable
Extension: XR_KHR_opengl_enable
Extension: XR_KHR_win32_convert_performance_counter_time
Extension: XR_EXT_win32_appcontainer_compatible
Extension: XR_KHR_binding_modification
Extension: XR_VALVE_analog_threshold
Extension: XR_EXT_hand_tracking
Extension: XR_EXT_hand_joints_motion_range
Extension: XR_EXT_hp_mixed_reality_controller
Extension: XR_HTC_vive_cosmos_controller_interaction
Extension: XR_KHR_visibility_mask
Extension: XR_UNITY_hand_model_pose
Extension: XR_KHR_composition_layer_depth
Extension: XR_EXT_debug_utils
Enabling OpenXR Extension: XR_KHR_opengl_enable
Enabling OpenXR Extension: XR_KHR_D3D11_enable
Enabling OpenXR Extension: XR_EXT_debug_utils
Enabling OpenXR Extension: XR_EXT_hp_mixed_reality_controller
Enabling OpenXR Extension: XR_HTC_vive_cosmos_controller_interaction
Connected to OpenXR runtime: SteamVR/OpenXR (Version 0.1.0)

Note:
I didn't add an enum for the gpu identifier (which would be equivalent to eGPUDeviceType) since I felt it was overkill at this point.
However, instead of adding the identifier to the context_flag in GHOST_XrContextCreateInfo, maybe it would be better to add a boolean.

Such a shame that the OpenGL backend still doesn't work well enough for SteamVR. But happy to see that we can support both AMD & NVIDIA users again here, even if with such annoying workarounds.

This revision is now accepted and ready to land.Sep 9 2021, 2:46 PM