Run the same-device Vulkan OpenXR backend on desktop Linux

Lepton's Vulkan driver has no external memory or sync fd extensions,
so the Steam Frame gets a native SteamOS build instead. Its backend is
the PC's: OpenXR creates Dawn's own Vulkan instance and device, and the
eyes are copied into the swapchain on Dawn's queue, with nothing shared
between devices.

- openxr_vulkan_win32 and Aurora's vulkan_win32_interop now compile on
  desktop Linux. Dawn links statically there, so the bridge calls the
  patched package's hooks directly, and exists only when the package's
  aurora-dawn.json declares the Vulkan hook ABI (AuroraDawnProvider
  turns AuroraVulkanAbi into AURORA_DAWN_VULKAN_HOOKS); a stock Dawn
  keeps the stubs and VR falls back to the desktop.
- openxr_integration.cpp gains a Linux branch: XR_KHR_vulkan_enable2,
  the timespec clock, refresh rate, performance level, the Frame
  controllers and eye gaze; fragment density maps are requested on
  Linux as on the Quest (fdm.cpp and gpu.cpp, AURORA_FDM=0/1 overrides).
- Controller motion uses XR_KHR_convert_timespec_time on any Linux.
- CMake: Vulkan headers are fetched for Linux OpenXR builds, the
  headset option is MKW_HEADSET on Android and Linux, and Linux aarch64
  builds take MKW_LINUX_CPU (cortex-x4 for the Steam Frame, else native).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019HBRGKTE1GnN2ah8gcZKr3
This commit is contained in:
Claude committed 2026-10-04 09:48:48 +00:00
1 parent da0d13bdd2
commit 28a25108c6
13 files changed
+137 -36

No files matched your search

@@ -268,7 +268,10 @@ elseif (_aurora_dawn_provider STREQUAL "package")
# A package built with Aurora's patches (android/Build-QuestDawn.ps1) describes them in
# aurora-dawn.json. Only such a package has the fragment density map ABI
# (include/aurora/dawn_fdm_abi.h); aurora_core compiles its callers against it.
# The Vulkan hook ABI (include/aurora/dawn_vulkan_abi.h) is the other half: a package built by
# Launcher/build-dawn-linux.sh carries it, and the Linux OpenXR backend needs it.
set(AURORA_DAWN_FDM_ABI 0 PARENT_SCOPE)
set(AURORA_DAWN_VULKAN_HOOKS_ABI 0 PARENT_SCOPE)
if (EXISTS "${_dawn_pkg_dir}/aurora-dawn.json")
file(READ "${_dawn_pkg_dir}/aurora-dawn.json" _aurora_dawn_manifest)
string(JSON _aurora_dawn_fdm_abi ERROR_VARIABLE _aurora_dawn_manifest_error
@@ -277,6 +280,12 @@ elseif (_aurora_dawn_provider STREQUAL "package")
set(AURORA_DAWN_FDM_ABI ${_aurora_dawn_fdm_abi} PARENT_SCOPE)
message(STATUS "aurora: Dawn package carries the fragment density map ABI ${_aurora_dawn_fdm_abi}")
endif ()
string(JSON _aurora_dawn_vulkan_abi ERROR_VARIABLE _aurora_dawn_manifest_error
GET "${_aurora_dawn_manifest}" AuroraVulkanAbi)
if (NOT _aurora_dawn_manifest_error AND _aurora_dawn_vulkan_abi GREATER 0)
set(AURORA_DAWN_VULKAN_HOOKS_ABI ${_aurora_dawn_vulkan_abi} PARENT_SCOPE)
message(STATUS "aurora: Dawn package carries the Vulkan hook ABI ${_aurora_dawn_vulkan_abi}")
endif ()
endif ()
_aurora_dawn_set_platform_backends()
+8
View File
@@ -39,6 +39,14 @@ if (AURORA_ENABLE_GX)
# of producing unresolved interop references.
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
target_sources(aurora_core PRIVATE lib/webgpu/d3d12_interop.cpp lib/webgpu/vulkan_win32_interop.cpp)
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
# The same-device Vulkan bridge, for the desktop Linux OpenXR backend (SteamOS on the Steam
# Frame). Static Dawn on Linux is linked directly, so the bridge is compiled in only against
# a package with Aurora's Vulkan hooks; otherwise the file is its C ABI stubs.
target_sources(aurora_core PRIVATE lib/webgpu/vulkan_win32_interop.cpp)
if (AURORA_DAWN_VULKAN_HOOKS_ABI)
target_compile_definitions(aurora_core PRIVATE AURORA_DAWN_VULKAN_HOOKS=${AURORA_DAWN_VULKAN_HOOKS_ABI})
endif ()
endif ()
# Android/Vulkan counterpart: the AHardwareBuffer stereo bridge. The file
# compiles to C ABI stubs on every other platform so the runtime's OpenXR
+5 -3
View File
@@ -6,8 +6,10 @@
#include <algorithm>
#include <bit>
// AURORA_DAWN_FDM carries the ABI version of the Dawn package's patches (AuroraDawnProvider.cmake).
#if defined(__ANDROID__) && defined(AURORA_DAWN_FDM)
// AURORA_DAWN_FDM carries the ABI version of the Dawn package's patches (AuroraDawnProvider.cmake):
// the Quest's (android/Build-QuestDawn.ps1) or desktop Linux's (Launcher/build-dawn-linux.sh), both
// linked statically.
#if (defined(__ANDROID__) || defined(__linux__)) && defined(AURORA_DAWN_FDM)
#include <aurora/dawn_fdm_abi.h>
static_assert(AURORA_DAWN_FDM == AURORA_DAWN_FDM_ABI,
"The Dawn package's fragment density map ABI does not match include/aurora/dawn_fdm_abi.h");
@@ -53,7 +55,7 @@ void device_created() noexcept {
#else
if (g_requested) {
Log.warn("Fragment density maps: unavailable; this build links a Dawn without Aurora's patches "
"(android/Build-QuestDawn.ps1)");
"(android/Build-QuestDawn.ps1, Launcher/build-dawn-linux.sh)");
}
#endif
}
+7
View File
@@ -830,6 +830,13 @@ bool initialize(AuroraBackend auroraBackend) {
const int fdmOverride = android_debug::property_int("debug.wiicompiled.fdm", -1);
fdm::request(g_backendType == wgpu::BackendType::Vulkan &&
(fdmOverride >= 0 ? fdmOverride == 1 : g_config.xrFragmentDensityMap));
#elif defined(__linux__)
// Desktop Linux (SteamOS on the Steam Frame), with a Dawn built by Launcher/build-dawn-linux.sh.
// AURORA_FDM=0 or 1 overrides the settings, as debug.wiicompiled.fdm does on the Quest.
const char* fdmOverride = std::getenv("AURORA_FDM");
fdm::request(g_backendType == wgpu::BackendType::Vulkan &&
(fdmOverride != nullptr && *fdmOverride != '\0' ? std::strcmp(fdmOverride, "1") == 0
: g_config.xrFragmentDensityMap));
#endif
const auto future =
g_adapter.RequestDevice(&deviceDescriptor, wgpu::CallbackMode::WaitAnyOnly,
@@ -4,8 +4,27 @@
#include "../stereo.hpp"
#include "../stereo_overlay.hpp"
#include "gpu.hpp"
#if defined(_WIN32) && defined(WEBGPU_DAWN) && defined(DAWN_ENABLE_BACKEND_VULKAN)
// Windows loads the patched webgpu_dawn.dll's exports at run time. Desktop Linux (SteamOS on the
// Steam Frame) links Dawn statically, so there the bridge exists only against a package built with
// the hooks (AURORA_DAWN_VULKAN_HOOKS, from its aurora-dawn.json) and calls them directly.
#if defined(WEBGPU_DAWN) && defined(DAWN_ENABLE_BACKEND_VULKAN) && \
(defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__) && defined(AURORA_DAWN_VULKAN_HOOKS)))
#if defined(_WIN32)
#include <windows.h>
#else
static_assert(AURORA_DAWN_VULKAN_HOOKS == AURORA_DAWN_VULKAN_ABI,
"The Dawn package's Vulkan hook ABI does not match include/aurora/dawn_vulkan_abi.h");
extern "C" {
uint32_t AuroraDawnVulkanVersion(void);
int AuroraDawnVulkanConfigure(const AuroraDawnVulkanHooks* hooks);
int AuroraDawnVulkanGetHandles(void* device, AuroraDawnVulkanHandles* handles);
void* AuroraDawnVulkanWrap(void* device, const void* textureDescriptor, uint64_t image);
int AuroraDawnVulkanRelease(void* device, void* const* textures, uint32_t count);
void* AuroraDawnVulkanLock(void* device);
void AuroraDawnVulkanUnlock(void* guard);
int AuroraDawnVulkanDrain(void* device);
}
#endif
#include <algorithm>
#include <array>
#include <memory>
@@ -23,6 +42,17 @@ struct Api {
AuroraDawnVulkanUnlockFn unlock = nullptr;
AuroraDawnVulkanDrainFn drain = nullptr;
bool Load() {
#if !defined(_WIN32)
if (AuroraDawnVulkanVersion() != AURORA_DAWN_VULKAN_ABI) return false;
configure = &AuroraDawnVulkanConfigure;
handles = &AuroraDawnVulkanGetHandles;
wrap = &AuroraDawnVulkanWrap;
release = &AuroraDawnVulkanRelease;
lock = &AuroraDawnVulkanLock;
unlock = &AuroraDawnVulkanUnlock;
drain = &AuroraDawnVulkanDrain;
return true;
#else
HMODULE module = GetModuleHandleW(L"webgpu_dawn.dll");
if (!module) return false;
auto version = reinterpret_cast<AuroraDawnVulkanVersionFn>(GetProcAddress(module, "AuroraDawnVulkanVersion"));
@@ -37,6 +67,7 @@ struct Api {
LOAD(drain, AuroraDawnVulkanDrainFn, "AuroraDawnVulkanDrain");
#undef LOAD
return true;
#endif
}
} api;
int64_t VkFormat(wgpu::TextureFormat format) {
@@ -222,8 +253,9 @@ void* aurora_vulkan_win32_lock_queue() {
void aurora_vulkan_win32_unlock_queue(void* guard) { aurora::vulkan_win32::api.unlock(guard); }
#else
// C ABI stubs keep the runtime's OpenXR integration linkable on Windows GX
// builds whose Dawn has no Vulkan backend; the backend then reports that the
// bridge is unavailable and the game falls back to the desktop renderer.
// builds whose Dawn has no Vulkan backend, and on Linux against a Dawn without
// Aurora's hooks; the backend then reports that the bridge is unavailable and
// the game falls back to the desktop renderer.
bool aurora_vulkan_win32_configure(const AuroraDawnVulkanHooks*) { return false; }
bool aurora_vulkan_win32_get_handles(AuroraDawnVulkanHandles* handles, int64_t* format) {
if (handles) *handles = {};