25 Commits
Author SHA1 Message Date
Jeremy Bowers 834cdddd2e OpenXR: add Steam Frame controller input 2026-10-03 22:21:35 -04:00
Jeremy Bowers bec9d1beae OpenXR: keep controller input in Flat Vulkan mode 2026-10-03 21:00:54 -04:00
Jeremy Bowers aa2871d9e6 VK/OpenXR: support headless Vulkan VR session
- Skip Vulkan surface creation when VR session is active; output goes to
  OpenXR swapchains, not a desktop window. This avoids WSI crashes under
  compositors such as Gamescope.
- Guard VKGfx backbuffer/present/fullscreen paths against a null swapchain
  in headless mode.
- Allow Present() and Presenter::Initialize() to run on any VR-active
  backend, not only Android GLES, so the XR frame lifecycle works with
  headless Vulkan.

Cleaned up diagnostic init logging added during earlier debugging.
2026-10-03 01:22:39 -04:00
iChris4andClaude Opus 5 05d91da8bf Fixed Vulkan VR crash when opening a second game in one process
Opening a game, closing it, and opening another crashed or device-lost on
the Vulkan backend with VR enabled. D3D11 and D3D12 both restart cleanly,
so this was Vulkan-specific rather than an OpenXR runtime limitation.

Root cause, proven with VK_EXT_device_fault plus
VK_EXT_device_address_binding_report: the fault is a write-invalid at a
page-aligned address that the binding tracer reports as not owned by the
second game device. The OpenXR compositor still references resources that
lived on the first game VkDevice; destroying that device frees the memory
and the compositor later writes into the freed page. The D3D backends are
immune because their shared compositor resources are COM ref-counted,
while vkDestroyDevice frees unconditionally.

Fix: persist and reuse the VulkanContext (VkInstance and VkDevice) across
VR games, so vkCreateDevice/vkDestroyDevice run once per process and those
pages are never unmapped. Per-game objects are still fully recreated,
including the surface, swapchain, object cache, command buffers, and the
OpenXR session and XrInstance. A device-lost context is never persisted. A
non-VR launch, or a runtime requiring a device extension the persisted
device lacks, discards it and initializes fresh.

Two problems that persisting exposed:

- InitBackendInfo() creates and destroys a temporary VkInstance on every
  game boot and then calls UnloadVulkanLibrary(), which nulls every global
  Vulkan function pointer. Reuse now re-resolves the instance and device
  dispatch for the persisted handles.

- That same UnloadVulkanLibrary() unmaps vulkan-1.dll on runtimes that do
  not otherwise pin it, invalidating the persisted handles. This is why
  VDXR still failed after SteamVR worked. Added KeepVulkanLibraryLoaded()
  so unloading is suppressed while a device is persisted.

Also removes the XR_KHR_vulkan_enable2 path. Creating a second device
against a retained XrInstance crashes inside the runtime in a way SEH
cannot catch. The backend now always uses legacy XR_KHR_vulkan_enable,
where Dolphin owns instance and device creation and the runtime binds at
xrCreateSession.

Supporting changes: ordered OpenXR session teardown (ShutdownSession and
DestroySession), a device-lost guard in CommandBufferManager that stops
emulation instead of resubmitting to a dead device, synchronous release of
Dolphin views and framebuffers before xrDestroySwapchain, and the two GPU
fault diagnostics. Note that vkGetDeviceFaultInfoEXT must be called with
vendorBinarySize zeroed on the second call, or the driver writes the
vendor blob to a null pointer.

Verified on SteamVR/PSVR2, VDXR/Quest 3, and Meta Link over repeated
open/close cycles.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 15:43:14 +02:00
iChris4 d9565464a9 Added 2D "cinema" mode 2026-07-07 05:37:17 +02:00
iChris4 06592e5f52 Improve Vulkan OpenXR performance and compatibility 2026-06-13 22:26:39 +02:00
iChris4andClaude Sonnet 4.6 d1511f187b Vulkan OpenXR: async frame finalization on Quest submit thread
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 01:17:29 +02:00
iChris4 a2dad38be5 Add OpenXR support and related VR changes 2026-04-07 00:18:01 +02:00
Martino Fontana b80e178403 Vulkan: Fix present semaphores reuse
Fixes validation errors.
See https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html
2025-07-21 16:02:53 +02:00
Jordan Woyak c18c039089 VideoCommon: Move backend_info out of VideoConfig struct. 2025-03-09 01:42:45 -06:00
OatmealDome 2633b84b98 Vulkan: Only attempt to create a CAMetalLayer on macOS 2025-01-08 13:51:53 -05:00
TellowKrinkle 1416dc7e6a VideoBackends:Vulkan: Consolidate feature checking into one struct 2024-09-05 22:15:29 -05:00
Pokechu22 c63f0f37cd VideoCommon: Pass WindowSystemInfo to InitBackendInfo 2023-06-08 22:07:39 -07:00
Scott Mansell 31cfe8250d Lint fixes 2023-02-09 18:36:20 +13:00
Scott Mansell 3ae78b8e76 Also use events for config changed 2023-01-31 19:41:24 +13:00
Scott Mansell 8bc8e43dd6 Add virtual Initialize() to PerfQueryBase
Both DX12 and Vulkan already had one.
2023-01-31 19:41:24 +13:00
Scott Mansell 2a2014af09 Implement AbstractGfx for Vulkan 2023-01-31 19:41:23 +13:00
Scott Mansell 606c18210d TextureCache: Refactor with smart pointers
The whole ownership model was getting a bit of a mess, with a some
of special cases to deal with. And I'm planning to make it even more
complex in the future.
So here is some upfront work to convert it over to reference counted
pointers.
2023-01-31 18:29:47 +13:00
Robin Kertels 19a4653203 VideoBackends:Vulkan: Replace debug_report with debug_utils
The former is deprecated and pretty much all modern drivers
support VK_EXT_debug_utils.
Android drivers dont support it. On those drivers,
we use the implementation provided by the validation layers.
2022-12-27 02:48:50 +01:00
Robin Kertelsandiwubcode 3ffbf94b2a VideoBackends:Vulkan: Set up VMA
Co-authored-by: iwubcode <iwubcode@users.noreply.github.com>
2022-10-23 02:54:35 +02:00
OatmealDome 803a0de5a4 VKMain: Remove check for macOS 10.14 2022-06-01 22:57:56 -04:00
Pokechu22 2025763420 Treewide: Adjust order of includes 2021-12-10 14:49:57 -08:00
Pokechu22 04d8cdfe88 Convert LOG_TYPE and LOG_LEVELS to enum class 2021-10-24 11:48:36 -07:00
Pierre Bourdon e149ad4f0a treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Shawn Hoffman d7fd892fde normalize common filenames in VideoBackends/Vulkan 2021-01-27 14:29:48 -08:00