Revert "Merge branch 'master' of https://github.com/Vindicus999/WiVRn"
This reverts commit6212dccc2b, reversing changes made to80e31b642a.
This commit is contained in:
@@ -36,33 +36,17 @@ body:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Installation method
|
||||
description: Describe how WiVRn and OpenComposite/xrizer were installed
|
||||
placeholder: flatpak --user, flatpak, AUR, Gentoo/Guru, built from sources...
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Server Config
|
||||
description: |
|
||||
Provide the content of `config.json` for the server.
|
||||
Located in `${XDG_CONFIG_HOME-${HOME}/.config}/wivrn/config.json`
|
||||
or `~/.var/app/io.github.wivrn.wivrn/config/wivrn/config.json` for the flatpak version
|
||||
placeholder: |
|
||||
{
|
||||
"encoders": [
|
||||
{"codec": "h264"}
|
||||
]
|
||||
}
|
||||
description: Provide the content of `config.json` for the server.
|
||||
placeholder: Add the content of config.json here...
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Server Logs
|
||||
description: Provide the `wivrn-server` output.
|
||||
placeholder: |
|
||||
Add the output of the wivrn-server here.
|
||||
If more than a few lines, prefer file attachment.
|
||||
placeholder: Add the output of the wivrn-server here...
|
||||
|
||||
- type: dropdown
|
||||
id: gpu
|
||||
|
||||
@@ -31,13 +31,6 @@ jobs:
|
||||
# repository: 'Vindicus999/WiVRn'
|
||||
# ref: sneed
|
||||
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Glslang, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
|
||||
+16
-19
@@ -33,12 +33,12 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: >
|
||||
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev libboost-all-dev librsvg2-bin libssl-dev libnotify-dev librsvg2-dev libarchive-dev
|
||||
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev libboost-all-dev librsvg2-bin libssl-dev libnotify-dev librsvg2-dev
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Vulkan-Headers, Glslang, SPIRV-Tools
|
||||
vulkan-query-version: 1.3.283.0
|
||||
vulkan-components: Vulkan-Headers
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: Configure CMake
|
||||
@@ -87,8 +87,14 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: >
|
||||
apt-get update && apt-get install --yes libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin libssl-dev libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git qcoro-qt6-dev librsvg2-dev libarchive-dev libglm-dev glslang-tools
|
||||
apt-get update && apt-get install --yes libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin libssl-dev libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git qcoro-qt6-dev librsvg2-dev
|
||||
# runtime: qml6-module-qtqml-workerscript qml6-module-qtquick-dialogs
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.283.0
|
||||
vulkan-components: Vulkan-Headers
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: Configure CMake
|
||||
run: >
|
||||
@@ -176,8 +182,8 @@ jobs:
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Vulkan-Headers, Glslang, SPIRV-Tools
|
||||
vulkan-query-version: 1.3.283.0
|
||||
vulkan-components: Vulkan-Headers
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
@@ -186,14 +192,13 @@ jobs:
|
||||
|
||||
- name: install server dependencies
|
||||
run: >
|
||||
sudo apt-get update && sudo apt-get install libavahi-glib-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libnotify-dev librsvg2-dev libarchive-dev
|
||||
sudo apt-get update && sudo apt-get install libavahi-glib-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libnotify-dev librsvg2-dev
|
||||
|
||||
- name: Configure CMake
|
||||
run: >
|
||||
cmake -B ${{github.workspace}}/build
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
-DWIVRN_USE_SYSTEM_OPENXR=OFF
|
||||
--preset everything
|
||||
-DWIVRN_BUILD_DASHBOARD=OFF
|
||||
-DWIVRN_BUILD_DISSECTOR=OFF
|
||||
@@ -288,8 +293,8 @@ jobs:
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Vulkan-Headers, Glslang, SPIRV-Tools
|
||||
vulkan-query-version: 1.3.268.0
|
||||
vulkan-components: Vulkan-Headers
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
@@ -302,7 +307,6 @@ jobs:
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
--preset ${{ matrix.cmake_preset }}
|
||||
-DWIVRN_USE_SYSTEM_OPENXR=OFF
|
||||
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
@@ -322,13 +326,6 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Prepare Vulkan SDK
|
||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||
with:
|
||||
vulkan-query-version: 1.3.296.0
|
||||
vulkan-components: Glslang, SPIRV-Tools
|
||||
vulkan-use-cache: true
|
||||
|
||||
- name: set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
@@ -470,7 +467,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt update
|
||||
apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev libarchive-dev
|
||||
apt install --yes libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev libcap-dev pkexec libboost-all-dev librsvg2-bin dpkg-dev pkg-config debhelper-compat build-essential lintian cmake libnotify-dev qt6-declarative-dev extra-cmake-modules libkirigami-dev libkf6i18n-dev libkf6coreaddons-dev libkf6qqc2desktopstyle-dev libkf6iconthemes-dev jq sudo cmake gcc g++ git wget libssl-dev qcoro-qt6-dev librsvg2-dev
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
@@ -9,14 +9,10 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install gettext
|
||||
pip install polib PyGithub
|
||||
run: sudo apt-get update && sudo apt-get install gettext qt6-base-dev qt6-tools-dev qt6-l10n-tools qtchooser python3-polib
|
||||
|
||||
- name: Check that .po files are up to date
|
||||
run: |
|
||||
if [[ "${{github.ref}}" == 'refs/heads/master' ]] ; then
|
||||
tools/check_po.py --manage-issues --github-repository "${{ github.repository }}" --github-token "${{ github.token }}"
|
||||
else
|
||||
tools/check_po.py
|
||||
fi
|
||||
qtchooser -install qt6 $(which qmake6)
|
||||
export QT_SELECT=qt6
|
||||
tools/check_messages.sh
|
||||
|
||||
+85
-29
@@ -18,12 +18,13 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
include(FetchContent)
|
||||
include(ExternalProject)
|
||||
include(GNUInstallDirs)
|
||||
include("cmake/AutoOption.cmake")
|
||||
|
||||
option(WIVRN_USE_SYSTEM_FREETYPE "Use system FreeType" ON)
|
||||
option(WIVRN_USE_SYSTEM_BOOST "Use system Boost headers" ON)
|
||||
option(WIVRN_USE_SYSTEM_OPENXR "Use system OpenXR headers" ON)
|
||||
option(WIVRN_USE_SYSTEMD "Use libsystemd" ON)
|
||||
option(WIVRN_USE_LIBKTX "Use libktx" ${ANDROID})
|
||||
auto_option(WIVRN_USE_SYSTEM_BOOST "Use system Boost headers" AUTO)
|
||||
auto_option(WIVRN_USE_SYSTEM_OPENXR "Use system OpenXR headers" AUTO)
|
||||
auto_option(WIVRN_USE_SYSTEMD "Use libsystemd" AUTO)
|
||||
auto_option(WIVRN_USE_LIBKTX "Use libktx" AUTO)
|
||||
option(WIVRN_USE_ANDROID_VALIDATION_LAYER "Download the android version of the Vulkan validation layer" OFF)
|
||||
option(WIVRN_BUILD_CLIENT "Build WiVRn client" OFF)
|
||||
option(WIVRN_BUILD_SERVER "Build WiVRn server" ON)
|
||||
@@ -36,12 +37,12 @@ option(WIVRN_WERROR "Treat warnings as errors" OFF)
|
||||
option(WIVRN_OPTIMIZE_SHADERS "Run siprv-opt on compiled shaders" ON)
|
||||
|
||||
option(WIVRN_USE_NVENC "Enable nvenc (Nvidia) hardware encoder" ON)
|
||||
option(WIVRN_USE_VAAPI "Enable vaapi (AMD/Intel) hardware encoder" ON)
|
||||
option(WIVRN_USE_VULKAN_ENCODE "Enable vulkan video encoder" ON)
|
||||
option(WIVRN_USE_X264 "Enable x264 software encoder" ON)
|
||||
auto_option(WIVRN_USE_VAAPI "Enable vaapi (AMD/Intel) hardware encoder" AUTO)
|
||||
auto_option(WIVRN_USE_VULKAN_ENCODE "Enable vulkan video encoder" AUTO)
|
||||
auto_option(WIVRN_USE_X264 "Enable x264 software encoder" AUTO)
|
||||
|
||||
option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" ON)
|
||||
option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" OFF)
|
||||
auto_option(WIVRN_USE_PIPEWIRE "Enable pipewire backend" AUTO)
|
||||
auto_option(WIVRN_USE_PULSEAUDIO "Enable pulseaudio backend" AUTO)
|
||||
|
||||
set(OVR_COMPAT_SEARCH_PATH "/opt/xrizer:/usr/local/lib/OpenComposite:/usr/lib/OpenComposite:/opt/OpenComposite:/opt/opencomposite"
|
||||
CACHE STRING "List of places to search for the OpenVR compatibility layer, separated by :")
|
||||
@@ -65,12 +66,6 @@ endif()
|
||||
|
||||
option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." ON)
|
||||
|
||||
if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_SERVER OR WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_DISSECTOR)
|
||||
set(NEED_COMMON TRUE)
|
||||
else()
|
||||
set(NEED_COMMON FALSE)
|
||||
endif()
|
||||
|
||||
if(ENABLE_COLOURED_OUTPUT)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
add_compile_options(-fdiagnostics-color=always)
|
||||
@@ -82,13 +77,19 @@ endif()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Vulkan REQUIRED)
|
||||
find_package(Git)
|
||||
if (NEED_COMMON AND NOT ANDROID)
|
||||
if (NOT ANDROID)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
endif()
|
||||
include(VulkanVersion)
|
||||
|
||||
if (WIVRN_USE_SYSTEM_BOOST AND NEED_COMMON)
|
||||
if (WIVRN_BUILD_DISSECTOR)
|
||||
if (WIVRN_USE_SYSTEM_BOOST STREQUAL "AUTO")
|
||||
if(WIVRN_BUILD_DISSECTOR)
|
||||
find_package(Boost 1.84.0 COMPONENTS locale url)
|
||||
else()
|
||||
find_package(Boost 1.75.0 COMPONENTS locale url)
|
||||
endif()
|
||||
elseif(WIVRN_USE_SYSTEM_BOOST STREQUAL "ON")
|
||||
if(WIVRN_BUILD_DISSECTOR)
|
||||
find_package(Boost 1.84.0 REQUIRED COMPONENTS locale url)
|
||||
else()
|
||||
find_package(Boost 1.75.0 REQUIRED COMPONENTS locale url)
|
||||
@@ -105,30 +106,72 @@ if (WIVRN_BUILD_SERVER)
|
||||
message(FATAL_ERROR "No encoder selected, use at least one of WIVRN_USE_NVENC, WIVRN_USE_VAAPI, WIVRN_USE_VULKAN_ENCODE or WIVRN_USE_X264")
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_VAAPI)
|
||||
if (WIVRN_USE_VAAPI STREQUAL "AUTO")
|
||||
pkg_check_modules(LIBAV IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||
pkg_check_modules(LIBDRM IMPORTED_TARGET libdrm)
|
||||
if (LIBAV_FOUND AND LIBDRM_FOUND)
|
||||
set(WIVRN_USE_VAAPI ON)
|
||||
else()
|
||||
set(WIVRN_USE_VAAPI OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_VAAPI)
|
||||
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||
pkg_check_modules(LIBDRM REQUIRED IMPORTED_TARGET libdrm)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_VULKAN_ENCODE)
|
||||
if (WIVRN_USE_VULKAN_ENCODE STREQUAL "AUTO")
|
||||
if (Vulkan_VERSION VERSION_GREATER_EQUAL 1.3.283)
|
||||
set(WIVRN_USE_VULKAN_ENCODE ON)
|
||||
else()
|
||||
set(WIVRN_USE_VULKAN_ENCODE OFF)
|
||||
endif()
|
||||
elseif(WIVRN_USE_VULKAN_ENCODE)
|
||||
if (Vulkan_VERSION VERSION_LESS 1.3.283)
|
||||
message(FATAL_ERROR "Vulkan video encode requires 1.3.283, found ${Vulkan_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_X264)
|
||||
if (WIVRN_USE_X264 STREQUAL "AUTO")
|
||||
pkg_check_modules(X264 IMPORTED_TARGET x264)
|
||||
if (X264_FOUND)
|
||||
set(WIVRN_USE_X264 ON)
|
||||
else()
|
||||
set(WIVRN_USE_X264 OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_X264)
|
||||
pkg_check_modules(X264 REQUIRED IMPORTED_TARGET x264)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_SYSTEMD)
|
||||
if (WIVRN_USE_SYSTEMD STREQUAL "AUTO")
|
||||
pkg_check_modules(SYSTEMD IMPORTED_TARGET libsystemd)
|
||||
if (SYSTEMD_FOUND)
|
||||
set(WIVRN_USE_SYSTEMD ON)
|
||||
else()
|
||||
set(WIVRN_USE_SYSTEMD OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_SYSTEMD)
|
||||
pkg_check_modules(SYSTEMD REQUIRED IMPORTED_TARGET libsystemd)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_PIPEWIRE)
|
||||
if (WIVRN_USE_PIPEWIRE STREQUAL "AUTO")
|
||||
pkg_check_modules(libpipewire IMPORTED_TARGET libpipewire-0.3)
|
||||
if (libpipewire_FOUND)
|
||||
set(WIVRN_USE_PIPEWIRE ON)
|
||||
else()
|
||||
set(WIVRN_USE_PIPEWIRE OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_PIPEWIRE)
|
||||
pkg_check_modules(libpipewire REQUIRED IMPORTED_TARGET libpipewire-0.3)
|
||||
endif()
|
||||
|
||||
if (WIVRN_USE_PULSEAUDIO)
|
||||
if (WIVRN_USE_PULSEAUDIO STREQUAL "AUTO")
|
||||
pkg_check_modules(libpulse IMPORTED_TARGET libpulse)
|
||||
if (libpulse_FOUND)
|
||||
set(WIVRN_USE_PULSEAUDIO ON)
|
||||
else()
|
||||
set(WIVRN_USE_PULSEAUDIO OFF)
|
||||
endif()
|
||||
elseif (WIVRN_USE_PULSEAUDIO)
|
||||
pkg_check_modules(libpulse REQUIRED IMPORTED_TARGET libpulse)
|
||||
endif()
|
||||
|
||||
@@ -144,8 +187,7 @@ endif()
|
||||
|
||||
if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER)
|
||||
pkg_check_modules(librsvg-2.0 REQUIRED IMPORTED_TARGET librsvg-2.0)
|
||||
find_package(LibArchive REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(PNG)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_DASHBOARD)
|
||||
@@ -174,11 +216,23 @@ if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_DASHBOARD)
|
||||
find_package(Gettext REQUIRED)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_CLIENT)
|
||||
if (WIVRN_USE_LIBKTX STREQUAL "AUTO")
|
||||
if (ANDROID)
|
||||
set(WIVRN_USE_LIBKTX ON)
|
||||
else()
|
||||
set(WIVRN_USE_LIBKTX OFF)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_CLIENT AND NOT ANDROID)
|
||||
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||
find_package(Fontconfig REQUIRED)
|
||||
|
||||
if (WIVRN_USE_SYSTEM_OPENXR)
|
||||
if (WIVRN_USE_SYSTEM_OPENXR STREQUAL "AUTO")
|
||||
find_package(OpenXR 1.1.48)
|
||||
elseif(WIVRN_USE_SYSTEM_OPENXR STREQUAL "ON")
|
||||
find_package(OpenXR 1.1.48 REQUIRED)
|
||||
endif()
|
||||
|
||||
@@ -192,7 +246,9 @@ if(ANDROID)
|
||||
endif()
|
||||
|
||||
if (WIVRN_BUILD_DISSECTOR)
|
||||
if (WIVRN_USE_SYSTEM_OPENXR)
|
||||
if (WIVRN_USE_SYSTEM_OPENXR STREQUAL "AUTO")
|
||||
find_package(OpenXR 1.1.48)
|
||||
elseif(WIVRN_USE_SYSTEM_OPENXR STREQUAL "ON")
|
||||
find_package(OpenXR 1.1.48 REQUIRED)
|
||||
endif()
|
||||
find_package(Wireshark REQUIRED)
|
||||
@@ -249,7 +305,7 @@ FetchContent_Declare(monado
|
||||
)
|
||||
|
||||
add_subdirectory(external)
|
||||
if (NEED_COMMON)
|
||||
if (WIVRN_BUILD_CLIENT OR WIVRN_BUILD_SERVER OR WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_DISSECTOR)
|
||||
add_subdirectory(common)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -124,7 +124,6 @@ android {
|
||||
'-DCMAKE_ANDROID_NDK_VERSION=' + ndkVersion,
|
||||
'-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON',
|
||||
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
|
||||
'-DWIVRN_USE_SYSTEM_BOOST=OFF',
|
||||
'-DWIVRN_USE_SYSTEM_FREETYPE=OFF',
|
||||
'-DWIVRN_BUILD_CLIENT=ON',
|
||||
'-DWIVRN_BUILD_SERVER=OFF',
|
||||
|
||||
+11
-18
@@ -13,7 +13,7 @@ if (WIVRN_USE_LIBKTX)
|
||||
FetchContent_MakeAvailable(libktx)
|
||||
endif()
|
||||
|
||||
if (NOT WIVRN_USE_SYSTEM_BOOST)
|
||||
if (NOT BOOST_FOUND)
|
||||
FetchContent_MakeAvailable(boost)
|
||||
endif()
|
||||
|
||||
@@ -51,7 +51,7 @@ if(ANDROID)
|
||||
else()
|
||||
add_executable(wivrn)
|
||||
|
||||
if (WIVRN_USE_SYSTEM_OPENXR)
|
||||
if (OpenXR_FOUND)
|
||||
target_link_libraries(wivrn OpenXR::openxr_loader OpenXR::headers)
|
||||
else()
|
||||
FetchContent_MakeAvailable(openxr_loader)
|
||||
@@ -91,22 +91,7 @@ file(GLOB_RECURSE VULKAN_SHADERS CONFIGURE_DEPENDS "*.glsl")
|
||||
target_sources(wivrn PRIVATE ${LOCAL_SOURCE} ${VULKAN_SHADERS})
|
||||
wivrn_compile_glsl(wivrn SHADERS ${VULKAN_SHADERS})
|
||||
|
||||
target_link_libraries(wivrn
|
||||
Boost::locale
|
||||
Boost::url
|
||||
EnTT::EnTT
|
||||
fastgltf
|
||||
FreetypeHarfbuzz
|
||||
glm::glm
|
||||
imspinner
|
||||
simdjson
|
||||
spdlog::spdlog
|
||||
stb
|
||||
uni-algo
|
||||
Vulkan::Vulkan
|
||||
wivrn-common
|
||||
wivrn-external
|
||||
)
|
||||
target_link_libraries(wivrn Vulkan::Vulkan spdlog::spdlog glm::glm fastgltf FreetypeHarfbuzz stb Boost::url Boost::locale)
|
||||
|
||||
if (WIVRN_USE_LIBKTX)
|
||||
target_link_libraries(wivrn ktx_read)
|
||||
@@ -122,6 +107,10 @@ if(NOT ANDROID)
|
||||
install(TARGETS wivrn)
|
||||
endif()
|
||||
|
||||
target_link_libraries(wivrn simdjson uni-algo wivrn-common wivrn-external)
|
||||
|
||||
|
||||
|
||||
##############################################################################
|
||||
# Dear ImGui
|
||||
#
|
||||
@@ -151,6 +140,10 @@ target_link_libraries(wivrn-imgui FreetypeHarfbuzz)
|
||||
target_link_libraries(wivrn wivrn-imgui)
|
||||
|
||||
|
||||
##############################################################################
|
||||
# EnTT
|
||||
#
|
||||
target_link_libraries(wivrn EnTT::EnTT)
|
||||
|
||||
##############################################################################
|
||||
# Vulkan Validation Layer
|
||||
|
||||
+82
-13
@@ -28,11 +28,14 @@
|
||||
#include "utils/thread_safe.h"
|
||||
#include "vk/vk_allocator.h"
|
||||
#include "wifi_lock.h"
|
||||
#include "xr/actionset.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/session.h"
|
||||
#include "xr/swapchain.h"
|
||||
#include "xr/system.h"
|
||||
#include "xr/fb_body_tracker.h"
|
||||
#include "xr/fb_face_tracker2.h"
|
||||
#include "xr/hand_tracker.h"
|
||||
#include "xr/htc_body_tracker.h"
|
||||
#include "xr/htc_face_tracker.h"
|
||||
#include "xr/pico_body_tracker.h"
|
||||
#include "xr/pico_face_tracker.h"
|
||||
#include "xr/xr.h"
|
||||
#include <atomic>
|
||||
#include <boost/locale/generator.hpp>
|
||||
#include <boost/locale/gnu_gettext.hpp>
|
||||
@@ -123,7 +126,12 @@ class application : public singleton<application>
|
||||
xr::actionset xr_actionset;
|
||||
std::vector<std::tuple<XrAction, XrActionType, std::string>> actions;
|
||||
|
||||
std::vector<std::pair<XrPath, xr::space>> generic_trackers;
|
||||
bool hand_tracking_supported = false;
|
||||
xr::hand_tracker left_hand;
|
||||
xr::hand_tracker right_hand;
|
||||
|
||||
std::variant<std::monostate, xr::fb_face_tracker2, xr::htc_face_tracker, xr::pico_face_tracker> face_tracker;
|
||||
std::variant<std::monostate, xr::fb_body_tracker, xr::htc_body_tracker, xr::pico_body_tracker> body_tracker;
|
||||
|
||||
bool eye_gaze_supported = false;
|
||||
|
||||
@@ -133,6 +141,7 @@ class application : public singleton<application>
|
||||
bool session_focused = false;
|
||||
bool session_visible = false;
|
||||
bool debug_extensions_found = false;
|
||||
std::vector<std::string> xr_extensions;
|
||||
std::vector<const char *> vk_device_extensions;
|
||||
std::atomic<bool> exit_requested = false;
|
||||
std::filesystem::path config_path;
|
||||
@@ -262,6 +271,16 @@ public:
|
||||
return std::make_pair(position, orientation);
|
||||
}
|
||||
|
||||
static XrPath string_to_path(const std::string & s)
|
||||
{
|
||||
return instance().xr_instance.string_to_path(s);
|
||||
}
|
||||
|
||||
static std::string path_to_string(XrPath p)
|
||||
{
|
||||
return instance().xr_instance.path_to_string(p);
|
||||
}
|
||||
|
||||
void run();
|
||||
|
||||
static void push_scene(std::shared_ptr<scene>);
|
||||
@@ -332,6 +351,16 @@ public:
|
||||
// #endif
|
||||
}
|
||||
|
||||
static XrTime now()
|
||||
{
|
||||
return instance().xr_instance.now();
|
||||
}
|
||||
|
||||
static uint32_t queue_family_index()
|
||||
{
|
||||
return instance().vk_queue_family_index;
|
||||
}
|
||||
|
||||
static thread_safe<vk::raii::Queue> & get_queue()
|
||||
{
|
||||
return instance().vk_queue;
|
||||
@@ -347,21 +376,26 @@ public:
|
||||
return intent;
|
||||
}
|
||||
|
||||
static vk::raii::PhysicalDevice & get_physical_device()
|
||||
{
|
||||
return instance().vk_physical_device;
|
||||
}
|
||||
|
||||
static const vk::PhysicalDeviceProperties & get_physical_device_properties()
|
||||
{
|
||||
return instance().physical_device_properties;
|
||||
}
|
||||
|
||||
static vk::raii::Device & get_device()
|
||||
{
|
||||
return instance().vk_device;
|
||||
}
|
||||
|
||||
static vk::raii::Instance & get_vulkan_instance()
|
||||
{
|
||||
return instance().vk_instance;
|
||||
}
|
||||
|
||||
static xr::system & get_system()
|
||||
{
|
||||
return instance().xr_system_id;
|
||||
}
|
||||
|
||||
static vk::raii::PipelineCache & get_pipeline_cache()
|
||||
{
|
||||
return instance().pipeline_cache;
|
||||
@@ -382,6 +416,21 @@ public:
|
||||
return instance().last_scene_cpu_time;
|
||||
}
|
||||
|
||||
static bool get_hand_tracking_supported()
|
||||
{
|
||||
return instance().hand_tracking_supported;
|
||||
}
|
||||
|
||||
static bool get_face_tracking_supported()
|
||||
{
|
||||
return !std::holds_alternative<std::monostate>(instance().face_tracker);
|
||||
}
|
||||
|
||||
static bool get_body_tracking_supported()
|
||||
{
|
||||
return !std::holds_alternative<std::monostate>(instance().body_tracker);
|
||||
}
|
||||
|
||||
static bool get_eye_gaze_supported()
|
||||
{
|
||||
return instance().eye_gaze_supported;
|
||||
@@ -392,9 +441,29 @@ public:
|
||||
return instance().openxr_post_processing_supported;
|
||||
}
|
||||
|
||||
static auto & get_generic_trackers()
|
||||
static xr::hand_tracker & get_left_hand()
|
||||
{
|
||||
return instance().generic_trackers;
|
||||
return instance().left_hand;
|
||||
}
|
||||
|
||||
static xr::hand_tracker & get_right_hand()
|
||||
{
|
||||
return instance().right_hand;
|
||||
}
|
||||
|
||||
static auto & get_face_tracker()
|
||||
{
|
||||
return instance().face_tracker;
|
||||
}
|
||||
|
||||
static auto & get_body_tracker()
|
||||
{
|
||||
return instance().body_tracker;
|
||||
}
|
||||
|
||||
static const std::vector<std::string> & get_xr_extensions()
|
||||
{
|
||||
return instance().xr_extensions;
|
||||
}
|
||||
|
||||
static const std::vector<const char *> & get_vk_device_extensions()
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
#include "shard_accumulator.h"
|
||||
#include "scenes/stream.h" // IWYU pragma: keep
|
||||
#include "application.h"
|
||||
#include "scenes/stream.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "xr/instance.h"
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
@@ -63,10 +63,10 @@ static bool is_complete(const shard_set & shards)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::optional<uint16_t> shard_set::insert(data_shard && shard, xr::instance & instance)
|
||||
std::optional<uint16_t> shard_set::insert(data_shard && shard)
|
||||
{
|
||||
if (empty())
|
||||
feedback.received_first_packet = instance.now();
|
||||
feedback.received_first_packet = application::now();
|
||||
|
||||
auto idx = shard.shard_idx;
|
||||
if (idx >= data.size())
|
||||
@@ -121,12 +121,12 @@ void shard_accumulator::push_shard(video_stream_data_shard && shard)
|
||||
}
|
||||
else if (frame_diff == 0)
|
||||
{
|
||||
auto shard_idx = current.insert(std::move(shard), instance);
|
||||
auto shard_idx = current.insert(std::move(shard));
|
||||
try_submit_frame(shard_idx);
|
||||
}
|
||||
else if (frame_diff == 1)
|
||||
{
|
||||
next.insert(std::move(shard), instance);
|
||||
next.insert(std::move(shard));
|
||||
if (is_complete(next))
|
||||
{
|
||||
debug_why_not_sent(current);
|
||||
@@ -191,7 +191,7 @@ void shard_accumulator::try_submit_frame(uint16_t shard_idx)
|
||||
if (not frame_complete)
|
||||
return;
|
||||
|
||||
current.feedback.received_last_packet = instance.now();
|
||||
current.feedback.received_last_packet = application::now();
|
||||
current.feedback.sent_to_decoder = current.feedback.received_last_packet;
|
||||
data_shard::timing_info_t timing_info = data_shards.back()->timing_info.value_or(data_shard::timing_info_t{});
|
||||
current.feedback.encode_begin = timing_info.encode_begin;
|
||||
@@ -216,7 +216,7 @@ void shard_accumulator::try_submit_frame(uint16_t shard_idx)
|
||||
void shard_accumulator::send_feedback(wivrn::from_headset::feedback & feedback)
|
||||
{
|
||||
if (not feedback.received_last_packet)
|
||||
feedback.received_first_packet = instance.now();
|
||||
feedback.received_first_packet = application::now();
|
||||
auto scene = weak_scene.lock();
|
||||
if (scene)
|
||||
scene->send_feedback(feedback);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "application.h"
|
||||
#include "utils/alignment.h"
|
||||
#include "vk/allocation.h"
|
||||
#include <fastgltf/tools.hpp>
|
||||
@@ -114,10 +115,10 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
buffer_allocation copy_to_gpu(vk::raii::Device & device)
|
||||
buffer_allocation copy_to_gpu()
|
||||
{
|
||||
buffer_allocation gpu_buffer{
|
||||
device,
|
||||
application::get_device(),
|
||||
vk::BufferCreateInfo{
|
||||
.size = bytes.size(),
|
||||
.usage = usage},
|
||||
|
||||
@@ -345,9 +345,9 @@ imgui_context::imgui_context(
|
||||
|
||||
ImGui_ImplVulkan_InitInfo init_info = {
|
||||
.Instance = *application::get_vulkan_instance(),
|
||||
.PhysicalDevice = *physical_device,
|
||||
.Device = *device,
|
||||
.QueueFamily = queue_family_index,
|
||||
.PhysicalDevice = *application::get_physical_device(),
|
||||
.Device = *application::get_device(),
|
||||
.QueueFamily = application::queue_family_index(),
|
||||
.Queue = *queue.get_unsafe(),
|
||||
.RenderPass = *renderpass,
|
||||
.MinImageCount = 2,
|
||||
@@ -718,7 +718,7 @@ void imgui_context::new_frame(XrTime display_time)
|
||||
ImPlot::SetCurrentContext(plot_context);
|
||||
|
||||
if (last_display_time)
|
||||
io.DeltaTime = std::clamp((display_time - last_display_time) * 1e-9f, 0.001f, 0.0166f);
|
||||
io.DeltaTime = std::min((display_time - last_display_time) * 1e-9f, 0.0166f);
|
||||
last_display_time = display_time;
|
||||
|
||||
// Uses the window list from last frame
|
||||
@@ -1099,13 +1099,6 @@ ImTextureID imgui_context::load_texture(const std::string & filename)
|
||||
|
||||
void imgui_context::free_texture(ImTextureID texture)
|
||||
{
|
||||
// Make sure we are done using the texture
|
||||
std::vector<vk::Fence> fences;
|
||||
for (auto & f: command_buffers)
|
||||
fences.push_back(*f.fence);
|
||||
if (auto result = device.waitForFences(fences, true, 1'000'000'000); result != vk::Result::eSuccess)
|
||||
spdlog::error("vkWaitForfences: {}", vk::to_string(result));
|
||||
|
||||
textures.erase(texture);
|
||||
}
|
||||
|
||||
|
||||
@@ -785,7 +785,7 @@ entt::registry scene_loader::operator()(const std::filesystem::path & gltf_path)
|
||||
|
||||
// Copy the staging buffer to the GPU
|
||||
spdlog::debug("Uploading scene data ({} bytes) to GPU memory", staging_buffer.size());
|
||||
auto buffer = std::make_shared<buffer_allocation>(staging_buffer.copy_to_gpu(device));
|
||||
auto buffer = std::make_shared<buffer_allocation>(staging_buffer.copy_to_gpu());
|
||||
|
||||
for (auto & i: materials)
|
||||
i->buffer = buffer;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "vk/allocation.h"
|
||||
#include "vk/pipeline.h"
|
||||
#include "vk/shader.h"
|
||||
#include "vk/specialization_constants.h"
|
||||
#include <boost/pfr/core.hpp>
|
||||
#include <entt/entity/entity.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
@@ -533,11 +532,34 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
|
||||
auto vertex_shader = load_shader(device, info.shader_name + ".vert");
|
||||
auto fragment_shader = load_shader(device, info.shader_name + ".frag");
|
||||
|
||||
auto specialization = make_specialization_constants(
|
||||
int32_t(info.nb_texcoords),
|
||||
VkBool32(info.dithering),
|
||||
VkBool32(info.alpha_cutout),
|
||||
VkBool32(info.skinning));
|
||||
std::array specialization_constants_desc{
|
||||
vk::SpecializationMapEntry{
|
||||
.constantID = 0,
|
||||
.offset = offsetof(pipeline_info, nb_texcoords),
|
||||
.size = sizeof(int32_t),
|
||||
},
|
||||
vk::SpecializationMapEntry{
|
||||
.constantID = 1,
|
||||
.offset = offsetof(pipeline_info, dithering),
|
||||
.size = sizeof(VkBool32),
|
||||
},
|
||||
vk::SpecializationMapEntry{
|
||||
.constantID = 2,
|
||||
.offset = offsetof(pipeline_info, alpha_cutout),
|
||||
.size = sizeof(VkBool32),
|
||||
},
|
||||
vk::SpecializationMapEntry{
|
||||
.constantID = 3,
|
||||
.offset = offsetof(pipeline_info, skinning),
|
||||
.size = sizeof(VkBool32),
|
||||
}};
|
||||
|
||||
vk::SpecializationInfo specialization{
|
||||
.mapEntryCount = specialization_constants_desc.size(),
|
||||
.pMapEntries = specialization_constants_desc.data(),
|
||||
.dataSize = sizeof(pipeline_info),
|
||||
.pData = &info,
|
||||
};
|
||||
|
||||
return vk::raii::Pipeline{
|
||||
device,
|
||||
@@ -548,14 +570,14 @@ vk::raii::Pipeline scene_renderer::create_pipeline(const pipeline_info & info)
|
||||
.stage = vk::ShaderStageFlagBits::eVertex,
|
||||
.module = *vertex_shader,
|
||||
.pName = "main",
|
||||
.pSpecializationInfo = specialization,
|
||||
.pSpecializationInfo = &specialization,
|
||||
|
||||
},
|
||||
vk::PipelineShaderStageCreateInfo{
|
||||
.stage = vk::ShaderStageFlagBits::eFragment,
|
||||
.module = *fragment_shader,
|
||||
.pName = "main",
|
||||
.pSpecializationInfo = specialization,
|
||||
.pSpecializationInfo = &specialization,
|
||||
|
||||
},
|
||||
},
|
||||
@@ -772,7 +794,7 @@ void scene_renderer::update_material_descriptor_set(renderer::material & materia
|
||||
device.updateDescriptorSets(write_ds, {});
|
||||
}
|
||||
|
||||
[[maybe_unused]] static void print_scene_hierarchy(const entt::registry & scene, entt::entity root = entt::null, int level = 0)
|
||||
static void print_scene_hierarchy(const entt::registry & scene, entt::entity root = entt::null, int level = 0)
|
||||
{
|
||||
if (level == 0)
|
||||
spdlog::info("Node hierarchy:");
|
||||
|
||||
@@ -139,42 +139,46 @@ text_rasterizer::text_rasterizer(vk::raii::Device & device, vk::raii::PhysicalDe
|
||||
|
||||
image_allocation text_rasterizer::create_image(vk::Extent2D size)
|
||||
{
|
||||
return {device,
|
||||
vk::ImageCreateInfo{
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = text::format,
|
||||
.extent = {
|
||||
.width = size.width,
|
||||
.height = size.height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 1,
|
||||
.samples = vk::SampleCountFlagBits::e1,
|
||||
.tiling = vk::ImageTiling::eOptimal,
|
||||
.usage = vk::ImageUsageFlagBits::eSampled | vk::ImageUsageFlagBits::eTransferDst,
|
||||
.sharingMode = vk::SharingMode::eExclusive,
|
||||
.initialLayout = vk::ImageLayout::eUndefined,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = 0,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"text_rasterizer image"};
|
||||
image_allocation alloc{device,
|
||||
vk::ImageCreateInfo{
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = text::format,
|
||||
.extent = {
|
||||
.width = size.width,
|
||||
.height = size.height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 1,
|
||||
.samples = vk::SampleCountFlagBits::e1,
|
||||
.tiling = vk::ImageTiling::eOptimal,
|
||||
.usage = vk::ImageUsageFlagBits::eSampled | vk::ImageUsageFlagBits::eTransferDst,
|
||||
.sharingMode = vk::SharingMode::eExclusive,
|
||||
.initialLayout = vk::ImageLayout::eUndefined,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = 0,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
}};
|
||||
|
||||
application::set_debug_reports_name<vk::Image>(alloc, "text_rasterizer image");
|
||||
return alloc;
|
||||
}
|
||||
|
||||
buffer_allocation text_rasterizer::create_buffer(size_t size)
|
||||
{
|
||||
return {device,
|
||||
vk::BufferCreateInfo{
|
||||
.size = size,
|
||||
.usage = vk::BufferUsageFlagBits::eTransferSrc,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"text_rasterizer buffer"};
|
||||
buffer_allocation alloc{device,
|
||||
vk::BufferCreateInfo{
|
||||
.size = size,
|
||||
.usage = vk::BufferUsageFlagBits::eTransferSrc,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
}};
|
||||
application::set_debug_reports_name<vk::Buffer>(alloc, "text_rasterizer buffer");
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
text_rasterizer::~text_rasterizer()
|
||||
|
||||
+3
-1
@@ -51,6 +51,8 @@ scene::scene(key, const meta & current_meta, std::span<const vk::Format> support
|
||||
queue_family_index(application::instance().vk_queue_family_index),
|
||||
current_meta(current_meta)
|
||||
{
|
||||
passthrough_supported = system.passthrough_supported();
|
||||
|
||||
swapchain_format = vk::Format::eUndefined;
|
||||
spdlog::info("Supported swapchain formats:");
|
||||
|
||||
@@ -441,7 +443,7 @@ std::pair<entt::entity, components::node &> scene::load_gltf(const std::filesyst
|
||||
node.layer_mask = layer_mask;
|
||||
|
||||
assert(renderer);
|
||||
scene_loader loader(device, physical_device, queue, queue_family_index, renderer->get_default_material());
|
||||
scene_loader loader(device, physical_device, queue, application::queue_family_index(), renderer->get_default_material());
|
||||
|
||||
loader.add_prefab(world, loader(path), entity);
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ public:
|
||||
protected:
|
||||
vk::Format swapchain_format;
|
||||
vk::Format depth_format;
|
||||
xr::system::passthrough_type passthrough_supported;
|
||||
bool composition_layer_depth_test_supported;
|
||||
bool composition_layer_color_scale_bias_supported;
|
||||
|
||||
|
||||
+102
-132
@@ -383,18 +383,9 @@ void scenes::lobby::connect(const configuration::server_data & data)
|
||||
data.manual);
|
||||
}
|
||||
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_gesture(xr::spaces space, const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints)
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_gesture(const std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT> & joints)
|
||||
{
|
||||
if (recentering_context and std::get<0>(*recentering_context) != space)
|
||||
return std::nullopt;
|
||||
|
||||
if (not joints)
|
||||
{
|
||||
recentering_context.reset();
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto & palm = (*joints)[XR_HAND_JOINT_PALM_EXT].first;
|
||||
const auto & palm = joints[XR_HAND_JOINT_PALM_EXT].first;
|
||||
const auto & o = palm.pose.orientation;
|
||||
const auto & p = palm.pose.position;
|
||||
glm::quat q{o.w, o.x, o.y, o.z};
|
||||
@@ -402,130 +393,102 @@ std::optional<glm::vec3> scenes::lobby::check_recenter_gesture(xr::spaces space,
|
||||
|
||||
if (glm::dot(q * glm::vec3(0, 1, 0), glm::vec3(0, -1, 0)) > constants::lobby::recenter_cosangle_min)
|
||||
{
|
||||
recentering_context.emplace(space, glm::vec3{}, 0);
|
||||
return v + glm::vec3(0, constants::lobby::recenter_distance_up, 0) + q * glm::vec3(0, 0, -constants::lobby::recenter_distance_front);
|
||||
}
|
||||
|
||||
recentering_context.reset();
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_action(XrTime predicted_display_time, glm::vec3 head_position)
|
||||
{
|
||||
xr::spaces controller;
|
||||
glm::vec3 recenter_position;
|
||||
float recenter_distance;
|
||||
std::optional<std::pair<glm::vec3, glm::quat>> aim;
|
||||
glm::vec3 offset_position;
|
||||
glm::quat offset_orientation;
|
||||
|
||||
if (recentering_context)
|
||||
if (application::read_action_bool(recenter_left_action).value_or(std::pair{0, false}).second)
|
||||
{
|
||||
controller = std::get<0>(*recentering_context);
|
||||
bool state;
|
||||
switch (controller)
|
||||
{
|
||||
case xr::spaces::aim_left:
|
||||
state = application::read_action_bool(recenter_left_action).value_or(std::pair{0, false}).second;
|
||||
break;
|
||||
|
||||
case xr::spaces::aim_right:
|
||||
state = application::read_action_bool(recenter_right_action).value_or(std::pair{0, false}).second;
|
||||
break;
|
||||
|
||||
default:
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (not state)
|
||||
{
|
||||
recentering_context.reset();
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
else if (auto state = application::read_action_bool(recenter_left_action); state and state->second)
|
||||
controller = xr::spaces::aim_left;
|
||||
else if (auto state = application::read_action_bool(recenter_right_action); state and state->second)
|
||||
controller = xr::spaces::aim_right;
|
||||
else
|
||||
return std::nullopt;
|
||||
|
||||
auto aim = application::locate_controller(application::space(controller), application::space(xr::spaces::world), predicted_display_time);
|
||||
|
||||
if (not aim)
|
||||
{
|
||||
// The controller cannot be located
|
||||
recentering_context.reset();
|
||||
return std::nullopt;
|
||||
aim = application::locate_controller(application::space(xr::spaces::aim_left), application::space(xr::spaces::world), predicted_display_time);
|
||||
std::tie(offset_position, offset_orientation) = input->offset[xr::spaces::aim_left];
|
||||
}
|
||||
|
||||
// Handle controller offset
|
||||
auto [offset_position, offset_orientation] = input->offset[controller];
|
||||
aim->first = aim->first + glm::mat3_cast(aim->second * offset_orientation) * offset_position;
|
||||
aim->second = aim->second * offset_orientation;
|
||||
|
||||
if (not recentering_context)
|
||||
if (application::read_action_bool(recenter_right_action).value_or(std::pair{0, false}).second)
|
||||
{
|
||||
// First frame of recentering
|
||||
imgui_context::controller_state state{
|
||||
.active = true,
|
||||
.aim_position = aim->first,
|
||||
.aim_orientation = aim->second,
|
||||
};
|
||||
aim = application::locate_controller(application::space(xr::spaces::aim_right), application::space(xr::spaces::world), predicted_display_time);
|
||||
std::tie(offset_position, offset_orientation) = input->offset[xr::spaces::aim_right];
|
||||
}
|
||||
|
||||
imgui_ctx->compute_pointer_position(state);
|
||||
if (aim)
|
||||
{
|
||||
// Handle controller offset
|
||||
aim->first = aim->first + glm::mat3_cast(aim->second * offset_orientation) * offset_position;
|
||||
aim->second = aim->second * offset_orientation;
|
||||
|
||||
if (state.pointer_position) // TODO: check that the pointer is inside an imgui window
|
||||
if (not gui_recenter_position or not gui_recenter_distance)
|
||||
{
|
||||
auto M = glm::mat3_cast(imgui_ctx->layers()[0].orientation);
|
||||
// First frame where the recenter action is active
|
||||
imgui_context::controller_state state{
|
||||
.active = true,
|
||||
.aim_position = aim->first,
|
||||
.aim_orientation = aim->second,
|
||||
};
|
||||
|
||||
// Pointer position in world
|
||||
glm::vec3 world_pointer_position = imgui_ctx->rw_from_vp(*state.pointer_position);
|
||||
imgui_ctx->compute_pointer_position(state);
|
||||
|
||||
// Pointer position in GUI
|
||||
recenter_position = glm::transpose(M) * (world_pointer_position - imgui_ctx->layers()[0].position);
|
||||
recenter_distance = glm::length(state.aim_position - world_pointer_position);
|
||||
if (state.pointer_position) // TODO: check that the pointer is inside an imgui window
|
||||
{
|
||||
auto M = glm::mat3_cast(imgui_ctx->layers()[0].orientation);
|
||||
|
||||
// Pointer position in world
|
||||
glm::vec3 world_pointer_position = imgui_ctx->rw_from_vp(*state.pointer_position);
|
||||
|
||||
// Pointer position in GUI
|
||||
gui_recenter_position = glm::transpose(M) * (world_pointer_position - imgui_ctx->layers()[0].position);
|
||||
gui_recenter_distance = glm::length(state.aim_position - world_pointer_position);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_recenter_position = glm::vec3(0, 0, 0);
|
||||
gui_recenter_distance = constants::lobby::recenter_action_distance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the center of the GUI if the controller points outside of the GUI
|
||||
recenter_position = glm::vec3(0, 0, 0);
|
||||
recenter_distance = constants::lobby::recenter_action_distance;
|
||||
}
|
||||
// Subsequent frames: find the GUI position that gives the correct world pointer position
|
||||
glm::vec3 controller_direction = -glm::column(glm::mat3_cast(aim->second), 2);
|
||||
glm::vec3 wanted_world_pointer_position = aim->first + controller_direction * *gui_recenter_distance;
|
||||
|
||||
recentering_context.emplace(controller, recenter_position, recenter_distance);
|
||||
return std::nullopt;
|
||||
// I'm sure there's an analytical solution but I can't be bothered to write it so
|
||||
// let's use a gradient descent instead
|
||||
auto f = [&](glm::vec3 new_gui_position) {
|
||||
auto q = compute_gui_orientation(head_position, new_gui_position);
|
||||
auto M = glm::mat3_cast(q); // plane-to-world transform
|
||||
|
||||
glm::vec3 world_pointer_position = new_gui_position + M * *gui_recenter_position;
|
||||
|
||||
return world_pointer_position - wanted_world_pointer_position;
|
||||
};
|
||||
|
||||
// One step is usually enough, the solution will continuously improve in the next frames
|
||||
glm::vec3 gui_position = imgui_ctx->layers()[0].position;
|
||||
float eps = 0.01;
|
||||
glm::vec3 obj = f(gui_position);
|
||||
glm::vec3 obj_dx = (f(gui_position + glm::vec3(eps, 0, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dy = (f(gui_position + glm::vec3(0, eps, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dz = (f(gui_position + glm::vec3(0, 0, eps)) - obj) / eps;
|
||||
|
||||
glm::mat3 jacobian{obj_dx, obj_dy, obj_dz};
|
||||
|
||||
gui_position -= glm::inverse(jacobian) * obj;
|
||||
|
||||
return gui_position;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Subsequent frames: find the GUI position that gives the correct world pointer position
|
||||
std::tie(controller, recenter_position, recenter_distance) = *recentering_context;
|
||||
|
||||
glm::vec3 controller_direction = -glm::column(glm::mat3_cast(aim->second), 2);
|
||||
glm::vec3 wanted_world_pointer_position = aim->first + controller_direction * recenter_distance;
|
||||
|
||||
// I'm sure there's an analytical solution but I can't be bothered to write it so
|
||||
// let's use a gradient descent instead
|
||||
auto f = [&](glm::vec3 new_gui_position) {
|
||||
auto q = compute_gui_orientation(head_position, new_gui_position);
|
||||
auto M = glm::mat3_cast(q); // plane-to-world transform
|
||||
|
||||
glm::vec3 world_pointer_position = new_gui_position + M * recenter_position;
|
||||
|
||||
return world_pointer_position - wanted_world_pointer_position;
|
||||
};
|
||||
|
||||
// One step is usually enough, the solution will continuously improve in the next frames
|
||||
glm::vec3 gui_position = imgui_ctx->layers()[0].position;
|
||||
float eps = 0.01;
|
||||
glm::vec3 obj = f(gui_position);
|
||||
glm::vec3 obj_dx = (f(gui_position + glm::vec3(eps, 0, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dy = (f(gui_position + glm::vec3(0, eps, 0)) - obj) / eps;
|
||||
glm::vec3 obj_dz = (f(gui_position + glm::vec3(0, 0, eps)) - obj) / eps;
|
||||
|
||||
glm::mat3 jacobian{obj_dx, obj_dy, obj_dz};
|
||||
|
||||
gui_position -= glm::inverse(jacobian) * obj;
|
||||
|
||||
return gui_position;
|
||||
gui_recenter_position.reset();
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<glm::vec3> scenes::lobby::check_recenter_gui(glm::vec3 head_position, glm::quat head_orientation)
|
||||
@@ -649,24 +612,26 @@ void scenes::lobby::render(const XrFrameState & frame_state)
|
||||
if (!new_gui_position and head_position)
|
||||
new_gui_position = check_recenter_action(frame_state.predictedDisplayTime, head_position->first);
|
||||
|
||||
if (left_hand and right_hand)
|
||||
if (application::get_hand_tracking_supported())
|
||||
{
|
||||
auto left = left_hand->locate(world_space, frame_state.predictedDisplayTime);
|
||||
auto right = right_hand->locate(world_space, frame_state.predictedDisplayTime);
|
||||
auto left = application::get_left_hand().locate(world_space, frame_state.predictedDisplayTime);
|
||||
auto right = application::get_right_hand().locate(world_space, frame_state.predictedDisplayTime);
|
||||
|
||||
hand_model::apply(world, left, right);
|
||||
|
||||
if (left and xr::hand_tracker::check_flags(*left, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
hide_left_controller = true;
|
||||
if (!new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(*left);
|
||||
}
|
||||
|
||||
if (right and xr::hand_tracker::check_flags(*right, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
{
|
||||
hide_right_controller = true;
|
||||
|
||||
if (not new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_left, left);
|
||||
|
||||
if (not new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(xr::spaces::palm_right, right);
|
||||
if (!new_gui_position)
|
||||
new_gui_position = check_recenter_gesture(*right);
|
||||
}
|
||||
}
|
||||
|
||||
if (head_position && new_gui_position)
|
||||
@@ -798,7 +763,7 @@ void scenes::lobby::on_focused()
|
||||
// assert(std::ranges::all_of(views, [height](const XrViewConfigurationView & view) { return view.recommendedImageRectHeight == height; }));
|
||||
|
||||
renderer.emplace(device, physical_device, queue, commandpool);
|
||||
loader.emplace(device, physical_device, queue, queue_family_index, renderer->get_default_material());
|
||||
loader.emplace(device, physical_device, queue, application::queue_family_index(), renderer->get_default_material());
|
||||
|
||||
lobby_entity = load_gltf("ground.gltf", layer_lobby).first;
|
||||
|
||||
@@ -835,6 +800,12 @@ void scenes::lobby::on_focused()
|
||||
xyz_axes_right_controller = load_gltf("xyz-arrows.glb", layer_controllers).first;
|
||||
#endif
|
||||
|
||||
if (application::get_hand_tracking_supported())
|
||||
{
|
||||
hand_model::add_hand(*this, XR_HAND_LEFT_EXT, "left-hand.glb", layer_controllers);
|
||||
hand_model::add_hand(*this, XR_HAND_RIGHT_EXT, "right-hand.glb", layer_controllers);
|
||||
}
|
||||
|
||||
recenter_left_action = get_action("recenter_left").first;
|
||||
recenter_right_action = get_action("recenter_right").first;
|
||||
|
||||
@@ -856,18 +827,20 @@ void scenes::lobby::on_focused()
|
||||
.haptic_output = get_action("right_haptic").first,
|
||||
},
|
||||
};
|
||||
|
||||
if (system.hand_tracking_supported())
|
||||
if (auto & hand = application::get_left_hand())
|
||||
{
|
||||
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
|
||||
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
|
||||
hand_model::add_hand(*this, XR_HAND_LEFT_EXT, "left-hand.glb", layer_controllers);
|
||||
hand_model::add_hand(*this, XR_HAND_RIGHT_EXT, "right-hand.glb", layer_controllers);
|
||||
imgui_inputs.push_back({.hand = &*left_hand});
|
||||
imgui_inputs.push_back({.hand = &*right_hand});
|
||||
imgui_inputs.push_back(
|
||||
{
|
||||
.hand = &hand,
|
||||
});
|
||||
}
|
||||
if (auto & hand = application::get_right_hand())
|
||||
{
|
||||
imgui_inputs.push_back(
|
||||
{
|
||||
.hand = &hand,
|
||||
});
|
||||
}
|
||||
|
||||
face_tracker = xr::make_face_tracker(instance, system, session);
|
||||
|
||||
// 0.4mm / pixel
|
||||
std::vector<imgui_context::viewport> vps{
|
||||
@@ -969,9 +942,6 @@ void scenes::lobby::on_unfocused()
|
||||
world.clear(); // Must be cleared before the renderer so that the descriptor sets are freed before their pools
|
||||
|
||||
input.reset();
|
||||
left_hand.reset();
|
||||
right_hand.reset();
|
||||
face_tracker.emplace<std::monostate>();
|
||||
|
||||
loader.reset();
|
||||
renderer.reset();
|
||||
|
||||
+4
-14
@@ -29,9 +29,7 @@
|
||||
#include "wivrn_config.h"
|
||||
#include "wivrn_discover.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/face_tracker.h"
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
@@ -67,11 +65,6 @@ class lobby : public scene_impl<lobby>
|
||||
|
||||
std::optional<imgui_context> imgui_ctx;
|
||||
|
||||
std::optional<xr::hand_tracker> left_hand;
|
||||
std::optional<xr::hand_tracker> right_hand;
|
||||
|
||||
xr::face_tracker face_tracker;
|
||||
|
||||
std::string selected_item;
|
||||
std::unique_ptr<asset> license;
|
||||
|
||||
@@ -101,10 +94,8 @@ class lobby : public scene_impl<lobby>
|
||||
|
||||
XrAction recenter_left_action = XR_NULL_HANDLE;
|
||||
XrAction recenter_right_action = XR_NULL_HANDLE;
|
||||
// std::optional<glm::vec3> gui_recenter_position;
|
||||
// std::optional<float> gui_recenter_distance;
|
||||
// Which controller is used for recentering, position of the pointed point in the GUI, in GUI axes, and distance between the controller and the pointed point during recentering
|
||||
std::optional<std::tuple<xr::spaces, glm::vec3, float>> recentering_context;
|
||||
std::optional<glm::vec3> gui_recenter_position;
|
||||
std::optional<float> gui_recenter_distance;
|
||||
bool recenter_gui = true;
|
||||
void move_gui(glm::vec3 head_position, glm::vec3 new_gui_position);
|
||||
|
||||
@@ -129,7 +120,6 @@ class lobby : public scene_impl<lobby>
|
||||
ImTextureID about_picture;
|
||||
ImTextureID default_icon;
|
||||
std::unordered_map<std::string, ImTextureID> app_icons;
|
||||
std::optional<XrTime> timestamp_start_application;
|
||||
|
||||
virtual_keyboard keyboard;
|
||||
|
||||
@@ -146,7 +136,7 @@ class lobby : public scene_impl<lobby>
|
||||
void draw_features_status(XrTime predicted_display_time);
|
||||
void gui_connecting(locked_notifiable<pin_request_data> & request);
|
||||
void gui_enter_pin(locked_notifiable<pin_request_data> & request);
|
||||
void gui_connected(XrTime predicted_display_time);
|
||||
void gui_connected();
|
||||
void gui_server_list();
|
||||
void gui_new_server();
|
||||
void gui_settings();
|
||||
@@ -162,7 +152,7 @@ class lobby : public scene_impl<lobby>
|
||||
void connect(const configuration::server_data & data);
|
||||
std::unique_ptr<wivrn_session> connect_to_session(wivrn_discover::service service, bool manual_connection);
|
||||
|
||||
std::optional<glm::vec3> check_recenter_gesture(xr::spaces space, const std::optional<std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT>> & joints);
|
||||
std::optional<glm::vec3> check_recenter_gesture(const std::array<xr::hand_tracker::joint, XR_HAND_JOINT_COUNT_EXT> & joints);
|
||||
std::optional<glm::vec3> check_recenter_action(XrTime predicted_display_time, glm::vec3 head_position);
|
||||
std::optional<glm::vec3> check_recenter_gui(glm::vec3 head_position, glm::quat head_orientation);
|
||||
|
||||
|
||||
+34
-68
@@ -35,13 +35,11 @@
|
||||
#include "utils/overloaded.h"
|
||||
#include "utils/ranges.h"
|
||||
#include "version.h"
|
||||
#include "xr/body_tracker.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <imspinner.h>
|
||||
#include <ranges>
|
||||
#include <spdlog/fmt/fmt.h>
|
||||
#include <string>
|
||||
@@ -248,7 +246,6 @@ void scenes::lobby::gui_connecting(locked_notifiable<pin_request_data> & pin_req
|
||||
if (next_scene)
|
||||
{
|
||||
current_tab = tab::connected;
|
||||
timestamp_start_application.reset();
|
||||
ImGui::CloseCurrentPopup();
|
||||
return;
|
||||
}
|
||||
@@ -379,7 +376,7 @@ void scenes::lobby::gui_enter_pin(locked_notifiable<pin_request_data> & pin_requ
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
void scenes::lobby::gui_connected(XrTime predicted_display_time)
|
||||
void scenes::lobby::gui_connected()
|
||||
{
|
||||
if (not next_scene)
|
||||
{
|
||||
@@ -404,17 +401,14 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time)
|
||||
|
||||
auto apps = next_scene->get_applications();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, {20, 20});
|
||||
if (apps->empty())
|
||||
if (apps->applications.empty())
|
||||
{
|
||||
CenterTextHV(_("Start an application on the server to start streaming."));
|
||||
}
|
||||
else
|
||||
{
|
||||
bool app_starting = timestamp_start_application and (predicted_display_time - *timestamp_start_application < 10'000'000'000);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, {20, 0});
|
||||
ImGui::BeginDisabled(app_starting);
|
||||
ImGui::BeginChild("Main", ImGui::GetWindowSize() - ImGui::GetCursorPos() - ImVec2(0, disconnect_size.y + 80), 0, app_starting ? ImGuiWindowFlags_NoScrollWithMouse : 0);
|
||||
ImGui::BeginChild("Main", ImGui::GetWindowSize() - ImGui::GetCursorPos() - ImVec2(0, disconnect_size.y + 80), 0);
|
||||
|
||||
ImGui::Indent(20);
|
||||
if (server_name.empty())
|
||||
@@ -433,7 +427,7 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time)
|
||||
ImGui::Indent((usable_window_width - icon_line_width) / 2);
|
||||
|
||||
auto t0 = std::chrono::steady_clock::now();
|
||||
for (const auto [index, app]: utils::enumerate(*apps))
|
||||
for (const auto [index, app]: utils::enumerate(apps->applications))
|
||||
{
|
||||
ImTextureID texture = [&]() -> ImTextureID {
|
||||
if (app.image.empty())
|
||||
@@ -464,11 +458,8 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time)
|
||||
}();
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, 0);
|
||||
if (icon(app.name + "##" + app.id, texture, {256, 256}, ImGuiButtonFlags_PressedOnClickRelease, {icon_width, 0}))
|
||||
{
|
||||
timestamp_start_application = predicted_display_time;
|
||||
if (icon(app.name + "##" + app.id, texture, {256, 256}, 0, {icon_width, 0}))
|
||||
next_scene->start_application(app.id);
|
||||
}
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
ImGui::PopStyleColor(); // ImGuiCol_Button
|
||||
|
||||
@@ -480,7 +471,7 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time)
|
||||
std::vector<std::pair<std::string, ImTextureID>> to_be_removed;
|
||||
for (const auto & [app_id, app_icon]: app_icons)
|
||||
{
|
||||
if (not std::ranges::contains(*apps, app_id, &scenes::stream::app::id))
|
||||
if (not std::ranges::contains(apps->applications, app_id, &to_headset::application_list::application::id))
|
||||
to_be_removed.emplace_back(app_id, app_icon);
|
||||
}
|
||||
for (const auto & [app_id, app_icon]: to_be_removed)
|
||||
@@ -491,26 +482,12 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time)
|
||||
|
||||
ScrollWhenDragging();
|
||||
ImGui::EndChild();
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (app_starting)
|
||||
{
|
||||
ImGui::SetCursorPos(ImGui::GetWindowSize() / 2 - ImVec2{200, 200} - ImGui::GetStyle().FramePadding);
|
||||
ImSpinner::SpinnerAng("App starting spinner",
|
||||
200, // Radius
|
||||
40, // Thickness
|
||||
ImColor{1.f, 1.f, 1.f, 1.f}, // Colour
|
||||
ImColor{1.f, 1.f, 1.f, 0.f}, // Background
|
||||
6, // Velocity
|
||||
0.75f * 2 * M_PI // Angle
|
||||
);
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(); // ImGuiStyleVar_WindowPadding
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
ImGui::SetCursorPos(ImGui::GetWindowSize() - disconnect_size - ImVec2{50, 50});
|
||||
ImGui::SetCursorPosX(ImGui::GetWindowSize().x - disconnect_size.x - 50);
|
||||
ImGui::SetCursorPosY(ImGui::GetWindowSize().y - disconnect_size.y - 50);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.2f, 0.2f, 0.40f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.2f, 0.2f, 1.00f));
|
||||
@@ -928,7 +905,7 @@ void scenes::lobby::gui_settings()
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
{
|
||||
ImGui::BeginDisabled(not system.hand_tracking_supported());
|
||||
ImGui::BeginDisabled(not application::get_hand_tracking_supported());
|
||||
bool enabled = config.check_feature(feature::hand_tracking);
|
||||
if (ImGui::Checkbox(_S("Enable hand tracking"), &enabled))
|
||||
{
|
||||
@@ -952,7 +929,7 @@ void scenes::lobby::gui_settings()
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
{
|
||||
ImGui::BeginDisabled(std::holds_alternative<std::monostate>(face_tracker));
|
||||
ImGui::BeginDisabled(not application::get_face_tracking_supported());
|
||||
bool enabled = config.check_feature(feature::face_tracking);
|
||||
if (ImGui::Checkbox(_S("Enable face tracking"), &enabled))
|
||||
{
|
||||
@@ -964,9 +941,8 @@ void scenes::lobby::gui_settings()
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
|
||||
auto body_tracker = system.body_tracker_supported();
|
||||
{
|
||||
ImGui::BeginDisabled(body_tracker == xr::body_tracker_type::none);
|
||||
ImGui::BeginDisabled(not application::get_body_tracking_supported());
|
||||
bool enabled = config.check_feature(feature::body_tracking);
|
||||
if (ImGui::Checkbox(_S("Enable body tracking"), &enabled))
|
||||
{
|
||||
@@ -981,14 +957,19 @@ void scenes::lobby::gui_settings()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (body_tracker == xr::body_tracker_type::fb)
|
||||
imgui_ctx->tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings,\notherwise body data will be guessed from controller and headset positions"));
|
||||
std::visit(utils::overloaded{
|
||||
[](auto &) {},
|
||||
[this](xr::fb_body_tracker &) {
|
||||
imgui_ctx->tooltip(_("Requires 'Hand and body tracking' to be enabled in the Quest movement tracking settings,\notherwise body data will be guessed from controller and headset positions"));
|
||||
},
|
||||
},
|
||||
application::get_body_tracker());
|
||||
}
|
||||
}
|
||||
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
}
|
||||
if (body_tracker == xr::body_tracker_type::fb)
|
||||
if (std::holds_alternative<xr::fb_body_tracker>(application::get_body_tracker()))
|
||||
{
|
||||
ImGui::BeginDisabled(not config.check_feature(feature::body_tracking));
|
||||
ImGui::Indent();
|
||||
@@ -1014,7 +995,7 @@ void scenes::lobby::gui_settings()
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
ImGui::BeginDisabled(system.passthrough_supported() == xr::passthrough_type::none);
|
||||
ImGui::BeginDisabled(passthrough_supported == xr::system::passthrough_type::no_passthrough);
|
||||
if (ImGui::Checkbox(_S("Enable video passthrough in lobby"), &config.passthrough_enabled))
|
||||
{
|
||||
setup_passthrough();
|
||||
@@ -1025,13 +1006,6 @@ void scenes::lobby::gui_settings()
|
||||
imgui_ctx->tooltip(_("This feature is not supported by your headset"));
|
||||
ImGui::EndDisabled();
|
||||
|
||||
{
|
||||
ImGui::Checkbox(_S("Enable in-stream window"), &config.enable_stream_gui);
|
||||
imgui_ctx->vibrate_on_hover();
|
||||
if (ImGui::IsItemHovered())
|
||||
imgui_ctx->tooltip(_("Enables the configuration window to be shown while the game is streaming.\nIf enabled, the window is activated by pressing both thumbsticks."));
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing
|
||||
}
|
||||
|
||||
@@ -1263,12 +1237,12 @@ void scenes::lobby::gui_first_run()
|
||||
item{
|
||||
.f = feature::face_tracking,
|
||||
.text = _S("Enable face tracking?"),
|
||||
.supported = not std::holds_alternative<std::monostate>(face_tracker),
|
||||
.supported = application::get_face_tracking_supported(),
|
||||
},
|
||||
item{
|
||||
.f = feature::body_tracking,
|
||||
.text = _S("Enable body tracking?"),
|
||||
.supported = system.body_tracker_supported() != xr::body_tracker_type::none,
|
||||
.supported = application::get_body_tracking_supported(),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1598,22 +1572,11 @@ static auto face_weights()
|
||||
return res;
|
||||
}
|
||||
|
||||
static const char * get_face_icon(XrTime predicted_display_time, xr::face_tracker & face_tracker)
|
||||
static const char * get_face_icon(XrTime predicted_display_time)
|
||||
{
|
||||
static const auto w = face_weights();
|
||||
wivrn::from_headset::tracking::fb_face2 expression;
|
||||
const char * result = nullptr;
|
||||
std::visit(utils::overloaded{
|
||||
[](std::monostate &) {},
|
||||
[&](xr::htc_face_tracker &) { result = ICON_FA_FACE_SMILE_WINK; },
|
||||
[&](auto & ft) {
|
||||
ft.get_weights(predicted_display_time, expression);
|
||||
},
|
||||
},
|
||||
face_tracker);
|
||||
|
||||
if (result)
|
||||
return result;
|
||||
std::get<xr::fb_face_tracker2>(application::get_face_tracker()).get_weights(predicted_display_time, expression);
|
||||
|
||||
if (not expression.is_valid)
|
||||
return ICON_FA_FACE_MEH;
|
||||
@@ -1656,7 +1619,7 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
|
||||
.icon_disabled = ICON_FA_MICROPHONE_SLASH,
|
||||
});
|
||||
|
||||
if (system.hand_tracking_supported())
|
||||
if (application::get_hand_tracking_supported())
|
||||
{
|
||||
items.push_back({
|
||||
.f = feature::hand_tracking,
|
||||
@@ -1677,18 +1640,21 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
|
||||
});
|
||||
}
|
||||
|
||||
if (not std::holds_alternative<std::monostate>(face_tracker))
|
||||
if (application::get_face_tracking_supported())
|
||||
{
|
||||
const char * icon_enabled = std::holds_alternative<xr::fb_face_tracker2>(application::get_face_tracker())
|
||||
? get_face_icon(predicted_display_time)
|
||||
: ICON_FA_FACE_KISS_WINK_HEART;
|
||||
items.push_back({
|
||||
.f = feature::face_tracking,
|
||||
.tooltip_enabled = _("Face tracking is enabled"),
|
||||
.tooltip_disabled = _("Face tracking is disabled"),
|
||||
.icon_enabled = get_face_icon(predicted_display_time, face_tracker),
|
||||
.icon_enabled = icon_enabled,
|
||||
.icon_disabled = ICON_FA_FACE_MEH_BLANK,
|
||||
});
|
||||
}
|
||||
|
||||
if (system.body_tracker_supported() != xr::body_tracker_type::none)
|
||||
if (application::get_body_tracking_supported())
|
||||
{
|
||||
items.push_back({
|
||||
.f = feature::body_tracking,
|
||||
@@ -1762,7 +1728,7 @@ void scenes::lobby::draw_features_status(XrTime predicted_display_time)
|
||||
if (*status.charge > 0.995)
|
||||
icon_nr = 5;
|
||||
else
|
||||
icon_nr = instance.now() / 500'000'000 % 5;
|
||||
icon_nr = application::now() / 500'000'000 % 5;
|
||||
}
|
||||
else
|
||||
icon_nr = std::round((*status.charge) * 4);
|
||||
@@ -1879,7 +1845,7 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 10);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {10, 10});
|
||||
ImGui::Begin("WiVRn", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
|
||||
gui_connected(predicted_display_time);
|
||||
gui_connected();
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar(3); // ImGuiStyleVar_WindowPadding, ImGuiStyleVar_FrameRounding, ImGuiStyleVar_FramePadding
|
||||
}
|
||||
@@ -1991,7 +1957,7 @@ std::vector<std::pair<int, XrCompositionLayerQuad>> scenes::lobby::draw_gui(XrTi
|
||||
|
||||
if (not is_gui_visible(*imgui_ctx, predicted_display_time))
|
||||
{
|
||||
if (system.hand_tracking_supported())
|
||||
if (application::get_hand_tracking_supported())
|
||||
display_recentering_tip(*imgui_ctx, _("Press the grip button or put your palm up\nto move the main window"));
|
||||
else
|
||||
display_recentering_tip(*imgui_ctx, _("Press the grip button to move the main window"));
|
||||
|
||||
@@ -389,14 +389,8 @@ void scenes::stream::gui_performance_metrics()
|
||||
|
||||
ImPlot::PopStyleColor(5);
|
||||
{
|
||||
ImGui::Text(
|
||||
"%s",
|
||||
fmt::format(
|
||||
_F("Estimated motion to photons latency: {}ms"),
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
tracking_control.lock()->max_offset)
|
||||
.count())
|
||||
.c_str());
|
||||
std::lock_guard lock(tracking_control_mutex);
|
||||
ImGui::Text("%s", fmt::format(_F("Estimated motion to photons latency: {}ms"), std::chrono::duration_cast<std::chrono::milliseconds>(tracking_control.max_offset).count()).c_str());
|
||||
|
||||
if (is_gui_interactable())
|
||||
ImGui::Text("%s", _S("Press the grip button to move the window"));
|
||||
@@ -423,12 +417,7 @@ void scenes::stream::gui_compact_view()
|
||||
f(_S("Upload"), 8 * compact_bandwidth_tx * 1e-6, "Mbit/s");
|
||||
f(_S("CPU time"), compact_cpu_time * 1000, "ms");
|
||||
f(_S("GPU time"), compact_gpu_time * 1000, "ms");
|
||||
f(_S("Motion to photon latency"),
|
||||
std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
tracking_control.lock()->max_offset)
|
||||
.count() *
|
||||
1e-3f,
|
||||
"ms");
|
||||
f(_S("Motion to photon latency"), std::chrono::duration_cast<std::chrono::microseconds>(tracking_control.max_offset).count() * 1e-3f, "ms");
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
@@ -626,8 +615,6 @@ static glm::vec4 compute_ray_limits(const XrPosef & pose, float margin = 0)
|
||||
|
||||
void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicted_display_period)
|
||||
{
|
||||
if (not(plots_toggle_1 and plots_toggle_2))
|
||||
return;
|
||||
bool interactable = true;
|
||||
XrSpace world_space = application::space(xr::spaces::world);
|
||||
auto views = session.locate_views(viewconfig, predicted_display_time, world_space).second;
|
||||
@@ -645,19 +632,6 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
break;
|
||||
}
|
||||
imgui_ctx->set_controllers_enabled(interactable);
|
||||
if (interactable)
|
||||
{
|
||||
if (system.hand_tracking_supported())
|
||||
{
|
||||
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
|
||||
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
left_hand.reset();
|
||||
right_hand.reset();
|
||||
}
|
||||
|
||||
if (gui_status != last_gui_status)
|
||||
{
|
||||
@@ -889,10 +863,10 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
bool hide_left_controller = false;
|
||||
bool hide_right_controller = false;
|
||||
|
||||
if (left_hand and right_hand)
|
||||
if (application::get_hand_tracking_supported())
|
||||
{
|
||||
auto left = left_hand->locate(world_space, predicted_display_time);
|
||||
auto right = right_hand->locate(world_space, predicted_display_time);
|
||||
auto left = application::get_left_hand().locate(world_space, predicted_display_time);
|
||||
auto right = application::get_right_hand().locate(world_space, predicted_display_time);
|
||||
|
||||
if (left and xr::hand_tracker::check_flags(*left, XR_SPACE_LOCATION_POSITION_TRACKED_BIT | XR_SPACE_LOCATION_POSITION_VALID_BIT, 0))
|
||||
hide_left_controller = true;
|
||||
|
||||
@@ -111,26 +111,8 @@ void scenes::stream::operator()(to_headset::application_list && apps)
|
||||
std::ranges::sort(apps.applications, [](auto & l, auto & r) {
|
||||
return una::casesens::collate_utf8(l.name, r.name) < 0;
|
||||
});
|
||||
|
||||
auto locked = applications.lock();
|
||||
|
||||
locked->clear();
|
||||
locked->reserve(apps.applications.size());
|
||||
for (const auto & i: apps.applications)
|
||||
{
|
||||
locked->push_back(app{
|
||||
.id = std::move(i.id),
|
||||
.name = std::move(i.name),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void scenes::stream::operator()(to_headset::application_icon && icon)
|
||||
{
|
||||
auto locked = applications.lock();
|
||||
|
||||
if (auto it = std::ranges::find(*locked, icon.id, &app::id); it != locked->end())
|
||||
it->image = std::move(icon.image);
|
||||
*locked = std::move(apps);
|
||||
}
|
||||
|
||||
void scenes::stream::start_application(std::string appid)
|
||||
|
||||
@@ -21,10 +21,7 @@
|
||||
#include "stream.h"
|
||||
#include "utils/overloaded.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/body_tracker.h"
|
||||
#include "xr/face_tracker.h"
|
||||
#include "xr/fb_body_tracker.h"
|
||||
#include "xr/to_string.h"
|
||||
#include <magic_enum.hpp>
|
||||
#include <ranges>
|
||||
#include <spdlog/spdlog.h>
|
||||
@@ -380,6 +377,7 @@ void scenes::stream::tracking()
|
||||
std::vector<from_headset::tracking> tracking;
|
||||
std::vector<from_headset::tracking> tracking_pool; // pre-allocated objects
|
||||
std::vector<from_headset::hand_tracking> hands;
|
||||
std::array<bool, 2> should_skip_simple_controllers{};
|
||||
std::vector<from_headset::body_tracking> body;
|
||||
std::vector<XrView> views;
|
||||
|
||||
@@ -387,14 +385,31 @@ void scenes::stream::tracking()
|
||||
std::vector<serialization_packet> packets;
|
||||
|
||||
const bool hand_tracking = config.check_feature(feature::hand_tracking);
|
||||
std::optional<xr::hand_tracker> left_hand;
|
||||
std::optional<xr::hand_tracker> right_hand;
|
||||
|
||||
const bool face_tracking = config.check_feature(feature::face_tracking);
|
||||
xr::face_tracker face_tracker;
|
||||
auto & face_tracker = application::get_face_tracker();
|
||||
if (face_tracking)
|
||||
{
|
||||
// We can't start the face tracking on application initialisation like we do for
|
||||
// other face trackers due to a Pico runtime bug where face tracking freezes when
|
||||
// the headset is taken off or the application is quit.
|
||||
if (auto * face_pico = std::get_if<xr::pico_face_tracker>(&face_tracker))
|
||||
face_pico->start();
|
||||
}
|
||||
|
||||
const bool body_tracking = config.check_feature(feature::body_tracking);
|
||||
xr::body_tracker body_tracker;
|
||||
auto & body_tracker = application::get_body_tracker();
|
||||
if (body_tracking)
|
||||
{
|
||||
if (auto * body_fb = std::get_if<xr::fb_body_tracker>(&body_tracker))
|
||||
{
|
||||
// TODO maybe handle reconnection better, if the settings are changed since
|
||||
// last connection to running server, the tracker count will mismatch and
|
||||
// stuff might break
|
||||
body_fb->stop();
|
||||
body_fb->start(config.fb_lower_body, config.fb_hip);
|
||||
}
|
||||
}
|
||||
|
||||
locate_spaces_functor locate_spaces{instance, world_space};
|
||||
|
||||
@@ -418,50 +433,11 @@ void scenes::stream::tracking()
|
||||
timer t(instance);
|
||||
int samples = 0;
|
||||
|
||||
auto control = *tracking_control.lock();
|
||||
bool interaction_profile_changed = this->interaction_profile_changed.exchange(false);
|
||||
|
||||
if (control.enabled[size_t(tid::left_hand)])
|
||||
to_headset::tracking_control control;
|
||||
{
|
||||
if (not left_hand and system.hand_tracking_supported())
|
||||
left_hand = session.create_hand_tracker(XR_HAND_LEFT_EXT);
|
||||
std::lock_guard lock(tracking_control_mutex);
|
||||
control = tracking_control;
|
||||
}
|
||||
else
|
||||
left_hand.reset();
|
||||
|
||||
if (control.enabled[size_t(tid::right_hand)])
|
||||
{
|
||||
if (not right_hand and system.hand_tracking_supported())
|
||||
right_hand = session.create_hand_tracker(XR_HAND_RIGHT_EXT);
|
||||
}
|
||||
else
|
||||
right_hand.reset();
|
||||
|
||||
if (face_tracking and control.enabled[size_t(tid::face)])
|
||||
{
|
||||
if (std::holds_alternative<std::monostate>(face_tracker))
|
||||
face_tracker = xr::make_face_tracker(instance, system, session);
|
||||
}
|
||||
else
|
||||
face_tracker.emplace<std::monostate>();
|
||||
|
||||
if (body_tracking and control.enabled[size_t(tid::generic_tracker)])
|
||||
{
|
||||
if (std::holds_alternative<std::monostate>(body_tracker))
|
||||
body_tracker = xr::make_body_tracker(
|
||||
instance,
|
||||
system,
|
||||
session,
|
||||
application::get_generic_trackers(),
|
||||
config.fb_lower_body,
|
||||
config.fb_hip);
|
||||
}
|
||||
else
|
||||
body_tracker.emplace<std::monostate>();
|
||||
|
||||
if (interaction_profile_changed)
|
||||
if (auto htc = std::get_if<xr::htc_body_tracker>(&body_tracker))
|
||||
htc->update_active();
|
||||
|
||||
XrDuration prediction = std::clamp<XrDuration>(control.max_offset.count(), 0, 80'000'000);
|
||||
auto period = std::max<XrDuration>(display_time_period.load(), 1'000'000);
|
||||
@@ -493,9 +469,9 @@ void scenes::stream::tracking()
|
||||
(Δt == 0 or Δt >= prediction - 2 * period))
|
||||
{
|
||||
last_hand_sample = t0;
|
||||
if (left_hand)
|
||||
if (control.enabled[size_t(tid::left_hand)])
|
||||
{
|
||||
auto joints = locate_hands(*left_hand, world_space, t0 + Δt);
|
||||
auto joints = locate_hands(application::get_left_hand(), world_space, t0 + Δt);
|
||||
hands.emplace_back(
|
||||
t0,
|
||||
t0 + Δt,
|
||||
@@ -503,9 +479,9 @@ void scenes::stream::tracking()
|
||||
joints);
|
||||
}
|
||||
|
||||
if (right_hand)
|
||||
if (control.enabled[size_t(tid::right_hand)])
|
||||
{
|
||||
auto joints = locate_hands(*right_hand, world_space, t0 + Δt);
|
||||
auto joints = locate_hands(application::get_right_hand(), world_space, t0 + Δt);
|
||||
hands.emplace_back(
|
||||
t0,
|
||||
t0 + Δt,
|
||||
@@ -522,33 +498,37 @@ void scenes::stream::tracking()
|
||||
}
|
||||
locate_spaces.resolve(session, t0 + Δt, packet.device_poses);
|
||||
|
||||
std::visit(utils::overloaded{
|
||||
[](std::monostate &) {},
|
||||
[&](auto & b) {
|
||||
if (t0 >= last_body_sample + period and
|
||||
(Δt == 0 or Δt >= prediction - 2 * period))
|
||||
{
|
||||
last_body_sample = t0;
|
||||
if (control.enabled[size_t(tid::generic_tracker)])
|
||||
if (body_tracking)
|
||||
std::visit(utils::overloaded{
|
||||
[](std::monostate &) {},
|
||||
[&](auto & b) {
|
||||
if (t0 >= last_body_sample + period and
|
||||
(Δt == 0 or Δt >= prediction - 2 * period))
|
||||
{
|
||||
body.push_back(from_headset::body_tracking{
|
||||
.production_timestamp = t0,
|
||||
.timestamp = t0 + Δt,
|
||||
.poses = b.locate_spaces(t0 + Δt, world_space),
|
||||
});
|
||||
last_body_sample = t0;
|
||||
if (control.enabled[size_t(tid::generic_tracker)])
|
||||
{
|
||||
body.push_back(from_headset::body_tracking{
|
||||
.production_timestamp = t0,
|
||||
.timestamp = t0 + Δt,
|
||||
.poses = b.locate_spaces(t0 + Δt, world_space),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
body_tracker);
|
||||
},
|
||||
},
|
||||
body_tracker);
|
||||
|
||||
std::visit(utils::overloaded{
|
||||
[](std::monostate &) {},
|
||||
[&](auto & ft) {
|
||||
ft.get_weights(t0 + Δt, packet.face.emplace<typename std::remove_reference_t<decltype(ft)>::packet_type>());
|
||||
},
|
||||
},
|
||||
face_tracker);
|
||||
if (face_tracking && control.enabled[size_t(tid::face)])
|
||||
{
|
||||
std::visit(utils::overloaded{
|
||||
[](std::monostate &) {},
|
||||
[&](auto & ft) {
|
||||
ft.get_weights(t0 + Δt, packet.face.emplace<typename std::remove_reference_t<decltype(ft)>::packet_type>());
|
||||
},
|
||||
},
|
||||
face_tracker);
|
||||
}
|
||||
}
|
||||
catch (const std::system_error & e)
|
||||
{
|
||||
@@ -649,17 +629,20 @@ void scenes::stream::tracking()
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto * face_pico = std::get_if<xr::pico_face_tracker>(&face_tracker))
|
||||
face_pico->stop();
|
||||
}
|
||||
|
||||
void scenes::stream::operator()(to_headset::tracking_control && packet)
|
||||
{
|
||||
auto locked = tracking_control.lock();
|
||||
std::lock_guard lock(tracking_control_mutex);
|
||||
auto m = size_t(to_headset::tracking_control::id::microphone);
|
||||
if (audio_handle)
|
||||
audio_handle->set_mic_state(packet.enabled[m]);
|
||||
|
||||
*locked = packet;
|
||||
locked->min_offset = std::min(locked->min_offset, locked->max_offset);
|
||||
tracking_control = packet;
|
||||
tracking_control.min_offset = std::min(tracking_control.min_offset, tracking_control.max_offset);
|
||||
}
|
||||
|
||||
static device_id derived_from(device_id target)
|
||||
@@ -680,7 +663,6 @@ static device_id derived_from(device_id target)
|
||||
|
||||
void scenes::stream::on_interaction_profile_changed(const XrEventDataInteractionProfileChanged &)
|
||||
{
|
||||
interaction_profile_changed = true;
|
||||
std::array path = {
|
||||
"/user/hand/left",
|
||||
"/user/hand/right",
|
||||
|
||||
@@ -1,4 +1,49 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2022 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||
* Copyright (C) 2022 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#version 450
|
||||
#extension GL_ARB_shading_language_include : require
|
||||
#define VSR 0
|
||||
#include "reprojection.glsl.inc"
|
||||
|
||||
#ifdef VERT_SHADER
|
||||
|
||||
layout (location = 0) in vec2 vPosition;
|
||||
layout (location = 1) in vec2 vUV;
|
||||
|
||||
layout(location = 0) out vec2 outUV;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
outUV = vUV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAG_SHADER
|
||||
|
||||
layout(set = 0, binding = 0) uniform sampler2D texSampler;
|
||||
|
||||
layout(location = 0) in vec2 inUV;
|
||||
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outColor = texture(texSampler, inUV).rgba;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#version 450
|
||||
#extension GL_ARB_shading_language_include : require
|
||||
#define VSR 1
|
||||
#include "reprojection.glsl.inc"
|
||||
|
||||
+3
-11
@@ -26,17 +26,9 @@ namespace utils
|
||||
template <typename Rng, typename T>
|
||||
bool contains(Rng && range, const T & value)
|
||||
{
|
||||
if constexpr (std::is_convertible_v<T, const char *> and
|
||||
std::is_convertible_v<typename std::decay_t<Rng>::value_type, const char *>)
|
||||
{
|
||||
auto it = std::find_if(range.begin(), range.end(), [&](const char * i) { return strcmp(i, value) == 0; });
|
||||
return it != range.end();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto it = std::find(range.begin(), range.end(), value);
|
||||
return it != range.end();
|
||||
}
|
||||
auto it = std::find(range.begin(), range.end(), value);
|
||||
|
||||
return it != range.end();
|
||||
}
|
||||
|
||||
// Check if all values of range2 are in range1
|
||||
|
||||
+5
-49
@@ -19,81 +19,37 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
|
||||
template <typename T, auto Deleter = nullptr>
|
||||
template <typename T, XrResult deleter(T)>
|
||||
class handle
|
||||
{
|
||||
public:
|
||||
// true if the deleter is provided when constructing the object
|
||||
// typically if it's from an OpenXR extension
|
||||
static constexpr bool runtime_deleter = Deleter == nullptr;
|
||||
|
||||
protected:
|
||||
static const inline T null_value = 0;
|
||||
|
||||
T id = null_value;
|
||||
[[no_unique_address]] std::conditional_t<runtime_deleter, XrResult (*)(T), std::monostate> deleter;
|
||||
|
||||
public:
|
||||
template <typename = void>
|
||||
requires(not runtime_deleter)
|
||||
handle()
|
||||
{}
|
||||
|
||||
template <typename = void>
|
||||
requires(not runtime_deleter)
|
||||
handle() {}
|
||||
handle(T id) :
|
||||
id(id)
|
||||
{}
|
||||
|
||||
template <typename = void>
|
||||
requires(runtime_deleter)
|
||||
handle(XrResult (*deleter)(T)) :
|
||||
deleter(deleter)
|
||||
{
|
||||
assert(deleter);
|
||||
}
|
||||
|
||||
template <typename = void>
|
||||
requires(runtime_deleter)
|
||||
handle(T id, XrResult (*deleter)(T)) :
|
||||
id(id), deleter(deleter)
|
||||
{
|
||||
assert(deleter);
|
||||
}
|
||||
|
||||
id(id) {}
|
||||
~handle()
|
||||
{
|
||||
if (id != null_value)
|
||||
{
|
||||
XrResult res = XR_SUCCESS;
|
||||
if constexpr (runtime_deleter)
|
||||
res = deleter(id);
|
||||
else
|
||||
res = Deleter(id);
|
||||
if (not XR_SUCCEEDED(res))
|
||||
spdlog::warn("Failed to destroy {}", typeid(T).name());
|
||||
}
|
||||
deleter(id);
|
||||
}
|
||||
|
||||
handle(handle && other) noexcept :
|
||||
id(other.id), deleter(other.deleter)
|
||||
id(other.id)
|
||||
{
|
||||
other.id = null_value;
|
||||
}
|
||||
|
||||
handle & operator=(handle && other) noexcept
|
||||
{
|
||||
if constexpr (runtime_deleter)
|
||||
std::swap(deleter, other.deleter);
|
||||
std::swap(id, other.id);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "body_tracker.h"
|
||||
|
||||
#include "xr/htc_exts.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/system.h"
|
||||
|
||||
xr::body_tracker_type xr::body_tracker_supported(xr::instance & instance, xr::system & system)
|
||||
{
|
||||
if (instance.has_extension(XR_FB_BODY_TRACKING_EXTENSION_NAME) and
|
||||
instance.has_extension(XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME) and
|
||||
instance.has_extension(XR_META_BODY_TRACKING_FIDELITY_EXTENSION_NAME))
|
||||
{
|
||||
auto fb_body_properties = system.fb_body_tracking_properties();
|
||||
if (fb_body_properties.supportsBodyTracking)
|
||||
return body_tracker_type::fb;
|
||||
}
|
||||
|
||||
if (instance.has_extension(XR_HTC_PATH_ENUMERATION_EXTENSION_NAME) and
|
||||
instance.has_extension(XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME))
|
||||
return body_tracker_type::htc;
|
||||
|
||||
if (instance.has_extension(XR_BD_BODY_TRACKING_EXTENSION_NAME))
|
||||
{
|
||||
auto bd_body_properties = system.bd_body_tracking_properties();
|
||||
if (bd_body_properties.supportsBodyTracking)
|
||||
return body_tracker_type::pico;
|
||||
}
|
||||
|
||||
return xr::body_tracker_type::none;
|
||||
}
|
||||
|
||||
xr::body_tracker xr::make_body_tracker(xr::instance & instance, xr::system & system, xr::session & session, std::vector<std::pair<XrPath, xr::space>> & generic_trackers, bool full_body, bool hips)
|
||||
{
|
||||
if (instance.has_extension(XR_FB_BODY_TRACKING_EXTENSION_NAME) and
|
||||
instance.has_extension(XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME) and
|
||||
instance.has_extension(XR_META_BODY_TRACKING_FIDELITY_EXTENSION_NAME))
|
||||
{
|
||||
auto fb_body_properties = system.fb_body_tracking_properties();
|
||||
if (fb_body_properties.supportsBodyTracking)
|
||||
return xr::body_tracker(std::in_place_type_t<xr::fb_body_tracker>(),
|
||||
instance,
|
||||
session,
|
||||
full_body,
|
||||
hips);
|
||||
}
|
||||
|
||||
if (not generic_trackers.empty())
|
||||
return xr::body_tracker(std::in_place_type_t<xr::htc_body_tracker>(),
|
||||
session,
|
||||
generic_trackers);
|
||||
|
||||
if (instance.has_extension(XR_BD_BODY_TRACKING_EXTENSION_NAME))
|
||||
{
|
||||
auto bd_body_properties = system.bd_body_tracking_properties();
|
||||
if (bd_body_properties.supportsBodyTracking)
|
||||
return xr::body_tracker(std::in_place_type_t<xr::pico_body_tracker>(),
|
||||
instance,
|
||||
session);
|
||||
}
|
||||
|
||||
return std::monostate();
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fb_body_tracker.h"
|
||||
#include "htc_body_tracker.h"
|
||||
#include "pico_body_tracker.h"
|
||||
#include "xr/system.h"
|
||||
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
namespace xr
|
||||
{
|
||||
|
||||
class instance;
|
||||
class session;
|
||||
|
||||
using body_tracker = std::variant<std::monostate, xr::fb_body_tracker, xr::htc_body_tracker, xr::pico_body_tracker>;
|
||||
|
||||
body_tracker make_body_tracker(xr::instance &, xr::system &, xr::session &, std::vector<std::pair<XrPath, xr::space>> & generic_trackers, bool full_body, bool hips);
|
||||
|
||||
body_tracker_type body_tracker_supported(xr::instance &, xr::system &);
|
||||
|
||||
} // namespace xr
|
||||
@@ -17,8 +17,8 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "xr.h"
|
||||
#include "xr/check.h"
|
||||
#include "xr/to_string.h"
|
||||
#include <system_error>
|
||||
|
||||
namespace
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "face_tracker.h"
|
||||
|
||||
#include "hardware.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/system.h"
|
||||
|
||||
xr::face_tracker_type xr::face_tracker_supported(xr::instance & instance, xr::system & system)
|
||||
{
|
||||
if (instance.has_extension(XR_FB_FACE_TRACKING2_EXTENSION_NAME))
|
||||
{
|
||||
auto properties = system.fb_face_tracking2_properties();
|
||||
if (properties.supportsVisualFaceTracking)
|
||||
return xr::face_tracker_type::fb;
|
||||
}
|
||||
|
||||
if (instance.has_extension(XR_HTC_FACIAL_TRACKING_EXTENSION_NAME))
|
||||
{
|
||||
auto properties = system.htc_face_tracking_properties();
|
||||
if (properties.supportEyeFacialTracking or properties.supportLipFacialTracking)
|
||||
return xr::face_tracker_type::htc;
|
||||
}
|
||||
|
||||
switch (guess_model())
|
||||
{
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
// The extension used by Pico is not published
|
||||
// it doesn't even need to be requested...
|
||||
if (instance.has_extension(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME) and
|
||||
system.eye_gaze_interaction_properties().supportsEyeGazeInteraction)
|
||||
return xr::face_tracker_type::pico;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return xr::face_tracker_type::none;
|
||||
}
|
||||
|
||||
xr::face_tracker xr::make_face_tracker(xr::instance & instance, xr::system & system, xr::session & session)
|
||||
{
|
||||
if (instance.has_extension(XR_FB_FACE_TRACKING2_EXTENSION_NAME))
|
||||
{
|
||||
auto properties = system.fb_face_tracking2_properties();
|
||||
if (properties.supportsVisualFaceTracking)
|
||||
return xr::face_tracker(std::in_place_type_t<xr::fb_face_tracker2>(), instance, session);
|
||||
}
|
||||
|
||||
if (instance.has_extension(XR_HTC_FACIAL_TRACKING_EXTENSION_NAME))
|
||||
{
|
||||
auto properties = system.htc_face_tracking_properties();
|
||||
if (properties.supportEyeFacialTracking or properties.supportLipFacialTracking)
|
||||
return xr::face_tracker(
|
||||
std::in_place_type_t<xr::htc_face_tracker>(),
|
||||
instance,
|
||||
session,
|
||||
properties.supportEyeFacialTracking,
|
||||
properties.supportLipFacialTracking);
|
||||
}
|
||||
|
||||
switch (guess_model())
|
||||
{
|
||||
case model::pico_4_pro:
|
||||
case model::pico_4_enterprise:
|
||||
// The extension used by Pico is not published
|
||||
// it doesn't even need to be requested...
|
||||
if (instance.has_extension(XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME) and
|
||||
system.eye_gaze_interaction_properties().supportsEyeGazeInteraction)
|
||||
return xr::face_tracker(std::in_place_type_t<xr::pico_face_tracker>(), instance, session);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return std::monostate();
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fb_face_tracker2.h"
|
||||
#include "htc_face_tracker.h"
|
||||
#include "pico_face_tracker.h"
|
||||
#include "xr/system.h"
|
||||
|
||||
#include <variant>
|
||||
|
||||
namespace xr
|
||||
{
|
||||
|
||||
class instance;
|
||||
class session;
|
||||
|
||||
using face_tracker = std::variant<std::monostate, xr::fb_face_tracker2, xr::htc_face_tracker, xr::pico_face_tracker>;
|
||||
|
||||
face_tracker make_face_tracker(xr::instance &, xr::system &, xr::session &);
|
||||
|
||||
face_tracker_type face_tracker_supported(xr::instance &, xr::system &);
|
||||
|
||||
} // namespace xr
|
||||
@@ -17,11 +17,10 @@
|
||||
*/
|
||||
|
||||
#include "fb_body_tracker.h"
|
||||
#include "application.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/meta_body_tracking_fidelity.h"
|
||||
#include "xr/session.h"
|
||||
#include "xr/to_string.h"
|
||||
#include "xr/xr.h"
|
||||
#include <ranges>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
@@ -40,33 +39,59 @@ std::vector<XrFullBodyJointMETA> xr::fb_body_tracker::get_whitelisted_joints(boo
|
||||
return {whitelisted_joints.begin(), whitelisted_joints.end()};
|
||||
}
|
||||
|
||||
xr::fb_body_tracker::fb_body_tracker(instance & inst, session & s, bool full_body, bool hip) :
|
||||
handle(inst.get_proc<PFN_xrDestroyBodyTrackerFB>("xrDestroyBodyTrackerFB")),
|
||||
xrRequestBodyTrackingFidelityMETA(inst.get_proc<PFN_xrRequestBodyTrackingFidelityMETA>("xrRequestBodyTrackingFidelityMETA")),
|
||||
xrLocateBodyJointsFB(inst.get_proc<PFN_xrLocateBodyJointsFB>("xrLocateBodyJointsFB")),
|
||||
full_body(full_body),
|
||||
hip(hip)
|
||||
xr::fb_body_tracker::fb_body_tracker(instance & inst, session & s) :
|
||||
s(s)
|
||||
{
|
||||
auto xrCreateBodyTrackerFB = inst.get_proc<PFN_xrCreateBodyTrackerFB>("xrCreateBodyTrackerFB");
|
||||
xrCreateBodyTrackerFB = inst.get_proc<PFN_xrCreateBodyTrackerFB>("xrCreateBodyTrackerFB");
|
||||
xrRequestBodyTrackingFidelityMETA = inst.get_proc<PFN_xrRequestBodyTrackingFidelityMETA>("xrRequestBodyTrackingFidelityMETA");
|
||||
xrLocateBodyJointsFB = inst.get_proc<PFN_xrLocateBodyJointsFB>("xrLocateBodyJointsFB");
|
||||
xrDestroyBodyTrackerFB = inst.get_proc<PFN_xrDestroyBodyTrackerFB>("xrDestroyBodyTrackerFB");
|
||||
}
|
||||
xr::fb_body_tracker::~fb_body_tracker()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
void xr::fb_body_tracker::start(bool full_body, bool hip)
|
||||
{
|
||||
assert(xrCreateBodyTrackerFB);
|
||||
this->full_body = full_body;
|
||||
this->hip = hip;
|
||||
|
||||
XrBodyTrackerCreateInfoFB create_info{
|
||||
.type = XR_TYPE_BODY_TRACKER_CREATE_INFO_FB,
|
||||
.bodyJointSet = full_body
|
||||
? XR_BODY_JOINT_SET_FULL_BODY_META
|
||||
: XR_BODY_JOINT_SET_DEFAULT_FB,
|
||||
.next = nullptr,
|
||||
};
|
||||
create_info.bodyJointSet = full_body
|
||||
? XR_BODY_JOINT_SET_FULL_BODY_META
|
||||
: XR_BODY_JOINT_SET_DEFAULT_FB;
|
||||
|
||||
CHECK_XR(xrCreateBodyTrackerFB(s, &create_info, &id));
|
||||
CHECK_XR(xrCreateBodyTrackerFB(s, &create_info, &handle));
|
||||
|
||||
// Enable IOBT.
|
||||
CHECK_XR(xrRequestBodyTrackingFidelityMETA(id, XR_BODY_TRACKING_FIDELITY_HIGH_META));
|
||||
CHECK_XR(xrRequestBodyTrackingFidelityMETA(handle, XR_BODY_TRACKING_FIDELITY_HIGH_META));
|
||||
|
||||
whitelisted_joints = get_whitelisted_joints(full_body, hip);
|
||||
}
|
||||
void xr::fb_body_tracker::stop()
|
||||
{
|
||||
full_body = false;
|
||||
hip = false;
|
||||
if (handle)
|
||||
{
|
||||
assert(xrDestroyBodyTrackerFB);
|
||||
CHECK_XR(xrDestroyBodyTrackerFB(std::exchange(handle, nullptr)));
|
||||
}
|
||||
}
|
||||
size_t xr::fb_body_tracker::count() const
|
||||
{
|
||||
const auto & config = application::get_config();
|
||||
return get_whitelisted_joints(config.fb_lower_body, config.fb_hip).size();
|
||||
}
|
||||
|
||||
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::fb_body_tracker::locate_spaces(XrTime time, XrSpace reference)
|
||||
{
|
||||
if (!id)
|
||||
if (!handle)
|
||||
return std::nullopt;
|
||||
|
||||
assert(xrLocateBodyJointsFB);
|
||||
@@ -86,7 +111,7 @@ std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_h
|
||||
.jointLocations = joints.data(),
|
||||
};
|
||||
|
||||
if (auto res = xrLocateBodyJointsFB(id, &locate_info, &joint_locations); !XR_SUCCEEDED(res))
|
||||
if (auto res = xrLocateBodyJointsFB(handle, &locate_info, &joint_locations); !XR_SUCCEEDED(res))
|
||||
{
|
||||
spdlog::warn("xrLocateBodyJointsFB returned {}", xr::to_string(res));
|
||||
return std::nullopt;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include "utils/handle.h"
|
||||
#include "xr/meta_body_tracking_fidelity.h"
|
||||
#include <array>
|
||||
#include <optional>
|
||||
@@ -31,10 +30,15 @@ namespace xr
|
||||
class instance;
|
||||
class session;
|
||||
|
||||
class fb_body_tracker : public utils::handle<XrBodyTrackerFB>
|
||||
class fb_body_tracker
|
||||
{
|
||||
XrSession s;
|
||||
XrBodyTrackerFB handle{};
|
||||
|
||||
PFN_xrCreateBodyTrackerFB xrCreateBodyTrackerFB{};
|
||||
PFN_xrRequestBodyTrackingFidelityMETA xrRequestBodyTrackingFidelityMETA{};
|
||||
PFN_xrLocateBodyJointsFB xrLocateBodyJointsFB{};
|
||||
PFN_xrDestroyBodyTrackerFB xrDestroyBodyTrackerFB{};
|
||||
|
||||
bool full_body{};
|
||||
bool hip{};
|
||||
@@ -55,7 +59,13 @@ public:
|
||||
};
|
||||
static std::vector<XrFullBodyJointMETA> get_whitelisted_joints(bool full_body, bool hip);
|
||||
|
||||
fb_body_tracker(instance & inst, session & s, bool full_body, bool hip);
|
||||
fb_body_tracker() = default;
|
||||
fb_body_tracker(instance & inst, session & s);
|
||||
~fb_body_tracker();
|
||||
|
||||
void start(bool lower_body, bool hip);
|
||||
void stop();
|
||||
size_t count() const;
|
||||
|
||||
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> locate_spaces(XrTime time, XrSpace reference);
|
||||
};
|
||||
|
||||
@@ -23,11 +23,18 @@
|
||||
#include <cstdint>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
xr::fb_face_tracker2::fb_face_tracker2(instance & inst, session & s) :
|
||||
handle(inst.get_proc<PFN_xrDestroyFaceTracker2FB>("xrDestroyFaceTracker2FB"))
|
||||
static PFN_xrDestroyFaceTracker2FB xrDestroyFaceTracker2FB{};
|
||||
|
||||
XrResult xr::destroy_fb_face_tracker2(XrFaceTracker2FB id)
|
||||
{
|
||||
return xrDestroyFaceTracker2FB(id);
|
||||
}
|
||||
|
||||
xr::fb_face_tracker2::fb_face_tracker2(instance & inst, session & s)
|
||||
{
|
||||
auto xrCreateFaceTracker2FB = inst.get_proc<PFN_xrCreateFaceTracker2FB>("xrCreateFaceTracker2FB");
|
||||
xrGetFaceExpressionWeights2FB = inst.get_proc<PFN_xrGetFaceExpressionWeights2FB>("xrGetFaceExpressionWeights2FB");
|
||||
xrDestroyFaceTracker2FB = inst.get_proc<PFN_xrDestroyFaceTracker2FB>("xrDestroyFaceTracker2FB");
|
||||
assert(xrCreateFaceTracker2FB);
|
||||
|
||||
XrFaceTrackingDataSource2FB data_sources[1];
|
||||
|
||||
@@ -27,12 +27,16 @@ namespace xr
|
||||
class instance;
|
||||
class session;
|
||||
|
||||
class fb_face_tracker2 : public utils::handle<XrFaceTracker2FB>
|
||||
XrResult destroy_fb_face_tracker2(XrFaceTracker2FB);
|
||||
|
||||
class fb_face_tracker2 : public utils::handle<XrFaceTracker2FB, destroy_fb_face_tracker2>
|
||||
{
|
||||
PFN_xrGetFaceExpressionWeights2FB xrGetFaceExpressionWeights2FB{};
|
||||
PFN_xrDestroyFaceTracker2FB xrDestroyFaceTracker2FB{};
|
||||
|
||||
public:
|
||||
using packet_type = wivrn::from_headset::tracking::fb_face2;
|
||||
fb_face_tracker2() = default;
|
||||
fb_face_tracker2(instance & inst, session & s);
|
||||
|
||||
void get_weights(XrTime time, packet_type & out_expressions);
|
||||
|
||||
@@ -23,12 +23,19 @@
|
||||
#include "xr/session.h"
|
||||
#include <cassert>
|
||||
|
||||
xr::hand_tracker::hand_tracker(instance & inst, session & session, const XrHandTrackerCreateInfoEXT & info) :
|
||||
handle(inst.get_proc<PFN_xrDestroyHandTrackerEXT>("xrDestroyHandTrackerEXT"))
|
||||
static PFN_xrDestroyHandTrackerEXT xrDestroyHandTrackerEXT{};
|
||||
|
||||
XrResult xr::destroy_hand_tracker(XrHandTrackerEXT id)
|
||||
{
|
||||
auto xrCreateHandTrackerEXT = inst.get_proc<PFN_xrCreateHandTrackerEXT>("xrCreateHandTrackerEXT");
|
||||
return xrDestroyHandTrackerEXT(id);
|
||||
}
|
||||
|
||||
xr::hand_tracker::hand_tracker(instance & inst, session & session, const XrHandTrackerCreateInfoEXT & info)
|
||||
{
|
||||
static auto xrCreateHandTrackerEXT = inst.get_proc<PFN_xrCreateHandTrackerEXT>("xrCreateHandTrackerEXT");
|
||||
assert(xrCreateHandTrackerEXT);
|
||||
xrLocateHandJointsEXT = inst.get_proc<PFN_xrLocateHandJointsEXT>("xrLocateHandJointsEXT");
|
||||
xrDestroyHandTrackerEXT = inst.get_proc<PFN_xrDestroyHandTrackerEXT>("xrDestroyHandTrackerEXT");
|
||||
CHECK_XR(xrCreateHandTrackerEXT(session, &info, &id));
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,14 @@ namespace xr
|
||||
{
|
||||
class instance;
|
||||
class session;
|
||||
XrResult destroy_hand_tracker(XrHandTrackerEXT);
|
||||
|
||||
class hand_tracker : public utils::handle<XrHandTrackerEXT>
|
||||
class hand_tracker : public utils::handle<XrHandTrackerEXT, destroy_hand_tracker>
|
||||
{
|
||||
PFN_xrLocateHandJointsEXT xrLocateHandJointsEXT{};
|
||||
|
||||
public:
|
||||
hand_tracker() = default;
|
||||
hand_tracker(instance & inst, session & session, const XrHandTrackerCreateInfoEXT & info);
|
||||
|
||||
using joint = std::pair<XrHandJointLocationEXT, XrHandJointVelocityEXT>;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Awzri <awzri@awzricat.com>
|
||||
* Copyright (C) 2025 Sapphire <imsapphire0@gmail.com>
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -20,7 +19,8 @@
|
||||
|
||||
#include "htc_body_tracker.h"
|
||||
#include "xr/details/enumerate.h"
|
||||
#include "xr/session.h"
|
||||
#include "xr/htc_exts.h"
|
||||
#include "xr/xr.h"
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
// Note: This utilizes extensions not present in the OpenXR spec!
|
||||
@@ -28,25 +28,11 @@
|
||||
// https://hub.vive.com/apidoc/api/VIVE.OpenXR.Tracker.ViveXRTracker.html
|
||||
// https://hub.vive.com/apidoc/api/VIVE.OpenXR.VivePathEnumerationHelper.xrEnumeratePathsForInteractionProfileHTCDelegate.html
|
||||
|
||||
xr::vive_xr_tracker::vive_xr_tracker(XrPath path, xr::space & space, XrSession session) :
|
||||
path(path),
|
||||
space(space)
|
||||
xr::vive_xr_tracker::vive_xr_tracker(xr::space && space) :
|
||||
space(std::move(space)) {}
|
||||
void xr::vive_xr_tracker::set_active(bool active)
|
||||
{
|
||||
update_active(session);
|
||||
}
|
||||
|
||||
void xr::vive_xr_tracker::update_active(XrSession session)
|
||||
{
|
||||
XrInputSourceLocalizedNameGetInfo get_info{
|
||||
.type = XR_TYPE_INPUT_SOURCE_LOCALIZED_NAME_GET_INFO,
|
||||
.next = nullptr,
|
||||
.sourcePath = path,
|
||||
.whichComponents = XR_INPUT_SOURCE_LOCALIZED_NAME_USER_PATH_BIT,
|
||||
};
|
||||
|
||||
auto role = xr::details::enumerate<char>(xrGetInputSourceLocalizedName, session, &get_info);
|
||||
|
||||
is_active = not role.contains("_");
|
||||
is_active = active;
|
||||
}
|
||||
bool xr::vive_xr_tracker::get_active() const
|
||||
{
|
||||
@@ -90,18 +76,63 @@ static wivrn::from_headset::body_tracking::pose locate_space(XrSpace space, XrSp
|
||||
return res;
|
||||
}
|
||||
|
||||
xr::htc_body_tracker::htc_body_tracker(session & s, std::vector<std::pair<XrPath, xr::space>> & trackers) :
|
||||
std::vector<std::string> xr::htc_body_tracker::get_roles()
|
||||
{
|
||||
auto paths = get_paths();
|
||||
std::vector<std::string> roles{};
|
||||
roles.reserve(paths.size());
|
||||
|
||||
for (auto & path: paths)
|
||||
{
|
||||
XrInputSourceLocalizedNameGetInfo get_info{
|
||||
.type = XR_TYPE_INPUT_SOURCE_LOCALIZED_NAME_GET_INFO,
|
||||
.next = nullptr,
|
||||
.sourcePath = path,
|
||||
.whichComponents = XR_INPUT_SOURCE_LOCALIZED_NAME_USER_PATH_BIT,
|
||||
};
|
||||
|
||||
roles.emplace_back(xr::details::enumerate<char>(xrGetInputSourceLocalizedName, s, &get_info));
|
||||
}
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
xr::htc_body_tracker::htc_body_tracker(instance & inst, session & s) :
|
||||
inst(&inst),
|
||||
s(s)
|
||||
{
|
||||
this->trackers.reserve(trackers.size());
|
||||
for (auto & [path, space]: trackers)
|
||||
this->trackers.emplace_back(path, space, s);
|
||||
xrEnumeratePathsForInteractionProfileHTC = inst.get_proc<PFN_xrEnumeratePathsForInteractionProfileHTC>("xrEnumeratePathsForInteractionProfileHTC");
|
||||
}
|
||||
|
||||
std::vector<XrPath> xr::htc_body_tracker::get_paths(XrPath user_path)
|
||||
{
|
||||
assert(xrEnumeratePathsForInteractionProfileHTC);
|
||||
XrPath tracker_profile = inst->string_to_path("/interaction_profiles/htc/vive_xr_tracker");
|
||||
|
||||
XrPathsForInteractionProfileEnumerateInfoHTC profile_info{
|
||||
.type = XR_TYPE_UNKNOWN,
|
||||
.next = nullptr,
|
||||
.interactionProfile = tracker_profile,
|
||||
.userPath = user_path,
|
||||
};
|
||||
return xr::details::enumerate<XrPath>(xrEnumeratePathsForInteractionProfileHTC, *inst, profile_info);
|
||||
}
|
||||
|
||||
void xr::htc_body_tracker::add(xr::space && space)
|
||||
{
|
||||
trackers.emplace_back(std::move(space));
|
||||
}
|
||||
size_t xr::htc_body_tracker::count() const
|
||||
{
|
||||
return trackers.size();
|
||||
}
|
||||
|
||||
void xr::htc_body_tracker::update_active()
|
||||
{
|
||||
for (auto & tracker: trackers)
|
||||
tracker.update_active(s);
|
||||
auto roles = get_roles();
|
||||
assert(roles.size() >= trackers.size());
|
||||
for (int i = 0; i < trackers.size(); i++)
|
||||
trackers[i].set_active(!roles[i].contains('_'));
|
||||
}
|
||||
|
||||
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> xr::htc_body_tracker::locate_spaces(XrTime time, XrSpace reference)
|
||||
@@ -110,7 +141,7 @@ std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_t
|
||||
|
||||
for (int i = 0; i < trackers.size(); i++)
|
||||
{
|
||||
auto & tracker = trackers[i];
|
||||
auto & tracker = trackers.at(i);
|
||||
wivrn::from_headset::body_tracking::pose pose{
|
||||
.pose = {},
|
||||
.flags = 0,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Awzri <awzri@awzricat.com>
|
||||
* Copyright (C) 2025 Sapphire <imsapphire0@gmail.com>
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -21,7 +20,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/htc_exts.h"
|
||||
#include "xr/space.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
@@ -33,24 +34,32 @@ class session;
|
||||
class vive_xr_tracker
|
||||
{
|
||||
bool is_active = false;
|
||||
XrPath path;
|
||||
xr::space & space;
|
||||
xr::space space;
|
||||
|
||||
public:
|
||||
vive_xr_tracker(XrPath path, xr::space & s, XrSession session);
|
||||
void update_active(XrSession session);
|
||||
vive_xr_tracker(xr::space && s);
|
||||
void set_active(bool active);
|
||||
bool get_active() const;
|
||||
XrSpace get_space() const;
|
||||
};
|
||||
|
||||
class htc_body_tracker
|
||||
{
|
||||
instance * inst;
|
||||
XrSession s;
|
||||
std::vector<vive_xr_tracker> trackers;
|
||||
|
||||
public:
|
||||
htc_body_tracker(session & s, std::vector<std::pair<XrPath, xr::space>> & trackers);
|
||||
PFN_xrEnumeratePathsForInteractionProfileHTC xrEnumeratePathsForInteractionProfileHTC{};
|
||||
|
||||
std::vector<std::string> get_roles();
|
||||
|
||||
public:
|
||||
htc_body_tracker() = default;
|
||||
htc_body_tracker(instance & inst, session & s);
|
||||
|
||||
std::vector<XrPath> get_paths(XrPath user_path = XR_NULL_PATH);
|
||||
void add(xr::space && space);
|
||||
size_t count() const;
|
||||
void update_active();
|
||||
std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses> locate_spaces(XrTime time, XrSpace reference);
|
||||
};
|
||||
|
||||
@@ -18,43 +18,53 @@
|
||||
*/
|
||||
|
||||
#include "htc_face_tracker.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/session.h"
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
static XrFacialTrackerHTC make_tracker(xr::instance & inst, xr::session & s, XrFacialTrackingTypeHTC type)
|
||||
xr::htc_face_tracker::htc_face_tracker(instance & inst, session & s, bool eye, bool lip) :
|
||||
s(s)
|
||||
{
|
||||
if (!eye && !lip)
|
||||
return;
|
||||
|
||||
xrCreateFacialTrackerHTC = inst.get_proc<PFN_xrCreateFacialTrackerHTC>("xrCreateFacialTrackerHTC");
|
||||
xrGetFacialExpressionsHTC = inst.get_proc<PFN_xrGetFacialExpressionsHTC>("xrGetFacialExpressionsHTC");
|
||||
xrDestroyFacialTrackerHTC = inst.get_proc<PFN_xrDestroyFacialTrackerHTC>("xrDestroyFacialTrackerHTC");
|
||||
|
||||
XrFacialTrackerCreateInfoHTC create_info{
|
||||
.type = XR_TYPE_FACIAL_TRACKER_CREATE_INFO_HTC,
|
||||
.facialTrackingType = type,
|
||||
.next = nullptr,
|
||||
};
|
||||
auto xrCreateFacialTrackerHTC = inst.get_proc<PFN_xrCreateFacialTrackerHTC>("xrCreateFacialTrackerHTC");
|
||||
XrFacialTrackerHTC id;
|
||||
CHECK_XR(xrCreateFacialTrackerHTC(s, &create_info, &id));
|
||||
return id;
|
||||
|
||||
if (eye)
|
||||
{
|
||||
create_info.facialTrackingType = XR_FACIAL_TRACKING_TYPE_EYE_DEFAULT_HTC;
|
||||
xrCreateFacialTrackerHTC(s, &create_info, &this->eye);
|
||||
}
|
||||
if (lip)
|
||||
{
|
||||
create_info.facialTrackingType = XR_FACIAL_TRACKING_TYPE_LIP_DEFAULT_HTC;
|
||||
xrCreateFacialTrackerHTC(s, &create_info, &this->lip);
|
||||
}
|
||||
}
|
||||
|
||||
static XrFacialTrackerHTC get_eye_tracker(xr::instance & inst, xr::session & s)
|
||||
xr::htc_face_tracker::~htc_face_tracker()
|
||||
{
|
||||
static XrFacialTrackerHTC res = make_tracker(inst, s, XR_FACIAL_TRACKING_TYPE_EYE_DEFAULT_HTC);
|
||||
return res;
|
||||
}
|
||||
static XrFacialTrackerHTC get_lip_tracker(xr::instance & inst, xr::session & s)
|
||||
{
|
||||
static XrFacialTrackerHTC res = make_tracker(inst, s, XR_FACIAL_TRACKING_TYPE_LIP_DEFAULT_HTC);
|
||||
return res;
|
||||
}
|
||||
if (!xrDestroyFacialTrackerHTC)
|
||||
return;
|
||||
|
||||
xr::htc_face_tracker::htc_face_tracker(instance & inst, session & s, bool eye, bool lip) :
|
||||
xrGetFacialExpressionsHTC(inst.get_proc<PFN_xrGetFacialExpressionsHTC>("xrGetFacialExpressionsHTC")),
|
||||
eye(eye ? get_eye_tracker(inst, s) : XR_NULL_HANDLE),
|
||||
lip(lip ? get_lip_tracker(inst, s) : XR_NULL_HANDLE)
|
||||
{
|
||||
if (eye)
|
||||
CHECK_XR(xrDestroyFacialTrackerHTC(std::exchange(eye, nullptr)));
|
||||
if (lip)
|
||||
CHECK_XR(xrDestroyFacialTrackerHTC(std::exchange(lip, nullptr)));
|
||||
}
|
||||
|
||||
void xr::htc_face_tracker::get_weights(XrTime time, packet_type & out_expressions)
|
||||
{
|
||||
assert(xrGetFacialExpressionsHTC);
|
||||
if (!(eye || lip) || !xrGetFacialExpressionsHTC)
|
||||
return;
|
||||
|
||||
XrFacialExpressionsHTC expressions{
|
||||
.type = XR_TYPE_FACIAL_EXPRESSIONS_HTC,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "utils/handle.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
@@ -29,13 +30,18 @@ class session;
|
||||
|
||||
class htc_face_tracker
|
||||
{
|
||||
PFN_xrGetFacialExpressionsHTC xrGetFacialExpressionsHTC;
|
||||
XrFacialTrackerHTC eye;
|
||||
XrFacialTrackerHTC lip;
|
||||
XrSession s;
|
||||
XrFacialTrackerHTC eye{};
|
||||
XrFacialTrackerHTC lip{};
|
||||
PFN_xrCreateFacialTrackerHTC xrCreateFacialTrackerHTC{};
|
||||
PFN_xrGetFacialExpressionsHTC xrGetFacialExpressionsHTC{};
|
||||
PFN_xrDestroyFacialTrackerHTC xrDestroyFacialTrackerHTC{};
|
||||
|
||||
public:
|
||||
using packet_type = wivrn::from_headset::tracking::htc_face;
|
||||
htc_face_tracker() = default;
|
||||
htc_face_tracker(instance & inst, session & s, bool eye, bool lip);
|
||||
~htc_face_tracker();
|
||||
|
||||
void get_weights(XrTime time, packet_type & out_expressions);
|
||||
};
|
||||
|
||||
+1
-16
@@ -19,9 +19,8 @@
|
||||
|
||||
#include "instance.h"
|
||||
|
||||
#include "xr.h"
|
||||
#include "xr/details/enumerate.h"
|
||||
#include "xr/htc_exts.h"
|
||||
#include "xr/to_string.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
@@ -285,20 +284,6 @@ XrPath xr::instance::string_to_path(const std::string & path)
|
||||
return p;
|
||||
}
|
||||
|
||||
std::vector<XrPath> xr::instance::enumerate_paths_for_interaction_profile(XrPath interaction_profile, XrPath user_path)
|
||||
{
|
||||
assert(has_extension(XR_HTC_PATH_ENUMERATION_EXTENSION_NAME));
|
||||
static auto xrEnumeratePathsForInteractionProfileHTC = get_proc<PFN_xrEnumeratePathsForInteractionProfileHTC>("xrEnumeratePathsForInteractionProfileHTC");
|
||||
|
||||
XrPathsForInteractionProfileEnumerateInfoHTC profile_info{
|
||||
.type = XR_TYPE_UNKNOWN,
|
||||
.next = nullptr,
|
||||
.interactionProfile = interaction_profile,
|
||||
.userPath = user_path,
|
||||
};
|
||||
return xr::details::enumerate<XrPath>(xrEnumeratePathsForInteractionProfileHTC, id, profile_info);
|
||||
}
|
||||
|
||||
bool xr::instance::poll_event(xr::event & buffer)
|
||||
{
|
||||
buffer.header.type = XR_TYPE_EVENT_DATA_BUFFER;
|
||||
|
||||
@@ -90,8 +90,6 @@ public:
|
||||
XrPath string_to_path(const std::string & path);
|
||||
std::string path_to_string(XrPath path);
|
||||
|
||||
std::vector<XrPath> enumerate_paths_for_interaction_profile(XrPath interaction_profile, XrPath user_path = XR_NULL_PATH);
|
||||
|
||||
void suggest_bindings(const std::string & interaction_profile,
|
||||
std::vector<XrActionSuggestedBinding> & bindings);
|
||||
|
||||
|
||||
@@ -23,9 +23,27 @@
|
||||
#include "xr/check.h"
|
||||
#include "xr/instance.h"
|
||||
|
||||
xr::passthrough_layer_fb::passthrough_layer_fb(instance & inst, session & s, const XrPassthroughLayerCreateInfoFB & info) :
|
||||
handle(inst.get_proc<PFN_xrDestroyPassthroughLayerFB>("xrDestroyPassthroughLayerFB"))
|
||||
static PFN_xrDestroyPassthroughLayerFB xrDestroyPassthroughLayerFB{};
|
||||
static PFN_xrDestroyPassthroughFB xrDestroyPassthroughFB{};
|
||||
static PFN_xrDestroyPassthroughHTC xrDestroyPassthroughHTC{};
|
||||
|
||||
XrResult xr::destroy_passthrough_layer_fb(XrPassthroughLayerFB id)
|
||||
{
|
||||
return xrDestroyPassthroughLayerFB(id);
|
||||
}
|
||||
XrResult xr::destroy_passthrough_fb(XrPassthroughFB id)
|
||||
{
|
||||
return xrDestroyPassthroughFB(id);
|
||||
}
|
||||
XrResult xr::destroy_passthrough_htc(XrPassthroughHTC id)
|
||||
{
|
||||
return xrDestroyPassthroughHTC(id);
|
||||
}
|
||||
|
||||
xr::passthrough_layer_fb::passthrough_layer_fb(instance & inst, session & s, const XrPassthroughLayerCreateInfoFB & info)
|
||||
{
|
||||
xrDestroyPassthroughLayerFB = inst.get_proc<PFN_xrDestroyPassthroughLayerFB>("xrDestroyPassthroughLayerFB");
|
||||
|
||||
PFN_xrCreatePassthroughLayerFB xrCreatePassthroughLayerFB = inst.get_proc<PFN_xrCreatePassthroughLayerFB>("xrCreatePassthroughLayerFB");
|
||||
CHECK_XR(xrCreatePassthroughLayerFB(s, &info, &id));
|
||||
}
|
||||
@@ -33,6 +51,7 @@ xr::passthrough_layer_fb::passthrough_layer_fb(instance & inst, session & s, con
|
||||
static XrPassthroughFB create_passthrough_fb(xr::instance & inst, xr::session & s)
|
||||
{
|
||||
PFN_xrCreatePassthroughFB xrCreatePassthroughFB = inst.get_proc<PFN_xrCreatePassthroughFB>("xrCreatePassthroughFB");
|
||||
xrDestroyPassthroughFB = inst.get_proc<PFN_xrDestroyPassthroughFB>("xrDestroyPassthroughFB");
|
||||
|
||||
XrPassthroughFB id;
|
||||
XrPassthroughCreateInfoFB info{
|
||||
@@ -45,7 +64,7 @@ static XrPassthroughFB create_passthrough_fb(xr::instance & inst, xr::session &
|
||||
}
|
||||
|
||||
xr::passthrough_fb::passthrough_fb(instance & inst, session & s) :
|
||||
handle(create_passthrough_fb(inst, s), inst.get_proc<PFN_xrDestroyPassthroughFB>("xrDestroyPassthroughFB")),
|
||||
utils::handle<XrPassthroughFB, destroy_passthrough_fb>(create_passthrough_fb(inst, s)),
|
||||
passthrough_layer(inst, s, XrPassthroughLayerCreateInfoFB{
|
||||
.type = XR_TYPE_PASSTHROUGH_LAYER_CREATE_INFO_FB,
|
||||
.passthrough = id,
|
||||
@@ -79,10 +98,10 @@ void xr::passthrough_fb::pause()
|
||||
CHECK_XR(xrPassthroughPauseFB(id));
|
||||
}
|
||||
|
||||
xr::passthrough_htc::passthrough_htc(instance & inst, session & s) :
|
||||
handle(inst.get_proc<PFN_xrDestroyPassthroughHTC>("xrDestroyPassthroughHTC"))
|
||||
xr::passthrough_htc::passthrough_htc(instance & inst, session & s)
|
||||
{
|
||||
PFN_xrCreatePassthroughHTC xrCreatePassthroughHTC = inst.get_proc<PFN_xrCreatePassthroughHTC>("xrCreatePassthroughHTC");
|
||||
xrDestroyPassthroughHTC = inst.get_proc<PFN_xrDestroyPassthroughHTC>("xrDestroyPassthroughHTC");
|
||||
|
||||
XrPassthroughCreateInfoHTC info{
|
||||
.type = XR_TYPE_PASSTHROUGH_CREATE_INFO_HTC,
|
||||
|
||||
@@ -28,13 +28,17 @@ namespace xr
|
||||
class instance;
|
||||
class session;
|
||||
|
||||
class passthrough_layer_fb : public utils::handle<XrPassthroughLayerFB>
|
||||
XrResult destroy_passthrough_layer_fb(XrPassthroughLayerFB);
|
||||
XrResult destroy_passthrough_fb(XrPassthroughFB);
|
||||
XrResult destroy_passthrough_htc(XrPassthroughHTC);
|
||||
|
||||
class passthrough_layer_fb : public utils::handle<XrPassthroughLayerFB, destroy_passthrough_layer_fb>
|
||||
{
|
||||
public:
|
||||
passthrough_layer_fb(instance &, session &, const XrPassthroughLayerCreateInfoFB &);
|
||||
};
|
||||
|
||||
class passthrough_fb : public utils::handle<XrPassthroughFB>
|
||||
class passthrough_fb : public utils::handle<XrPassthroughFB, destroy_passthrough_fb>
|
||||
{
|
||||
PFN_xrPassthroughStartFB xrPassthroughStartFB{};
|
||||
PFN_xrPassthroughPauseFB xrPassthroughPauseFB{};
|
||||
@@ -55,7 +59,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class passthrough_htc : public utils::handle<XrPassthroughHTC>
|
||||
class passthrough_htc : public utils::handle<XrPassthroughHTC, destroy_passthrough_htc>
|
||||
{
|
||||
XrCompositionLayerPassthroughHTC composition_layer;
|
||||
|
||||
|
||||
@@ -18,15 +18,19 @@
|
||||
|
||||
#include "pico_body_tracker.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/session.h"
|
||||
#include "xr/to_string.h"
|
||||
#include "xr/xr.h"
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
static_assert(xr::pico_body_tracker::joint_whitelist.size() <= wivrn::from_headset::body_tracking::max_tracked_poses);
|
||||
|
||||
xr::pico_body_tracker::pico_body_tracker(instance & inst, session & s) :
|
||||
handle(inst.get_proc<PFN_xrDestroyBodyTrackerBD>("xrDestroyBodyTrackerBD"))
|
||||
static PFN_xrDestroyBodyTrackerBD xrDestroyBodyTrackerBD{};
|
||||
|
||||
XrResult xr::destroy_pico_body_tracker(XrBodyTrackerBD id)
|
||||
{
|
||||
return xrDestroyBodyTrackerBD(id);
|
||||
}
|
||||
|
||||
xr::pico_body_tracker::pico_body_tracker(instance & inst, session & s)
|
||||
{
|
||||
auto xrCreateBodyTrackerBD = inst.get_proc<PFN_xrCreateBodyTrackerBD>("xrCreateBodyTrackerBD");
|
||||
xrLocateBodyJointsBD = inst.get_proc<PFN_xrLocateBodyJointsBD>("xrLocateBodyJointsBD");
|
||||
@@ -41,6 +45,10 @@ xr::pico_body_tracker::pico_body_tracker(instance & inst, session & s) :
|
||||
CHECK_XR(xrCreateBodyTrackerBD(s, &create_info, &id));
|
||||
}
|
||||
|
||||
size_t xr::pico_body_tracker::count() const
|
||||
{
|
||||
return joint_whitelist.size();
|
||||
}
|
||||
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> xr::pico_body_tracker::locate_spaces(XrTime time, XrSpace reference)
|
||||
{
|
||||
if (!xrLocateBodyJointsBD)
|
||||
|
||||
@@ -30,7 +30,9 @@ namespace xr
|
||||
class instance;
|
||||
class session;
|
||||
|
||||
class pico_body_tracker : public utils::handle<XrBodyTrackerBD>
|
||||
XrResult destroy_pico_body_tracker(XrBodyTrackerBD);
|
||||
|
||||
class pico_body_tracker : public utils::handle<XrBodyTrackerBD, destroy_pico_body_tracker>
|
||||
{
|
||||
PFN_xrLocateBodyJointsBD xrLocateBodyJointsBD{};
|
||||
|
||||
@@ -46,8 +48,10 @@ public:
|
||||
XR_BODY_JOINT_RIGHT_FOOT_BD,
|
||||
};
|
||||
|
||||
pico_body_tracker() = default;
|
||||
pico_body_tracker(instance & inst, session & s);
|
||||
|
||||
size_t count() const;
|
||||
std::optional<std::array<wivrn::from_headset::body_tracking::pose, wivrn::from_headset::body_tracking::max_tracked_poses>> locate_spaces(XrTime time, XrSpace reference);
|
||||
};
|
||||
} // namespace xr
|
||||
|
||||
+124
-135
@@ -18,163 +18,152 @@
|
||||
*/
|
||||
|
||||
#include "pico_face_tracker.h"
|
||||
|
||||
#include "spdlog/common.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/pico_eye_types.h"
|
||||
#include "xr/pico_eye_types_reflection.h"
|
||||
#include "xr/session.h"
|
||||
#include "xr/to_string.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
struct xr::pico_face_tracker::impl
|
||||
xr::pico_face_tracker::pico_face_tracker(instance & inst, session & s_) :
|
||||
s(s_)
|
||||
{
|
||||
const XrSession s;
|
||||
const PFN_xrStopEyeTrackingPICO xrStopEyeTrackingPICO;
|
||||
const PFN_xrGetFaceTrackingDataPICO xrGetFaceTrackingDataPICO;
|
||||
xrStartEyeTrackingPICO = inst.get_proc<PFN_xrStartEyeTrackingPICO>("xrStartEyeTrackingPICO");
|
||||
xrStopEyeTrackingPICO = inst.get_proc<PFN_xrStopEyeTrackingPICO>("xrStopEyeTrackingPICO");
|
||||
xrSetTrackingModePICO = inst.get_proc<PFN_xrSetTrackingModePICO>("xrSetTrackingModePICO");
|
||||
xrGetFaceTrackingDataPICO = inst.get_proc<PFN_xrGetFaceTrackingDataPICO>("xrGetFaceTrackingDataPICO");
|
||||
}
|
||||
xr::pico_face_tracker::~pico_face_tracker()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
impl(instance & inst, session & s) :
|
||||
s(s),
|
||||
xrStopEyeTrackingPICO(inst.get_proc<PFN_xrStopEyeTrackingPICO>("xrStopEyeTrackingPICO")),
|
||||
xrGetFaceTrackingDataPICO(inst.get_proc<PFN_xrGetFaceTrackingDataPICO>("xrGetFaceTrackingDataPICO"))
|
||||
void xr::pico_face_tracker::start()
|
||||
{
|
||||
if (started)
|
||||
throw std::invalid_argument("face tracking already started");
|
||||
|
||||
CHECK_XR(xrStartEyeTrackingPICO(s));
|
||||
CHECK_XR(xrSetTrackingModePICO(s, XR_TRACKING_MODE_FACE_BIT_PICO));
|
||||
started = true;
|
||||
}
|
||||
void xr::pico_face_tracker::stop()
|
||||
{
|
||||
if (!started)
|
||||
return;
|
||||
|
||||
if (auto res = xrStopEyeTrackingPICO(s, XR_TRACKING_MODE_FACE_BIT_PICO); !XR_SUCCEEDED(res))
|
||||
spdlog::warn("Failed to deactivate face tracking: {}", xr::to_string(res));
|
||||
|
||||
started = false;
|
||||
}
|
||||
|
||||
void xr::pico_face_tracker::get_weights(XrTime time, wivrn::from_headset::tracking::fb_face2 & out_expressions)
|
||||
{
|
||||
out_expressions.is_valid = false;
|
||||
out_expressions.is_eye_following_blendshapes_valid = false;
|
||||
|
||||
if (!started or !xrGetFaceTrackingDataPICO)
|
||||
return;
|
||||
|
||||
XrFaceTrackingDataPICO face_tracking{.time = 0};
|
||||
|
||||
if (auto res = xrGetFaceTrackingDataPICO(s, time, XR_GET_FACE_DATA_DEFAULT_PICO, &face_tracking); !XR_SUCCEEDED(res))
|
||||
{
|
||||
auto xrStartEyeTrackingPICO = inst.get_proc<PFN_xrStartEyeTrackingPICO>("xrStartEyeTrackingPICO");
|
||||
auto xrSetTrackingModePICO = inst.get_proc<PFN_xrSetTrackingModePICO>("xrSetTrackingModePICO");
|
||||
CHECK_XR(xrStartEyeTrackingPICO(s));
|
||||
CHECK_XR(xrSetTrackingModePICO(s, XR_TRACKING_MODE_FACE_BIT_PICO));
|
||||
spdlog::warn("Unable to get face tracking data: xrGetFaceTrackingDataPICO returned {}", xr::to_string(res));
|
||||
return;
|
||||
}
|
||||
|
||||
~impl()
|
||||
{
|
||||
if (auto res = xrStopEyeTrackingPICO(s, XR_TRACKING_MODE_FACE_BIT_PICO); not XR_SUCCEEDED(res))
|
||||
spdlog::warn("Failed to deactivate face tracking: {}", xr::to_string(res));
|
||||
}
|
||||
|
||||
void get_weights(XrTime time, wivrn::from_headset::tracking::fb_face2 & out_expressions)
|
||||
{
|
||||
out_expressions.is_valid = false;
|
||||
out_expressions.is_eye_following_blendshapes_valid = false;
|
||||
|
||||
XrFaceTrackingDataPICO face_tracking{.time = 0};
|
||||
|
||||
if (auto res = xrGetFaceTrackingDataPICO(s, time, XR_GET_FACE_DATA_DEFAULT_PICO, &face_tracking); !XR_SUCCEEDED(res))
|
||||
{
|
||||
spdlog::warn("Unable to get face tracking data: xrGetFaceTrackingDataPICO returned {}", xr::to_string(res));
|
||||
return;
|
||||
}
|
||||
|
||||
if (face_tracking.time == 0)
|
||||
return;
|
||||
if (face_tracking.time == 0)
|
||||
return;
|
||||
|
||||
#define MAP_EXPRESSION(fb, pico) \
|
||||
out_expressions.weights[fb] = face_tracking.blendShapeWeight[pico];
|
||||
|
||||
// Map the blendshapes.
|
||||
out_expressions.weights.fill(0.f);
|
||||
out_expressions.confidences.fill(1.f);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_BROW_LOWERER_L_FB, XR_BS_BROWDOWN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_BROW_LOWERER_R_FB, XR_BS_BROWDOWN_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_CHEEK_PUFF_L_FB, XR_BS_CHEEKPUFF_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_CHEEK_PUFF_R_FB, XR_BS_CHEEKPUFF_PICO);
|
||||
// XR_FACE_EXPRESSION2_CHEEK_RAISER_L_FB
|
||||
// XR_FACE_EXPRESSION2_CHEEK_RAISER_R_FB
|
||||
// XR_FACE_EXPRESSION2_CHEEK_SUCK_L_FB
|
||||
// XR_FACE_EXPRESSION2_CHEEK_SUCK_R_FB
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_CHIN_RAISER_B_FB, XR_BS_MOUTHSHRUGLOWER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_CHIN_RAISER_T_FB, XR_BS_MOUTHSHRUGUPPER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_DIMPLER_L_FB, XR_BS_MOUTHDIMPLE_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_DIMPLER_R_FB, XR_BS_MOUTHDIMPLE_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_CLOSED_L_FB, XR_BS_EYEBLINK_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_CLOSED_R_FB, XR_BS_EYEBLINK_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_DOWN_L_FB, XR_BS_EYELOOKDOWN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_DOWN_R_FB, XR_BS_EYELOOKDOWN_R_PICO);
|
||||
// Map the blendshapes.
|
||||
out_expressions.weights.fill(0.f);
|
||||
out_expressions.confidences.fill(1.f);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_BROW_LOWERER_L_FB, XR_BS_BROWDOWN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_BROW_LOWERER_R_FB, XR_BS_BROWDOWN_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_CHEEK_PUFF_L_FB, XR_BS_CHEEKPUFF_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_CHEEK_PUFF_R_FB, XR_BS_CHEEKPUFF_PICO);
|
||||
// XR_FACE_EXPRESSION2_CHEEK_RAISER_L_FB
|
||||
// XR_FACE_EXPRESSION2_CHEEK_RAISER_R_FB
|
||||
// XR_FACE_EXPRESSION2_CHEEK_SUCK_L_FB
|
||||
// XR_FACE_EXPRESSION2_CHEEK_SUCK_R_FB
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_CHIN_RAISER_B_FB, XR_BS_MOUTHSHRUGLOWER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_CHIN_RAISER_T_FB, XR_BS_MOUTHSHRUGUPPER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_DIMPLER_L_FB, XR_BS_MOUTHDIMPLE_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_DIMPLER_R_FB, XR_BS_MOUTHDIMPLE_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_CLOSED_L_FB, XR_BS_EYEBLINK_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_CLOSED_R_FB, XR_BS_EYEBLINK_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_DOWN_L_FB, XR_BS_EYELOOKDOWN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_DOWN_R_FB, XR_BS_EYELOOKDOWN_R_PICO);
|
||||
|
||||
// "out" is left for the left eye, right for the right eye
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_LEFT_L_FB, XR_BS_EYELOOKOUT_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_RIGHT_L_FB, XR_BS_EYELOOKIN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_LEFT_R_FB, XR_BS_EYELOOKIN_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_RIGHT_R_FB, XR_BS_EYELOOKOUT_R_PICO);
|
||||
// "out" is left for the left eye, right for the right eye
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_LEFT_L_FB, XR_BS_EYELOOKOUT_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_RIGHT_L_FB, XR_BS_EYELOOKIN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_LEFT_R_FB, XR_BS_EYELOOKIN_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_RIGHT_R_FB, XR_BS_EYELOOKOUT_R_PICO);
|
||||
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_UP_L_FB, XR_BS_EYELOOKUP_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_UP_R_FB, XR_BS_EYELOOKUP_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_INNER_BROW_RAISER_L_FB, XR_BS_BROWINNERUP_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_INNER_BROW_RAISER_R_FB, XR_BS_BROWINNERUP_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_JAW_DROP_FB, XR_BS_JAWOPEN_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_JAW_SIDEWAYS_LEFT_FB, XR_BS_JAWLEFT_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_JAW_SIDEWAYS_RIGHT_FB, XR_BS_JAWRIGHT_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_JAW_THRUST_FB, XR_BS_JAWFORWARD_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LID_TIGHTENER_L_FB, XR_BS_EYESQUINT_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LID_TIGHTENER_R_FB, XR_BS_EYESQUINT_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_CORNER_DEPRESSOR_L_FB, XR_BS_MOUTHFROWN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_CORNER_DEPRESSOR_R_FB, XR_BS_MOUTHFROWN_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_CORNER_PULLER_L_FB, XR_BS_MOUTHSMILE_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_CORNER_PULLER_R_FB, XR_BS_MOUTHSMILE_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_FUNNELER_LB_FB, XR_BS_MOUTHFUNNEL_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_FUNNELER_LT_FB, XR_BS_MOUTHFUNNEL_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_FUNNELER_RB_FB, XR_BS_MOUTHFUNNEL_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_FUNNELER_RT_FB, XR_BS_MOUTHFUNNEL_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_PRESSOR_L_FB, XR_BS_MOUTHPRESS_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_PRESSOR_R_FB, XR_BS_MOUTHPRESS_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_PUCKER_L_FB, XR_BS_MOUTHPUCKER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_PUCKER_R_FB, XR_BS_MOUTHPUCKER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_STRETCHER_L_FB, XR_BS_MOUTHSTRETCH_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_STRETCHER_R_FB, XR_BS_MOUTHSTRETCH_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_SUCK_LB_FB, XR_BS_MOUTHROLLLOWER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_SUCK_LT_FB, XR_BS_MOUTHROLLLOWER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_SUCK_RT_FB, XR_BS_MOUTHROLLUPPER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_SUCK_RB_FB, XR_BS_MOUTHROLLUPPER_PICO);
|
||||
// XR_FACE_EXPRESSION2_LIP_TIGHTENER_L_FB
|
||||
// XR_FACE_EXPRESSION2_LIP_TIGHTENER_R_FB
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIPS_TOWARD_FB, XR_BS_MOUTHCLOSE_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LOWER_LIP_DEPRESSOR_L_FB, XR_BS_MOUTHLOWERDOWN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LOWER_LIP_DEPRESSOR_R_FB, XR_BS_MOUTHLOWERDOWN_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_MOUTH_LEFT_FB, XR_BS_MOUTHLEFT_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_MOUTH_RIGHT_FB, XR_BS_MOUTHRIGHT_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_NOSE_WRINKLER_L_FB, XR_BS_NOSESNEER_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_NOSE_WRINKLER_R_FB, XR_BS_NOSESNEER_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_OUTER_BROW_RAISER_L_FB, XR_BS_BROWOUTERUP_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_OUTER_BROW_RAISER_R_FB, XR_BS_BROWOUTERUP_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_UPPER_LID_RAISER_L_FB, XR_BS_EYEWIDE_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_UPPER_LID_RAISER_R_FB, XR_BS_EYEWIDE_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_UPPER_LIP_RAISER_L_FB, XR_BS_MOUTHUPPERUP_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_UPPER_LIP_RAISER_R_FB, XR_BS_MOUTHUPPERUP_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_TONGUE_OUT_FB, XR_BS_TONGUEOUT_PICO);
|
||||
// XR_FACE_EXPRESSION2_TONGUE_TIP_INTERDENTAL_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_TIP_ALVEOLAR_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_FRONT_DORSAL_PALATE_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_MID_DORSAL_PALATE_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_BACK_DORSAL_VELAR_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_RETREAT_FB
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_UP_L_FB, XR_BS_EYELOOKUP_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_EYES_LOOK_UP_R_FB, XR_BS_EYELOOKUP_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_INNER_BROW_RAISER_L_FB, XR_BS_BROWINNERUP_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_INNER_BROW_RAISER_R_FB, XR_BS_BROWINNERUP_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_JAW_DROP_FB, XR_BS_JAWOPEN_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_JAW_SIDEWAYS_LEFT_FB, XR_BS_JAWLEFT_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_JAW_SIDEWAYS_RIGHT_FB, XR_BS_JAWRIGHT_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_JAW_THRUST_FB, XR_BS_JAWFORWARD_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LID_TIGHTENER_L_FB, XR_BS_EYESQUINT_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LID_TIGHTENER_R_FB, XR_BS_EYESQUINT_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_CORNER_DEPRESSOR_L_FB, XR_BS_MOUTHFROWN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_CORNER_DEPRESSOR_R_FB, XR_BS_MOUTHFROWN_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_CORNER_PULLER_L_FB, XR_BS_MOUTHSMILE_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_CORNER_PULLER_R_FB, XR_BS_MOUTHSMILE_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_FUNNELER_LB_FB, XR_BS_MOUTHFUNNEL_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_FUNNELER_LT_FB, XR_BS_MOUTHFUNNEL_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_FUNNELER_RB_FB, XR_BS_MOUTHFUNNEL_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_FUNNELER_RT_FB, XR_BS_MOUTHFUNNEL_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_PRESSOR_L_FB, XR_BS_MOUTHPRESS_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_PRESSOR_R_FB, XR_BS_MOUTHPRESS_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_PUCKER_L_FB, XR_BS_MOUTHPUCKER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_PUCKER_R_FB, XR_BS_MOUTHPUCKER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_STRETCHER_L_FB, XR_BS_MOUTHSTRETCH_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_STRETCHER_R_FB, XR_BS_MOUTHSTRETCH_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_SUCK_LB_FB, XR_BS_MOUTHROLLLOWER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_SUCK_LT_FB, XR_BS_MOUTHROLLLOWER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_SUCK_RT_FB, XR_BS_MOUTHROLLUPPER_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIP_SUCK_RB_FB, XR_BS_MOUTHROLLUPPER_PICO);
|
||||
// XR_FACE_EXPRESSION2_LIP_TIGHTENER_L_FB
|
||||
// XR_FACE_EXPRESSION2_LIP_TIGHTENER_R_FB
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LIPS_TOWARD_FB, XR_BS_MOUTHCLOSE_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LOWER_LIP_DEPRESSOR_L_FB, XR_BS_MOUTHLOWERDOWN_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_LOWER_LIP_DEPRESSOR_R_FB, XR_BS_MOUTHLOWERDOWN_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_MOUTH_LEFT_FB, XR_BS_MOUTHLEFT_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_MOUTH_RIGHT_FB, XR_BS_MOUTHRIGHT_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_NOSE_WRINKLER_L_FB, XR_BS_NOSESNEER_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_NOSE_WRINKLER_R_FB, XR_BS_NOSESNEER_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_OUTER_BROW_RAISER_L_FB, XR_BS_BROWOUTERUP_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_OUTER_BROW_RAISER_R_FB, XR_BS_BROWOUTERUP_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_UPPER_LID_RAISER_L_FB, XR_BS_EYEWIDE_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_UPPER_LID_RAISER_R_FB, XR_BS_EYEWIDE_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_UPPER_LIP_RAISER_L_FB, XR_BS_MOUTHUPPERUP_L_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_UPPER_LIP_RAISER_R_FB, XR_BS_MOUTHUPPERUP_R_PICO);
|
||||
MAP_EXPRESSION(XR_FACE_EXPRESSION2_TONGUE_OUT_FB, XR_BS_TONGUEOUT_PICO);
|
||||
// XR_FACE_EXPRESSION2_TONGUE_TIP_INTERDENTAL_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_TIP_ALVEOLAR_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_FRONT_DORSAL_PALATE_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_MID_DORSAL_PALATE_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_BACK_DORSAL_VELAR_FB
|
||||
// XR_FACE_EXPRESSION2_TONGUE_RETREAT_FB
|
||||
|
||||
#undef MAP_EXPRESSION
|
||||
|
||||
out_expressions.is_valid = true;
|
||||
out_expressions.is_eye_following_blendshapes_valid = true;
|
||||
}
|
||||
};
|
||||
|
||||
xr::pico_face_tracker::pico_face_tracker(instance & inst, session & s)
|
||||
{
|
||||
// The API has a global start and stop method
|
||||
// use a shared handle so we can have independent objects
|
||||
// and start/stop accordingly
|
||||
static std::mutex mutex;
|
||||
std::unique_lock lock(mutex);
|
||||
static std::weak_ptr<impl> instance;
|
||||
if (auto shared = instance.lock())
|
||||
{
|
||||
i = std::move(shared);
|
||||
return;
|
||||
}
|
||||
i = std::make_unique<impl>(inst, s);
|
||||
instance = i;
|
||||
}
|
||||
|
||||
void xr::pico_face_tracker::get_weights(XrTime time, packet_type & out_expressions)
|
||||
{
|
||||
return i->get_weights(time, out_expressions);
|
||||
out_expressions.is_valid = true;
|
||||
out_expressions.is_eye_following_blendshapes_valid = true;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "wivrn_packets.h"
|
||||
#include "xr/pico_eye_types.h"
|
||||
#include "xr/pico_eye_types_reflection.h"
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
namespace xr
|
||||
@@ -29,13 +31,22 @@ class session;
|
||||
|
||||
class pico_face_tracker
|
||||
{
|
||||
struct impl;
|
||||
std::shared_ptr<impl> i;
|
||||
PFN_xrStartEyeTrackingPICO xrStartEyeTrackingPICO{};
|
||||
PFN_xrStopEyeTrackingPICO xrStopEyeTrackingPICO{};
|
||||
PFN_xrSetTrackingModePICO xrSetTrackingModePICO{};
|
||||
PFN_xrGetFaceTrackingDataPICO xrGetFaceTrackingDataPICO{};
|
||||
|
||||
XrSession s;
|
||||
bool started{};
|
||||
|
||||
public:
|
||||
using packet_type = wivrn::from_headset::tracking::fb_face2;
|
||||
pico_face_tracker() = default;
|
||||
pico_face_tracker(instance & inst, session & s);
|
||||
~pico_face_tracker();
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void get_weights(XrTime time, packet_type & out_expressions);
|
||||
};
|
||||
} // namespace xr
|
||||
|
||||
@@ -19,19 +19,18 @@
|
||||
|
||||
#include "session.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "details/enumerate.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include "utils/contains.h"
|
||||
#include "xr/instance.h"
|
||||
#include "xr/system.h"
|
||||
#include "xr/to_string.h"
|
||||
#include <ranges>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <openxr/openxr_platform.h>
|
||||
|
||||
xr::session::session(xr::instance & inst, xr::system & sys, vk::raii::Instance & vk_inst, vk::raii::PhysicalDevice & pdev, vk::raii::Device & dev, thread_safe<vk::raii::Queue> & queue, int queue_family_index) :
|
||||
inst(&inst),
|
||||
queue(&queue)
|
||||
xr::session::session(xr::instance & inst, xr::system & sys, vk::raii::Instance & vk_inst, vk::raii::PhysicalDevice & pdev, vk::raii::Device & dev, int queue_family_index) :
|
||||
inst(&inst)
|
||||
{
|
||||
XrGraphicsBindingVulkan2KHR vulkan_binding{
|
||||
.type = XR_TYPE_GRAPHICS_BINDING_VULKAN2_KHR,
|
||||
@@ -128,7 +127,7 @@ void xr::session::begin_frame()
|
||||
.type = XR_TYPE_FRAME_BEGIN_INFO,
|
||||
};
|
||||
|
||||
auto lock = queue->lock();
|
||||
auto lock = application::get_queue().lock();
|
||||
CHECK_XR(xrBeginFrame(id, &begin_info));
|
||||
}
|
||||
|
||||
@@ -142,7 +141,7 @@ void xr::session::end_frame(XrTime display_time, const std::vector<XrComposition
|
||||
.layers = layers.data(),
|
||||
};
|
||||
|
||||
auto lock = queue->lock();
|
||||
auto lock = application::get_queue().lock();
|
||||
CHECK_XR(xrEndFrame(id, &end_info));
|
||||
}
|
||||
|
||||
@@ -345,14 +344,14 @@ void xr::session::enable_passthrough(xr::system & system)
|
||||
if (not std::holds_alternative<std::monostate>(passthrough))
|
||||
return;
|
||||
|
||||
if (system.passthrough_supported() == xr::passthrough_type::none)
|
||||
if (system.passthrough_supported() == xr::system::passthrough_type::no_passthrough)
|
||||
return;
|
||||
|
||||
if (inst->has_extension(XR_FB_PASSTHROUGH_EXTENSION_NAME))
|
||||
if (utils::contains(application::get_xr_extensions(), XR_FB_PASSTHROUGH_EXTENSION_NAME))
|
||||
{
|
||||
passthrough.emplace<xr::passthrough_fb>(*inst, *this);
|
||||
}
|
||||
else if (inst->has_extension(XR_HTC_PASSTHROUGH_EXTENSION_NAME))
|
||||
else if (utils::contains(application::get_xr_extensions(), XR_HTC_PASSTHROUGH_EXTENSION_NAME))
|
||||
{
|
||||
passthrough.emplace<xr::passthrough_htc>(*inst, *this);
|
||||
}
|
||||
|
||||
+1
-3
@@ -20,7 +20,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "utils/handle.h"
|
||||
#include "utils/thread_safe.h"
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -40,11 +39,10 @@ class session : public utils::handle<XrSession, xrDestroySession>
|
||||
{
|
||||
instance * inst = nullptr;
|
||||
xr::passthrough passthrough;
|
||||
thread_safe<vk::raii::Queue> * queue = nullptr;
|
||||
|
||||
public:
|
||||
session() = default;
|
||||
session(instance &, system &, vk::raii::Instance &, vk::raii::PhysicalDevice &, vk::raii::Device &, thread_safe<vk::raii::Queue> & queue, int queue_family_index);
|
||||
session(instance &, system &, vk::raii::Instance &, vk::raii::PhysicalDevice &, vk::raii::Device &, int queue_family_index);
|
||||
|
||||
std::vector<XrReferenceSpaceType> get_reference_spaces() const;
|
||||
space create_reference_space(XrReferenceSpaceType ref, const XrPosef & pose = {{0, 0, 0, 1}, {0, 0, 0}});
|
||||
|
||||
+7
-28
@@ -19,14 +19,12 @@
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#include "body_tracker.h"
|
||||
#include "application.h"
|
||||
#include "details/enumerate.h"
|
||||
#include "face_tracker.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include "utils/contains.h"
|
||||
#include "vk/check.h"
|
||||
#include "xr/check.h"
|
||||
#include "xr/instance.h"
|
||||
#include <cassert>
|
||||
#include <openxr/openxr_platform.h>
|
||||
|
||||
@@ -43,12 +41,6 @@ xr::system::system(xr::instance & inst, XrFormFactor formfactor)
|
||||
CHECK_XR(xrGetSystem(inst, &system_info, &id));
|
||||
|
||||
assert(id != XR_NULL_SYSTEM_ID);
|
||||
|
||||
if (inst.has_extension(XR_EXT_HAND_TRACKING_EXTENSION_NAME))
|
||||
hand_tracking_supported_ = hand_tracking_properties().supportsHandTracking;
|
||||
|
||||
body_tracker = xr::body_tracker_supported(inst, *this);
|
||||
face_tracker = xr::face_tracker_supported(inst, *this);
|
||||
}
|
||||
|
||||
XrGraphicsRequirementsVulkan2KHR xr::system::graphics_requirements() const
|
||||
@@ -203,15 +195,16 @@ XrSystemBodyTrackingPropertiesBD xr::system::bd_body_tracking_properties() const
|
||||
return body_tracking_prop;
|
||||
}
|
||||
|
||||
xr::passthrough_type xr::system::passthrough_supported() const
|
||||
xr::system::passthrough_type xr::system::passthrough_supported() const
|
||||
{
|
||||
if (utils::contains(environment_blend_modes(XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO), XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND))
|
||||
return passthrough_type::color;
|
||||
|
||||
if (inst->has_extension(XR_HTC_PASSTHROUGH_EXTENSION_NAME))
|
||||
const std::vector<std::string> & xr_extensions = application::get_xr_extensions();
|
||||
if (utils::contains(xr_extensions, XR_HTC_PASSTHROUGH_EXTENSION_NAME))
|
||||
return passthrough_type::color;
|
||||
|
||||
if (inst->has_extension(XR_FB_PASSTHROUGH_EXTENSION_NAME))
|
||||
if (utils::contains(xr_extensions, XR_FB_PASSTHROUGH_EXTENSION_NAME))
|
||||
{
|
||||
XrSystemPassthroughProperties2FB passthrough_prop2{
|
||||
.type = XR_TYPE_SYSTEM_PASSTHROUGH_PROPERTIES2_FB,
|
||||
@@ -231,7 +224,7 @@ xr::passthrough_type xr::system::passthrough_supported() const
|
||||
if (passthrough_prop.supportsPassthrough)
|
||||
{
|
||||
if (!(passthrough_prop2.capabilities & XR_PASSTHROUGH_CAPABILITY_BIT_FB))
|
||||
return passthrough_type::none;
|
||||
return passthrough_type::no_passthrough;
|
||||
|
||||
if (passthrough_prop2.capabilities & XR_PASSTHROUGH_CAPABILITY_COLOR_BIT_FB)
|
||||
return passthrough_type::color;
|
||||
@@ -240,21 +233,7 @@ xr::passthrough_type xr::system::passthrough_supported() const
|
||||
}
|
||||
}
|
||||
|
||||
return passthrough_type::none;
|
||||
}
|
||||
xr::face_tracker_type xr::system::face_tracker_supported() const
|
||||
{
|
||||
return face_tracker;
|
||||
}
|
||||
|
||||
xr::body_tracker_type xr::system::body_tracker_supported() const
|
||||
{
|
||||
return body_tracker;
|
||||
}
|
||||
|
||||
bool xr::system::hand_tracking_supported() const
|
||||
{
|
||||
return hand_tracking_supported_;
|
||||
return passthrough_type::no_passthrough;
|
||||
}
|
||||
|
||||
vk::raii::PhysicalDevice xr::system::physical_device(vk::raii::Instance & vulkan) const
|
||||
|
||||
+7
-31
@@ -32,39 +32,19 @@ namespace xr
|
||||
{
|
||||
class instance;
|
||||
|
||||
enum class passthrough_type
|
||||
{
|
||||
none,
|
||||
bw,
|
||||
color
|
||||
};
|
||||
|
||||
enum class body_tracker_type
|
||||
{
|
||||
none,
|
||||
fb,
|
||||
htc,
|
||||
pico,
|
||||
};
|
||||
|
||||
enum class face_tracker_type
|
||||
{
|
||||
none,
|
||||
fb,
|
||||
htc,
|
||||
pico,
|
||||
};
|
||||
|
||||
class system
|
||||
{
|
||||
instance * inst = nullptr;
|
||||
XrSystemId id = XR_NULL_SYSTEM_ID;
|
||||
bool hand_tracking_supported_ = false;
|
||||
passthrough_type passthrough;
|
||||
body_tracker_type body_tracker;
|
||||
face_tracker_type face_tracker;
|
||||
|
||||
public:
|
||||
enum class passthrough_type
|
||||
{
|
||||
no_passthrough,
|
||||
bw,
|
||||
color
|
||||
};
|
||||
|
||||
system() = default;
|
||||
system(const system &) = default;
|
||||
system & operator=(const system &) = default;
|
||||
@@ -87,11 +67,7 @@ public:
|
||||
XrSystemFacialTrackingPropertiesHTC htc_face_tracking_properties() const;
|
||||
XrSystemBodyTrackingPropertiesFB fb_body_tracking_properties() const;
|
||||
XrSystemBodyTrackingPropertiesBD bd_body_tracking_properties() const;
|
||||
|
||||
bool hand_tracking_supported() const;
|
||||
passthrough_type passthrough_supported() const;
|
||||
face_tracker_type face_tracker_supported() const;
|
||||
body_tracker_type body_tracker_supported() const;
|
||||
|
||||
XrGraphicsRequirementsVulkan2KHR graphics_requirements() const;
|
||||
vk::raii::PhysicalDevice physical_device(vk::raii::Instance & vulkan) const;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
function(auto_option name description default)
|
||||
set(${name} ${default} CACHE STRING "${description}")
|
||||
set_property(CACHE ${name} PROPERTY STRINGS AUTO ON OFF)
|
||||
endfunction()
|
||||
@@ -1,4 +1,4 @@
|
||||
if (WIVRN_USE_SYSTEM_BOOST)
|
||||
if (BOOST_FOUND)
|
||||
add_library(Boost::pfr ALIAS Boost::headers)
|
||||
elseif (WIVRN_BUILD_CLIENT)
|
||||
FetchContent_MakeAvailable(boost)
|
||||
@@ -50,7 +50,7 @@ if (WIVRN_BUILD_DASHBOARD OR WIVRN_BUILD_SERVER)
|
||||
utils/ini.cpp
|
||||
application.cpp
|
||||
)
|
||||
target_link_libraries(wivrn-common-server PRIVATE nlohmann_json::nlohmann_json PNG::PNG PkgConfig::librsvg-2.0 LibArchive::LibArchive PUBLIC wivrn-common-base)
|
||||
target_link_libraries(wivrn-common-server PRIVATE nlohmann_json::nlohmann_json PNG::PNG PkgConfig::librsvg-2.0 PUBLIC wivrn-common-base)
|
||||
|
||||
if (WIVRN_BUILD_TEST)
|
||||
add_executable(list-apps
|
||||
|
||||
+40
-34
@@ -20,6 +20,7 @@
|
||||
#include "application.h"
|
||||
|
||||
#include "utils/flatpak.h"
|
||||
#include "utils/load_icon.h"
|
||||
#include "utils/steam_app_info.h"
|
||||
#include "utils/xdg_base_directory.h"
|
||||
#include "utils/xdg_icon_lookup.h"
|
||||
@@ -50,19 +51,20 @@ std::filesystem::path home()
|
||||
|
||||
std::pair<std::string, std::optional<std::filesystem::path>> find_steam()
|
||||
{
|
||||
auto h = home();
|
||||
// Flatpak Steam
|
||||
if (std::filesystem::exists(h / ".var/app/com.valvesoftware.Steam/.steam/steam"))
|
||||
return {"flatpak run com.valvesoftware.Steam", h / ".var/app/com.valvesoftware.Steam/.steam/steam"};
|
||||
|
||||
// system Steam
|
||||
if (std::filesystem::exists(xdg_data_home() / "Steam"))
|
||||
return {"steam", xdg_data_home() / "Steam"};
|
||||
|
||||
auto h = home();
|
||||
|
||||
// system Steam (accessed from flatpak)
|
||||
if (std::filesystem::exists(h / ".local/share/Steam"))
|
||||
return {"steam", h / ".local/share/Steam"};
|
||||
|
||||
// Flatpak Steam
|
||||
if (std::filesystem::exists(h / ".var/app/com.valvesoftware.Steam/.steam/steam"))
|
||||
return {"flatpak run com.valvesoftware.Steam", h / ".var/app/com.valvesoftware.Steam/.steam/steam"};
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -83,17 +85,17 @@ steam_app_info read_steam_app_info(const std::filesystem::path & root)
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<std::filesystem::path> find_steam_icon(const std::filesystem::path & root, int app_id, const steam_app_info & info)
|
||||
std::vector<std::byte> load_steam_icon(const std::filesystem::path & root, int app_id, const steam_app_info & info)
|
||||
{
|
||||
const auto & app_info = info.get(app_id);
|
||||
|
||||
try
|
||||
{
|
||||
std::string icon{std::get<std::string_view>(app_info.at("common.clienticon"))};
|
||||
auto icon_path = root / "steam/games" / (icon + ".ico");
|
||||
|
||||
if (std::filesystem::exists(icon_path))
|
||||
return icon_path;
|
||||
auto image = load_icon(root / "steam/games" / (icon + ".ico"), 128);
|
||||
if (not image.empty())
|
||||
return image;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -101,21 +103,20 @@ std::optional<std::filesystem::path> find_steam_icon(const std::filesystem::path
|
||||
|
||||
try
|
||||
{
|
||||
std::string icon{std::get<std::string_view>(app_info.at("common.linuxclienticon"))};
|
||||
std::string icon{std::get<std::string_view>(app_info.at("common.LinuxClientIcon"))};
|
||||
|
||||
auto icon_path = root / "steam/games" / (icon + ".zip");
|
||||
|
||||
if (std::filesystem::exists(icon_path))
|
||||
return icon_path;
|
||||
auto image = load_icon(root / "steam/games" / (icon + ".zip"), 128);
|
||||
if (not image.empty())
|
||||
return image;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
return {};
|
||||
}
|
||||
|
||||
void read_steam_vr_apps(std::unordered_map<std::string, application> & res)
|
||||
void read_steam_vr_apps(std::unordered_map<std::string, application> & res, bool load_icons)
|
||||
{
|
||||
auto [command, root] = find_steam();
|
||||
if (not root)
|
||||
@@ -165,17 +166,20 @@ void read_steam_vr_apps(std::unordered_map<std::string, application> & res)
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
if (load_icons)
|
||||
{
|
||||
const char prefix[] = "steam.app.";
|
||||
if (app_key.starts_with(prefix))
|
||||
try
|
||||
{
|
||||
const char prefix[] = "steam.app.";
|
||||
if (app_key.starts_with(prefix))
|
||||
{
|
||||
uint32_t app_id = stoll(app_key.substr(strlen(prefix)));
|
||||
app.image = load_steam_icon(*root, app_id, info);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
uint32_t app_id = stoll(app_key.substr(strlen(prefix)));
|
||||
app.icon_path = find_steam_icon(*root, app_id, info);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
if (not app.exec.empty())
|
||||
@@ -277,7 +281,7 @@ bool contains(std::string_view entries, std::string_view val, char sep = ';')
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<application> do_desktop_entry(const std::filesystem::path & filename)
|
||||
std::optional<application> do_desktop_entry(const std::filesystem::path & filename, bool load_icons)
|
||||
{
|
||||
auto data = read_file(filename);
|
||||
std::optional<application> res;
|
||||
@@ -319,11 +323,12 @@ std::optional<application> do_desktop_entry(const std::filesystem::path & filena
|
||||
res->exec = unescape(item.value);
|
||||
if (item.key == "Path")
|
||||
res->path = unescape(item.value);
|
||||
if (item.key == "Icon")
|
||||
if (item.key == "Icon" and load_icons)
|
||||
{
|
||||
try
|
||||
{
|
||||
res->icon_path = xdg_icon_lookup(std::string{item.value}, 256);
|
||||
if (auto filename = xdg_icon_lookup(std::string{item.value}, 256))
|
||||
res->image = load_icon(*filename, 256);
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
@@ -336,7 +341,7 @@ std::optional<application> do_desktop_entry(const std::filesystem::path & filena
|
||||
return res;
|
||||
}
|
||||
|
||||
void do_data_dir(std::filesystem::path dir, std::unordered_map<std::string, application> & res)
|
||||
void do_data_dir(std::filesystem::path dir, std::unordered_map<std::string, application> & res, bool load_icons)
|
||||
{
|
||||
dir = dir / "applications";
|
||||
if (not std::filesystem::is_directory(dir))
|
||||
@@ -359,28 +364,29 @@ void do_data_dir(std::filesystem::path dir, std::unordered_map<std::string, appl
|
||||
if (res.contains(file_id))
|
||||
continue;
|
||||
|
||||
auto app = do_desktop_entry(entry.path());
|
||||
auto app = do_desktop_entry(entry.path(), load_icons);
|
||||
if (app)
|
||||
res.emplace(std::move(file_id), std::move(*app));
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::unordered_map<std::string, application> list_applications()
|
||||
std::unordered_map<std::string, application> list_applications(bool include_steam, bool load_icons)
|
||||
{
|
||||
std::unordered_map<std::string, application> res;
|
||||
|
||||
read_steam_vr_apps(res);
|
||||
if (include_steam)
|
||||
read_steam_vr_apps(res, load_icons);
|
||||
|
||||
do_data_dir(xdg_data_home(), res);
|
||||
do_data_dir(xdg_data_home(), res, load_icons);
|
||||
|
||||
for (auto && dir: xdg_data_dirs())
|
||||
do_data_dir(std::move(dir), res);
|
||||
do_data_dir(std::move(dir), res, load_icons);
|
||||
|
||||
if (wivrn::is_flatpak())
|
||||
{
|
||||
// Try to guess host data dirs
|
||||
do_data_dir("/run/host/usr/share", res);
|
||||
do_data_dir("/run/host/usr/share", res, load_icons);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
@@ -31,9 +31,9 @@ struct application
|
||||
// localised names, with empty locale for default
|
||||
std::unordered_map<std::string, std::string> name;
|
||||
std::string exec;
|
||||
std::optional<std::filesystem::path> icon_path;
|
||||
std::vector<std::byte> image; // In PNG
|
||||
std::optional<std::string> path;
|
||||
};
|
||||
|
||||
std::unordered_map<std::string, application> list_applications();
|
||||
std::unordered_map<std::string, application> list_applications(bool include_steam = true, bool load_icons = true);
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -23,13 +23,5 @@
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
struct icon
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
int bpp;
|
||||
std::vector<std::byte> png_data;
|
||||
};
|
||||
|
||||
const std::vector<icon> & load_icon(const std::filesystem::path & filename);
|
||||
} // namespace wivrn
|
||||
const std::vector<std::byte> & load_icon(const std::filesystem::path & filename, int size);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "steam_app_info.h"
|
||||
#include <bit>
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <span>
|
||||
@@ -90,8 +89,6 @@ void read_vdf(wivrn::steam_app_info::info & info, const std::string & prefix, st
|
||||
while (type != 8)
|
||||
{
|
||||
std::string name{string_table.at(read<uint32_t>(bindata))};
|
||||
for (char & c: name)
|
||||
c = std::tolower(c);
|
||||
|
||||
// https://github.com/ValveResourceFormat/ValveKeyValue/blob/master/ValveKeyValue/ValveKeyValue/KeyValues1/KV1BinaryNodeType.cs
|
||||
switch (type)
|
||||
|
||||
@@ -131,12 +131,6 @@ public:
|
||||
std::tie(resource, allocation) = traits::create(device, create_info, alloc_info);
|
||||
|
||||
vmaSetAllocationName(vk_allocator::instance(), allocation, name.c_str());
|
||||
if (vk_allocator::instance().has_debug_utils)
|
||||
device.setDebugUtilsObjectNameEXT(vk::DebugUtilsObjectNameInfoEXT{
|
||||
.objectType = T::objectType,
|
||||
.objectHandle = uint64_t(CType(*resource)),
|
||||
.pObjectName = name.c_str(),
|
||||
});
|
||||
}
|
||||
|
||||
basic_allocation(const basic_allocation &) = delete;
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <patricknicolas@laposte.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <tuple>
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
template <typename... Args>
|
||||
class specialization_constants
|
||||
{
|
||||
std::tuple<Args...> values;
|
||||
std::array<vk::SpecializationMapEntry, sizeof...(Args)> entries;
|
||||
vk::SpecializationInfo info_;
|
||||
|
||||
specialization_constants(specialization_constants &&) = delete;
|
||||
specialization_constants(const specialization_constants &) = delete;
|
||||
specialization_constants & operator=(const specialization_constants &) = delete;
|
||||
specialization_constants & operator=(specialization_constants &&) = delete;
|
||||
|
||||
template <uint32_t i = sizeof...(Args) - 1>
|
||||
void fill_entries()
|
||||
{
|
||||
entries[i] = vk::SpecializationMapEntry{
|
||||
.constantID = i,
|
||||
.offset = uint32_t(uintptr_t(std::addressof(std::get<i>(values))) - uintptr_t(std::addressof(values))),
|
||||
.size = sizeof(std::get<i>(values)),
|
||||
};
|
||||
if constexpr (i > 0)
|
||||
fill_entries<i - 1>();
|
||||
}
|
||||
|
||||
public:
|
||||
specialization_constants(Args &&... args) :
|
||||
values(std::forward<Args>(args)...),
|
||||
info_{
|
||||
.mapEntryCount = uint32_t(entries.size()),
|
||||
.pMapEntries = entries.data(),
|
||||
.dataSize = sizeof(values),
|
||||
.pData = &values,
|
||||
}
|
||||
{
|
||||
fill_entries();
|
||||
}
|
||||
|
||||
operator vk::SpecializationInfo *()
|
||||
{
|
||||
return &info_;
|
||||
}
|
||||
|
||||
vk::SpecializationInfo * info()
|
||||
{
|
||||
return &info_;
|
||||
}
|
||||
|
||||
template <uint32_t i>
|
||||
auto & data()
|
||||
{
|
||||
return std::get<i>(values);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename... Args>
|
||||
specialization_constants<Args...> make_specialization_constants(Args &&... args)
|
||||
{
|
||||
return specialization_constants<Args...>(std::forward<Args>(args)...);
|
||||
}
|
||||
@@ -20,8 +20,7 @@
|
||||
#include "vk_allocator.h"
|
||||
#include "vk/check.h"
|
||||
|
||||
vk_allocator::vk_allocator(const VmaAllocatorCreateInfo & info, bool has_debug_utils) :
|
||||
has_debug_utils(has_debug_utils)
|
||||
vk_allocator::vk_allocator(const VmaAllocatorCreateInfo & info)
|
||||
{
|
||||
CHECK_VK(vmaCreateAllocator(&info, &handle));
|
||||
}
|
||||
|
||||
@@ -27,8 +27,7 @@ class vk_allocator : public singleton<vk_allocator>
|
||||
VmaAllocator handle = nullptr;
|
||||
|
||||
public:
|
||||
const bool has_debug_utils;
|
||||
vk_allocator(const VmaAllocatorCreateInfo &, bool has_debug_utils);
|
||||
vk_allocator(const VmaAllocatorCreateInfo &);
|
||||
~vk_allocator();
|
||||
|
||||
operator VmaAllocator()
|
||||
|
||||
+3
-14
@@ -41,7 +41,7 @@ namespace wivrn
|
||||
// Default port for server to listen, both TCP and UDP
|
||||
static const int default_port = 9757;
|
||||
|
||||
static constexpr int protocol_revision = 1;
|
||||
static constexpr int protocol_revision = 2;
|
||||
|
||||
enum class device_id : uint8_t
|
||||
{
|
||||
@@ -239,11 +239,6 @@ struct headset_info_packet
|
||||
uint32_t num_generic_trackers;
|
||||
std::vector<video_codec> supported_codecs; // from preferred to least preferred
|
||||
std::string system_name;
|
||||
|
||||
// Used for the application list
|
||||
std::string language;
|
||||
std::string country;
|
||||
std::string variant;
|
||||
};
|
||||
|
||||
struct handshake
|
||||
@@ -680,16 +675,11 @@ struct application_list
|
||||
{
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::vector<std::byte> image; // In PNG
|
||||
};
|
||||
std::vector<application> applications;
|
||||
};
|
||||
|
||||
struct application_icon
|
||||
{
|
||||
std::string id;
|
||||
std::vector<std::byte> image; // In PNG
|
||||
};
|
||||
|
||||
using packets = std::variant<
|
||||
crypto_handshake,
|
||||
pin_check_2,
|
||||
@@ -703,7 +693,6 @@ using packets = std::variant<
|
||||
timesync_query,
|
||||
tracking_control,
|
||||
refresh_rate_change,
|
||||
application_list,
|
||||
application_icon>;
|
||||
application_list>;
|
||||
} // namespace to_headset
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -69,9 +69,10 @@ wivrn::fd_base::~fd_base()
|
||||
wivrn::UDP::UDP()
|
||||
{
|
||||
fd = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
if (fd < 0)
|
||||
throw std::system_error{errno, std::generic_category()};
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
|
||||
wivrn::UDP::UDP(int fd)
|
||||
@@ -176,9 +177,10 @@ wivrn::TCP::TCP(int fd)
|
||||
wivrn::TCP::TCP(in6_addr address, int port)
|
||||
{
|
||||
fd = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
if (fd < 0)
|
||||
throw std::system_error{errno, std::generic_category()};
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
sockaddr_in6 sa;
|
||||
sa.sin6_family = AF_INET6;
|
||||
@@ -197,9 +199,10 @@ wivrn::TCP::TCP(in6_addr address, int port)
|
||||
wivrn::TCP::TCP(in_addr address, int port)
|
||||
{
|
||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
if (fd < 0)
|
||||
throw std::system_error{errno, std::generic_category()};
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
sockaddr_in sa;
|
||||
sa.sin_family = AF_INET;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
|
||||
Apps::Apps(QObject * parent)
|
||||
{
|
||||
auto apps = wivrn::list_applications();
|
||||
auto apps = wivrn::list_applications(true /* Include steam apps */, false /* Don't load icons */);
|
||||
|
||||
for (const auto & [id, app]: apps)
|
||||
{
|
||||
|
||||
@@ -59,12 +59,6 @@ Kirigami.ApplicationWindow {
|
||||
// Set the visible property here because dismissing the message removes the binding
|
||||
if (value == WivrnServer.FailedToStart)
|
||||
message_failed_to_start.visible = true;
|
||||
|
||||
if (root.first_run && started) {
|
||||
console.log("First run");
|
||||
root.pageStack.push(Qt.resolvedUrl("WizardPage.qml"));
|
||||
root.first_run = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onPairingEnabledChanged(value) {
|
||||
@@ -90,6 +84,12 @@ Kirigami.ApplicationWindow {
|
||||
if (WivrnServer.serverStatus == WivrnServer.Stopped)
|
||||
WivrnServer.start_server();
|
||||
|
||||
if (root.first_run) {
|
||||
console.log("First run");
|
||||
root.pageStack.push(Qt.resolvedUrl("WizardPage.qml"));
|
||||
root.first_run = false;
|
||||
}
|
||||
|
||||
if (root.last_run_version != ApkInstaller.currentVersion) {
|
||||
root.last_run_version = ApkInstaller.currentVersion;
|
||||
}
|
||||
@@ -305,12 +305,11 @@ Kirigami.ApplicationWindow {
|
||||
level: 1
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Steam information")
|
||||
opacity: steam_info.opacity
|
||||
opacity: root.server_started
|
||||
Layout.maximumHeight: root.server_started ? -1 : 0
|
||||
}
|
||||
SteamLaunchOptions {
|
||||
id: steam_info
|
||||
opacity: root.server_started && WivrnServer.steamCommand != ""
|
||||
opacity: root.server_started
|
||||
Layout.maximumHeight: root.server_started ? -1 : 0
|
||||
}
|
||||
|
||||
|
||||
@@ -290,7 +290,6 @@ Kirigami.ScrollablePage {
|
||||
SelectGame {}
|
||||
|
||||
SteamLaunchOptions {
|
||||
visible: WivrnServer.steamCommand != ""
|
||||
Layout.topMargin: 2 * Kirigami.Units.largeSpacing
|
||||
}
|
||||
|
||||
|
||||
@@ -507,37 +507,29 @@ void wivrn_server::on_server_properties_changed(const QString & interface_name,
|
||||
|
||||
void wivrn_server::setJsonConfiguration(QString new_configuration)
|
||||
{
|
||||
if (server_interface)
|
||||
{
|
||||
server_interface->setJsonConfiguration(m_jsonConfiguration = new_configuration);
|
||||
jsonConfigurationChanged(new_configuration);
|
||||
}
|
||||
server_interface->setJsonConfiguration(m_jsonConfiguration = new_configuration);
|
||||
jsonConfigurationChanged(new_configuration);
|
||||
}
|
||||
|
||||
void wivrn_server::revoke_key(QString public_key)
|
||||
{
|
||||
if (server_interface)
|
||||
server_interface->RevokeKey(public_key);
|
||||
server_interface->RevokeKey(public_key);
|
||||
}
|
||||
|
||||
void wivrn_server::rename_key(QString public_key, QString name)
|
||||
{
|
||||
if (server_interface)
|
||||
server_interface->RenameKey(public_key, name);
|
||||
server_interface->RenameKey(public_key, name);
|
||||
}
|
||||
|
||||
QString wivrn_server::enable_pairing(int timeout_secs)
|
||||
{
|
||||
qDebug() << "Enabling pairing for" << timeout_secs << "seconds";
|
||||
if (server_interface)
|
||||
return server_interface->EnablePairing(timeout_secs).value();
|
||||
return "";
|
||||
return server_interface->EnablePairing(timeout_secs).value();
|
||||
}
|
||||
|
||||
void wivrn_server::disable_pairing()
|
||||
{
|
||||
if (server_interface)
|
||||
server_interface->DisablePairing();
|
||||
server_interface->DisablePairing();
|
||||
}
|
||||
|
||||
QString wivrn_server::hostname()
|
||||
|
||||
@@ -5,8 +5,6 @@ The headset application and the server dashboard are translated, contributions a
|
||||
# Required software
|
||||
You only need `gettext` and a text editor, you can optionally use a graphical editor such as [GNOME Translation Editor](https://wiki.gnome.org/Apps/Gtranslator/) or [Lokalize](https://apps.kde.org/lokalize/).
|
||||
|
||||
If using Lokalize, make sure to erase the "Default mailing list" in the settings, or it will write a KDE mailing list in the translation file and you will have to manually remove it.
|
||||
|
||||
# Adding a new language
|
||||
|
||||
* Run `tools/update_messages.sh LANG` where LANG is the 2 letter [ISO 639](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) language code, this will create files in the `locale` directory for the new language. Fill in the fields, `git add` the files, commit and file a pull request.
|
||||
|
||||
Vendored
-4
@@ -1,6 +1,2 @@
|
||||
add_library(wivrn-external INTERFACE)
|
||||
target_include_directories(wivrn-external SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_library(imspinner OBJECT EXCLUDE_FROM_ALL imspinner/cimspinner.cpp)
|
||||
target_include_directories(imspinner SYSTEM PUBLIC imspinner)
|
||||
target_link_libraries(imspinner wivrn-imgui)
|
||||
|
||||
Vendored
-1628
File diff suppressed because it is too large
Load Diff
Vendored
-415
@@ -1,415 +0,0 @@
|
||||
/*
|
||||
* This file has been auto generated by srcript, see genCimSpinner.rb
|
||||
*/
|
||||
#include "cimspinner_config.h"
|
||||
//#define SPINNER_RAINBOW
|
||||
//#define SPINNER_RAINBOWMIX
|
||||
//#define SPINNER_ROTATINGHEART
|
||||
//#define SPINNER_ANG
|
||||
//#define SPINNER_ANG8
|
||||
//#define SPINNER_ANGMIX
|
||||
//#define SPINNER_LOADINGRING
|
||||
//#define SPINNER_CLOCK
|
||||
//#define SPINNER_PULSAR
|
||||
//#define SPINNER_DOUBLEFADEPULSAR
|
||||
//#define SPINNER_TWINPULSAR
|
||||
//#define SPINNER_FADEPULSAR
|
||||
//#define SPINNER_FADEPULSARSQUARE
|
||||
//#define SPINNER_CIRCULARLINES
|
||||
//#define SPINNER_DOTS
|
||||
//#define SPINNER_VDOTS
|
||||
//#define SPINNER_BOUNCEDOTS
|
||||
//#define SPINNER_ZIPDOTS
|
||||
//#define SPINNER_DOTSTOPOINTS
|
||||
//#define SPINNER_DOTSTOBAR
|
||||
//#define SPINNER_WAVEDOTS
|
||||
//#define SPINNER_FADEDOTS
|
||||
//#define SPINNER_THREEDOTS
|
||||
//#define SPINNER_FIVEDOTS
|
||||
//#define SPINNER_4CALEIDOSPCOPE
|
||||
//#define SPINNER_MULTIFADEDOTS
|
||||
//#define SPINNER_THICKTOSIN
|
||||
//#define SPINNER_SCALEDOTS
|
||||
//#define SPINNER_SQUARESPINS
|
||||
//#define SPINNER_MOVINGDOTS
|
||||
//#define SPINNER_ROTATEDOTS
|
||||
//#define SPINNER_ORIONDOTS
|
||||
//#define SPINNER_GALAXYDOTS
|
||||
//#define SPINNER_TWINANG
|
||||
//#define SPINNER_FILLING
|
||||
//#define SPINNER_FILLINGMEM
|
||||
//#define SPINNER_TOPUP
|
||||
//#define SPINNER_TWINANG180
|
||||
//#define SPINNER_TWINANG360
|
||||
//#define SPINNER_INCDOTS
|
||||
//#define SPINNER_INCFULLDOTS
|
||||
//#define SPINNER_FADEBARS
|
||||
//#define SPINNER_FADETRIS
|
||||
//#define SPINNER_BARSROTATEFADE
|
||||
//#define SPINNER_BARSSCALEMIDDLE
|
||||
//#define SPINNER_ANGTWIN
|
||||
//#define SPINNER_ARCROTATION
|
||||
//#define SPINNER_ARCFADE
|
||||
//#define SPINNER_SIMPLEARCFADE
|
||||
//#define SPINNER_SQUARESTROKEFADE
|
||||
//#define SPINNER_ASCIISYMBOLPOINTS
|
||||
//#define SPINNER_TEXTFADING
|
||||
//#define SPINNER_SEVENSEGMENTS
|
||||
//#define SPINNER_SQUARESTROKEFILL
|
||||
//#define SPINNER_SQUARESTROKELOADING
|
||||
//#define SPINNER_SQUARELOADING
|
||||
//#define SPINNER_FILLEDARCFADE
|
||||
//#define SPINNER_POINTSROLLER
|
||||
//#define SPINNER_POINTSARCBOUNCE
|
||||
//#define SPINNER_FILLEDARCCOLOR
|
||||
//#define SPINNER_FILLEDARCRING
|
||||
//#define SPINNER_ARCWEDGES
|
||||
//#define SPINNER_TWINBALL
|
||||
//#define SPINNER_SOLARBALLS
|
||||
//#define SPINNER_SOLARSCALEBALLS
|
||||
//#define SPINNER_SOLARARCS
|
||||
//#define SPINNER_MOVINGARCS
|
||||
//#define SPINNER_RAINBOWCIRCLE
|
||||
//#define SPINNER_BOUNCEBALL
|
||||
//#define SPINNER_PULSARBALL
|
||||
//#define SPINNER_INCSCALEDOTS
|
||||
//#define SPINNER_SOMESCALEDOTS
|
||||
//#define SPINNER_ANGTRIPLE
|
||||
//#define SPINNER_ANGECLIPSE
|
||||
//#define SPINNER_INGYANG
|
||||
//#define SPINNER_GOOEYBALLS
|
||||
//#define SPINNER_DOTSLOADING
|
||||
//#define SPINNER_ROTATEGOOEYBALLS
|
||||
//#define SPINNER_HERBERTBALLS
|
||||
//#define SPINNER_HERBERTBALLS3D
|
||||
//#define SPINNER_ROTATETRIANGLES
|
||||
//#define SPINNER_ROTATESHAPES
|
||||
//#define SPINNER_SINSQUARES
|
||||
//#define SPINNER_MOONLINE
|
||||
//#define SPINNER_CIRCLEDROP
|
||||
//#define SPINNER_SURROUNDEDINDICATOR
|
||||
//#define SPINNER_WIFIINDICATOR
|
||||
//#define SPINNER_TRIANGLESSELECTOR
|
||||
//#define SPINNER_CAMERA
|
||||
//#define SPINNER_FLOWINGGRADIENT
|
||||
//#define SPINNER_ROTATESEGMENTS
|
||||
//#define SPINNER_LEMNISCATE
|
||||
//#define SPINNER_ROTATEGEAR
|
||||
//#define SPINNER_ROTATEWHEEL
|
||||
//#define SPINNER_ATOM
|
||||
//#define SPINNER_PATTERNRINGS
|
||||
//#define SPINNER_PATTERNECLIPSE
|
||||
//#define SPINNER_PATTERNSPHERE
|
||||
//#define SPINNER_RINGSYNCHRONOUS
|
||||
//#define SPINNER_RINGWATERMARKS
|
||||
//#define SPINNER_ROTATEDATOM
|
||||
//#define SPINNER_RAINBOWBALLS
|
||||
//#define SPINNER_RAINBOWSHOT
|
||||
//#define SPINNER_SPIRAL
|
||||
//#define SPINNER_SPIRALEYE
|
||||
//#define SPINNER_BARCHARTSINE
|
||||
//#define SPINNER_BARCHARTADVSINE
|
||||
//#define SPINNER_BARCHARTADVSINEFADE
|
||||
//#define SPINNER_BARCHARTRAINBOW
|
||||
//#define SPINNER_BLOCKS
|
||||
//#define SPINNER_TWINBLOCKS
|
||||
//#define SPINNER_SQUARERANDOMDOTS
|
||||
//#define SPINNER_SCALEBLOCKS
|
||||
//#define SPINNER_SCALESQUARES
|
||||
//#define SPINNER_SQUISHSQUARE
|
||||
//#define SPINNER_FLUID
|
||||
//#define SPINNER_FLUIDPOINTS
|
||||
//#define SPINNER_ARCPOLARFADE
|
||||
//#define SPINNER_ARCPOLARRADIUS
|
||||
//#define SPINNER_CALEIDOSCOPE
|
||||
//#define SPINNER_HBODOTS
|
||||
//#define SPINNER_MOONDOTS
|
||||
//#define SPINNER_TWINHBODOTS
|
||||
//#define SPINNER_THREEDOTSSTAR
|
||||
//#define SPINNER_SINEARCS
|
||||
//#define SPINNER_TRIANGLESSHIFT
|
||||
//#define SPINNER_POINTSSHIFT
|
||||
//#define SPINNER_SWINGDOTS
|
||||
//#define SPINNER_CIRCULARPOINTS
|
||||
//#define SPINNER_CURVEDCIRCLE
|
||||
//#define SPINNER_MODCIRCLE
|
||||
//#define SPINNER_DNADOTS
|
||||
//#define SPINNER_3SMUGGLEDOTS
|
||||
//#define SPINNER_ROTATESEGMENTSPULSAR
|
||||
//#define SPINNER_SPLINEANG
|
||||
|
||||
#pragma once
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CIMSPINNER_API
|
||||
#define CIMSPINNER_API
|
||||
#endif
|
||||
|
||||
CIMSPINNER_API void SpinnerRainbow(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerRainbowEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min, float ang_max, int arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerRainbowMix(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerRainbowMixEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min, float ang_max, int arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerRotatingHeart(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerRotatingHeartEx(const char *label, float radius, float thickness, const ImColor color, float speed,float ang_min);
|
||||
CIMSPINNER_API void SpinnerAng(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerAngEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode);
|
||||
CIMSPINNER_API void SpinnerAng8(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerAng8Ex(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode, float rkoef);
|
||||
CIMSPINNER_API void SpinnerAngMix(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerAngMixEx(const char *label, float radius, float thickness,const ImColor color, float speed, float angle, int arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerLoadingRing(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerLoadingRingEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, int segments);
|
||||
CIMSPINNER_API void SpinnerClock(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerClockEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed);
|
||||
CIMSPINNER_API void SpinnerPulsar(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerPulsarEx(const char *label, float radius, float thickness,const ImColor bg, float speed, bool sequence, float angle, int mode);
|
||||
CIMSPINNER_API void SpinnerDoubleFadePulsar(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerDoubleFadePulsarEx(const char *label, float radius, float thickness,const ImColor bg, float speed);
|
||||
CIMSPINNER_API void SpinnerTwinPulsar(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerTwinPulsarEx(const char *label, float radius, float thickness,const ImColor color, float speed, int rings, int mode);
|
||||
CIMSPINNER_API void SpinnerFadePulsar(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerFadePulsarEx(const char *label, float radius,const ImColor color, float speed, int rings, int mode);
|
||||
CIMSPINNER_API void SpinnerFadePulsarSquare(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerFadePulsarSquareEx(const char *label, float radius,const ImColor color, float speed, int rings, int mode);
|
||||
CIMSPINNER_API void SpinnerCircularLines(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerCircularLinesEx(const char *label, float radius,const ImColor color, float speed, int lines, int mode);
|
||||
CIMSPINNER_API void SpinnerDots(const char *label, float *nextdot, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerDotsEx(const char *label, float *nextdot, float radius, float thickness,const ImColor color, float speed, size_t dots, float minth, int mode);
|
||||
CIMSPINNER_API void SpinnerVDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerVDotsEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bgcolor, float speed, size_t dots, size_t mdots, int mode);
|
||||
CIMSPINNER_API void SpinnerBounceDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerBounceDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, int mode);
|
||||
CIMSPINNER_API void SpinnerZipDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerZipDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots);
|
||||
CIMSPINNER_API void SpinnerDotsToPoints(const char *label, float radius, float thickness, float offset_k);
|
||||
CIMSPINNER_API void SpinnerDotsToPointsEx(const char *label, float radius, float thickness, float offset_k,const ImColor color, float speed, size_t dots);
|
||||
CIMSPINNER_API void SpinnerDotsToBar(const char *label, float radius, float thickness, float offset_k);
|
||||
CIMSPINNER_API void SpinnerDotsToBarEx(const char *label, float radius, float thickness, float offset_k,const ImColor color, float speed, size_t dots);
|
||||
CIMSPINNER_API void SpinnerWaveDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerWaveDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt);
|
||||
CIMSPINNER_API void SpinnerFadeDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerFadeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, int mode);
|
||||
CIMSPINNER_API void SpinnerThreeDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerThreeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt);
|
||||
CIMSPINNER_API void SpinnerFiveDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerFiveDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt);
|
||||
CIMSPINNER_API void Spinner4Caleidospcope(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void Spinner4CaleidospcopeEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt);
|
||||
CIMSPINNER_API void SpinnerMultiFadeDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerMultiFadeDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt);
|
||||
CIMSPINNER_API void SpinnerThickToSin(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerThickToSinEx(const char *label, float radius, float thickness,const ImColor color, float speed, int nt, int lt, int mode);
|
||||
CIMSPINNER_API void SpinnerScaleDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt);
|
||||
CIMSPINNER_API void SpinnerSquareSpins(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSquareSpinsEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerMovingDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerMovingDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots);
|
||||
CIMSPINNER_API void SpinnerRotateDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRotateDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int dots, int mode);
|
||||
CIMSPINNER_API void SpinnerOrionDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerOrionDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int arcs);
|
||||
CIMSPINNER_API void SpinnerGalaxyDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerGalaxyDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int arcs);
|
||||
CIMSPINNER_API void SpinnerTwinAng(const char *label, float radius1, float radius2, float thickness);
|
||||
CIMSPINNER_API void SpinnerTwinAngEx(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed, float angle, int mode);
|
||||
CIMSPINNER_API void SpinnerFilling(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerFillingEx(const char *label, float radius, float thickness,const ImColor color1, const ImColor color2, float speed);
|
||||
CIMSPINNER_API void SpinnerFillingMem(const char *label, float radius, float thickness, const ImColor color, ImColor colorbg, float speed);
|
||||
CIMSPINNER_API void SpinnerTopup(const char *label, float radius1, float radius2);
|
||||
CIMSPINNER_API void SpinnerTopupEx(const char *label, float radius1, float radius2,const ImColor color, const ImColor fg, const ImColor bg, float speed);
|
||||
CIMSPINNER_API void SpinnerTwinAng180(const char *label, float radius1, float radius2, float thickness);
|
||||
CIMSPINNER_API void SpinnerTwinAng180Ex(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed, float angle, int mode);
|
||||
CIMSPINNER_API void SpinnerTwinAng360(const char *label, float radius1, float radius2, float thickness);
|
||||
CIMSPINNER_API void SpinnerTwinAng360Ex(const char *label, float radius1, float radius2, float thickness,const ImColor color1, const ImColor color2, float speed1, float speed2, int mode);
|
||||
CIMSPINNER_API void SpinnerIncDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerIncDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots);
|
||||
CIMSPINNER_API void SpinnerIncFullDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerIncFullDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots);
|
||||
CIMSPINNER_API void SpinnerFadeBars(const char *label, float w);
|
||||
CIMSPINNER_API void SpinnerFadeBarsEx(const char *label, float w,const ImColor color, float speed, size_t bars, bool scale);
|
||||
CIMSPINNER_API void SpinnerFadeTris(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerFadeTrisEx(const char *label, float radius,const ImColor color, float speed, size_t dim, bool scale, int mode);
|
||||
CIMSPINNER_API void SpinnerBarsRotateFade(const char *label, float rmin, float rmax , float thickness);
|
||||
CIMSPINNER_API void SpinnerBarsRotateFadeEx(const char *label, float rmin, float rmax , float thickness,const ImColor color, float speed, size_t bars);
|
||||
CIMSPINNER_API void SpinnerBarsScaleMiddle(const char *label, float w);
|
||||
CIMSPINNER_API void SpinnerBarsScaleMiddleEx(const char *label, float w,const ImColor color, float speed, size_t bars);
|
||||
CIMSPINNER_API void SpinnerAngTwin(const char *label, float radius1, float radius2, float thickness);
|
||||
CIMSPINNER_API void SpinnerAngTwinEx(const char *label, float radius1, float radius2, float thickness,const ImColor color, const ImColor bg, float speed, float angle, size_t arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerArcRotation(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerArcRotationEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerArcFade(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerArcFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerSimpleArcFade(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSimpleArcFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerSquareStrokeFade(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSquareStrokeFadeEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerAsciiSymbolPoints(const char *label, const char* text, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerAsciiSymbolPointsEx(const char *label, const char* text, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerTextFading(const char *label, const char* text, float radius, float fsize);
|
||||
CIMSPINNER_API void SpinnerTextFadingEx(const char *label, const char* text, float radius, float fsize,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerSevenSegments(const char *label, const char* text, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSevenSegmentsEx(const char *label, const char* text, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerSquareStrokeFill(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSquareStrokeFillEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerSquareStrokeLoading(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSquareStrokeLoadingEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerSquareLoading(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSquareLoadingEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerFilledArcFade(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerFilledArcFadeEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerPointsRoller(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerPointsRollerEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t points, int circles, float rspeed);
|
||||
CIMSPINNER_API void SpinnerPointsArcBounce(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerPointsArcBounceEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t points, int circles, float rspeed);
|
||||
CIMSPINNER_API void SpinnerFilledArcColor(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerFilledArcColorEx(const char *label, float radius,const ImColor color, const ImColor bg, float speed, size_t arcs);
|
||||
CIMSPINNER_API void SpinnerFilledArcRing(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerFilledArcRingEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t arcs);
|
||||
CIMSPINNER_API void SpinnerArcWedges(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerArcWedgesEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerTwinBall(const char *label, float radius1, float radius2, float thickness, float b_thickness);
|
||||
CIMSPINNER_API void SpinnerTwinBallEx(const char *label, float radius1, float radius2, float thickness, float b_thickness,const ImColor ball, const ImColor bg, float speed, size_t balls, int mode);
|
||||
CIMSPINNER_API void SpinnerSolarBalls(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSolarBallsEx(const char *label, float radius, float thickness,const ImColor ball, const ImColor bg, float speed, size_t balls);
|
||||
CIMSPINNER_API void SpinnerSolarScaleBalls(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSolarScaleBallsEx(const char *label, float radius, float thickness,const ImColor ball, float speed, size_t balls);
|
||||
CIMSPINNER_API void SpinnerSolarArcs(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSolarArcsEx(const char *label, float radius, float thickness,const ImColor ball, const ImColor bg, float speed, size_t balls);
|
||||
CIMSPINNER_API void SpinnerMovingArcs(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerMovingArcsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs);
|
||||
CIMSPINNER_API void SpinnerRainbowCircle(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRainbowCircleEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, float mode);
|
||||
CIMSPINNER_API void SpinnerBounceBall(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerBounceBallEx(const char *label, float radius, float thickness,const ImColor color, float speed, int dots, bool shadow);
|
||||
CIMSPINNER_API void SpinnerPulsarBall(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerPulsarBallEx(const char *label, float radius, float thickness,const ImColor color, float speed, bool shadow, int mode);
|
||||
CIMSPINNER_API void SpinnerIncScaleDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerIncScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, float angle, int mode);
|
||||
CIMSPINNER_API void SpinnerSomeScaleDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSomeScaleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t dots, int mode);
|
||||
CIMSPINNER_API void SpinnerAngTriple(const char *label, float radius1, float radius2, float radius3, float thickness);
|
||||
CIMSPINNER_API void SpinnerAngTripleEx(const char *label, float radius1, float radius2, float radius3, float thickness,const ImColor c1, const ImColor c2, const ImColor c3, float speed, float angle);
|
||||
CIMSPINNER_API void SpinnerAngEclipse(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerAngEclipseEx(const char *label, float radius, float thickness,const ImColor color, float speed, float angle);
|
||||
CIMSPINNER_API void SpinnerIngYang(const char *label, float radius, float thickness, bool reverse, float yang_detlta_r);
|
||||
CIMSPINNER_API void SpinnerIngYangEx(const char *label, float radius, float thickness, bool reverse, float yang_detlta_r,const ImColor colorI, const ImColor colorY, float speed, float angle, int mode);
|
||||
CIMSPINNER_API void SpinnerGooeyBalls(const char *label, float radius, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerGooeyBallsEx(const char *label, float radius, const ImColor color, float speed,int mode);
|
||||
CIMSPINNER_API void SpinnerDotsLoading(const char *label, float radius, float thickness, const ImColor color, const ImColor bg, float speed);
|
||||
CIMSPINNER_API void SpinnerRotateGooeyBalls(const char *label, float radius, float thickness, const ImColor color, float speed, int balls);
|
||||
CIMSPINNER_API void SpinnerRotateGooeyBallsEx(const char *label, float radius, float thickness, const ImColor color, float speed, int balls,int mode);
|
||||
CIMSPINNER_API void SpinnerHerbertBalls(const char *label, float radius, float thickness, const ImColor color, float speed, int balls);
|
||||
CIMSPINNER_API void SpinnerHerbertBalls3D(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerRotateTriangles(const char *label, float radius, float thickness, const ImColor color, float speed, int tris);
|
||||
CIMSPINNER_API void SpinnerRotateTrianglesEx(const char *label, float radius, float thickness, const ImColor color, float speed, int tris,int mode);
|
||||
CIMSPINNER_API void SpinnerRotateShapes(const char *label, float radius, float thickness, const ImColor color, float speed, int shapes, int pnt);
|
||||
CIMSPINNER_API void SpinnerSinSquares(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerSinSquaresEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode);
|
||||
CIMSPINNER_API void SpinnerMoonLine(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerMoonLineEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle);
|
||||
CIMSPINNER_API void SpinnerCircleDrop(const char *label, float radius, float thickness, float thickness_drop);
|
||||
CIMSPINNER_API void SpinnerCircleDropEx(const char *label, float radius, float thickness, float thickness_drop,const ImColor color, const ImColor bg, float speed, float angle);
|
||||
CIMSPINNER_API void SpinnerSurroundedIndicator(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSurroundedIndicatorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed);
|
||||
CIMSPINNER_API void SpinnerWifiIndicator(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerWifiIndicatorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float cangle, int dots);
|
||||
CIMSPINNER_API void SpinnerTrianglesSelector(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerTrianglesSelectorEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars);
|
||||
typedef ImColor LeafColor(int);
|
||||
CIMSPINNER_API void SpinnerCamera(const char *label, float radius, float thickness, LeafColor *leaf_color);
|
||||
CIMSPINNER_API void SpinnerCameraEx(const char *label, float radius, float thickness, LeafColor *leaf_color,float speed, size_t bars, int mode);
|
||||
CIMSPINNER_API void SpinnerFlowingGradient(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerFlowingGradientEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle);
|
||||
CIMSPINNER_API void SpinnerRotateSegments(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRotateSegmentsEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, size_t layers, int mode);
|
||||
CIMSPINNER_API void SpinnerLemniscate(const char* label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerLemniscateEx(const char* label, float radius, float thickness,const ImColor color, float speed, float angle);
|
||||
CIMSPINNER_API void SpinnerRotateGear(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRotateGearEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t pins);
|
||||
CIMSPINNER_API void SpinnerRotateWheel(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRotateWheelEx(const char *label, float radius, float thickness,const ImColor bg_color, const ImColor color, float speed, size_t pins);
|
||||
CIMSPINNER_API void SpinnerAtom(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerAtomEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses);
|
||||
CIMSPINNER_API void SpinnerPatternRings(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerPatternRingsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses);
|
||||
CIMSPINNER_API void SpinnerPatternEclipse(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerPatternEclipseEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses, float delta_a, float delta_y);
|
||||
CIMSPINNER_API void SpinnerPatternSphere(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerPatternSphereEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses);
|
||||
CIMSPINNER_API void SpinnerRingSynchronous(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRingSynchronousEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses);
|
||||
CIMSPINNER_API void SpinnerRingWatermarks(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRingWatermarksEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses);
|
||||
CIMSPINNER_API void SpinnerRotatedAtom(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRotatedAtomEx(const char *label, float radius, float thickness,const ImColor color, float speed, int elipses, int mode);
|
||||
CIMSPINNER_API void SpinnerRainbowBalls(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerRainbowBallsEx(const char *label, float radius, float thickness, const ImColor color, float speed,int balls, int mode, int rings, int mx);
|
||||
CIMSPINNER_API void SpinnerRainbowShot(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerRainbowShotEx(const char *label, float radius, float thickness, const ImColor color, float speed,int balls, int mode);
|
||||
CIMSPINNER_API void SpinnerSpiral(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSpiralEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs);
|
||||
CIMSPINNER_API void SpinnerSpiralEye(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSpiralEyeEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerBarChartSine(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerBarChartSineEx(const char *label, float radius, float thickness, const ImColor color, float speed,int bars, int mode);
|
||||
CIMSPINNER_API void SpinnerBarChartAdvSine(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerBarChartAdvSineEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode);
|
||||
CIMSPINNER_API void SpinnerBarChartAdvSineFade(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerBarChartAdvSineFadeEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode);
|
||||
CIMSPINNER_API void SpinnerBarChartRainbow(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerBarChartRainbowEx(const char *label, float radius, float thickness, const ImColor color, float speed,int bars, int mode);
|
||||
CIMSPINNER_API void SpinnerBlocks(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerTwinBlocks(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerSquareRandomDots(const char *label, float radius, float thickness, const ImColor bg, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerScaleBlocks(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerScaleBlocksEx(const char *label, float radius, float thickness, const ImColor color, float speed,int mode);
|
||||
CIMSPINNER_API void SpinnerScaleSquares(const char *label, float radius, float thikness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerSquishSquare(const char *label, float radius, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerFluid(const char *label, float radius, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerFluidEx(const char *label, float radius, const ImColor color, float speed,int bars);
|
||||
CIMSPINNER_API void SpinnerFluidPoints(const char *label, float radius, float thickness, const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerFluidPointsEx(const char *label, float radius, float thickness, const ImColor color, float speed,size_t dots, float delta);
|
||||
CIMSPINNER_API void SpinnerArcPolarFade(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerArcPolarFadeEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerArcPolarRadius(const char *label, float radius);
|
||||
CIMSPINNER_API void SpinnerArcPolarRadiusEx(const char *label, float radius,const ImColor color, float speed, size_t arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerCaleidoscope(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerCaleidoscopeEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, int mode);
|
||||
CIMSPINNER_API void SpinnerHboDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerHboDotsEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, size_t dots, int mode);
|
||||
CIMSPINNER_API void SpinnerMoonDots(const char *label, float radius, float thickness, const ImColor first, const ImColor second);
|
||||
CIMSPINNER_API void SpinnerMoonDotsEx(const char *label, float radius, float thickness, const ImColor first, const ImColor second,float speed);
|
||||
CIMSPINNER_API void SpinnerTwinHboDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerTwinHboDotsEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, size_t dots, float delta);
|
||||
CIMSPINNER_API void SpinnerThreeDotsStar(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerThreeDotsStarEx(const char *label, float radius, float thickness,const ImColor color, float minfade, float ryk, float speed, float delta);
|
||||
CIMSPINNER_API void SpinnerSineArcs(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSineArcsEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerTrianglesShift(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerTrianglesShiftEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars);
|
||||
CIMSPINNER_API void SpinnerPointsShift(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerPointsShiftEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, size_t bars);
|
||||
CIMSPINNER_API void SpinnerSwingDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSwingDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed);
|
||||
CIMSPINNER_API void SpinnerCircularPoints(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerCircularPointsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lines);
|
||||
CIMSPINNER_API void SpinnerCurvedCircle(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerCurvedCircleEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t circles);
|
||||
CIMSPINNER_API void SpinnerModCircle(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerModCircleEx(const char *label, float radius, float thickness,const ImColor color, float ang_min, float ang_max, float speed);
|
||||
CIMSPINNER_API void SpinnerDnaDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerDnaDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, float delta, bool mode);
|
||||
CIMSPINNER_API void Spinner3SmuggleDots(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void Spinner3SmuggleDotsEx(const char *label, float radius, float thickness,const ImColor color, float speed, int lt, float delta, bool mode);
|
||||
CIMSPINNER_API void SpinnerRotateSegmentsPulsar(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerRotateSegmentsPulsarEx(const char *label, float radius, float thickness,const ImColor color, float speed, size_t arcs, size_t layers);
|
||||
CIMSPINNER_API void SpinnerSplineAng(const char *label, float radius, float thickness);
|
||||
CIMSPINNER_API void SpinnerSplineAngEx(const char *label, float radius, float thickness,const ImColor color, const ImColor bg, float speed, float angle, int mode);
|
||||
|
||||
CIMSPINNER_API void demoSpinners();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define SPINNER_RAINBOWMIX
|
||||
#define SPINNER_DNADOTS
|
||||
#define SPINNER_ANG8
|
||||
#define SPINNER_CLOCK
|
||||
#define SPINNER_PULSAR
|
||||
#define SPINNER_DOTSTOBAR
|
||||
#define SPINNER_ATOM
|
||||
#define SPINNER_BARCHARTRAINBOW
|
||||
#define SPINNER_SWINGDOTS
|
||||
Vendored
-4950
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,6 @@
|
||||
|
||||
pkgs.librsvg
|
||||
pkgs.libpng
|
||||
pkgs.libarchive
|
||||
];
|
||||
extraNativeBuildInputs = [
|
||||
pkgs.util-linux
|
||||
|
||||
@@ -23,6 +23,11 @@ finish-args:
|
||||
- --system-talk-name=org.freedesktop.Avahi
|
||||
# Allow getting the pretty hostname
|
||||
- --system-talk-name=org.freedesktop.hostname1
|
||||
# List applications from $XDG_DATA_DIRS
|
||||
- --filesystem=host-os:ro
|
||||
- --filesystem=xdg-data:ro
|
||||
# List flatpak Steam games
|
||||
- --filesystem=~/.var/app/com.valvesoftware.Steam:ro
|
||||
# Pipewire
|
||||
- --filesystem=xdg-run/pipewire-0
|
||||
# Set the active OpenXR / OpenVR runtime
|
||||
@@ -93,10 +98,11 @@ modules:
|
||||
url: https://www.mpfr.org/mpfr-4.2.1/mpfr-4.2.1.tar.xz
|
||||
sha256: 277807353a6726978996945af13e52829e3abd7a9a5b7fb2793894e18f1fcbb2
|
||||
- type: file
|
||||
url: https://libisl.sourceforge.io/isl-0.26.tar.xz
|
||||
dest-filename: isl-0.26.tar.xz
|
||||
url: https://sourceforge.net/projects/libisl/files/isl-0.26.tar.xz/download
|
||||
sha256: a0b5cb06d24f9fa9e77b55fabbe9a3c94a336190345c2555f9915bb38e976504
|
||||
- type: file
|
||||
url: https://www.multiprecision.org/downloads/mpc-1.3.1.tar.gz
|
||||
url: https://ftpmirror.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz
|
||||
sha256: ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8
|
||||
- type: file
|
||||
url: https://invisible-mirror.net/archives/ncurses/ncurses-6.4.tar.gz
|
||||
@@ -307,7 +313,7 @@ modules:
|
||||
sources:
|
||||
- type: git
|
||||
url: https://github.com/Supreeeme/xrizer.git
|
||||
tag: fcc6793ffeadf0d7676c4cfd5a6c57da481a520c
|
||||
tag: 76e01ac8ad79fed226a883985daa3cbe61271ca7
|
||||
- xrizer-gen-src.json
|
||||
|
||||
- name: wivrn-library
|
||||
|
||||
+99
-113
@@ -2,14 +2,13 @@
|
||||
# This file is distributed under the same license as the WiVRn-dashboard package.
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2025 not <github.superglue094@slmail.me>
|
||||
# SPDX-FileCopyrightText: 2025 eps <eps@bwsal.org>
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WiVRn-dashboard\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-08-08 20:41+0200\n"
|
||||
"PO-Revision-Date: 2025-08-08 22:35+0200\n"
|
||||
"Last-Translator: eps <eps@bwsal.org>\n"
|
||||
"POT-Creation-Date: 2025-07-25 22:10+0200\n"
|
||||
"PO-Revision-Date: 2025-08-02 18:48+0200\n"
|
||||
"Last-Translator: not <github.superglue094@slmail.me>\n"
|
||||
"Language-Team: Slovak <>\n"
|
||||
"Language: sk\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -21,12 +20,12 @@ msgstr ""
|
||||
#: dashboard/apk_installer.cpp:167
|
||||
#, kde-format
|
||||
msgid "Downloading APK: %1 MB / %2 MB"
|
||||
msgstr "Sťahuje sa APK: %1 MB / %2 MB"
|
||||
msgstr "Sťahujem APK: %1 MB / %2 MB"
|
||||
|
||||
#: dashboard/apk_installer.cpp:169
|
||||
#, kde-format
|
||||
msgid "Downloading APK: %1 MB"
|
||||
msgstr "Sťahuje sa APK: %1 MB"
|
||||
msgstr "Sťahujem APK: %1 MB"
|
||||
|
||||
#: dashboard/apk_installer.cpp:178
|
||||
#, kde-format
|
||||
@@ -36,12 +35,12 @@ msgstr "Sťahovanie zrušené"
|
||||
#: dashboard/apk_installer.cpp:194
|
||||
#, kde-format
|
||||
msgid "Cannot download APK: %1"
|
||||
msgstr "APK sa nedá stiahnúť: %1"
|
||||
msgstr "APK sa nedá stiahnuť: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:217
|
||||
#, kde-format
|
||||
msgid "Installing APK"
|
||||
msgstr "Inštaluje sa APK"
|
||||
msgstr "Inštalujem APK"
|
||||
|
||||
#: dashboard/apk_installer.cpp:221
|
||||
#, kde-format
|
||||
@@ -51,7 +50,7 @@ msgstr "Nepodarilo sa spustiť adb: %1"
|
||||
#: dashboard/apk_installer.cpp:231
|
||||
#, kde-format
|
||||
msgid "adb exited abnormally: %1"
|
||||
msgstr "adb sa neočakávane ukončilo: %1"
|
||||
msgstr "adb sa neočakávane ukončil: %1"
|
||||
|
||||
#: dashboard/apk_installer.cpp:239
|
||||
#, kde-format
|
||||
@@ -77,15 +76,15 @@ msgstr "Nainštaluj si aplikáciu WiVRn do headsetu"
|
||||
#: dashboard/qml/WizardPage.qml:192
|
||||
#, kde-format
|
||||
msgid "Checking latest release..."
|
||||
msgstr "Kontroluje sa najnovšia verzia…"
|
||||
msgstr "Kontrolujem najnovšiu verziu…"
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:43 dashboard/qml/WizardPage.qml:198
|
||||
#, kde-format
|
||||
msgid "No precompiled APK is available for this version."
|
||||
msgstr "Pre túto verziu nie je dostupné predkompilované APK."
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:259
|
||||
#: dashboard/qml/Main.qml:341
|
||||
#: dashboard/qml/ApkInstallPage.qml:45 dashboard/qml/Main.qml:247
|
||||
#: dashboard/qml/Main.qml:329
|
||||
#, kde-format
|
||||
msgid "ADB is not installed."
|
||||
msgstr "ADB nie je nainštalované."
|
||||
@@ -93,7 +92,7 @@ msgstr "ADB nie je nainštalované."
|
||||
#: dashboard/qml/ApkInstallPage.qml:47
|
||||
#, kde-format
|
||||
msgid "Connect a headset and make sure developer mode is enabled."
|
||||
msgstr "Pripojte headset a uistite sa, že je zapnutý vývojársky režim."
|
||||
msgstr "Pripoj headset a uisti sa, že je zapnutý vývojársky režim."
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:51 dashboard/qml/WizardPage.qml:204
|
||||
#, kde-format
|
||||
@@ -103,11 +102,12 @@ msgid ""
|
||||
"client."
|
||||
msgstr ""
|
||||
"Postupuj podľa pokynov v <a href=\"https://github.com/WiVRn/WiVRn/blob/"
|
||||
"master/docs/building.md#client-headset\">dokumentácii</a> na vytvorenie "
|
||||
"vlastného klienta."
|
||||
"master/docs/building.md#client-headset\">dokumentácii</a> na vytvorenie vlastn"
|
||||
"ého "
|
||||
"klienta."
|
||||
|
||||
#: dashboard/qml/ApkInstallPage.qml:65 dashboard/qml/HeadsetStatsPage.qml:36
|
||||
#: dashboard/qml/HeadsetsPage.qml:183 dashboard/qml/TroubleshootPage.qml:59
|
||||
#: dashboard/qml/ApkInstallPage.qml:65 dashboard/qml/HeadsetsPage.qml:183
|
||||
#: dashboard/qml/HeadsetStatsPage.qml:36 dashboard/qml/TroubleshootPage.qml:59
|
||||
#, kde-format
|
||||
msgctxt "go back to the home page"
|
||||
msgid "Back"
|
||||
@@ -116,7 +116,7 @@ msgstr "Späť"
|
||||
#: dashboard/qml/ConnectUsbDialog.qml:11
|
||||
#, kde-format
|
||||
msgid "Select your headset"
|
||||
msgstr "Vyberte svoj headset"
|
||||
msgstr "Vyber svoj headset"
|
||||
|
||||
#: dashboard/qml/DeviceCard.qml:46
|
||||
#, kde-format
|
||||
@@ -133,12 +133,7 @@ msgstr "Preinštalovať WiVRn"
|
||||
msgid "Install WiVRn"
|
||||
msgstr "Nainštalovať WiVRn"
|
||||
|
||||
#: dashboard/qml/HeadsetStatsPage.qml:12
|
||||
#, kde-format
|
||||
msgid "Headset statistics"
|
||||
msgstr "Štatistiky headsetu"
|
||||
|
||||
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:354
|
||||
#: dashboard/qml/HeadsetsPage.qml:12 dashboard/qml/Main.qml:342
|
||||
#, kde-format
|
||||
msgid "Headsets"
|
||||
msgstr "Headsety"
|
||||
@@ -215,12 +210,12 @@ msgstr "Vypnúť párovanie"
|
||||
#: dashboard/qml/HeadsetsPage.qml:166
|
||||
#, kde-format
|
||||
msgid "Start the WiVRn app on your headset and use the PIN: %1"
|
||||
msgstr "Spustite aplikáciu WiVRn v headsete a zadajte PIN: %1"
|
||||
msgstr "Spusť aplikáciu WiVRn v headsete a zadaj PIN: %1"
|
||||
|
||||
#: dashboard/qml/HeadsetsPage.qml:166
|
||||
#, kde-format
|
||||
msgid "Enable pairing to allow your headset to connect to this computer"
|
||||
msgstr "Zapnite párovanie, aby sa mohol headset pripojiť k tomuto počítaču"
|
||||
msgstr "Zapni párovanie, aby sa mohol headset pripojiť k tomuto počítaču"
|
||||
|
||||
#: dashboard/qml/HeadsetsPage.qml:171 dashboard/qml/TroubleshootPage.qml:37
|
||||
#, kde-format
|
||||
@@ -232,128 +227,122 @@ msgstr "Zapnúť párovanie"
|
||||
msgid "Pair a new headset"
|
||||
msgstr "Spárovať nový headset"
|
||||
|
||||
#: dashboard/qml/Main.qml:107
|
||||
#: dashboard/qml/HeadsetStatsPage.qml:12
|
||||
#, kde-format
|
||||
msgid "Headset statistics"
|
||||
msgstr "Štatistiky headsetu"
|
||||
|
||||
#: dashboard/qml/Main.qml:103
|
||||
#, kde-format
|
||||
msgid "The server does not have CAP_SYS_NICE capabilities."
|
||||
msgstr "Server nemá oprávnenia CAP_SYS_NICE."
|
||||
|
||||
#: dashboard/qml/Main.qml:114
|
||||
#: dashboard/qml/Main.qml:110
|
||||
#, kde-format
|
||||
msgid "Fix it"
|
||||
msgstr "Opraviť"
|
||||
|
||||
#: dashboard/qml/Main.qml:123
|
||||
#: dashboard/qml/Main.qml:119
|
||||
#, kde-format
|
||||
msgid "The CAP_SYS_NICE capability will be used when the server is restarted."
|
||||
msgstr "CAP_SYS_NICE bude použité po reštarte servera."
|
||||
|
||||
#: dashboard/qml/Main.qml:129
|
||||
#: dashboard/qml/Main.qml:125
|
||||
#, kde-format
|
||||
msgctxt "restart the server"
|
||||
msgid "Restart now"
|
||||
msgstr "Reštartovať teraz"
|
||||
|
||||
#: dashboard/qml/Main.qml:140
|
||||
#: dashboard/qml/Main.qml:136
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"NVIDIA GPUs require at least driver version 565.77, current version is %1"
|
||||
msgstr ""
|
||||
"GPU od NVIDIA vyžadujú minimálne verziu ovládača 565.77, aktuálna verzia je "
|
||||
"%1"
|
||||
"GPU od NVIDIA vyžadujú minimálne verziu ovládača 565.77, aktuálna verzia je %1"
|
||||
|
||||
#: dashboard/qml/Main.qml:146
|
||||
#: dashboard/qml/Main.qml:142
|
||||
#, kde-format
|
||||
msgid "More info"
|
||||
msgstr "Viac info"
|
||||
|
||||
#: dashboard/qml/Main.qml:154
|
||||
#: dashboard/qml/Main.qml:150
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"Use the Mesa (radv) driver for AMD GPUs\n"
|
||||
"Hardware encoding with vaapi does not work with AMDVLK and AMDGPU-PRO"
|
||||
msgstr ""
|
||||
"Pre GPU od AMD používajte ovládač Mesa (radv)\n"
|
||||
"Pre GPU od AMD používaj ovládač Mesa (radv)\n"
|
||||
"Hardvérové kódovanie cez vaapi nefunguje s AMDVLK ani AMDGPU-PRO"
|
||||
|
||||
#: dashboard/qml/Main.qml:162
|
||||
#, kde-format
|
||||
msgid ""
|
||||
"No OpenVR compatibility detected, Steam games won't be able to load VR.\n"
|
||||
"Install xrizer or OpenComposite."
|
||||
msgstr ""
|
||||
"Žiadna OpenVR kompatibilita nebola nájdená, Hry na steame nebude možné "
|
||||
"načítať do VRka.\n"
|
||||
"Nainštalujte xrizer alebo OpenComposite."
|
||||
|
||||
#: dashboard/qml/Main.qml:171
|
||||
#: dashboard/qml/Main.qml:159
|
||||
#, kde-format
|
||||
msgid "Server failed to start"
|
||||
msgstr "Nepodarilo sa spustiť server"
|
||||
|
||||
#: dashboard/qml/Main.qml:177 dashboard/qml/TroubleshootPage.qml:77
|
||||
#: dashboard/qml/Main.qml:165 dashboard/qml/TroubleshootPage.qml:77
|
||||
#, kde-format
|
||||
msgid "Open server logs"
|
||||
msgstr "Zobraziť logy servera"
|
||||
|
||||
#: dashboard/qml/Main.qml:214
|
||||
#: dashboard/qml/Main.qml:202
|
||||
#, kde-format
|
||||
msgctxt "whether the server is running, displayed in front of a checkbox"
|
||||
msgid "Running"
|
||||
msgstr "Beží"
|
||||
|
||||
#: dashboard/qml/Main.qml:229
|
||||
#: dashboard/qml/Main.qml:217
|
||||
#, kde-format
|
||||
msgctxt "whether pairing is enabled, displayed in front of a checkbox"
|
||||
msgid "Pairing"
|
||||
msgstr "Párovanie"
|
||||
|
||||
#: dashboard/qml/Main.qml:242
|
||||
#: dashboard/qml/Main.qml:230
|
||||
#, kde-format
|
||||
msgid "PIN: %1"
|
||||
msgstr "PIN: %1"
|
||||
|
||||
#: dashboard/qml/Main.qml:250 dashboard/qml/WizardPage.qml:373
|
||||
#: dashboard/qml/Main.qml:238 dashboard/qml/WizardPage.qml:373
|
||||
#, kde-format
|
||||
msgid "Connect by USB"
|
||||
msgstr "Pripojiť cez USB"
|
||||
|
||||
#: dashboard/qml/Main.qml:261
|
||||
#: dashboard/qml/Main.qml:249
|
||||
#, kde-format
|
||||
msgid "No headset is connected or your headset is not in developer mode."
|
||||
msgstr "Žiadny headset nie je pripojený alebo nemá zapnutý vývojársky režim."
|
||||
|
||||
#: dashboard/qml/Main.qml:269
|
||||
#: dashboard/qml/Main.qml:257
|
||||
#, kde-format
|
||||
msgid "Disconnect"
|
||||
msgstr "Odpojiť"
|
||||
|
||||
#: dashboard/qml/Main.qml:286
|
||||
#: dashboard/qml/Main.qml:274
|
||||
#, kde-format
|
||||
msgctxt "automatically started application"
|
||||
msgid "Application"
|
||||
msgstr "Aplikácia"
|
||||
|
||||
#: dashboard/qml/Main.qml:307
|
||||
#: dashboard/qml/Main.qml:295
|
||||
#, kde-format
|
||||
msgid "Steam information"
|
||||
msgstr "Informácie o Steame"
|
||||
|
||||
#: dashboard/qml/Main.qml:325
|
||||
#: dashboard/qml/Main.qml:313
|
||||
#, kde-format
|
||||
msgid "Wizard"
|
||||
msgstr "Sprievodca"
|
||||
|
||||
#: dashboard/qml/Main.qml:332
|
||||
#: dashboard/qml/Main.qml:320
|
||||
#, kde-format
|
||||
msgid "Install the app"
|
||||
msgstr "Nainštalovať aplikáciu"
|
||||
|
||||
#: dashboard/qml/Main.qml:361 dashboard/qml/SettingsPage.qml:14
|
||||
#: dashboard/qml/Main.qml:349 dashboard/qml/SettingsPage.qml:14
|
||||
#, kde-format
|
||||
msgid "Settings"
|
||||
msgstr "Nastavenia"
|
||||
|
||||
#: dashboard/qml/Main.qml:368 dashboard/qml/TroubleshootPage.qml:10
|
||||
#: dashboard/qml/Main.qml:356 dashboard/qml/TroubleshootPage.qml:10
|
||||
#, kde-format
|
||||
msgid "Troubleshoot"
|
||||
msgstr "Riešiť problémy"
|
||||
@@ -380,12 +369,12 @@ msgstr "Prehľadať"
|
||||
#, kde-format
|
||||
msgctxt "automatic foveation setup"
|
||||
msgid "Manual foveation"
|
||||
msgstr "Manuálne foveovanie"
|
||||
msgstr "Manuálna foveation"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:46
|
||||
#, kde-format
|
||||
msgid "Foveation strength:"
|
||||
msgstr "Sila foveovania"
|
||||
msgstr "Foveation sila"
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:62
|
||||
#, kde-format
|
||||
@@ -404,13 +393,13 @@ msgid ""
|
||||
"The recommended values are between 20% and 50% for headsets without eye "
|
||||
"tracking and between 50% and 70% for headsets with eye tracking."
|
||||
msgstr ""
|
||||
"Silnejšia foveácia zvyšuje ostrosť v strede obrazu a znižuje ju na okrajoch, "
|
||||
"čím zrýchľuje dekódovanie. Je vhodnejšia pre rýchle hry.\n"
|
||||
"Silnejšia foveácia zvyšuje ostrosť v strede obrazu a znižuje ju na okrajoch, č"
|
||||
"ím zrýchľuje dekódovanie. Je vhodnejšia pre rýchle hry.\n"
|
||||
"\n"
|
||||
"Slabšia foveácia zachováva rovnomernú ostrosť v celom obraze.\n"
|
||||
"\n"
|
||||
"Odporúčané hodnoty sú medzi 20 % a 50 % pre headsety bez sledovania očí a "
|
||||
"medzi 50 % a 70 % pre headsety so sledovaním očí."
|
||||
"Odporúčané hodnoty sú medzi 20 % a 50 % pre headsety bez sledovania očí a medz"
|
||||
"i 50 % a 70 % pre headsety so sledovaním očí."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:74
|
||||
#, kde-format
|
||||
@@ -476,9 +465,8 @@ msgid ""
|
||||
"To add a new encoder, split an existing encoder by clicking near an edge.\n"
|
||||
"Drag an edge to resize or remove encoders."
|
||||
msgstr ""
|
||||
"Ak chcete pridať nový enkodér, rozdeľte existujúci kliknutím pri jeho "
|
||||
"okraji.\n"
|
||||
"Potiahnutím okraja môžete meniť veľkosť alebo enkodér odstrániť."
|
||||
"Ak chceš pridať nový enkodér, rozdeľ existujúci kliknutím pri jeho okraji.\n"
|
||||
"Potiahnutím okraja môžeš meniť veľkosť alebo enkodér odstrániť."
|
||||
|
||||
#: dashboard/qml/SettingsPage.qml:220
|
||||
#, kde-format
|
||||
@@ -618,14 +606,14 @@ msgid ""
|
||||
"For Steam games, right click on the game in Steam, go in Properties > "
|
||||
"General and paste this in \"Launch options\":"
|
||||
msgstr ""
|
||||
"Pre Steam hry kliknite pravým tlačidlom na hru v Steame, otvorte Vlastnosti > "
|
||||
"Všeobecné a vložte toto do \"Spúšťacích parametrov“:"
|
||||
"Pre Steam hry klikni pravým tlačidlom na hru v Steame, otvor Vlastnosti > "
|
||||
"Všeo becné a vlož toto do \"Spúšťacích parametrov“:"
|
||||
|
||||
#: dashboard/qml/SteamLaunchOptions.qml:20
|
||||
#, kde-format
|
||||
msgid "Paste this in the Steam launch options for the app you want to start"
|
||||
msgstr ""
|
||||
"Vložte toto do spúšťacích možností Steamu pre aplikáciu, ktorú chcete spustiť"
|
||||
"Vlož toto do spúšťacích možností Steamu pre aplikáciu, ktorú chceš spustiť"
|
||||
|
||||
#: dashboard/qml/SteamLaunchOptions.qml:26
|
||||
#, kde-format
|
||||
@@ -649,8 +637,8 @@ msgid ""
|
||||
"If you installed WiVRn over USB on a Meta headset, the app is in the "
|
||||
"\"unknown sources\" section."
|
||||
msgstr ""
|
||||
"Ak ste nainštalovali WiVRn cez USB na Meta headset, aplikácia sa nachádza v "
|
||||
"sekcii „neznáme zdroje“."
|
||||
"Ak si nainštaloval WiVRn cez USB na Meta headset, aplikácia sa nachádza v sekc"
|
||||
"ii „neznáme zdroje“."
|
||||
|
||||
#: dashboard/qml/TroubleshootPage.qml:24
|
||||
#, kde-format
|
||||
@@ -663,9 +651,8 @@ msgid ""
|
||||
"If the server is not visible or the connection fails, check that port 5353 "
|
||||
"(UDP) and 9757 (TCP and UDP) are open in your firewall."
|
||||
msgstr ""
|
||||
"Ak server nie je viditeľný alebo sa nepodarilo pripojenie, skontrolujte, či sú"
|
||||
" "
|
||||
"vo vašom firewalle otvorené porty 5353 (UDP) a 9757 (TCP aj UDP)."
|
||||
"Ak server nie je viditeľný alebo sa nepodarilo pripojenie, skontroluj, či sú v"
|
||||
" tvojom firewalle otvorené porty 5353 (UDP) a 9757 (TCP aj UDP)."
|
||||
|
||||
#: dashboard/qml/TroubleshootPage.qml:28
|
||||
#, kde-format
|
||||
@@ -679,9 +666,10 @@ msgid ""
|
||||
"</p><ul><li>The headset app version is in the \"About\" page</li><li>The "
|
||||
"server version is <b>%1</b></li></ul>"
|
||||
msgstr ""
|
||||
"<p>Verzia aplikácie v headsete a verzia servera na vašom počítači sa musia "
|
||||
"zhodovať.</p><ul><li>Verziu aplikácie nájdete v časti „O aplikácii“</"
|
||||
"li><li>Verzia servera je <b>%1</b></li></ul>"
|
||||
"<p>Verzia aplikácie v headsete a verzia servera na tvojom počítači sa musia zh"
|
||||
"odovať."
|
||||
"</p><ul><li>Verziu aplikácie nájdeš v časti „O aplikácii“</li><li>Verzia "
|
||||
"servera je <b>%1</b></li></ul>"
|
||||
|
||||
#: dashboard/qml/TroubleshootPage.qml:32
|
||||
#, kde-format
|
||||
@@ -694,8 +682,8 @@ msgid ""
|
||||
"If you have reinstalled the server or the client or if you want to connect "
|
||||
"another headset, you must enable pairing before connecting."
|
||||
msgstr ""
|
||||
"Ak ste preinštalovali server alebo klienta, alebo ak chcete pripojiť iný "
|
||||
"headset, musíte pred pripojením povoliť párovanie."
|
||||
"Ak si preinštaloval server alebo klienta, alebo ak chceš pripojiť iný headset,"
|
||||
" musíš pred pripojením povoliť párovanie."
|
||||
|
||||
#: dashboard/qml/TroubleshootPage.qml:33
|
||||
#, kde-format
|
||||
@@ -718,9 +706,8 @@ msgid ""
|
||||
"When the headset is connected, select \"WiVRn\" as the default audio output "
|
||||
"device for applications to use it."
|
||||
msgstr ""
|
||||
"Keď je headset pripojený, vyberte WiVRn ako predvolené zvukové zariadenie, aby"
|
||||
" "
|
||||
"ho aplikácie používali."
|
||||
"Keď je headset pripojený, vyber WiVRn ako predvolené zvukové zariadenie, aby h"
|
||||
"o aplikácie používali."
|
||||
|
||||
#: dashboard/qml/TroubleshootPage.qml:67
|
||||
#, kde-format
|
||||
@@ -756,8 +743,8 @@ msgid ""
|
||||
"This wizard will help you set up WiVRn on your headset and connect it to "
|
||||
"your computer."
|
||||
msgstr ""
|
||||
"Tento sprievodca vám pomôže nastaviť WiVRn na vašom headsete a pripojiť ho k "
|
||||
"počítaču."
|
||||
"Tento sprievodca ti pomôže nastaviť WiVRn na tvojom headsete a pripojiť ho k p"
|
||||
"očítaču."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:83 dashboard/qml/WizardPage.qml:258
|
||||
#: dashboard/qml/WizardPage.qml:321 dashboard/qml/WizardPage.qml:452
|
||||
@@ -769,12 +756,12 @@ msgstr "Ďalej"
|
||||
#: dashboard/qml/WizardPage.qml:112
|
||||
#, kde-format
|
||||
msgid "How to enable developer mode"
|
||||
msgstr "Ako zapnúť vývojársky režim"
|
||||
msgstr "Ako zapnúť vývojársky reži"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:119
|
||||
#, kde-format
|
||||
msgid "Follow the manufacturer's instructions below:"
|
||||
msgstr "Postupujte podľa inštrukcií od výrobcu:"
|
||||
msgstr "Postupuj podľa inštrukcií od výrobcu:"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:142
|
||||
#, kde-format
|
||||
@@ -783,9 +770,9 @@ msgid ""
|
||||
"headset.\n"
|
||||
"You can either install it from the Meta store or directly over USB."
|
||||
msgstr ""
|
||||
"Na používanie WiVRn je potrebné nainštalovať klientsku aplikáciu do "
|
||||
"headsetu.\n"
|
||||
"Môžete ju nainštalovať buď z Meta obchodu alebo priamo cez USB."
|
||||
"Na používanie WiVRn je potrebné nainštalovať klientsku aplikáciu do headsetu."
|
||||
"\n"
|
||||
"Môžeš ju nainštalovať buď z Meta obchodu alebo priamo cez USB."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:148
|
||||
#, kde-format
|
||||
@@ -798,8 +785,8 @@ msgid ""
|
||||
"For the Quest 2, 3, 3S, and Pro, you can get the app from the <a "
|
||||
"href=\"https://www.meta.com/experiences/7959676140827574/\">Meta store</a>."
|
||||
msgstr ""
|
||||
"Pre Quest 2, 3, 3S a Pro si môžete aplikáciu stiahnuť z <a href=\"https://"
|
||||
"www.meta.com/experiences/7959676140827574/\">obchodu Meta</a>."
|
||||
"Pre Quest 2, 3, 3S a Pro si môžeš aplikáciu stiahnuť z <a "
|
||||
"href=\"https://www.meta.com/experiences/7959676140827574/\">Meta obchodu</a>."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:164
|
||||
#, kde-format
|
||||
@@ -807,8 +794,8 @@ msgid ""
|
||||
"A newer release is available: %1 → %2, the client app on the Meta store may "
|
||||
"not be compatible."
|
||||
msgstr ""
|
||||
"K dispozícii je novšia verzia: %1 → %2, Aplikácia z obchodu Meta nemusí byť "
|
||||
"kompatibilná."
|
||||
"K dispozícii je novšia verzia: %1 → %2, Aplikácia z obchodu Meta nemusí byť ko"
|
||||
"mpatibilná."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:171
|
||||
#, kde-format
|
||||
@@ -816,8 +803,8 @@ msgid ""
|
||||
"This is a nightly build, the client app on the Meta store may not be "
|
||||
"compatible."
|
||||
msgstr ""
|
||||
"Toto je nightly verzia, aplikácia z Meta obchodu s ňou nemusí byť "
|
||||
"kompatibilná."
|
||||
"Toto je nightly verzia, aplikácia z Meta obchodu s ňou nemusí byť kompatibilná"
|
||||
"."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:181
|
||||
#, kde-format
|
||||
@@ -842,14 +829,14 @@ msgid ""
|
||||
"<ul><li>The ADB udev rules are installed</li><li>The headset is in <a "
|
||||
"href=\"#\">developer mode</a></li></ul></p>"
|
||||
msgstr ""
|
||||
"<p>Headset nebol rozpoznaný. Uistite sa, že:\n"
|
||||
"<ul><li>Máte nainštalované ADB udev rules</li><li>Headset je v <a "
|
||||
"<p>Headset nebol rozpoznaný. Uisti sa, že:\n"
|
||||
"<ul><li>Máš nainštalované ADB udev rules</li><li>Headset je v <a "
|
||||
"href=\"#\">režime vývojára</a></li></ul></p>"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:280
|
||||
#, kde-format
|
||||
msgid "Select the application you want to start"
|
||||
msgstr "Vyberte aplikáciu, ktorú chcete spustiť"
|
||||
msgstr "Vyber aplikáciu, ktorú chceš spustiť"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:286
|
||||
#, kde-format
|
||||
@@ -869,13 +856,13 @@ msgid ""
|
||||
"WiVRn entirely replaces SteamVR, you should not start SteamVR while WiVRn is "
|
||||
"running."
|
||||
msgstr ""
|
||||
"WiVRn úplne nahrádza SteamVR, preto by ste SteamVR nemali spúšťať, keď beží "
|
||||
"WiVRn"
|
||||
"WiVRn úplne nahrádza SteamVR, preto by si SteamVR nemal spúšťať, keď beží WiVR"
|
||||
"n"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:358
|
||||
#, kde-format
|
||||
msgid "Start the WiVRn app on your headset"
|
||||
msgstr "Spustite aplikáciu WiVRn v headsete"
|
||||
msgstr "Spusť aplikáciu WiVRn v headsete"
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:363
|
||||
#, kde-format
|
||||
@@ -883,14 +870,14 @@ msgid ""
|
||||
"To connect over WiFi, start the WiVRn app on your headset, connect to \"%1\" "
|
||||
"and enter PIN \"%2\"."
|
||||
msgstr ""
|
||||
"Na pripojenie cez Wi-Fi spustite aplikáciu WiVRn v headsete, pripojte sa k \"%"
|
||||
"1“ "
|
||||
"a zadajte PIN \"%2“."
|
||||
"Na pripojenie cez Wi-Fi spusti aplikáciu WiVRn v headsete, pripoj sa k \"%1“ a"
|
||||
" "
|
||||
"zadaj PIN \"%2“."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:370
|
||||
#, kde-format
|
||||
msgid "To connect over USB, click on \"Connect by USB\"."
|
||||
msgstr "Pre pripojenie cez USB kliknite na \"Pripojiť cez USB“."
|
||||
msgstr "Pre pripojenie cez USB klikni na \"Pripojiť cez USB“."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:383
|
||||
#, kde-format
|
||||
@@ -918,9 +905,8 @@ msgid ""
|
||||
"To connect another headset, make sure pairing is enabled in the dashboard "
|
||||
"before connecting."
|
||||
msgstr ""
|
||||
"Ak chcete pripojiť ďalší headset, uistite sa, že je v ovládacom paneli povolen"
|
||||
"é "
|
||||
"párovanie."
|
||||
"Ak chceš pripojiť ďalší headset, uisti sa, že je v ovládacom paneli povolené p"
|
||||
"árovanie."
|
||||
|
||||
#: dashboard/qml/WizardPage.qml:457 dashboard/qml/WizardPage.qml:494
|
||||
#, kde-format
|
||||
@@ -932,12 +918,12 @@ msgstr "Dokončiť"
|
||||
msgid "Finished"
|
||||
msgstr "Hotovo"
|
||||
|
||||
#: dashboard/wivrn_server.cpp:592
|
||||
#: dashboard/wivrn_server.cpp:584
|
||||
#, kde-format
|
||||
msgid "xrizer"
|
||||
msgstr "xrizer"
|
||||
|
||||
#: dashboard/wivrn_server.cpp:593
|
||||
#: dashboard/wivrn_server.cpp:585
|
||||
#, kde-format
|
||||
msgid "Open Composite"
|
||||
msgstr "Open Composite"
|
||||
|
||||
@@ -9,11 +9,6 @@ if [ -d ".git" ] ; then
|
||||
exec git am --committer-date-is-author-date "$@"
|
||||
fi
|
||||
|
||||
if ! type patch 2> /dev/null ; then
|
||||
echo "patch command not found" >&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# There is no reliable way to apply a patch and succeed if it was
|
||||
# already applied. Just ignore errors...
|
||||
for f in "$@" ; do
|
||||
|
||||
@@ -0,0 +1,700 @@
|
||||
From 1bc74f74b613cce9d32c0f4bf16de70ddb7fb482 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Nicolas <patricknicolas@laposte.net>
|
||||
Date: Mon, 2 Jun 2025 14:51:11 +0200
|
||||
Subject: [PATCH 10/10] Replace distortion with pixel-aligned foveation
|
||||
|
||||
---
|
||||
src/xrt/compositor/CMakeLists.txt | 2 +-
|
||||
src/xrt/compositor/render/render_compute.c | 181 ++-----------------
|
||||
src/xrt/compositor/render/render_interface.h | 33 ++--
|
||||
src/xrt/compositor/render/render_resources.c | 71 +-------
|
||||
src/xrt/compositor/shaders/distortion.comp | 134 ++++----------
|
||||
src/xrt/compositor/util/comp_render_cs.c | 33 +---
|
||||
6 files changed, 76 insertions(+), 378 deletions(-)
|
||||
|
||||
diff --git a/src/xrt/compositor/CMakeLists.txt b/src/xrt/compositor/CMakeLists.txt
|
||||
index 1ba5ec438..f1defe77a 100644
|
||||
--- a/src/xrt/compositor/CMakeLists.txt
|
||||
+++ b/src/xrt/compositor/CMakeLists.txt
|
||||
@@ -115,7 +115,7 @@ if(XRT_HAVE_VULKAN)
|
||||
${SHADER_HEADERS}
|
||||
render/render_buffer.c
|
||||
render/render_compute.c
|
||||
- render/render_distortion.c
|
||||
+ # render/render_distortion.c implemented in wivrn
|
||||
render/render_gfx.c
|
||||
render/render_interface.h
|
||||
render/render_resources.c
|
||||
diff --git a/src/xrt/compositor/render/render_compute.c b/src/xrt/compositor/render/render_compute.c
|
||||
index fd04801d4..5cd5a1726 100644
|
||||
--- a/src/xrt/compositor/render/render_compute.c
|
||||
+++ b/src/xrt/compositor/render/render_compute.c
|
||||
@@ -167,8 +167,8 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
|
||||
VkSampler src_samplers[XRT_MAX_VIEWS],
|
||||
VkImageView src_image_views[XRT_MAX_VIEWS],
|
||||
uint32_t distortion_binding,
|
||||
- VkSampler distortion_samplers[3 * XRT_MAX_VIEWS],
|
||||
- VkImageView distortion_image_views[3 * XRT_MAX_VIEWS],
|
||||
+ VkDeviceSize foveation_size,
|
||||
+ VkBuffer foveation_buffer,
|
||||
uint32_t target_binding_y,
|
||||
uint32_t target_binding_cbcr,
|
||||
VkImageView target_image_view_y,
|
||||
@@ -186,12 +186,11 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
|
||||
src_image_info[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
}
|
||||
|
||||
- VkDescriptorImageInfo distortion_image_info[3 * XRT_MAX_VIEWS];
|
||||
- for (uint32_t i = 0; i < 3 * view_count; ++i) {
|
||||
- distortion_image_info[i].sampler = distortion_samplers[i];
|
||||
- distortion_image_info[i].imageView = distortion_image_views[i];
|
||||
- distortion_image_info[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
- }
|
||||
+ VkDescriptorBufferInfo foveation_buffer_info = {
|
||||
+ .buffer = foveation_buffer,
|
||||
+ .offset = 0,
|
||||
+ .range = foveation_size,
|
||||
+ };
|
||||
|
||||
VkDescriptorImageInfo target_image_y_info = {
|
||||
.imageView = target_image_view_y,
|
||||
@@ -222,9 +221,9 @@ update_compute_shared_descriptor_set(struct vk_bundle *vk,
|
||||
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
|
||||
.dstSet = descriptor_set,
|
||||
.dstBinding = distortion_binding,
|
||||
- .descriptorCount = 3 * view_count,
|
||||
- .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
||||
- .pImageInfo = distortion_image_info,
|
||||
+ .descriptorCount = 1,
|
||||
+ .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
+ .pBufferInfo = &foveation_buffer_info,
|
||||
},
|
||||
{
|
||||
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
|
||||
@@ -483,146 +482,6 @@ render_compute_layers(struct render_compute *render,
|
||||
1); // groupCountZ
|
||||
}
|
||||
|
||||
-void
|
||||
-render_compute_projection_timewarp(struct render_compute *render,
|
||||
- VkSampler src_samplers[XRT_MAX_VIEWS],
|
||||
- VkImageView src_image_views[XRT_MAX_VIEWS],
|
||||
- const struct xrt_normalized_rect src_norm_rects[XRT_MAX_VIEWS],
|
||||
- const struct xrt_pose src_poses[XRT_MAX_VIEWS],
|
||||
- const struct xrt_fov src_fovs[XRT_MAX_VIEWS],
|
||||
- const struct xrt_pose new_poses[XRT_MAX_VIEWS],
|
||||
- VkImage target_image,
|
||||
- VkImageView target_image_view_y,
|
||||
- VkImageView target_image_view_cbcr,
|
||||
- const struct render_viewport_data views[XRT_MAX_VIEWS])
|
||||
-{
|
||||
- assert(render->r != NULL);
|
||||
-
|
||||
- struct vk_bundle *vk = vk_from_render(render);
|
||||
- struct render_resources *r = render->r;
|
||||
-
|
||||
-
|
||||
- /*
|
||||
- * UBO
|
||||
- */
|
||||
-
|
||||
- struct xrt_matrix_4x4 time_warp_matrix[XRT_MAX_VIEWS];
|
||||
- for (uint32_t i = 0; i < render->r->view_count; ++i) {
|
||||
- render_calc_time_warp_matrix( //
|
||||
- &src_poses[i], //
|
||||
- &src_fovs[i], //
|
||||
- &new_poses[i], //
|
||||
- &time_warp_matrix[i]); //
|
||||
- }
|
||||
-
|
||||
- struct render_compute_distortion_ubo_data *data =
|
||||
- (struct render_compute_distortion_ubo_data *)r->compute.distortion.ubo.mapped;
|
||||
- for (uint32_t i = 0; i < render->r->view_count; ++i) {
|
||||
- data->views[i] = views[i];
|
||||
- data->pre_transforms[i] = r->distortion.uv_to_tanangle[i];
|
||||
- data->transforms[i] = time_warp_matrix[i];
|
||||
- data->post_transforms[i] = src_norm_rects[i];
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Source, target and distortion images.
|
||||
- */
|
||||
-
|
||||
- VkImageSubresourceRange subresource_range = {
|
||||
- .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
- .baseMipLevel = 0,
|
||||
- .levelCount = VK_REMAINING_MIP_LEVELS,
|
||||
- .baseArrayLayer = 0,
|
||||
- .layerCount = VK_REMAINING_ARRAY_LAYERS,
|
||||
- };
|
||||
-
|
||||
- vk_cmd_image_barrier_gpu_locked( //
|
||||
- vk, //
|
||||
- r->cmd, //
|
||||
- target_image, //
|
||||
- 0, //
|
||||
- VK_ACCESS_SHADER_WRITE_BIT, //
|
||||
- VK_IMAGE_LAYOUT_UNDEFINED, //
|
||||
- VK_IMAGE_LAYOUT_GENERAL, //
|
||||
- subresource_range); //
|
||||
-
|
||||
- VkSampler sampler = r->samplers.clamp_to_edge;
|
||||
- VkSampler distortion_samplers[3 * XRT_MAX_VIEWS];
|
||||
- for (uint32_t i = 0; i < render->r->view_count; ++i) {
|
||||
- distortion_samplers[3 * i + 0] = sampler;
|
||||
- distortion_samplers[3 * i + 1] = sampler;
|
||||
- distortion_samplers[3 * i + 2] = sampler;
|
||||
- }
|
||||
-
|
||||
- update_compute_shared_descriptor_set( //
|
||||
- vk, //
|
||||
- r->compute.src_binding, //
|
||||
- src_samplers, //
|
||||
- src_image_views, //
|
||||
- r->compute.distortion_binding, //
|
||||
- distortion_samplers, //
|
||||
- r->distortion.image_views, //
|
||||
- r->compute.target_binding_y, //
|
||||
- r->compute.target_binding_cbcr, //
|
||||
- target_image_view_y, //
|
||||
- target_image_view_cbcr, //
|
||||
- r->compute.ubo_binding, //
|
||||
- r->compute.distortion.ubo.buffer, //
|
||||
- VK_WHOLE_SIZE, //
|
||||
- render->shared_descriptor_set, //
|
||||
- render->r->view_count); //
|
||||
-
|
||||
- vk->vkCmdBindPipeline( //
|
||||
- r->cmd, //
|
||||
- VK_PIPELINE_BIND_POINT_COMPUTE, // pipelineBindPoint
|
||||
- r->compute.distortion.timewarp_pipeline); // pipeline
|
||||
-
|
||||
- vk->vkCmdBindDescriptorSets( //
|
||||
- r->cmd, //
|
||||
- VK_PIPELINE_BIND_POINT_COMPUTE, // pipelineBindPoint
|
||||
- r->compute.distortion.pipeline_layout, // layout
|
||||
- 0, // firstSet
|
||||
- 1, // descriptorSetCount
|
||||
- &render->shared_descriptor_set, // pDescriptorSets
|
||||
- 0, // dynamicOffsetCount
|
||||
- NULL); // pDynamicOffsets
|
||||
-
|
||||
-
|
||||
- uint32_t w = 0, h = 0;
|
||||
- calc_dispatch_dims_views(views, render->r->view_count, &w, &h);
|
||||
- assert(w != 0 && h != 0);
|
||||
-
|
||||
- vk->vkCmdDispatch( //
|
||||
- r->cmd, //
|
||||
- w, // groupCountX
|
||||
- h, // groupCountY
|
||||
- 2); // groupCountZ
|
||||
-
|
||||
- VkImageMemoryBarrier memoryBarrier = {
|
||||
- .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||
- .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
|
||||
- .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT,
|
||||
- .oldLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||
- .newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
- .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
- .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||
- .image = target_image,
|
||||
- .subresourceRange = subresource_range,
|
||||
- };
|
||||
-
|
||||
- vk->vkCmdPipelineBarrier( //
|
||||
- r->cmd, //
|
||||
- VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, //
|
||||
- VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, //
|
||||
- 0, //
|
||||
- 0, //
|
||||
- NULL, //
|
||||
- 0, //
|
||||
- NULL, //
|
||||
- 1, //
|
||||
- &memoryBarrier); //
|
||||
-}
|
||||
-
|
||||
void
|
||||
render_compute_projection(struct render_compute *render,
|
||||
VkSampler src_samplers[XRT_MAX_VIEWS],
|
||||
@@ -673,22 +532,14 @@ render_compute_projection(struct render_compute *render,
|
||||
VK_IMAGE_LAYOUT_GENERAL, //
|
||||
subresource_range); //
|
||||
|
||||
- VkSampler sampler = r->samplers.clamp_to_edge;
|
||||
- VkSampler distortion_samplers[3 * XRT_MAX_VIEWS];
|
||||
- for (uint32_t i = 0; i < render->r->view_count; ++i) {
|
||||
- distortion_samplers[3 * i + 0] = sampler;
|
||||
- distortion_samplers[3 * i + 1] = sampler;
|
||||
- distortion_samplers[3 * i + 2] = sampler;
|
||||
- }
|
||||
-
|
||||
update_compute_shared_descriptor_set( //
|
||||
vk, //
|
||||
r->compute.src_binding, //
|
||||
src_samplers, //
|
||||
src_image_views, //
|
||||
r->compute.distortion_binding, //
|
||||
- distortion_samplers, //
|
||||
- r->distortion.image_views, //
|
||||
+ VK_WHOLE_SIZE, //
|
||||
+ r->distortion.buffer, //
|
||||
r->compute.target_binding_y, //
|
||||
r->compute.target_binding_cbcr, //
|
||||
target_image_view_y, //
|
||||
@@ -804,13 +655,9 @@ render_compute_clear(struct render_compute *render,
|
||||
VkSampler sampler = r->samplers.mock;
|
||||
VkSampler src_samplers[XRT_MAX_VIEWS];
|
||||
VkImageView src_image_views[XRT_MAX_VIEWS];
|
||||
- VkSampler distortion_samplers[3 * XRT_MAX_VIEWS];
|
||||
for (uint32_t i = 0; i < render->r->view_count; ++i) {
|
||||
src_samplers[i] = sampler;
|
||||
src_image_views[i] = r->mock.color.image_view;
|
||||
- distortion_samplers[3 * i + 0] = sampler;
|
||||
- distortion_samplers[3 * i + 1] = sampler;
|
||||
- distortion_samplers[3 * i + 2] = sampler;
|
||||
}
|
||||
|
||||
update_compute_shared_descriptor_set( //
|
||||
@@ -819,8 +666,8 @@ render_compute_clear(struct render_compute *render,
|
||||
src_samplers, //
|
||||
src_image_views, //
|
||||
r->compute.distortion_binding, //
|
||||
- distortion_samplers, //
|
||||
- r->distortion.image_views, //
|
||||
+ VK_WHOLE_SIZE, //
|
||||
+ r->distortion.buffer, //
|
||||
r->compute.target_binding_y, //
|
||||
r->compute.target_binding_cbcr, //
|
||||
target_image_view_y, //
|
||||
diff --git a/src/xrt/compositor/render/render_interface.h b/src/xrt/compositor/render/render_interface.h
|
||||
index 2f8ce5287..d74ec78dd 100644
|
||||
--- a/src/xrt/compositor/render/render_interface.h
|
||||
+++ b/src/xrt/compositor/render/render_interface.h
|
||||
@@ -74,12 +74,8 @@ extern "C" {
|
||||
#define RENDER_MAX_LAYER_RUNS_SIZE (XRT_MAX_VIEWS)
|
||||
#define RENDER_MAX_LAYER_RUNS_COUNT(RENDER_RESOURCES) (RENDER_RESOURCES->view_count)
|
||||
|
||||
-//! Distortion image dimension in pixels
|
||||
-#define RENDER_DISTORTION_IMAGE_DIMENSIONS (128)
|
||||
-
|
||||
-//! How many distortion images we have, one for each channel (3 rgb) and per view.
|
||||
-#define RENDER_DISTORTION_IMAGES_SIZE (3 * XRT_MAX_VIEWS)
|
||||
-#define RENDER_DISTORTION_IMAGES_COUNT(RENDER_RESOURCES) (3 * RENDER_RESOURCES->view_count)
|
||||
+//! Foveation buffer dimension in pixels (including past-the end pixel)
|
||||
+#define RENDER_FOVEATION_BUFFER_DIMENSIONS (4096 + 1)
|
||||
|
||||
//! The binding that the layer projection and quad shader have their UBO on.
|
||||
#define RENDER_BINDING_LAYER_SHARED_UBO 0
|
||||
@@ -519,9 +515,6 @@ struct render_resources
|
||||
//! Doesn't depend on target so is static.
|
||||
VkPipeline pipeline;
|
||||
|
||||
- //! Doesn't depend on target so is static.
|
||||
- VkPipeline timewarp_pipeline;
|
||||
-
|
||||
//! Target info.
|
||||
struct render_buffer ubo;
|
||||
} distortion;
|
||||
@@ -543,17 +536,11 @@ struct render_resources
|
||||
//! Transform to go from UV to tangle angles.
|
||||
struct xrt_normalized_rect uv_to_tanangle[XRT_MAX_VIEWS];
|
||||
|
||||
- //! Backing memory to distortion images.
|
||||
- VkDeviceMemory device_memories[RENDER_DISTORTION_IMAGES_SIZE];
|
||||
-
|
||||
- //! Distortion images.
|
||||
- VkImage images[RENDER_DISTORTION_IMAGES_SIZE];
|
||||
+ //! Backing memory to foveation buffers.
|
||||
+ VkDeviceMemory device_memory;
|
||||
|
||||
- //! The views into the distortion images.
|
||||
- VkImageView image_views[RENDER_DISTORTION_IMAGES_SIZE];
|
||||
-
|
||||
- //! Whether distortion images have been pre-rotated 90 degrees.
|
||||
- bool pre_rotated;
|
||||
+ //! Foveation buffer.
|
||||
+ VkBuffer buffer;
|
||||
} distortion;
|
||||
};
|
||||
|
||||
@@ -1298,6 +1285,14 @@ struct render_compute_distortion_ubo_data
|
||||
struct xrt_matrix_4x4 transforms[XRT_MAX_VIEWS];
|
||||
};
|
||||
|
||||
+struct render_compute_distortion_foveation_data
|
||||
+{
|
||||
+ // For each output pixel: index of the first pixel to read.
|
||||
+ // contains 1 additional value at the end for past-the end pixel
|
||||
+ uint32_t x[XRT_MAX_VIEWS * RENDER_FOVEATION_BUFFER_DIMENSIONS];
|
||||
+ uint32_t y[XRT_MAX_VIEWS * RENDER_FOVEATION_BUFFER_DIMENSIONS];
|
||||
+};
|
||||
+
|
||||
/*!
|
||||
* Init struct and create resources needed for compute rendering.
|
||||
*
|
||||
diff --git a/src/xrt/compositor/render/render_resources.c b/src/xrt/compositor/render/render_resources.c
|
||||
index 5b9addd59..7d4d9cddb 100644
|
||||
--- a/src/xrt/compositor/render/render_resources.c
|
||||
+++ b/src/xrt/compositor/render/render_resources.c
|
||||
@@ -258,8 +258,8 @@ create_compute_distortion_descriptor_set_layout(struct vk_bundle *vk,
|
||||
},
|
||||
{
|
||||
.binding = distortion_binding,
|
||||
- .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
|
||||
- .descriptorCount = 6,
|
||||
+ .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
|
||||
+ .descriptorCount = 1,
|
||||
.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT,
|
||||
},
|
||||
{
|
||||
@@ -309,12 +309,6 @@ struct compute_layer_params
|
||||
uint32_t image_array_size;
|
||||
};
|
||||
|
||||
-struct compute_distortion_params
|
||||
-{
|
||||
- uint32_t distortion_texel_count;
|
||||
- VkBool32 do_timewarp;
|
||||
-};
|
||||
-
|
||||
XRT_CHECK_RESULT static VkResult
|
||||
create_compute_layer_pipeline(struct vk_bundle *vk,
|
||||
VkPipelineCache pipeline_cache,
|
||||
@@ -359,35 +353,15 @@ create_compute_distortion_pipeline(struct vk_bundle *vk,
|
||||
VkPipelineCache pipeline_cache,
|
||||
VkShaderModule shader,
|
||||
VkPipelineLayout pipeline_layout,
|
||||
- const struct compute_distortion_params *params,
|
||||
VkPipeline *out_compute_pipeline)
|
||||
{
|
||||
-#define ENTRY(ID, FIELD) \
|
||||
- { \
|
||||
- .constantID = ID, \
|
||||
- .offset = offsetof(struct compute_distortion_params, FIELD), \
|
||||
- sizeof(params->FIELD), \
|
||||
- }
|
||||
-
|
||||
- VkSpecializationMapEntry entries[2] = {
|
||||
- ENTRY(0, distortion_texel_count),
|
||||
- ENTRY(1, do_timewarp),
|
||||
- };
|
||||
-#undef ENTRY
|
||||
-
|
||||
- VkSpecializationInfo specialization_info = {
|
||||
- .mapEntryCount = ARRAY_SIZE(entries),
|
||||
- .pMapEntries = entries,
|
||||
- .dataSize = sizeof(*params),
|
||||
- .pData = params,
|
||||
- };
|
||||
|
||||
return vk_create_compute_pipeline( //
|
||||
vk, // vk_bundle
|
||||
pipeline_cache, // pipeline_cache
|
||||
shader, // shader
|
||||
pipeline_layout, // pipeline_layout
|
||||
- &specialization_info, // specialization_info
|
||||
+ NULL, // specialization_info
|
||||
out_compute_pipeline); // out_compute_pipeline
|
||||
}
|
||||
|
||||
@@ -849,9 +823,9 @@ render_resources_init(struct render_resources *r,
|
||||
struct vk_descriptor_pool_info compute_pool_info = {
|
||||
.uniform_per_descriptor_count = 1,
|
||||
// layer images
|
||||
- .sampler_per_descriptor_count = r->compute.layer.image_array_size + RENDER_DISTORTION_IMAGES_COUNT(r),
|
||||
+ .sampler_per_descriptor_count = r->compute.layer.image_array_size,
|
||||
.storage_image_per_descriptor_count = 1,
|
||||
- .storage_buffer_per_descriptor_count = 0,
|
||||
+ .storage_buffer_per_descriptor_count = 1,
|
||||
.descriptor_count = compute_descriptor_count,
|
||||
.freeable = false,
|
||||
};
|
||||
@@ -971,39 +945,16 @@ render_resources_init(struct render_resources *r,
|
||||
VK_NAME_PIPELINE_LAYOUT(vk, r->compute.distortion.pipeline_layout,
|
||||
"render_resources compute distortion pipeline layout");
|
||||
|
||||
- struct compute_distortion_params distortion_params = {
|
||||
- .distortion_texel_count = RENDER_DISTORTION_IMAGE_DIMENSIONS,
|
||||
- .do_timewarp = false,
|
||||
- };
|
||||
-
|
||||
ret = create_compute_distortion_pipeline( //
|
||||
vk, // vk_bundle
|
||||
r->pipeline_cache, // pipeline_cache
|
||||
r->shaders->distortion_comp, // shader
|
||||
r->compute.distortion.pipeline_layout, // pipeline_layout
|
||||
- &distortion_params, // params
|
||||
&r->compute.distortion.pipeline); // out_compute_pipeline
|
||||
VK_CHK_WITH_RET(ret, "create_compute_distortion_pipeline", false);
|
||||
|
||||
VK_NAME_PIPELINE(vk, r->compute.distortion.pipeline, "render_resources compute distortion pipeline");
|
||||
|
||||
- struct compute_distortion_params distortion_timewarp_params = {
|
||||
- .distortion_texel_count = RENDER_DISTORTION_IMAGE_DIMENSIONS,
|
||||
- .do_timewarp = true,
|
||||
- };
|
||||
-
|
||||
- ret = create_compute_distortion_pipeline( //
|
||||
- vk, // vk_bundle
|
||||
- r->pipeline_cache, // pipeline_cache
|
||||
- r->shaders->distortion_comp, // shader
|
||||
- r->compute.distortion.pipeline_layout, // pipeline_layout
|
||||
- &distortion_timewarp_params, // params
|
||||
- &r->compute.distortion.timewarp_pipeline); // out_compute_pipeline
|
||||
- VK_CHK_WITH_RET(ret, "create_compute_distortion_pipeline", false);
|
||||
-
|
||||
- VK_NAME_PIPELINE(vk, r->compute.distortion.timewarp_pipeline,
|
||||
- "render_resources compute distortion timewarp pipeline");
|
||||
-
|
||||
size_t distortion_ubo_size = sizeof(struct render_compute_distortion_ubo_data);
|
||||
|
||||
ret = render_buffer_init( //
|
||||
@@ -1056,15 +1007,8 @@ render_resources_init(struct render_resources *r,
|
||||
* Compute distortion textures, not created until later.
|
||||
*/
|
||||
|
||||
- for (uint32_t i = 0; i < RENDER_DISTORTION_IMAGES_COUNT(r); i++) {
|
||||
- r->distortion.image_views[i] = VK_NULL_HANDLE;
|
||||
- }
|
||||
- for (uint32_t i = 0; i < RENDER_DISTORTION_IMAGES_COUNT(r); i++) {
|
||||
- r->distortion.images[i] = VK_NULL_HANDLE;
|
||||
- }
|
||||
- for (uint32_t i = 0; i < RENDER_DISTORTION_IMAGES_COUNT(r); i++) {
|
||||
- r->distortion.device_memories[i] = VK_NULL_HANDLE;
|
||||
- }
|
||||
+ r->distortion.buffer = VK_NULL_HANDLE;
|
||||
+ r->distortion.device_memory = VK_NULL_HANDLE;
|
||||
|
||||
|
||||
/*
|
||||
@@ -1141,7 +1085,6 @@ render_resources_fini(struct render_resources *r)
|
||||
|
||||
D(DescriptorSetLayout, r->compute.distortion.descriptor_set_layout);
|
||||
D(Pipeline, r->compute.distortion.pipeline);
|
||||
- D(Pipeline, r->compute.distortion.timewarp_pipeline);
|
||||
D(PipelineLayout, r->compute.distortion.pipeline_layout);
|
||||
|
||||
D(Pipeline, r->compute.clear.pipeline);
|
||||
diff --git a/src/xrt/compositor/shaders/distortion.comp b/src/xrt/compositor/shaders/distortion.comp
|
||||
index 9ce46fe6f..f3be617bd 100644
|
||||
--- a/src/xrt/compositor/shaders/distortion.comp
|
||||
+++ b/src/xrt/compositor/shaders/distortion.comp
|
||||
@@ -7,17 +7,17 @@
|
||||
|
||||
#include "srgb.inc.glsl"
|
||||
|
||||
-
|
||||
-// The size of the distortion texture dimensions in texels.
|
||||
-layout(constant_id = 0) const int distortion_texel_count = 2;
|
||||
-
|
||||
-// Should we do timewarp.
|
||||
-layout(constant_id = 1) const bool do_timewarp = false;
|
||||
-
|
||||
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||
|
||||
+#define MAX_DIM 4097
|
||||
+
|
||||
layout(set = 0, binding = 0) uniform sampler2D source[2];
|
||||
-layout(set = 0, binding = 1) uniform sampler2D distortion[6];
|
||||
+layout(set = 0, binding = 1, std430) buffer restrict Foveation
|
||||
+{
|
||||
+ uint x[2*MAX_DIM];
|
||||
+ uint y[2*MAX_DIM];
|
||||
+} foveation;
|
||||
+
|
||||
layout(set = 0, binding = 2) uniform writeonly restrict image2DArray luma;
|
||||
layout(set = 0, binding = 3, std140) uniform restrict Config
|
||||
{
|
||||
@@ -41,109 +41,40 @@ vec3 rgb_to_ycbcr(vec3 color)
|
||||
return transpose(color_space) * color + vec3(0, 0.5, 0.5);
|
||||
}
|
||||
|
||||
-vec2 position_to_uv(ivec2 extent, uint ix, uint iy)
|
||||
-{
|
||||
- // Turn the index into floating point.
|
||||
- vec2 xy = vec2(float(ix), float(iy));
|
||||
-
|
||||
- // The inverse of the extent of the target image is the pixel size in [0 .. 1] space.
|
||||
- vec2 extent_pixel_size = vec2(1.0 / float(extent.x), 1.0 / float(extent.y));
|
||||
-
|
||||
- // Per-target pixel we move the size of the pixels.
|
||||
- vec2 dist_uv = xy * extent_pixel_size;
|
||||
-
|
||||
- // Emulate a triangle sample position by offset half target pixel size.
|
||||
- dist_uv = dist_uv + extent_pixel_size / 2.0;
|
||||
-
|
||||
-
|
||||
- // To correctly sample we need to put position (0, 0) in the
|
||||
- // middle of the (0, 0) texel in the distortion textures. That's why we
|
||||
- // offset with half the texel size, pushing all samples into the middle
|
||||
- // of each texels, a kin to a vertex buffer. We need to put uv coord
|
||||
- // (1, 1) in the middle of the last texel, that pixel is (size - 1)
|
||||
- // texels away from the first texel. So we need to scale [0 .. 1] to
|
||||
- // [0 .. size - 1].
|
||||
-
|
||||
-#define DIM (float(distortion_texel_count))
|
||||
-#define STRETCH ((DIM - 1.0) / DIM)
|
||||
-#define OFFSET (1.0 / (DIM * 2.0))
|
||||
-
|
||||
- dist_uv = (dist_uv * STRETCH) + OFFSET;
|
||||
-
|
||||
- return dist_uv;
|
||||
-}
|
||||
-
|
||||
-vec2 transform_uv_subimage(vec2 uv, uint iz)
|
||||
-{
|
||||
- vec2 values = uv;
|
||||
-
|
||||
- // To deal with OpenGL flip and sub image view.
|
||||
- values.xy = values.xy * ubo.post_transform[iz].zw + ubo.post_transform[iz].xy;
|
||||
-
|
||||
- // Ready to be used.
|
||||
- return values.xy;
|
||||
-}
|
||||
-
|
||||
-vec2 transform_uv_timewarp(vec2 uv, uint iz)
|
||||
-{
|
||||
- vec4 values = vec4(uv, -1, 1);
|
||||
-
|
||||
- // From uv to tan angle (tangent space).
|
||||
- values.xy = values.xy * ubo.pre_transform[iz].zw + ubo.pre_transform[iz].xy;
|
||||
- values.y = -values.y; // Flip to OpenXR coordinate system.
|
||||
-
|
||||
- // Timewarp.
|
||||
- values = ubo.transform[iz] * values;
|
||||
- values.xy = values.xy * (1.0 / max(values.w, 0.00001));
|
||||
-
|
||||
- // From [-1, 1] to [0, 1]
|
||||
- values.xy = values.xy * 0.5 + 0.5;
|
||||
-
|
||||
- // To deal with OpenGL flip and sub image view.
|
||||
- values.xy = values.xy * ubo.post_transform[iz].zw + ubo.post_transform[iz].xy;
|
||||
-
|
||||
- // Done.
|
||||
- return values.xy;
|
||||
-}
|
||||
-
|
||||
-vec2 transform_uv(vec2 uv, uint iz)
|
||||
-{
|
||||
- if (do_timewarp) {
|
||||
- return transform_uv_timewarp(uv, iz);
|
||||
- } else {
|
||||
- return transform_uv_subimage(uv, iz);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
void main()
|
||||
{
|
||||
uint iz = gl_GlobalInvocationID.z;
|
||||
|
||||
ivec2 offset = ivec2(ubo.views[iz].xy);
|
||||
ivec2 extent = ivec2(ubo.views[iz].zw);
|
||||
- vec2 cbcrs[4];
|
||||
- vec4 alpha;
|
||||
+ vec3 cbcra = vec3(0);
|
||||
for (int k = 0; k < 2; k += 1) {
|
||||
uint iy = gl_GlobalInvocationID.y * 2 + k;
|
||||
+ uint ymin = foveation.y[MAX_DIM * iz + iy];
|
||||
+ uint ymax = foveation.y[MAX_DIM * iz + iy + 1];
|
||||
+ if (ymin > ymax)
|
||||
+ {
|
||||
+ uint tmp = ymin;
|
||||
+ ymin = ymax;
|
||||
+ ymax = tmp;
|
||||
+ }
|
||||
for (int j = 0; j < 2; j += 1) {
|
||||
uint ix = gl_GlobalInvocationID.x * 2 + j;
|
||||
|
||||
- vec2 dist_uv = position_to_uv(extent, ix, iy);
|
||||
+ uint xmin = foveation.x[MAX_DIM * iz + ix];
|
||||
+ uint xmax = foveation.x[MAX_DIM * iz + ix + 1];
|
||||
|
||||
- vec2 uv = texture(distortion[iz + 0], dist_uv).xy;
|
||||
- vec2 lod = texture(distortion[iz + 2], dist_uv).xy;
|
||||
-
|
||||
- // Do any transformation needed.
|
||||
- uv = transform_uv(uv, iz);
|
||||
-
|
||||
- // Sample the source
|
||||
- vec4 colour = textureLod(source[iz], uv, mix(lod.x, lod.y, 0.5));
|
||||
-
|
||||
- colour.rgb = rgb_to_ycbcr(from_linear_to_srgb(colour.rgb));
|
||||
+ vec4 colour = vec4(0);
|
||||
+ for (uint y = ymin ; y < ymax; y += 1) {
|
||||
+ for (uint x = xmin ; x < xmax; x += 1) {
|
||||
+ colour += texelFetch(source[iz], ivec2(x, y), 0);
|
||||
+ }
|
||||
+ }
|
||||
+ colour /= (xmax - xmin) * (ymax - ymin);
|
||||
+ colour.xyz = rgb_to_ycbcr(from_linear_to_srgb(colour.rgb));
|
||||
|
||||
- int i = k * 2 + j;
|
||||
- cbcrs[i] = colour.yz;
|
||||
- alpha[i] = colour.a;
|
||||
+ cbcra.xy += colour.yz;
|
||||
+ cbcra.z += colour.a;
|
||||
|
||||
if (ix < extent.x && iy < extent.y) {
|
||||
imageStore(luma, ivec3(offset.x + ix, offset.y + iy, 0), vec4(colour.x));
|
||||
@@ -153,10 +84,7 @@ void main()
|
||||
if (gl_GlobalInvocationID.x >= extent.x || gl_GlobalInvocationID.y >= extent.y) {
|
||||
return;
|
||||
}
|
||||
- vec2 cbcr = mix(mix(cbcrs[0], cbcrs[1], 0.5), mix(cbcrs[2], cbcrs[3], 0.5), 0.5);
|
||||
- imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 0), vec4(cbcr.x, cbcr.y, 0, 0));
|
||||
-
|
||||
+ imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 0), vec4(cbcra.x, cbcra.y, 0, 0) / 4);
|
||||
+ imageStore(luma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 1), vec4(cbcra.z, 0, 0, 0) / 4);
|
||||
imageStore(chroma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 1), vec4(0.5, 0.5, 0, 0));
|
||||
- alpha = vec4(mix(mix(alpha[0], alpha[1], 0.5), mix(alpha[2], alpha[3], 0.5), 0.5));
|
||||
- imageStore(luma, ivec3(offset.xy/2 + gl_GlobalInvocationID.xy, 1), alpha);
|
||||
}
|
||||
diff --git a/src/xrt/compositor/util/comp_render_cs.c b/src/xrt/compositor/util/comp_render_cs.c
|
||||
index b2d3ce10d..69429dc97 100644
|
||||
--- a/src/xrt/compositor/util/comp_render_cs.c
|
||||
+++ b/src/xrt/compositor/util/comp_render_cs.c
|
||||
@@ -466,30 +466,15 @@ crc_distortion_fast_path(struct render_compute *render,
|
||||
world_poses[i] = world_pose;
|
||||
}
|
||||
|
||||
- if (!d->do_timewarp) {
|
||||
- render_compute_projection( //
|
||||
- render, //
|
||||
- src_samplers, //
|
||||
- src_image_views, //
|
||||
- src_norm_rects, //
|
||||
- d->target.cs.image, //
|
||||
- d->target.cs.storage_view_y, //
|
||||
- d->target.cs.storage_view_cbcr, //
|
||||
- target_viewport_datas); //
|
||||
- } else {
|
||||
- render_compute_projection_timewarp( //
|
||||
- render, //
|
||||
- src_samplers, //
|
||||
- src_image_views, //
|
||||
- src_norm_rects, //
|
||||
- src_poses, //
|
||||
- src_fovs, //
|
||||
- world_poses, //
|
||||
- d->target.cs.image, //
|
||||
- d->target.cs.storage_view_y, //
|
||||
- d->target.cs.storage_view_cbcr, //
|
||||
- target_viewport_datas); //
|
||||
- }
|
||||
+ render_compute_projection( //
|
||||
+ render, //
|
||||
+ src_samplers, //
|
||||
+ src_image_views, //
|
||||
+ src_norm_rects, //
|
||||
+ d->target.cs.image, //
|
||||
+ d->target.cs.storage_view_y, //
|
||||
+ d->target.cs.storage_view_cbcr, //
|
||||
+ target_viewport_datas); //
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -23,14 +23,12 @@
|
||||
#include "encoder/video_encoder.h"
|
||||
#include "util/u_logging.h"
|
||||
#include "utils/scoped_lock.h"
|
||||
#include "wivrn_config.h"
|
||||
#include "wivrn_foveation.h"
|
||||
|
||||
#include "main/comp_compositor.h"
|
||||
#include "math/m_space.h"
|
||||
#include "xrt_cast.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan.hpp>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
@@ -60,9 +58,6 @@ std::vector<const char *> wivrn_comp_target::wanted_device_extensions = {
|
||||
#ifdef VK_KHR_video_encode_queue
|
||||
VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME,
|
||||
#endif
|
||||
#ifdef VK_KHR_video_maintenance1
|
||||
VK_KHR_VIDEO_MAINTENANCE_1_EXTENSION_NAME,
|
||||
#endif
|
||||
#ifdef VK_KHR_video_encode_h264
|
||||
VK_KHR_VIDEO_ENCODE_H264_EXTENSION_NAME,
|
||||
#endif
|
||||
@@ -193,51 +188,56 @@ static VkResult create_images(struct wivrn_comp_target * cn, vk::ImageUsageFlags
|
||||
|
||||
cn->images = U_TYPED_ARRAY_CALLOC(struct comp_target_image, cn->image_count);
|
||||
|
||||
vk::StructureChain image_info{
|
||||
vk::ImageCreateInfo{
|
||||
.flags = vk::ImageCreateFlagBits::eExtendedUsage | vk::ImageCreateFlagBits::eMutableFormat,
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = format,
|
||||
.extent = {
|
||||
.width = cn->width,
|
||||
.height = cn->height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 2, // colour then alpha
|
||||
.samples = vk::SampleCountFlagBits::e1,
|
||||
.tiling = vk::ImageTiling::eOptimal,
|
||||
.usage = flags | vk::ImageUsageFlagBits::eStorage | vk::ImageUsageFlagBits::eTransferSrc,
|
||||
.sharingMode = vk::SharingMode::eExclusive,
|
||||
},
|
||||
vk::ImageFormatListCreateInfo{
|
||||
.viewFormatCount = formats.size(),
|
||||
.pViewFormats = formats.data(),
|
||||
},
|
||||
};
|
||||
#if WIVRN_USE_VULKAN_ENCODE
|
||||
if (
|
||||
vk->features.video_maintenance_1 and
|
||||
std::ranges::any_of(
|
||||
cn->settings,
|
||||
[](const auto & item) { return item.encoder_name == encoder_vulkan //
|
||||
and item.offset_x == 0 and item.offset_y == 0; }))
|
||||
{
|
||||
image_info.get().flags |= vk::ImageCreateFlagBits::eVideoProfileIndependentKHR;
|
||||
image_info.get().usage |= vk::ImageUsageFlagBits::eVideoEncodeSrcKHR;
|
||||
}
|
||||
auto [video_profiles, encoder_flags] = video_encoder::get_create_image_info(cn->settings);
|
||||
|
||||
vk::VideoProfileListInfoKHR video_profile_list{
|
||||
.profileCount = uint32_t(video_profiles.size()),
|
||||
.pProfiles = video_profiles.data(),
|
||||
};
|
||||
#endif
|
||||
|
||||
cn->psc.images.resize(cn->image_count);
|
||||
for (uint32_t i = 0; i < cn->image_count; i++)
|
||||
{
|
||||
vk::ImageFormatListCreateInfo formats_info{
|
||||
.viewFormatCount = formats.size(),
|
||||
.pViewFormats = formats.data(),
|
||||
};
|
||||
|
||||
#if WIVRN_USE_VULKAN_ENCODE
|
||||
if (video_profile_list.profileCount)
|
||||
formats_info.pNext = &video_profile_list;
|
||||
#endif
|
||||
|
||||
auto & image = cn->psc.images[i].image;
|
||||
image = image_allocation(
|
||||
device,
|
||||
image_info.get(),
|
||||
{.usage = VMA_MEMORY_USAGE_AUTO},
|
||||
std::format("comp target image {}", i));
|
||||
device, {
|
||||
.pNext = &formats_info,
|
||||
.flags = vk::ImageCreateFlagBits::eExtendedUsage | vk::ImageCreateFlagBits::eMutableFormat,
|
||||
.imageType = vk::ImageType::e2D,
|
||||
.format = format,
|
||||
.extent = {
|
||||
.width = cn->width,
|
||||
.height = cn->height,
|
||||
.depth = 1,
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arrayLayers = 2, // colour then alpha
|
||||
.samples = vk::SampleCountFlagBits::e1,
|
||||
.tiling = vk::ImageTiling::eOptimal,
|
||||
.usage = flags
|
||||
#if WIVRN_USE_VULKAN_ENCODE
|
||||
| encoder_flags
|
||||
#endif
|
||||
| vk::ImageUsageFlagBits::eStorage | vk::ImageUsageFlagBits::eTransferSrc,
|
||||
.sharingMode = vk::SharingMode::eExclusive,
|
||||
},
|
||||
{
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
});
|
||||
cn->images[i].handle = image;
|
||||
cn->wivrn_bundle->name(vk::Image(image), "comp target image");
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < cn->image_count; i++)
|
||||
@@ -483,6 +483,20 @@ static void comp_wivrn_present_thread(std::stop_token stop_token, wivrn_comp_tar
|
||||
|
||||
auto res = vk.device.waitForFences(*cn->psc.fence, true, UINT64_MAX);
|
||||
|
||||
// Update encoder status, release image
|
||||
if ((cn->psc.status &= ~status_bit) == 0)
|
||||
{
|
||||
cn->psc.status.notify_all();
|
||||
for (auto & img: cn->psc.images)
|
||||
{
|
||||
if (img.status == pseudo_swapchain::status_t::encoding)
|
||||
{
|
||||
img.status = pseudo_swapchain::status_t::free;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
for (auto & encoder: encoders)
|
||||
@@ -499,20 +513,6 @@ static void comp_wivrn_present_thread(std::stop_token stop_token, wivrn_comp_tar
|
||||
{
|
||||
// Ignore errors
|
||||
}
|
||||
|
||||
// Update encoder status, release image
|
||||
if ((cn->psc.status &= ~status_bit) == 0)
|
||||
{
|
||||
cn->psc.status.notify_all();
|
||||
for (auto & img: cn->psc.images)
|
||||
{
|
||||
if (img.status == pseudo_swapchain::status_t::encoding)
|
||||
{
|
||||
img.status = pseudo_swapchain::status_t::free;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
enum wivrn_controller_input_index
|
||||
{
|
||||
WIVRN_CONTROLLER_INPUT_INVALID = -1,
|
||||
@@ -100,7 +98,7 @@ struct input_data
|
||||
xrt_device_type device;
|
||||
};
|
||||
|
||||
input_data map_input(device_id id)
|
||||
static input_data map_input(device_id id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
@@ -249,18 +247,18 @@ input_data map_input(device_id id)
|
||||
return {WIVRN_CONTROLLER_INPUT_INVALID, wivrn_input_type::BOOL, XRT_DEVICE_TYPE_UNKNOWN};
|
||||
}
|
||||
|
||||
xrt_binding_input_pair simple_input_binding[] = {
|
||||
static xrt_binding_input_pair simple_input_binding[] = {
|
||||
{XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_TOUCH_TRIGGER_VALUE},
|
||||
{XRT_INPUT_SIMPLE_MENU_CLICK, XRT_INPUT_TOUCH_MENU_CLICK},
|
||||
{XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_TOUCH_GRIP_POSE},
|
||||
{XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_TOUCH_AIM_POSE},
|
||||
};
|
||||
|
||||
xrt_binding_output_pair simple_output_binding[] = {
|
||||
static xrt_binding_output_pair simple_output_binding[] = {
|
||||
{XRT_OUTPUT_NAME_SIMPLE_VIBRATION, XRT_OUTPUT_NAME_TOUCH_HAPTIC},
|
||||
};
|
||||
|
||||
xrt_binding_input_pair index_input_binding[] = {
|
||||
static xrt_binding_input_pair index_input_binding[] = {
|
||||
{XRT_INPUT_INDEX_SYSTEM_CLICK, XRT_INPUT_TOUCH_SYSTEM_CLICK},
|
||||
{XRT_INPUT_INDEX_SYSTEM_TOUCH, XRT_INPUT_INDEX_SYSTEM_TOUCH},
|
||||
{XRT_INPUT_INDEX_A_CLICK, XRT_INPUT_TOUCH_A_CLICK},
|
||||
@@ -282,11 +280,11 @@ xrt_binding_input_pair index_input_binding[] = {
|
||||
{XRT_INPUT_INDEX_AIM_POSE, XRT_INPUT_TOUCH_AIM_POSE},
|
||||
};
|
||||
|
||||
xrt_binding_output_pair index_output_binding[] = {
|
||||
static xrt_binding_output_pair index_output_binding[] = {
|
||||
{XRT_OUTPUT_NAME_INDEX_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC},
|
||||
};
|
||||
|
||||
xrt_binding_input_pair focus3_input_binding[] = {
|
||||
static xrt_binding_input_pair focus3_input_binding[] = {
|
||||
{XRT_INPUT_VIVE_FOCUS3_X_CLICK, XRT_INPUT_TOUCH_X_CLICK},
|
||||
{XRT_INPUT_VIVE_FOCUS3_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK},
|
||||
{XRT_INPUT_VIVE_FOCUS3_MENU_CLICK, XRT_INPUT_TOUCH_MENU_CLICK},
|
||||
@@ -307,11 +305,11 @@ xrt_binding_input_pair focus3_input_binding[] = {
|
||||
{XRT_INPUT_VIVE_FOCUS3_AIM_POSE, XRT_INPUT_TOUCH_AIM_POSE},
|
||||
};
|
||||
|
||||
xrt_binding_output_pair focus3_output_binding[] = {
|
||||
static xrt_binding_output_pair focus3_output_binding[] = {
|
||||
{XRT_OUTPUT_NAME_VIVE_FOCUS3_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC},
|
||||
};
|
||||
|
||||
xrt_binding_input_pair touch_pro_input_binding[] = {
|
||||
static xrt_binding_input_pair touch_pro_input_binding[] = {
|
||||
{XRT_INPUT_TOUCH_PRO_X_CLICK, XRT_INPUT_TOUCH_X_CLICK},
|
||||
{XRT_INPUT_TOUCH_PRO_X_TOUCH, XRT_INPUT_TOUCH_X_TOUCH},
|
||||
{XRT_INPUT_TOUCH_PRO_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK},
|
||||
@@ -339,13 +337,13 @@ xrt_binding_input_pair touch_pro_input_binding[] = {
|
||||
{XRT_INPUT_TOUCH_PRO_STYLUS_FORCE, XRT_INPUT_TOUCH_PRO_STYLUS_FORCE},
|
||||
};
|
||||
|
||||
xrt_binding_output_pair touch_pro_output_binding[] = {
|
||||
static xrt_binding_output_pair touch_pro_output_binding[] = {
|
||||
{XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC},
|
||||
{XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB, XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB},
|
||||
{XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER, XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER},
|
||||
};
|
||||
|
||||
xrt_binding_input_pair touch_plus_input_binding[] = {
|
||||
static xrt_binding_input_pair touch_plus_input_binding[] = {
|
||||
{XRT_INPUT_TOUCH_PLUS_X_CLICK, XRT_INPUT_TOUCH_X_CLICK},
|
||||
{XRT_INPUT_TOUCH_PLUS_X_TOUCH, XRT_INPUT_TOUCH_X_TOUCH},
|
||||
{XRT_INPUT_TOUCH_PLUS_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK},
|
||||
@@ -372,11 +370,11 @@ xrt_binding_input_pair touch_plus_input_binding[] = {
|
||||
{XRT_INPUT_TOUCH_PLUS_TRIGGER_SLIDE, XRT_INPUT_TOUCH_PRO_TRIGGER_SLIDE},
|
||||
};
|
||||
|
||||
xrt_binding_output_pair touch_plus_output_binding[] = {
|
||||
static xrt_binding_output_pair touch_plus_output_binding[] = {
|
||||
{XRT_OUTPUT_NAME_TOUCH_PLUS_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC},
|
||||
};
|
||||
|
||||
xrt_binding_input_pair pico_neo3_input_binding[] = {
|
||||
static xrt_binding_input_pair pico_neo3_input_binding[] = {
|
||||
{XRT_INPUT_PICO_NEO3_X_CLICK, XRT_INPUT_TOUCH_X_CLICK},
|
||||
{XRT_INPUT_PICO_NEO3_X_TOUCH, XRT_INPUT_TOUCH_X_TOUCH},
|
||||
{XRT_INPUT_PICO_NEO3_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK},
|
||||
@@ -399,11 +397,11 @@ xrt_binding_input_pair pico_neo3_input_binding[] = {
|
||||
{XRT_INPUT_PICO_NEO3_B_TOUCH, XRT_INPUT_TOUCH_B_TOUCH},
|
||||
};
|
||||
|
||||
xrt_binding_output_pair pico_neo3_output_binding[] = {
|
||||
static xrt_binding_output_pair pico_neo3_output_binding[] = {
|
||||
{XRT_OUTPUT_NAME_PICO_NEO3_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC},
|
||||
};
|
||||
|
||||
xrt_binding_input_pair pico4_input_binding[] = {
|
||||
static xrt_binding_input_pair pico4_input_binding[] = {
|
||||
{XRT_INPUT_PICO4_X_CLICK, XRT_INPUT_TOUCH_X_CLICK},
|
||||
{XRT_INPUT_PICO4_X_TOUCH, XRT_INPUT_TOUCH_X_TOUCH},
|
||||
{XRT_INPUT_PICO4_Y_CLICK, XRT_INPUT_TOUCH_Y_CLICK},
|
||||
@@ -426,11 +424,11 @@ xrt_binding_input_pair pico4_input_binding[] = {
|
||||
{XRT_INPUT_PICO4_MENU_CLICK, XRT_INPUT_TOUCH_MENU_CLICK},
|
||||
};
|
||||
|
||||
xrt_binding_output_pair pico4_output_binding[] = {
|
||||
static xrt_binding_output_pair pico4_output_binding[] = {
|
||||
{XRT_OUTPUT_NAME_PICO4_HAPTIC, XRT_OUTPUT_NAME_TOUCH_HAPTIC},
|
||||
};
|
||||
|
||||
xrt_binding_profile wivrn_binding_profiles[] = {
|
||||
static xrt_binding_profile wivrn_binding_profiles[] = {
|
||||
{
|
||||
.name = XRT_DEVICE_SIMPLE_CONTROLLER,
|
||||
.inputs = simple_input_binding,
|
||||
@@ -482,10 +480,13 @@ xrt_binding_profile wivrn_binding_profiles[] = {
|
||||
},
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
struct xrt_space_relation_csv_header
|
||||
{};
|
||||
} // namespace
|
||||
|
||||
std::ostream & operator<<(std::ostream & out, const xrt_space_relation_csv_header &)
|
||||
static std::ostream & operator<<(std::ostream & out, const xrt_space_relation_csv_header &)
|
||||
{
|
||||
for (auto [value, name]: magic_enum::enum_entries<xrt_space_relation_flags>())
|
||||
{
|
||||
@@ -502,7 +503,44 @@ std::ostream & operator<<(std::ostream & out, const xrt_space_relation_csv_heade
|
||||
out << "avx,avy,avz";
|
||||
return out;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
static std::ostream & operator<<(std::ostream & out, const xrt_space_relation & rel)
|
||||
{
|
||||
const auto & pos = rel.pose.position;
|
||||
const auto & o = rel.pose.orientation;
|
||||
const auto & v = rel.linear_velocity;
|
||||
const auto & av = rel.angular_velocity;
|
||||
for (const auto & [value, name]: magic_enum::enum_entries<xrt_space_relation_flags>())
|
||||
{
|
||||
if (value and value != XRT_SPACE_RELATION_BITMASK_ALL)
|
||||
out << bool(rel.relation_flags & value) << ',';
|
||||
}
|
||||
out << pos.x << ',' << pos.y << ',' << pos.z << ',';
|
||||
out << o.w << ',' << o.x << ',' << o.y << ',' << o.z << ',';
|
||||
out << v.x << ',' << v.y << ',' << v.z << ',';
|
||||
out << av.x << ',' << av.y << ',' << av.z;
|
||||
return out;
|
||||
}
|
||||
|
||||
static std::mutex tracking_dump_mutex;
|
||||
static std::ofstream & tracking_dump()
|
||||
{
|
||||
static auto res = [] {
|
||||
std::ofstream res;
|
||||
if (auto wivrn_dump = std::getenv("WIVRN_DUMP_TRACKING"))
|
||||
{
|
||||
res.open(wivrn_dump);
|
||||
res << "device_id,"
|
||||
"now_ns,"
|
||||
"timestamp_ns,"
|
||||
"extrapolation_ns,"
|
||||
"receive/get,"
|
||||
<< xrt_space_relation_csv_header{} << std::endl;
|
||||
}
|
||||
return res;
|
||||
}();
|
||||
return res;
|
||||
}
|
||||
|
||||
wivrn_controller::wivrn_controller(int hand_id,
|
||||
xrt_device * hmd,
|
||||
@@ -722,8 +760,9 @@ xrt_result_t wivrn_controller::get_tracked_pose(xrt_input_name name, int64_t at_
|
||||
return XRT_ERROR_INPUT_UNSUPPORTED;
|
||||
}
|
||||
cnx->add_predict_offset(extrapolation_time);
|
||||
if (auto out = tracking_dump())
|
||||
if (auto & out = tracking_dump())
|
||||
{
|
||||
std::lock_guard lock{tracking_dump_mutex};
|
||||
auto device = [&] {
|
||||
switch (name)
|
||||
{
|
||||
@@ -734,12 +773,12 @@ xrt_result_t wivrn_controller::get_tracked_pose(xrt_input_name name, int64_t at_
|
||||
assert(false);
|
||||
__builtin_unreachable();
|
||||
} }();
|
||||
*out->lock() << magic_enum::enum_name(device) << ','
|
||||
<< os_monotonic_get_ns() << ','
|
||||
<< at_timestamp_ns << ','
|
||||
<< extrapolation_time.count() << ','
|
||||
<< "g,"
|
||||
<< *res << std::endl;
|
||||
out << magic_enum::enum_name(device) << ','
|
||||
<< os_monotonic_get_ns() << ','
|
||||
<< at_timestamp_ns << ','
|
||||
<< extrapolation_time.count() << ','
|
||||
<< "g,"
|
||||
<< *res << std::endl;
|
||||
;
|
||||
}
|
||||
return XRT_SUCCESS;
|
||||
@@ -793,19 +832,19 @@ void wivrn_controller::update_tracking(const from_headset::tracking & tracking,
|
||||
cnx->set_enabled(grip.device, false);
|
||||
if (not palm.update_tracking(tracking, offset))
|
||||
cnx->set_enabled(palm.device, false);
|
||||
if (auto out = tracking_dump(); out and offset)
|
||||
if (auto & out = tracking_dump(); out and offset)
|
||||
{
|
||||
auto locked = out->lock();
|
||||
std::lock_guard lock{tracking_dump_mutex};
|
||||
auto now = os_monotonic_get_ns();
|
||||
for (const auto & pose: tracking.device_poses)
|
||||
{
|
||||
if (pose.device == aim.device or pose.device == grip.device or pose.device == palm.device)
|
||||
*locked << magic_enum::enum_name(pose.device) << ','
|
||||
<< now << ','
|
||||
<< offset.from_headset(tracking.timestamp) << ','
|
||||
<< tracking.timestamp - tracking.production_timestamp << ','
|
||||
<< "r,"
|
||||
<< pose_list::convert_pose(pose) << std::endl;
|
||||
out << magic_enum::enum_name(pose.device) << ','
|
||||
<< now << ','
|
||||
<< offset.from_headset(tracking.timestamp) << ','
|
||||
<< tracking.timestamp - tracking.production_timestamp << ','
|
||||
<< "r,"
|
||||
<< pose_list::convert_pose(pose) << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -856,44 +895,4 @@ void wivrn_controller::reset_history()
|
||||
aim.reset();
|
||||
palm.reset();
|
||||
}
|
||||
|
||||
thread_safe<std::ofstream> * wivrn_controller::tracking_dump()
|
||||
{
|
||||
static std::unique_ptr<thread_safe<std::ofstream>> res = [] {
|
||||
if (auto wivrn_dump = std::getenv("WIVRN_DUMP_TRACKING"))
|
||||
{
|
||||
U_LOG_I("Controller tracking dump enabled: %s", wivrn_dump);
|
||||
std::ofstream res;
|
||||
res.open(wivrn_dump);
|
||||
res << "device_id,"
|
||||
"now_ns,"
|
||||
"timestamp_ns,"
|
||||
"extrapolation_ns,"
|
||||
"receive/get,"
|
||||
<< xrt_space_relation_csv_header{} << std::endl;
|
||||
|
||||
return std::make_unique<thread_safe<std::ofstream>>(std::move(res));
|
||||
}
|
||||
return std::unique_ptr<thread_safe<std::ofstream>>();
|
||||
}();
|
||||
return res.get();
|
||||
}
|
||||
} // namespace wivrn
|
||||
|
||||
std::ostream & operator<<(std::ostream & out, const xrt_space_relation & rel)
|
||||
{
|
||||
const auto & pos = rel.pose.position;
|
||||
const auto & o = rel.pose.orientation;
|
||||
const auto & v = rel.linear_velocity;
|
||||
const auto & av = rel.angular_velocity;
|
||||
for (const auto & [value, name]: magic_enum::enum_entries<xrt_space_relation_flags>())
|
||||
{
|
||||
if (value and value != XRT_SPACE_RELATION_BITMASK_ALL)
|
||||
out << bool(rel.relation_flags & value) << ',';
|
||||
}
|
||||
out << pos.x << ',' << pos.y << ',' << pos.z << ',';
|
||||
out << o.w << ',' << o.x << ',' << o.y << ',' << o.z << ',';
|
||||
out << v.x << ',' << v.y << ',' << v.z << ',';
|
||||
out << av.x << ',' << av.y << ',' << av.z;
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
|
||||
#include "hand_joints_list.h"
|
||||
#include "pose_list.h"
|
||||
#include "utils/thread_safe.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
@@ -66,10 +64,5 @@ public:
|
||||
void update_hand_tracking(const from_headset::hand_tracking &, const clock_offset &);
|
||||
|
||||
void reset_history();
|
||||
|
||||
static thread_safe<std::ofstream> * tracking_dump();
|
||||
};
|
||||
|
||||
} // namespace wivrn
|
||||
|
||||
std::ostream & operator<<(std::ostream & out, const xrt_space_relation & rel);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "render/render_interface.h"
|
||||
#include "vk/vk_mini_helpers.h"
|
||||
|
||||
#include "wivrn_foveation.h"
|
||||
|
||||
@@ -44,13 +45,22 @@ bool render_distortion_images_ensure(struct render_resources * r,
|
||||
bool pre_rotate)
|
||||
{
|
||||
if (r->distortion.buffer == VK_NULL_HANDLE)
|
||||
r->distortion.buffer = wivrn::wivrn_foveation::instance().get_gpu_buffer();
|
||||
{
|
||||
return vk_buffer_init(vk,
|
||||
sizeof(render_compute_distortion_foveation_data),
|
||||
VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||
&r->distortion.buffer,
|
||||
&r->distortion.device_memory);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void render_distortion_images_fini(struct render_resources * r)
|
||||
{
|
||||
r->distortion.buffer = VK_NULL_HANDLE;
|
||||
auto * vk = r->vk;
|
||||
D(Buffer, r->distortion.buffer);
|
||||
DF(Memory, r->distortion.device_memory);
|
||||
}
|
||||
|
||||
// a, b: parameters computed by solve_foveation
|
||||
@@ -311,34 +321,20 @@ wivrn_foveation::wivrn_foveation(wivrn_vk_bundle & bundle, const xrt_hmd_parts &
|
||||
.commandPool = *command_pool,
|
||||
.commandBufferCount = 1,
|
||||
})[0])),
|
||||
gpu_buffer(
|
||||
host_buffer(
|
||||
bundle.device,
|
||||
{
|
||||
.size = sizeof(render_compute_distortion_foveation_data),
|
||||
.usage = vk::BufferUsageFlagBits::eTransferDst | vk::BufferUsageFlagBits::eStorageBuffer,
|
||||
.usage = vk::BufferUsageFlagBits::eTransferSrc,
|
||||
},
|
||||
VmaAllocationCreateInfo{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT,
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"foveation storage buffer")
|
||||
})
|
||||
{
|
||||
if (not(gpu_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
|
||||
{
|
||||
host_buffer = buffer_allocation(
|
||||
bundle.device,
|
||||
{
|
||||
.size = gpu_buffer.info().size,
|
||||
.usage = vk::BufferUsageFlagBits::eTransferSrc,
|
||||
},
|
||||
{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST,
|
||||
},
|
||||
"foveation staging buffer");
|
||||
}
|
||||
bundle.name(command_pool, "foveation command pool");
|
||||
bundle.name(cmd, "foveation command buffer");
|
||||
bundle.name(vk::Buffer(host_buffer), "foveation staging buffer");
|
||||
}
|
||||
|
||||
void wivrn_foveation::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset)
|
||||
@@ -394,7 +390,7 @@ std::array<to_headset::foveation_parameter, 2> wivrn_foveation::get_parameters()
|
||||
}
|
||||
|
||||
static void fill_ubo(
|
||||
std::span<uint32_t> ubo,
|
||||
uint32_t * ubo,
|
||||
const std::vector<uint16_t> & params,
|
||||
bool flip,
|
||||
size_t offset,
|
||||
@@ -403,9 +399,9 @@ static void fill_ubo(
|
||||
{
|
||||
assert(params.size() % 2 == 1);
|
||||
const int n_ratio = (params.size() - 1) / 2;
|
||||
ubo[0] = offset;
|
||||
*ubo = offset;
|
||||
if (flip)
|
||||
ubo[0] += size;
|
||||
*ubo += size;
|
||||
for (auto [i, n]: std::ranges::enumerate_view(params))
|
||||
{
|
||||
const int n_source = std::abs(n_ratio - int(i)) + 1;
|
||||
@@ -416,12 +412,12 @@ static void fill_ubo(
|
||||
ubo[1] = ubo[0] - n_source;
|
||||
else
|
||||
ubo[1] = ubo[0] + n_source;
|
||||
ubo = ubo.subspan(1);
|
||||
++ubo;
|
||||
--count;
|
||||
}
|
||||
}
|
||||
if (not ubo.empty())
|
||||
std::ranges::fill(ubo, ubo[0]);
|
||||
if (count > 0)
|
||||
std::fill(ubo + 1, ubo + count + 1, *ubo);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -439,11 +435,6 @@ static bool operator==(const xrt_fov & a, const xrt_fov & b)
|
||||
return a.angle_left == b.angle_left and a.angle_right == b.angle_right and a.angle_up == b.angle_up and a.angle_down == b.angle_down;
|
||||
}
|
||||
|
||||
vk::Buffer wivrn_foveation::get_gpu_buffer()
|
||||
{
|
||||
return gpu_buffer;
|
||||
}
|
||||
|
||||
vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
|
||||
vk::Buffer target,
|
||||
bool flip_y,
|
||||
@@ -453,6 +444,14 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
|
||||
if (not target)
|
||||
return nullptr;
|
||||
|
||||
if (target != gpu_buffer)
|
||||
{
|
||||
command_pool.reset();
|
||||
cmd.begin({});
|
||||
cmd.copyBuffer(host_buffer, target, vk::BufferCopy{.size = sizeof(render_compute_distortion_foveation_data)});
|
||||
cmd.end();
|
||||
}
|
||||
|
||||
// Check if the last value is still valid
|
||||
std::lock_guard lock(mutex);
|
||||
if (last.flip_y == flip_y //
|
||||
@@ -469,15 +468,6 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
|
||||
)
|
||||
return nullptr;
|
||||
|
||||
assert(target == gpu_buffer);
|
||||
if (host_buffer)
|
||||
{
|
||||
command_pool.reset();
|
||||
cmd.begin({});
|
||||
cmd.copyBuffer(host_buffer, target, vk::BufferCopy{.size = sizeof(render_compute_distortion_foveation_data)});
|
||||
cmd.end();
|
||||
}
|
||||
|
||||
last = {
|
||||
.gaze = gaze,
|
||||
.flip_y = flip_y,
|
||||
@@ -489,7 +479,7 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
|
||||
|
||||
compute_params(source, fovs);
|
||||
|
||||
auto ubo = host_buffer ? host_buffer.data<render_compute_distortion_foveation_data>() : gpu_buffer.data<render_compute_distortion_foveation_data>();
|
||||
auto ubo = (render_compute_distortion_foveation_data *)host_buffer.map();
|
||||
for (size_t view = 0; view < 2; ++view)
|
||||
{
|
||||
bool flip = false;
|
||||
@@ -506,7 +496,7 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
|
||||
offset = source[view].offset.w;
|
||||
extent = source[view].extent.w;
|
||||
}
|
||||
fill_ubo(std::span(ubo->x + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, RENDER_FOVEATION_BUFFER_DIMENSIONS), params[view].x, flip, offset, extent, foveated_width);
|
||||
fill_ubo(ubo->x + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, params[view].x, flip, offset, extent, foveated_width);
|
||||
|
||||
if (source[view].extent.h < 0)
|
||||
{
|
||||
@@ -520,10 +510,8 @@ vk::CommandBuffer wivrn_foveation::update_foveation_buffer(
|
||||
offset = source[view].offset.h;
|
||||
extent = source[view].extent.h;
|
||||
}
|
||||
fill_ubo(std::span(ubo->y + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, RENDER_FOVEATION_BUFFER_DIMENSIONS), params[view].y, flip, offset, extent, foveated_height);
|
||||
fill_ubo(ubo->y + view * RENDER_FOVEATION_BUFFER_DIMENSIONS, params[view].y, flip, offset, extent, foveated_height);
|
||||
}
|
||||
if (host_buffer)
|
||||
return *cmd;
|
||||
return nullptr;
|
||||
return *cmd;
|
||||
}
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -148,8 +148,7 @@ xrt_result_t wivrn_generic_tracker::get_tracked_pose(xrt_input_name name, int64_
|
||||
{
|
||||
std::tie(extrapolation_time, *res) = poses.get_pose_at(at_timestamp_ns);
|
||||
|
||||
active = true;
|
||||
cnx.update_tracker_enabled();
|
||||
cnx.set_tracker_enabled(index, true);
|
||||
cnx.add_predict_offset(extrapolation_time);
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
@@ -161,9 +160,6 @@ xrt_result_t wivrn_generic_tracker::get_tracked_pose(xrt_input_name name, int64_
|
||||
void wivrn_generic_tracker::update_tracking(const from_headset::body_tracking & tracking, const from_headset::body_tracking::pose & pose, const clock_offset & offset)
|
||||
{
|
||||
if (!poses.update_tracking(tracking.production_timestamp, tracking.timestamp, pose, offset))
|
||||
{
|
||||
active = false;
|
||||
cnx.update_tracker_enabled();
|
||||
}
|
||||
cnx.set_tracker_enabled(index, false);
|
||||
}
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -45,7 +45,6 @@ class wivrn_generic_tracker : public xrt_device
|
||||
{
|
||||
tracker_pose_list poses;
|
||||
xrt_input pose_input;
|
||||
std::atomic_bool active = false;
|
||||
|
||||
wivrn_session & cnx;
|
||||
int index;
|
||||
@@ -58,10 +57,5 @@ public:
|
||||
xrt_result_t get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns, xrt_space_relation * out_relation);
|
||||
|
||||
void update_tracking(const from_headset::body_tracking & tracking, const from_headset::body_tracking::pose & pose, const clock_offset & offset);
|
||||
|
||||
bool is_active()
|
||||
{
|
||||
return active;
|
||||
}
|
||||
};
|
||||
} // namespace wivrn
|
||||
} // namespace wivrn
|
||||
@@ -31,13 +31,13 @@
|
||||
#include <numbers>
|
||||
#include <optional>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "xrt/xrt_defines.h"
|
||||
|
||||
namespace wivrn
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
enum wivrn_hand_interaction_input_index
|
||||
{
|
||||
WIVRN_HAND_INTERACTION_INPUT_INVALID = -1,
|
||||
@@ -73,7 +73,7 @@ struct input_data
|
||||
xrt_device_type device;
|
||||
};
|
||||
|
||||
input_data map_input(device_id id)
|
||||
static input_data map_input(device_id id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ input_data map_input(device_id id)
|
||||
return {WIVRN_HAND_INTERACTION_INPUT_INVALID, wivrn_input_type::BOOL, XRT_DEVICE_TYPE_UNKNOWN};
|
||||
}
|
||||
|
||||
xrt_binding_input_pair hand_interaction_input_binding[] = {
|
||||
static xrt_binding_input_pair hand_interaction_input_binding[] = {
|
||||
{XRT_INPUT_HAND_GRIP_POSE, XRT_INPUT_HAND_GRIP_POSE},
|
||||
{XRT_INPUT_HAND_AIM_POSE, XRT_INPUT_HAND_AIM_POSE},
|
||||
{XRT_INPUT_HAND_PINCH_POSE, XRT_INPUT_HAND_PINCH_POSE},
|
||||
@@ -147,13 +147,7 @@ xrt_binding_input_pair hand_interaction_input_binding[] = {
|
||||
{XRT_INPUT_HAND_GRASP_READY, XRT_INPUT_HAND_GRASP_READY},
|
||||
};
|
||||
|
||||
xrt_binding_input_pair simple_input_binding[] = {
|
||||
{XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_HAND_PINCH_VALUE},
|
||||
{XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_HAND_GRIP_POSE},
|
||||
{XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_HAND_AIM_POSE},
|
||||
};
|
||||
|
||||
xrt_binding_profile wivrn_binding_profiles[] = {
|
||||
static xrt_binding_profile wivrn_binding_profiles[] = {
|
||||
{
|
||||
.name = XRT_DEVICE_EXT_HAND_INTERACTION,
|
||||
.inputs = hand_interaction_input_binding,
|
||||
@@ -161,16 +155,64 @@ xrt_binding_profile wivrn_binding_profiles[] = {
|
||||
.outputs = nullptr,
|
||||
.output_count = 0,
|
||||
},
|
||||
{
|
||||
.name = XRT_DEVICE_SIMPLE_CONTROLLER,
|
||||
.inputs = simple_input_binding,
|
||||
.input_count = std::size(simple_input_binding),
|
||||
.outputs = nullptr,
|
||||
.output_count = 0,
|
||||
},
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
struct xrt_space_relation_csv_header
|
||||
{};
|
||||
} // namespace
|
||||
|
||||
static std::ostream & operator<<(std::ostream & out, const xrt_space_relation_csv_header &)
|
||||
{
|
||||
for (auto [value, name]: magic_enum::enum_entries<xrt_space_relation_flags>())
|
||||
{
|
||||
if (value and value != XRT_SPACE_RELATION_BITMASK_ALL)
|
||||
{
|
||||
name = name.substr(strlen("XRT_SPACE_RELATION_"));
|
||||
name = name.substr(0, name.size() - strlen("_BIT"));
|
||||
out << name << ",";
|
||||
}
|
||||
}
|
||||
out << "x,y,z,";
|
||||
out << "qw,qx,qy,qz";
|
||||
return out;
|
||||
}
|
||||
|
||||
static std::ostream & operator<<(std::ostream & out, const xrt_space_relation & rel)
|
||||
{
|
||||
const auto & pos = rel.pose.position;
|
||||
const auto & o = rel.pose.orientation;
|
||||
for (const auto & [value, name]: magic_enum::enum_entries<xrt_space_relation_flags>())
|
||||
{
|
||||
if (value and value != XRT_SPACE_RELATION_BITMASK_ALL)
|
||||
out << bool(rel.relation_flags & value) << ',';
|
||||
}
|
||||
out << pos.x << ',' << pos.y << ',' << pos.z << ',';
|
||||
out << o.w << ',' << o.x << ',' << o.y << ',' << o.z;
|
||||
return out;
|
||||
}
|
||||
|
||||
static std::mutex tracking_dump_mutex;
|
||||
static std::ofstream & tracking_dump()
|
||||
{
|
||||
static auto res = [] {
|
||||
std::ofstream res;
|
||||
if (auto wivrn_dump = std::getenv("WIVRN_DUMP_TRACKING"))
|
||||
{
|
||||
res.open(wivrn_dump);
|
||||
res << "device_id,"
|
||||
"now_ns,"
|
||||
"timestamp_ns,"
|
||||
"extrapolation_ns,"
|
||||
"receive/get,"
|
||||
<< xrt_space_relation_csv_header{} << std::endl;
|
||||
}
|
||||
return res;
|
||||
}();
|
||||
return res;
|
||||
}
|
||||
|
||||
wivrn_hand_interaction::wivrn_hand_interaction(int hand_id,
|
||||
xrt_device * hmd,
|
||||
wivrn::wivrn_session * cnx) :
|
||||
@@ -355,8 +397,9 @@ xrt_result_t wivrn_hand_interaction::get_tracked_pose(xrt_input_name name, int64
|
||||
return XRT_ERROR_INPUT_UNSUPPORTED;
|
||||
}
|
||||
cnx->add_predict_offset(extrapolation_time);
|
||||
if (auto out = wivrn_controller::tracking_dump())
|
||||
if (auto & out = tracking_dump())
|
||||
{
|
||||
std::lock_guard lock{tracking_dump_mutex};
|
||||
auto device = [&] {
|
||||
switch (name)
|
||||
{
|
||||
@@ -369,12 +412,12 @@ xrt_result_t wivrn_hand_interaction::get_tracked_pose(xrt_input_name name, int64
|
||||
assert(false);
|
||||
__builtin_unreachable();
|
||||
} }();
|
||||
*out->lock() << magic_enum::enum_name(device) << ','
|
||||
<< os_monotonic_get_ns() << ','
|
||||
<< at_timestamp_ns << ','
|
||||
<< extrapolation_time.count() << ','
|
||||
<< "g,"
|
||||
<< *res << std::endl;
|
||||
out << magic_enum::enum_name(device) << ','
|
||||
<< os_monotonic_get_ns() << ','
|
||||
<< at_timestamp_ns << ','
|
||||
<< extrapolation_time.count() << ','
|
||||
<< "g,"
|
||||
<< *res << std::endl;
|
||||
;
|
||||
}
|
||||
return XRT_SUCCESS;
|
||||
@@ -412,19 +455,19 @@ void wivrn_hand_interaction::update_tracking(const from_headset::tracking & trac
|
||||
cnx->set_enabled(pinch_ext.device, false);
|
||||
if (not poke_ext.update_tracking(tracking, offset))
|
||||
cnx->set_enabled(poke_ext.device, false);
|
||||
if (auto out = wivrn_controller::tracking_dump(); out and offset)
|
||||
if (auto & out = tracking_dump(); out and offset)
|
||||
{
|
||||
std::lock_guard lock{tracking_dump_mutex};
|
||||
auto now = os_monotonic_get_ns();
|
||||
auto locked = out->lock();
|
||||
for (const auto & pose: tracking.device_poses)
|
||||
{
|
||||
if (pose.device == aim.device or pose.device == grip.device or pose.device == palm.device)
|
||||
*locked << magic_enum::enum_name(pose.device) << ','
|
||||
<< now << ','
|
||||
<< offset.from_headset(tracking.timestamp) << ','
|
||||
<< tracking.timestamp - tracking.production_timestamp << ','
|
||||
<< "r,"
|
||||
<< pose_list::convert_pose(pose) << std::endl;
|
||||
out << magic_enum::enum_name(pose.device) << ','
|
||||
<< now << ','
|
||||
<< offset.from_headset(tracking.timestamp) << ','
|
||||
<< tracking.timestamp - tracking.production_timestamp << ','
|
||||
<< "r,"
|
||||
<< pose_list::convert_pose(pose) << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "util/u_builders.h"
|
||||
#include "util/u_logging.h"
|
||||
#include "util/u_system.h"
|
||||
#include "utils/load_icon.h"
|
||||
#include "utils/scoped_lock.h"
|
||||
|
||||
#include "audio/audio_setup.h"
|
||||
@@ -172,12 +171,6 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
||||
throw;
|
||||
}
|
||||
|
||||
(*this)(from_headset::get_application_list{
|
||||
.language = get_info().language,
|
||||
.country = get_info().country,
|
||||
.variant = get_info().variant,
|
||||
});
|
||||
|
||||
static_roles.head = xdevs[xdev_count++] = &hmd;
|
||||
|
||||
if (hmd.supported.face_tracking)
|
||||
@@ -240,31 +233,24 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
||||
xdevs[xdev_count++] = htc_face_tracker.get();
|
||||
}
|
||||
|
||||
auto num_generic_trackers = get_info().num_generic_trackers;
|
||||
generic_trackers.reserve(num_generic_trackers);
|
||||
num_generic_trackers = get_info().num_generic_trackers;
|
||||
enabled_trackers.fill(false);
|
||||
if (num_generic_trackers > 0)
|
||||
{
|
||||
if (num_generic_trackers > from_headset::body_tracking::max_tracked_poses)
|
||||
{
|
||||
U_LOG_W("reported generic trackers %d larger than maximum %lu",
|
||||
num_generic_trackers,
|
||||
from_headset::body_tracking::max_tracked_poses);
|
||||
num_generic_trackers = from_headset::body_tracking::max_tracked_poses;
|
||||
}
|
||||
if (num_generic_trackers + xdev_count > std::size(xdevs))
|
||||
{
|
||||
U_LOG_W("Too many generic trackers: %d, only %lu will be active",
|
||||
num_generic_trackers,
|
||||
std::size(xdevs) - xdev_count);
|
||||
num_generic_trackers = std::size(xdevs) - xdev_count;
|
||||
}
|
||||
U_LOG_I("Creating %d generic trackers", num_generic_trackers);
|
||||
|
||||
if (num_generic_trackers > generic_trackers.size())
|
||||
throw std::out_of_range(
|
||||
std::format("{} generic trackers is larger than maximum {}",
|
||||
num_generic_trackers,
|
||||
generic_trackers.size()));
|
||||
|
||||
for (int i = 0; i < num_generic_trackers; ++i)
|
||||
{
|
||||
auto dev = std::make_unique<wivrn_generic_tracker>(i, &hmd, *this);
|
||||
xdevs[xdev_count++] = dev.get();
|
||||
generic_trackers.push_back(std::move(dev));
|
||||
generic_trackers[i] = std::move(dev);
|
||||
enabled_trackers[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,10 +535,12 @@ void wivrn_session::operator()(from_headset::body_tracking && body_tracking)
|
||||
{
|
||||
auto offset = offset_est.get_offset();
|
||||
|
||||
assert(generic_trackers.size() <= from_headset::body_tracking::max_tracked_poses);
|
||||
for (int i = 0; i < generic_trackers.size(); i++)
|
||||
for (int i = 0; i < num_generic_trackers; i++)
|
||||
{
|
||||
auto pose = body_tracking.poses ? (*body_tracking.poses)[i] : from_headset::body_tracking::pose{};
|
||||
auto pose = body_tracking.poses ? body_tracking.poses->at(i) : from_headset::body_tracking::pose{
|
||||
.pose = {},
|
||||
.flags = 0,
|
||||
};
|
||||
generic_trackers[i]->update_tracking(body_tracking, pose, offset);
|
||||
}
|
||||
}
|
||||
@@ -617,10 +605,12 @@ void wivrn_session::set_enabled(device_id id, bool enabled)
|
||||
if (tracking_control.set_enabled(to_tracking_control(id), enabled) and enabled)
|
||||
tracking_control.send(*connection, true);
|
||||
}
|
||||
void wivrn_session::update_tracker_enabled()
|
||||
void wivrn_session::set_tracker_enabled(int index, bool enabled)
|
||||
{
|
||||
bool active = std::ranges::any_of(generic_trackers, [](auto & t) { return t->is_active(); });
|
||||
if (tracking_control.set_enabled(to_headset::tracking_control::id::generic_tracker, active) and active)
|
||||
assert(index < std::size(enabled_trackers));
|
||||
enabled_trackers[index] = enabled;
|
||||
bool keep_active = std::ranges::any_of(enabled_trackers, [](bool b) { return b; });
|
||||
if (tracking_control.set_enabled(to_headset::tracking_control::id::generic_tracker, keep_active))
|
||||
tracking_control.send(*connection, true);
|
||||
}
|
||||
|
||||
@@ -746,48 +736,15 @@ void wivrn_session::operator()(from_headset::get_application_list && request)
|
||||
.country = std::move(request.country),
|
||||
.variant = std::move(request.variant),
|
||||
};
|
||||
|
||||
auto apps = list_applications();
|
||||
|
||||
for (const auto & [id, app]: apps)
|
||||
for (auto && [id, app]: list_applications())
|
||||
{
|
||||
response.applications.emplace_back(
|
||||
std::move(id),
|
||||
// FIXME: use locale
|
||||
app.name.at(""));
|
||||
app.name.at(""),
|
||||
app.image);
|
||||
}
|
||||
send_control(std::move(response));
|
||||
|
||||
for (const auto & [id, app]: apps)
|
||||
{
|
||||
if (app.icon_path)
|
||||
{
|
||||
try
|
||||
{
|
||||
const auto & icons = load_icon(*app.icon_path);
|
||||
|
||||
if (icons.empty())
|
||||
continue;
|
||||
|
||||
const auto & largest_icon = std::ranges::max(icons, [](const wivrn::icon & a, const wivrn::icon & b) {
|
||||
if (a.bpp < b.bpp)
|
||||
return true;
|
||||
if (a.bpp > b.bpp)
|
||||
return false;
|
||||
return a.width * a.height < b.width * b.height;
|
||||
});
|
||||
|
||||
send_control(to_headset::application_icon{
|
||||
.id = id,
|
||||
.image = largest_icon.png_data,
|
||||
});
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
U_LOG_W("Error loading icon %s: %s", app.icon_path->c_str(), e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wivrn_session::operator()(const from_headset::start_app & request)
|
||||
|
||||
@@ -105,8 +105,6 @@ class wivrn_session : public xrt_system_devices
|
||||
.gamepad = -1,
|
||||
};
|
||||
|
||||
tracking_control_t tracking_control;
|
||||
|
||||
wivrn_hmd hmd;
|
||||
wivrn_controller left_controller;
|
||||
int32_t left_controller_index;
|
||||
@@ -119,13 +117,19 @@ class wivrn_session : public xrt_system_devices
|
||||
std::unique_ptr<wivrn_eye_tracker> eye_tracker;
|
||||
std::unique_ptr<wivrn_fb_face2_tracker> fb_face2_tracker;
|
||||
std::unique_ptr<wivrn_htc_face_tracker> htc_face_tracker;
|
||||
std::vector<std::unique_ptr<wivrn_generic_tracker>> generic_trackers;
|
||||
uint32_t num_generic_trackers;
|
||||
std::array<std::unique_ptr<wivrn_generic_tracker>, from_headset::body_tracking::max_tracked_poses> generic_trackers;
|
||||
std::array<bool, from_headset::body_tracking::max_tracked_poses> enabled_trackers;
|
||||
|
||||
std::shared_mutex comp_target_mutex;
|
||||
wivrn_comp_target * comp_target;
|
||||
|
||||
clock_offset_estimator offset_est;
|
||||
|
||||
// prediction offset and enabled tracking to configure client
|
||||
tracking_control_t tracking_control;
|
||||
std::mutex tracking_control_mutex;
|
||||
|
||||
std::mutex csv_mutex;
|
||||
std::ofstream feedback_csv;
|
||||
|
||||
@@ -165,7 +169,7 @@ public:
|
||||
|
||||
void set_enabled(to_headset::tracking_control::id id, bool enabled);
|
||||
void set_enabled(device_id id, bool enabled);
|
||||
void update_tracker_enabled();
|
||||
void set_tracker_enabled(int index, bool enabled);
|
||||
|
||||
void operator()(from_headset::crypto_handshake &&) {}
|
||||
void operator()(from_headset::pin_check_1 &&) {}
|
||||
|
||||
@@ -180,6 +180,32 @@ std::unique_ptr<video_encoder> video_encoder::create(
|
||||
return res;
|
||||
}
|
||||
|
||||
#if WIVRN_USE_VULKAN_ENCODE
|
||||
std::pair<std::vector<vk::VideoProfileInfoKHR>, vk::ImageUsageFlags> video_encoder::get_create_image_info(const std::vector<encoder_settings> & settings)
|
||||
{
|
||||
std::pair<std::vector<vk::VideoProfileInfoKHR>, vk::ImageUsageFlags> result;
|
||||
for (const auto & item: settings)
|
||||
{
|
||||
if (item.encoder_name == encoder_vulkan)
|
||||
{
|
||||
result.second |= vk::ImageUsageFlagBits::eVideoEncodeSrcKHR;
|
||||
switch (item.codec)
|
||||
{
|
||||
case h264:
|
||||
result.first.push_back(video_encoder_vulkan_h264::video_profile_info.get());
|
||||
break;
|
||||
case h265:
|
||||
// result.first.push_back(video_encoder_vulkan_h265::video_profile_info.get());
|
||||
break;
|
||||
case av1:
|
||||
throw std::runtime_error("av1 not supported for vulkan video encode");
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const uint64_t idr_throttle = 100;
|
||||
|
||||
video_encoder::video_encoder(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, double bitrate_multiplier, bool async_send) :
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "driver/clock_offset.h"
|
||||
#include "wivrn_config.h"
|
||||
#include "wivrn_packets.h"
|
||||
|
||||
#include <atomic>
|
||||
@@ -113,6 +114,10 @@ public:
|
||||
int input_height,
|
||||
float fps);
|
||||
|
||||
#if WIVRN_USE_VULKAN_ENCODE
|
||||
static std::pair<std::vector<vk::VideoProfileInfoKHR>, vk::ImageUsageFlags> get_create_image_info(const std::vector<encoder_settings> &);
|
||||
#endif
|
||||
|
||||
video_encoder(uint8_t stream_idx, to_headset::video_stream_description::channels_t channels, double bitrate_multiplier, bool async_send);
|
||||
virtual ~video_encoder();
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "vk/vk_helpers.h"
|
||||
|
||||
#include "video_encoder_vulkan.h"
|
||||
|
||||
#include "encoder/encoder_settings.h"
|
||||
@@ -176,8 +174,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
img_create_info,
|
||||
{
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"vulkan encoder DPB image");
|
||||
});
|
||||
vk.name(vk::Image(dpb_image), "vulkan encoder DPB image");
|
||||
}
|
||||
|
||||
// Output buffer
|
||||
@@ -195,8 +193,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"vulkan encode output buffer");
|
||||
});
|
||||
vk.name(vk::Buffer(item.output_buffer), "vulkan encode output buffer");
|
||||
|
||||
if (not(item.output_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
|
||||
{
|
||||
@@ -208,8 +206,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"vulkan encode host buffer");
|
||||
});
|
||||
vk.name(vk::Buffer(item.host_buffer), "vulkan encode host buffer");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +266,7 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
.layerCount = 1},
|
||||
};
|
||||
|
||||
if (rect.offset != vk::Offset2D{0, 0} or not vk.vk.features.video_maintenance_1)
|
||||
if (rect.offset != vk::Offset2D{0, 0})
|
||||
{
|
||||
image_view_template.subresourceRange.baseArrayLayer = 0;
|
||||
for (size_t i = 0; i < num_slots; ++i)
|
||||
@@ -292,8 +290,8 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
},
|
||||
{
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"vulkan encoder temporary image");
|
||||
});
|
||||
vk.name(vk::Image(slot_data[i].tmp_image), "vulkan encoder temporary image");
|
||||
image_view_template.image = vk::Image(slot_data[i].tmp_image);
|
||||
slot_data[i].view = vk.device.createImageView(image_view_template);
|
||||
vk.name(slot_data[i].view, "vulkan encoder temporary image view");
|
||||
@@ -480,7 +478,7 @@ std::pair<bool, vk::Semaphore> wivrn::video_encoder_vulkan::present_image(vk::Im
|
||||
video_cmd_buf.begin({.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit});
|
||||
|
||||
// If we encode from top left corner, encode from the source image directly
|
||||
bool encode_direct = not slot_item.tmp_image;
|
||||
bool encode_direct = rect.offset == vk::Offset2D{0, 0};
|
||||
|
||||
vk::ImageView image_view;
|
||||
|
||||
|
||||
@@ -80,9 +80,10 @@ class video_encoder_vulkan : public video_encoder
|
||||
bool session_initialized = false;
|
||||
const vk::Rect2D rect;
|
||||
|
||||
vk::VideoEncodeRateControlLayerInfoKHR rate_control_layer;
|
||||
|
||||
protected:
|
||||
const uint8_t num_dpb_slots;
|
||||
vk::VideoEncodeRateControlLayerInfoKHR rate_control_layer;
|
||||
std::optional<vk::VideoEncodeRateControlInfoKHR> rate_control;
|
||||
|
||||
video_encoder_vulkan(wivrn_vk_bundle & vk,
|
||||
|
||||
@@ -169,47 +169,6 @@ std::vector<void *> wivrn::video_encoder_vulkan_h264::setup_slot_info(size_t dpb
|
||||
return res;
|
||||
}
|
||||
|
||||
auto get_video_caps(vk::raii::PhysicalDevice & phys_dev)
|
||||
{
|
||||
vk::StructureChain video_profile_info{
|
||||
vk::VideoProfileInfoKHR{
|
||||
.videoCodecOperation =
|
||||
vk::VideoCodecOperationFlagBitsKHR::eEncodeH264,
|
||||
.chromaSubsampling = vk::VideoChromaSubsamplingFlagBitsKHR::e420,
|
||||
.lumaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
.chromaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
},
|
||||
vk::VideoEncodeH264ProfileInfoKHR{
|
||||
.stdProfileIdc = STD_VIDEO_H264_PROFILE_IDC_BASELINE,
|
||||
},
|
||||
vk::VideoEncodeUsageInfoKHR{
|
||||
.videoUsageHints = vk::VideoEncodeUsageFlagBitsKHR::eStreaming,
|
||||
.videoContentHints = vk::VideoEncodeContentFlagBitsKHR::eRendered,
|
||||
.tuningMode = vk::VideoEncodeTuningModeKHR::eUltraLowLatency,
|
||||
}};
|
||||
|
||||
try
|
||||
{
|
||||
auto [video_caps, encode_caps, encode_h264_caps] =
|
||||
phys_dev.getVideoCapabilitiesKHR<
|
||||
vk::VideoCapabilitiesKHR,
|
||||
vk::VideoEncodeCapabilitiesKHR,
|
||||
vk::VideoEncodeH264CapabilitiesKHR>(video_profile_info.get());
|
||||
|
||||
return std::make_tuple(video_caps, encode_caps, encode_h264_caps, video_profile_info);
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
// NVIDIA fails if the structure is there
|
||||
video_profile_info.unlink<vk::VideoEncodeUsageInfoKHR>();
|
||||
auto [video_caps, encode_caps, encode_h264_caps] =
|
||||
phys_dev.getVideoCapabilitiesKHR<
|
||||
vk::VideoCapabilitiesKHR,
|
||||
vk::VideoEncodeCapabilitiesKHR,
|
||||
vk::VideoEncodeH264CapabilitiesKHR>(video_profile_info.get());
|
||||
return std::make_tuple(video_caps, encode_caps, encode_h264_caps, video_profile_info);
|
||||
}
|
||||
|
||||
std::unique_ptr<wivrn::video_encoder_vulkan_h264> wivrn::video_encoder_vulkan_h264::create(
|
||||
wivrn_vk_bundle & vk,
|
||||
encoder_settings & settings,
|
||||
@@ -227,11 +186,15 @@ std::unique_ptr<wivrn::video_encoder_vulkan_h264> wivrn::video_encoder_vulkan_h2
|
||||
},
|
||||
};
|
||||
|
||||
auto [video_caps, encode_caps, encode_h264_caps] =
|
||||
vk.physical_device.getVideoCapabilitiesKHR<
|
||||
vk::VideoCapabilitiesKHR,
|
||||
vk::VideoEncodeCapabilitiesKHR,
|
||||
vk::VideoEncodeH264CapabilitiesKHR>(video_profile_info.get());
|
||||
|
||||
if (settings.bit_depth != 8)
|
||||
throw std::runtime_error("h264 codec only supports 8-bit encoding");
|
||||
|
||||
auto [video_caps, encode_caps, encode_h264_caps, video_profile_info] = get_video_caps(vk.physical_device);
|
||||
|
||||
std::unique_ptr<video_encoder_vulkan_h264> self(new video_encoder_vulkan_h264(vk, rect, video_caps, encode_caps, fps, stream_idx, settings));
|
||||
|
||||
vk::VideoEncodeH264SessionParametersAddInfoKHR h264_add_info{};
|
||||
@@ -264,8 +227,6 @@ std::unique_ptr<wivrn::video_encoder_vulkan_h264> wivrn::video_encoder_vulkan_h2
|
||||
self->rate_control->pNext = &self->rate_control_h264;
|
||||
}
|
||||
|
||||
self->rate_control_layer.pNext = &self->rate_control_layer_h264;
|
||||
|
||||
self->init(video_caps, video_profile_info.get(), &session_create_info, &h264_session_params);
|
||||
|
||||
return self;
|
||||
@@ -398,3 +359,20 @@ vk::ExtensionProperties wivrn::video_encoder_vulkan_h264::std_header_version()
|
||||
VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME);
|
||||
return std_header_version;
|
||||
}
|
||||
|
||||
decltype(wivrn::video_encoder_vulkan_h264::video_profile_info) wivrn::video_encoder_vulkan_h264::video_profile_info = vk::StructureChain{
|
||||
vk::VideoProfileInfoKHR{
|
||||
.videoCodecOperation =
|
||||
vk::VideoCodecOperationFlagBitsKHR::eEncodeH264,
|
||||
.chromaSubsampling = vk::VideoChromaSubsamplingFlagBitsKHR::e420,
|
||||
.lumaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
.chromaBitDepth = vk::VideoComponentBitDepthFlagBitsKHR::e8,
|
||||
},
|
||||
vk::VideoEncodeH264ProfileInfoKHR{
|
||||
.stdProfileIdc = STD_VIDEO_H264_PROFILE_IDC_BASELINE,
|
||||
},
|
||||
vk::VideoEncodeUsageInfoKHR{
|
||||
.videoUsageHints = vk::VideoEncodeUsageFlagBitsKHR::eStreaming,
|
||||
.videoContentHints = vk::VideoEncodeContentFlagBitsKHR::eRendered,
|
||||
.tuningMode = vk::VideoEncodeTuningModeKHR::eUltraLowLatency,
|
||||
}};
|
||||
|
||||
@@ -46,7 +46,6 @@ class video_encoder_vulkan_h264 : public video_encoder_vulkan
|
||||
|
||||
vk::VideoEncodeH264GopRemainingFrameInfoKHR gop_info;
|
||||
vk::VideoEncodeH264RateControlInfoKHR rate_control_h264;
|
||||
vk::VideoEncodeH264RateControlLayerInfoKHR rate_control_layer_h264;
|
||||
|
||||
video_encoder_vulkan_h264(wivrn_vk_bundle & vk,
|
||||
vk::Rect2D rect,
|
||||
@@ -71,5 +70,7 @@ public:
|
||||
uint8_t stream_idx);
|
||||
|
||||
std::vector<uint8_t> get_sps_pps();
|
||||
|
||||
static const vk::StructureChain<vk::VideoProfileInfoKHR, vk::VideoEncodeH264ProfileInfoKHR, vk::VideoEncodeUsageInfoKHR> video_profile_info;
|
||||
};
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -168,8 +168,7 @@ video_encoder_x264::video_encoder_x264(
|
||||
{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"x264 luma buffer");
|
||||
});
|
||||
i.chroma = buffer_allocation(
|
||||
vk.device, {
|
||||
.size = vk::DeviceSize(settings.video_width * settings.video_height / 2),
|
||||
@@ -178,8 +177,9 @@ video_encoder_x264::video_encoder_x264(
|
||||
{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
},
|
||||
"x264 chroma buffer");
|
||||
});
|
||||
vk.name(vk::Buffer(i.luma), "x264 luma buffer");
|
||||
vk.name(vk::Buffer(i.chroma), "x264 chroma buffer");
|
||||
|
||||
auto & pic = i.pic;
|
||||
x264_picture_init(&pic);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "start_systemd_unit.h"
|
||||
#include "systemd_manager.h"
|
||||
#include "systemd_unit.h"
|
||||
#include "utils/strings.h"
|
||||
#include <gio/gio.h>
|
||||
#include <glib-object.h>
|
||||
#include <iostream>
|
||||
@@ -212,10 +211,11 @@ void systemd_units_manager::start_application(const std::vector<std::string> & a
|
||||
variant_builder argv(G_VARIANT_TYPE("as"));
|
||||
for (const auto & arg: args)
|
||||
g_variant_builder_add(&argv, "s", arg.c_str());
|
||||
auto exec_start = g_variant_new("(s@asb)",
|
||||
args.front().c_str(),
|
||||
g_variant_new("as", &argv),
|
||||
false);
|
||||
auto exec_start =
|
||||
g_variant_new("(s@asb)",
|
||||
args.front().c_str(),
|
||||
g_variant_new("as", &argv),
|
||||
false);
|
||||
g_variant_builder_add(&b,
|
||||
"(sv)",
|
||||
"ExecStart",
|
||||
@@ -224,17 +224,6 @@ void systemd_units_manager::start_application(const std::vector<std::string> & a
|
||||
&exec_start,
|
||||
1));
|
||||
|
||||
if (auto path = std::getenv("PATH"))
|
||||
{
|
||||
variant_builder pathv(G_VARIANT_TYPE("as"));
|
||||
for (auto item: utils::split(path, ":"))
|
||||
g_variant_builder_add(&pathv, "s", item.c_str());
|
||||
g_variant_builder_add(&b,
|
||||
"(sv)",
|
||||
"ExecSearchPath",
|
||||
g_variant_new("as", &pathv));
|
||||
}
|
||||
|
||||
auto properties = b.end();
|
||||
auto aux = g_variant_new_array(G_VARIANT_TYPE("(sa(sv))"), nullptr, 0);
|
||||
|
||||
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd $(dirname $0)/..
|
||||
|
||||
WIVRN_CLIENT_POT=$(mktemp)
|
||||
WIVRN_DASHBOARD_POT=$(mktemp)
|
||||
|
||||
xgettext \
|
||||
--c++ --from-code=UTF-8 \
|
||||
--keyword=_:1,1t \
|
||||
--keyword=_S:1,1t \
|
||||
--keyword=_cS:1c,2,2t \
|
||||
--keyword=_F:1,1t \
|
||||
--output=$WIVRN_CLIENT_POT \
|
||||
--package-name=WiVRn \
|
||||
$(find client/ -name "*.cpp" | sort)
|
||||
|
||||
xgettext \
|
||||
--c++ --kde --from-code=UTF-8 \
|
||||
--keyword=i18n:1 \
|
||||
--keyword=i18nc:1c,2 \
|
||||
--keyword=i18np:1,2 \
|
||||
--keyword=i18ncp:1c,2,3 \
|
||||
--output=$WIVRN_DASHBOARD_POT \
|
||||
--package-name=WiVRn-dashboard \
|
||||
$(find dashboard/ -name "*.qml" -o -name "*.cpp" | sort)
|
||||
|
||||
sed -i 's/charset=CHARSET/charset=UTF-8/g' $WIVRN_CLIENT_POT $WIVRN_DASHBOARD_POT
|
||||
|
||||
RC=0
|
||||
|
||||
for i in locale/*
|
||||
do
|
||||
if [ -f $i/wivrn.po ]
|
||||
then
|
||||
tools/check_po.py $WIVRN_CLIENT_POT $i/wivrn.po $(basename $i)
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
RC=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $i/wivrn-dashboard.po ]
|
||||
then
|
||||
tools/check_po.py $WIVRN_DASHBOARD_POT $i/wivrn-dashboard.po $(basename $i)
|
||||
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
RC=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
rm $WIVRN_CLIENT_POT $WIVRN_DASHBOARD_POT
|
||||
|
||||
exit $RC
|
||||
+36
-117
@@ -1,132 +1,51 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import polib
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
def list_files(base: str, exts: str|list[str]):
|
||||
if type(exts) == str:
|
||||
exts = [exts]
|
||||
for root, dirs, files in os.walk(base):
|
||||
for f in files:
|
||||
for ext in exts:
|
||||
if f.endswith(ext):
|
||||
yield os.path.join(root, f)
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='check_po.py',
|
||||
description='Check that all strings are translated in a .po file')
|
||||
|
||||
def flag(lang: str):
|
||||
# Map language code to a country flag
|
||||
countries = {
|
||||
'es': 'es',
|
||||
'fr': 'fr',
|
||||
'it': 'it',
|
||||
'ja': 'jp',
|
||||
'zh_TW': 'tw',
|
||||
'pt_BR': 'br'
|
||||
}
|
||||
parser.add_argument('ref', type=pathlib.Path)
|
||||
parser.add_argument('file', type=pathlib.Path)
|
||||
parser.add_argument('lang', type=str)
|
||||
|
||||
country = countries.get(lang, lang)
|
||||
args = parser.parse_args()
|
||||
|
||||
res = ''
|
||||
for i in country.upper():
|
||||
res += chr(ord(i) + ord('🇦') - ord('A'))
|
||||
return res
|
||||
po_ref = polib.pofile(args.ref)
|
||||
|
||||
ISSUE_LABEL="localisation"
|
||||
ISSUE_TITLE="[{lang}] Missing translations"
|
||||
po_file = polib.pofile(args.file)
|
||||
entries = [i.msgid for i in po_file.translated_entries()]
|
||||
|
||||
if __name__ == "__main__":
|
||||
root = os.path.dirname(os.path.dirname(__file__))
|
||||
locale_dir = os.path.join(root, "locale")
|
||||
cwd = os.getcwd()
|
||||
# Map language code to a country flag
|
||||
countries = {
|
||||
'es': 'es',
|
||||
'fr': 'fr',
|
||||
'it': 'it',
|
||||
'ja': 'jp',
|
||||
'zh_TW': 'tw',
|
||||
'pt_BR': 'br'
|
||||
}
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='check_po.py',
|
||||
description='Check that all strings are translated in a .po file')
|
||||
if args.lang in countries:
|
||||
country = countries[args.lang]
|
||||
else:
|
||||
country = args.lang
|
||||
|
||||
parser.add_argument('lang', type=str, nargs="*")
|
||||
parser.add_argument('--github-repository')
|
||||
parser.add_argument('--github-token')
|
||||
parser.add_argument('--manage-issues', action="store_true")
|
||||
flag = ''
|
||||
for i in country.upper():
|
||||
flag += chr(ord(i) + ord('🇦') - ord('A'))
|
||||
|
||||
args = parser.parse_args()
|
||||
missing = 0
|
||||
for i in po_ref:
|
||||
if not i.obsolete:
|
||||
if not i.msgid in entries:
|
||||
missing = missing + 1
|
||||
print(f"::notice file={args.file}::{flag} Translation for {repr(i.msgid)} is missing")
|
||||
|
||||
if len(args.lang) == 0:
|
||||
for d in sorted(os.listdir(locale_dir)):
|
||||
if os.path.isdir(os.path.join(locale_dir, d)):
|
||||
args.lang.append(d)
|
||||
|
||||
if args.manage_issues:
|
||||
from github import Github, Auth
|
||||
gh = Github(auth=Auth.Token(args.github_token))
|
||||
repo = gh.get_repo(args.github_repository)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
client_pot = os.path.join(tmpdir, "client.pot")
|
||||
dashboard_pot = os.path.join(tmpdir, "dashboard.pot")
|
||||
|
||||
subprocess.check_call(
|
||||
["xgettext",
|
||||
"--c++", "--from-code=UTF-8",
|
||||
"--keyword=_:1,1t",
|
||||
"--keyword=_S:1,1t",
|
||||
"--keyword=_cS:1c,2,2t",
|
||||
"--keyword=_F:1,1t",
|
||||
"--output", client_pot,
|
||||
"--package-name=WiVRn",
|
||||
] + sorted(list_files(os.path.join(root, "client"), ".cpp"))
|
||||
)
|
||||
|
||||
subprocess.check_call(
|
||||
["xgettext",
|
||||
"--c++", "--kde", "--from-code=UTF-8",
|
||||
"--keyword=i18n:1",
|
||||
"--keyword=i18nc:1c,2",
|
||||
"--keyword=i18np:1,2",
|
||||
"--keyword=i18ncp:1c,2,3",
|
||||
"--output", dashboard_pot,
|
||||
"--package-name=WiVRn-dashboard",
|
||||
] + sorted(list_files(os.path.join(root, "dashboard"), [".cpp", ".qml"]))
|
||||
)
|
||||
|
||||
client_ref = polib.pofile(client_pot)
|
||||
dashboard_ref = polib.pofile(dashboard_pot)
|
||||
|
||||
for lang in args.lang:
|
||||
lang_issues = 0
|
||||
for po_ref, po in ((client_ref, os.path.join(locale_dir, lang, "wivrn.po")),
|
||||
(dashboard_ref, os.path.join(locale_dir, lang, "wivrn-dashboard.po"))):
|
||||
if not os.path.exists(po):
|
||||
continue
|
||||
po_file = polib.pofile(po)
|
||||
po = os.path.relpath(po, cwd)
|
||||
entries = [i.msgid for i in po_file.translated_entries()]
|
||||
|
||||
missing = 0
|
||||
for i in po_ref:
|
||||
if not i.obsolete:
|
||||
if not i.msgid in entries:
|
||||
missing = missing + 1
|
||||
print(f"::notice file={po}::{flag(lang)} Translation for {repr(i.msgid)} is missing")
|
||||
lang_issues += missing
|
||||
|
||||
if missing > 0:
|
||||
print(f"::warning file={po}::{flag(lang)} {missing} translations missing")
|
||||
|
||||
if args.manage_issues:
|
||||
issues = [i for i in repo.get_issues(state="all", labels = [ISSUE_LABEL]) if i.title == ISSUE_TITLE.format(lang=lang)]
|
||||
if lang_issues > 0:
|
||||
if issues:
|
||||
for issue in issues:
|
||||
if issue.state != "open":
|
||||
issue.edit(state="open")
|
||||
else:
|
||||
issue = repo.create_issue(
|
||||
title=ISSUE_TITLE.format(lang=lang),
|
||||
labels=[ISSUE_LABEL]
|
||||
)
|
||||
else:
|
||||
for issue in issues:
|
||||
issue.edit(state="closed")
|
||||
if missing > 0:
|
||||
print(f"::warning file={args.file}::{flag} {missing} translations missing")
|
||||
sys.exit(1)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user