mirror of
https://github.com/thejerf/baijiSteamVR.git
synced 2026-10-18 19:01:37 +02:00
Compare commits
11
Commits
v0.4
..
openxr-work
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e9a304a65 | ||
|
|
1678bc7cd5 | ||
|
|
ffe128309f | ||
|
|
6955095298 | ||
|
|
308ce19adf | ||
|
|
6f5b20ac24 | ||
|
|
1292404e31 | ||
|
|
2d41ce7ac4 | ||
|
|
ca0070222d | ||
|
|
3d069f0bb9 | ||
|
|
9bd33b5f6b |
No files matched your search
@@ -0,0 +1,52 @@
|
||||
### Copy of gitignore
|
||||
# Ignore image thumbnail files created by windows
|
||||
Thumbs.db
|
||||
# Ignore Finder view option files created by OS X
|
||||
.DS_Store
|
||||
# Ignore autogenerated source files
|
||||
Externals/mGBA/version.c
|
||||
Source/Core/Common/scmrev.h
|
||||
# Ignore files output by build
|
||||
/cmake-build-debug
|
||||
/cmake-build-release
|
||||
/[Bb]uild/
|
||||
/[Bb]inary/
|
||||
/obj/
|
||||
# Ignore files output by Android cmake build
|
||||
/Source/Android/app/.cxx/
|
||||
/libs/
|
||||
# Ignore various files created by visual studio/msbuild
|
||||
*.ipch
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.suo
|
||||
*.vcxproj.user
|
||||
*.obj
|
||||
*.tlog
|
||||
*.VC.opendb
|
||||
*.VC.db
|
||||
.vs*/
|
||||
/Source/enc_temp_folder/
|
||||
# Ignore build info file created by QtCreator
|
||||
CMakeLists.txt.user
|
||||
|
||||
# Ignore vim swapfiles
|
||||
*.swp
|
||||
# Ignore kdevelop files/dirs
|
||||
*.kdev4
|
||||
# Ignore IDEA/Clion files/dirs
|
||||
.idea/
|
||||
# Ignore Visual Studio Code's working dir
|
||||
/.vscode/
|
||||
# Ignore flatpak-builder's cache dir
|
||||
.flatpak-builder
|
||||
# DolphinXR dev artifacts
|
||||
codex_apk_backups/
|
||||
quest_perf_capture/
|
||||
vulkan_pipeline_failures/
|
||||
vulkan_pipeline_failures_latest/
|
||||
vulkan_pipeline_failures_latest2/
|
||||
quest_first_mv_vs.glsl
|
||||
quest_mv_vs.glsl
|
||||
|
||||
### Changes from gitignore
|
||||
@@ -0,0 +1,15 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [iChris4] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
polar: # Replace with a single Polar username
|
||||
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||
thanks_dev: # Replace with a single thanks.dev username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
@@ -51,3 +51,5 @@ vulkan_pipeline_failures_latest/
|
||||
vulkan_pipeline_failures_latest2/
|
||||
quest_first_mv_vs.glsl
|
||||
quest_mv_vs.glsl
|
||||
|
||||
dist/*
|
||||
+9
-1
@@ -13,7 +13,7 @@ endif()
|
||||
# This is inserted into the Info.plist as well.
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0.0" CACHE STRING "")
|
||||
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FlagsOverride.cmake")
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "CMake/FlagsOverride.cmake")
|
||||
|
||||
# CMake 3.28 and later scan c++ source files for module imports by default. Since we don't use
|
||||
# modules scanning is pointless, so disable it. This also prevents Clang from generating an error
|
||||
@@ -490,6 +490,13 @@ endif()
|
||||
# TODO: We should have options for dependencies included in the externals to
|
||||
# override autodetection of system libraries and force the usage of the
|
||||
# externals.
|
||||
if (ENABLE_QT AND MSVC)
|
||||
# Windows has no system Qt6 package, so use the vendored one from Externals/Qt (locked to 6.5.1).
|
||||
# On Linux we use the system Qt6 package instead: mixing the vendored Qt6.5.1 (which lacks a DBus
|
||||
# module) with a system Qt6 for DBus fails, since CMake's Qt6 package requires all found
|
||||
# components to share the exact same version.
|
||||
list(PREPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt6.5.1/x64")
|
||||
endif()
|
||||
include(CheckLib)
|
||||
include(CheckCXXSourceRuns)
|
||||
|
||||
@@ -897,6 +904,7 @@ endif()
|
||||
# packaging information
|
||||
set(CPACK_PACKAGE_NAME "dolphin-emu")
|
||||
set(CPACK_PACKAGE_VENDOR "Dolphin Team")
|
||||
set(CPACK_PACKAGE_CONTACT "dolphinxr@example.com")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${DOLPHIN_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${DOLPHIN_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${DOLPHIN_VERSION_PATCH})
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
FROM ubuntu:26.04
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
build-essential \
|
||||
clang \
|
||||
cmake \
|
||||
file \
|
||||
qt6-base-dev \
|
||||
qt6-base-private-dev \
|
||||
qt6-svg-dev \
|
||||
pkg-config \
|
||||
libgl1-mesa-dev \
|
||||
libx11-dev \
|
||||
libxrandr-dev \
|
||||
libxi-dev \
|
||||
libegl1-mesa-dev \
|
||||
libavcodec-dev \
|
||||
libavformat-dev \
|
||||
libavutil-dev \
|
||||
libswresample-dev \
|
||||
libswscale-dev \
|
||||
libudev-dev \
|
||||
libevdev-dev \
|
||||
libsdl3-dev \
|
||||
glslang-dev \
|
||||
glslang-tools \
|
||||
libpugixml-dev \
|
||||
libenet-dev \
|
||||
libxxhash-dev \
|
||||
libbz2-dev \
|
||||
liblzma-dev \
|
||||
libzstd-dev \
|
||||
zlib1g-dev \
|
||||
libminizip-ng-dev \
|
||||
liblzo2-dev \
|
||||
liblz4-dev \
|
||||
libspng-dev \
|
||||
libcubeb-dev \
|
||||
libusb-1.0-0-dev \
|
||||
libsfml-dev \
|
||||
libminiupnpc-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libhidapi-dev \
|
||||
libsystemd-dev \
|
||||
libgtest-dev \
|
||||
libasound2-dev \
|
||||
libpulse-dev \
|
||||
llvm-dev \
|
||||
libbluetooth-dev \
|
||||
gettext \
|
||||
libvulkan-dev \
|
||||
vulkan-tools
|
||||
## fmt that comes with ubuntu 26 also seems incorrect.
|
||||
# libfmt-dev \
|
||||
|
||||
RUN mkdir -p /app/dolphinxr
|
||||
WORKDIR /app/dolphinxr
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN mkdir Build \
|
||||
&& cd Build \
|
||||
&& cmake .. -DENABLE_VR=ON -DENABLE_VULKAN=ON -DUSE_SYSTEM_MBEDTLS=OFF -DUSE_SYSTEM_LIBMGBA=OFF \
|
||||
&& cd .. \
|
||||
&& cmake --build Build --target dolphin-emu -j $(nproc)
|
||||
Vendored
+1
-1
Submodule Externals/OpenXR updated: 472d817ffe...a170408a4d.
Vendored
+1
-1
Submodule Externals/fmt/fmt updated: e424e3f2e6...ebd44f3691.
@@ -0,0 +1,18 @@
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 7efde81..9d5e1fd 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -163,8 +163,12 @@ option(BUILD_ALL_EXTENSIONS "Build loader and layers with all extensions" OFF)
|
||||
option(
|
||||
BUILD_LOADER_WITH_EXCEPTION_HANDLING
|
||||
"Enable exception handling in the loader. Leave this on unless your standard library is built to not throw."
|
||||
- ON
|
||||
+ OFF
|
||||
)
|
||||
+if(NOT BUILD_LOADER_WITH_EXCEPTION_HANDLING)
|
||||
+ add_definitions(-DXRLOADER_DISABLE_EXCEPTION_HANDLING)
|
||||
+ add_definitions(-DJSON_USE_EXCEPTIONS=0)
|
||||
+endif()
|
||||
|
||||
if(WIN32)
|
||||
set(OPENXR_DEBUG_POSTFIX
|
||||
@@ -10,11 +10,11 @@ This fork adds OpenXR support to Dolphin so users can play in VR on Windows,
|
||||
desktop Linux, and standalone Meta Quest headsets, and was developed with the
|
||||
use of AI tools.
|
||||
|
||||
* **Windows** — VR runs on the Direct3D 11, Direct3D 12, Vulkan, and OpenGL
|
||||
- **Windows** — VR runs on the Direct3D 11, Direct3D 12, Vulkan, and OpenGL
|
||||
backends with any OpenXR runtime (SteamVR, Oculus/Meta Link, VDXR, etc.).
|
||||
* **Linux** — VR runs on the Vulkan and OpenGL backends and requires a working
|
||||
- **Linux** — VR runs on the Vulkan and OpenGL backends and requires a working
|
||||
system OpenXR runtime such as Monado or SteamVR.
|
||||
* **Meta Quest** — a standalone Android build (Quest 2, Quest 3, Quest 3S, and
|
||||
- **Meta Quest** — a standalone Android build (Quest 2, Quest 3, Quest 3S, and
|
||||
Quest Pro) renders natively in the headset on the Vulkan and OpenGL ES
|
||||
backends, with OpenXR controller support.
|
||||
|
||||
@@ -24,42 +24,42 @@ Please read the [FAQ](https://dolphin-emu.org/docs/faq/) before using Dolphin.
|
||||
|
||||
### Desktop
|
||||
|
||||
* OS
|
||||
* Windows (10 1903 or higher).
|
||||
* Linux.
|
||||
* macOS (11.0 Big Sur or higher).
|
||||
* Unix-like systems other than Linux are not officially supported but might work.
|
||||
* Processor
|
||||
* A CPU with SSE2 support.
|
||||
* A modern CPU (3 GHz and Dual Core, not older than 2008) is highly recommended.
|
||||
* Graphics
|
||||
* A reasonably modern graphics card (Direct3D 11.1 / OpenGL 3.3).
|
||||
* A graphics card that supports Direct3D 11.1 / OpenGL 4.4 is recommended.
|
||||
- OS
|
||||
- Windows (10 1903 or higher).
|
||||
- Linux.
|
||||
- macOS (11.0 Big Sur or higher).
|
||||
- Unix-like systems other than Linux are not officially supported but might work.
|
||||
- Processor
|
||||
- A CPU with SSE2 support.
|
||||
- A modern CPU (3 GHz and Dual Core, not older than 2008) is highly recommended.
|
||||
- Graphics
|
||||
- A reasonably modern graphics card (Direct3D 11.1 / OpenGL 3.3).
|
||||
- A graphics card that supports Direct3D 11.1 / OpenGL 4.4 is recommended.
|
||||
|
||||
### Android
|
||||
|
||||
* OS
|
||||
* Android (5.0 Lollipop or higher).
|
||||
* Processor
|
||||
* A processor with support for 64-bit applications (either ARMv8 or x86-64).
|
||||
* Graphics
|
||||
* A graphics processor that supports OpenGL ES 3.0 or higher. Performance varies heavily with [driver quality](https://dolphin-emu.org/blog/2013/09/26/dolphin-emulator-and-opengl-drivers-hall-fameshame/).
|
||||
* A graphics processor that supports standard desktop OpenGL features is recommended for best performance.
|
||||
- OS
|
||||
- Android (5.0 Lollipop or higher).
|
||||
- Processor
|
||||
- A processor with support for 64-bit applications (either ARMv8 or x86-64).
|
||||
- Graphics
|
||||
- A graphics processor that supports OpenGL ES 3.0 or higher. Performance varies heavily with [driver quality](https://dolphin-emu.org/blog/2013/09/26/dolphin-emulator-and-opengl-drivers-hall-fameshame/).
|
||||
- A graphics processor that supports standard desktop OpenGL features is recommended for best performance.
|
||||
|
||||
Dolphin can only be installed on devices that satisfy the above requirements. Attempting to install on an unsupported device will fail and display an error message.
|
||||
|
||||
### VR (OpenXR)
|
||||
|
||||
* Windows
|
||||
* An OpenXR runtime (SteamVR, Oculus/Meta Link, VDXR, etc.) and a headset it supports.
|
||||
* Direct3D 11, Direct3D 12, Vulkan, or OpenGL backend.
|
||||
* Linux
|
||||
* An OpenXR runtime such as Monado or SteamVR.
|
||||
* Vulkan (recommended) or OpenGL backend.
|
||||
* Meta Quest
|
||||
* Quest 2, Quest 3, Quest 3S, or Quest Pro, running the standalone `quest` build.
|
||||
* Vulkan or OpenGL ES backend.
|
||||
* VR is not supported on macOS.
|
||||
- Windows
|
||||
- An OpenXR runtime (SteamVR, Oculus/Meta Link, VDXR, etc.) and a headset it supports.
|
||||
- Direct3D 11, Direct3D 12, Vulkan, or OpenGL backend.
|
||||
- Linux
|
||||
- An OpenXR runtime such as Monado or SteamVR.
|
||||
- Vulkan (recommended) or OpenGL backend.
|
||||
- Meta Quest
|
||||
- Quest 2, Quest 3, Quest 3S, or Quest Pro, running the standalone `quest` build.
|
||||
- Vulkan or OpenGL ES backend.
|
||||
- VR is not supported on macOS.
|
||||
|
||||
## Building for Windows
|
||||
|
||||
@@ -70,6 +70,7 @@ tested and are not recommended to be used. Git and latest Windows SDK must be
|
||||
installed when building.
|
||||
|
||||
Make sure to pull submodules before building:
|
||||
|
||||
```sh
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
@@ -82,16 +83,19 @@ with `-DENABLE_VR=ON`. VR is supported on Windows, desktop Linux, and Android
|
||||
|
||||
If you are generating a Visual Studio build with CMake, configure with
|
||||
`-DENABLE_VR=ON`:
|
||||
|
||||
```sh
|
||||
cmake -S . -B Build-vs2022 -G "Visual Studio 17 2022" -A x64 -DENABLE_VR=ON
|
||||
```
|
||||
|
||||
When using the Visual Studio generator, build the OpenXR loader first:
|
||||
|
||||
```sh
|
||||
cmake --build Build-vs2022 --config Release --target openxr_loader
|
||||
```
|
||||
|
||||
Finally, build Dolphin:
|
||||
|
||||
```sh
|
||||
cmake --build Build-vs2022 --config Release --target dolphin-emu
|
||||
```
|
||||
@@ -104,14 +108,15 @@ The "Debug" solution configuration is significantly slower, more verbose and les
|
||||
|
||||
## Building for Linux and macOS
|
||||
|
||||
Dolphin requires [CMake](https://cmake.org/) for systems other than Windows.
|
||||
Dolphin requires [CMake](https://cmake.org/) for systems other than Windows.
|
||||
You need a recent version of GCC or Clang with decent c++20 support. CMake will
|
||||
inform you if your compiler is too old.
|
||||
Many libraries are bundled with Dolphin and used if they're not installed on
|
||||
Many libraries are bundled with Dolphin and used if they're not installed on
|
||||
your system. CMake will inform you if a bundled library is used or if you need
|
||||
to install any missing packages yourself. You may refer to the [wiki](https://github.com/dolphin-emu/dolphin/wiki/Building-for-Linux) for more information.
|
||||
|
||||
Make sure to pull submodules before building:
|
||||
|
||||
```sh
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
@@ -132,7 +137,7 @@ without `-DENABLE_VULKAN=ON`, though Vulkan is recommended.
|
||||
|
||||
### macOS Build Steps:
|
||||
|
||||
A binary supporting a single architecture can be built using the following steps:
|
||||
A binary supporting a single architecture can be built using the following steps:
|
||||
|
||||
1. `mkdir build`
|
||||
2. `cd build`
|
||||
@@ -150,8 +155,8 @@ application bundle using the following steps:
|
||||
4. Universal binaries will be available in the `universal` folder
|
||||
|
||||
Doing this is more complex as it requires installation of library dependencies for both x64 and ARM (or universal library
|
||||
equivalents) and may require specifying additional arguments to point to relevant library locations.
|
||||
Execute BuildMacOSUniversalBinary.py --help for more details.
|
||||
equivalents) and may require specifying additional arguments to point to relevant library locations.
|
||||
Execute BuildMacOSUniversalBinary.py --help for more details.
|
||||
|
||||
### Linux Global Build Steps:
|
||||
|
||||
@@ -173,6 +178,28 @@ Useful for development as root access is not required.
|
||||
4. `make -j $(nproc)`
|
||||
5. `ln -s ../../Data/Sys Binaries/`
|
||||
|
||||
### Building with Docker
|
||||
|
||||
A `Dockerfile` is provided for a reproducible Linux build environment. Build the image from the repository root:
|
||||
|
||||
```sh
|
||||
docker build -t dolphinxr:latest .
|
||||
```
|
||||
|
||||
To produce an installable `.deb` package from the built image and extract it to the host:
|
||||
|
||||
```sh
|
||||
mkdir -p dist
|
||||
docker run --rm -v "$(pwd)/dist:/out" -w /app/dolphinxr/Build dolphinxr:latest \
|
||||
bash -c "cpack -G DEB && cp -v *.deb /out/"
|
||||
```
|
||||
|
||||
Then install it:
|
||||
|
||||
```sh
|
||||
sudo apt install ./dist/dolphin-emu-*.deb
|
||||
```
|
||||
|
||||
### Linux Portable Build Steps:
|
||||
|
||||
Can be stored on external storage and used on different Linux systems.
|
||||
@@ -191,6 +218,7 @@ These instructions assume familiarity with Android development. If you do not ha
|
||||
Android dev environment set up, see [AndroidSetup.md](AndroidSetup.md).
|
||||
|
||||
Make sure to pull submodules before building:
|
||||
|
||||
```sh
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
@@ -211,17 +239,20 @@ so it can live alongside a standard install, and declares the OpenXR manifest
|
||||
entries required by Quest 2, Quest 3, Quest 3S, and Quest Pro.
|
||||
|
||||
Build it with Gradle from `Source/Android`:
|
||||
|
||||
```sh
|
||||
./gradlew assembleQuestDebug # or assembleQuestRelease
|
||||
```
|
||||
|
||||
Helper scripts are also provided for Windows:
|
||||
|
||||
```powershell
|
||||
.\Source\Android\build-quest.ps1 # debug APK
|
||||
.\Source\Android\build-quest-release.ps1 # release APK (needs signing properties)
|
||||
```
|
||||
|
||||
Install the resulting APK on a headset with adb:
|
||||
|
||||
```sh
|
||||
adb install -r Source/Android/app/build/outputs/apk/quest/debug/app-quest-debug.apk
|
||||
```
|
||||
@@ -283,6 +314,7 @@ There's also "Null", which will not render anything, and
|
||||
is intended for debugging purposes only.
|
||||
|
||||
## DolphinTool Usage
|
||||
|
||||
```
|
||||
usage: dolphin-tool COMMAND -h
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
if (MSVC)
|
||||
if(_M_ARM_64)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt6.5.1/ARM64")
|
||||
|
||||
@@ -295,8 +295,11 @@ void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||
std::array<std::array<float, 4>, 2> eye_z_rows{};
|
||||
VR::g_openxr->GetEyeProjectionRows(upm, eye_projection_rows, eye_z_rows);
|
||||
|
||||
// OpenXR stereo path bypasses the classic cproj path, so apply freelook here too.
|
||||
if (perspective && g_freelook_camera.IsActive())
|
||||
// OpenXR stereo bypasses the classic cproj path, so bake Free Look into the cached
|
||||
// game-camera rows. Do this regardless of the current draw type: with the per-frame
|
||||
// pose lock, an ortho draw may be the one that refreshes the cache for all later
|
||||
// perspective draws in the frame.
|
||||
if (g_freelook_camera.IsActive())
|
||||
{
|
||||
const Common::Matrix44 freelook_view = g_freelook_camera.GetView();
|
||||
ApplyRowTransform(&eye_projection_rows, freelook_view);
|
||||
@@ -305,6 +308,16 @@ void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||
|
||||
m_cached_eye_projection = eye_projection_rows;
|
||||
m_cached_eye_z_row = eye_z_rows;
|
||||
|
||||
// Cache a second projection from the exact same tracked pose without any game-camera
|
||||
// adjustment. Orthographic HUD and other virtual-screen routes select this below, so
|
||||
// Free Look, Camera Forward/Height, and Camera Anchor only move immersive 3D geometry.
|
||||
std::array<std::array<float, 4>, 4> tracked_eye_projection_rows{};
|
||||
std::array<std::array<float, 4>, 2> tracked_eye_z_rows{};
|
||||
VR::g_openxr->GetTrackedEyeProjectionRows(upm, tracked_eye_projection_rows,
|
||||
tracked_eye_z_rows);
|
||||
m_cached_tracked_eye_projection = tracked_eye_projection_rows;
|
||||
m_cached_tracked_eye_z_row = tracked_eye_z_rows;
|
||||
m_cached_units_per_meter = upm;
|
||||
|
||||
// Unrotated per-eye projection rows for head-locked content.
|
||||
@@ -320,13 +333,6 @@ void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||
m_vr_pose_needs_refresh = false;
|
||||
}
|
||||
|
||||
constants.eye_projection[0] = m_cached_eye_projection[0];
|
||||
constants.eye_projection[1] = m_cached_eye_projection[1];
|
||||
constants.eye_projection[2] = m_cached_eye_projection[2];
|
||||
constants.eye_projection[3] = m_cached_eye_projection[3];
|
||||
constants.eye_z_row[0] = m_cached_eye_z_row[0];
|
||||
constants.eye_z_row[1] = m_cached_eye_z_row[1];
|
||||
|
||||
// Unrotated per-eye projection rows for head-locked content (cached above).
|
||||
constants.head_projection[0] = m_cached_head_projection[0];
|
||||
constants.head_projection[1] = m_cached_head_projection[1];
|
||||
@@ -509,6 +515,25 @@ void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||
vr_stereo_override = std::numeric_limits<float>::quiet_NaN();
|
||||
}
|
||||
|
||||
if (VR::g_openxr && VR::g_openxr->IsSessionRunning())
|
||||
{
|
||||
// Only the normal immersive-perspective route represents the game camera. Virtual
|
||||
// screens (including orthographic HUD and perspective Screen Pane draws) stay tied to
|
||||
// the tracked room pose and therefore do not inherit Free Look or camera offsets.
|
||||
const bool use_game_camera =
|
||||
constants.stereoparams[3] > 0.5f && constants.stereoparams[3] < 1.5f;
|
||||
const auto& eye_projection = use_game_camera ? m_cached_eye_projection :
|
||||
m_cached_tracked_eye_projection;
|
||||
const auto& eye_z_row =
|
||||
use_game_camera ? m_cached_eye_z_row : m_cached_tracked_eye_z_row;
|
||||
constants.eye_projection[0] = eye_projection[0];
|
||||
constants.eye_projection[1] = eye_projection[1];
|
||||
constants.eye_projection[2] = eye_projection[2];
|
||||
constants.eye_projection[3] = eye_projection[3];
|
||||
constants.eye_z_row[0] = eye_z_row[0];
|
||||
constants.eye_z_row[1] = eye_z_row[1];
|
||||
}
|
||||
|
||||
const bool perspective_hud =
|
||||
perspective && VR::g_openxr && VR::g_openxr->IsSessionRunning() &&
|
||||
constants.stereoparams[3] < -2.5f;
|
||||
|
||||
@@ -97,6 +97,10 @@ private:
|
||||
// otherwise refreshed every SetConstants call.
|
||||
std::array<std::array<float, 4>, 4> m_cached_eye_projection{};
|
||||
std::array<std::array<float, 4>, 2> m_cached_eye_z_row{};
|
||||
// Same pose snapshot as the eye rows above, but without game-camera adjustments. Screen/HUD
|
||||
// routes use these so their placement is independent of Free Look and camera offsets.
|
||||
std::array<std::array<float, 4>, 4> m_cached_tracked_eye_projection{};
|
||||
std::array<std::array<float, 4>, 2> m_cached_tracked_eye_z_row{};
|
||||
std::array<std::array<float, 4>, 4> m_cached_head_projection{};
|
||||
float m_cached_units_per_meter = 0.0f;
|
||||
bool m_vr_pose_needs_refresh = true;
|
||||
|
||||
@@ -3294,19 +3294,40 @@ void OpenXRManager::GetEyeProjectionRows(
|
||||
float units_per_meter,
|
||||
std::array<std::array<float, 4>, 4>& out_proj_rows,
|
||||
std::array<std::array<float, 4>, 2>& out_z_rows) const
|
||||
{
|
||||
GetEyeProjectionRowsImpl(units_per_meter, true, out_proj_rows, out_z_rows);
|
||||
}
|
||||
|
||||
void OpenXRManager::GetTrackedEyeProjectionRows(
|
||||
float units_per_meter,
|
||||
std::array<std::array<float, 4>, 4>& out_proj_rows,
|
||||
std::array<std::array<float, 4>, 2>& out_z_rows) const
|
||||
{
|
||||
GetEyeProjectionRowsImpl(units_per_meter, false, out_proj_rows, out_z_rows);
|
||||
}
|
||||
|
||||
void OpenXRManager::GetEyeProjectionRowsImpl(
|
||||
float units_per_meter, bool apply_game_camera,
|
||||
std::array<std::array<float, 4>, 4>& out_proj_rows,
|
||||
std::array<std::array<float, 4>, 2>& out_z_rows) const
|
||||
{
|
||||
const float s = std::max(units_per_meter, 0.0001f);
|
||||
constexpr float DEG_TO_RAD = 0.01745329252f;
|
||||
const float lean_back_rad =
|
||||
g_ActiveConfig.vr_enable_lean_back_angle ? g_ActiveConfig.vr_lean_back_angle * DEG_TO_RAD :
|
||||
0.0f;
|
||||
apply_game_camera && g_ActiveConfig.vr_enable_lean_back_angle ?
|
||||
g_ActiveConfig.vr_lean_back_angle * DEG_TO_RAD :
|
||||
0.0f;
|
||||
// Positive UI values should move the camera forward.
|
||||
// In this projection path, decreasing eye-space Z corresponds to moving forward.
|
||||
const float camera_forward_units =
|
||||
g_ActiveConfig.vr_enable_camera_forward ? -g_ActiveConfig.vr_camera_forward * s : 0.0f;
|
||||
apply_game_camera && g_ActiveConfig.vr_enable_camera_forward ?
|
||||
-g_ActiveConfig.vr_camera_forward * s :
|
||||
0.0f;
|
||||
// Positive UI values should move the camera upward.
|
||||
const float camera_height_units =
|
||||
g_ActiveConfig.vr_enable_camera_height ? g_ActiveConfig.vr_camera_height * s : 0.0f;
|
||||
apply_game_camera && g_ActiveConfig.vr_enable_camera_height ?
|
||||
g_ActiveConfig.vr_camera_height * s :
|
||||
0.0f;
|
||||
|
||||
const std::array<XREyeView, 2> eye_views = GetTrackingAdjustedEyeViews();
|
||||
|
||||
@@ -3358,7 +3379,7 @@ void OpenXRManager::GetEyeProjectionRows(
|
||||
float m00 = r00, m01 = r01, m02 = r02;
|
||||
float m10 = r10, m11 = r11, m12 = r12;
|
||||
float m20 = r20, m21 = r21, m22 = r22;
|
||||
if (m_camera_anchor_rotation_active)
|
||||
if (apply_game_camera && m_camera_anchor_rotation_active)
|
||||
{
|
||||
const std::array<float, 9>& A = m_camera_anchor_rotation;
|
||||
m00 = A[0] * r00 + A[1] * r10 + A[2] * r20;
|
||||
@@ -3413,7 +3434,7 @@ void OpenXRManager::GetEyeProjectionRows(
|
||||
// head orientation. This keeps head tracking anchored like freelook offsets.
|
||||
ez += camera_forward_units;
|
||||
}
|
||||
if (m_camera_anchor_rotation_active)
|
||||
if (apply_game_camera && m_camera_anchor_rotation_active)
|
||||
{
|
||||
// The offsets above are rig-space; rotate them into view space so IPD, room
|
||||
// tracking and the fixed camera offsets stay aligned with the turned rig.
|
||||
@@ -3426,9 +3447,12 @@ void OpenXRManager::GetEyeProjectionRows(
|
||||
// Camera anchor: committed element position, already in game units and game view
|
||||
// space (see CommitCameraAnchorFrame). Zero when no anchor override is active;
|
||||
// capture is gated on the enable toggle, so disabling glides the camera home.
|
||||
ex += m_camera_anchor_position[0];
|
||||
ey += m_camera_anchor_position[1];
|
||||
ez += m_camera_anchor_position[2];
|
||||
if (apply_game_camera)
|
||||
{
|
||||
ex += m_camera_anchor_position[0];
|
||||
ey += m_camera_anchor_position[1];
|
||||
ez += m_camera_anchor_position[2];
|
||||
}
|
||||
|
||||
// W component: -dot(combined_xyz, eye_pos) using the ROTATED projection rows.
|
||||
// This gives the correct full view transform: P · R^T · (viewPos - eye_pos).
|
||||
|
||||
@@ -340,6 +340,15 @@ public:
|
||||
std::array<std::array<float, 4>, 4>& out_proj_rows,
|
||||
std::array<std::array<float, 4>, 2>& out_z_rows) const;
|
||||
|
||||
// Compute projection rows from the same tracked HMD pose without applying game-camera
|
||||
// adjustments (Free Look is applied by GeometryShaderManager, while Camera Forward/Height and
|
||||
// Camera Anchor are applied in GetEyeProjectionRows). World-fixed screen/HUD routes use these
|
||||
// rows so moving the game camera does not also move the virtual screen.
|
||||
void GetTrackedEyeProjectionRows(
|
||||
float units_per_meter,
|
||||
std::array<std::array<float, 4>, 4>& out_proj_rows,
|
||||
std::array<std::array<float, 4>, 2>& out_z_rows) const;
|
||||
|
||||
// ---- Camera Anchor (Elements Group Override "CameraAnchor" handling) ----
|
||||
// Anchors the VR camera to a game element's view-space origin (e.g. a character's
|
||||
// head for first-person view). Video-thread only, like m_submitted_eye_views.
|
||||
@@ -428,6 +437,11 @@ public:
|
||||
XrCompositionLayerFlags GetProjectionLayerExtraFlags() const;
|
||||
|
||||
private:
|
||||
void GetEyeProjectionRowsImpl(
|
||||
float units_per_meter, bool apply_game_camera,
|
||||
std::array<std::array<float, 4>, 4>& out_proj_rows,
|
||||
std::array<std::array<float, 4>, 2>& out_z_rows) const;
|
||||
|
||||
// XR_FB_passthrough: usable when the extension loaded and the system reports support.
|
||||
bool IsFBPassthroughUsable() const;
|
||||
// Create/start or pause the FB passthrough feed to match the Passthrough setting.
|
||||
|
||||
@@ -49,18 +49,22 @@
|
||||
#include "VideoCommon/CPMemory.h"
|
||||
#include "VideoCommon/CommandProcessor.h"
|
||||
#include "VideoCommon/EFBInterface.h"
|
||||
#include "VideoCommon/ElementsGroupManager.h"
|
||||
#include "VideoCommon/Fifo.h"
|
||||
#include "VideoCommon/FrameDumper.h"
|
||||
#include "VideoCommon/FramebufferManager.h"
|
||||
#include "VideoCommon/GeometryShaderManager.h"
|
||||
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.h"
|
||||
#include "VideoCommon/HideObjectEngine.h"
|
||||
#include "VideoCommon/OnScreenDisplay.h"
|
||||
#include "VideoCommon/PixelEngine.h"
|
||||
#include "VideoCommon/PixelShaderManager.h"
|
||||
#include "VideoCommon/Present.h"
|
||||
#include "VideoCommon/Resources/CustomResourceManager.h"
|
||||
#include "VideoCommon/ShaderHunter.h"
|
||||
#include "VideoCommon/TMEM.h"
|
||||
#include "VideoCommon/TextureCacheBase.h"
|
||||
#include "VideoCommon/TextureElementManager.h"
|
||||
#include "VideoCommon/VertexLoaderManager.h"
|
||||
#include "VideoCommon/VertexManagerBase.h"
|
||||
#include "VideoCommon/VertexShaderManager.h"
|
||||
@@ -397,6 +401,16 @@ void VideoBackendBase::ShutdownShared()
|
||||
|
||||
m_initialized = false;
|
||||
|
||||
// The VR override managers are process-lifetime singletons that lazily load per game ID and
|
||||
// skip the load when the ID already matches. Without dropping the cached ID here, booting the
|
||||
// same game twice in one process reuses the overrides from the first boot, so edits made in
|
||||
// between (e.g. enabling one in the Android per-game settings) only appear after a full
|
||||
// application restart. Loading with an empty ID clears the state and the cached ID.
|
||||
ShaderHunter::GetInstance().LoadOverrides("");
|
||||
ElementsGroupManager::GetInstance().LoadOverrides("");
|
||||
TextureElementManager::GetInstance().LoadOverrides("");
|
||||
HideObjectEngine::Engine::GetInstance().LoadCodes("");
|
||||
|
||||
VertexLoaderManager::Clear();
|
||||
system.GetFifo().Shutdown();
|
||||
}
|
||||
Reference in new issue
Block a user