diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e5f64baf..4b9ece5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,7 +63,7 @@ jobs: ${{ matrix.tests && '-Tests' || '' }} # Every OpenVR interface version Valve has shipped is offered or set aside with a reason (offline: it compares - # interfaces.txt with the source) + # interfaces.txt with the source), and how_real.txt is what the source gives - name: Interface inventory if: matrix.tests && matrix.arch == 'x64' run: python scripts/openvr_inventory.py --check @@ -135,13 +135,25 @@ jobs: # Formats the runtime doesn't offer (it has RGBA8 sRGB only), converted into the one it has python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-d3d11-formats,gfx-d3d12-formats,gfx-vk-formats,gfx-gl-formats --script tests/conformance/scripts/gfx_rgba8_only.json --expect tests/conformance/expect/gfx_formats.json --allow-skip ".*-(vk|gl)(-.*)?" --out conformance/gfx-formats if ($LASTEXITCODE) { $failed++ } + # Vulkan multisampled textures (resolved), a second queue and dynamic resolution; needs a Vulkan driver + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-vk-odd,gfx-vk-dynamic-resolution,gfx-vk-msaa-formats --script tests/conformance/scripts/gfx_vk_odd.json --expect tests/conformance/expect/gfx_vk_odd.json --allow-skip "gfx-vk-.*" --out conformance/gfx-vk-odd + if ($LASTEXITCODE) { $failed++ } + # A game that makes its device again mid-run: the session follows it, or the frames are left out when the + # runtime refuses the new device + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-d3d11-new-device,gfx-d3d11-eyes-two-devices,gfx-d3d12-new-device,gfx-vk-new-device --script tests/conformance/scripts/gfx_all_apis.json --expect tests/conformance/expect/gfx_new_device.json --allow-skip "gfx-(vk|d3d12)-new-device" --out conformance/gfx-new-device + if ($LASTEXITCODE) { $failed++ } + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-d3d11-new-device,gfx-d3d12-new-device,gfx-vk-new-device --script tests/conformance/scripts/gfx_new_device_refused.json --expect tests/conformance/expect/gfx_new_device_refused.json --allow-skip "gfx-(vk|d3d12)-new-device" --out conformance/gfx-new-device-refused + if ($LASTEXITCODE) { $failed++ } # The pose and depth a frame was submitted with: used with useSubmittedPose and submitDepth on, not without python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-d3d11-pose-depth,gfx-d3d12-pose-depth,gfx-vk-pose-depth,gfx-gl-pose-depth --script tests/conformance/scripts/gfx_depth.json --ini tests/conformance/ini/pose_depth.ini --expect tests/conformance/expect/gfx_pose_depth.json --allow-skip ".*-(vk|gl)(-.*)?" --out conformance/gfx-pose-depth if ($LASTEXITCODE) { $failed++ } python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-d3d11-pose-depth,gfx-d3d12-pose-depth,gfx-vk-pose-depth,gfx-gl-pose-depth --script tests/conformance/scripts/gfx_depth.json --expect tests/conformance/expect/gfx_pose_depth_off.json --allow-skip ".*-(vk|gl)(-.*)?" --out conformance/gfx-pose-depth-off if ($LASTEXITCODE) { $failed++ } # OpenGL and Vulkan frames through D3D11 where the runtime has D3D11 alone (they skip without those drivers) - python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-gl-interop,gfx-vk-interop,gfx-gl-interop-bounds,gfx-vk-interop-bounds --expect tests/conformance/expect/gfx_interop.json --allow-skip "gfx-(vk|gl)-.*" --out conformance/gfx-interop + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-gl-interop,gfx-vk-interop,gfx-gl-interop-bounds,gfx-vk-interop-bounds,gfx-gl-interop-odd,gfx-vk-interop-odd,gfx-vk-interop-gpu-wait --expect tests/conformance/expect/gfx_interop.json --allow-skip "gfx-(vk|gl)-.*" --out conformance/gfx-interop + if ($LASTEXITCODE) { $failed++ } + # OpenGL and Vulkan formats through the interop, copied into D3D11 and converted into the runtime's one format + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases gfx-gl-interop-formats,gfx-vk-interop-formats --script tests/conformance/scripts/gfx_interop_rgba8_only.json --expect tests/conformance/expect/gfx_interop_formats.json --allow-skip "gfx-(vk|gl)-.*" --out conformance/gfx-interop-formats if ($LASTEXITCODE) { $failed++ } # The events SteamVR sends for session changes: with sessionEvents all of them, without it only the IPD's and the quit python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases session-events --script tests/conformance/scripts/session_events.json --ini tests/conformance/ini/session_events.ini --expect tests/conformance/expect/session_events.json --out conformance/session-events @@ -159,6 +171,18 @@ jobs: # A bound source that isn't an input path: GetActionBindingInfo leaves it out python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases binding-info --script tests/conformance/scripts/bound_source_odd.json --manifest tests/unit/data/manifest_toggle.json --expect tests/conformance/expect/binding_info.json --out conformance/binding-info if ($LASTEXITCODE) { $failed++ } + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases binding-info --script tests/conformance/scripts/bound_source_odd.json --manifest tests/unit/data/manifest_haptic_no_bindings.json --expect tests/conformance/expect/binding_info_runtime.json --out conformance/binding-info-runtime + if ($LASTEXITCODE) { $failed++ } + # Vive trackers by their role: a device per role, and a pose action a tracker's binding file binds read from it + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases vive-trackers --script tests/conformance/scripts/vive_trackers.json --manifest tests/unit/data/manifest_trackers.json --expect tests/conformance/expect/vive_trackers.json --out conformance/vive-trackers + if ($LASTEXITCODE) { $failed++ } + # The hands as controllers: through XR_EXT_hand_interaction, with hand tracking alone, and shown as Touch controllers + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases hand-controllers --script tests/conformance/scripts/hand_interaction.json --manifest tests/unit/data/manifest_trackers.json --expect tests/conformance/expect/hand_controllers.json --out conformance/hand-controllers + if ($LASTEXITCODE) { $failed++ } + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases hand-controllers --script tests/conformance/scripts/hand_tracking_only.json --manifest tests/unit/data/manifest_trackers.json --expect tests/conformance/expect/hand_controllers_tracking.json --out conformance/hand-controllers-tracking + if ($LASTEXITCODE) { $failed++ } + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases hand-controllers --script tests/conformance/scripts/hand_interaction.json --manifest tests/unit/data/manifest_trackers.json --ini tests/conformance/ini/hand_controller_touch.ini --expect tests/conformance/expect/hand_controllers_touch.json --out conformance/hand-controllers-touch + if ($LASTEXITCODE) { $failed++ } # The compositor's calls with every graphics API offered: the Vulkan extension lists with a null buffer python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --only "IVRCompositor_0(19|2[0-9])" --script tests/conformance/scripts/gfx_all_apis.json --out conformance/compositor-all-apis if ($LASTEXITCODE) { $failed++ } @@ -191,7 +215,7 @@ jobs: python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases display-frequency --script tests/conformance/scripts/display_120.json --expect tests/conformance/expect/display_frequency_measured.json --out conformance/display-frequency-measured if ($LASTEXITCODE) { $failed++ } # OpenLamina's own frames while the game stalls, also while another thread reads input - python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases own-frames,own-frames-race,own-frames-nothing-shown,own-frames-overlay-churn --repeat 5 --jobs 2 --ini tests/conformance/ini/own_frames.ini --expect tests/conformance/expect/own_frames.json --out conformance/own-frames + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases own-frames,own-frames-race,own-frames-nothing-shown,own-frames-overlay-churn,own-frames-fade --repeat 5 --jobs 2 --ini tests/conformance/ini/own_frames.ini --expect tests/conformance/expect/own_frames.json --out conformance/own-frames if ($LASTEXITCODE) { $failed++ } # Overlay and background applications on overlay and headless sessions (a background one only while a game # runs), and their refusals without them @@ -254,7 +278,7 @@ jobs: if ($LASTEXITCODE) { $failed++ } python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --shipped-defaults --cases gfx-d3d11-pose-depth,gfx-d3d12-pose-depth,gfx-vk-pose-depth,gfx-gl-pose-depth --script tests/conformance/scripts/gfx_depth.json --expect tests/conformance/expect/gfx_pose_depth.json --allow-skip ".*-(vk|gl)(-.*)?" --out conformance/defaults-pose-depth if ($LASTEXITCODE) { $failed++ } - python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --shipped-defaults --cases own-frames,own-frames-race,own-frames-nothing-shown,own-frames-overlay-churn --repeat 2 --jobs 2 --expect tests/conformance/expect/own_frames.json --out conformance/defaults-own-frames + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --shipped-defaults --cases own-frames,own-frames-race,own-frames-nothing-shown,own-frames-overlay-churn,own-frames-fade --repeat 2 --jobs 2 --expect tests/conformance/expect/own_frames.json --out conformance/defaults-own-frames if ($LASTEXITCODE) { $failed++ } python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --shipped-defaults --cases message-overlay --script tests/conformance/scripts/message_box.json --expect tests/conformance/expect/message_overlay.json --out conformance/defaults-message-overlay if ($LASTEXITCODE) { $failed++ } @@ -272,7 +296,7 @@ jobs: python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases keyboard --script tests/conformance/scripts/keyboard.json --ini tests/conformance/ini/keyboard_us.ini --expect tests/conformance/expect/keyboard.json --out conformance/keyboard if ($LASTEXITCODE) { $failed++ } # The compositor's statistics, timing and poses per frame - python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases compositor-stats,mirror --script tests/conformance/scripts/gfx_all_apis.json --ini tests/conformance/ini/mirror_window.ini --expect tests/conformance/expect/compositor.json --out conformance/compositor-stats + python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases compositor-stats,mirror,mirror-flipped --script tests/conformance/scripts/gfx_all_apis.json --ini tests/conformance/ini/mirror_window.ini --expect tests/conformance/expect/compositor.json --out conformance/compositor-stats if ($LASTEXITCODE) { $failed++ } # Without mirrorWindow no window is shown; the mirror texture is given all the same python tests/conformance/run.py --runtime build/bin/$env:OC_DLL --conformance build/tests/oc_conformance.exe --xr-runtime stand-in --ci --cases mirror --script tests/conformance/scripts/gfx_all_apis.json --expect tests/conformance/expect/mirror_window_off.json --out conformance/mirror-window-off @@ -341,6 +365,7 @@ jobs: run: | python3 tests/conformance/list_games.py --self-test python3 tests/conformance/regress.py --self-test + python3 scripts/openvr_inventory.py --self-test # The library, the tests and the unit tests - name: Build @@ -370,6 +395,66 @@ jobs: path: build/bin/${{ matrix.lib }} if-no-files-found: error + # Build variants, x64: the C++ library's assertions on (-D_GLIBCXX_ASSERTIONS: bounds and preconditions checked, a + # failure aborts), with the stand-in runtime's tests and every conformance run; and the system's OpenXR loader, + # jsoncpp and glm (USE_SYSTEM_OPENXR, USE_SYSTEM_GLM), as a distribution would build it, with the unit and stand-in + # runtime tests + linux-variants: + name: Linux x64, ${{ matrix.variant }} + runs-on: ubuntu-24.04 + container: ubuntu:24.04 + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - variant: assertions + cxxflags: -D_GLIBCXX_ASSERTIONS + cmake: '' + packages: '' + conformance: true + - variant: system libraries + cxxflags: '' + cmake: -DUSE_SYSTEM_OPENXR=ON -DUSE_SYSTEM_GLM=ON + packages: libopenxr-dev libjsoncpp-dev libglm-dev + conformance: false + steps: + - name: Build tools + env: + PACKAGES: ${{ matrix.packages }} + run: | + apt-get update + # shellcheck disable=SC2086 # PACKAGES is a list + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + ca-certificates git g++ cmake make automake autoconf libtool python3 libgl-dev libvulkan-dev \ + xvfb xauth mesa-vulkan-drivers libgl1-mesa-dri libglx-mesa0 $PACKAGES + + - uses: actions/checkout@v7 + with: + submodules: recursive + + - name: Build + env: + CXXFLAGS: ${{ matrix.cxxflags }} + OC_CMAKE_ARGS: ${{ matrix.cmake }} + run: sh scripts/ci/build-linux.sh --tests x64 build "$GITHUB_SHA ($GITHUB_REF_NAME)" + + - name: Stand-in runtime + run: xvfb-run -a ctest --test-dir build -L runtime --output-on-failure + + - name: Conformance + if: matrix.conformance + run: xvfb-run -a sh scripts/ci/conformance-linux.sh x64 build conformance + + - uses: actions/upload-artifact@v7 + if: always() && matrix.conformance + with: + name: conformance-linux-x64-${{ matrix.variant }} + path: | + conformance/*/summary.txt + conformance/*/results.json + conformance/**/logs/ + # OpenLamina on Monado's simulated headset (built from source, at MONADO_REF), headless: monado-service with the # simulated driver and the null compositor, on Mesa's lavapipe monado: @@ -413,6 +498,7 @@ jobs: # Nothing may end, crash or hang on Monado (no baseline: its answers are its own). On lavapipe no session starts: # Monado asks for VK_KHR_external_semaphore_fd and VK_KHR_external_fence_fd, which lavapipe lacks, so OpenLamina's # own Vulkan device can't be made and every Init answers as without a headset. The notice says how many started. + # Lavapipe is Mesa's only software Vulkan driver, and Ubuntu 24.04's (Mesa 25.2) lacks both: nothing to switch to. - name: Conformance run: | export XDG_RUNTIME_DIR="$RUNNER_TEMP/xdg" diff --git a/.github/workflows/openvr-inventory.yml b/.github/workflows/openvr-inventory.yml new file mode 100644 index 00000000..172fae3f --- /dev/null +++ b/.github/workflows/openvr-inventory.yml @@ -0,0 +1,27 @@ +# Once a week: the OpenVR interface versions in every tag of Valve's SDK (github.com/ValveSoftware/openvr) against +# tests/conformance/interfaces.txt. Fails on anything new (a version not listed, or a newer tag still shipping one); the +# log says what, and how to update the list (scripts/openvr_inventory.py --write). +name: OpenVR inventory + +on: + schedule: + - cron: '17 4 * * 1' + workflow_dispatch: + +permissions: + contents: read + +jobs: + inventory: + name: Valve's SDK tags + runs-on: ubuntu-24.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@v7 + + # Blobless: the headers each tag needs are fetched as they're read + - name: Valve's SDK + run: git clone -q --filter=blob:none --no-checkout https://github.com/ValveSoftware/openvr.git "$RUNNER_TEMP/openvr" + + - name: Compare + run: python3 scripts/openvr_inventory.py --valve-repo "$RUNNER_TEMP/openvr" --compare tests/conformance/interfaces.txt diff --git a/BundledLibs/stb_image.h b/BundledLibs/stb_image.h new file mode 100644 index 00000000..9eedabed --- /dev/null +++ b/BundledLibs/stb_image.h @@ -0,0 +1,7988 @@ +/* stb_image - v2.30 - public domain image loader - http://nothings.org/stb + no warranty implied; use at your own risk + + Do this: + #define STB_IMAGE_IMPLEMENTATION + before you include this file in *one* C or C++ file to create the implementation. + + // i.e. it should look like this: + #include ... + #include ... + #include ... + #define STB_IMAGE_IMPLEMENTATION + #include "stb_image.h" + + You can #define STBI_ASSERT(x) before the #include to avoid using assert.h. + And #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free + + + QUICK NOTES: + Primarily of interest to game developers and other people who can + avoid problematic images and only need the trivial interface + + JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib) + PNG 1/2/4/8/16-bit-per-channel + + TGA (not sure what subset, if a subset) + BMP non-1bpp, non-RLE + PSD (composited view only, no extra channels, 8/16 bit-per-channel) + + GIF (*comp always reports as 4-channel) + HDR (radiance rgbE format) + PIC (Softimage PIC) + PNM (PPM and PGM binary only) + + Animated GIF still needs a proper API, but here's one way to do it: + http://gist.github.com/urraka/685d9a6340b26b830d49 + + - decode from memory or through FILE (define STBI_NO_STDIO to remove code) + - decode from arbitrary I/O callbacks + - SIMD acceleration on x86/x64 (SSE2) and ARM (NEON) + + Full documentation under "DOCUMENTATION" below. + + +LICENSE + + See end of file for license information. + +RECENT REVISION HISTORY: + + 2.30 (2024-05-31) avoid erroneous gcc warning + 2.29 (2023-05-xx) optimizations + 2.28 (2023-01-29) many error fixes, security errors, just tons of stuff + 2.27 (2021-07-11) document stbi_info better, 16-bit PNM support, bug fixes + 2.26 (2020-07-13) many minor fixes + 2.25 (2020-02-02) fix warnings + 2.24 (2020-02-02) fix warnings; thread-local failure_reason and flip_vertically + 2.23 (2019-08-11) fix clang static analysis warning + 2.22 (2019-03-04) gif fixes, fix warnings + 2.21 (2019-02-25) fix typo in comment + 2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs + 2.19 (2018-02-11) fix warning + 2.18 (2018-01-30) fix warnings + 2.17 (2018-01-29) bugfix, 1-bit BMP, 16-bitness query, fix warnings + 2.16 (2017-07-23) all functions have 16-bit variants; optimizations; bugfixes + 2.15 (2017-03-18) fix png-1,2,4; all Imagenet JPGs; no runtime SSE detection on GCC + 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs + 2.13 (2016-12-04) experimental 16-bit API, only for PNG so far; fixes + 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes + 2.11 (2016-04-02) 16-bit PNGS; enable SSE2 in non-gcc x64 + RGB-format JPEG; remove white matting in PSD; + allocate large structures on the stack; + correct channel count for PNG & BMP + 2.10 (2016-01-22) avoid warning introduced in 2.09 + 2.09 (2016-01-16) 16-bit TGA; comments in PNM files; STBI_REALLOC_SIZED + + See end of file for full revision history. + + + ============================ Contributors ========================= + + Image formats Extensions, features + Sean Barrett (jpeg, png, bmp) Jetro Lauha (stbi_info) + Nicolas Schulz (hdr, psd) Martin "SpartanJ" Golini (stbi_info) + Jonathan Dummer (tga) James "moose2000" Brown (iPhone PNG) + Jean-Marc Lienher (gif) Ben "Disch" Wenger (io callbacks) + Tom Seddon (pic) Omar Cornut (1/2/4-bit PNG) + Thatcher Ulrich (psd) Nicolas Guillemot (vertical flip) + Ken Miller (pgm, ppm) Richard Mitton (16-bit PSD) + github:urraka (animated gif) Junggon Kim (PNM comments) + Christopher Forseth (animated gif) Daniel Gibson (16-bit TGA) + socks-the-fox (16-bit PNG) + Jeremy Sawicki (handle all ImageNet JPGs) + Optimizations & bugfixes Mikhail Morozov (1-bit BMP) + Fabian "ryg" Giesen Anael Seghezzi (is-16-bit query) + Arseny Kapoulkine Simon Breuss (16-bit PNM) + John-Mark Allen + Carmelo J Fdez-Aguera + + Bug & warning fixes + Marc LeBlanc David Woo Guillaume George Martins Mozeiko + Christpher Lloyd Jerry Jansson Joseph Thomson Blazej Dariusz Roszkowski + Phil Jordan Dave Moore Roy Eltham + Hayaki Saito Nathan Reed Won Chun + Luke Graham Johan Duparc Nick Verigakis the Horde3D community + Thomas Ruf Ronny Chevalier github:rlyeh + Janez Zemva John Bartholomew Michal Cichon github:romigrou + Jonathan Blow Ken Hamada Tero Hanninen github:svdijk + Eugene Golushkov Laurent Gomila Cort Stratton github:snagar + Aruelien Pocheville Sergio Gonzalez Thibault Reuille github:Zelex + Cass Everitt Ryamond Barbiero github:grim210 + Paul Du Bois Engin Manap Aldo Culquicondor github:sammyhw + Philipp Wiesemann Dale Weiler Oriol Ferrer Mesia github:phprus + Josh Tobin Neil Bickford Matthew Gregan github:poppolopoppo + Julian Raschke Gregory Mullen Christian Floisand github:darealshinji + Baldur Karlsson Kevin Schmidt JR Smith github:Michaelangel007 + Brad Weinberger Matvey Cherevko github:mosra + Luca Sas Alexander Veselov Zack Middleton [reserved] + Ryan C. Gordon [reserved] [reserved] + DO NOT ADD YOUR NAME HERE + + Jacko Dirks + + To add your name to the credits, pick a random blank space in the middle and fill it. + 80% of merge conflicts on stb PRs are due to people adding their name at the end + of the credits. +*/ + +#ifndef STBI_INCLUDE_STB_IMAGE_H +#define STBI_INCLUDE_STB_IMAGE_H + +// DOCUMENTATION +// +// Limitations: +// - no 12-bit-per-channel JPEG +// - no JPEGs with arithmetic coding +// - GIF always returns *comp=4 +// +// Basic usage (see HDR discussion below for HDR usage): +// int x,y,n; +// unsigned char *data = stbi_load(filename, &x, &y, &n, 0); +// // ... process data if not NULL ... +// // ... x = width, y = height, n = # 8-bit components per pixel ... +// // ... replace '0' with '1'..'4' to force that many components per pixel +// // ... but 'n' will always be the number that it would have been if you said 0 +// stbi_image_free(data); +// +// Standard parameters: +// int *x -- outputs image width in pixels +// int *y -- outputs image height in pixels +// int *channels_in_file -- outputs # of image components in image file +// int desired_channels -- if non-zero, # of image components requested in result +// +// The return value from an image loader is an 'unsigned char *' which points +// to the pixel data, or NULL on an allocation failure or if the image is +// corrupt or invalid. The pixel data consists of *y scanlines of *x pixels, +// with each pixel consisting of N interleaved 8-bit components; the first +// pixel pointed to is top-left-most in the image. There is no padding between +// image scanlines or between pixels, regardless of format. The number of +// components N is 'desired_channels' if desired_channels is non-zero, or +// *channels_in_file otherwise. If desired_channels is non-zero, +// *channels_in_file has the number of components that _would_ have been +// output otherwise. E.g. if you set desired_channels to 4, you will always +// get RGBA output, but you can check *channels_in_file to see if it's trivially +// opaque because e.g. there were only 3 channels in the source image. +// +// An output image with N components has the following components interleaved +// in this order in each pixel: +// +// N=#comp components +// 1 grey +// 2 grey, alpha +// 3 red, green, blue +// 4 red, green, blue, alpha +// +// If image loading fails for any reason, the return value will be NULL, +// and *x, *y, *channels_in_file will be unchanged. The function +// stbi_failure_reason() can be queried for an extremely brief, end-user +// unfriendly explanation of why the load failed. Define STBI_NO_FAILURE_STRINGS +// to avoid compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly +// more user-friendly ones. +// +// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized. +// +// To query the width, height and component count of an image without having to +// decode the full file, you can use the stbi_info family of functions: +// +// int x,y,n,ok; +// ok = stbi_info(filename, &x, &y, &n); +// // returns ok=1 and sets x, y, n if image is a supported format, +// // 0 otherwise. +// +// Note that stb_image pervasively uses ints in its public API for sizes, +// including sizes of memory buffers. This is now part of the API and thus +// hard to change without causing breakage. As a result, the various image +// loaders all have certain limits on image size; these differ somewhat +// by format but generally boil down to either just under 2GB or just under +// 1GB. When the decoded image would be larger than this, stb_image decoding +// will fail. +// +// Additionally, stb_image will reject image files that have any of their +// dimensions set to a larger value than the configurable STBI_MAX_DIMENSIONS, +// which defaults to 2**24 = 16777216 pixels. Due to the above memory limit, +// the only way to have an image with such dimensions load correctly +// is for it to have a rather extreme aspect ratio. Either way, the +// assumption here is that such larger images are likely to be malformed +// or malicious. If you do need to load an image with individual dimensions +// larger than that, and it still fits in the overall size limit, you can +// #define STBI_MAX_DIMENSIONS on your own to be something larger. +// +// =========================================================================== +// +// UNICODE: +// +// If compiling for Windows and you wish to use Unicode filenames, compile +// with +// #define STBI_WINDOWS_UTF8 +// and pass utf8-encoded filenames. Call stbi_convert_wchar_to_utf8 to convert +// Windows wchar_t filenames to utf8. +// +// =========================================================================== +// +// Philosophy +// +// stb libraries are designed with the following priorities: +// +// 1. easy to use +// 2. easy to maintain +// 3. good performance +// +// Sometimes I let "good performance" creep up in priority over "easy to maintain", +// and for best performance I may provide less-easy-to-use APIs that give higher +// performance, in addition to the easy-to-use ones. Nevertheless, it's important +// to keep in mind that from the standpoint of you, a client of this library, +// all you care about is #1 and #3, and stb libraries DO NOT emphasize #3 above all. +// +// Some secondary priorities arise directly from the first two, some of which +// provide more explicit reasons why performance can't be emphasized. +// +// - Portable ("ease of use") +// - Small source code footprint ("easy to maintain") +// - No dependencies ("ease of use") +// +// =========================================================================== +// +// I/O callbacks +// +// I/O callbacks allow you to read from arbitrary sources, like packaged +// files or some other source. Data read from callbacks are processed +// through a small internal buffer (currently 128 bytes) to try to reduce +// overhead. +// +// The three functions you must define are "read" (reads some bytes of data), +// "skip" (skips some bytes of data), "eof" (reports if the stream is at the end). +// +// =========================================================================== +// +// SIMD support +// +// The JPEG decoder will try to automatically use SIMD kernels on x86 when +// supported by the compiler. For ARM Neon support, you must explicitly +// request it. +// +// (The old do-it-yourself SIMD API is no longer supported in the current +// code.) +// +// On x86, SSE2 will automatically be used when available based on a run-time +// test; if not, the generic C versions are used as a fall-back. On ARM targets, +// the typical path is to have separate builds for NEON and non-NEON devices +// (at least this is true for iOS and Android). Therefore, the NEON support is +// toggled by a build flag: define STBI_NEON to get NEON loops. +// +// If for some reason you do not want to use any of SIMD code, or if +// you have issues compiling it, you can disable it entirely by +// defining STBI_NO_SIMD. +// +// =========================================================================== +// +// HDR image support (disable by defining STBI_NO_HDR) +// +// stb_image supports loading HDR images in general, and currently the Radiance +// .HDR file format specifically. You can still load any file through the existing +// interface; if you attempt to load an HDR file, it will be automatically remapped +// to LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1; +// both of these constants can be reconfigured through this interface: +// +// stbi_hdr_to_ldr_gamma(2.2f); +// stbi_hdr_to_ldr_scale(1.0f); +// +// (note, do not use _inverse_ constants; stbi_image will invert them +// appropriately). +// +// Additionally, there is a new, parallel interface for loading files as +// (linear) floats to preserve the full dynamic range: +// +// float *data = stbi_loadf(filename, &x, &y, &n, 0); +// +// If you load LDR images through this interface, those images will +// be promoted to floating point values, run through the inverse of +// constants corresponding to the above: +// +// stbi_ldr_to_hdr_scale(1.0f); +// stbi_ldr_to_hdr_gamma(2.2f); +// +// Finally, given a filename (or an open file or memory block--see header +// file for details) containing image data, you can query for the "most +// appropriate" interface to use (that is, whether the image is HDR or +// not), using: +// +// stbi_is_hdr(char *filename); +// +// =========================================================================== +// +// iPhone PNG support: +// +// We optionally support converting iPhone-formatted PNGs (which store +// premultiplied BGRA) back to RGB, even though they're internally encoded +// differently. To enable this conversion, call +// stbi_convert_iphone_png_to_rgb(1). +// +// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per +// pixel to remove any premultiplied alpha *only* if the image file explicitly +// says there's premultiplied data (currently only happens in iPhone images, +// and only if iPhone convert-to-rgb processing is on). +// +// =========================================================================== +// +// ADDITIONAL CONFIGURATION +// +// - You can suppress implementation of any of the decoders to reduce +// your code footprint by #defining one or more of the following +// symbols before creating the implementation. +// +// STBI_NO_JPEG +// STBI_NO_PNG +// STBI_NO_BMP +// STBI_NO_PSD +// STBI_NO_TGA +// STBI_NO_GIF +// STBI_NO_HDR +// STBI_NO_PIC +// STBI_NO_PNM (.ppm and .pgm) +// +// - You can request *only* certain decoders and suppress all other ones +// (this will be more forward-compatible, as addition of new decoders +// doesn't require you to disable them explicitly): +// +// STBI_ONLY_JPEG +// STBI_ONLY_PNG +// STBI_ONLY_BMP +// STBI_ONLY_PSD +// STBI_ONLY_TGA +// STBI_ONLY_GIF +// STBI_ONLY_HDR +// STBI_ONLY_PIC +// STBI_ONLY_PNM (.ppm and .pgm) +// +// - If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still +// want the zlib decoder to be available, #define STBI_SUPPORT_ZLIB +// +// - If you define STBI_MAX_DIMENSIONS, stb_image will reject images greater +// than that size (in either width or height) without further processing. +// This is to let programs in the wild set an upper bound to prevent +// denial-of-service attacks on untrusted data, as one could generate a +// valid image of gigantic dimensions and force stb_image to allocate a +// huge block of memory and spend disproportionate time decoding it. By +// default this is set to (1 << 24), which is 16777216, but that's still +// very big. + +#ifndef STBI_NO_STDIO +#include +#endif // STBI_NO_STDIO + +#define STBI_VERSION 1 + +enum +{ + STBI_default = 0, // only used for desired_channels + + STBI_grey = 1, + STBI_grey_alpha = 2, + STBI_rgb = 3, + STBI_rgb_alpha = 4 +}; + +#include +typedef unsigned char stbi_uc; +typedef unsigned short stbi_us; + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef STBIDEF +#ifdef STB_IMAGE_STATIC +#define STBIDEF static +#else +#define STBIDEF extern +#endif +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// PRIMARY API - works on images of any type +// + +// +// load image by filename, open file, or memory buffer +// + +typedef struct +{ + int (*read) (void *user,char *data,int size); // fill 'data' with 'size' bytes. return number of bytes actually read + void (*skip) (void *user,int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative + int (*eof) (void *user); // returns nonzero if we are at end of file/data +} stbi_io_callbacks; + +//////////////////////////////////// +// +// 8-bits-per-channel interface +// + +STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels); +STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *channels_in_file, int desired_channels); + +#ifndef STBI_NO_STDIO +STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); +STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); +// for stbi_load_from_file, file pointer is left pointing immediately after image +#endif + +#ifndef STBI_NO_GIF +STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp); +#endif + +#ifdef STBI_WINDOWS_UTF8 +STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input); +#endif + +//////////////////////////////////// +// +// 16-bits-per-channel interface +// + +STBIDEF stbi_us *stbi_load_16_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels); +STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels); + +#ifndef STBI_NO_STDIO +STBIDEF stbi_us *stbi_load_16 (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); +STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); +#endif + +//////////////////////////////////// +// +// float-per-channel interface +// +#ifndef STBI_NO_LINEAR + STBIDEF float *stbi_loadf_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels); + STBIDEF float *stbi_loadf_from_callbacks (stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels); + + #ifndef STBI_NO_STDIO + STBIDEF float *stbi_loadf (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); + STBIDEF float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); + #endif +#endif + +#ifndef STBI_NO_HDR + STBIDEF void stbi_hdr_to_ldr_gamma(float gamma); + STBIDEF void stbi_hdr_to_ldr_scale(float scale); +#endif // STBI_NO_HDR + +#ifndef STBI_NO_LINEAR + STBIDEF void stbi_ldr_to_hdr_gamma(float gamma); + STBIDEF void stbi_ldr_to_hdr_scale(float scale); +#endif // STBI_NO_LINEAR + +// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR +STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user); +STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len); +#ifndef STBI_NO_STDIO +STBIDEF int stbi_is_hdr (char const *filename); +STBIDEF int stbi_is_hdr_from_file(FILE *f); +#endif // STBI_NO_STDIO + + +// get a VERY brief reason for failure +// on most compilers (and ALL modern mainstream compilers) this is threadsafe +STBIDEF const char *stbi_failure_reason (void); + +// free the loaded image -- this is just free() +STBIDEF void stbi_image_free (void *retval_from_stbi_load); + +// get image dimensions & components without fully decoding +STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); +STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp); +STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len); +STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *clbk, void *user); + +#ifndef STBI_NO_STDIO +STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp); +STBIDEF int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); +STBIDEF int stbi_is_16_bit (char const *filename); +STBIDEF int stbi_is_16_bit_from_file(FILE *f); +#endif + + + +// for image formats that explicitly notate that they have premultiplied alpha, +// we just return the colors as stored in the file. set this flag to force +// unpremultiplication. results are undefined if the unpremultiply overflow. +STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply); + +// indicate whether we should process iphone images back to canonical format, +// or just pass them through "as-is" +STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert); + +// flip the image vertically, so the first pixel in the output array is the bottom left +STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip); + +// as above, but only applies to images loaded on the thread that calls the function +// this function is only available if your compiler supports thread-local variables; +// calling it will fail to link if your compiler doesn't +STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply); +STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert); +STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip); + +// ZLIB client - used by PNG, available for other purposes + +STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen); +STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header); +STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen); +STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); + +STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen); +STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); + + +#ifdef __cplusplus +} +#endif + +// +// +//// end header file ///////////////////////////////////////////////////// +#endif // STBI_INCLUDE_STB_IMAGE_H + +#ifdef STB_IMAGE_IMPLEMENTATION + +#if defined(STBI_ONLY_JPEG) || defined(STBI_ONLY_PNG) || defined(STBI_ONLY_BMP) \ + || defined(STBI_ONLY_TGA) || defined(STBI_ONLY_GIF) || defined(STBI_ONLY_PSD) \ + || defined(STBI_ONLY_HDR) || defined(STBI_ONLY_PIC) || defined(STBI_ONLY_PNM) \ + || defined(STBI_ONLY_ZLIB) + #ifndef STBI_ONLY_JPEG + #define STBI_NO_JPEG + #endif + #ifndef STBI_ONLY_PNG + #define STBI_NO_PNG + #endif + #ifndef STBI_ONLY_BMP + #define STBI_NO_BMP + #endif + #ifndef STBI_ONLY_PSD + #define STBI_NO_PSD + #endif + #ifndef STBI_ONLY_TGA + #define STBI_NO_TGA + #endif + #ifndef STBI_ONLY_GIF + #define STBI_NO_GIF + #endif + #ifndef STBI_ONLY_HDR + #define STBI_NO_HDR + #endif + #ifndef STBI_ONLY_PIC + #define STBI_NO_PIC + #endif + #ifndef STBI_ONLY_PNM + #define STBI_NO_PNM + #endif +#endif + +#if defined(STBI_NO_PNG) && !defined(STBI_SUPPORT_ZLIB) && !defined(STBI_NO_ZLIB) +#define STBI_NO_ZLIB +#endif + + +#include +#include // ptrdiff_t on osx +#include +#include +#include + +#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) +#include // ldexp, pow +#endif + +#ifndef STBI_NO_STDIO +#include +#endif + +#ifndef STBI_ASSERT +#include +#define STBI_ASSERT(x) assert(x) +#endif + +#ifdef __cplusplus +#define STBI_EXTERN extern "C" +#else +#define STBI_EXTERN extern +#endif + + +#ifndef _MSC_VER + #ifdef __cplusplus + #define stbi_inline inline + #else + #define stbi_inline + #endif +#else + #define stbi_inline __forceinline +#endif + +#ifndef STBI_NO_THREAD_LOCALS + #if defined(__cplusplus) && __cplusplus >= 201103L + #define STBI_THREAD_LOCAL thread_local + #elif defined(__GNUC__) && __GNUC__ < 5 + #define STBI_THREAD_LOCAL __thread + #elif defined(_MSC_VER) + #define STBI_THREAD_LOCAL __declspec(thread) + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__) + #define STBI_THREAD_LOCAL _Thread_local + #endif + + #ifndef STBI_THREAD_LOCAL + #if defined(__GNUC__) + #define STBI_THREAD_LOCAL __thread + #endif + #endif +#endif + +#if defined(_MSC_VER) || defined(__SYMBIAN32__) +typedef unsigned short stbi__uint16; +typedef signed short stbi__int16; +typedef unsigned int stbi__uint32; +typedef signed int stbi__int32; +#else +#include +typedef uint16_t stbi__uint16; +typedef int16_t stbi__int16; +typedef uint32_t stbi__uint32; +typedef int32_t stbi__int32; +#endif + +// should produce compiler error if size is wrong +typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1]; + +#ifdef _MSC_VER +#define STBI_NOTUSED(v) (void)(v) +#else +#define STBI_NOTUSED(v) (void)sizeof(v) +#endif + +#ifdef _MSC_VER +#define STBI_HAS_LROTL +#endif + +#ifdef STBI_HAS_LROTL + #define stbi_lrot(x,y) _lrotl(x,y) +#else + #define stbi_lrot(x,y) (((x) << (y)) | ((x) >> (-(y) & 31))) +#endif + +#if defined(STBI_MALLOC) && defined(STBI_FREE) && (defined(STBI_REALLOC) || defined(STBI_REALLOC_SIZED)) +// ok +#elif !defined(STBI_MALLOC) && !defined(STBI_FREE) && !defined(STBI_REALLOC) && !defined(STBI_REALLOC_SIZED) +// ok +#else +#error "Must define all or none of STBI_MALLOC, STBI_FREE, and STBI_REALLOC (or STBI_REALLOC_SIZED)." +#endif + +#ifndef STBI_MALLOC +#define STBI_MALLOC(sz) malloc(sz) +#define STBI_REALLOC(p,newsz) realloc(p,newsz) +#define STBI_FREE(p) free(p) +#endif + +#ifndef STBI_REALLOC_SIZED +#define STBI_REALLOC_SIZED(p,oldsz,newsz) STBI_REALLOC(p,newsz) +#endif + +// x86/x64 detection +#if defined(__x86_64__) || defined(_M_X64) +#define STBI__X64_TARGET +#elif defined(__i386) || defined(_M_IX86) +#define STBI__X86_TARGET +#endif + +#if defined(__GNUC__) && defined(STBI__X86_TARGET) && !defined(__SSE2__) && !defined(STBI_NO_SIMD) +// gcc doesn't support sse2 intrinsics unless you compile with -msse2, +// which in turn means it gets to use SSE2 everywhere. This is unfortunate, +// but previous attempts to provide the SSE2 functions with runtime +// detection caused numerous issues. The way architecture extensions are +// exposed in GCC/Clang is, sadly, not really suited for one-file libs. +// New behavior: if compiled with -msse2, we use SSE2 without any +// detection; if not, we don't use it at all. +#define STBI_NO_SIMD +#endif + +#if defined(__MINGW32__) && defined(STBI__X86_TARGET) && !defined(STBI_MINGW_ENABLE_SSE2) && !defined(STBI_NO_SIMD) +// Note that __MINGW32__ doesn't actually mean 32-bit, so we have to avoid STBI__X64_TARGET +// +// 32-bit MinGW wants ESP to be 16-byte aligned, but this is not in the +// Windows ABI and VC++ as well as Windows DLLs don't maintain that invariant. +// As a result, enabling SSE2 on 32-bit MinGW is dangerous when not +// simultaneously enabling "-mstackrealign". +// +// See https://github.com/nothings/stb/issues/81 for more information. +// +// So default to no SSE2 on 32-bit MinGW. If you've read this far and added +// -mstackrealign to your build settings, feel free to #define STBI_MINGW_ENABLE_SSE2. +#define STBI_NO_SIMD +#endif + +#if !defined(STBI_NO_SIMD) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET)) +#define STBI_SSE2 +#include + +#ifdef _MSC_VER + +#if _MSC_VER >= 1400 // not VC6 +#include // __cpuid +static int stbi__cpuid3(void) +{ + int info[4]; + __cpuid(info,1); + return info[3]; +} +#else +static int stbi__cpuid3(void) +{ + int res; + __asm { + mov eax,1 + cpuid + mov res,edx + } + return res; +} +#endif + +#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name + +#if !defined(STBI_NO_JPEG) && defined(STBI_SSE2) +static int stbi__sse2_available(void) +{ + int info3 = stbi__cpuid3(); + return ((info3 >> 26) & 1) != 0; +} +#endif + +#else // assume GCC-style if not VC++ +#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16))) + +#if !defined(STBI_NO_JPEG) && defined(STBI_SSE2) +static int stbi__sse2_available(void) +{ + // If we're even attempting to compile this on GCC/Clang, that means + // -msse2 is on, which means the compiler is allowed to use SSE2 + // instructions at will, and so are we. + return 1; +} +#endif + +#endif +#endif + +// ARM NEON +#if defined(STBI_NO_SIMD) && defined(STBI_NEON) +#undef STBI_NEON +#endif + +#ifdef STBI_NEON +#include +#ifdef _MSC_VER +#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name +#else +#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16))) +#endif +#endif + +#ifndef STBI_SIMD_ALIGN +#define STBI_SIMD_ALIGN(type, name) type name +#endif + +#ifndef STBI_MAX_DIMENSIONS +#define STBI_MAX_DIMENSIONS (1 << 24) +#endif + +/////////////////////////////////////////////// +// +// stbi__context struct and start_xxx functions + +// stbi__context structure is our basic context used by all images, so it +// contains all the IO context, plus some basic image information +typedef struct +{ + stbi__uint32 img_x, img_y; + int img_n, img_out_n; + + stbi_io_callbacks io; + void *io_user_data; + + int read_from_callbacks; + int buflen; + stbi_uc buffer_start[128]; + int callback_already_read; + + stbi_uc *img_buffer, *img_buffer_end; + stbi_uc *img_buffer_original, *img_buffer_original_end; +} stbi__context; + + +static void stbi__refill_buffer(stbi__context *s); + +// initialize a memory-decode context +static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len) +{ + s->io.read = NULL; + s->read_from_callbacks = 0; + s->callback_already_read = 0; + s->img_buffer = s->img_buffer_original = (stbi_uc *) buffer; + s->img_buffer_end = s->img_buffer_original_end = (stbi_uc *) buffer+len; +} + +// initialize a callback-based context +static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user) +{ + s->io = *c; + s->io_user_data = user; + s->buflen = sizeof(s->buffer_start); + s->read_from_callbacks = 1; + s->callback_already_read = 0; + s->img_buffer = s->img_buffer_original = s->buffer_start; + stbi__refill_buffer(s); + s->img_buffer_original_end = s->img_buffer_end; +} + +#ifndef STBI_NO_STDIO + +static int stbi__stdio_read(void *user, char *data, int size) +{ + return (int) fread(data,1,size,(FILE*) user); +} + +static void stbi__stdio_skip(void *user, int n) +{ + int ch; + fseek((FILE*) user, n, SEEK_CUR); + ch = fgetc((FILE*) user); /* have to read a byte to reset feof()'s flag */ + if (ch != EOF) { + ungetc(ch, (FILE *) user); /* push byte back onto stream if valid. */ + } +} + +static int stbi__stdio_eof(void *user) +{ + return feof((FILE*) user) || ferror((FILE *) user); +} + +static stbi_io_callbacks stbi__stdio_callbacks = +{ + stbi__stdio_read, + stbi__stdio_skip, + stbi__stdio_eof, +}; + +static void stbi__start_file(stbi__context *s, FILE *f) +{ + stbi__start_callbacks(s, &stbi__stdio_callbacks, (void *) f); +} + +//static void stop_file(stbi__context *s) { } + +#endif // !STBI_NO_STDIO + +static void stbi__rewind(stbi__context *s) +{ + // conceptually rewind SHOULD rewind to the beginning of the stream, + // but we just rewind to the beginning of the initial buffer, because + // we only use it after doing 'test', which only ever looks at at most 92 bytes + s->img_buffer = s->img_buffer_original; + s->img_buffer_end = s->img_buffer_original_end; +} + +enum +{ + STBI_ORDER_RGB, + STBI_ORDER_BGR +}; + +typedef struct +{ + int bits_per_channel; + int num_channels; + int channel_order; +} stbi__result_info; + +#ifndef STBI_NO_JPEG +static int stbi__jpeg_test(stbi__context *s); +static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_PNG +static int stbi__png_test(stbi__context *s); +static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp); +static int stbi__png_is16(stbi__context *s); +#endif + +#ifndef STBI_NO_BMP +static int stbi__bmp_test(stbi__context *s); +static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_TGA +static int stbi__tga_test(stbi__context *s); +static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_PSD +static int stbi__psd_test(stbi__context *s); +static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc); +static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp); +static int stbi__psd_is16(stbi__context *s); +#endif + +#ifndef STBI_NO_HDR +static int stbi__hdr_test(stbi__context *s); +static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_PIC +static int stbi__pic_test(stbi__context *s); +static void *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_GIF +static int stbi__gif_test(stbi__context *s); +static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, int *z, int *comp, int req_comp); +static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp); +#endif + +#ifndef STBI_NO_PNM +static int stbi__pnm_test(stbi__context *s); +static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); +static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp); +static int stbi__pnm_is16(stbi__context *s); +#endif + +static +#ifdef STBI_THREAD_LOCAL +STBI_THREAD_LOCAL +#endif +const char *stbi__g_failure_reason; + +STBIDEF const char *stbi_failure_reason(void) +{ + return stbi__g_failure_reason; +} + +#ifndef STBI_NO_FAILURE_STRINGS +static int stbi__err(const char *str) +{ + stbi__g_failure_reason = str; + return 0; +} +#endif + +static void *stbi__malloc(size_t size) +{ + return STBI_MALLOC(size); +} + +// stb_image uses ints pervasively, including for offset calculations. +// therefore the largest decoded image size we can support with the +// current code, even on 64-bit targets, is INT_MAX. this is not a +// significant limitation for the intended use case. +// +// we do, however, need to make sure our size calculations don't +// overflow. hence a few helper functions for size calculations that +// multiply integers together, making sure that they're non-negative +// and no overflow occurs. + +// return 1 if the sum is valid, 0 on overflow. +// negative terms are considered invalid. +static int stbi__addsizes_valid(int a, int b) +{ + if (b < 0) return 0; + // now 0 <= b <= INT_MAX, hence also + // 0 <= INT_MAX - b <= INTMAX. + // And "a + b <= INT_MAX" (which might overflow) is the + // same as a <= INT_MAX - b (no overflow) + return a <= INT_MAX - b; +} + +// returns 1 if the product is valid, 0 on overflow. +// negative factors are considered invalid. +static int stbi__mul2sizes_valid(int a, int b) +{ + if (a < 0 || b < 0) return 0; + if (b == 0) return 1; // mul-by-0 is always safe + // portable way to check for no overflows in a*b + return a <= INT_MAX/b; +} + +#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR) +// returns 1 if "a*b + add" has no negative terms/factors and doesn't overflow +static int stbi__mad2sizes_valid(int a, int b, int add) +{ + return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add); +} +#endif + +// returns 1 if "a*b*c + add" has no negative terms/factors and doesn't overflow +static int stbi__mad3sizes_valid(int a, int b, int c, int add) +{ + return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && + stbi__addsizes_valid(a*b*c, add); +} + +// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow +#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) || !defined(STBI_NO_PNM) +static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add) +{ + return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && + stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add); +} +#endif + +#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR) +// mallocs with size overflow checking +static void *stbi__malloc_mad2(int a, int b, int add) +{ + if (!stbi__mad2sizes_valid(a, b, add)) return NULL; + return stbi__malloc(a*b + add); +} +#endif + +static void *stbi__malloc_mad3(int a, int b, int c, int add) +{ + if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL; + return stbi__malloc(a*b*c + add); +} + +#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) || !defined(STBI_NO_PNM) +static void *stbi__malloc_mad4(int a, int b, int c, int d, int add) +{ + if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL; + return stbi__malloc(a*b*c*d + add); +} +#endif + +// returns 1 if the sum of two signed ints is valid (between -2^31 and 2^31-1 inclusive), 0 on overflow. +static int stbi__addints_valid(int a, int b) +{ + if ((a >= 0) != (b >= 0)) return 1; // a and b have different signs, so no overflow + if (a < 0 && b < 0) return a >= INT_MIN - b; // same as a + b >= INT_MIN; INT_MIN - b cannot overflow since b < 0. + return a <= INT_MAX - b; +} + +// returns 1 if the product of two ints fits in a signed short, 0 on overflow. +static int stbi__mul2shorts_valid(int a, int b) +{ + if (b == 0 || b == -1) return 1; // multiplication by 0 is always 0; check for -1 so SHRT_MIN/b doesn't overflow + if ((a >= 0) == (b >= 0)) return a <= SHRT_MAX/b; // product is positive, so similar to mul2sizes_valid + if (b < 0) return a <= SHRT_MIN / b; // same as a * b >= SHRT_MIN + return a >= SHRT_MIN / b; +} + +// stbi__err - error +// stbi__errpf - error returning pointer to float +// stbi__errpuc - error returning pointer to unsigned char + +#ifdef STBI_NO_FAILURE_STRINGS + #define stbi__err(x,y) 0 +#elif defined(STBI_FAILURE_USERMSG) + #define stbi__err(x,y) stbi__err(y) +#else + #define stbi__err(x,y) stbi__err(x) +#endif + +#define stbi__errpf(x,y) ((float *)(size_t) (stbi__err(x,y)?NULL:NULL)) +#define stbi__errpuc(x,y) ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL)) + +STBIDEF void stbi_image_free(void *retval_from_stbi_load) +{ + STBI_FREE(retval_from_stbi_load); +} + +#ifndef STBI_NO_LINEAR +static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp); +#endif + +#ifndef STBI_NO_HDR +static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp); +#endif + +static int stbi__vertically_flip_on_load_global = 0; + +STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip) +{ + stbi__vertically_flip_on_load_global = flag_true_if_should_flip; +} + +#ifndef STBI_THREAD_LOCAL +#define stbi__vertically_flip_on_load stbi__vertically_flip_on_load_global +#else +static STBI_THREAD_LOCAL int stbi__vertically_flip_on_load_local, stbi__vertically_flip_on_load_set; + +STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip) +{ + stbi__vertically_flip_on_load_local = flag_true_if_should_flip; + stbi__vertically_flip_on_load_set = 1; +} + +#define stbi__vertically_flip_on_load (stbi__vertically_flip_on_load_set \ + ? stbi__vertically_flip_on_load_local \ + : stbi__vertically_flip_on_load_global) +#endif // STBI_THREAD_LOCAL + +static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) +{ + memset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields + ri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed + ri->channel_order = STBI_ORDER_RGB; // all current input & output are this, but this is here so we can add BGR order + ri->num_channels = 0; + + // test the formats with a very explicit header first (at least a FOURCC + // or distinctive magic number first) + #ifndef STBI_NO_PNG + if (stbi__png_test(s)) return stbi__png_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_BMP + if (stbi__bmp_test(s)) return stbi__bmp_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_GIF + if (stbi__gif_test(s)) return stbi__gif_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_PSD + if (stbi__psd_test(s)) return stbi__psd_load(s,x,y,comp,req_comp, ri, bpc); + #else + STBI_NOTUSED(bpc); + #endif + #ifndef STBI_NO_PIC + if (stbi__pic_test(s)) return stbi__pic_load(s,x,y,comp,req_comp, ri); + #endif + + // then the formats that can end up attempting to load with just 1 or 2 + // bytes matching expectations; these are prone to false positives, so + // try them later + #ifndef STBI_NO_JPEG + if (stbi__jpeg_test(s)) return stbi__jpeg_load(s,x,y,comp,req_comp, ri); + #endif + #ifndef STBI_NO_PNM + if (stbi__pnm_test(s)) return stbi__pnm_load(s,x,y,comp,req_comp, ri); + #endif + + #ifndef STBI_NO_HDR + if (stbi__hdr_test(s)) { + float *hdr = stbi__hdr_load(s, x,y,comp,req_comp, ri); + return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); + } + #endif + + #ifndef STBI_NO_TGA + // test tga last because it's a crappy test! + if (stbi__tga_test(s)) + return stbi__tga_load(s,x,y,comp,req_comp, ri); + #endif + + return stbi__errpuc("unknown image type", "Image not of any known type, or corrupt"); +} + +static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, int channels) +{ + int i; + int img_len = w * h * channels; + stbi_uc *reduced; + + reduced = (stbi_uc *) stbi__malloc(img_len); + if (reduced == NULL) return stbi__errpuc("outofmem", "Out of memory"); + + for (i = 0; i < img_len; ++i) + reduced[i] = (stbi_uc)((orig[i] >> 8) & 0xFF); // top half of each byte is sufficient approx of 16->8 bit scaling + + STBI_FREE(orig); + return reduced; +} + +static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels) +{ + int i; + int img_len = w * h * channels; + stbi__uint16 *enlarged; + + enlarged = (stbi__uint16 *) stbi__malloc(img_len*2); + if (enlarged == NULL) return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory"); + + for (i = 0; i < img_len; ++i) + enlarged[i] = (stbi__uint16)((orig[i] << 8) + orig[i]); // replicate to high and low byte, maps 0->0, 255->0xffff + + STBI_FREE(orig); + return enlarged; +} + +static void stbi__vertical_flip(void *image, int w, int h, int bytes_per_pixel) +{ + int row; + size_t bytes_per_row = (size_t)w * bytes_per_pixel; + stbi_uc temp[2048]; + stbi_uc *bytes = (stbi_uc *)image; + + for (row = 0; row < (h>>1); row++) { + stbi_uc *row0 = bytes + row*bytes_per_row; + stbi_uc *row1 = bytes + (h - row - 1)*bytes_per_row; + // swap row0 with row1 + size_t bytes_left = bytes_per_row; + while (bytes_left) { + size_t bytes_copy = (bytes_left < sizeof(temp)) ? bytes_left : sizeof(temp); + memcpy(temp, row0, bytes_copy); + memcpy(row0, row1, bytes_copy); + memcpy(row1, temp, bytes_copy); + row0 += bytes_copy; + row1 += bytes_copy; + bytes_left -= bytes_copy; + } + } +} + +#ifndef STBI_NO_GIF +static void stbi__vertical_flip_slices(void *image, int w, int h, int z, int bytes_per_pixel) +{ + int slice; + int slice_size = w * h * bytes_per_pixel; + + stbi_uc *bytes = (stbi_uc *)image; + for (slice = 0; slice < z; ++slice) { + stbi__vertical_flip(bytes, w, h, bytes_per_pixel); + bytes += slice_size; + } +} +#endif + +static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp) +{ + stbi__result_info ri; + void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8); + + if (result == NULL) + return NULL; + + // it is the responsibility of the loaders to make sure we get either 8 or 16 bit. + STBI_ASSERT(ri.bits_per_channel == 8 || ri.bits_per_channel == 16); + + if (ri.bits_per_channel != 8) { + result = stbi__convert_16_to_8((stbi__uint16 *) result, *x, *y, req_comp == 0 ? *comp : req_comp); + ri.bits_per_channel = 8; + } + + // @TODO: move stbi__convert_format to here + + if (stbi__vertically_flip_on_load) { + int channels = req_comp ? req_comp : *comp; + stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi_uc)); + } + + return (unsigned char *) result; +} + +static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp) +{ + stbi__result_info ri; + void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 16); + + if (result == NULL) + return NULL; + + // it is the responsibility of the loaders to make sure we get either 8 or 16 bit. + STBI_ASSERT(ri.bits_per_channel == 8 || ri.bits_per_channel == 16); + + if (ri.bits_per_channel != 16) { + result = stbi__convert_8_to_16((stbi_uc *) result, *x, *y, req_comp == 0 ? *comp : req_comp); + ri.bits_per_channel = 16; + } + + // @TODO: move stbi__convert_format16 to here + // @TODO: special case RGB-to-Y (and RGBA-to-YA) for 8-bit-to-16-bit case to keep more precision + + if (stbi__vertically_flip_on_load) { + int channels = req_comp ? req_comp : *comp; + stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi__uint16)); + } + + return (stbi__uint16 *) result; +} + +#if !defined(STBI_NO_HDR) && !defined(STBI_NO_LINEAR) +static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp) +{ + if (stbi__vertically_flip_on_load && result != NULL) { + int channels = req_comp ? req_comp : *comp; + stbi__vertical_flip(result, *x, *y, channels * sizeof(float)); + } +} +#endif + +#ifndef STBI_NO_STDIO + +#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) +STBI_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); +STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); +#endif + +#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) +STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) +{ + return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); +} +#endif + +static FILE *stbi__fopen(char const *filename, char const *mode) +{ + FILE *f; +#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) + wchar_t wMode[64]; + wchar_t wFilename[1024]; + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename))) + return 0; + + if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode))) + return 0; + +#if defined(_MSC_VER) && _MSC_VER >= 1400 + if (0 != _wfopen_s(&f, wFilename, wMode)) + f = 0; +#else + f = _wfopen(wFilename, wMode); +#endif + +#elif defined(_MSC_VER) && _MSC_VER >= 1400 + if (0 != fopen_s(&f, filename, mode)) + f=0; +#else + f = fopen(filename, mode); +#endif + return f; +} + + +STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + FILE *f = stbi__fopen(filename, "rb"); + unsigned char *result; + if (!f) return stbi__errpuc("can't fopen", "Unable to open file"); + result = stbi_load_from_file(f,x,y,comp,req_comp); + fclose(f); + return result; +} + +STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *result; + stbi__context s; + stbi__start_file(&s,f); + result = stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); + if (result) { + // need to 'unget' all the characters in the IO buffer + fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR); + } + return result; +} + +STBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + stbi__uint16 *result; + stbi__context s; + stbi__start_file(&s,f); + result = stbi__load_and_postprocess_16bit(&s,x,y,comp,req_comp); + if (result) { + // need to 'unget' all the characters in the IO buffer + fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR); + } + return result; +} + +STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + FILE *f = stbi__fopen(filename, "rb"); + stbi__uint16 *result; + if (!f) return (stbi_us *) stbi__errpuc("can't fopen", "Unable to open file"); + result = stbi_load_from_file_16(f,x,y,comp,req_comp); + fclose(f); + return result; +} + + +#endif //!STBI_NO_STDIO + +STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels); +} + +STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user); + return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels); +} + +STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); +} + +STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); + return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); +} + +#ifndef STBI_NO_GIF +STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp) +{ + unsigned char *result; + stbi__context s; + stbi__start_mem(&s,buffer,len); + + result = (unsigned char*) stbi__load_gif_main(&s, delays, x, y, z, comp, req_comp); + if (stbi__vertically_flip_on_load) { + stbi__vertical_flip_slices( result, *x, *y, *z, *comp ); + } + + return result; +} +#endif + +#ifndef STBI_NO_LINEAR +static float *stbi__loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp) +{ + unsigned char *data; + #ifndef STBI_NO_HDR + if (stbi__hdr_test(s)) { + stbi__result_info ri; + float *hdr_data = stbi__hdr_load(s,x,y,comp,req_comp, &ri); + if (hdr_data) + stbi__float_postprocess(hdr_data,x,y,comp,req_comp); + return hdr_data; + } + #endif + data = stbi__load_and_postprocess_8bit(s, x, y, comp, req_comp); + if (data) + return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); + return stbi__errpf("unknown image type", "Image not of any known type, or corrupt"); +} + +STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__loadf_main(&s,x,y,comp,req_comp); +} + +STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); + return stbi__loadf_main(&s,x,y,comp,req_comp); +} + +#ifndef STBI_NO_STDIO +STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp) +{ + float *result; + FILE *f = stbi__fopen(filename, "rb"); + if (!f) return stbi__errpf("can't fopen", "Unable to open file"); + result = stbi_loadf_from_file(f,x,y,comp,req_comp); + fclose(f); + return result; +} + +STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) +{ + stbi__context s; + stbi__start_file(&s,f); + return stbi__loadf_main(&s,x,y,comp,req_comp); +} +#endif // !STBI_NO_STDIO + +#endif // !STBI_NO_LINEAR + +// these is-hdr-or-not is defined independent of whether STBI_NO_LINEAR is +// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always +// reports false! + +STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len) +{ + #ifndef STBI_NO_HDR + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__hdr_test(&s); + #else + STBI_NOTUSED(buffer); + STBI_NOTUSED(len); + return 0; + #endif +} + +#ifndef STBI_NO_STDIO +STBIDEF int stbi_is_hdr (char const *filename) +{ + FILE *f = stbi__fopen(filename, "rb"); + int result=0; + if (f) { + result = stbi_is_hdr_from_file(f); + fclose(f); + } + return result; +} + +STBIDEF int stbi_is_hdr_from_file(FILE *f) +{ + #ifndef STBI_NO_HDR + long pos = ftell(f); + int res; + stbi__context s; + stbi__start_file(&s,f); + res = stbi__hdr_test(&s); + fseek(f, pos, SEEK_SET); + return res; + #else + STBI_NOTUSED(f); + return 0; + #endif +} +#endif // !STBI_NO_STDIO + +STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user) +{ + #ifndef STBI_NO_HDR + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); + return stbi__hdr_test(&s); + #else + STBI_NOTUSED(clbk); + STBI_NOTUSED(user); + return 0; + #endif +} + +#ifndef STBI_NO_LINEAR +static float stbi__l2h_gamma=2.2f, stbi__l2h_scale=1.0f; + +STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; } +STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; } +#endif + +static float stbi__h2l_gamma_i=1.0f/2.2f, stbi__h2l_scale_i=1.0f; + +STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; } +STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; } + + +////////////////////////////////////////////////////////////////////////////// +// +// Common code used by all image loaders +// + +enum +{ + STBI__SCAN_load=0, + STBI__SCAN_type, + STBI__SCAN_header +}; + +static void stbi__refill_buffer(stbi__context *s) +{ + int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen); + s->callback_already_read += (int) (s->img_buffer - s->img_buffer_original); + if (n == 0) { + // at end of file, treat same as if from memory, but need to handle case + // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file + s->read_from_callbacks = 0; + s->img_buffer = s->buffer_start; + s->img_buffer_end = s->buffer_start+1; + *s->img_buffer = 0; + } else { + s->img_buffer = s->buffer_start; + s->img_buffer_end = s->buffer_start + n; + } +} + +stbi_inline static stbi_uc stbi__get8(stbi__context *s) +{ + if (s->img_buffer < s->img_buffer_end) + return *s->img_buffer++; + if (s->read_from_callbacks) { + stbi__refill_buffer(s); + return *s->img_buffer++; + } + return 0; +} + +#if defined(STBI_NO_JPEG) && defined(STBI_NO_HDR) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) +// nothing +#else +stbi_inline static int stbi__at_eof(stbi__context *s) +{ + if (s->io.read) { + if (!(s->io.eof)(s->io_user_data)) return 0; + // if feof() is true, check if buffer = end + // special case: we've only got the special 0 character at the end + if (s->read_from_callbacks == 0) return 1; + } + + return s->img_buffer >= s->img_buffer_end; +} +#endif + +#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) +// nothing +#else +static void stbi__skip(stbi__context *s, int n) +{ + if (n == 0) return; // already there! + if (n < 0) { + s->img_buffer = s->img_buffer_end; + return; + } + if (s->io.read) { + int blen = (int) (s->img_buffer_end - s->img_buffer); + if (blen < n) { + s->img_buffer = s->img_buffer_end; + (s->io.skip)(s->io_user_data, n - blen); + return; + } + } + s->img_buffer += n; +} +#endif + +#if defined(STBI_NO_PNG) && defined(STBI_NO_TGA) && defined(STBI_NO_HDR) && defined(STBI_NO_PNM) +// nothing +#else +static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) +{ + if (s->io.read) { + int blen = (int) (s->img_buffer_end - s->img_buffer); + if (blen < n) { + int res, count; + + memcpy(buffer, s->img_buffer, blen); + + count = (s->io.read)(s->io_user_data, (char*) buffer + blen, n - blen); + res = (count == (n-blen)); + s->img_buffer = s->img_buffer_end; + return res; + } + } + + if (s->img_buffer+n <= s->img_buffer_end) { + memcpy(buffer, s->img_buffer, n); + s->img_buffer += n; + return 1; + } else + return 0; +} +#endif + +#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC) +// nothing +#else +static int stbi__get16be(stbi__context *s) +{ + int z = stbi__get8(s); + return (z << 8) + stbi__get8(s); +} +#endif + +#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC) +// nothing +#else +static stbi__uint32 stbi__get32be(stbi__context *s) +{ + stbi__uint32 z = stbi__get16be(s); + return (z << 16) + stbi__get16be(s); +} +#endif + +#if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) +// nothing +#else +static int stbi__get16le(stbi__context *s) +{ + int z = stbi__get8(s); + return z + (stbi__get8(s) << 8); +} +#endif + +#ifndef STBI_NO_BMP +static stbi__uint32 stbi__get32le(stbi__context *s) +{ + stbi__uint32 z = stbi__get16le(s); + z += (stbi__uint32)stbi__get16le(s) << 16; + return z; +} +#endif + +#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings + +#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) +// nothing +#else +////////////////////////////////////////////////////////////////////////////// +// +// generic converter from built-in img_n to req_comp +// individual types do this automatically as much as possible (e.g. jpeg +// does all cases internally since it needs to colorspace convert anyway, +// and it never has alpha, so very few cases ). png can automatically +// interleave an alpha=255 channel, but falls back to this for other cases +// +// assume data buffer is malloced, so malloc a new one and free that one +// only failure mode is malloc failing + +static stbi_uc stbi__compute_y(int r, int g, int b) +{ + return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8); +} +#endif + +#if defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) +// nothing +#else +static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y) +{ + int i,j; + unsigned char *good; + + if (req_comp == img_n) return data; + STBI_ASSERT(req_comp >= 1 && req_comp <= 4); + + good = (unsigned char *) stbi__malloc_mad3(req_comp, x, y, 0); + if (good == NULL) { + STBI_FREE(data); + return stbi__errpuc("outofmem", "Out of memory"); + } + + for (j=0; j < (int) y; ++j) { + unsigned char *src = data + j * x * img_n ; + unsigned char *dest = good + j * x * req_comp; + + #define STBI__COMBO(a,b) ((a)*8+(b)) + #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) + // convert source image with img_n components to one with req_comp components; + // avoid switch per pixel, so use switch per scanline and massive macros + switch (STBI__COMBO(img_n, req_comp)) { + STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=255; } break; + STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; + STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=255; } break; + STBI__CASE(2,1) { dest[0]=src[0]; } break; + STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; + STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break; + STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=255; } break; + STBI__CASE(3,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break; + STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = 255; } break; + STBI__CASE(4,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break; + STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = src[3]; } break; + STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break; + default: STBI_ASSERT(0); STBI_FREE(data); STBI_FREE(good); return stbi__errpuc("unsupported", "Unsupported format conversion"); + } + #undef STBI__CASE + } + + STBI_FREE(data); + return good; +} +#endif + +#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) +// nothing +#else +static stbi__uint16 stbi__compute_y_16(int r, int g, int b) +{ + return (stbi__uint16) (((r*77) + (g*150) + (29*b)) >> 8); +} +#endif + +#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) +// nothing +#else +static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y) +{ + int i,j; + stbi__uint16 *good; + + if (req_comp == img_n) return data; + STBI_ASSERT(req_comp >= 1 && req_comp <= 4); + + good = (stbi__uint16 *) stbi__malloc(req_comp * x * y * 2); + if (good == NULL) { + STBI_FREE(data); + return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory"); + } + + for (j=0; j < (int) y; ++j) { + stbi__uint16 *src = data + j * x * img_n ; + stbi__uint16 *dest = good + j * x * req_comp; + + #define STBI__COMBO(a,b) ((a)*8+(b)) + #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) + // convert source image with img_n components to one with req_comp components; + // avoid switch per pixel, so use switch per scanline and massive macros + switch (STBI__COMBO(img_n, req_comp)) { + STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=0xffff; } break; + STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; + STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=0xffff; } break; + STBI__CASE(2,1) { dest[0]=src[0]; } break; + STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; + STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break; + STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=0xffff; } break; + STBI__CASE(3,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break; + STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = 0xffff; } break; + STBI__CASE(4,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break; + STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = src[3]; } break; + STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break; + default: STBI_ASSERT(0); STBI_FREE(data); STBI_FREE(good); return (stbi__uint16*) stbi__errpuc("unsupported", "Unsupported format conversion"); + } + #undef STBI__CASE + } + + STBI_FREE(data); + return good; +} +#endif + +#ifndef STBI_NO_LINEAR +static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp) +{ + int i,k,n; + float *output; + if (!data) return NULL; + output = (float *) stbi__malloc_mad4(x, y, comp, sizeof(float), 0); + if (output == NULL) { STBI_FREE(data); return stbi__errpf("outofmem", "Out of memory"); } + // compute number of non-alpha components + if (comp & 1) n = comp; else n = comp-1; + for (i=0; i < x*y; ++i) { + for (k=0; k < n; ++k) { + output[i*comp + k] = (float) (pow(data[i*comp+k]/255.0f, stbi__l2h_gamma) * stbi__l2h_scale); + } + } + if (n < comp) { + for (i=0; i < x*y; ++i) { + output[i*comp + n] = data[i*comp + n]/255.0f; + } + } + STBI_FREE(data); + return output; +} +#endif + +#ifndef STBI_NO_HDR +#define stbi__float2int(x) ((int) (x)) +static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp) +{ + int i,k,n; + stbi_uc *output; + if (!data) return NULL; + output = (stbi_uc *) stbi__malloc_mad3(x, y, comp, 0); + if (output == NULL) { STBI_FREE(data); return stbi__errpuc("outofmem", "Out of memory"); } + // compute number of non-alpha components + if (comp & 1) n = comp; else n = comp-1; + for (i=0; i < x*y; ++i) { + for (k=0; k < n; ++k) { + float z = (float) pow(data[i*comp+k]*stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f; + if (z < 0) z = 0; + if (z > 255) z = 255; + output[i*comp + k] = (stbi_uc) stbi__float2int(z); + } + if (k < comp) { + float z = data[i*comp+k] * 255 + 0.5f; + if (z < 0) z = 0; + if (z > 255) z = 255; + output[i*comp + k] = (stbi_uc) stbi__float2int(z); + } + } + STBI_FREE(data); + return output; +} +#endif + +////////////////////////////////////////////////////////////////////////////// +// +// "baseline" JPEG/JFIF decoder +// +// simple implementation +// - doesn't support delayed output of y-dimension +// - simple interface (only one output format: 8-bit interleaved RGB) +// - doesn't try to recover corrupt jpegs +// - doesn't allow partial loading, loading multiple at once +// - still fast on x86 (copying globals into locals doesn't help x86) +// - allocates lots of intermediate memory (full size of all components) +// - non-interleaved case requires this anyway +// - allows good upsampling (see next) +// high-quality +// - upsampled channels are bilinearly interpolated, even across blocks +// - quality integer IDCT derived from IJG's 'slow' +// performance +// - fast huffman; reasonable integer IDCT +// - some SIMD kernels for common paths on targets with SSE2/NEON +// - uses a lot of intermediate memory, could cache poorly + +#ifndef STBI_NO_JPEG + +// huffman decoding acceleration +#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache + +typedef struct +{ + stbi_uc fast[1 << FAST_BITS]; + // weirdly, repacking this into AoS is a 10% speed loss, instead of a win + stbi__uint16 code[256]; + stbi_uc values[256]; + stbi_uc size[257]; + unsigned int maxcode[18]; + int delta[17]; // old 'firstsymbol' - old 'firstcode' +} stbi__huffman; + +typedef struct +{ + stbi__context *s; + stbi__huffman huff_dc[4]; + stbi__huffman huff_ac[4]; + stbi__uint16 dequant[4][64]; + stbi__int16 fast_ac[4][1 << FAST_BITS]; + +// sizes for components, interleaved MCUs + int img_h_max, img_v_max; + int img_mcu_x, img_mcu_y; + int img_mcu_w, img_mcu_h; + +// definition of jpeg image component + struct + { + int id; + int h,v; + int tq; + int hd,ha; + int dc_pred; + + int x,y,w2,h2; + stbi_uc *data; + void *raw_data, *raw_coeff; + stbi_uc *linebuf; + short *coeff; // progressive only + int coeff_w, coeff_h; // number of 8x8 coefficient blocks + } img_comp[4]; + + stbi__uint32 code_buffer; // jpeg entropy-coded buffer + int code_bits; // number of valid bits + unsigned char marker; // marker seen while filling entropy buffer + int nomore; // flag if we saw a marker so must stop + + int progressive; + int spec_start; + int spec_end; + int succ_high; + int succ_low; + int eob_run; + int jfif; + int app14_color_transform; // Adobe APP14 tag + int rgb; + + int scan_n, order[4]; + int restart_interval, todo; + +// kernels + void (*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]); + void (*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step); + stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs); +} stbi__jpeg; + +static int stbi__build_huffman(stbi__huffman *h, int *count) +{ + int i,j,k=0; + unsigned int code; + // build size list for each symbol (from JPEG spec) + for (i=0; i < 16; ++i) { + for (j=0; j < count[i]; ++j) { + h->size[k++] = (stbi_uc) (i+1); + if(k >= 257) return stbi__err("bad size list","Corrupt JPEG"); + } + } + h->size[k] = 0; + + // compute actual symbols (from jpeg spec) + code = 0; + k = 0; + for(j=1; j <= 16; ++j) { + // compute delta to add to code to compute symbol id + h->delta[j] = k - code; + if (h->size[k] == j) { + while (h->size[k] == j) + h->code[k++] = (stbi__uint16) (code++); + if (code-1 >= (1u << j)) return stbi__err("bad code lengths","Corrupt JPEG"); + } + // compute largest code + 1 for this size, preshifted as needed later + h->maxcode[j] = code << (16-j); + code <<= 1; + } + h->maxcode[j] = 0xffffffff; + + // build non-spec acceleration table; 255 is flag for not-accelerated + memset(h->fast, 255, 1 << FAST_BITS); + for (i=0; i < k; ++i) { + int s = h->size[i]; + if (s <= FAST_BITS) { + int c = h->code[i] << (FAST_BITS-s); + int m = 1 << (FAST_BITS-s); + for (j=0; j < m; ++j) { + h->fast[c+j] = (stbi_uc) i; + } + } + } + return 1; +} + +// build a table that decodes both magnitude and value of small ACs in +// one go. +static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h) +{ + int i; + for (i=0; i < (1 << FAST_BITS); ++i) { + stbi_uc fast = h->fast[i]; + fast_ac[i] = 0; + if (fast < 255) { + int rs = h->values[fast]; + int run = (rs >> 4) & 15; + int magbits = rs & 15; + int len = h->size[fast]; + + if (magbits && len + magbits <= FAST_BITS) { + // magnitude code followed by receive_extend code + int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits); + int m = 1 << (magbits - 1); + if (k < m) k += (~0U << magbits) + 1; + // if the result is small enough, we can fit it in fast_ac table + if (k >= -128 && k <= 127) + fast_ac[i] = (stbi__int16) ((k * 256) + (run * 16) + (len + magbits)); + } + } + } +} + +static void stbi__grow_buffer_unsafe(stbi__jpeg *j) +{ + do { + unsigned int b = j->nomore ? 0 : stbi__get8(j->s); + if (b == 0xff) { + int c = stbi__get8(j->s); + while (c == 0xff) c = stbi__get8(j->s); // consume fill bytes + if (c != 0) { + j->marker = (unsigned char) c; + j->nomore = 1; + return; + } + } + j->code_buffer |= b << (24 - j->code_bits); + j->code_bits += 8; + } while (j->code_bits <= 24); +} + +// (1 << n) - 1 +static const stbi__uint32 stbi__bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535}; + +// decode a jpeg huffman value from the bitstream +stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h) +{ + unsigned int temp; + int c,k; + + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + + // look at the top FAST_BITS and determine what symbol ID it is, + // if the code is <= FAST_BITS + c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); + k = h->fast[c]; + if (k < 255) { + int s = h->size[k]; + if (s > j->code_bits) + return -1; + j->code_buffer <<= s; + j->code_bits -= s; + return h->values[k]; + } + + // naive test is to shift the code_buffer down so k bits are + // valid, then test against maxcode. To speed this up, we've + // preshifted maxcode left so that it has (16-k) 0s at the + // end; in other words, regardless of the number of bits, it + // wants to be compared against something shifted to have 16; + // that way we don't need to shift inside the loop. + temp = j->code_buffer >> 16; + for (k=FAST_BITS+1 ; ; ++k) + if (temp < h->maxcode[k]) + break; + if (k == 17) { + // error! code not found + j->code_bits -= 16; + return -1; + } + + if (k > j->code_bits) + return -1; + + // convert the huffman code to the symbol id + c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k]; + if(c < 0 || c >= 256) // symbol id out of bounds! + return -1; + STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]); + + // convert the id to a symbol + j->code_bits -= k; + j->code_buffer <<= k; + return h->values[c]; +} + +// bias[n] = (-1<code_bits < n) stbi__grow_buffer_unsafe(j); + if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s intead of continuing + + sgn = j->code_buffer >> 31; // sign bit always in MSB; 0 if MSB clear (positive), 1 if MSB set (negative) + k = stbi_lrot(j->code_buffer, n); + j->code_buffer = k & ~stbi__bmask[n]; + k &= stbi__bmask[n]; + j->code_bits -= n; + return k + (stbi__jbias[n] & (sgn - 1)); +} + +// get some unsigned bits +stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n) +{ + unsigned int k; + if (j->code_bits < n) stbi__grow_buffer_unsafe(j); + if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s intead of continuing + k = stbi_lrot(j->code_buffer, n); + j->code_buffer = k & ~stbi__bmask[n]; + k &= stbi__bmask[n]; + j->code_bits -= n; + return k; +} + +stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j) +{ + unsigned int k; + if (j->code_bits < 1) stbi__grow_buffer_unsafe(j); + if (j->code_bits < 1) return 0; // ran out of bits from stream, return 0s intead of continuing + k = j->code_buffer; + j->code_buffer <<= 1; + --j->code_bits; + return k & 0x80000000; +} + +// given a value that's at position X in the zigzag stream, +// where does it appear in the 8x8 matrix coded as row-major? +static const stbi_uc stbi__jpeg_dezigzag[64+15] = +{ + 0, 1, 8, 16, 9, 2, 3, 10, + 17, 24, 32, 25, 18, 11, 4, 5, + 12, 19, 26, 33, 40, 48, 41, 34, + 27, 20, 13, 6, 7, 14, 21, 28, + 35, 42, 49, 56, 57, 50, 43, 36, + 29, 22, 15, 23, 30, 37, 44, 51, + 58, 59, 52, 45, 38, 31, 39, 46, + 53, 60, 61, 54, 47, 55, 62, 63, + // let corrupt input sample past end + 63, 63, 63, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63 +}; + +// decode one 64-entry block-- +static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi__uint16 *dequant) +{ + int diff,dc,k; + int t; + + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + t = stbi__jpeg_huff_decode(j, hdc); + if (t < 0 || t > 15) return stbi__err("bad huffman code","Corrupt JPEG"); + + // 0 all the ac values now so we can do it 32-bits at a time + memset(data,0,64*sizeof(data[0])); + + diff = t ? stbi__extend_receive(j, t) : 0; + if (!stbi__addints_valid(j->img_comp[b].dc_pred, diff)) return stbi__err("bad delta","Corrupt JPEG"); + dc = j->img_comp[b].dc_pred + diff; + j->img_comp[b].dc_pred = dc; + if (!stbi__mul2shorts_valid(dc, dequant[0])) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); + data[0] = (short) (dc * dequant[0]); + + // decode AC components, see JPEG spec + k = 1; + do { + unsigned int zig; + int c,r,s; + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); + r = fac[c]; + if (r) { // fast-AC path + k += (r >> 4) & 15; // run + s = r & 15; // combined length + if (s > j->code_bits) return stbi__err("bad huffman code", "Combined length longer than code bits available"); + j->code_buffer <<= s; + j->code_bits -= s; + // decode into unzigzag'd location + zig = stbi__jpeg_dezigzag[k++]; + data[zig] = (short) ((r >> 8) * dequant[zig]); + } else { + int rs = stbi__jpeg_huff_decode(j, hac); + if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); + s = rs & 15; + r = rs >> 4; + if (s == 0) { + if (rs != 0xf0) break; // end block + k += 16; + } else { + k += r; + // decode into unzigzag'd location + zig = stbi__jpeg_dezigzag[k++]; + data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]); + } + } + } while (k < 64); + return 1; +} + +static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b) +{ + int diff,dc; + int t; + if (j->spec_end != 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); + + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + + if (j->succ_high == 0) { + // first scan for DC coefficient, must be first + memset(data,0,64*sizeof(data[0])); // 0 all the ac values now + t = stbi__jpeg_huff_decode(j, hdc); + if (t < 0 || t > 15) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); + diff = t ? stbi__extend_receive(j, t) : 0; + + if (!stbi__addints_valid(j->img_comp[b].dc_pred, diff)) return stbi__err("bad delta", "Corrupt JPEG"); + dc = j->img_comp[b].dc_pred + diff; + j->img_comp[b].dc_pred = dc; + if (!stbi__mul2shorts_valid(dc, 1 << j->succ_low)) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); + data[0] = (short) (dc * (1 << j->succ_low)); + } else { + // refinement scan for DC coefficient + if (stbi__jpeg_get_bit(j)) + data[0] += (short) (1 << j->succ_low); + } + return 1; +} + +// @OPTIMIZE: store non-zigzagged during the decode passes, +// and only de-zigzag when dequantizing +static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac) +{ + int k; + if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); + + if (j->succ_high == 0) { + int shift = j->succ_low; + + if (j->eob_run) { + --j->eob_run; + return 1; + } + + k = j->spec_start; + do { + unsigned int zig; + int c,r,s; + if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); + c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); + r = fac[c]; + if (r) { // fast-AC path + k += (r >> 4) & 15; // run + s = r & 15; // combined length + if (s > j->code_bits) return stbi__err("bad huffman code", "Combined length longer than code bits available"); + j->code_buffer <<= s; + j->code_bits -= s; + zig = stbi__jpeg_dezigzag[k++]; + data[zig] = (short) ((r >> 8) * (1 << shift)); + } else { + int rs = stbi__jpeg_huff_decode(j, hac); + if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); + s = rs & 15; + r = rs >> 4; + if (s == 0) { + if (r < 15) { + j->eob_run = (1 << r); + if (r) + j->eob_run += stbi__jpeg_get_bits(j, r); + --j->eob_run; + break; + } + k += 16; + } else { + k += r; + zig = stbi__jpeg_dezigzag[k++]; + data[zig] = (short) (stbi__extend_receive(j,s) * (1 << shift)); + } + } + } while (k <= j->spec_end); + } else { + // refinement scan for these AC coefficients + + short bit = (short) (1 << j->succ_low); + + if (j->eob_run) { + --j->eob_run; + for (k = j->spec_start; k <= j->spec_end; ++k) { + short *p = &data[stbi__jpeg_dezigzag[k]]; + if (*p != 0) + if (stbi__jpeg_get_bit(j)) + if ((*p & bit)==0) { + if (*p > 0) + *p += bit; + else + *p -= bit; + } + } + } else { + k = j->spec_start; + do { + int r,s; + int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh + if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); + s = rs & 15; + r = rs >> 4; + if (s == 0) { + if (r < 15) { + j->eob_run = (1 << r) - 1; + if (r) + j->eob_run += stbi__jpeg_get_bits(j, r); + r = 64; // force end of block + } else { + // r=15 s=0 should write 16 0s, so we just do + // a run of 15 0s and then write s (which is 0), + // so we don't have to do anything special here + } + } else { + if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG"); + // sign bit + if (stbi__jpeg_get_bit(j)) + s = bit; + else + s = -bit; + } + + // advance by r + while (k <= j->spec_end) { + short *p = &data[stbi__jpeg_dezigzag[k++]]; + if (*p != 0) { + if (stbi__jpeg_get_bit(j)) + if ((*p & bit)==0) { + if (*p > 0) + *p += bit; + else + *p -= bit; + } + } else { + if (r == 0) { + *p = (short) s; + break; + } + --r; + } + } + } while (k <= j->spec_end); + } + } + return 1; +} + +// take a -128..127 value and stbi__clamp it and convert to 0..255 +stbi_inline static stbi_uc stbi__clamp(int x) +{ + // trick to use a single test to catch both cases + if ((unsigned int) x > 255) { + if (x < 0) return 0; + if (x > 255) return 255; + } + return (stbi_uc) x; +} + +#define stbi__f2f(x) ((int) (((x) * 4096 + 0.5))) +#define stbi__fsh(x) ((x) * 4096) + +// derived from jidctint -- DCT_ISLOW +#define STBI__IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \ + int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \ + p2 = s2; \ + p3 = s6; \ + p1 = (p2+p3) * stbi__f2f(0.5411961f); \ + t2 = p1 + p3*stbi__f2f(-1.847759065f); \ + t3 = p1 + p2*stbi__f2f( 0.765366865f); \ + p2 = s0; \ + p3 = s4; \ + t0 = stbi__fsh(p2+p3); \ + t1 = stbi__fsh(p2-p3); \ + x0 = t0+t3; \ + x3 = t0-t3; \ + x1 = t1+t2; \ + x2 = t1-t2; \ + t0 = s7; \ + t1 = s5; \ + t2 = s3; \ + t3 = s1; \ + p3 = t0+t2; \ + p4 = t1+t3; \ + p1 = t0+t3; \ + p2 = t1+t2; \ + p5 = (p3+p4)*stbi__f2f( 1.175875602f); \ + t0 = t0*stbi__f2f( 0.298631336f); \ + t1 = t1*stbi__f2f( 2.053119869f); \ + t2 = t2*stbi__f2f( 3.072711026f); \ + t3 = t3*stbi__f2f( 1.501321110f); \ + p1 = p5 + p1*stbi__f2f(-0.899976223f); \ + p2 = p5 + p2*stbi__f2f(-2.562915447f); \ + p3 = p3*stbi__f2f(-1.961570560f); \ + p4 = p4*stbi__f2f(-0.390180644f); \ + t3 += p1+p4; \ + t2 += p2+p3; \ + t1 += p2+p4; \ + t0 += p1+p3; + +static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64]) +{ + int i,val[64],*v=val; + stbi_uc *o; + short *d = data; + + // columns + for (i=0; i < 8; ++i,++d, ++v) { + // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing + if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 + && d[40]==0 && d[48]==0 && d[56]==0) { + // no shortcut 0 seconds + // (1|2|3|4|5|6|7)==0 0 seconds + // all separate -0.047 seconds + // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds + int dcterm = d[0]*4; + v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; + } else { + STBI__IDCT_1D(d[ 0],d[ 8],d[16],d[24],d[32],d[40],d[48],d[56]) + // constants scaled things up by 1<<12; let's bring them back + // down, but keep 2 extra bits of precision + x0 += 512; x1 += 512; x2 += 512; x3 += 512; + v[ 0] = (x0+t3) >> 10; + v[56] = (x0-t3) >> 10; + v[ 8] = (x1+t2) >> 10; + v[48] = (x1-t2) >> 10; + v[16] = (x2+t1) >> 10; + v[40] = (x2-t1) >> 10; + v[24] = (x3+t0) >> 10; + v[32] = (x3-t0) >> 10; + } + } + + for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { + // no fast case since the first 1D IDCT spread components out + STBI__IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) + // constants scaled things up by 1<<12, plus we had 1<<2 from first + // loop, plus horizontal and vertical each scale by sqrt(8) so together + // we've got an extra 1<<3, so 1<<17 total we need to remove. + // so we want to round that, which means adding 0.5 * 1<<17, + // aka 65536. Also, we'll end up with -128 to 127 that we want + // to encode as 0..255 by adding 128, so we'll add that before the shift + x0 += 65536 + (128<<17); + x1 += 65536 + (128<<17); + x2 += 65536 + (128<<17); + x3 += 65536 + (128<<17); + // tried computing the shifts into temps, or'ing the temps to see + // if any were out of range, but that was slower + o[0] = stbi__clamp((x0+t3) >> 17); + o[7] = stbi__clamp((x0-t3) >> 17); + o[1] = stbi__clamp((x1+t2) >> 17); + o[6] = stbi__clamp((x1-t2) >> 17); + o[2] = stbi__clamp((x2+t1) >> 17); + o[5] = stbi__clamp((x2-t1) >> 17); + o[3] = stbi__clamp((x3+t0) >> 17); + o[4] = stbi__clamp((x3-t0) >> 17); + } +} + +#ifdef STBI_SSE2 +// sse2 integer IDCT. not the fastest possible implementation but it +// produces bit-identical results to the generic C version so it's +// fully "transparent". +static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) +{ + // This is constructed to match our regular (generic) integer IDCT exactly. + __m128i row0, row1, row2, row3, row4, row5, row6, row7; + __m128i tmp; + + // dot product constant: even elems=x, odd elems=y + #define dct_const(x,y) _mm_setr_epi16((x),(y),(x),(y),(x),(y),(x),(y)) + + // out(0) = c0[even]*x + c0[odd]*y (c0, x, y 16-bit, out 32-bit) + // out(1) = c1[even]*x + c1[odd]*y + #define dct_rot(out0,out1, x,y,c0,c1) \ + __m128i c0##lo = _mm_unpacklo_epi16((x),(y)); \ + __m128i c0##hi = _mm_unpackhi_epi16((x),(y)); \ + __m128i out0##_l = _mm_madd_epi16(c0##lo, c0); \ + __m128i out0##_h = _mm_madd_epi16(c0##hi, c0); \ + __m128i out1##_l = _mm_madd_epi16(c0##lo, c1); \ + __m128i out1##_h = _mm_madd_epi16(c0##hi, c1) + + // out = in << 12 (in 16-bit, out 32-bit) + #define dct_widen(out, in) \ + __m128i out##_l = _mm_srai_epi32(_mm_unpacklo_epi16(_mm_setzero_si128(), (in)), 4); \ + __m128i out##_h = _mm_srai_epi32(_mm_unpackhi_epi16(_mm_setzero_si128(), (in)), 4) + + // wide add + #define dct_wadd(out, a, b) \ + __m128i out##_l = _mm_add_epi32(a##_l, b##_l); \ + __m128i out##_h = _mm_add_epi32(a##_h, b##_h) + + // wide sub + #define dct_wsub(out, a, b) \ + __m128i out##_l = _mm_sub_epi32(a##_l, b##_l); \ + __m128i out##_h = _mm_sub_epi32(a##_h, b##_h) + + // butterfly a/b, add bias, then shift by "s" and pack + #define dct_bfly32o(out0, out1, a,b,bias,s) \ + { \ + __m128i abiased_l = _mm_add_epi32(a##_l, bias); \ + __m128i abiased_h = _mm_add_epi32(a##_h, bias); \ + dct_wadd(sum, abiased, b); \ + dct_wsub(dif, abiased, b); \ + out0 = _mm_packs_epi32(_mm_srai_epi32(sum_l, s), _mm_srai_epi32(sum_h, s)); \ + out1 = _mm_packs_epi32(_mm_srai_epi32(dif_l, s), _mm_srai_epi32(dif_h, s)); \ + } + + // 8-bit interleave step (for transposes) + #define dct_interleave8(a, b) \ + tmp = a; \ + a = _mm_unpacklo_epi8(a, b); \ + b = _mm_unpackhi_epi8(tmp, b) + + // 16-bit interleave step (for transposes) + #define dct_interleave16(a, b) \ + tmp = a; \ + a = _mm_unpacklo_epi16(a, b); \ + b = _mm_unpackhi_epi16(tmp, b) + + #define dct_pass(bias,shift) \ + { \ + /* even part */ \ + dct_rot(t2e,t3e, row2,row6, rot0_0,rot0_1); \ + __m128i sum04 = _mm_add_epi16(row0, row4); \ + __m128i dif04 = _mm_sub_epi16(row0, row4); \ + dct_widen(t0e, sum04); \ + dct_widen(t1e, dif04); \ + dct_wadd(x0, t0e, t3e); \ + dct_wsub(x3, t0e, t3e); \ + dct_wadd(x1, t1e, t2e); \ + dct_wsub(x2, t1e, t2e); \ + /* odd part */ \ + dct_rot(y0o,y2o, row7,row3, rot2_0,rot2_1); \ + dct_rot(y1o,y3o, row5,row1, rot3_0,rot3_1); \ + __m128i sum17 = _mm_add_epi16(row1, row7); \ + __m128i sum35 = _mm_add_epi16(row3, row5); \ + dct_rot(y4o,y5o, sum17,sum35, rot1_0,rot1_1); \ + dct_wadd(x4, y0o, y4o); \ + dct_wadd(x5, y1o, y5o); \ + dct_wadd(x6, y2o, y5o); \ + dct_wadd(x7, y3o, y4o); \ + dct_bfly32o(row0,row7, x0,x7,bias,shift); \ + dct_bfly32o(row1,row6, x1,x6,bias,shift); \ + dct_bfly32o(row2,row5, x2,x5,bias,shift); \ + dct_bfly32o(row3,row4, x3,x4,bias,shift); \ + } + + __m128i rot0_0 = dct_const(stbi__f2f(0.5411961f), stbi__f2f(0.5411961f) + stbi__f2f(-1.847759065f)); + __m128i rot0_1 = dct_const(stbi__f2f(0.5411961f) + stbi__f2f( 0.765366865f), stbi__f2f(0.5411961f)); + __m128i rot1_0 = dct_const(stbi__f2f(1.175875602f) + stbi__f2f(-0.899976223f), stbi__f2f(1.175875602f)); + __m128i rot1_1 = dct_const(stbi__f2f(1.175875602f), stbi__f2f(1.175875602f) + stbi__f2f(-2.562915447f)); + __m128i rot2_0 = dct_const(stbi__f2f(-1.961570560f) + stbi__f2f( 0.298631336f), stbi__f2f(-1.961570560f)); + __m128i rot2_1 = dct_const(stbi__f2f(-1.961570560f), stbi__f2f(-1.961570560f) + stbi__f2f( 3.072711026f)); + __m128i rot3_0 = dct_const(stbi__f2f(-0.390180644f) + stbi__f2f( 2.053119869f), stbi__f2f(-0.390180644f)); + __m128i rot3_1 = dct_const(stbi__f2f(-0.390180644f), stbi__f2f(-0.390180644f) + stbi__f2f( 1.501321110f)); + + // rounding biases in column/row passes, see stbi__idct_block for explanation. + __m128i bias_0 = _mm_set1_epi32(512); + __m128i bias_1 = _mm_set1_epi32(65536 + (128<<17)); + + // load + row0 = _mm_load_si128((const __m128i *) (data + 0*8)); + row1 = _mm_load_si128((const __m128i *) (data + 1*8)); + row2 = _mm_load_si128((const __m128i *) (data + 2*8)); + row3 = _mm_load_si128((const __m128i *) (data + 3*8)); + row4 = _mm_load_si128((const __m128i *) (data + 4*8)); + row5 = _mm_load_si128((const __m128i *) (data + 5*8)); + row6 = _mm_load_si128((const __m128i *) (data + 6*8)); + row7 = _mm_load_si128((const __m128i *) (data + 7*8)); + + // column pass + dct_pass(bias_0, 10); + + { + // 16bit 8x8 transpose pass 1 + dct_interleave16(row0, row4); + dct_interleave16(row1, row5); + dct_interleave16(row2, row6); + dct_interleave16(row3, row7); + + // transpose pass 2 + dct_interleave16(row0, row2); + dct_interleave16(row1, row3); + dct_interleave16(row4, row6); + dct_interleave16(row5, row7); + + // transpose pass 3 + dct_interleave16(row0, row1); + dct_interleave16(row2, row3); + dct_interleave16(row4, row5); + dct_interleave16(row6, row7); + } + + // row pass + dct_pass(bias_1, 17); + + { + // pack + __m128i p0 = _mm_packus_epi16(row0, row1); // a0a1a2a3...a7b0b1b2b3...b7 + __m128i p1 = _mm_packus_epi16(row2, row3); + __m128i p2 = _mm_packus_epi16(row4, row5); + __m128i p3 = _mm_packus_epi16(row6, row7); + + // 8bit 8x8 transpose pass 1 + dct_interleave8(p0, p2); // a0e0a1e1... + dct_interleave8(p1, p3); // c0g0c1g1... + + // transpose pass 2 + dct_interleave8(p0, p1); // a0c0e0g0... + dct_interleave8(p2, p3); // b0d0f0h0... + + // transpose pass 3 + dct_interleave8(p0, p2); // a0b0c0d0... + dct_interleave8(p1, p3); // a4b4c4d4... + + // store + _mm_storel_epi64((__m128i *) out, p0); out += out_stride; + _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p0, 0x4e)); out += out_stride; + _mm_storel_epi64((__m128i *) out, p2); out += out_stride; + _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p2, 0x4e)); out += out_stride; + _mm_storel_epi64((__m128i *) out, p1); out += out_stride; + _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p1, 0x4e)); out += out_stride; + _mm_storel_epi64((__m128i *) out, p3); out += out_stride; + _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p3, 0x4e)); + } + +#undef dct_const +#undef dct_rot +#undef dct_widen +#undef dct_wadd +#undef dct_wsub +#undef dct_bfly32o +#undef dct_interleave8 +#undef dct_interleave16 +#undef dct_pass +} + +#endif // STBI_SSE2 + +#ifdef STBI_NEON + +// NEON integer IDCT. should produce bit-identical +// results to the generic C version. +static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) +{ + int16x8_t row0, row1, row2, row3, row4, row5, row6, row7; + + int16x4_t rot0_0 = vdup_n_s16(stbi__f2f(0.5411961f)); + int16x4_t rot0_1 = vdup_n_s16(stbi__f2f(-1.847759065f)); + int16x4_t rot0_2 = vdup_n_s16(stbi__f2f( 0.765366865f)); + int16x4_t rot1_0 = vdup_n_s16(stbi__f2f( 1.175875602f)); + int16x4_t rot1_1 = vdup_n_s16(stbi__f2f(-0.899976223f)); + int16x4_t rot1_2 = vdup_n_s16(stbi__f2f(-2.562915447f)); + int16x4_t rot2_0 = vdup_n_s16(stbi__f2f(-1.961570560f)); + int16x4_t rot2_1 = vdup_n_s16(stbi__f2f(-0.390180644f)); + int16x4_t rot3_0 = vdup_n_s16(stbi__f2f( 0.298631336f)); + int16x4_t rot3_1 = vdup_n_s16(stbi__f2f( 2.053119869f)); + int16x4_t rot3_2 = vdup_n_s16(stbi__f2f( 3.072711026f)); + int16x4_t rot3_3 = vdup_n_s16(stbi__f2f( 1.501321110f)); + +#define dct_long_mul(out, inq, coeff) \ + int32x4_t out##_l = vmull_s16(vget_low_s16(inq), coeff); \ + int32x4_t out##_h = vmull_s16(vget_high_s16(inq), coeff) + +#define dct_long_mac(out, acc, inq, coeff) \ + int32x4_t out##_l = vmlal_s16(acc##_l, vget_low_s16(inq), coeff); \ + int32x4_t out##_h = vmlal_s16(acc##_h, vget_high_s16(inq), coeff) + +#define dct_widen(out, inq) \ + int32x4_t out##_l = vshll_n_s16(vget_low_s16(inq), 12); \ + int32x4_t out##_h = vshll_n_s16(vget_high_s16(inq), 12) + +// wide add +#define dct_wadd(out, a, b) \ + int32x4_t out##_l = vaddq_s32(a##_l, b##_l); \ + int32x4_t out##_h = vaddq_s32(a##_h, b##_h) + +// wide sub +#define dct_wsub(out, a, b) \ + int32x4_t out##_l = vsubq_s32(a##_l, b##_l); \ + int32x4_t out##_h = vsubq_s32(a##_h, b##_h) + +// butterfly a/b, then shift using "shiftop" by "s" and pack +#define dct_bfly32o(out0,out1, a,b,shiftop,s) \ + { \ + dct_wadd(sum, a, b); \ + dct_wsub(dif, a, b); \ + out0 = vcombine_s16(shiftop(sum_l, s), shiftop(sum_h, s)); \ + out1 = vcombine_s16(shiftop(dif_l, s), shiftop(dif_h, s)); \ + } + +#define dct_pass(shiftop, shift) \ + { \ + /* even part */ \ + int16x8_t sum26 = vaddq_s16(row2, row6); \ + dct_long_mul(p1e, sum26, rot0_0); \ + dct_long_mac(t2e, p1e, row6, rot0_1); \ + dct_long_mac(t3e, p1e, row2, rot0_2); \ + int16x8_t sum04 = vaddq_s16(row0, row4); \ + int16x8_t dif04 = vsubq_s16(row0, row4); \ + dct_widen(t0e, sum04); \ + dct_widen(t1e, dif04); \ + dct_wadd(x0, t0e, t3e); \ + dct_wsub(x3, t0e, t3e); \ + dct_wadd(x1, t1e, t2e); \ + dct_wsub(x2, t1e, t2e); \ + /* odd part */ \ + int16x8_t sum15 = vaddq_s16(row1, row5); \ + int16x8_t sum17 = vaddq_s16(row1, row7); \ + int16x8_t sum35 = vaddq_s16(row3, row5); \ + int16x8_t sum37 = vaddq_s16(row3, row7); \ + int16x8_t sumodd = vaddq_s16(sum17, sum35); \ + dct_long_mul(p5o, sumodd, rot1_0); \ + dct_long_mac(p1o, p5o, sum17, rot1_1); \ + dct_long_mac(p2o, p5o, sum35, rot1_2); \ + dct_long_mul(p3o, sum37, rot2_0); \ + dct_long_mul(p4o, sum15, rot2_1); \ + dct_wadd(sump13o, p1o, p3o); \ + dct_wadd(sump24o, p2o, p4o); \ + dct_wadd(sump23o, p2o, p3o); \ + dct_wadd(sump14o, p1o, p4o); \ + dct_long_mac(x4, sump13o, row7, rot3_0); \ + dct_long_mac(x5, sump24o, row5, rot3_1); \ + dct_long_mac(x6, sump23o, row3, rot3_2); \ + dct_long_mac(x7, sump14o, row1, rot3_3); \ + dct_bfly32o(row0,row7, x0,x7,shiftop,shift); \ + dct_bfly32o(row1,row6, x1,x6,shiftop,shift); \ + dct_bfly32o(row2,row5, x2,x5,shiftop,shift); \ + dct_bfly32o(row3,row4, x3,x4,shiftop,shift); \ + } + + // load + row0 = vld1q_s16(data + 0*8); + row1 = vld1q_s16(data + 1*8); + row2 = vld1q_s16(data + 2*8); + row3 = vld1q_s16(data + 3*8); + row4 = vld1q_s16(data + 4*8); + row5 = vld1q_s16(data + 5*8); + row6 = vld1q_s16(data + 6*8); + row7 = vld1q_s16(data + 7*8); + + // add DC bias + row0 = vaddq_s16(row0, vsetq_lane_s16(1024, vdupq_n_s16(0), 0)); + + // column pass + dct_pass(vrshrn_n_s32, 10); + + // 16bit 8x8 transpose + { +// these three map to a single VTRN.16, VTRN.32, and VSWP, respectively. +// whether compilers actually get this is another story, sadly. +#define dct_trn16(x, y) { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; } +#define dct_trn32(x, y) { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); } +#define dct_trn64(x, y) { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); } + + // pass 1 + dct_trn16(row0, row1); // a0b0a2b2a4b4a6b6 + dct_trn16(row2, row3); + dct_trn16(row4, row5); + dct_trn16(row6, row7); + + // pass 2 + dct_trn32(row0, row2); // a0b0c0d0a4b4c4d4 + dct_trn32(row1, row3); + dct_trn32(row4, row6); + dct_trn32(row5, row7); + + // pass 3 + dct_trn64(row0, row4); // a0b0c0d0e0f0g0h0 + dct_trn64(row1, row5); + dct_trn64(row2, row6); + dct_trn64(row3, row7); + +#undef dct_trn16 +#undef dct_trn32 +#undef dct_trn64 + } + + // row pass + // vrshrn_n_s32 only supports shifts up to 16, we need + // 17. so do a non-rounding shift of 16 first then follow + // up with a rounding shift by 1. + dct_pass(vshrn_n_s32, 16); + + { + // pack and round + uint8x8_t p0 = vqrshrun_n_s16(row0, 1); + uint8x8_t p1 = vqrshrun_n_s16(row1, 1); + uint8x8_t p2 = vqrshrun_n_s16(row2, 1); + uint8x8_t p3 = vqrshrun_n_s16(row3, 1); + uint8x8_t p4 = vqrshrun_n_s16(row4, 1); + uint8x8_t p5 = vqrshrun_n_s16(row5, 1); + uint8x8_t p6 = vqrshrun_n_s16(row6, 1); + uint8x8_t p7 = vqrshrun_n_s16(row7, 1); + + // again, these can translate into one instruction, but often don't. +#define dct_trn8_8(x, y) { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; } +#define dct_trn8_16(x, y) { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); } +#define dct_trn8_32(x, y) { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); } + + // sadly can't use interleaved stores here since we only write + // 8 bytes to each scan line! + + // 8x8 8-bit transpose pass 1 + dct_trn8_8(p0, p1); + dct_trn8_8(p2, p3); + dct_trn8_8(p4, p5); + dct_trn8_8(p6, p7); + + // pass 2 + dct_trn8_16(p0, p2); + dct_trn8_16(p1, p3); + dct_trn8_16(p4, p6); + dct_trn8_16(p5, p7); + + // pass 3 + dct_trn8_32(p0, p4); + dct_trn8_32(p1, p5); + dct_trn8_32(p2, p6); + dct_trn8_32(p3, p7); + + // store + vst1_u8(out, p0); out += out_stride; + vst1_u8(out, p1); out += out_stride; + vst1_u8(out, p2); out += out_stride; + vst1_u8(out, p3); out += out_stride; + vst1_u8(out, p4); out += out_stride; + vst1_u8(out, p5); out += out_stride; + vst1_u8(out, p6); out += out_stride; + vst1_u8(out, p7); + +#undef dct_trn8_8 +#undef dct_trn8_16 +#undef dct_trn8_32 + } + +#undef dct_long_mul +#undef dct_long_mac +#undef dct_widen +#undef dct_wadd +#undef dct_wsub +#undef dct_bfly32o +#undef dct_pass +} + +#endif // STBI_NEON + +#define STBI__MARKER_none 0xff +// if there's a pending marker from the entropy stream, return that +// otherwise, fetch from the stream and get a marker. if there's no +// marker, return 0xff, which is never a valid marker value +static stbi_uc stbi__get_marker(stbi__jpeg *j) +{ + stbi_uc x; + if (j->marker != STBI__MARKER_none) { x = j->marker; j->marker = STBI__MARKER_none; return x; } + x = stbi__get8(j->s); + if (x != 0xff) return STBI__MARKER_none; + while (x == 0xff) + x = stbi__get8(j->s); // consume repeated 0xff fill bytes + return x; +} + +// in each scan, we'll have scan_n components, and the order +// of the components is specified by order[] +#define STBI__RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7) + +// after a restart interval, stbi__jpeg_reset the entropy decoder and +// the dc prediction +static void stbi__jpeg_reset(stbi__jpeg *j) +{ + j->code_bits = 0; + j->code_buffer = 0; + j->nomore = 0; + j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = j->img_comp[3].dc_pred = 0; + j->marker = STBI__MARKER_none; + j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff; + j->eob_run = 0; + // no more than 1<<31 MCUs if no restart_interal? that's plenty safe, + // since we don't even allow 1<<30 pixels +} + +static int stbi__parse_entropy_coded_data(stbi__jpeg *z) +{ + stbi__jpeg_reset(z); + if (!z->progressive) { + if (z->scan_n == 1) { + int i,j; + STBI_SIMD_ALIGN(short, data[64]); + int n = z->order[0]; + // non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = (z->img_comp[n].x+7) >> 3; + int h = (z->img_comp[n].y+7) >> 3; + for (j=0; j < h; ++j) { + for (i=0; i < w; ++i) { + int ha = z->img_comp[n].ha; + if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0; + z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data); + // every data block is an MCU, so countdown the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); + // if it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!STBI__RESTART(z->marker)) return 1; + stbi__jpeg_reset(z); + } + } + } + return 1; + } else { // interleaved + int i,j,k,x,y; + STBI_SIMD_ALIGN(short, data[64]); + for (j=0; j < z->img_mcu_y; ++j) { + for (i=0; i < z->img_mcu_x; ++i) { + // scan an interleaved mcu... process scan_n components in order + for (k=0; k < z->scan_n; ++k) { + int n = z->order[k]; + // scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (y=0; y < z->img_comp[n].v; ++y) { + for (x=0; x < z->img_comp[n].h; ++x) { + int x2 = (i*z->img_comp[n].h + x)*8; + int y2 = (j*z->img_comp[n].v + y)*8; + int ha = z->img_comp[n].ha; + if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0; + z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data); + } + } + } + // after all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); + if (!STBI__RESTART(z->marker)) return 1; + stbi__jpeg_reset(z); + } + } + } + return 1; + } + } else { + if (z->scan_n == 1) { + int i,j; + int n = z->order[0]; + // non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = (z->img_comp[n].x+7) >> 3; + int h = (z->img_comp[n].y+7) >> 3; + for (j=0; j < h; ++j) { + for (i=0; i < w; ++i) { + short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w); + if (z->spec_start == 0) { + if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) + return 0; + } else { + int ha = z->img_comp[n].ha; + if (!stbi__jpeg_decode_block_prog_ac(z, data, &z->huff_ac[ha], z->fast_ac[ha])) + return 0; + } + // every data block is an MCU, so countdown the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); + if (!STBI__RESTART(z->marker)) return 1; + stbi__jpeg_reset(z); + } + } + } + return 1; + } else { // interleaved + int i,j,k,x,y; + for (j=0; j < z->img_mcu_y; ++j) { + for (i=0; i < z->img_mcu_x; ++i) { + // scan an interleaved mcu... process scan_n components in order + for (k=0; k < z->scan_n; ++k) { + int n = z->order[k]; + // scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (y=0; y < z->img_comp[n].v; ++y) { + for (x=0; x < z->img_comp[n].h; ++x) { + int x2 = (i*z->img_comp[n].h + x); + int y2 = (j*z->img_comp[n].v + y); + short *data = z->img_comp[n].coeff + 64 * (x2 + y2 * z->img_comp[n].coeff_w); + if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) + return 0; + } + } + } + // after all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + if (--z->todo <= 0) { + if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); + if (!STBI__RESTART(z->marker)) return 1; + stbi__jpeg_reset(z); + } + } + } + return 1; + } + } +} + +static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant) +{ + int i; + for (i=0; i < 64; ++i) + data[i] *= dequant[i]; +} + +static void stbi__jpeg_finish(stbi__jpeg *z) +{ + if (z->progressive) { + // dequantize and idct the data + int i,j,n; + for (n=0; n < z->s->img_n; ++n) { + int w = (z->img_comp[n].x+7) >> 3; + int h = (z->img_comp[n].y+7) >> 3; + for (j=0; j < h; ++j) { + for (i=0; i < w; ++i) { + short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w); + stbi__jpeg_dequantize(data, z->dequant[z->img_comp[n].tq]); + z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data); + } + } + } + } +} + +static int stbi__process_marker(stbi__jpeg *z, int m) +{ + int L; + switch (m) { + case STBI__MARKER_none: // no marker found + return stbi__err("expected marker","Corrupt JPEG"); + + case 0xDD: // DRI - specify restart interval + if (stbi__get16be(z->s) != 4) return stbi__err("bad DRI len","Corrupt JPEG"); + z->restart_interval = stbi__get16be(z->s); + return 1; + + case 0xDB: // DQT - define quantization table + L = stbi__get16be(z->s)-2; + while (L > 0) { + int q = stbi__get8(z->s); + int p = q >> 4, sixteen = (p != 0); + int t = q & 15,i; + if (p != 0 && p != 1) return stbi__err("bad DQT type","Corrupt JPEG"); + if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG"); + + for (i=0; i < 64; ++i) + z->dequant[t][stbi__jpeg_dezigzag[i]] = (stbi__uint16)(sixteen ? stbi__get16be(z->s) : stbi__get8(z->s)); + L -= (sixteen ? 129 : 65); + } + return L==0; + + case 0xC4: // DHT - define huffman table + L = stbi__get16be(z->s)-2; + while (L > 0) { + stbi_uc *v; + int sizes[16],i,n=0; + int q = stbi__get8(z->s); + int tc = q >> 4; + int th = q & 15; + if (tc > 1 || th > 3) return stbi__err("bad DHT header","Corrupt JPEG"); + for (i=0; i < 16; ++i) { + sizes[i] = stbi__get8(z->s); + n += sizes[i]; + } + if(n > 256) return stbi__err("bad DHT header","Corrupt JPEG"); // Loop over i < n would write past end of values! + L -= 17; + if (tc == 0) { + if (!stbi__build_huffman(z->huff_dc+th, sizes)) return 0; + v = z->huff_dc[th].values; + } else { + if (!stbi__build_huffman(z->huff_ac+th, sizes)) return 0; + v = z->huff_ac[th].values; + } + for (i=0; i < n; ++i) + v[i] = stbi__get8(z->s); + if (tc != 0) + stbi__build_fast_ac(z->fast_ac[th], z->huff_ac + th); + L -= n; + } + return L==0; + } + + // check for comment block or APP blocks + if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) { + L = stbi__get16be(z->s); + if (L < 2) { + if (m == 0xFE) + return stbi__err("bad COM len","Corrupt JPEG"); + else + return stbi__err("bad APP len","Corrupt JPEG"); + } + L -= 2; + + if (m == 0xE0 && L >= 5) { // JFIF APP0 segment + static const unsigned char tag[5] = {'J','F','I','F','\0'}; + int ok = 1; + int i; + for (i=0; i < 5; ++i) + if (stbi__get8(z->s) != tag[i]) + ok = 0; + L -= 5; + if (ok) + z->jfif = 1; + } else if (m == 0xEE && L >= 12) { // Adobe APP14 segment + static const unsigned char tag[6] = {'A','d','o','b','e','\0'}; + int ok = 1; + int i; + for (i=0; i < 6; ++i) + if (stbi__get8(z->s) != tag[i]) + ok = 0; + L -= 6; + if (ok) { + stbi__get8(z->s); // version + stbi__get16be(z->s); // flags0 + stbi__get16be(z->s); // flags1 + z->app14_color_transform = stbi__get8(z->s); // color transform + L -= 6; + } + } + + stbi__skip(z->s, L); + return 1; + } + + return stbi__err("unknown marker","Corrupt JPEG"); +} + +// after we see SOS +static int stbi__process_scan_header(stbi__jpeg *z) +{ + int i; + int Ls = stbi__get16be(z->s); + z->scan_n = stbi__get8(z->s); + if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n) return stbi__err("bad SOS component count","Corrupt JPEG"); + if (Ls != 6+2*z->scan_n) return stbi__err("bad SOS len","Corrupt JPEG"); + for (i=0; i < z->scan_n; ++i) { + int id = stbi__get8(z->s), which; + int q = stbi__get8(z->s); + for (which = 0; which < z->s->img_n; ++which) + if (z->img_comp[which].id == id) + break; + if (which == z->s->img_n) return 0; // no match + z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return stbi__err("bad DC huff","Corrupt JPEG"); + z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return stbi__err("bad AC huff","Corrupt JPEG"); + z->order[i] = which; + } + + { + int aa; + z->spec_start = stbi__get8(z->s); + z->spec_end = stbi__get8(z->s); // should be 63, but might be 0 + aa = stbi__get8(z->s); + z->succ_high = (aa >> 4); + z->succ_low = (aa & 15); + if (z->progressive) { + if (z->spec_start > 63 || z->spec_end > 63 || z->spec_start > z->spec_end || z->succ_high > 13 || z->succ_low > 13) + return stbi__err("bad SOS", "Corrupt JPEG"); + } else { + if (z->spec_start != 0) return stbi__err("bad SOS","Corrupt JPEG"); + if (z->succ_high != 0 || z->succ_low != 0) return stbi__err("bad SOS","Corrupt JPEG"); + z->spec_end = 63; + } + } + + return 1; +} + +static int stbi__free_jpeg_components(stbi__jpeg *z, int ncomp, int why) +{ + int i; + for (i=0; i < ncomp; ++i) { + if (z->img_comp[i].raw_data) { + STBI_FREE(z->img_comp[i].raw_data); + z->img_comp[i].raw_data = NULL; + z->img_comp[i].data = NULL; + } + if (z->img_comp[i].raw_coeff) { + STBI_FREE(z->img_comp[i].raw_coeff); + z->img_comp[i].raw_coeff = 0; + z->img_comp[i].coeff = 0; + } + if (z->img_comp[i].linebuf) { + STBI_FREE(z->img_comp[i].linebuf); + z->img_comp[i].linebuf = NULL; + } + } + return why; +} + +static int stbi__process_frame_header(stbi__jpeg *z, int scan) +{ + stbi__context *s = z->s; + int Lf,p,i,q, h_max=1,v_max=1,c; + Lf = stbi__get16be(s); if (Lf < 11) return stbi__err("bad SOF len","Corrupt JPEG"); // JPEG + p = stbi__get8(s); if (p != 8) return stbi__err("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline + s->img_y = stbi__get16be(s); if (s->img_y == 0) return stbi__err("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG + s->img_x = stbi__get16be(s); if (s->img_x == 0) return stbi__err("0 width","Corrupt JPEG"); // JPEG requires + if (s->img_y > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); + if (s->img_x > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); + c = stbi__get8(s); + if (c != 3 && c != 1 && c != 4) return stbi__err("bad component count","Corrupt JPEG"); + s->img_n = c; + for (i=0; i < c; ++i) { + z->img_comp[i].data = NULL; + z->img_comp[i].linebuf = NULL; + } + + if (Lf != 8+3*s->img_n) return stbi__err("bad SOF len","Corrupt JPEG"); + + z->rgb = 0; + for (i=0; i < s->img_n; ++i) { + static const unsigned char rgb[3] = { 'R', 'G', 'B' }; + z->img_comp[i].id = stbi__get8(s); + if (s->img_n == 3 && z->img_comp[i].id == rgb[i]) + ++z->rgb; + q = stbi__get8(s); + z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return stbi__err("bad H","Corrupt JPEG"); + z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return stbi__err("bad V","Corrupt JPEG"); + z->img_comp[i].tq = stbi__get8(s); if (z->img_comp[i].tq > 3) return stbi__err("bad TQ","Corrupt JPEG"); + } + + if (scan != STBI__SCAN_load) return 1; + + if (!stbi__mad3sizes_valid(s->img_x, s->img_y, s->img_n, 0)) return stbi__err("too large", "Image too large to decode"); + + for (i=0; i < s->img_n; ++i) { + if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h; + if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v; + } + + // check that plane subsampling factors are integer ratios; our resamplers can't deal with fractional ratios + // and I've never seen a non-corrupted JPEG file actually use them + for (i=0; i < s->img_n; ++i) { + if (h_max % z->img_comp[i].h != 0) return stbi__err("bad H","Corrupt JPEG"); + if (v_max % z->img_comp[i].v != 0) return stbi__err("bad V","Corrupt JPEG"); + } + + // compute interleaved mcu info + z->img_h_max = h_max; + z->img_v_max = v_max; + z->img_mcu_w = h_max * 8; + z->img_mcu_h = v_max * 8; + // these sizes can't be more than 17 bits + z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w; + z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h; + + for (i=0; i < s->img_n; ++i) { + // number of effective pixels (e.g. for non-interleaved MCU) + z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max; + z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max; + // to simplify generation, we'll allocate enough memory to decode + // the bogus oversized data from using interleaved MCUs and their + // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't + // discard the extra data until colorspace conversion + // + // img_mcu_x, img_mcu_y: <=17 bits; comp[i].h and .v are <=4 (checked earlier) + // so these muls can't overflow with 32-bit ints (which we require) + z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8; + z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8; + z->img_comp[i].coeff = 0; + z->img_comp[i].raw_coeff = 0; + z->img_comp[i].linebuf = NULL; + z->img_comp[i].raw_data = stbi__malloc_mad2(z->img_comp[i].w2, z->img_comp[i].h2, 15); + if (z->img_comp[i].raw_data == NULL) + return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory")); + // align blocks for idct using mmx/sse + z->img_comp[i].data = (stbi_uc*) (((size_t) z->img_comp[i].raw_data + 15) & ~15); + if (z->progressive) { + // w2, h2 are multiples of 8 (see above) + z->img_comp[i].coeff_w = z->img_comp[i].w2 / 8; + z->img_comp[i].coeff_h = z->img_comp[i].h2 / 8; + z->img_comp[i].raw_coeff = stbi__malloc_mad3(z->img_comp[i].w2, z->img_comp[i].h2, sizeof(short), 15); + if (z->img_comp[i].raw_coeff == NULL) + return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory")); + z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15); + } + } + + return 1; +} + +// use comparisons since in some cases we handle more than one case (e.g. SOF) +#define stbi__DNL(x) ((x) == 0xdc) +#define stbi__SOI(x) ((x) == 0xd8) +#define stbi__EOI(x) ((x) == 0xd9) +#define stbi__SOF(x) ((x) == 0xc0 || (x) == 0xc1 || (x) == 0xc2) +#define stbi__SOS(x) ((x) == 0xda) + +#define stbi__SOF_progressive(x) ((x) == 0xc2) + +static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan) +{ + int m; + z->jfif = 0; + z->app14_color_transform = -1; // valid values are 0,1,2 + z->marker = STBI__MARKER_none; // initialize cached marker to empty + m = stbi__get_marker(z); + if (!stbi__SOI(m)) return stbi__err("no SOI","Corrupt JPEG"); + if (scan == STBI__SCAN_type) return 1; + m = stbi__get_marker(z); + while (!stbi__SOF(m)) { + if (!stbi__process_marker(z,m)) return 0; + m = stbi__get_marker(z); + while (m == STBI__MARKER_none) { + // some files have extra padding after their blocks, so ok, we'll scan + if (stbi__at_eof(z->s)) return stbi__err("no SOF", "Corrupt JPEG"); + m = stbi__get_marker(z); + } + } + z->progressive = stbi__SOF_progressive(m); + if (!stbi__process_frame_header(z, scan)) return 0; + return 1; +} + +static stbi_uc stbi__skip_jpeg_junk_at_end(stbi__jpeg *j) +{ + // some JPEGs have junk at end, skip over it but if we find what looks + // like a valid marker, resume there + while (!stbi__at_eof(j->s)) { + stbi_uc x = stbi__get8(j->s); + while (x == 0xff) { // might be a marker + if (stbi__at_eof(j->s)) return STBI__MARKER_none; + x = stbi__get8(j->s); + if (x != 0x00 && x != 0xff) { + // not a stuffed zero or lead-in to another marker, looks + // like an actual marker, return it + return x; + } + // stuffed zero has x=0 now which ends the loop, meaning we go + // back to regular scan loop. + // repeated 0xff keeps trying to read the next byte of the marker. + } + } + return STBI__MARKER_none; +} + +// decode image to YCbCr format +static int stbi__decode_jpeg_image(stbi__jpeg *j) +{ + int m; + for (m = 0; m < 4; m++) { + j->img_comp[m].raw_data = NULL; + j->img_comp[m].raw_coeff = NULL; + } + j->restart_interval = 0; + if (!stbi__decode_jpeg_header(j, STBI__SCAN_load)) return 0; + m = stbi__get_marker(j); + while (!stbi__EOI(m)) { + if (stbi__SOS(m)) { + if (!stbi__process_scan_header(j)) return 0; + if (!stbi__parse_entropy_coded_data(j)) return 0; + if (j->marker == STBI__MARKER_none ) { + j->marker = stbi__skip_jpeg_junk_at_end(j); + // if we reach eof without hitting a marker, stbi__get_marker() below will fail and we'll eventually return 0 + } + m = stbi__get_marker(j); + if (STBI__RESTART(m)) + m = stbi__get_marker(j); + } else if (stbi__DNL(m)) { + int Ld = stbi__get16be(j->s); + stbi__uint32 NL = stbi__get16be(j->s); + if (Ld != 4) return stbi__err("bad DNL len", "Corrupt JPEG"); + if (NL != j->s->img_y) return stbi__err("bad DNL height", "Corrupt JPEG"); + m = stbi__get_marker(j); + } else { + if (!stbi__process_marker(j, m)) return 1; + m = stbi__get_marker(j); + } + } + if (j->progressive) + stbi__jpeg_finish(j); + return 1; +} + +// static jfif-centered resampling (across block boundaries) + +typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_uc *in1, + int w, int hs); + +#define stbi__div4(x) ((stbi_uc) ((x) >> 2)) + +static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + STBI_NOTUSED(out); + STBI_NOTUSED(in_far); + STBI_NOTUSED(w); + STBI_NOTUSED(hs); + return in_near; +} + +static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // need to generate two samples vertically for every one in input + int i; + STBI_NOTUSED(hs); + for (i=0; i < w; ++i) + out[i] = stbi__div4(3*in_near[i] + in_far[i] + 2); + return out; +} + +static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // need to generate two samples horizontally for every one in input + int i; + stbi_uc *input = in_near; + + if (w == 1) { + // if only one sample, can't do any interpolation + out[0] = out[1] = input[0]; + return out; + } + + out[0] = input[0]; + out[1] = stbi__div4(input[0]*3 + input[1] + 2); + for (i=1; i < w-1; ++i) { + int n = 3*input[i]+2; + out[i*2+0] = stbi__div4(n+input[i-1]); + out[i*2+1] = stbi__div4(n+input[i+1]); + } + out[i*2+0] = stbi__div4(input[w-2]*3 + input[w-1] + 2); + out[i*2+1] = input[w-1]; + + STBI_NOTUSED(in_far); + STBI_NOTUSED(hs); + + return out; +} + +#define stbi__div16(x) ((stbi_uc) ((x) >> 4)) + +static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // need to generate 2x2 samples for every one in input + int i,t0,t1; + if (w == 1) { + out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2); + return out; + } + + t1 = 3*in_near[0] + in_far[0]; + out[0] = stbi__div4(t1+2); + for (i=1; i < w; ++i) { + t0 = t1; + t1 = 3*in_near[i]+in_far[i]; + out[i*2-1] = stbi__div16(3*t0 + t1 + 8); + out[i*2 ] = stbi__div16(3*t1 + t0 + 8); + } + out[w*2-1] = stbi__div4(t1+2); + + STBI_NOTUSED(hs); + + return out; +} + +#if defined(STBI_SSE2) || defined(STBI_NEON) +static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // need to generate 2x2 samples for every one in input + int i=0,t0,t1; + + if (w == 1) { + out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2); + return out; + } + + t1 = 3*in_near[0] + in_far[0]; + // process groups of 8 pixels for as long as we can. + // note we can't handle the last pixel in a row in this loop + // because we need to handle the filter boundary conditions. + for (; i < ((w-1) & ~7); i += 8) { +#if defined(STBI_SSE2) + // load and perform the vertical filtering pass + // this uses 3*x + y = 4*x + (y - x) + __m128i zero = _mm_setzero_si128(); + __m128i farb = _mm_loadl_epi64((__m128i *) (in_far + i)); + __m128i nearb = _mm_loadl_epi64((__m128i *) (in_near + i)); + __m128i farw = _mm_unpacklo_epi8(farb, zero); + __m128i nearw = _mm_unpacklo_epi8(nearb, zero); + __m128i diff = _mm_sub_epi16(farw, nearw); + __m128i nears = _mm_slli_epi16(nearw, 2); + __m128i curr = _mm_add_epi16(nears, diff); // current row + + // horizontal filter works the same based on shifted vers of current + // row. "prev" is current row shifted right by 1 pixel; we need to + // insert the previous pixel value (from t1). + // "next" is current row shifted left by 1 pixel, with first pixel + // of next block of 8 pixels added in. + __m128i prv0 = _mm_slli_si128(curr, 2); + __m128i nxt0 = _mm_srli_si128(curr, 2); + __m128i prev = _mm_insert_epi16(prv0, t1, 0); + __m128i next = _mm_insert_epi16(nxt0, 3*in_near[i+8] + in_far[i+8], 7); + + // horizontal filter, polyphase implementation since it's convenient: + // even pixels = 3*cur + prev = cur*4 + (prev - cur) + // odd pixels = 3*cur + next = cur*4 + (next - cur) + // note the shared term. + __m128i bias = _mm_set1_epi16(8); + __m128i curs = _mm_slli_epi16(curr, 2); + __m128i prvd = _mm_sub_epi16(prev, curr); + __m128i nxtd = _mm_sub_epi16(next, curr); + __m128i curb = _mm_add_epi16(curs, bias); + __m128i even = _mm_add_epi16(prvd, curb); + __m128i odd = _mm_add_epi16(nxtd, curb); + + // interleave even and odd pixels, then undo scaling. + __m128i int0 = _mm_unpacklo_epi16(even, odd); + __m128i int1 = _mm_unpackhi_epi16(even, odd); + __m128i de0 = _mm_srli_epi16(int0, 4); + __m128i de1 = _mm_srli_epi16(int1, 4); + + // pack and write output + __m128i outv = _mm_packus_epi16(de0, de1); + _mm_storeu_si128((__m128i *) (out + i*2), outv); +#elif defined(STBI_NEON) + // load and perform the vertical filtering pass + // this uses 3*x + y = 4*x + (y - x) + uint8x8_t farb = vld1_u8(in_far + i); + uint8x8_t nearb = vld1_u8(in_near + i); + int16x8_t diff = vreinterpretq_s16_u16(vsubl_u8(farb, nearb)); + int16x8_t nears = vreinterpretq_s16_u16(vshll_n_u8(nearb, 2)); + int16x8_t curr = vaddq_s16(nears, diff); // current row + + // horizontal filter works the same based on shifted vers of current + // row. "prev" is current row shifted right by 1 pixel; we need to + // insert the previous pixel value (from t1). + // "next" is current row shifted left by 1 pixel, with first pixel + // of next block of 8 pixels added in. + int16x8_t prv0 = vextq_s16(curr, curr, 7); + int16x8_t nxt0 = vextq_s16(curr, curr, 1); + int16x8_t prev = vsetq_lane_s16(t1, prv0, 0); + int16x8_t next = vsetq_lane_s16(3*in_near[i+8] + in_far[i+8], nxt0, 7); + + // horizontal filter, polyphase implementation since it's convenient: + // even pixels = 3*cur + prev = cur*4 + (prev - cur) + // odd pixels = 3*cur + next = cur*4 + (next - cur) + // note the shared term. + int16x8_t curs = vshlq_n_s16(curr, 2); + int16x8_t prvd = vsubq_s16(prev, curr); + int16x8_t nxtd = vsubq_s16(next, curr); + int16x8_t even = vaddq_s16(curs, prvd); + int16x8_t odd = vaddq_s16(curs, nxtd); + + // undo scaling and round, then store with even/odd phases interleaved + uint8x8x2_t o; + o.val[0] = vqrshrun_n_s16(even, 4); + o.val[1] = vqrshrun_n_s16(odd, 4); + vst2_u8(out + i*2, o); +#endif + + // "previous" value for next iter + t1 = 3*in_near[i+7] + in_far[i+7]; + } + + t0 = t1; + t1 = 3*in_near[i] + in_far[i]; + out[i*2] = stbi__div16(3*t1 + t0 + 8); + + for (++i; i < w; ++i) { + t0 = t1; + t1 = 3*in_near[i]+in_far[i]; + out[i*2-1] = stbi__div16(3*t0 + t1 + 8); + out[i*2 ] = stbi__div16(3*t1 + t0 + 8); + } + out[w*2-1] = stbi__div4(t1+2); + + STBI_NOTUSED(hs); + + return out; +} +#endif + +static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) +{ + // resample with nearest-neighbor + int i,j; + STBI_NOTUSED(in_far); + for (i=0; i < w; ++i) + for (j=0; j < hs; ++j) + out[i*hs+j] = in_near[i]; + return out; +} + +// this is a reduced-precision calculation of YCbCr-to-RGB introduced +// to make sure the code produces the same results in both SIMD and scalar +#define stbi__float2fixed(x) (((int) ((x) * 4096.0f + 0.5f)) << 8) +static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step) +{ + int i; + for (i=0; i < count; ++i) { + int y_fixed = (y[i] << 20) + (1<<19); // rounding + int r,g,b; + int cr = pcr[i] - 128; + int cb = pcb[i] - 128; + r = y_fixed + cr* stbi__float2fixed(1.40200f); + g = y_fixed + (cr*-stbi__float2fixed(0.71414f)) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); + b = y_fixed + cb* stbi__float2fixed(1.77200f); + r >>= 20; + g >>= 20; + b >>= 20; + if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } + if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } + if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } + out[0] = (stbi_uc)r; + out[1] = (stbi_uc)g; + out[2] = (stbi_uc)b; + out[3] = 255; + out += step; + } +} + +#if defined(STBI_SSE2) || defined(STBI_NEON) +static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi_uc const *pcb, stbi_uc const *pcr, int count, int step) +{ + int i = 0; + +#ifdef STBI_SSE2 + // step == 3 is pretty ugly on the final interleave, and i'm not convinced + // it's useful in practice (you wouldn't use it for textures, for example). + // so just accelerate step == 4 case. + if (step == 4) { + // this is a fairly straightforward implementation and not super-optimized. + __m128i signflip = _mm_set1_epi8(-0x80); + __m128i cr_const0 = _mm_set1_epi16( (short) ( 1.40200f*4096.0f+0.5f)); + __m128i cr_const1 = _mm_set1_epi16( - (short) ( 0.71414f*4096.0f+0.5f)); + __m128i cb_const0 = _mm_set1_epi16( - (short) ( 0.34414f*4096.0f+0.5f)); + __m128i cb_const1 = _mm_set1_epi16( (short) ( 1.77200f*4096.0f+0.5f)); + __m128i y_bias = _mm_set1_epi8((char) (unsigned char) 128); + __m128i xw = _mm_set1_epi16(255); // alpha channel + + for (; i+7 < count; i += 8) { + // load + __m128i y_bytes = _mm_loadl_epi64((__m128i *) (y+i)); + __m128i cr_bytes = _mm_loadl_epi64((__m128i *) (pcr+i)); + __m128i cb_bytes = _mm_loadl_epi64((__m128i *) (pcb+i)); + __m128i cr_biased = _mm_xor_si128(cr_bytes, signflip); // -128 + __m128i cb_biased = _mm_xor_si128(cb_bytes, signflip); // -128 + + // unpack to short (and left-shift cr, cb by 8) + __m128i yw = _mm_unpacklo_epi8(y_bias, y_bytes); + __m128i crw = _mm_unpacklo_epi8(_mm_setzero_si128(), cr_biased); + __m128i cbw = _mm_unpacklo_epi8(_mm_setzero_si128(), cb_biased); + + // color transform + __m128i yws = _mm_srli_epi16(yw, 4); + __m128i cr0 = _mm_mulhi_epi16(cr_const0, crw); + __m128i cb0 = _mm_mulhi_epi16(cb_const0, cbw); + __m128i cb1 = _mm_mulhi_epi16(cbw, cb_const1); + __m128i cr1 = _mm_mulhi_epi16(crw, cr_const1); + __m128i rws = _mm_add_epi16(cr0, yws); + __m128i gwt = _mm_add_epi16(cb0, yws); + __m128i bws = _mm_add_epi16(yws, cb1); + __m128i gws = _mm_add_epi16(gwt, cr1); + + // descale + __m128i rw = _mm_srai_epi16(rws, 4); + __m128i bw = _mm_srai_epi16(bws, 4); + __m128i gw = _mm_srai_epi16(gws, 4); + + // back to byte, set up for transpose + __m128i brb = _mm_packus_epi16(rw, bw); + __m128i gxb = _mm_packus_epi16(gw, xw); + + // transpose to interleave channels + __m128i t0 = _mm_unpacklo_epi8(brb, gxb); + __m128i t1 = _mm_unpackhi_epi8(brb, gxb); + __m128i o0 = _mm_unpacklo_epi16(t0, t1); + __m128i o1 = _mm_unpackhi_epi16(t0, t1); + + // store + _mm_storeu_si128((__m128i *) (out + 0), o0); + _mm_storeu_si128((__m128i *) (out + 16), o1); + out += 32; + } + } +#endif + +#ifdef STBI_NEON + // in this version, step=3 support would be easy to add. but is there demand? + if (step == 4) { + // this is a fairly straightforward implementation and not super-optimized. + uint8x8_t signflip = vdup_n_u8(0x80); + int16x8_t cr_const0 = vdupq_n_s16( (short) ( 1.40200f*4096.0f+0.5f)); + int16x8_t cr_const1 = vdupq_n_s16( - (short) ( 0.71414f*4096.0f+0.5f)); + int16x8_t cb_const0 = vdupq_n_s16( - (short) ( 0.34414f*4096.0f+0.5f)); + int16x8_t cb_const1 = vdupq_n_s16( (short) ( 1.77200f*4096.0f+0.5f)); + + for (; i+7 < count; i += 8) { + // load + uint8x8_t y_bytes = vld1_u8(y + i); + uint8x8_t cr_bytes = vld1_u8(pcr + i); + uint8x8_t cb_bytes = vld1_u8(pcb + i); + int8x8_t cr_biased = vreinterpret_s8_u8(vsub_u8(cr_bytes, signflip)); + int8x8_t cb_biased = vreinterpret_s8_u8(vsub_u8(cb_bytes, signflip)); + + // expand to s16 + int16x8_t yws = vreinterpretq_s16_u16(vshll_n_u8(y_bytes, 4)); + int16x8_t crw = vshll_n_s8(cr_biased, 7); + int16x8_t cbw = vshll_n_s8(cb_biased, 7); + + // color transform + int16x8_t cr0 = vqdmulhq_s16(crw, cr_const0); + int16x8_t cb0 = vqdmulhq_s16(cbw, cb_const0); + int16x8_t cr1 = vqdmulhq_s16(crw, cr_const1); + int16x8_t cb1 = vqdmulhq_s16(cbw, cb_const1); + int16x8_t rws = vaddq_s16(yws, cr0); + int16x8_t gws = vaddq_s16(vaddq_s16(yws, cb0), cr1); + int16x8_t bws = vaddq_s16(yws, cb1); + + // undo scaling, round, convert to byte + uint8x8x4_t o; + o.val[0] = vqrshrun_n_s16(rws, 4); + o.val[1] = vqrshrun_n_s16(gws, 4); + o.val[2] = vqrshrun_n_s16(bws, 4); + o.val[3] = vdup_n_u8(255); + + // store, interleaving r/g/b/a + vst4_u8(out, o); + out += 8*4; + } + } +#endif + + for (; i < count; ++i) { + int y_fixed = (y[i] << 20) + (1<<19); // rounding + int r,g,b; + int cr = pcr[i] - 128; + int cb = pcb[i] - 128; + r = y_fixed + cr* stbi__float2fixed(1.40200f); + g = y_fixed + cr*-stbi__float2fixed(0.71414f) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); + b = y_fixed + cb* stbi__float2fixed(1.77200f); + r >>= 20; + g >>= 20; + b >>= 20; + if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } + if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } + if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } + out[0] = (stbi_uc)r; + out[1] = (stbi_uc)g; + out[2] = (stbi_uc)b; + out[3] = 255; + out += step; + } +} +#endif + +// set up the kernels +static void stbi__setup_jpeg(stbi__jpeg *j) +{ + j->idct_block_kernel = stbi__idct_block; + j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_row; + j->resample_row_hv_2_kernel = stbi__resample_row_hv_2; + +#ifdef STBI_SSE2 + if (stbi__sse2_available()) { + j->idct_block_kernel = stbi__idct_simd; + j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd; + j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd; + } +#endif + +#ifdef STBI_NEON + j->idct_block_kernel = stbi__idct_simd; + j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd; + j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd; +#endif +} + +// clean up the temporary component buffers +static void stbi__cleanup_jpeg(stbi__jpeg *j) +{ + stbi__free_jpeg_components(j, j->s->img_n, 0); +} + +typedef struct +{ + resample_row_func resample; + stbi_uc *line0,*line1; + int hs,vs; // expansion factor in each axis + int w_lores; // horizontal pixels pre-expansion + int ystep; // how far through vertical expansion we are + int ypos; // which pre-expansion row we're on +} stbi__resample; + +// fast 0..255 * 0..255 => 0..255 rounded multiplication +static stbi_uc stbi__blinn_8x8(stbi_uc x, stbi_uc y) +{ + unsigned int t = x*y + 128; + return (stbi_uc) ((t + (t >>8)) >> 8); +} + +static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp, int req_comp) +{ + int n, decode_n, is_rgb; + z->s->img_n = 0; // make stbi__cleanup_jpeg safe + + // validate req_comp + if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); + + // load a jpeg image from whichever source, but leave in YCbCr format + if (!stbi__decode_jpeg_image(z)) { stbi__cleanup_jpeg(z); return NULL; } + + // determine actual number of components to generate + n = req_comp ? req_comp : z->s->img_n >= 3 ? 3 : 1; + + is_rgb = z->s->img_n == 3 && (z->rgb == 3 || (z->app14_color_transform == 0 && !z->jfif)); + + if (z->s->img_n == 3 && n < 3 && !is_rgb) + decode_n = 1; + else + decode_n = z->s->img_n; + + // nothing to do if no components requested; check this now to avoid + // accessing uninitialized coutput[0] later + if (decode_n <= 0) { stbi__cleanup_jpeg(z); return NULL; } + + // resample and color-convert + { + int k; + unsigned int i,j; + stbi_uc *output; + stbi_uc *coutput[4] = { NULL, NULL, NULL, NULL }; + + stbi__resample res_comp[4]; + + for (k=0; k < decode_n; ++k) { + stbi__resample *r = &res_comp[k]; + + // allocate line buffer big enough for upsampling off the edges + // with upsample factor of 4 + z->img_comp[k].linebuf = (stbi_uc *) stbi__malloc(z->s->img_x + 3); + if (!z->img_comp[k].linebuf) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); } + + r->hs = z->img_h_max / z->img_comp[k].h; + r->vs = z->img_v_max / z->img_comp[k].v; + r->ystep = r->vs >> 1; + r->w_lores = (z->s->img_x + r->hs-1) / r->hs; + r->ypos = 0; + r->line0 = r->line1 = z->img_comp[k].data; + + if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1; + else if (r->hs == 1 && r->vs == 2) r->resample = stbi__resample_row_v_2; + else if (r->hs == 2 && r->vs == 1) r->resample = stbi__resample_row_h_2; + else if (r->hs == 2 && r->vs == 2) r->resample = z->resample_row_hv_2_kernel; + else r->resample = stbi__resample_row_generic; + } + + // can't error after this so, this is safe + output = (stbi_uc *) stbi__malloc_mad3(n, z->s->img_x, z->s->img_y, 1); + if (!output) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); } + + // now go ahead and resample + for (j=0; j < z->s->img_y; ++j) { + stbi_uc *out = output + n * z->s->img_x * j; + for (k=0; k < decode_n; ++k) { + stbi__resample *r = &res_comp[k]; + int y_bot = r->ystep >= (r->vs >> 1); + coutput[k] = r->resample(z->img_comp[k].linebuf, + y_bot ? r->line1 : r->line0, + y_bot ? r->line0 : r->line1, + r->w_lores, r->hs); + if (++r->ystep >= r->vs) { + r->ystep = 0; + r->line0 = r->line1; + if (++r->ypos < z->img_comp[k].y) + r->line1 += z->img_comp[k].w2; + } + } + if (n >= 3) { + stbi_uc *y = coutput[0]; + if (z->s->img_n == 3) { + if (is_rgb) { + for (i=0; i < z->s->img_x; ++i) { + out[0] = y[i]; + out[1] = coutput[1][i]; + out[2] = coutput[2][i]; + out[3] = 255; + out += n; + } + } else { + z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); + } + } else if (z->s->img_n == 4) { + if (z->app14_color_transform == 0) { // CMYK + for (i=0; i < z->s->img_x; ++i) { + stbi_uc m = coutput[3][i]; + out[0] = stbi__blinn_8x8(coutput[0][i], m); + out[1] = stbi__blinn_8x8(coutput[1][i], m); + out[2] = stbi__blinn_8x8(coutput[2][i], m); + out[3] = 255; + out += n; + } + } else if (z->app14_color_transform == 2) { // YCCK + z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); + for (i=0; i < z->s->img_x; ++i) { + stbi_uc m = coutput[3][i]; + out[0] = stbi__blinn_8x8(255 - out[0], m); + out[1] = stbi__blinn_8x8(255 - out[1], m); + out[2] = stbi__blinn_8x8(255 - out[2], m); + out += n; + } + } else { // YCbCr + alpha? Ignore the fourth channel for now + z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); + } + } else + for (i=0; i < z->s->img_x; ++i) { + out[0] = out[1] = out[2] = y[i]; + out[3] = 255; // not used if n==3 + out += n; + } + } else { + if (is_rgb) { + if (n == 1) + for (i=0; i < z->s->img_x; ++i) + *out++ = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]); + else { + for (i=0; i < z->s->img_x; ++i, out += 2) { + out[0] = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]); + out[1] = 255; + } + } + } else if (z->s->img_n == 4 && z->app14_color_transform == 0) { + for (i=0; i < z->s->img_x; ++i) { + stbi_uc m = coutput[3][i]; + stbi_uc r = stbi__blinn_8x8(coutput[0][i], m); + stbi_uc g = stbi__blinn_8x8(coutput[1][i], m); + stbi_uc b = stbi__blinn_8x8(coutput[2][i], m); + out[0] = stbi__compute_y(r, g, b); + out[1] = 255; + out += n; + } + } else if (z->s->img_n == 4 && z->app14_color_transform == 2) { + for (i=0; i < z->s->img_x; ++i) { + out[0] = stbi__blinn_8x8(255 - coutput[0][i], coutput[3][i]); + out[1] = 255; + out += n; + } + } else { + stbi_uc *y = coutput[0]; + if (n == 1) + for (i=0; i < z->s->img_x; ++i) out[i] = y[i]; + else + for (i=0; i < z->s->img_x; ++i) { *out++ = y[i]; *out++ = 255; } + } + } + } + stbi__cleanup_jpeg(z); + *out_x = z->s->img_x; + *out_y = z->s->img_y; + if (comp) *comp = z->s->img_n >= 3 ? 3 : 1; // report original components, not output + return output; + } +} + +static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + unsigned char* result; + stbi__jpeg* j = (stbi__jpeg*) stbi__malloc(sizeof(stbi__jpeg)); + if (!j) return stbi__errpuc("outofmem", "Out of memory"); + memset(j, 0, sizeof(stbi__jpeg)); + STBI_NOTUSED(ri); + j->s = s; + stbi__setup_jpeg(j); + result = load_jpeg_image(j, x,y,comp,req_comp); + STBI_FREE(j); + return result; +} + +static int stbi__jpeg_test(stbi__context *s) +{ + int r; + stbi__jpeg* j = (stbi__jpeg*)stbi__malloc(sizeof(stbi__jpeg)); + if (!j) return stbi__err("outofmem", "Out of memory"); + memset(j, 0, sizeof(stbi__jpeg)); + j->s = s; + stbi__setup_jpeg(j); + r = stbi__decode_jpeg_header(j, STBI__SCAN_type); + stbi__rewind(s); + STBI_FREE(j); + return r; +} + +static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp) +{ + if (!stbi__decode_jpeg_header(j, STBI__SCAN_header)) { + stbi__rewind( j->s ); + return 0; + } + if (x) *x = j->s->img_x; + if (y) *y = j->s->img_y; + if (comp) *comp = j->s->img_n >= 3 ? 3 : 1; + return 1; +} + +static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp) +{ + int result; + stbi__jpeg* j = (stbi__jpeg*) (stbi__malloc(sizeof(stbi__jpeg))); + if (!j) return stbi__err("outofmem", "Out of memory"); + memset(j, 0, sizeof(stbi__jpeg)); + j->s = s; + result = stbi__jpeg_info_raw(j, x, y, comp); + STBI_FREE(j); + return result; +} +#endif + +// public domain zlib decode v0.2 Sean Barrett 2006-11-18 +// simple implementation +// - all input must be provided in an upfront buffer +// - all output is written to a single output buffer (can malloc/realloc) +// performance +// - fast huffman + +#ifndef STBI_NO_ZLIB + +// fast-way is faster to check than jpeg huffman, but slow way is slower +#define STBI__ZFAST_BITS 9 // accelerate all cases in default tables +#define STBI__ZFAST_MASK ((1 << STBI__ZFAST_BITS) - 1) +#define STBI__ZNSYMS 288 // number of symbols in literal/length alphabet + +// zlib-style huffman encoding +// (jpegs packs from left, zlib from right, so can't share code) +typedef struct +{ + stbi__uint16 fast[1 << STBI__ZFAST_BITS]; + stbi__uint16 firstcode[16]; + int maxcode[17]; + stbi__uint16 firstsymbol[16]; + stbi_uc size[STBI__ZNSYMS]; + stbi__uint16 value[STBI__ZNSYMS]; +} stbi__zhuffman; + +stbi_inline static int stbi__bitreverse16(int n) +{ + n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1); + n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2); + n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4); + n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8); + return n; +} + +stbi_inline static int stbi__bit_reverse(int v, int bits) +{ + STBI_ASSERT(bits <= 16); + // to bit reverse n bits, reverse 16 and shift + // e.g. 11 bits, bit reverse and shift away 5 + return stbi__bitreverse16(v) >> (16-bits); +} + +static int stbi__zbuild_huffman(stbi__zhuffman *z, const stbi_uc *sizelist, int num) +{ + int i,k=0; + int code, next_code[16], sizes[17]; + + // DEFLATE spec for generating codes + memset(sizes, 0, sizeof(sizes)); + memset(z->fast, 0, sizeof(z->fast)); + for (i=0; i < num; ++i) + ++sizes[sizelist[i]]; + sizes[0] = 0; + for (i=1; i < 16; ++i) + if (sizes[i] > (1 << i)) + return stbi__err("bad sizes", "Corrupt PNG"); + code = 0; + for (i=1; i < 16; ++i) { + next_code[i] = code; + z->firstcode[i] = (stbi__uint16) code; + z->firstsymbol[i] = (stbi__uint16) k; + code = (code + sizes[i]); + if (sizes[i]) + if (code-1 >= (1 << i)) return stbi__err("bad codelengths","Corrupt PNG"); + z->maxcode[i] = code << (16-i); // preshift for inner loop + code <<= 1; + k += sizes[i]; + } + z->maxcode[16] = 0x10000; // sentinel + for (i=0; i < num; ++i) { + int s = sizelist[i]; + if (s) { + int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s]; + stbi__uint16 fastv = (stbi__uint16) ((s << 9) | i); + z->size [c] = (stbi_uc ) s; + z->value[c] = (stbi__uint16) i; + if (s <= STBI__ZFAST_BITS) { + int j = stbi__bit_reverse(next_code[s],s); + while (j < (1 << STBI__ZFAST_BITS)) { + z->fast[j] = fastv; + j += (1 << s); + } + } + ++next_code[s]; + } + } + return 1; +} + +// zlib-from-memory implementation for PNG reading +// because PNG allows splitting the zlib stream arbitrarily, +// and it's annoying structurally to have PNG call ZLIB call PNG, +// we require PNG read all the IDATs and combine them into a single +// memory buffer + +typedef struct +{ + stbi_uc *zbuffer, *zbuffer_end; + int num_bits; + int hit_zeof_once; + stbi__uint32 code_buffer; + + char *zout; + char *zout_start; + char *zout_end; + int z_expandable; + + stbi__zhuffman z_length, z_distance; +} stbi__zbuf; + +stbi_inline static int stbi__zeof(stbi__zbuf *z) +{ + return (z->zbuffer >= z->zbuffer_end); +} + +stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z) +{ + return stbi__zeof(z) ? 0 : *z->zbuffer++; +} + +static void stbi__fill_bits(stbi__zbuf *z) +{ + do { + if (z->code_buffer >= (1U << z->num_bits)) { + z->zbuffer = z->zbuffer_end; /* treat this as EOF so we fail. */ + return; + } + z->code_buffer |= (unsigned int) stbi__zget8(z) << z->num_bits; + z->num_bits += 8; + } while (z->num_bits <= 24); +} + +stbi_inline static unsigned int stbi__zreceive(stbi__zbuf *z, int n) +{ + unsigned int k; + if (z->num_bits < n) stbi__fill_bits(z); + k = z->code_buffer & ((1 << n) - 1); + z->code_buffer >>= n; + z->num_bits -= n; + return k; +} + +static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z) +{ + int b,s,k; + // not resolved by fast table, so compute it the slow way + // use jpeg approach, which requires MSbits at top + k = stbi__bit_reverse(a->code_buffer, 16); + for (s=STBI__ZFAST_BITS+1; ; ++s) + if (k < z->maxcode[s]) + break; + if (s >= 16) return -1; // invalid code! + // code size is s, so: + b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s]; + if (b >= STBI__ZNSYMS) return -1; // some data was corrupt somewhere! + if (z->size[b] != s) return -1; // was originally an assert, but report failure instead. + a->code_buffer >>= s; + a->num_bits -= s; + return z->value[b]; +} + +stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffman *z) +{ + int b,s; + if (a->num_bits < 16) { + if (stbi__zeof(a)) { + if (!a->hit_zeof_once) { + // This is the first time we hit eof, insert 16 extra padding btis + // to allow us to keep going; if we actually consume any of them + // though, that is invalid data. This is caught later. + a->hit_zeof_once = 1; + a->num_bits += 16; // add 16 implicit zero bits + } else { + // We already inserted our extra 16 padding bits and are again + // out, this stream is actually prematurely terminated. + return -1; + } + } else { + stbi__fill_bits(a); + } + } + b = z->fast[a->code_buffer & STBI__ZFAST_MASK]; + if (b) { + s = b >> 9; + a->code_buffer >>= s; + a->num_bits -= s; + return b & 511; + } + return stbi__zhuffman_decode_slowpath(a, z); +} + +static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) // need to make room for n bytes +{ + char *q; + unsigned int cur, limit, old_limit; + z->zout = zout; + if (!z->z_expandable) return stbi__err("output buffer limit","Corrupt PNG"); + cur = (unsigned int) (z->zout - z->zout_start); + limit = old_limit = (unsigned) (z->zout_end - z->zout_start); + if (UINT_MAX - cur < (unsigned) n) return stbi__err("outofmem", "Out of memory"); + while (cur + n > limit) { + if(limit > UINT_MAX / 2) return stbi__err("outofmem", "Out of memory"); + limit *= 2; + } + q = (char *) STBI_REALLOC_SIZED(z->zout_start, old_limit, limit); + STBI_NOTUSED(old_limit); + if (q == NULL) return stbi__err("outofmem", "Out of memory"); + z->zout_start = q; + z->zout = q + cur; + z->zout_end = q + limit; + return 1; +} + +static const int stbi__zlength_base[31] = { + 3,4,5,6,7,8,9,10,11,13, + 15,17,19,23,27,31,35,43,51,59, + 67,83,99,115,131,163,195,227,258,0,0 }; + +static const int stbi__zlength_extra[31]= +{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; + +static const int stbi__zdist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, +257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; + +static const int stbi__zdist_extra[32] = +{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +static int stbi__parse_huffman_block(stbi__zbuf *a) +{ + char *zout = a->zout; + for(;;) { + int z = stbi__zhuffman_decode(a, &a->z_length); + if (z < 256) { + if (z < 0) return stbi__err("bad huffman code","Corrupt PNG"); // error in huffman codes + if (zout >= a->zout_end) { + if (!stbi__zexpand(a, zout, 1)) return 0; + zout = a->zout; + } + *zout++ = (char) z; + } else { + stbi_uc *p; + int len,dist; + if (z == 256) { + a->zout = zout; + if (a->hit_zeof_once && a->num_bits < 16) { + // The first time we hit zeof, we inserted 16 extra zero bits into our bit + // buffer so the decoder can just do its speculative decoding. But if we + // actually consumed any of those bits (which is the case when num_bits < 16), + // the stream actually read past the end so it is malformed. + return stbi__err("unexpected end","Corrupt PNG"); + } + return 1; + } + if (z >= 286) return stbi__err("bad huffman code","Corrupt PNG"); // per DEFLATE, length codes 286 and 287 must not appear in compressed data + z -= 257; + len = stbi__zlength_base[z]; + if (stbi__zlength_extra[z]) len += stbi__zreceive(a, stbi__zlength_extra[z]); + z = stbi__zhuffman_decode(a, &a->z_distance); + if (z < 0 || z >= 30) return stbi__err("bad huffman code","Corrupt PNG"); // per DEFLATE, distance codes 30 and 31 must not appear in compressed data + dist = stbi__zdist_base[z]; + if (stbi__zdist_extra[z]) dist += stbi__zreceive(a, stbi__zdist_extra[z]); + if (zout - a->zout_start < dist) return stbi__err("bad dist","Corrupt PNG"); + if (len > a->zout_end - zout) { + if (!stbi__zexpand(a, zout, len)) return 0; + zout = a->zout; + } + p = (stbi_uc *) (zout - dist); + if (dist == 1) { // run of one byte; common in images. + stbi_uc v = *p; + if (len) { do *zout++ = v; while (--len); } + } else { + if (len) { do *zout++ = *p++; while (--len); } + } + } + } +} + +static int stbi__compute_huffman_codes(stbi__zbuf *a) +{ + static const stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; + stbi__zhuffman z_codelength; + stbi_uc lencodes[286+32+137];//padding for maximum single op + stbi_uc codelength_sizes[19]; + int i,n; + + int hlit = stbi__zreceive(a,5) + 257; + int hdist = stbi__zreceive(a,5) + 1; + int hclen = stbi__zreceive(a,4) + 4; + int ntot = hlit + hdist; + + memset(codelength_sizes, 0, sizeof(codelength_sizes)); + for (i=0; i < hclen; ++i) { + int s = stbi__zreceive(a,3); + codelength_sizes[length_dezigzag[i]] = (stbi_uc) s; + } + if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; + + n = 0; + while (n < ntot) { + int c = stbi__zhuffman_decode(a, &z_codelength); + if (c < 0 || c >= 19) return stbi__err("bad codelengths", "Corrupt PNG"); + if (c < 16) + lencodes[n++] = (stbi_uc) c; + else { + stbi_uc fill = 0; + if (c == 16) { + c = stbi__zreceive(a,2)+3; + if (n == 0) return stbi__err("bad codelengths", "Corrupt PNG"); + fill = lencodes[n-1]; + } else if (c == 17) { + c = stbi__zreceive(a,3)+3; + } else if (c == 18) { + c = stbi__zreceive(a,7)+11; + } else { + return stbi__err("bad codelengths", "Corrupt PNG"); + } + if (ntot - n < c) return stbi__err("bad codelengths", "Corrupt PNG"); + memset(lencodes+n, fill, c); + n += c; + } + } + if (n != ntot) return stbi__err("bad codelengths","Corrupt PNG"); + if (!stbi__zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; + if (!stbi__zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; + return 1; +} + +static int stbi__parse_uncompressed_block(stbi__zbuf *a) +{ + stbi_uc header[4]; + int len,nlen,k; + if (a->num_bits & 7) + stbi__zreceive(a, a->num_bits & 7); // discard + // drain the bit-packed data into header + k = 0; + while (a->num_bits > 0) { + header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check + a->code_buffer >>= 8; + a->num_bits -= 8; + } + if (a->num_bits < 0) return stbi__err("zlib corrupt","Corrupt PNG"); + // now fill header the normal way + while (k < 4) + header[k++] = stbi__zget8(a); + len = header[1] * 256 + header[0]; + nlen = header[3] * 256 + header[2]; + if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG"); + if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG"); + if (a->zout + len > a->zout_end) + if (!stbi__zexpand(a, a->zout, len)) return 0; + memcpy(a->zout, a->zbuffer, len); + a->zbuffer += len; + a->zout += len; + return 1; +} + +static int stbi__parse_zlib_header(stbi__zbuf *a) +{ + int cmf = stbi__zget8(a); + int cm = cmf & 15; + /* int cinfo = cmf >> 4; */ + int flg = stbi__zget8(a); + if (stbi__zeof(a)) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec + if ((cmf*256+flg) % 31 != 0) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec + if (flg & 32) return stbi__err("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png + if (cm != 8) return stbi__err("bad compression","Corrupt PNG"); // DEFLATE required for png + // window = 1 << (8 + cinfo)... but who cares, we fully buffer output + return 1; +} + +static const stbi_uc stbi__zdefault_length[STBI__ZNSYMS] = +{ + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8 +}; +static const stbi_uc stbi__zdefault_distance[32] = +{ + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 +}; +/* +Init algorithm: +{ + int i; // use <= to match clearly with spec + for (i=0; i <= 143; ++i) stbi__zdefault_length[i] = 8; + for ( ; i <= 255; ++i) stbi__zdefault_length[i] = 9; + for ( ; i <= 279; ++i) stbi__zdefault_length[i] = 7; + for ( ; i <= 287; ++i) stbi__zdefault_length[i] = 8; + + for (i=0; i <= 31; ++i) stbi__zdefault_distance[i] = 5; +} +*/ + +static int stbi__parse_zlib(stbi__zbuf *a, int parse_header) +{ + int final, type; + if (parse_header) + if (!stbi__parse_zlib_header(a)) return 0; + a->num_bits = 0; + a->code_buffer = 0; + a->hit_zeof_once = 0; + do { + final = stbi__zreceive(a,1); + type = stbi__zreceive(a,2); + if (type == 0) { + if (!stbi__parse_uncompressed_block(a)) return 0; + } else if (type == 3) { + return 0; + } else { + if (type == 1) { + // use fixed code lengths + if (!stbi__zbuild_huffman(&a->z_length , stbi__zdefault_length , STBI__ZNSYMS)) return 0; + if (!stbi__zbuild_huffman(&a->z_distance, stbi__zdefault_distance, 32)) return 0; + } else { + if (!stbi__compute_huffman_codes(a)) return 0; + } + if (!stbi__parse_huffman_block(a)) return 0; + } + } while (!final); + return 1; +} + +static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, int parse_header) +{ + a->zout_start = obuf; + a->zout = obuf; + a->zout_end = obuf + olen; + a->z_expandable = exp; + + return stbi__parse_zlib(a, parse_header); +} + +STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen) +{ + stbi__zbuf a; + char *p = (char *) stbi__malloc(initial_size); + if (p == NULL) return NULL; + a.zbuffer = (stbi_uc *) buffer; + a.zbuffer_end = (stbi_uc *) buffer + len; + if (stbi__do_zlib(&a, p, initial_size, 1, 1)) { + if (outlen) *outlen = (int) (a.zout - a.zout_start); + return a.zout_start; + } else { + STBI_FREE(a.zout_start); + return NULL; + } +} + +STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen) +{ + return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen); +} + +STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header) +{ + stbi__zbuf a; + char *p = (char *) stbi__malloc(initial_size); + if (p == NULL) return NULL; + a.zbuffer = (stbi_uc *) buffer; + a.zbuffer_end = (stbi_uc *) buffer + len; + if (stbi__do_zlib(&a, p, initial_size, 1, parse_header)) { + if (outlen) *outlen = (int) (a.zout - a.zout_start); + return a.zout_start; + } else { + STBI_FREE(a.zout_start); + return NULL; + } +} + +STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen) +{ + stbi__zbuf a; + a.zbuffer = (stbi_uc *) ibuffer; + a.zbuffer_end = (stbi_uc *) ibuffer + ilen; + if (stbi__do_zlib(&a, obuffer, olen, 0, 1)) + return (int) (a.zout - a.zout_start); + else + return -1; +} + +STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen) +{ + stbi__zbuf a; + char *p = (char *) stbi__malloc(16384); + if (p == NULL) return NULL; + a.zbuffer = (stbi_uc *) buffer; + a.zbuffer_end = (stbi_uc *) buffer+len; + if (stbi__do_zlib(&a, p, 16384, 1, 0)) { + if (outlen) *outlen = (int) (a.zout - a.zout_start); + return a.zout_start; + } else { + STBI_FREE(a.zout_start); + return NULL; + } +} + +STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen) +{ + stbi__zbuf a; + a.zbuffer = (stbi_uc *) ibuffer; + a.zbuffer_end = (stbi_uc *) ibuffer + ilen; + if (stbi__do_zlib(&a, obuffer, olen, 0, 0)) + return (int) (a.zout - a.zout_start); + else + return -1; +} +#endif + +// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18 +// simple implementation +// - only 8-bit samples +// - no CRC checking +// - allocates lots of intermediate memory +// - avoids problem of streaming data between subsystems +// - avoids explicit window management +// performance +// - uses stb_zlib, a PD zlib implementation with fast huffman decoding + +#ifndef STBI_NO_PNG +typedef struct +{ + stbi__uint32 length; + stbi__uint32 type; +} stbi__pngchunk; + +static stbi__pngchunk stbi__get_chunk_header(stbi__context *s) +{ + stbi__pngchunk c; + c.length = stbi__get32be(s); + c.type = stbi__get32be(s); + return c; +} + +static int stbi__check_png_header(stbi__context *s) +{ + static const stbi_uc png_sig[8] = { 137,80,78,71,13,10,26,10 }; + int i; + for (i=0; i < 8; ++i) + if (stbi__get8(s) != png_sig[i]) return stbi__err("bad png sig","Not a PNG"); + return 1; +} + +typedef struct +{ + stbi__context *s; + stbi_uc *idata, *expanded, *out; + int depth; +} stbi__png; + + +enum { + STBI__F_none=0, + STBI__F_sub=1, + STBI__F_up=2, + STBI__F_avg=3, + STBI__F_paeth=4, + // synthetic filter used for first scanline to avoid needing a dummy row of 0s + STBI__F_avg_first +}; + +static stbi_uc first_row_filter[5] = +{ + STBI__F_none, + STBI__F_sub, + STBI__F_none, + STBI__F_avg_first, + STBI__F_sub // Paeth with b=c=0 turns out to be equivalent to sub +}; + +static int stbi__paeth(int a, int b, int c) +{ + // This formulation looks very different from the reference in the PNG spec, but is + // actually equivalent and has favorable data dependencies and admits straightforward + // generation of branch-free code, which helps performance significantly. + int thresh = c*3 - (a + b); + int lo = a < b ? a : b; + int hi = a < b ? b : a; + int t0 = (hi <= thresh) ? lo : c; + int t1 = (thresh <= lo) ? hi : t0; + return t1; +} + +static const stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 }; + +// adds an extra all-255 alpha channel +// dest == src is legal +// img_n must be 1 or 3 +static void stbi__create_png_alpha_expand8(stbi_uc *dest, stbi_uc *src, stbi__uint32 x, int img_n) +{ + int i; + // must process data backwards since we allow dest==src + if (img_n == 1) { + for (i=x-1; i >= 0; --i) { + dest[i*2+1] = 255; + dest[i*2+0] = src[i]; + } + } else { + STBI_ASSERT(img_n == 3); + for (i=x-1; i >= 0; --i) { + dest[i*4+3] = 255; + dest[i*4+2] = src[i*3+2]; + dest[i*4+1] = src[i*3+1]; + dest[i*4+0] = src[i*3+0]; + } + } +} + +// create the png data from post-deflated data +static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color) +{ + int bytes = (depth == 16 ? 2 : 1); + stbi__context *s = a->s; + stbi__uint32 i,j,stride = x*out_n*bytes; + stbi__uint32 img_len, img_width_bytes; + stbi_uc *filter_buf; + int all_ok = 1; + int k; + int img_n = s->img_n; // copy it into a local for later + + int output_bytes = out_n*bytes; + int filter_bytes = img_n*bytes; + int width = x; + + STBI_ASSERT(out_n == s->img_n || out_n == s->img_n+1); + a->out = (stbi_uc *) stbi__malloc_mad3(x, y, output_bytes, 0); // extra bytes to write off the end into + if (!a->out) return stbi__err("outofmem", "Out of memory"); + + // note: error exits here don't need to clean up a->out individually, + // stbi__do_png always does on error. + if (!stbi__mad3sizes_valid(img_n, x, depth, 7)) return stbi__err("too large", "Corrupt PNG"); + img_width_bytes = (((img_n * x * depth) + 7) >> 3); + if (!stbi__mad2sizes_valid(img_width_bytes, y, img_width_bytes)) return stbi__err("too large", "Corrupt PNG"); + img_len = (img_width_bytes + 1) * y; + + // we used to check for exact match between raw_len and img_len on non-interlaced PNGs, + // but issue #276 reported a PNG in the wild that had extra data at the end (all zeros), + // so just check for raw_len < img_len always. + if (raw_len < img_len) return stbi__err("not enough pixels","Corrupt PNG"); + + // Allocate two scan lines worth of filter workspace buffer. + filter_buf = (stbi_uc *) stbi__malloc_mad2(img_width_bytes, 2, 0); + if (!filter_buf) return stbi__err("outofmem", "Out of memory"); + + // Filtering for low-bit-depth images + if (depth < 8) { + filter_bytes = 1; + width = img_width_bytes; + } + + for (j=0; j < y; ++j) { + // cur/prior filter buffers alternate + stbi_uc *cur = filter_buf + (j & 1)*img_width_bytes; + stbi_uc *prior = filter_buf + (~j & 1)*img_width_bytes; + stbi_uc *dest = a->out + stride*j; + int nk = width * filter_bytes; + int filter = *raw++; + + // check filter type + if (filter > 4) { + all_ok = stbi__err("invalid filter","Corrupt PNG"); + break; + } + + // if first row, use special filter that doesn't sample previous row + if (j == 0) filter = first_row_filter[filter]; + + // perform actual filtering + switch (filter) { + case STBI__F_none: + memcpy(cur, raw, nk); + break; + case STBI__F_sub: + memcpy(cur, raw, filter_bytes); + for (k = filter_bytes; k < nk; ++k) + cur[k] = STBI__BYTECAST(raw[k] + cur[k-filter_bytes]); + break; + case STBI__F_up: + for (k = 0; k < nk; ++k) + cur[k] = STBI__BYTECAST(raw[k] + prior[k]); + break; + case STBI__F_avg: + for (k = 0; k < filter_bytes; ++k) + cur[k] = STBI__BYTECAST(raw[k] + (prior[k]>>1)); + for (k = filter_bytes; k < nk; ++k) + cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-filter_bytes])>>1)); + break; + case STBI__F_paeth: + for (k = 0; k < filter_bytes; ++k) + cur[k] = STBI__BYTECAST(raw[k] + prior[k]); // prior[k] == stbi__paeth(0,prior[k],0) + for (k = filter_bytes; k < nk; ++k) + cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes], prior[k], prior[k-filter_bytes])); + break; + case STBI__F_avg_first: + memcpy(cur, raw, filter_bytes); + for (k = filter_bytes; k < nk; ++k) + cur[k] = STBI__BYTECAST(raw[k] + (cur[k-filter_bytes] >> 1)); + break; + } + + raw += nk; + + // expand decoded bits in cur to dest, also adding an extra alpha channel if desired + if (depth < 8) { + stbi_uc scale = (color == 0) ? stbi__depth_scale_table[depth] : 1; // scale grayscale values to 0..255 range + stbi_uc *in = cur; + stbi_uc *out = dest; + stbi_uc inb = 0; + stbi__uint32 nsmp = x*img_n; + + // expand bits to bytes first + if (depth == 4) { + for (i=0; i < nsmp; ++i) { + if ((i & 1) == 0) inb = *in++; + *out++ = scale * (inb >> 4); + inb <<= 4; + } + } else if (depth == 2) { + for (i=0; i < nsmp; ++i) { + if ((i & 3) == 0) inb = *in++; + *out++ = scale * (inb >> 6); + inb <<= 2; + } + } else { + STBI_ASSERT(depth == 1); + for (i=0; i < nsmp; ++i) { + if ((i & 7) == 0) inb = *in++; + *out++ = scale * (inb >> 7); + inb <<= 1; + } + } + + // insert alpha=255 values if desired + if (img_n != out_n) + stbi__create_png_alpha_expand8(dest, dest, x, img_n); + } else if (depth == 8) { + if (img_n == out_n) + memcpy(dest, cur, x*img_n); + else + stbi__create_png_alpha_expand8(dest, cur, x, img_n); + } else if (depth == 16) { + // convert the image data from big-endian to platform-native + stbi__uint16 *dest16 = (stbi__uint16*)dest; + stbi__uint32 nsmp = x*img_n; + + if (img_n == out_n) { + for (i = 0; i < nsmp; ++i, ++dest16, cur += 2) + *dest16 = (cur[0] << 8) | cur[1]; + } else { + STBI_ASSERT(img_n+1 == out_n); + if (img_n == 1) { + for (i = 0; i < x; ++i, dest16 += 2, cur += 2) { + dest16[0] = (cur[0] << 8) | cur[1]; + dest16[1] = 0xffff; + } + } else { + STBI_ASSERT(img_n == 3); + for (i = 0; i < x; ++i, dest16 += 4, cur += 6) { + dest16[0] = (cur[0] << 8) | cur[1]; + dest16[1] = (cur[2] << 8) | cur[3]; + dest16[2] = (cur[4] << 8) | cur[5]; + dest16[3] = 0xffff; + } + } + } + } + } + + STBI_FREE(filter_buf); + if (!all_ok) return 0; + + return 1; +} + +static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stbi__uint32 image_data_len, int out_n, int depth, int color, int interlaced) +{ + int bytes = (depth == 16 ? 2 : 1); + int out_bytes = out_n * bytes; + stbi_uc *final; + int p; + if (!interlaced) + return stbi__create_png_image_raw(a, image_data, image_data_len, out_n, a->s->img_x, a->s->img_y, depth, color); + + // de-interlacing + final = (stbi_uc *) stbi__malloc_mad3(a->s->img_x, a->s->img_y, out_bytes, 0); + if (!final) return stbi__err("outofmem", "Out of memory"); + for (p=0; p < 7; ++p) { + int xorig[] = { 0,4,0,2,0,1,0 }; + int yorig[] = { 0,0,4,0,2,0,1 }; + int xspc[] = { 8,8,4,4,2,2,1 }; + int yspc[] = { 8,8,8,4,4,2,2 }; + int i,j,x,y; + // pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1 + x = (a->s->img_x - xorig[p] + xspc[p]-1) / xspc[p]; + y = (a->s->img_y - yorig[p] + yspc[p]-1) / yspc[p]; + if (x && y) { + stbi__uint32 img_len = ((((a->s->img_n * x * depth) + 7) >> 3) + 1) * y; + if (!stbi__create_png_image_raw(a, image_data, image_data_len, out_n, x, y, depth, color)) { + STBI_FREE(final); + return 0; + } + for (j=0; j < y; ++j) { + for (i=0; i < x; ++i) { + int out_y = j*yspc[p]+yorig[p]; + int out_x = i*xspc[p]+xorig[p]; + memcpy(final + out_y*a->s->img_x*out_bytes + out_x*out_bytes, + a->out + (j*x+i)*out_bytes, out_bytes); + } + } + STBI_FREE(a->out); + image_data += img_len; + image_data_len -= img_len; + } + } + a->out = final; + + return 1; +} + +static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int out_n) +{ + stbi__context *s = z->s; + stbi__uint32 i, pixel_count = s->img_x * s->img_y; + stbi_uc *p = z->out; + + // compute color-based transparency, assuming we've + // already got 255 as the alpha value in the output + STBI_ASSERT(out_n == 2 || out_n == 4); + + if (out_n == 2) { + for (i=0; i < pixel_count; ++i) { + p[1] = (p[0] == tc[0] ? 0 : 255); + p += 2; + } + } else { + for (i=0; i < pixel_count; ++i) { + if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) + p[3] = 0; + p += 4; + } + } + return 1; +} + +static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], int out_n) +{ + stbi__context *s = z->s; + stbi__uint32 i, pixel_count = s->img_x * s->img_y; + stbi__uint16 *p = (stbi__uint16*) z->out; + + // compute color-based transparency, assuming we've + // already got 65535 as the alpha value in the output + STBI_ASSERT(out_n == 2 || out_n == 4); + + if (out_n == 2) { + for (i = 0; i < pixel_count; ++i) { + p[1] = (p[0] == tc[0] ? 0 : 65535); + p += 2; + } + } else { + for (i = 0; i < pixel_count; ++i) { + if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) + p[3] = 0; + p += 4; + } + } + return 1; +} + +static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n) +{ + stbi__uint32 i, pixel_count = a->s->img_x * a->s->img_y; + stbi_uc *p, *temp_out, *orig = a->out; + + p = (stbi_uc *) stbi__malloc_mad2(pixel_count, pal_img_n, 0); + if (p == NULL) return stbi__err("outofmem", "Out of memory"); + + // between here and free(out) below, exitting would leak + temp_out = p; + + if (pal_img_n == 3) { + for (i=0; i < pixel_count; ++i) { + int n = orig[i]*4; + p[0] = palette[n ]; + p[1] = palette[n+1]; + p[2] = palette[n+2]; + p += 3; + } + } else { + for (i=0; i < pixel_count; ++i) { + int n = orig[i]*4; + p[0] = palette[n ]; + p[1] = palette[n+1]; + p[2] = palette[n+2]; + p[3] = palette[n+3]; + p += 4; + } + } + STBI_FREE(a->out); + a->out = temp_out; + + STBI_NOTUSED(len); + + return 1; +} + +static int stbi__unpremultiply_on_load_global = 0; +static int stbi__de_iphone_flag_global = 0; + +STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply) +{ + stbi__unpremultiply_on_load_global = flag_true_if_should_unpremultiply; +} + +STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert) +{ + stbi__de_iphone_flag_global = flag_true_if_should_convert; +} + +#ifndef STBI_THREAD_LOCAL +#define stbi__unpremultiply_on_load stbi__unpremultiply_on_load_global +#define stbi__de_iphone_flag stbi__de_iphone_flag_global +#else +static STBI_THREAD_LOCAL int stbi__unpremultiply_on_load_local, stbi__unpremultiply_on_load_set; +static STBI_THREAD_LOCAL int stbi__de_iphone_flag_local, stbi__de_iphone_flag_set; + +STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply) +{ + stbi__unpremultiply_on_load_local = flag_true_if_should_unpremultiply; + stbi__unpremultiply_on_load_set = 1; +} + +STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert) +{ + stbi__de_iphone_flag_local = flag_true_if_should_convert; + stbi__de_iphone_flag_set = 1; +} + +#define stbi__unpremultiply_on_load (stbi__unpremultiply_on_load_set \ + ? stbi__unpremultiply_on_load_local \ + : stbi__unpremultiply_on_load_global) +#define stbi__de_iphone_flag (stbi__de_iphone_flag_set \ + ? stbi__de_iphone_flag_local \ + : stbi__de_iphone_flag_global) +#endif // STBI_THREAD_LOCAL + +static void stbi__de_iphone(stbi__png *z) +{ + stbi__context *s = z->s; + stbi__uint32 i, pixel_count = s->img_x * s->img_y; + stbi_uc *p = z->out; + + if (s->img_out_n == 3) { // convert bgr to rgb + for (i=0; i < pixel_count; ++i) { + stbi_uc t = p[0]; + p[0] = p[2]; + p[2] = t; + p += 3; + } + } else { + STBI_ASSERT(s->img_out_n == 4); + if (stbi__unpremultiply_on_load) { + // convert bgr to rgb and unpremultiply + for (i=0; i < pixel_count; ++i) { + stbi_uc a = p[3]; + stbi_uc t = p[0]; + if (a) { + stbi_uc half = a / 2; + p[0] = (p[2] * 255 + half) / a; + p[1] = (p[1] * 255 + half) / a; + p[2] = ( t * 255 + half) / a; + } else { + p[0] = p[2]; + p[2] = t; + } + p += 4; + } + } else { + // convert bgr to rgb + for (i=0; i < pixel_count; ++i) { + stbi_uc t = p[0]; + p[0] = p[2]; + p[2] = t; + p += 4; + } + } + } +} + +#define STBI__PNG_TYPE(a,b,c,d) (((unsigned) (a) << 24) + ((unsigned) (b) << 16) + ((unsigned) (c) << 8) + (unsigned) (d)) + +static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp) +{ + stbi_uc palette[1024], pal_img_n=0; + stbi_uc has_trans=0, tc[3]={0}; + stbi__uint16 tc16[3]; + stbi__uint32 ioff=0, idata_limit=0, i, pal_len=0; + int first=1,k,interlace=0, color=0, is_iphone=0; + stbi__context *s = z->s; + + z->expanded = NULL; + z->idata = NULL; + z->out = NULL; + + if (!stbi__check_png_header(s)) return 0; + + if (scan == STBI__SCAN_type) return 1; + + for (;;) { + stbi__pngchunk c = stbi__get_chunk_header(s); + switch (c.type) { + case STBI__PNG_TYPE('C','g','B','I'): + is_iphone = 1; + stbi__skip(s, c.length); + break; + case STBI__PNG_TYPE('I','H','D','R'): { + int comp,filter; + if (!first) return stbi__err("multiple IHDR","Corrupt PNG"); + first = 0; + if (c.length != 13) return stbi__err("bad IHDR len","Corrupt PNG"); + s->img_x = stbi__get32be(s); + s->img_y = stbi__get32be(s); + if (s->img_y > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); + if (s->img_x > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); + z->depth = stbi__get8(s); if (z->depth != 1 && z->depth != 2 && z->depth != 4 && z->depth != 8 && z->depth != 16) return stbi__err("1/2/4/8/16-bit only","PNG not supported: 1/2/4/8/16-bit only"); + color = stbi__get8(s); if (color > 6) return stbi__err("bad ctype","Corrupt PNG"); + if (color == 3 && z->depth == 16) return stbi__err("bad ctype","Corrupt PNG"); + if (color == 3) pal_img_n = 3; else if (color & 1) return stbi__err("bad ctype","Corrupt PNG"); + comp = stbi__get8(s); if (comp) return stbi__err("bad comp method","Corrupt PNG"); + filter= stbi__get8(s); if (filter) return stbi__err("bad filter method","Corrupt PNG"); + interlace = stbi__get8(s); if (interlace>1) return stbi__err("bad interlace method","Corrupt PNG"); + if (!s->img_x || !s->img_y) return stbi__err("0-pixel image","Corrupt PNG"); + if (!pal_img_n) { + s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0); + if ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err("too large", "Image too large to decode"); + } else { + // if paletted, then pal_n is our final components, and + // img_n is # components to decompress/filter. + s->img_n = 1; + if ((1 << 30) / s->img_x / 4 < s->img_y) return stbi__err("too large","Corrupt PNG"); + } + // even with SCAN_header, have to scan to see if we have a tRNS + break; + } + + case STBI__PNG_TYPE('P','L','T','E'): { + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (c.length > 256*3) return stbi__err("invalid PLTE","Corrupt PNG"); + pal_len = c.length / 3; + if (pal_len * 3 != c.length) return stbi__err("invalid PLTE","Corrupt PNG"); + for (i=0; i < pal_len; ++i) { + palette[i*4+0] = stbi__get8(s); + palette[i*4+1] = stbi__get8(s); + palette[i*4+2] = stbi__get8(s); + palette[i*4+3] = 255; + } + break; + } + + case STBI__PNG_TYPE('t','R','N','S'): { + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (z->idata) return stbi__err("tRNS after IDAT","Corrupt PNG"); + if (pal_img_n) { + if (scan == STBI__SCAN_header) { s->img_n = 4; return 1; } + if (pal_len == 0) return stbi__err("tRNS before PLTE","Corrupt PNG"); + if (c.length > pal_len) return stbi__err("bad tRNS len","Corrupt PNG"); + pal_img_n = 4; + for (i=0; i < c.length; ++i) + palette[i*4+3] = stbi__get8(s); + } else { + if (!(s->img_n & 1)) return stbi__err("tRNS with alpha","Corrupt PNG"); + if (c.length != (stbi__uint32) s->img_n*2) return stbi__err("bad tRNS len","Corrupt PNG"); + has_trans = 1; + // non-paletted with tRNS = constant alpha. if header-scanning, we can stop now. + if (scan == STBI__SCAN_header) { ++s->img_n; return 1; } + if (z->depth == 16) { + for (k = 0; k < s->img_n && k < 3; ++k) // extra loop test to suppress false GCC warning + tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is + } else { + for (k = 0; k < s->img_n && k < 3; ++k) + tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger + } + } + break; + } + + case STBI__PNG_TYPE('I','D','A','T'): { + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG"); + if (scan == STBI__SCAN_header) { + // header scan definitely stops at first IDAT + if (pal_img_n) + s->img_n = pal_img_n; + return 1; + } + if (c.length > (1u << 30)) return stbi__err("IDAT size limit", "IDAT section larger than 2^30 bytes"); + if ((int)(ioff + c.length) < (int)ioff) return 0; + if (ioff + c.length > idata_limit) { + stbi__uint32 idata_limit_old = idata_limit; + stbi_uc *p; + if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096; + while (ioff + c.length > idata_limit) + idata_limit *= 2; + STBI_NOTUSED(idata_limit_old); + p = (stbi_uc *) STBI_REALLOC_SIZED(z->idata, idata_limit_old, idata_limit); if (p == NULL) return stbi__err("outofmem", "Out of memory"); + z->idata = p; + } + if (!stbi__getn(s, z->idata+ioff,c.length)) return stbi__err("outofdata","Corrupt PNG"); + ioff += c.length; + break; + } + + case STBI__PNG_TYPE('I','E','N','D'): { + stbi__uint32 raw_len, bpl; + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if (scan != STBI__SCAN_load) return 1; + if (z->idata == NULL) return stbi__err("no IDAT","Corrupt PNG"); + // initial guess for decoded data size to avoid unnecessary reallocs + bpl = (s->img_x * z->depth + 7) / 8; // bytes per line, per component + raw_len = bpl * s->img_y * s->img_n /* pixels */ + s->img_y /* filter mode per row */; + z->expanded = (stbi_uc *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, raw_len, (int *) &raw_len, !is_iphone); + if (z->expanded == NULL) return 0; // zlib should set error + STBI_FREE(z->idata); z->idata = NULL; + if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans) + s->img_out_n = s->img_n+1; + else + s->img_out_n = s->img_n; + if (!stbi__create_png_image(z, z->expanded, raw_len, s->img_out_n, z->depth, color, interlace)) return 0; + if (has_trans) { + if (z->depth == 16) { + if (!stbi__compute_transparency16(z, tc16, s->img_out_n)) return 0; + } else { + if (!stbi__compute_transparency(z, tc, s->img_out_n)) return 0; + } + } + if (is_iphone && stbi__de_iphone_flag && s->img_out_n > 2) + stbi__de_iphone(z); + if (pal_img_n) { + // pal_img_n == 3 or 4 + s->img_n = pal_img_n; // record the actual colors we had + s->img_out_n = pal_img_n; + if (req_comp >= 3) s->img_out_n = req_comp; + if (!stbi__expand_png_palette(z, palette, pal_len, s->img_out_n)) + return 0; + } else if (has_trans) { + // non-paletted image with tRNS -> source image has (constant) alpha + ++s->img_n; + } + STBI_FREE(z->expanded); z->expanded = NULL; + // end of PNG chunk, read and skip CRC + stbi__get32be(s); + return 1; + } + + default: + // if critical, fail + if (first) return stbi__err("first not IHDR", "Corrupt PNG"); + if ((c.type & (1 << 29)) == 0) { + #ifndef STBI_NO_FAILURE_STRINGS + // not threadsafe + static char invalid_chunk[] = "XXXX PNG chunk not known"; + invalid_chunk[0] = STBI__BYTECAST(c.type >> 24); + invalid_chunk[1] = STBI__BYTECAST(c.type >> 16); + invalid_chunk[2] = STBI__BYTECAST(c.type >> 8); + invalid_chunk[3] = STBI__BYTECAST(c.type >> 0); + #endif + return stbi__err(invalid_chunk, "PNG not supported: unknown PNG chunk type"); + } + stbi__skip(s, c.length); + break; + } + // end of PNG chunk, read and skip CRC + stbi__get32be(s); + } +} + +static void *stbi__do_png(stbi__png *p, int *x, int *y, int *n, int req_comp, stbi__result_info *ri) +{ + void *result=NULL; + if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); + if (stbi__parse_png_file(p, STBI__SCAN_load, req_comp)) { + if (p->depth <= 8) + ri->bits_per_channel = 8; + else if (p->depth == 16) + ri->bits_per_channel = 16; + else + return stbi__errpuc("bad bits_per_channel", "PNG not supported: unsupported color depth"); + result = p->out; + p->out = NULL; + if (req_comp && req_comp != p->s->img_out_n) { + if (ri->bits_per_channel == 8) + result = stbi__convert_format((unsigned char *) result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y); + else + result = stbi__convert_format16((stbi__uint16 *) result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y); + p->s->img_out_n = req_comp; + if (result == NULL) return result; + } + *x = p->s->img_x; + *y = p->s->img_y; + if (n) *n = p->s->img_n; + } + STBI_FREE(p->out); p->out = NULL; + STBI_FREE(p->expanded); p->expanded = NULL; + STBI_FREE(p->idata); p->idata = NULL; + + return result; +} + +static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + stbi__png p; + p.s = s; + return stbi__do_png(&p, x,y,comp,req_comp, ri); +} + +static int stbi__png_test(stbi__context *s) +{ + int r; + r = stbi__check_png_header(s); + stbi__rewind(s); + return r; +} + +static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp) +{ + if (!stbi__parse_png_file(p, STBI__SCAN_header, 0)) { + stbi__rewind( p->s ); + return 0; + } + if (x) *x = p->s->img_x; + if (y) *y = p->s->img_y; + if (comp) *comp = p->s->img_n; + return 1; +} + +static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp) +{ + stbi__png p; + p.s = s; + return stbi__png_info_raw(&p, x, y, comp); +} + +static int stbi__png_is16(stbi__context *s) +{ + stbi__png p; + p.s = s; + if (!stbi__png_info_raw(&p, NULL, NULL, NULL)) + return 0; + if (p.depth != 16) { + stbi__rewind(p.s); + return 0; + } + return 1; +} +#endif + +// Microsoft/Windows BMP image + +#ifndef STBI_NO_BMP +static int stbi__bmp_test_raw(stbi__context *s) +{ + int r; + int sz; + if (stbi__get8(s) != 'B') return 0; + if (stbi__get8(s) != 'M') return 0; + stbi__get32le(s); // discard filesize + stbi__get16le(s); // discard reserved + stbi__get16le(s); // discard reserved + stbi__get32le(s); // discard data offset + sz = stbi__get32le(s); + r = (sz == 12 || sz == 40 || sz == 56 || sz == 108 || sz == 124); + return r; +} + +static int stbi__bmp_test(stbi__context *s) +{ + int r = stbi__bmp_test_raw(s); + stbi__rewind(s); + return r; +} + + +// returns 0..31 for the highest set bit +static int stbi__high_bit(unsigned int z) +{ + int n=0; + if (z == 0) return -1; + if (z >= 0x10000) { n += 16; z >>= 16; } + if (z >= 0x00100) { n += 8; z >>= 8; } + if (z >= 0x00010) { n += 4; z >>= 4; } + if (z >= 0x00004) { n += 2; z >>= 2; } + if (z >= 0x00002) { n += 1;/* >>= 1;*/ } + return n; +} + +static int stbi__bitcount(unsigned int a) +{ + a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2 + a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4 + a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits + a = (a + (a >> 8)); // max 16 per 8 bits + a = (a + (a >> 16)); // max 32 per 8 bits + return a & 0xff; +} + +// extract an arbitrarily-aligned N-bit value (N=bits) +// from v, and then make it 8-bits long and fractionally +// extend it to full full range. +static int stbi__shiftsigned(unsigned int v, int shift, int bits) +{ + static unsigned int mul_table[9] = { + 0, + 0xff/*0b11111111*/, 0x55/*0b01010101*/, 0x49/*0b01001001*/, 0x11/*0b00010001*/, + 0x21/*0b00100001*/, 0x41/*0b01000001*/, 0x81/*0b10000001*/, 0x01/*0b00000001*/, + }; + static unsigned int shift_table[9] = { + 0, 0,0,1,0,2,4,6,0, + }; + if (shift < 0) + v <<= -shift; + else + v >>= shift; + STBI_ASSERT(v < 256); + v >>= (8-bits); + STBI_ASSERT(bits >= 0 && bits <= 8); + return (int) ((unsigned) v * mul_table[bits]) >> shift_table[bits]; +} + +typedef struct +{ + int bpp, offset, hsz; + unsigned int mr,mg,mb,ma, all_a; + int extra_read; +} stbi__bmp_data; + +static int stbi__bmp_set_mask_defaults(stbi__bmp_data *info, int compress) +{ + // BI_BITFIELDS specifies masks explicitly, don't override + if (compress == 3) + return 1; + + if (compress == 0) { + if (info->bpp == 16) { + info->mr = 31u << 10; + info->mg = 31u << 5; + info->mb = 31u << 0; + } else if (info->bpp == 32) { + info->mr = 0xffu << 16; + info->mg = 0xffu << 8; + info->mb = 0xffu << 0; + info->ma = 0xffu << 24; + info->all_a = 0; // if all_a is 0 at end, then we loaded alpha channel but it was all 0 + } else { + // otherwise, use defaults, which is all-0 + info->mr = info->mg = info->mb = info->ma = 0; + } + return 1; + } + return 0; // error +} + +static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) +{ + int hsz; + if (stbi__get8(s) != 'B' || stbi__get8(s) != 'M') return stbi__errpuc("not BMP", "Corrupt BMP"); + stbi__get32le(s); // discard filesize + stbi__get16le(s); // discard reserved + stbi__get16le(s); // discard reserved + info->offset = stbi__get32le(s); + info->hsz = hsz = stbi__get32le(s); + info->mr = info->mg = info->mb = info->ma = 0; + info->extra_read = 14; + + if (info->offset < 0) return stbi__errpuc("bad BMP", "bad BMP"); + + if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) return stbi__errpuc("unknown BMP", "BMP type not supported: unknown"); + if (hsz == 12) { + s->img_x = stbi__get16le(s); + s->img_y = stbi__get16le(s); + } else { + s->img_x = stbi__get32le(s); + s->img_y = stbi__get32le(s); + } + if (stbi__get16le(s) != 1) return stbi__errpuc("bad BMP", "bad BMP"); + info->bpp = stbi__get16le(s); + if (hsz != 12) { + int compress = stbi__get32le(s); + if (compress == 1 || compress == 2) return stbi__errpuc("BMP RLE", "BMP type not supported: RLE"); + if (compress >= 4) return stbi__errpuc("BMP JPEG/PNG", "BMP type not supported: unsupported compression"); // this includes PNG/JPEG modes + if (compress == 3 && info->bpp != 16 && info->bpp != 32) return stbi__errpuc("bad BMP", "bad BMP"); // bitfields requires 16 or 32 bits/pixel + stbi__get32le(s); // discard sizeof + stbi__get32le(s); // discard hres + stbi__get32le(s); // discard vres + stbi__get32le(s); // discard colorsused + stbi__get32le(s); // discard max important + if (hsz == 40 || hsz == 56) { + if (hsz == 56) { + stbi__get32le(s); + stbi__get32le(s); + stbi__get32le(s); + stbi__get32le(s); + } + if (info->bpp == 16 || info->bpp == 32) { + if (compress == 0) { + stbi__bmp_set_mask_defaults(info, compress); + } else if (compress == 3) { + info->mr = stbi__get32le(s); + info->mg = stbi__get32le(s); + info->mb = stbi__get32le(s); + info->extra_read += 12; + // not documented, but generated by photoshop and handled by mspaint + if (info->mr == info->mg && info->mg == info->mb) { + // ?!?!? + return stbi__errpuc("bad BMP", "bad BMP"); + } + } else + return stbi__errpuc("bad BMP", "bad BMP"); + } + } else { + // V4/V5 header + int i; + if (hsz != 108 && hsz != 124) + return stbi__errpuc("bad BMP", "bad BMP"); + info->mr = stbi__get32le(s); + info->mg = stbi__get32le(s); + info->mb = stbi__get32le(s); + info->ma = stbi__get32le(s); + if (compress != 3) // override mr/mg/mb unless in BI_BITFIELDS mode, as per docs + stbi__bmp_set_mask_defaults(info, compress); + stbi__get32le(s); // discard color space + for (i=0; i < 12; ++i) + stbi__get32le(s); // discard color space parameters + if (hsz == 124) { + stbi__get32le(s); // discard rendering intent + stbi__get32le(s); // discard offset of profile data + stbi__get32le(s); // discard size of profile data + stbi__get32le(s); // discard reserved + } + } + } + return (void *) 1; +} + + +static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + stbi_uc *out; + unsigned int mr=0,mg=0,mb=0,ma=0, all_a; + stbi_uc pal[256][4]; + int psize=0,i,j,width; + int flip_vertically, pad, target; + stbi__bmp_data info; + STBI_NOTUSED(ri); + + info.all_a = 255; + if (stbi__bmp_parse_header(s, &info) == NULL) + return NULL; // error code already set + + flip_vertically = ((int) s->img_y) > 0; + s->img_y = abs((int) s->img_y); + + if (s->img_y > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + if (s->img_x > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + + mr = info.mr; + mg = info.mg; + mb = info.mb; + ma = info.ma; + all_a = info.all_a; + + if (info.hsz == 12) { + if (info.bpp < 24) + psize = (info.offset - info.extra_read - 24) / 3; + } else { + if (info.bpp < 16) + psize = (info.offset - info.extra_read - info.hsz) >> 2; + } + if (psize == 0) { + // accept some number of extra bytes after the header, but if the offset points either to before + // the header ends or implies a large amount of extra data, reject the file as malformed + int bytes_read_so_far = s->callback_already_read + (int)(s->img_buffer - s->img_buffer_original); + int header_limit = 1024; // max we actually read is below 256 bytes currently. + int extra_data_limit = 256*4; // what ordinarily goes here is a palette; 256 entries*4 bytes is its max size. + if (bytes_read_so_far <= 0 || bytes_read_so_far > header_limit) { + return stbi__errpuc("bad header", "Corrupt BMP"); + } + // we established that bytes_read_so_far is positive and sensible. + // the first half of this test rejects offsets that are either too small positives, or + // negative, and guarantees that info.offset >= bytes_read_so_far > 0. this in turn + // ensures the number computed in the second half of the test can't overflow. + if (info.offset < bytes_read_so_far || info.offset - bytes_read_so_far > extra_data_limit) { + return stbi__errpuc("bad offset", "Corrupt BMP"); + } else { + stbi__skip(s, info.offset - bytes_read_so_far); + } + } + + if (info.bpp == 24 && ma == 0xff000000) + s->img_n = 3; + else + s->img_n = ma ? 4 : 3; + if (req_comp && req_comp >= 3) // we can directly decode 3 or 4 + target = req_comp; + else + target = s->img_n; // if they want monochrome, we'll post-convert + + // sanity-check size + if (!stbi__mad3sizes_valid(target, s->img_x, s->img_y, 0)) + return stbi__errpuc("too large", "Corrupt BMP"); + + out = (stbi_uc *) stbi__malloc_mad3(target, s->img_x, s->img_y, 0); + if (!out) return stbi__errpuc("outofmem", "Out of memory"); + if (info.bpp < 16) { + int z=0; + if (psize == 0 || psize > 256) { STBI_FREE(out); return stbi__errpuc("invalid", "Corrupt BMP"); } + for (i=0; i < psize; ++i) { + pal[i][2] = stbi__get8(s); + pal[i][1] = stbi__get8(s); + pal[i][0] = stbi__get8(s); + if (info.hsz != 12) stbi__get8(s); + pal[i][3] = 255; + } + stbi__skip(s, info.offset - info.extra_read - info.hsz - psize * (info.hsz == 12 ? 3 : 4)); + if (info.bpp == 1) width = (s->img_x + 7) >> 3; + else if (info.bpp == 4) width = (s->img_x + 1) >> 1; + else if (info.bpp == 8) width = s->img_x; + else { STBI_FREE(out); return stbi__errpuc("bad bpp", "Corrupt BMP"); } + pad = (-width)&3; + if (info.bpp == 1) { + for (j=0; j < (int) s->img_y; ++j) { + int bit_offset = 7, v = stbi__get8(s); + for (i=0; i < (int) s->img_x; ++i) { + int color = (v>>bit_offset)&0x1; + out[z++] = pal[color][0]; + out[z++] = pal[color][1]; + out[z++] = pal[color][2]; + if (target == 4) out[z++] = 255; + if (i+1 == (int) s->img_x) break; + if((--bit_offset) < 0) { + bit_offset = 7; + v = stbi__get8(s); + } + } + stbi__skip(s, pad); + } + } else { + for (j=0; j < (int) s->img_y; ++j) { + for (i=0; i < (int) s->img_x; i += 2) { + int v=stbi__get8(s),v2=0; + if (info.bpp == 4) { + v2 = v & 15; + v >>= 4; + } + out[z++] = pal[v][0]; + out[z++] = pal[v][1]; + out[z++] = pal[v][2]; + if (target == 4) out[z++] = 255; + if (i+1 == (int) s->img_x) break; + v = (info.bpp == 8) ? stbi__get8(s) : v2; + out[z++] = pal[v][0]; + out[z++] = pal[v][1]; + out[z++] = pal[v][2]; + if (target == 4) out[z++] = 255; + } + stbi__skip(s, pad); + } + } + } else { + int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0; + int z = 0; + int easy=0; + stbi__skip(s, info.offset - info.extra_read - info.hsz); + if (info.bpp == 24) width = 3 * s->img_x; + else if (info.bpp == 16) width = 2*s->img_x; + else /* bpp = 32 and pad = 0 */ width=0; + pad = (-width) & 3; + if (info.bpp == 24) { + easy = 1; + } else if (info.bpp == 32) { + if (mb == 0xff && mg == 0xff00 && mr == 0x00ff0000 && ma == 0xff000000) + easy = 2; + } + if (!easy) { + if (!mr || !mg || !mb) { STBI_FREE(out); return stbi__errpuc("bad masks", "Corrupt BMP"); } + // right shift amt to put high bit in position #7 + rshift = stbi__high_bit(mr)-7; rcount = stbi__bitcount(mr); + gshift = stbi__high_bit(mg)-7; gcount = stbi__bitcount(mg); + bshift = stbi__high_bit(mb)-7; bcount = stbi__bitcount(mb); + ashift = stbi__high_bit(ma)-7; acount = stbi__bitcount(ma); + if (rcount > 8 || gcount > 8 || bcount > 8 || acount > 8) { STBI_FREE(out); return stbi__errpuc("bad masks", "Corrupt BMP"); } + } + for (j=0; j < (int) s->img_y; ++j) { + if (easy) { + for (i=0; i < (int) s->img_x; ++i) { + unsigned char a; + out[z+2] = stbi__get8(s); + out[z+1] = stbi__get8(s); + out[z+0] = stbi__get8(s); + z += 3; + a = (easy == 2 ? stbi__get8(s) : 255); + all_a |= a; + if (target == 4) out[z++] = a; + } + } else { + int bpp = info.bpp; + for (i=0; i < (int) s->img_x; ++i) { + stbi__uint32 v = (bpp == 16 ? (stbi__uint32) stbi__get16le(s) : stbi__get32le(s)); + unsigned int a; + out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mr, rshift, rcount)); + out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mg, gshift, gcount)); + out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mb, bshift, bcount)); + a = (ma ? stbi__shiftsigned(v & ma, ashift, acount) : 255); + all_a |= a; + if (target == 4) out[z++] = STBI__BYTECAST(a); + } + } + stbi__skip(s, pad); + } + } + + // if alpha channel is all 0s, replace with all 255s + if (target == 4 && all_a == 0) + for (i=4*s->img_x*s->img_y-1; i >= 0; i -= 4) + out[i] = 255; + + if (flip_vertically) { + stbi_uc t; + for (j=0; j < (int) s->img_y>>1; ++j) { + stbi_uc *p1 = out + j *s->img_x*target; + stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target; + for (i=0; i < (int) s->img_x*target; ++i) { + t = p1[i]; p1[i] = p2[i]; p2[i] = t; + } + } + } + + if (req_comp && req_comp != target) { + out = stbi__convert_format(out, target, req_comp, s->img_x, s->img_y); + if (out == NULL) return out; // stbi__convert_format frees input on failure + } + + *x = s->img_x; + *y = s->img_y; + if (comp) *comp = s->img_n; + return out; +} +#endif + +// Targa Truevision - TGA +// by Jonathan Dummer +#ifndef STBI_NO_TGA +// returns STBI_rgb or whatever, 0 on error +static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16) +{ + // only RGB or RGBA (incl. 16bit) or grey allowed + if (is_rgb16) *is_rgb16 = 0; + switch(bits_per_pixel) { + case 8: return STBI_grey; + case 16: if(is_grey) return STBI_grey_alpha; + // fallthrough + case 15: if(is_rgb16) *is_rgb16 = 1; + return STBI_rgb; + case 24: // fallthrough + case 32: return bits_per_pixel/8; + default: return 0; + } +} + +static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp) +{ + int tga_w, tga_h, tga_comp, tga_image_type, tga_bits_per_pixel, tga_colormap_bpp; + int sz, tga_colormap_type; + stbi__get8(s); // discard Offset + tga_colormap_type = stbi__get8(s); // colormap type + if( tga_colormap_type > 1 ) { + stbi__rewind(s); + return 0; // only RGB or indexed allowed + } + tga_image_type = stbi__get8(s); // image type + if ( tga_colormap_type == 1 ) { // colormapped (paletted) image + if (tga_image_type != 1 && tga_image_type != 9) { + stbi__rewind(s); + return 0; + } + stbi__skip(s,4); // skip index of first colormap entry and number of entries + sz = stbi__get8(s); // check bits per palette color entry + if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) { + stbi__rewind(s); + return 0; + } + stbi__skip(s,4); // skip image x and y origin + tga_colormap_bpp = sz; + } else { // "normal" image w/o colormap - only RGB or grey allowed, +/- RLE + if ( (tga_image_type != 2) && (tga_image_type != 3) && (tga_image_type != 10) && (tga_image_type != 11) ) { + stbi__rewind(s); + return 0; // only RGB or grey allowed, +/- RLE + } + stbi__skip(s,9); // skip colormap specification and image x/y origin + tga_colormap_bpp = 0; + } + tga_w = stbi__get16le(s); + if( tga_w < 1 ) { + stbi__rewind(s); + return 0; // test width + } + tga_h = stbi__get16le(s); + if( tga_h < 1 ) { + stbi__rewind(s); + return 0; // test height + } + tga_bits_per_pixel = stbi__get8(s); // bits per pixel + stbi__get8(s); // ignore alpha bits + if (tga_colormap_bpp != 0) { + if((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16)) { + // when using a colormap, tga_bits_per_pixel is the size of the indexes + // I don't think anything but 8 or 16bit indexes makes sense + stbi__rewind(s); + return 0; + } + tga_comp = stbi__tga_get_comp(tga_colormap_bpp, 0, NULL); + } else { + tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3) || (tga_image_type == 11), NULL); + } + if(!tga_comp) { + stbi__rewind(s); + return 0; + } + if (x) *x = tga_w; + if (y) *y = tga_h; + if (comp) *comp = tga_comp; + return 1; // seems to have passed everything +} + +static int stbi__tga_test(stbi__context *s) +{ + int res = 0; + int sz, tga_color_type; + stbi__get8(s); // discard Offset + tga_color_type = stbi__get8(s); // color type + if ( tga_color_type > 1 ) goto errorEnd; // only RGB or indexed allowed + sz = stbi__get8(s); // image type + if ( tga_color_type == 1 ) { // colormapped (paletted) image + if (sz != 1 && sz != 9) goto errorEnd; // colortype 1 demands image type 1 or 9 + stbi__skip(s,4); // skip index of first colormap entry and number of entries + sz = stbi__get8(s); // check bits per palette color entry + if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd; + stbi__skip(s,4); // skip image x and y origin + } else { // "normal" image w/o colormap + if ( (sz != 2) && (sz != 3) && (sz != 10) && (sz != 11) ) goto errorEnd; // only RGB or grey allowed, +/- RLE + stbi__skip(s,9); // skip colormap specification and image x/y origin + } + if ( stbi__get16le(s) < 1 ) goto errorEnd; // test width + if ( stbi__get16le(s) < 1 ) goto errorEnd; // test height + sz = stbi__get8(s); // bits per pixel + if ( (tga_color_type == 1) && (sz != 8) && (sz != 16) ) goto errorEnd; // for colormapped images, bpp is size of an index + if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd; + + res = 1; // if we got this far, everything's good and we can return 1 instead of 0 + +errorEnd: + stbi__rewind(s); + return res; +} + +// read 16bit value and convert to 24bit RGB +static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out) +{ + stbi__uint16 px = (stbi__uint16)stbi__get16le(s); + stbi__uint16 fiveBitMask = 31; + // we have 3 channels with 5bits each + int r = (px >> 10) & fiveBitMask; + int g = (px >> 5) & fiveBitMask; + int b = px & fiveBitMask; + // Note that this saves the data in RGB(A) order, so it doesn't need to be swapped later + out[0] = (stbi_uc)((r * 255)/31); + out[1] = (stbi_uc)((g * 255)/31); + out[2] = (stbi_uc)((b * 255)/31); + + // some people claim that the most significant bit might be used for alpha + // (possibly if an alpha-bit is set in the "image descriptor byte") + // but that only made 16bit test images completely translucent.. + // so let's treat all 15 and 16bit TGAs as RGB with no alpha. +} + +static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + // read in the TGA header stuff + int tga_offset = stbi__get8(s); + int tga_indexed = stbi__get8(s); + int tga_image_type = stbi__get8(s); + int tga_is_RLE = 0; + int tga_palette_start = stbi__get16le(s); + int tga_palette_len = stbi__get16le(s); + int tga_palette_bits = stbi__get8(s); + int tga_x_origin = stbi__get16le(s); + int tga_y_origin = stbi__get16le(s); + int tga_width = stbi__get16le(s); + int tga_height = stbi__get16le(s); + int tga_bits_per_pixel = stbi__get8(s); + int tga_comp, tga_rgb16=0; + int tga_inverted = stbi__get8(s); + // int tga_alpha_bits = tga_inverted & 15; // the 4 lowest bits - unused (useless?) + // image data + unsigned char *tga_data; + unsigned char *tga_palette = NULL; + int i, j; + unsigned char raw_data[4] = {0}; + int RLE_count = 0; + int RLE_repeating = 0; + int read_next_pixel = 1; + STBI_NOTUSED(ri); + STBI_NOTUSED(tga_x_origin); // @TODO + STBI_NOTUSED(tga_y_origin); // @TODO + + if (tga_height > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + if (tga_width > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + + // do a tiny bit of precessing + if ( tga_image_type >= 8 ) + { + tga_image_type -= 8; + tga_is_RLE = 1; + } + tga_inverted = 1 - ((tga_inverted >> 5) & 1); + + // If I'm paletted, then I'll use the number of bits from the palette + if ( tga_indexed ) tga_comp = stbi__tga_get_comp(tga_palette_bits, 0, &tga_rgb16); + else tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3), &tga_rgb16); + + if(!tga_comp) // shouldn't really happen, stbi__tga_test() should have ensured basic consistency + return stbi__errpuc("bad format", "Can't find out TGA pixelformat"); + + // tga info + *x = tga_width; + *y = tga_height; + if (comp) *comp = tga_comp; + + if (!stbi__mad3sizes_valid(tga_width, tga_height, tga_comp, 0)) + return stbi__errpuc("too large", "Corrupt TGA"); + + tga_data = (unsigned char*)stbi__malloc_mad3(tga_width, tga_height, tga_comp, 0); + if (!tga_data) return stbi__errpuc("outofmem", "Out of memory"); + + // skip to the data's starting position (offset usually = 0) + stbi__skip(s, tga_offset ); + + if ( !tga_indexed && !tga_is_RLE && !tga_rgb16 ) { + for (i=0; i < tga_height; ++i) { + int row = tga_inverted ? tga_height -i - 1 : i; + stbi_uc *tga_row = tga_data + row*tga_width*tga_comp; + stbi__getn(s, tga_row, tga_width * tga_comp); + } + } else { + // do I need to load a palette? + if ( tga_indexed) + { + if (tga_palette_len == 0) { /* you have to have at least one entry! */ + STBI_FREE(tga_data); + return stbi__errpuc("bad palette", "Corrupt TGA"); + } + + // any data to skip? (offset usually = 0) + stbi__skip(s, tga_palette_start ); + // load the palette + tga_palette = (unsigned char*)stbi__malloc_mad2(tga_palette_len, tga_comp, 0); + if (!tga_palette) { + STBI_FREE(tga_data); + return stbi__errpuc("outofmem", "Out of memory"); + } + if (tga_rgb16) { + stbi_uc *pal_entry = tga_palette; + STBI_ASSERT(tga_comp == STBI_rgb); + for (i=0; i < tga_palette_len; ++i) { + stbi__tga_read_rgb16(s, pal_entry); + pal_entry += tga_comp; + } + } else if (!stbi__getn(s, tga_palette, tga_palette_len * tga_comp)) { + STBI_FREE(tga_data); + STBI_FREE(tga_palette); + return stbi__errpuc("bad palette", "Corrupt TGA"); + } + } + // load the data + for (i=0; i < tga_width * tga_height; ++i) + { + // if I'm in RLE mode, do I need to get a RLE stbi__pngchunk? + if ( tga_is_RLE ) + { + if ( RLE_count == 0 ) + { + // yep, get the next byte as a RLE command + int RLE_cmd = stbi__get8(s); + RLE_count = 1 + (RLE_cmd & 127); + RLE_repeating = RLE_cmd >> 7; + read_next_pixel = 1; + } else if ( !RLE_repeating ) + { + read_next_pixel = 1; + } + } else + { + read_next_pixel = 1; + } + // OK, if I need to read a pixel, do it now + if ( read_next_pixel ) + { + // load however much data we did have + if ( tga_indexed ) + { + // read in index, then perform the lookup + int pal_idx = (tga_bits_per_pixel == 8) ? stbi__get8(s) : stbi__get16le(s); + if ( pal_idx >= tga_palette_len ) { + // invalid index + pal_idx = 0; + } + pal_idx *= tga_comp; + for (j = 0; j < tga_comp; ++j) { + raw_data[j] = tga_palette[pal_idx+j]; + } + } else if(tga_rgb16) { + STBI_ASSERT(tga_comp == STBI_rgb); + stbi__tga_read_rgb16(s, raw_data); + } else { + // read in the data raw + for (j = 0; j < tga_comp; ++j) { + raw_data[j] = stbi__get8(s); + } + } + // clear the reading flag for the next pixel + read_next_pixel = 0; + } // end of reading a pixel + + // copy data + for (j = 0; j < tga_comp; ++j) + tga_data[i*tga_comp+j] = raw_data[j]; + + // in case we're in RLE mode, keep counting down + --RLE_count; + } + // do I need to invert the image? + if ( tga_inverted ) + { + for (j = 0; j*2 < tga_height; ++j) + { + int index1 = j * tga_width * tga_comp; + int index2 = (tga_height - 1 - j) * tga_width * tga_comp; + for (i = tga_width * tga_comp; i > 0; --i) + { + unsigned char temp = tga_data[index1]; + tga_data[index1] = tga_data[index2]; + tga_data[index2] = temp; + ++index1; + ++index2; + } + } + } + // clear my palette, if I had one + if ( tga_palette != NULL ) + { + STBI_FREE( tga_palette ); + } + } + + // swap RGB - if the source data was RGB16, it already is in the right order + if (tga_comp >= 3 && !tga_rgb16) + { + unsigned char* tga_pixel = tga_data; + for (i=0; i < tga_width * tga_height; ++i) + { + unsigned char temp = tga_pixel[0]; + tga_pixel[0] = tga_pixel[2]; + tga_pixel[2] = temp; + tga_pixel += tga_comp; + } + } + + // convert to target component count + if (req_comp && req_comp != tga_comp) + tga_data = stbi__convert_format(tga_data, tga_comp, req_comp, tga_width, tga_height); + + // the things I do to get rid of an error message, and yet keep + // Microsoft's C compilers happy... [8^( + tga_palette_start = tga_palette_len = tga_palette_bits = + tga_x_origin = tga_y_origin = 0; + STBI_NOTUSED(tga_palette_start); + // OK, done + return tga_data; +} +#endif + +// ************************************************************************************************* +// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicolas Schulz, tweaked by STB + +#ifndef STBI_NO_PSD +static int stbi__psd_test(stbi__context *s) +{ + int r = (stbi__get32be(s) == 0x38425053); + stbi__rewind(s); + return r; +} + +static int stbi__psd_decode_rle(stbi__context *s, stbi_uc *p, int pixelCount) +{ + int count, nleft, len; + + count = 0; + while ((nleft = pixelCount - count) > 0) { + len = stbi__get8(s); + if (len == 128) { + // No-op. + } else if (len < 128) { + // Copy next len+1 bytes literally. + len++; + if (len > nleft) return 0; // corrupt data + count += len; + while (len) { + *p = stbi__get8(s); + p += 4; + len--; + } + } else if (len > 128) { + stbi_uc val; + // Next -len+1 bytes in the dest are replicated from next source byte. + // (Interpret len as a negative 8-bit int.) + len = 257 - len; + if (len > nleft) return 0; // corrupt data + val = stbi__get8(s); + count += len; + while (len) { + *p = val; + p += 4; + len--; + } + } + } + + return 1; +} + +static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) +{ + int pixelCount; + int channelCount, compression; + int channel, i; + int bitdepth; + int w,h; + stbi_uc *out; + STBI_NOTUSED(ri); + + // Check identifier + if (stbi__get32be(s) != 0x38425053) // "8BPS" + return stbi__errpuc("not PSD", "Corrupt PSD image"); + + // Check file type version. + if (stbi__get16be(s) != 1) + return stbi__errpuc("wrong version", "Unsupported version of PSD image"); + + // Skip 6 reserved bytes. + stbi__skip(s, 6 ); + + // Read the number of channels (R, G, B, A, etc). + channelCount = stbi__get16be(s); + if (channelCount < 0 || channelCount > 16) + return stbi__errpuc("wrong channel count", "Unsupported number of channels in PSD image"); + + // Read the rows and columns of the image. + h = stbi__get32be(s); + w = stbi__get32be(s); + + if (h > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + if (w > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + + // Make sure the depth is 8 bits. + bitdepth = stbi__get16be(s); + if (bitdepth != 8 && bitdepth != 16) + return stbi__errpuc("unsupported bit depth", "PSD bit depth is not 8 or 16 bit"); + + // Make sure the color mode is RGB. + // Valid options are: + // 0: Bitmap + // 1: Grayscale + // 2: Indexed color + // 3: RGB color + // 4: CMYK color + // 7: Multichannel + // 8: Duotone + // 9: Lab color + if (stbi__get16be(s) != 3) + return stbi__errpuc("wrong color format", "PSD is not in RGB color format"); + + // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.) + stbi__skip(s,stbi__get32be(s) ); + + // Skip the image resources. (resolution, pen tool paths, etc) + stbi__skip(s, stbi__get32be(s) ); + + // Skip the reserved data. + stbi__skip(s, stbi__get32be(s) ); + + // Find out if the data is compressed. + // Known values: + // 0: no compression + // 1: RLE compressed + compression = stbi__get16be(s); + if (compression > 1) + return stbi__errpuc("bad compression", "PSD has an unknown compression format"); + + // Check size + if (!stbi__mad3sizes_valid(4, w, h, 0)) + return stbi__errpuc("too large", "Corrupt PSD"); + + // Create the destination image. + + if (!compression && bitdepth == 16 && bpc == 16) { + out = (stbi_uc *) stbi__malloc_mad3(8, w, h, 0); + ri->bits_per_channel = 16; + } else + out = (stbi_uc *) stbi__malloc(4 * w*h); + + if (!out) return stbi__errpuc("outofmem", "Out of memory"); + pixelCount = w*h; + + // Initialize the data to zero. + //memset( out, 0, pixelCount * 4 ); + + // Finally, the image data. + if (compression) { + // RLE as used by .PSD and .TIFF + // Loop until you get the number of unpacked bytes you are expecting: + // Read the next source byte into n. + // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. + // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times. + // Else if n is 128, noop. + // Endloop + + // The RLE-compressed data is preceded by a 2-byte data count for each row in the data, + // which we're going to just skip. + stbi__skip(s, h * channelCount * 2 ); + + // Read the RLE data by channel. + for (channel = 0; channel < 4; channel++) { + stbi_uc *p; + + p = out+channel; + if (channel >= channelCount) { + // Fill this channel with default data. + for (i = 0; i < pixelCount; i++, p += 4) + *p = (channel == 3 ? 255 : 0); + } else { + // Read the RLE data. + if (!stbi__psd_decode_rle(s, p, pixelCount)) { + STBI_FREE(out); + return stbi__errpuc("corrupt", "bad RLE data"); + } + } + } + + } else { + // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...) + // where each channel consists of an 8-bit (or 16-bit) value for each pixel in the image. + + // Read the data by channel. + for (channel = 0; channel < 4; channel++) { + if (channel >= channelCount) { + // Fill this channel with default data. + if (bitdepth == 16 && bpc == 16) { + stbi__uint16 *q = ((stbi__uint16 *) out) + channel; + stbi__uint16 val = channel == 3 ? 65535 : 0; + for (i = 0; i < pixelCount; i++, q += 4) + *q = val; + } else { + stbi_uc *p = out+channel; + stbi_uc val = channel == 3 ? 255 : 0; + for (i = 0; i < pixelCount; i++, p += 4) + *p = val; + } + } else { + if (ri->bits_per_channel == 16) { // output bpc + stbi__uint16 *q = ((stbi__uint16 *) out) + channel; + for (i = 0; i < pixelCount; i++, q += 4) + *q = (stbi__uint16) stbi__get16be(s); + } else { + stbi_uc *p = out+channel; + if (bitdepth == 16) { // input bpc + for (i = 0; i < pixelCount; i++, p += 4) + *p = (stbi_uc) (stbi__get16be(s) >> 8); + } else { + for (i = 0; i < pixelCount; i++, p += 4) + *p = stbi__get8(s); + } + } + } + } + } + + // remove weird white matte from PSD + if (channelCount >= 4) { + if (ri->bits_per_channel == 16) { + for (i=0; i < w*h; ++i) { + stbi__uint16 *pixel = (stbi__uint16 *) out + 4*i; + if (pixel[3] != 0 && pixel[3] != 65535) { + float a = pixel[3] / 65535.0f; + float ra = 1.0f / a; + float inv_a = 65535.0f * (1 - ra); + pixel[0] = (stbi__uint16) (pixel[0]*ra + inv_a); + pixel[1] = (stbi__uint16) (pixel[1]*ra + inv_a); + pixel[2] = (stbi__uint16) (pixel[2]*ra + inv_a); + } + } + } else { + for (i=0; i < w*h; ++i) { + unsigned char *pixel = out + 4*i; + if (pixel[3] != 0 && pixel[3] != 255) { + float a = pixel[3] / 255.0f; + float ra = 1.0f / a; + float inv_a = 255.0f * (1 - ra); + pixel[0] = (unsigned char) (pixel[0]*ra + inv_a); + pixel[1] = (unsigned char) (pixel[1]*ra + inv_a); + pixel[2] = (unsigned char) (pixel[2]*ra + inv_a); + } + } + } + } + + // convert to desired output format + if (req_comp && req_comp != 4) { + if (ri->bits_per_channel == 16) + out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, 4, req_comp, w, h); + else + out = stbi__convert_format(out, 4, req_comp, w, h); + if (out == NULL) return out; // stbi__convert_format frees input on failure + } + + if (comp) *comp = 4; + *y = h; + *x = w; + + return out; +} +#endif + +// ************************************************************************************************* +// Softimage PIC loader +// by Tom Seddon +// +// See http://softimage.wiki.softimage.com/index.php/INFO:_PIC_file_format +// See http://ozviz.wasp.uwa.edu.au/~pbourke/dataformats/softimagepic/ + +#ifndef STBI_NO_PIC +static int stbi__pic_is4(stbi__context *s,const char *str) +{ + int i; + for (i=0; i<4; ++i) + if (stbi__get8(s) != (stbi_uc)str[i]) + return 0; + + return 1; +} + +static int stbi__pic_test_core(stbi__context *s) +{ + int i; + + if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) + return 0; + + for(i=0;i<84;++i) + stbi__get8(s); + + if (!stbi__pic_is4(s,"PICT")) + return 0; + + return 1; +} + +typedef struct +{ + stbi_uc size,type,channel; +} stbi__pic_packet; + +static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest) +{ + int mask=0x80, i; + + for (i=0; i<4; ++i, mask>>=1) { + if (channel & mask) { + if (stbi__at_eof(s)) return stbi__errpuc("bad file","PIC file too short"); + dest[i]=stbi__get8(s); + } + } + + return dest; +} + +static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src) +{ + int mask=0x80,i; + + for (i=0;i<4; ++i, mask>>=1) + if (channel&mask) + dest[i]=src[i]; +} + +static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int height,int *comp, stbi_uc *result) +{ + int act_comp=0,num_packets=0,y,chained; + stbi__pic_packet packets[10]; + + // this will (should...) cater for even some bizarre stuff like having data + // for the same channel in multiple packets. + do { + stbi__pic_packet *packet; + + if (num_packets==sizeof(packets)/sizeof(packets[0])) + return stbi__errpuc("bad format","too many packets"); + + packet = &packets[num_packets++]; + + chained = stbi__get8(s); + packet->size = stbi__get8(s); + packet->type = stbi__get8(s); + packet->channel = stbi__get8(s); + + act_comp |= packet->channel; + + if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (reading packets)"); + if (packet->size != 8) return stbi__errpuc("bad format","packet isn't 8bpp"); + } while (chained); + + *comp = (act_comp & 0x10 ? 4 : 3); // has alpha channel? + + for(y=0; ytype) { + default: + return stbi__errpuc("bad format","packet has bad compression type"); + + case 0: {//uncompressed + int x; + + for(x=0;xchannel,dest)) + return 0; + break; + } + + case 1://Pure RLE + { + int left=width, i; + + while (left>0) { + stbi_uc count,value[4]; + + count=stbi__get8(s); + if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pure read count)"); + + if (count > left) + count = (stbi_uc) left; + + if (!stbi__readval(s,packet->channel,value)) return 0; + + for(i=0; ichannel,dest,value); + left -= count; + } + } + break; + + case 2: {//Mixed RLE + int left=width; + while (left>0) { + int count = stbi__get8(s), i; + if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (mixed read count)"); + + if (count >= 128) { // Repeated + stbi_uc value[4]; + + if (count==128) + count = stbi__get16be(s); + else + count -= 127; + if (count > left) + return stbi__errpuc("bad file","scanline overrun"); + + if (!stbi__readval(s,packet->channel,value)) + return 0; + + for(i=0;ichannel,dest,value); + } else { // Raw + ++count; + if (count>left) return stbi__errpuc("bad file","scanline overrun"); + + for(i=0;ichannel,dest)) + return 0; + } + left-=count; + } + break; + } + } + } + } + + return result; +} + +static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp, stbi__result_info *ri) +{ + stbi_uc *result; + int i, x,y, internal_comp; + STBI_NOTUSED(ri); + + if (!comp) comp = &internal_comp; + + for (i=0; i<92; ++i) + stbi__get8(s); + + x = stbi__get16be(s); + y = stbi__get16be(s); + + if (y > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + if (x > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + + if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pic header)"); + if (!stbi__mad3sizes_valid(x, y, 4, 0)) return stbi__errpuc("too large", "PIC image too large to decode"); + + stbi__get32be(s); //skip `ratio' + stbi__get16be(s); //skip `fields' + stbi__get16be(s); //skip `pad' + + // intermediate buffer is RGBA + result = (stbi_uc *) stbi__malloc_mad3(x, y, 4, 0); + if (!result) return stbi__errpuc("outofmem", "Out of memory"); + memset(result, 0xff, x*y*4); + + if (!stbi__pic_load_core(s,x,y,comp, result)) { + STBI_FREE(result); + result=0; + } + *px = x; + *py = y; + if (req_comp == 0) req_comp = *comp; + result=stbi__convert_format(result,4,req_comp,x,y); + + return result; +} + +static int stbi__pic_test(stbi__context *s) +{ + int r = stbi__pic_test_core(s); + stbi__rewind(s); + return r; +} +#endif + +// ************************************************************************************************* +// GIF loader -- public domain by Jean-Marc Lienher -- simplified/shrunk by stb + +#ifndef STBI_NO_GIF +typedef struct +{ + stbi__int16 prefix; + stbi_uc first; + stbi_uc suffix; +} stbi__gif_lzw; + +typedef struct +{ + int w,h; + stbi_uc *out; // output buffer (always 4 components) + stbi_uc *background; // The current "background" as far as a gif is concerned + stbi_uc *history; + int flags, bgindex, ratio, transparent, eflags; + stbi_uc pal[256][4]; + stbi_uc lpal[256][4]; + stbi__gif_lzw codes[8192]; + stbi_uc *color_table; + int parse, step; + int lflags; + int start_x, start_y; + int max_x, max_y; + int cur_x, cur_y; + int line_size; + int delay; +} stbi__gif; + +static int stbi__gif_test_raw(stbi__context *s) +{ + int sz; + if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') return 0; + sz = stbi__get8(s); + if (sz != '9' && sz != '7') return 0; + if (stbi__get8(s) != 'a') return 0; + return 1; +} + +static int stbi__gif_test(stbi__context *s) +{ + int r = stbi__gif_test_raw(s); + stbi__rewind(s); + return r; +} + +static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256][4], int num_entries, int transp) +{ + int i; + for (i=0; i < num_entries; ++i) { + pal[i][2] = stbi__get8(s); + pal[i][1] = stbi__get8(s); + pal[i][0] = stbi__get8(s); + pal[i][3] = transp == i ? 0 : 255; + } +} + +static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info) +{ + stbi_uc version; + if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') + return stbi__err("not GIF", "Corrupt GIF"); + + version = stbi__get8(s); + if (version != '7' && version != '9') return stbi__err("not GIF", "Corrupt GIF"); + if (stbi__get8(s) != 'a') return stbi__err("not GIF", "Corrupt GIF"); + + stbi__g_failure_reason = ""; + g->w = stbi__get16le(s); + g->h = stbi__get16le(s); + g->flags = stbi__get8(s); + g->bgindex = stbi__get8(s); + g->ratio = stbi__get8(s); + g->transparent = -1; + + if (g->w > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); + if (g->h > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); + + if (comp != 0) *comp = 4; // can't actually tell whether it's 3 or 4 until we parse the comments + + if (is_info) return 1; + + if (g->flags & 0x80) + stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1); + + return 1; +} + +static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp) +{ + stbi__gif* g = (stbi__gif*) stbi__malloc(sizeof(stbi__gif)); + if (!g) return stbi__err("outofmem", "Out of memory"); + if (!stbi__gif_header(s, g, comp, 1)) { + STBI_FREE(g); + stbi__rewind( s ); + return 0; + } + if (x) *x = g->w; + if (y) *y = g->h; + STBI_FREE(g); + return 1; +} + +static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code) +{ + stbi_uc *p, *c; + int idx; + + // recurse to decode the prefixes, since the linked-list is backwards, + // and working backwards through an interleaved image would be nasty + if (g->codes[code].prefix >= 0) + stbi__out_gif_code(g, g->codes[code].prefix); + + if (g->cur_y >= g->max_y) return; + + idx = g->cur_x + g->cur_y; + p = &g->out[idx]; + g->history[idx / 4] = 1; + + c = &g->color_table[g->codes[code].suffix * 4]; + if (c[3] > 128) { // don't render transparent pixels; + p[0] = c[2]; + p[1] = c[1]; + p[2] = c[0]; + p[3] = c[3]; + } + g->cur_x += 4; + + if (g->cur_x >= g->max_x) { + g->cur_x = g->start_x; + g->cur_y += g->step; + + while (g->cur_y >= g->max_y && g->parse > 0) { + g->step = (1 << g->parse) * g->line_size; + g->cur_y = g->start_y + (g->step >> 1); + --g->parse; + } + } +} + +static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) +{ + stbi_uc lzw_cs; + stbi__int32 len, init_code; + stbi__uint32 first; + stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear; + stbi__gif_lzw *p; + + lzw_cs = stbi__get8(s); + if (lzw_cs > 12) return NULL; + clear = 1 << lzw_cs; + first = 1; + codesize = lzw_cs + 1; + codemask = (1 << codesize) - 1; + bits = 0; + valid_bits = 0; + for (init_code = 0; init_code < clear; init_code++) { + g->codes[init_code].prefix = -1; + g->codes[init_code].first = (stbi_uc) init_code; + g->codes[init_code].suffix = (stbi_uc) init_code; + } + + // support no starting clear code + avail = clear+2; + oldcode = -1; + + len = 0; + for(;;) { + if (valid_bits < codesize) { + if (len == 0) { + len = stbi__get8(s); // start new block + if (len == 0) + return g->out; + } + --len; + bits |= (stbi__int32) stbi__get8(s) << valid_bits; + valid_bits += 8; + } else { + stbi__int32 code = bits & codemask; + bits >>= codesize; + valid_bits -= codesize; + // @OPTIMIZE: is there some way we can accelerate the non-clear path? + if (code == clear) { // clear code + codesize = lzw_cs + 1; + codemask = (1 << codesize) - 1; + avail = clear + 2; + oldcode = -1; + first = 0; + } else if (code == clear + 1) { // end of stream code + stbi__skip(s, len); + while ((len = stbi__get8(s)) > 0) + stbi__skip(s,len); + return g->out; + } else if (code <= avail) { + if (first) { + return stbi__errpuc("no clear code", "Corrupt GIF"); + } + + if (oldcode >= 0) { + p = &g->codes[avail++]; + if (avail > 8192) { + return stbi__errpuc("too many codes", "Corrupt GIF"); + } + + p->prefix = (stbi__int16) oldcode; + p->first = g->codes[oldcode].first; + p->suffix = (code == avail) ? p->first : g->codes[code].first; + } else if (code == avail) + return stbi__errpuc("illegal code in raster", "Corrupt GIF"); + + stbi__out_gif_code(g, (stbi__uint16) code); + + if ((avail & codemask) == 0 && avail <= 0x0FFF) { + codesize++; + codemask = (1 << codesize) - 1; + } + + oldcode = code; + } else { + return stbi__errpuc("illegal code in raster", "Corrupt GIF"); + } + } + } +} + +// this function is designed to support animated gifs, although stb_image doesn't support it +// two back is the image from two frames ago, used for a very specific disposal format +static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp, stbi_uc *two_back) +{ + int dispose; + int first_frame; + int pi; + int pcount; + STBI_NOTUSED(req_comp); + + // on first frame, any non-written pixels get the background colour (non-transparent) + first_frame = 0; + if (g->out == 0) { + if (!stbi__gif_header(s, g, comp,0)) return 0; // stbi__g_failure_reason set by stbi__gif_header + if (!stbi__mad3sizes_valid(4, g->w, g->h, 0)) + return stbi__errpuc("too large", "GIF image is too large"); + pcount = g->w * g->h; + g->out = (stbi_uc *) stbi__malloc(4 * pcount); + g->background = (stbi_uc *) stbi__malloc(4 * pcount); + g->history = (stbi_uc *) stbi__malloc(pcount); + if (!g->out || !g->background || !g->history) + return stbi__errpuc("outofmem", "Out of memory"); + + // image is treated as "transparent" at the start - ie, nothing overwrites the current background; + // background colour is only used for pixels that are not rendered first frame, after that "background" + // color refers to the color that was there the previous frame. + memset(g->out, 0x00, 4 * pcount); + memset(g->background, 0x00, 4 * pcount); // state of the background (starts transparent) + memset(g->history, 0x00, pcount); // pixels that were affected previous frame + first_frame = 1; + } else { + // second frame - how do we dispose of the previous one? + dispose = (g->eflags & 0x1C) >> 2; + pcount = g->w * g->h; + + if ((dispose == 3) && (two_back == 0)) { + dispose = 2; // if I don't have an image to revert back to, default to the old background + } + + if (dispose == 3) { // use previous graphic + for (pi = 0; pi < pcount; ++pi) { + if (g->history[pi]) { + memcpy( &g->out[pi * 4], &two_back[pi * 4], 4 ); + } + } + } else if (dispose == 2) { + // restore what was changed last frame to background before that frame; + for (pi = 0; pi < pcount; ++pi) { + if (g->history[pi]) { + memcpy( &g->out[pi * 4], &g->background[pi * 4], 4 ); + } + } + } else { + // This is a non-disposal case eithe way, so just + // leave the pixels as is, and they will become the new background + // 1: do not dispose + // 0: not specified. + } + + // background is what out is after the undoing of the previou frame; + memcpy( g->background, g->out, 4 * g->w * g->h ); + } + + // clear my history; + memset( g->history, 0x00, g->w * g->h ); // pixels that were affected previous frame + + for (;;) { + int tag = stbi__get8(s); + switch (tag) { + case 0x2C: /* Image Descriptor */ + { + stbi__int32 x, y, w, h; + stbi_uc *o; + + x = stbi__get16le(s); + y = stbi__get16le(s); + w = stbi__get16le(s); + h = stbi__get16le(s); + if (((x + w) > (g->w)) || ((y + h) > (g->h))) + return stbi__errpuc("bad Image Descriptor", "Corrupt GIF"); + + g->line_size = g->w * 4; + g->start_x = x * 4; + g->start_y = y * g->line_size; + g->max_x = g->start_x + w * 4; + g->max_y = g->start_y + h * g->line_size; + g->cur_x = g->start_x; + g->cur_y = g->start_y; + + // if the width of the specified rectangle is 0, that means + // we may not see *any* pixels or the image is malformed; + // to make sure this is caught, move the current y down to + // max_y (which is what out_gif_code checks). + if (w == 0) + g->cur_y = g->max_y; + + g->lflags = stbi__get8(s); + + if (g->lflags & 0x40) { + g->step = 8 * g->line_size; // first interlaced spacing + g->parse = 3; + } else { + g->step = g->line_size; + g->parse = 0; + } + + if (g->lflags & 0x80) { + stbi__gif_parse_colortable(s,g->lpal, 2 << (g->lflags & 7), g->eflags & 0x01 ? g->transparent : -1); + g->color_table = (stbi_uc *) g->lpal; + } else if (g->flags & 0x80) { + g->color_table = (stbi_uc *) g->pal; + } else + return stbi__errpuc("missing color table", "Corrupt GIF"); + + o = stbi__process_gif_raster(s, g); + if (!o) return NULL; + + // if this was the first frame, + pcount = g->w * g->h; + if (first_frame && (g->bgindex > 0)) { + // if first frame, any pixel not drawn to gets the background color + for (pi = 0; pi < pcount; ++pi) { + if (g->history[pi] == 0) { + g->pal[g->bgindex][3] = 255; // just in case it was made transparent, undo that; It will be reset next frame if need be; + memcpy( &g->out[pi * 4], &g->pal[g->bgindex], 4 ); + } + } + } + + return o; + } + + case 0x21: // Comment Extension. + { + int len; + int ext = stbi__get8(s); + if (ext == 0xF9) { // Graphic Control Extension. + len = stbi__get8(s); + if (len == 4) { + g->eflags = stbi__get8(s); + g->delay = 10 * stbi__get16le(s); // delay - 1/100th of a second, saving as 1/1000ths. + + // unset old transparent + if (g->transparent >= 0) { + g->pal[g->transparent][3] = 255; + } + if (g->eflags & 0x01) { + g->transparent = stbi__get8(s); + if (g->transparent >= 0) { + g->pal[g->transparent][3] = 0; + } + } else { + // don't need transparent + stbi__skip(s, 1); + g->transparent = -1; + } + } else { + stbi__skip(s, len); + break; + } + } + while ((len = stbi__get8(s)) != 0) { + stbi__skip(s, len); + } + break; + } + + case 0x3B: // gif stream termination code + return (stbi_uc *) s; // using '1' causes warning on some compilers + + default: + return stbi__errpuc("unknown code", "Corrupt GIF"); + } + } +} + +static void *stbi__load_gif_main_outofmem(stbi__gif *g, stbi_uc *out, int **delays) +{ + STBI_FREE(g->out); + STBI_FREE(g->history); + STBI_FREE(g->background); + + if (out) STBI_FREE(out); + if (delays && *delays) STBI_FREE(*delays); + return stbi__errpuc("outofmem", "Out of memory"); +} + +static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, int *z, int *comp, int req_comp) +{ + if (stbi__gif_test(s)) { + int layers = 0; + stbi_uc *u = 0; + stbi_uc *out = 0; + stbi_uc *two_back = 0; + stbi__gif g; + int stride; + int out_size = 0; + int delays_size = 0; + + STBI_NOTUSED(out_size); + STBI_NOTUSED(delays_size); + + memset(&g, 0, sizeof(g)); + if (delays) { + *delays = 0; + } + + do { + u = stbi__gif_load_next(s, &g, comp, req_comp, two_back); + if (u == (stbi_uc *) s) u = 0; // end of animated gif marker + + if (u) { + *x = g.w; + *y = g.h; + ++layers; + stride = g.w * g.h * 4; + + if (out) { + void *tmp = (stbi_uc*) STBI_REALLOC_SIZED( out, out_size, layers * stride ); + if (!tmp) + return stbi__load_gif_main_outofmem(&g, out, delays); + else { + out = (stbi_uc*) tmp; + out_size = layers * stride; + } + + if (delays) { + int *new_delays = (int*) STBI_REALLOC_SIZED( *delays, delays_size, sizeof(int) * layers ); + if (!new_delays) + return stbi__load_gif_main_outofmem(&g, out, delays); + *delays = new_delays; + delays_size = layers * sizeof(int); + } + } else { + out = (stbi_uc*)stbi__malloc( layers * stride ); + if (!out) + return stbi__load_gif_main_outofmem(&g, out, delays); + out_size = layers * stride; + if (delays) { + *delays = (int*) stbi__malloc( layers * sizeof(int) ); + if (!*delays) + return stbi__load_gif_main_outofmem(&g, out, delays); + delays_size = layers * sizeof(int); + } + } + memcpy( out + ((layers - 1) * stride), u, stride ); + if (layers >= 2) { + two_back = out - 2 * stride; + } + + if (delays) { + (*delays)[layers - 1U] = g.delay; + } + } + } while (u != 0); + + // free temp buffer; + STBI_FREE(g.out); + STBI_FREE(g.history); + STBI_FREE(g.background); + + // do the final conversion after loading everything; + if (req_comp && req_comp != 4) + out = stbi__convert_format(out, 4, req_comp, layers * g.w, g.h); + + *z = layers; + return out; + } else { + return stbi__errpuc("not GIF", "Image was not as a gif type."); + } +} + +static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + stbi_uc *u = 0; + stbi__gif g; + memset(&g, 0, sizeof(g)); + STBI_NOTUSED(ri); + + u = stbi__gif_load_next(s, &g, comp, req_comp, 0); + if (u == (stbi_uc *) s) u = 0; // end of animated gif marker + if (u) { + *x = g.w; + *y = g.h; + + // moved conversion to after successful load so that the same + // can be done for multiple frames. + if (req_comp && req_comp != 4) + u = stbi__convert_format(u, 4, req_comp, g.w, g.h); + } else if (g.out) { + // if there was an error and we allocated an image buffer, free it! + STBI_FREE(g.out); + } + + // free buffers needed for multiple frame loading; + STBI_FREE(g.history); + STBI_FREE(g.background); + + return u; +} + +static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp) +{ + return stbi__gif_info_raw(s,x,y,comp); +} +#endif + +// ************************************************************************************************* +// Radiance RGBE HDR loader +// originally by Nicolas Schulz +#ifndef STBI_NO_HDR +static int stbi__hdr_test_core(stbi__context *s, const char *signature) +{ + int i; + for (i=0; signature[i]; ++i) + if (stbi__get8(s) != signature[i]) + return 0; + stbi__rewind(s); + return 1; +} + +static int stbi__hdr_test(stbi__context* s) +{ + int r = stbi__hdr_test_core(s, "#?RADIANCE\n"); + stbi__rewind(s); + if(!r) { + r = stbi__hdr_test_core(s, "#?RGBE\n"); + stbi__rewind(s); + } + return r; +} + +#define STBI__HDR_BUFLEN 1024 +static char *stbi__hdr_gettoken(stbi__context *z, char *buffer) +{ + int len=0; + char c = '\0'; + + c = (char) stbi__get8(z); + + while (!stbi__at_eof(z) && c != '\n') { + buffer[len++] = c; + if (len == STBI__HDR_BUFLEN-1) { + // flush to end of line + while (!stbi__at_eof(z) && stbi__get8(z) != '\n') + ; + break; + } + c = (char) stbi__get8(z); + } + + buffer[len] = 0; + return buffer; +} + +static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp) +{ + if ( input[3] != 0 ) { + float f1; + // Exponent + f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8)); + if (req_comp <= 2) + output[0] = (input[0] + input[1] + input[2]) * f1 / 3; + else { + output[0] = input[0] * f1; + output[1] = input[1] * f1; + output[2] = input[2] * f1; + } + if (req_comp == 2) output[1] = 1; + if (req_comp == 4) output[3] = 1; + } else { + switch (req_comp) { + case 4: output[3] = 1; /* fallthrough */ + case 3: output[0] = output[1] = output[2] = 0; + break; + case 2: output[1] = 1; /* fallthrough */ + case 1: output[0] = 0; + break; + } + } +} + +static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + char buffer[STBI__HDR_BUFLEN]; + char *token; + int valid = 0; + int width, height; + stbi_uc *scanline; + float *hdr_data; + int len; + unsigned char count, value; + int i, j, k, c1,c2, z; + const char *headerToken; + STBI_NOTUSED(ri); + + // Check identifier + headerToken = stbi__hdr_gettoken(s,buffer); + if (strcmp(headerToken, "#?RADIANCE") != 0 && strcmp(headerToken, "#?RGBE") != 0) + return stbi__errpf("not HDR", "Corrupt HDR image"); + + // Parse header + for(;;) { + token = stbi__hdr_gettoken(s,buffer); + if (token[0] == 0) break; + if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; + } + + if (!valid) return stbi__errpf("unsupported format", "Unsupported HDR format"); + + // Parse width and height + // can't use sscanf() if we're not using stdio! + token = stbi__hdr_gettoken(s,buffer); + if (strncmp(token, "-Y ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format"); + token += 3; + height = (int) strtol(token, &token, 10); + while (*token == ' ') ++token; + if (strncmp(token, "+X ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format"); + token += 3; + width = (int) strtol(token, NULL, 10); + + if (height > STBI_MAX_DIMENSIONS) return stbi__errpf("too large","Very large image (corrupt?)"); + if (width > STBI_MAX_DIMENSIONS) return stbi__errpf("too large","Very large image (corrupt?)"); + + *x = width; + *y = height; + + if (comp) *comp = 3; + if (req_comp == 0) req_comp = 3; + + if (!stbi__mad4sizes_valid(width, height, req_comp, sizeof(float), 0)) + return stbi__errpf("too large", "HDR image is too large"); + + // Read data + hdr_data = (float *) stbi__malloc_mad4(width, height, req_comp, sizeof(float), 0); + if (!hdr_data) + return stbi__errpf("outofmem", "Out of memory"); + + // Load image data + // image data is stored as some number of sca + if ( width < 8 || width >= 32768) { + // Read flat data + for (j=0; j < height; ++j) { + for (i=0; i < width; ++i) { + stbi_uc rgbe[4]; + main_decode_loop: + stbi__getn(s, rgbe, 4); + stbi__hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp); + } + } + } else { + // Read RLE-encoded data + scanline = NULL; + + for (j = 0; j < height; ++j) { + c1 = stbi__get8(s); + c2 = stbi__get8(s); + len = stbi__get8(s); + if (c1 != 2 || c2 != 2 || (len & 0x80)) { + // not run-length encoded, so we have to actually use THIS data as a decoded + // pixel (note this can't be a valid pixel--one of RGB must be >= 128) + stbi_uc rgbe[4]; + rgbe[0] = (stbi_uc) c1; + rgbe[1] = (stbi_uc) c2; + rgbe[2] = (stbi_uc) len; + rgbe[3] = (stbi_uc) stbi__get8(s); + stbi__hdr_convert(hdr_data, rgbe, req_comp); + i = 1; + j = 0; + STBI_FREE(scanline); + goto main_decode_loop; // yes, this makes no sense + } + len <<= 8; + len |= stbi__get8(s); + if (len != width) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("invalid decoded scanline length", "corrupt HDR"); } + if (scanline == NULL) { + scanline = (stbi_uc *) stbi__malloc_mad2(width, 4, 0); + if (!scanline) { + STBI_FREE(hdr_data); + return stbi__errpf("outofmem", "Out of memory"); + } + } + + for (k = 0; k < 4; ++k) { + int nleft; + i = 0; + while ((nleft = width - i) > 0) { + count = stbi__get8(s); + if (count > 128) { + // Run + value = stbi__get8(s); + count -= 128; + if ((count == 0) || (count > nleft)) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); } + for (z = 0; z < count; ++z) + scanline[i++ * 4 + k] = value; + } else { + // Dump + if ((count == 0) || (count > nleft)) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); } + for (z = 0; z < count; ++z) + scanline[i++ * 4 + k] = stbi__get8(s); + } + } + } + for (i=0; i < width; ++i) + stbi__hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp); + } + if (scanline) + STBI_FREE(scanline); + } + + return hdr_data; +} + +static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp) +{ + char buffer[STBI__HDR_BUFLEN]; + char *token; + int valid = 0; + int dummy; + + if (!x) x = &dummy; + if (!y) y = &dummy; + if (!comp) comp = &dummy; + + if (stbi__hdr_test(s) == 0) { + stbi__rewind( s ); + return 0; + } + + for(;;) { + token = stbi__hdr_gettoken(s,buffer); + if (token[0] == 0) break; + if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; + } + + if (!valid) { + stbi__rewind( s ); + return 0; + } + token = stbi__hdr_gettoken(s,buffer); + if (strncmp(token, "-Y ", 3)) { + stbi__rewind( s ); + return 0; + } + token += 3; + *y = (int) strtol(token, &token, 10); + while (*token == ' ') ++token; + if (strncmp(token, "+X ", 3)) { + stbi__rewind( s ); + return 0; + } + token += 3; + *x = (int) strtol(token, NULL, 10); + *comp = 3; + return 1; +} +#endif // STBI_NO_HDR + +#ifndef STBI_NO_BMP +static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp) +{ + void *p; + stbi__bmp_data info; + + info.all_a = 255; + p = stbi__bmp_parse_header(s, &info); + if (p == NULL) { + stbi__rewind( s ); + return 0; + } + if (x) *x = s->img_x; + if (y) *y = s->img_y; + if (comp) { + if (info.bpp == 24 && info.ma == 0xff000000) + *comp = 3; + else + *comp = info.ma ? 4 : 3; + } + return 1; +} +#endif + +#ifndef STBI_NO_PSD +static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp) +{ + int channelCount, dummy, depth; + if (!x) x = &dummy; + if (!y) y = &dummy; + if (!comp) comp = &dummy; + if (stbi__get32be(s) != 0x38425053) { + stbi__rewind( s ); + return 0; + } + if (stbi__get16be(s) != 1) { + stbi__rewind( s ); + return 0; + } + stbi__skip(s, 6); + channelCount = stbi__get16be(s); + if (channelCount < 0 || channelCount > 16) { + stbi__rewind( s ); + return 0; + } + *y = stbi__get32be(s); + *x = stbi__get32be(s); + depth = stbi__get16be(s); + if (depth != 8 && depth != 16) { + stbi__rewind( s ); + return 0; + } + if (stbi__get16be(s) != 3) { + stbi__rewind( s ); + return 0; + } + *comp = 4; + return 1; +} + +static int stbi__psd_is16(stbi__context *s) +{ + int channelCount, depth; + if (stbi__get32be(s) != 0x38425053) { + stbi__rewind( s ); + return 0; + } + if (stbi__get16be(s) != 1) { + stbi__rewind( s ); + return 0; + } + stbi__skip(s, 6); + channelCount = stbi__get16be(s); + if (channelCount < 0 || channelCount > 16) { + stbi__rewind( s ); + return 0; + } + STBI_NOTUSED(stbi__get32be(s)); + STBI_NOTUSED(stbi__get32be(s)); + depth = stbi__get16be(s); + if (depth != 16) { + stbi__rewind( s ); + return 0; + } + return 1; +} +#endif + +#ifndef STBI_NO_PIC +static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp) +{ + int act_comp=0,num_packets=0,chained,dummy; + stbi__pic_packet packets[10]; + + if (!x) x = &dummy; + if (!y) y = &dummy; + if (!comp) comp = &dummy; + + if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) { + stbi__rewind(s); + return 0; + } + + stbi__skip(s, 88); + + *x = stbi__get16be(s); + *y = stbi__get16be(s); + if (stbi__at_eof(s)) { + stbi__rewind( s); + return 0; + } + if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) { + stbi__rewind( s ); + return 0; + } + + stbi__skip(s, 8); + + do { + stbi__pic_packet *packet; + + if (num_packets==sizeof(packets)/sizeof(packets[0])) + return 0; + + packet = &packets[num_packets++]; + chained = stbi__get8(s); + packet->size = stbi__get8(s); + packet->type = stbi__get8(s); + packet->channel = stbi__get8(s); + act_comp |= packet->channel; + + if (stbi__at_eof(s)) { + stbi__rewind( s ); + return 0; + } + if (packet->size != 8) { + stbi__rewind( s ); + return 0; + } + } while (chained); + + *comp = (act_comp & 0x10 ? 4 : 3); + + return 1; +} +#endif + +// ************************************************************************************************* +// Portable Gray Map and Portable Pixel Map loader +// by Ken Miller +// +// PGM: http://netpbm.sourceforge.net/doc/pgm.html +// PPM: http://netpbm.sourceforge.net/doc/ppm.html +// +// Known limitations: +// Does not support comments in the header section +// Does not support ASCII image data (formats P2 and P3) + +#ifndef STBI_NO_PNM + +static int stbi__pnm_test(stbi__context *s) +{ + char p, t; + p = (char) stbi__get8(s); + t = (char) stbi__get8(s); + if (p != 'P' || (t != '5' && t != '6')) { + stbi__rewind( s ); + return 0; + } + return 1; +} + +static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) +{ + stbi_uc *out; + STBI_NOTUSED(ri); + + ri->bits_per_channel = stbi__pnm_info(s, (int *)&s->img_x, (int *)&s->img_y, (int *)&s->img_n); + if (ri->bits_per_channel == 0) + return 0; + + if (s->img_y > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + if (s->img_x > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); + + *x = s->img_x; + *y = s->img_y; + if (comp) *comp = s->img_n; + + if (!stbi__mad4sizes_valid(s->img_n, s->img_x, s->img_y, ri->bits_per_channel / 8, 0)) + return stbi__errpuc("too large", "PNM too large"); + + out = (stbi_uc *) stbi__malloc_mad4(s->img_n, s->img_x, s->img_y, ri->bits_per_channel / 8, 0); + if (!out) return stbi__errpuc("outofmem", "Out of memory"); + if (!stbi__getn(s, out, s->img_n * s->img_x * s->img_y * (ri->bits_per_channel / 8))) { + STBI_FREE(out); + return stbi__errpuc("bad PNM", "PNM file truncated"); + } + + if (req_comp && req_comp != s->img_n) { + if (ri->bits_per_channel == 16) { + out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, s->img_n, req_comp, s->img_x, s->img_y); + } else { + out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y); + } + if (out == NULL) return out; // stbi__convert_format frees input on failure + } + return out; +} + +static int stbi__pnm_isspace(char c) +{ + return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r'; +} + +static void stbi__pnm_skip_whitespace(stbi__context *s, char *c) +{ + for (;;) { + while (!stbi__at_eof(s) && stbi__pnm_isspace(*c)) + *c = (char) stbi__get8(s); + + if (stbi__at_eof(s) || *c != '#') + break; + + while (!stbi__at_eof(s) && *c != '\n' && *c != '\r' ) + *c = (char) stbi__get8(s); + } +} + +static int stbi__pnm_isdigit(char c) +{ + return c >= '0' && c <= '9'; +} + +static int stbi__pnm_getinteger(stbi__context *s, char *c) +{ + int value = 0; + + while (!stbi__at_eof(s) && stbi__pnm_isdigit(*c)) { + value = value*10 + (*c - '0'); + *c = (char) stbi__get8(s); + if((value > 214748364) || (value == 214748364 && *c > '7')) + return stbi__err("integer parse overflow", "Parsing an integer in the PPM header overflowed a 32-bit int"); + } + + return value; +} + +static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp) +{ + int maxv, dummy; + char c, p, t; + + if (!x) x = &dummy; + if (!y) y = &dummy; + if (!comp) comp = &dummy; + + stbi__rewind(s); + + // Get identifier + p = (char) stbi__get8(s); + t = (char) stbi__get8(s); + if (p != 'P' || (t != '5' && t != '6')) { + stbi__rewind(s); + return 0; + } + + *comp = (t == '6') ? 3 : 1; // '5' is 1-component .pgm; '6' is 3-component .ppm + + c = (char) stbi__get8(s); + stbi__pnm_skip_whitespace(s, &c); + + *x = stbi__pnm_getinteger(s, &c); // read width + if(*x == 0) + return stbi__err("invalid width", "PPM image header had zero or overflowing width"); + stbi__pnm_skip_whitespace(s, &c); + + *y = stbi__pnm_getinteger(s, &c); // read height + if (*y == 0) + return stbi__err("invalid width", "PPM image header had zero or overflowing width"); + stbi__pnm_skip_whitespace(s, &c); + + maxv = stbi__pnm_getinteger(s, &c); // read max value + if (maxv > 65535) + return stbi__err("max value > 65535", "PPM image supports only 8-bit and 16-bit images"); + else if (maxv > 255) + return 16; + else + return 8; +} + +static int stbi__pnm_is16(stbi__context *s) +{ + if (stbi__pnm_info(s, NULL, NULL, NULL) == 16) + return 1; + return 0; +} +#endif + +static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp) +{ + #ifndef STBI_NO_JPEG + if (stbi__jpeg_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PNG + if (stbi__png_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_GIF + if (stbi__gif_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_BMP + if (stbi__bmp_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PSD + if (stbi__psd_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PIC + if (stbi__pic_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_PNM + if (stbi__pnm_info(s, x, y, comp)) return 1; + #endif + + #ifndef STBI_NO_HDR + if (stbi__hdr_info(s, x, y, comp)) return 1; + #endif + + // test tga last because it's a crappy test! + #ifndef STBI_NO_TGA + if (stbi__tga_info(s, x, y, comp)) + return 1; + #endif + return stbi__err("unknown image type", "Image not of any known type, or corrupt"); +} + +static int stbi__is_16_main(stbi__context *s) +{ + #ifndef STBI_NO_PNG + if (stbi__png_is16(s)) return 1; + #endif + + #ifndef STBI_NO_PSD + if (stbi__psd_is16(s)) return 1; + #endif + + #ifndef STBI_NO_PNM + if (stbi__pnm_is16(s)) return 1; + #endif + return 0; +} + +#ifndef STBI_NO_STDIO +STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp) +{ + FILE *f = stbi__fopen(filename, "rb"); + int result; + if (!f) return stbi__err("can't fopen", "Unable to open file"); + result = stbi_info_from_file(f, x, y, comp); + fclose(f); + return result; +} + +STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp) +{ + int r; + stbi__context s; + long pos = ftell(f); + stbi__start_file(&s, f); + r = stbi__info_main(&s,x,y,comp); + fseek(f,pos,SEEK_SET); + return r; +} + +STBIDEF int stbi_is_16_bit(char const *filename) +{ + FILE *f = stbi__fopen(filename, "rb"); + int result; + if (!f) return stbi__err("can't fopen", "Unable to open file"); + result = stbi_is_16_bit_from_file(f); + fclose(f); + return result; +} + +STBIDEF int stbi_is_16_bit_from_file(FILE *f) +{ + int r; + stbi__context s; + long pos = ftell(f); + stbi__start_file(&s, f); + r = stbi__is_16_main(&s); + fseek(f,pos,SEEK_SET); + return r; +} +#endif // !STBI_NO_STDIO + +STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__info_main(&s,x,y,comp); +} + +STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int *x, int *y, int *comp) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user); + return stbi__info_main(&s,x,y,comp); +} + +STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len) +{ + stbi__context s; + stbi__start_mem(&s,buffer,len); + return stbi__is_16_main(&s); +} + +STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, void *user) +{ + stbi__context s; + stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user); + return stbi__is_16_main(&s); +} + +#endif // STB_IMAGE_IMPLEMENTATION + +/* + revision history: + 2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs + 2.19 (2018-02-11) fix warning + 2.18 (2018-01-30) fix warnings + 2.17 (2018-01-29) change sbti__shiftsigned to avoid clang -O2 bug + 1-bit BMP + *_is_16_bit api + avoid warnings + 2.16 (2017-07-23) all functions have 16-bit variants; + STBI_NO_STDIO works again; + compilation fixes; + fix rounding in unpremultiply; + optimize vertical flip; + disable raw_len validation; + documentation fixes + 2.15 (2017-03-18) fix png-1,2,4 bug; now all Imagenet JPGs decode; + warning fixes; disable run-time SSE detection on gcc; + uniform handling of optional "return" values; + thread-safe initialization of zlib tables + 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs + 2.13 (2016-11-29) add 16-bit API, only supported for PNG right now + 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes + 2.11 (2016-04-02) allocate large structures on the stack + remove white matting for transparent PSD + fix reported channel count for PNG & BMP + re-enable SSE2 in non-gcc 64-bit + support RGB-formatted JPEG + read 16-bit PNGs (only as 8-bit) + 2.10 (2016-01-22) avoid warning introduced in 2.09 by STBI_REALLOC_SIZED + 2.09 (2016-01-16) allow comments in PNM files + 16-bit-per-pixel TGA (not bit-per-component) + info() for TGA could break due to .hdr handling + info() for BMP to shares code instead of sloppy parse + can use STBI_REALLOC_SIZED if allocator doesn't support realloc + code cleanup + 2.08 (2015-09-13) fix to 2.07 cleanup, reading RGB PSD as RGBA + 2.07 (2015-09-13) fix compiler warnings + partial animated GIF support + limited 16-bpc PSD support + #ifdef unused functions + bug with < 92 byte PIC,PNM,HDR,TGA + 2.06 (2015-04-19) fix bug where PSD returns wrong '*comp' value + 2.05 (2015-04-19) fix bug in progressive JPEG handling, fix warning + 2.04 (2015-04-15) try to re-enable SIMD on MinGW 64-bit + 2.03 (2015-04-12) extra corruption checking (mmozeiko) + stbi_set_flip_vertically_on_load (nguillemot) + fix NEON support; fix mingw support + 2.02 (2015-01-19) fix incorrect assert, fix warning + 2.01 (2015-01-17) fix various warnings; suppress SIMD on gcc 32-bit without -msse2 + 2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG + 2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg) + progressive JPEG (stb) + PGM/PPM support (Ken Miller) + STBI_MALLOC,STBI_REALLOC,STBI_FREE + GIF bugfix -- seemingly never worked + STBI_NO_*, STBI_ONLY_* + 1.48 (2014-12-14) fix incorrectly-named assert() + 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb) + optimize PNG (ryg) + fix bug in interlaced PNG with user-specified channel count (stb) + 1.46 (2014-08-26) + fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG + 1.45 (2014-08-16) + fix MSVC-ARM internal compiler error by wrapping malloc + 1.44 (2014-08-07) + various warning fixes from Ronny Chevalier + 1.43 (2014-07-15) + fix MSVC-only compiler problem in code changed in 1.42 + 1.42 (2014-07-09) + don't define _CRT_SECURE_NO_WARNINGS (affects user code) + fixes to stbi__cleanup_jpeg path + added STBI_ASSERT to avoid requiring assert.h + 1.41 (2014-06-25) + fix search&replace from 1.36 that messed up comments/error messages + 1.40 (2014-06-22) + fix gcc struct-initialization warning + 1.39 (2014-06-15) + fix to TGA optimization when req_comp != number of components in TGA; + fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite) + add support for BMP version 5 (more ignored fields) + 1.38 (2014-06-06) + suppress MSVC warnings on integer casts truncating values + fix accidental rename of 'skip' field of I/O + 1.37 (2014-06-04) + remove duplicate typedef + 1.36 (2014-06-03) + convert to header file single-file library + if de-iphone isn't set, load iphone images color-swapped instead of returning NULL + 1.35 (2014-05-27) + various warnings + fix broken STBI_SIMD path + fix bug where stbi_load_from_file no longer left file pointer in correct place + fix broken non-easy path for 32-bit BMP (possibly never used) + TGA optimization by Arseny Kapoulkine + 1.34 (unknown) + use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case + 1.33 (2011-07-14) + make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements + 1.32 (2011-07-13) + support for "info" function for all supported filetypes (SpartanJ) + 1.31 (2011-06-20) + a few more leak fixes, bug in PNG handling (SpartanJ) + 1.30 (2011-06-11) + added ability to load files via callbacks to accomidate custom input streams (Ben Wenger) + removed deprecated format-specific test/load functions + removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway + error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha) + fix inefficiency in decoding 32-bit BMP (David Woo) + 1.29 (2010-08-16) + various warning fixes from Aurelien Pocheville + 1.28 (2010-08-01) + fix bug in GIF palette transparency (SpartanJ) + 1.27 (2010-08-01) + cast-to-stbi_uc to fix warnings + 1.26 (2010-07-24) + fix bug in file buffering for PNG reported by SpartanJ + 1.25 (2010-07-17) + refix trans_data warning (Won Chun) + 1.24 (2010-07-12) + perf improvements reading from files on platforms with lock-heavy fgetc() + minor perf improvements for jpeg + deprecated type-specific functions so we'll get feedback if they're needed + attempt to fix trans_data warning (Won Chun) + 1.23 fixed bug in iPhone support + 1.22 (2010-07-10) + removed image *writing* support + stbi_info support from Jetro Lauha + GIF support from Jean-Marc Lienher + iPhone PNG-extensions from James Brown + warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva) + 1.21 fix use of 'stbi_uc' in header (reported by jon blow) + 1.20 added support for Softimage PIC, by Tom Seddon + 1.19 bug in interlaced PNG corruption check (found by ryg) + 1.18 (2008-08-02) + fix a threading bug (local mutable static) + 1.17 support interlaced PNG + 1.16 major bugfix - stbi__convert_format converted one too many pixels + 1.15 initialize some fields for thread safety + 1.14 fix threadsafe conversion bug + header-file-only version (#define STBI_HEADER_FILE_ONLY before including) + 1.13 threadsafe + 1.12 const qualifiers in the API + 1.11 Support installable IDCT, colorspace conversion routines + 1.10 Fixes for 64-bit (don't use "unsigned long") + optimized upsampling by Fabian "ryg" Giesen + 1.09 Fix format-conversion for PSD code (bad global variables!) + 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz + 1.07 attempt to fix C++ warning/errors again + 1.06 attempt to fix C++ warning/errors again + 1.05 fix TGA loading to return correct *comp and use good luminance calc + 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free + 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR + 1.02 support for (subset of) HDR files, float interface for preferred access to them + 1.01 fix bug: possible bug in handling right-side up bmps... not sure + fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all + 1.00 interface to zlib that skips zlib header + 0.99 correct handling of alpha in palette + 0.98 TGA loader by lonesock; dynamically add loaders (untested) + 0.97 jpeg errors on too large a file; also catch another malloc failure + 0.96 fix detection of invalid v value - particleman@mollyrocket forum + 0.95 during header scan, seek to markers in case of padding + 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same + 0.93 handle jpegtran output; verbose errors + 0.92 read 4,8,16,24,32-bit BMP files of several formats + 0.91 output 24-bit Windows 3.0 BMP files + 0.90 fix a few more warnings; bump version number to approach 1.0 + 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd + 0.60 fix compiling as c++ + 0.59 fix warnings: merge Dave Moore's -Wall fixes + 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian + 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available + 0.56 fix bug: zlib uncompressed mode len vs. nlen + 0.55 fix bug: restart_interval not initialized to 0 + 0.54 allow NULL for 'int *comp' + 0.53 fix bug in png 3->4; speedup png decoding + 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments + 0.51 obey req_comp requests, 1-component jpegs return as 1-component, + on 'test' only check type, not whether we support this variant + 0.50 (2006-11-19) + first released version +*/ + + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------ +*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index c8296f59..b549f439 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,6 +255,8 @@ add_library(DrvOpenXR STATIC DrvOpenXR/GfxInterop.h DrvOpenXR/OverlayTextureCopy.cpp DrvOpenXR/OverlayTextureCopy.h + DrvOpenXR/OverlayTextureShare.cpp + DrvOpenXR/OverlayTextureShare.h DrvOpenXR/tmp_gfx/TemporaryGraphics.cpp DrvOpenXR/tmp_gfx/TemporaryGraphics.h @@ -298,6 +300,7 @@ endif () set(OVR_PCH_EXCLUDED OpenOVR/Misc/ini.c OpenOVR/Misc/lodepng.cpp + OpenOVR/Misc/stb_image.cpp ) # Generate version string from git revision, or supplied OC_VERSION setting @@ -410,6 +413,8 @@ add_library(OCCore STATIC OpenOVR/Misc/Input/ViveFocus3InteractionProfile.cpp OpenOVR/Misc/Input/PicoInteractionProfile.cpp OpenOVR/Misc/Input/MsftHandInteractionProfile.cpp + OpenOVR/Misc/Input/ExtHandInteractionProfile.cpp + OpenOVR/Misc/Input/ViveTrackerRoles.cpp OpenOVR/Reimpl/BaseApplications.cpp OpenOVR/Reimpl/BaseChaperone.cpp OpenOVR/Reimpl/BaseChaperoneSetup.cpp @@ -486,7 +491,10 @@ add_library(OCCore STATIC OpenOVR/Misc/Input/ViveFocus3InteractionProfile.h OpenOVR/Misc/Input/PicoInteractionProfile.h OpenOVR/Misc/Input/MsftHandInteractionProfile.h + OpenOVR/Misc/Input/ExtHandInteractionProfile.h + OpenOVR/Misc/Input/ViveTrackerRoles.h OpenOVR/Misc/lodepng.h + OpenOVR/Misc/StbJpeg.h OpenOVR/Misc/ScopeGuard.h OpenOVR/Reimpl/BaseApplications.h OpenOVR/Reimpl/BaseChaperone.h @@ -543,7 +551,7 @@ target_include_directories(OCCore PUBLIC OpenOVR ${CMAKE_BINARY_DIR}) # TODO ma target_include_directories(OCCore PRIVATE BundledLibs OpenVRHeaders) target_compile_definitions(OCCore PRIVATE ${GRAPHICS_API_SUPPORT_FLAGS}) -target_link_libraries(OCCore PRIVATE OpenVR Vulkan ${XrLib} ${glmLib}) +target_link_libraries(OCCore PRIVATE OpenVR Vulkan ${XrLib} ${jsoncppLib} ${glmLib}) if (NOT WIN32 AND NOT ANDROID) find_package(OpenGL REQUIRED) # for glGetError() @@ -781,6 +789,21 @@ get_target_property(output_dir OCOVR LIBRARY_OUTPUT_DIRECTORY) add_custom_command(TARGET OCOVR PRE_LINK COMMAND ${CMAKE_COMMAND} -E make_directory ${output_dir}) +# The controller models (assets/controllers, the WebXR Input Profiles') in SteamVR's render-model layout, beside the +# libraries: bin/rendermodels serves bin/ and bin/linux64/. The conversion checks each model's motion as it goes. +file(GLOB_RECURSE OC_CONTROLLER_ASSETS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/assets/controllers/*) +set(OC_RENDERMODELS_DIR ${CMAKE_BINARY_DIR}/bin/rendermodels) +add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/rendermodels.stamp + COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/rendermodels.py --quiet + --assets ${CMAKE_SOURCE_DIR}/assets/controllers --out ${OC_RENDERMODELS_DIR} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/rendermodels.stamp + DEPENDS ${CMAKE_SOURCE_DIR}/scripts/rendermodels.py ${OC_CONTROLLER_ASSETS} + COMMENT "Converting the controller models" +) +add_custom_target(OCRenderModels ALL DEPENDS ${CMAKE_BINARY_DIR}/rendermodels.stamp) +add_dependencies(OCOVR OCRenderModels) + # Installation include(GNUInstallDirs) install(TARGETS OCOVR @@ -792,6 +815,7 @@ install(FILES ${CMAKE_BINARY_DIR}/openvrpaths.vrpath DESTINATION ${PROJECT_NAME} install(FILES ${CMAKE_BINARY_DIR}/bin/version.txt DESTINATION "${PROJECT_NAME}/bin" ) +install(DIRECTORY ${OC_RENDERMODELS_DIR} DESTINATION "${PROJECT_NAME}/bin") # === Tests === if (OC_BUILD_TESTS) diff --git a/DrvOpenXR/DeviceIdentity.cpp b/DrvOpenXR/DeviceIdentity.cpp index 146c0599..7176a44f 100644 --- a/DrvOpenXR/DeviceIdentity.cpp +++ b/DrvOpenXR/DeviceIdentity.cpp @@ -5,6 +5,7 @@ #include "../OpenOVR/Misc/Input/Bindings/LegacyBindings.h" #include +#include #include #include @@ -55,7 +56,32 @@ uint64_t ButtonsForComponent(const std::string& component) } // namespace -DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& device) +std::string HmdManufacturer(uint32_t vendorId, const std::string& runtimeName) +{ + // The USB vendor IDs runtimes give, as SteamVR's drivers name those makers + switch (vendorId) { + case 0x2833: + return "Oculus"; + case 0x28de: + return "Valve"; + case 0x0bb4: + return "HTC"; + case 0x045e: + return "WindowsMR"; + default: + break; + } + // Else the runtime's name, as far as its first word ("Monado" of "Monado(XRT) by Collabora et al ...") + std::string name; + for (char c : runtimeName) { + if (isspace((unsigned char)c) || c == '(' || c == ':' || c == '/') + break; + name += c; + } + return name; +} + +DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& device, uint32_t vendorId, const std::string& runtimeName) { auto it = HmdRows().find(xrSystemName); if (it != HmdRows().end()) @@ -64,8 +90,10 @@ DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& DeviceIdentity id = DefaultHmd(); if (xrSystemName.empty()) return id; - // The runtime's own words: the system name is all OpenXR says of who made it - id.manufacturer = xrSystemName; + // Who made it from the system's vendor ID (the system name is its model), else the runtime's name + std::string maker = HmdManufacturer(vendorId, runtimeName); + if (!maker.empty()) + id.manufacturer = maker; id.modelNumber = device.name.empty() ? xrSystemName : device.name; id.serial = device.serial.empty() ? xrSystemName + "-head" : device.serial; return id; diff --git a/DrvOpenXR/DeviceIdentity.h b/DrvOpenXR/DeviceIdentity.h index 949ce3df..3055446f 100644 --- a/DrvOpenXR/DeviceIdentity.h +++ b/DrvOpenXR/DeviceIdentity.h @@ -23,11 +23,16 @@ struct RuntimeDevice { std::string name, serial; }; -/** The HMD of the OpenXR system of that name: its row if the table has one, else what the runtime says (the system - * name as the manufacturer and model number, the device's name and serial where libmonado gives them) on the generic - * answers that games branch on (tracking system, controller type, render model). With no system name (no runtime - * yet) the generic answers alone. */ -DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& device = {}); +/** The HMD's manufacturer for an OpenXR system's vendor ID (XrSystemProperties::vendorId): the maker's name as + * SteamVR gives it for the vendors known, else the first word of the runtime's name; empty without either */ +std::string HmdManufacturer(uint32_t vendorId, const std::string& runtimeName); + +/** The HMD of the OpenXR system of that name: its row if the table has one, else what the runtime says (the + * manufacturer from the system's vendor ID, else the runtime's name; the system name as the model number, the + * device's name and serial where libmonado gives them) on the generic answers that games branch on (tracking system, + * controller type, render model). With no system name (no runtime yet) the generic answers alone. */ +DeviceIdentity HmdIdentity(const std::string& xrSystemName, const RuntimeDevice& device = {}, uint32_t vendorId = 0, + const std::string& runtimeName = std::string()); /** A controller of that profile in that hand: the profile's OpenVR name and render models, its buttons. The serial is * the runtime's where libmonado gives one, else one that is the hand's own. */ diff --git a/DrvOpenXR/DrvOpenXR.cpp b/DrvOpenXR/DrvOpenXR.cpp index 35cc3cae..b38819fd 100644 --- a/DrvOpenXR/DrvOpenXR.cpp +++ b/DrvOpenXR/DrvOpenXR.cpp @@ -189,6 +189,11 @@ struct InstancePlan { XrGraphicsApiSupportedFlags apiFlags = 0; }; +// The running instance's plan, set once at start-up: an instance made again after a loss has the same +static InstancePlan currentPlan; +// A new instance after a loss whose headset isn't there yet (RemakeInstance keeps it); until FullShutdown +static bool madeAgain = false; + // The extensions OpenLamina enables, of those available, for a session of that kind InstancePlan PlanInstance(const std::set& available, SessionKind kind) { @@ -207,9 +212,13 @@ InstancePlan PlanInstance(const std::set& available, SessionKind ki } #endif #if defined(SUPPORT_VK) + // XR_KHR_vulkan_enable where it's there (its extension lists are what a game's own device needs), else enable2 if (available.count(XR_KHR_VULKAN_ENABLE_EXTENSION_NAME)) { plan.extensions.push_back(XR_KHR_VULKAN_ENABLE_EXTENSION_NAME); plan.apiFlags |= XR_SUPPORTED_GRAPHICS_API_VK; + } else if (available.count(XR_KHR_VULKAN_ENABLE2_EXTENSION_NAME)) { + plan.extensions.push_back(XR_KHR_VULKAN_ENABLE2_EXTENSION_NAME); + plan.apiFlags |= XR_SUPPORTED_GRAPHICS_API_VK; } #endif #if defined(SUPPORT_GL) @@ -238,6 +247,10 @@ InstancePlan PlanInstance(const std::set& available, SessionKind ki if (available.count(XR_EXT_HAND_TRACKING_EXTENSION_NAME)) plan.extensions.push_back(XR_EXT_HAND_TRACKING_EXTENSION_NAME); + // Vive trackers by their role (/user/vive_tracker_htcx/role/waist), poses only + if (available.contains(OC_XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME)) + plan.extensions.push_back(OC_XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); + if (available.count(XR_MNDX_XDEV_SPACE_EXTENSION_NAME)) plan.extensions.push_back(XR_MNDX_XDEV_SPACE_EXTENSION_NAME); @@ -259,6 +272,9 @@ InstancePlan PlanInstance(const std::set& available, SessionKind ki OC_XR_FB_TOUCH_CONTROLLER_PROXIMITY_EXTENSION_NAME, XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME, XR_MSFT_HAND_INTERACTION_EXTENSION_NAME }) if (available.contains(profileExtension)) plan.extensions.push_back(profileExtension); + // XR_EXT_hand_interaction's hands are shown as a controller unless handController is off + if (oovr_global_configuration.HandController() != "off" && available.contains(OC_XR_EXT_HAND_INTERACTION_EXTENSION_NAME)) + plan.extensions.push_back(OC_XR_EXT_HAND_INTERACTION_EXTENSION_NAME); if (available.contains(XR_KHR_COMPOSITION_LAYER_CYLINDER_EXTENSION_NAME)) plan.extensions.push_back(XR_KHR_COMPOSITION_LAYER_CYLINDER_EXTENSION_NAME); @@ -351,8 +367,14 @@ XrResult MakeInstance(const InstancePlan& plan, XrInstance* instance, XrVersion* #endif XrResult res = DrvOpenXR::CreateInstanceNewestVersion(createInfo, instance, version, xrCreateInstance); - if (XR_SUCCEEDED(res)) + if (XR_SUCCEEDED(res)) { OOVR_LOGF("Created the OpenXR instance for OpenXR %d.%d", (int)XR_VERSION_MAJOR(*version), (int)XR_VERSION_MINOR(*version)); + XrInstanceProperties properties = { XR_TYPE_INSTANCE_PROPERTIES }; + if (XR_SUCCEEDED(xrGetInstanceProperties(*instance, &properties))) { + OOVR_LOGF("OpenXR runtime: %s %d.%d.%d", properties.runtimeName, (int)XR_VERSION_MAJOR(properties.runtimeVersion), + (int)XR_VERSION_MINOR(properties.runtimeVersion), (int)XR_VERSION_PATCH(properties.runtimeVersion)); + } + } return res; } @@ -521,6 +543,7 @@ IBackend* DrvOpenXR::CreateOpenXRBackend(const char* startupInfo, vr::EVRInitErr // Create the OpenXR instance - this is the overall handle that connects us to the runtime, or take the one // VR_IsHmdPresent made for a scene application const InstancePlan plan = PlanInstance(availableExtensions, choice.kind); + currentPlan = plan; const std::vector& extensions = plan.extensions; const XrGraphicsApiSupportedFlags apiFlags = plan.apiFlags; xr_instance = TakeProbedInstance(plan, &xr_instance_version); @@ -642,6 +665,8 @@ XrResult DrvOpenXR::SetupSession() OOVR_LOGF("Started OpenXR session on runtime '%s', hand tracking supported: %d", xr_gbl->systemProperties.systemName, xr_gbl->handTrackingProperties.supportsHandTracking); + currentBackend->ForgetTrackerSpaces(); + // If required, re-setup the input system for this new session BaseInput* input = GetUnsafeBaseInput(); if (input) @@ -651,6 +676,50 @@ XrResult DrvOpenXR::SetupSession() return XR_SUCCESS; } +XrResult DrvOpenXR::FindSystem() +{ + return CreateSystemID(); +} + +XrResult DrvOpenXR::RemakeInstance() +{ +#ifdef _DEBUG + // It went with the old instance + dbgMessenger = NULL; +#endif + // A new instance made at an earlier try is kept while the headset isn't there yet + if (!madeAgain) { + if (xr_instance) { + if (XR_FAILED(xrDestroyInstance(xr_instance))) + OOVR_LOG("xrDestroyInstance of the lost instance failed"); + xr_instance = XR_NULL_HANDLE; + } + if (XrResult res = MakeInstance(currentPlan, &xr_instance, &xr_instance_version); XR_FAILED(res)) { + OOVR_LOGF("The OpenXR instance can't be made again yet: %d", (int)res); + xr_instance = XR_NULL_HANDLE; + return res; + } + // The old function table isn't freed: a thread outside the session lock may still be reading it + xr_ext = new XrExt(currentPlan.apiFlags, currentPlan.extensions); + madeAgain = true; + } + if (XrResult res = CreateSystemID(); XR_FAILED(res)) + return res; + uint32_t viewCount = 0; + if (XrResult res = xrEnumerateViewConfigurationViews(xr_instance, xr_system, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, 0, &viewCount, nullptr); XR_FAILED(res)) + return res; + std::vector views(viewCount, { XR_TYPE_VIEW_CONFIGURATION_VIEW }); + if (XrResult res = xrEnumerateViewConfigurationViews(xr_instance, xr_system, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO, viewCount, &viewCount, views.data()); XR_FAILED(res)) + return res; + // The game sized its textures for two views: a headset with another count isn't one to go on with + if (viewCount != XruEyeCount) + return XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED; + xr_views_list = views; + madeAgain = false; // the next loss makes another + OOVR_LOG("Made the OpenXR instance again"); + return XR_SUCCESS; +} + void DrvOpenXR::KeepOverlaysInstance() { if (currentBackend) @@ -721,6 +790,7 @@ void DrvOpenXR::FullShutdown() } initialised = false; + madeAgain = false; currentBackend = nullptr; SetCurrentSessionKind(SessionKind::Scene); } diff --git a/DrvOpenXR/GfxInterop.cpp b/DrvOpenXR/GfxInterop.cpp index bfdabae7..d6495ae1 100644 --- a/DrvOpenXR/GfxInterop.cpp +++ b/DrvOpenXR/GfxInterop.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -19,18 +20,22 @@ #include #endif +#include "../OpenOVR/Compositor/FormatTable.h" +#include "../OpenOVR/Compositor/compositor.h" #include "../OpenOVR/Reimpl/BaseSystem.h" #include "../OpenOVR/logging.h" #include #include +#include +#include using Microsoft::WRL::ComPtr; namespace { // More textures than a game submits in turn (its swapchain's, a few per eye): the copies are dropped and made again -constexpr size_t kMaxCopies = 16; +constexpr size_t kMaxCopies = 32; uint64_t PackLuid(const LUID& luid) { @@ -121,22 +126,19 @@ constexpr GLenum kReadFramebufferBinding = 0x8CAA, kDrawFramebufferBinding = 0x8 constexpr GLenum kColorAttachment0 = 0x8CE0, kFramebufferSrgb = 0x8DB9; constexpr GLenum kAccessWriteDiscard = 0x0002; // WGL_ACCESS_WRITE_DISCARD_NV -// The DXGI format of a GL internal format (the pattern's and the common colour formats), DXGI_FORMAT_UNKNOWN else +constexpr GLenum kTexture2DArray = 0x8C1A, kTextureBinding2DArray = 0x8C1D, kTextureDepth = 0x8071; +constexpr GLenum kTexture2DMultisample = 0x9100, kTextureBinding2DMultisample = 0x9104; +constexpr GLenum kRenderbuffer = 0x8D41, kRenderbufferBinding = 0x8CA7, kRenderbufferWidth = 0x8D42, kRenderbufferHeight = 0x8D43, + kRenderbufferInternalFormat = 0x8D44, kRenderbufferSamples = 0x8CAB; + +// The DXGI format of a GL internal format: the one of the same texels, else one the blit converts into; UNKNOWN for +// formats no table knows (and compressed or integer ones) DXGI_FORMAT DxgiOfGl(GLint format) { - switch (format) { - case 0x8C43: // GL_SRGB8_ALPHA8 - return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; - case 0x8058: // GL_RGBA8 - case GL_RGBA: - return DXGI_FORMAT_R8G8B8A8_UNORM; - case 0x881A: // GL_RGBA16F - return DXGI_FORMAT_R16G16B16A16_FLOAT; - case 0x8059: // GL_RGB10_A2 - return DXGI_FORMAT_R10G10B10A2_UNORM; - default: - return DXGI_FORMAT_UNKNOWN; - } + std::optional dxgi = SameTexelsIn(GfxApiKind::OpenGL, format, GfxApiKind::D3D11); + if (!dxgi) + dxgi = ConvertibleColourIn(GfxApiKind::OpenGL, format, GfxApiKind::D3D11); + return dxgi ? (DXGI_FORMAT)*dxgi : DXGI_FORMAT_UNKNOWN; } class GLInterop : public GfxInterop { @@ -151,6 +153,10 @@ class GLInterop : public GfxInterop { using BindFramebuffer = void(APIENTRY*)(GLenum, GLuint); using FramebufferTexture2D = void(APIENTRY*)(GLenum, GLenum, GLenum, GLuint, GLint); using BlitFramebuffer = void(APIENTRY*)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); + using FramebufferTextureLayer = void(APIENTRY*)(GLenum, GLenum, GLuint, GLint, GLint); + using FramebufferRenderbuffer = void(APIENTRY*)(GLenum, GLenum, GLenum, GLuint); + using BindRenderbuffer = void(APIENTRY*)(GLenum, GLuint); + using GetRenderbufferParameteriv = void(APIENTRY*)(GLenum, GLenum, GLint*); OpenDevice openDevice = nullptr; CloseDevice closeDevice = nullptr; @@ -162,17 +168,39 @@ class GLInterop : public GfxInterop { BindFramebuffer bindFramebuffer = nullptr; FramebufferTexture2D framebufferTexture2D = nullptr; BlitFramebuffer blitFramebuffer = nullptr; + // Optional: without them, array textures and renderbuffers aren't copied + FramebufferTextureLayer framebufferTextureLayer = nullptr; + FramebufferRenderbuffer framebufferRenderbuffer = nullptr; + BindRenderbuffer bindRenderbuffer = nullptr; + GetRenderbufferParameteriv getRenderbufferParameteriv = nullptr; HANDLE interopDevice = nullptr; GLuint framebuffers[2] = {}; + // How the game's image is read: a texture's level 0, a slice of an array texture, a renderbuffer or a multisampled + // texture (the last two through a resolving blit) + enum class Kind { + Texture, + Array, + Renderbuffer, + Multisampled, + }; + struct Source { + Kind kind = Kind::Texture; + GLint layer = 0; + GLint width = 0, height = 0, format = 0, layers = 1, samples = 0; + // A blit from it resolves samples, so it can't turn the rows over or change the format + bool Resolves() const { return kind == Kind::Multisampled || (kind == Kind::Renderbuffer && samples > 1); } + }; + struct Copy { GLint width = 0, height = 0, format = 0; ComPtr tex; GLuint name = 0; HANDLE object = nullptr; }; - std::map copies; + // By name and kind (a renderbuffer and a texture may have the same name); an array's slices share one + std::map, Copy> copies; vr::ETextureType Type() const override { return vr::TextureType_OpenGL; } @@ -195,6 +223,10 @@ class GLInterop : public GfxInterop { OC_GL_LOAD(framebufferTexture2D, "glFramebufferTexture2D"); OC_GL_LOAD(blitFramebuffer, "glBlitFramebuffer"); #undef OC_GL_LOAD + framebufferTextureLayer = (FramebufferTextureLayer)wglGetProcAddress("glFramebufferTextureLayer"); + framebufferRenderbuffer = (FramebufferRenderbuffer)wglGetProcAddress("glFramebufferRenderbuffer"); + bindRenderbuffer = (BindRenderbuffer)wglGetProcAddress("glBindRenderbuffer"); + getRenderbufferParameteriv = (GetRenderbufferParameteriv)wglGetProcAddress("glGetRenderbufferParameteriv"); if (!MakeDevice()) return false; interopDevice = openDevice(device); @@ -227,19 +259,98 @@ class GLInterop : public GfxInterop { } } - Copy* CopyFor(GLuint src) + // Reads the image's size and format as `kind` (a texture's target bound for the query, and bound back after) + void Query(GLuint src, Source& source) { + source.width = source.height = source.format = 0; + source.layers = 1; + if (source.kind == Kind::Renderbuffer) { + GLint previous = 0; + glGetIntegerv(kRenderbufferBinding, &previous); + bindRenderbuffer(kRenderbuffer, src); + GLint bound = 0; + glGetIntegerv(kRenderbufferBinding, &bound); + if ((GLuint)bound != src) + return; + getRenderbufferParameteriv(kRenderbuffer, kRenderbufferWidth, &source.width); + getRenderbufferParameteriv(kRenderbuffer, kRenderbufferHeight, &source.height); + getRenderbufferParameteriv(kRenderbuffer, kRenderbufferInternalFormat, &source.format); + getRenderbufferParameteriv(kRenderbuffer, kRenderbufferSamples, &source.samples); + bindRenderbuffer(kRenderbuffer, (GLuint)previous); + return; + } + GLenum target = GL_TEXTURE_2D, binding = GL_TEXTURE_BINDING_2D; + if (source.kind == Kind::Array) { + target = kTexture2DArray; + binding = kTextureBinding2DArray; + } else if (source.kind == Kind::Multisampled) { + target = kTexture2DMultisample; + binding = kTextureBinding2DMultisample; + } GLint previous = 0; - glGetIntegerv(GL_TEXTURE_BINDING_2D, &previous); - glBindTexture(GL_TEXTURE_2D, src); - GLint width = 0, height = 0, format = 0; - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &format); - glBindTexture(GL_TEXTURE_2D, previous); + glGetIntegerv(binding, &previous); + glBindTexture(target, src); + // A texture of another target isn't bound, and the one bound before mustn't be read + GLint bound = 0; + glGetIntegerv(binding, &bound); + if ((GLuint)bound != src) + return; + glGetTexLevelParameteriv(target, 0, GL_TEXTURE_WIDTH, &source.width); + glGetTexLevelParameteriv(target, 0, GL_TEXTURE_HEIGHT, &source.height); + glGetTexLevelParameteriv(target, 0, GL_TEXTURE_INTERNAL_FORMAT, &source.format); + if (source.kind == Kind::Array) + glGetTexLevelParameteriv(target, 0, kTextureDepth, &source.layers); + glBindTexture(target, (GLuint)previous); + } - auto it = copies.find(src); - if (it != copies.end() && it->second.width == width && it->second.height == height && it->second.format == format) + // What the submit names: the slice as GLCompositor picks it (SubmitWithArrayIndex's, else the eye's for an array + // texture), a renderbuffer, or a texture, multisampled if it has no plain level 0. False (logged) if it's none of + // them, or this GL lacks what's needed to read it. The GL errors of the tries are the caller's to clear. + bool Identify(GLuint src, vr::EVRSubmitFlags submitFlags, int eye, Source& source) + { + const std::optional slice = SubmitArraySlice::Current(); + const bool array = (submitFlags & vr::Submit_GlArrayTexture) || slice.has_value(); + source.layer = array ? (GLint)(slice ? *slice : (uint32_t)(eye == 1 ? 1 : 0)) : 0; + if ((submitFlags & vr::Submit_GlRenderBuffer) && !array) { + if (!bindRenderbuffer || !getRenderbufferParameteriv || !framebufferRenderbuffer) { + OOVR_LOG_ONCE("Graphics interop: this OpenGL can't read renderbuffers: frame left out"); + return false; + } + source.kind = Kind::Renderbuffer; + Query(src, source); + } else if (array) { + if (!framebufferTextureLayer) { + OOVR_LOG_ONCE("Graphics interop: this OpenGL can't read array textures: frame left out"); + return false; + } + source.kind = Kind::Array; + Query(src, source); + // A plain texture given to SubmitWithArrayIndex with slice 0 is taken as it is + if (source.width <= 0 && source.layer == 0) { + source.kind = Kind::Texture; + Query(src, source); + } + } else { + source.kind = Kind::Texture; + Query(src, source); + if (source.width <= 0) { + source.kind = Kind::Multisampled; + Query(src, source); + } + } + if (source.width <= 0 || source.height <= 0 || source.layer >= source.layers) { + OOVR_LOG_ONCEF("Graphics interop: an OpenGL image that can't be read (%dx%d, slice %d of %d): frame left out", source.width, + source.height, source.layer, source.layers); + return false; + } + return true; + } + + Copy* CopyFor(GLuint src, const Source& source) + { + const std::pair key{ src, source.kind }; + auto it = copies.find(key); + if (it != copies.end() && it->second.width == source.width && it->second.height == source.height && it->second.format == source.format) return &it->second; if (it != copies.end()) { Drop(it->second); @@ -251,37 +362,47 @@ class GLInterop : public GfxInterop { copies.clear(); } - DXGI_FORMAT dxgi = DxgiOfGl(format); - if (dxgi == DXGI_FORMAT_UNKNOWN || width <= 0 || height <= 0) { - OOVR_LOG_ONCEF("Graphics interop: an OpenGL texture of internal format 0x%x (%dx%d) can't be copied", format, width, height); + DXGI_FORMAT dxgi = DxgiOfGl(source.format); + if (dxgi == DXGI_FORMAT_UNKNOWN) { + OOVR_LOG_ONCEF("Graphics interop: an OpenGL image of internal format 0x%x (%dx%d) can't be copied", source.format, source.width, source.height); + return nullptr; + } + if (source.Resolves() && !SameTexelsIn(GfxApiKind::OpenGL, source.format, GfxApiKind::D3D11)) { + OOVR_LOG_ONCEF("Graphics interop: a multisampled OpenGL image of internal format 0x%x has no D3D11 format of its own: frame left out", source.format); return nullptr; } Copy copy; - copy.width = width; - copy.height = height; - copy.format = format; - copy.tex = MakeTexture(device, width, height, dxgi, 0); + copy.width = source.width; + copy.height = source.height; + copy.format = source.format; + copy.tex = MakeTexture(device, source.width, source.height, dxgi, 0); if (copy.tex) { glGenTextures(1, ©.name); copy.object = registerObject(interopDevice, copy.tex.Get(), copy.name, GL_TEXTURE_2D, kAccessWriteDiscard); } if (!copy.object) { - OOVR_LOG_ONCEF("Graphics interop: an OpenGL texture of internal format 0x%x couldn't be shared with D3D11", format); + OOVR_LOG_ONCEF("Graphics interop: an OpenGL image of internal format 0x%x couldn't be shared with D3D11 (DXGI format %d)", source.format, (int)dxgi); Drop(copy); return nullptr; } - return &(copies[src] = std::move(copy)); + return &(copies[key] = std::move(copy)); } - ID3D11Texture2D* CopyIn(const vr::Texture_t* tex, const vr::VRTextureBounds_t*) override + Copied CopyIn(const vr::Texture_t* tex, vr::EVRSubmitFlags submitFlags, int eye) override { GLuint src = (GLuint)(intptr_t)tex->handle; - Copy* copy = CopyFor(src); - if (!copy) - return nullptr; + Source source; + const bool known = Identify(src, submitFlags, eye, source); + Copy* copy = known ? CopyFor(src, source) : nullptr; + if (!copy) { + // The tries' errors aren't the game's + for (int i = 0; i < 32 && glGetError() != GL_NO_ERROR; i++) { + } + return {}; + } if (!lockObjects(interopDevice, 1, ©->object)) { OOVR_LOG_ONCE("Graphics interop: wglDXLockObjectsNV failed: frame left out"); - return nullptr; + return {}; } // The game's own earlier errors aren't this copy's (at most 32: the context reports each one once) for (int i = 0; i < 32 && glGetError() != GL_NO_ERROR; i++) { @@ -295,12 +416,33 @@ class GLInterop : public GfxInterop { glDisable(GL_SCISSOR_TEST); glDisable(kFramebufferSrgb); bindFramebuffer(kReadFramebuffer, framebuffers[0]); - framebufferTexture2D(kReadFramebuffer, kColorAttachment0, GL_TEXTURE_2D, src, 0); + switch (source.kind) { + case Kind::Renderbuffer: + framebufferRenderbuffer(kReadFramebuffer, kColorAttachment0, kRenderbuffer, src); + break; + case Kind::Array: + framebufferTextureLayer(kReadFramebuffer, kColorAttachment0, src, 0, source.layer); + break; + case Kind::Multisampled: + framebufferTexture2D(kReadFramebuffer, kColorAttachment0, kTexture2DMultisample, src, 0); + break; + default: + framebufferTexture2D(kReadFramebuffer, kColorAttachment0, GL_TEXTURE_2D, src, 0); + break; + } bindFramebuffer(kDrawFramebuffer, framebuffers[1]); framebufferTexture2D(kDrawFramebuffer, kColorAttachment0, GL_TEXTURE_2D, copy->name, 0); - // GL's rows run bottom-up, D3D's top-down: turned over as it's copied - blitFramebuffer(0, 0, copy->width, copy->height, 0, copy->height, copy->width, 0, GL_COLOR_BUFFER_BIT, GL_NEAREST); - framebufferTexture2D(kReadFramebuffer, kColorAttachment0, GL_TEXTURE_2D, 0, 0); + // GL's rows run bottom-up, D3D's top-down: turned over as it's copied. A blit that resolves samples can't also + // turn them over: copied as they are, and the bounds turn them. + const bool resolves = source.Resolves(); + if (resolves) + blitFramebuffer(0, 0, copy->width, copy->height, 0, 0, copy->width, copy->height, GL_COLOR_BUFFER_BIT, GL_NEAREST); + else + blitFramebuffer(0, 0, copy->width, copy->height, 0, copy->height, copy->width, 0, GL_COLOR_BUFFER_BIT, GL_NEAREST); + if (source.kind == Kind::Renderbuffer) + framebufferRenderbuffer(kReadFramebuffer, kColorAttachment0, kRenderbuffer, 0); + else + framebufferTexture2D(kReadFramebuffer, kColorAttachment0, GL_TEXTURE_2D, 0, 0); framebufferTexture2D(kDrawFramebuffer, kColorAttachment0, GL_TEXTURE_2D, 0, 0); bindFramebuffer(kReadFramebuffer, read); bindFramebuffer(kDrawFramebuffer, draw); @@ -312,9 +454,9 @@ class GLInterop : public GfxInterop { unlockObjects(interopDevice, 1, ©->object); if (error != GL_NO_ERROR) { OOVR_LOG_ONCEF("Graphics interop: the OpenGL copy failed (0x%x): frame left out", error); - return nullptr; + return {}; } - return copy->tex.Get(); + return { copy->tex.Get(), resolves }; } }; @@ -349,24 +491,11 @@ std::unique_ptr GfxInterop::ForGL(ID3D11Device*) namespace { +// The DXGI format of the same texels (a copy can't convert), UNKNOWN if there's none DXGI_FORMAT DxgiOfVk(VkFormat format) { - switch (format) { - case VK_FORMAT_R8G8B8A8_SRGB: - return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; - case VK_FORMAT_R8G8B8A8_UNORM: - return DXGI_FORMAT_R8G8B8A8_UNORM; - case VK_FORMAT_B8G8R8A8_SRGB: - return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; - case VK_FORMAT_B8G8R8A8_UNORM: - return DXGI_FORMAT_B8G8R8A8_UNORM; - case VK_FORMAT_R16G16B16A16_SFLOAT: - return DXGI_FORMAT_R16G16B16A16_FLOAT; - case VK_FORMAT_A2B10G10R10_UNORM_PACK32: - return DXGI_FORMAT_R10G10B10A2_UNORM; - default: - return DXGI_FORMAT_UNKNOWN; - } + std::optional dxgi = SameTexelsIn(GfxApiKind::Vulkan, (int64_t)format, GfxApiKind::D3D11); + return dxgi ? (DXGI_FORMAT)*dxgi : DXGI_FORMAT_UNKNOWN; } // The typeless one of a format's group, for a shared texture where the typed one can't be shared @@ -379,6 +508,13 @@ DXGI_FORMAT TypelessOf(DXGI_FORMAT format) case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: case DXGI_FORMAT_B8G8R8A8_UNORM: return DXGI_FORMAT_B8G8R8A8_TYPELESS; + case DXGI_FORMAT_R16G16B16A16_FLOAT: + case DXGI_FORMAT_R16G16B16A16_UNORM: + return DXGI_FORMAT_R16G16B16A16_TYPELESS; + case DXGI_FORMAT_R10G10B10A2_UNORM: + return DXGI_FORMAT_R10G10B10A2_TYPELESS; + case DXGI_FORMAT_R32G32B32A32_FLOAT: + return DXGI_FORMAT_R32G32B32A32_TYPELESS; default: return format; } @@ -395,12 +531,26 @@ class VkInterop : public GfxInterop { VkQueue queue = VK_NULL_HANDLE; uint32_t family = 0; VkCommandPool pool = VK_NULL_HANDLE; - VkCommandBuffer commands = VK_NULL_HANDLE; - VkFence fence = VK_NULL_HANDLE; + // The copies' command buffers and fences, used in turn (two eyes, two frames), so a copy doesn't wait for the other + // eye's. pending: submitted, and its fence not seen signalled yet. + struct Slot { + VkCommandBuffer commands = VK_NULL_HANDLE; + VkFence fence = VK_NULL_HANDLE; + bool pending = false; + }; + static constexpr int kSlots = 4; + Slot slots[kSlots]; + int nextSlot = 0; PFN_vkGetMemoryWin32HandlePropertiesKHR getHandleProperties = nullptr; - // A copy was submitted and its fence hasn't been seen signalled: the command buffer, the fence and the images are - // in use until it is - bool pending = false; + // The GPU-side wait, where the game's device has VK_KHR_external_semaphore_win32 and D3D11 has shared fences + // (ID3D11Device5): fences[0] is signalled by D3D11 once it's done with the copies so far, which the Vulkan copy + // waits for; fences[1] by the Vulkan copy, which D3D11 waits for. Both are imported into the game's device as + // semaphores. Without them, the copy is waited for on the CPU. + ComPtr fences[2]; + VkSemaphore semaphores[2] = { VK_NULL_HANDLE, VK_NULL_HANDLE }; + ComPtr context4; + uint64_t fenceValue = 0; + bool gpuWait = false; struct Copy { uint32_t width = 0, height = 0; @@ -409,7 +559,8 @@ class VkInterop : public GfxInterop { VkImage image = VK_NULL_HANDLE; VkDeviceMemory memory = VK_NULL_HANDLE; }; - std::map copies; + // By image and layer: an array's eyes each have their own + std::map, Copy> copies; vr::ETextureType Type() const override { return vr::TextureType_Vulkan; } @@ -421,29 +572,46 @@ class VkInterop : public GfxInterop { vkFreeMemory(vkDevice, copy.memory, nullptr); } - // Waits up to timeoutNs for the copy submitted last: VK_SUCCESS once it's done (or there was none), VK_TIMEOUT - // while it still runs, when nothing it uses may be reset or freed, or the error of a lost device, which ends it. - VkResult WaitForCopy(uint64_t timeoutNs) + // Waits up to timeoutNs for the slot's copy: VK_SUCCESS once it's done (or there was none), VK_TIMEOUT while it + // still runs, when nothing it uses may be reset or freed, or the error of a lost device, which ends it. + VkResult WaitForSlot(Slot& slot, uint64_t timeoutNs) { - if (!pending) + if (!slot.pending) return VK_SUCCESS; - VkResult result = vkWaitForFences(vkDevice, 1, &fence, VK_TRUE, timeoutNs); + VkResult result = vkWaitForFences(vkDevice, 1, &slot.fence, VK_TRUE, timeoutNs); if (result != VK_TIMEOUT) - pending = false; + slot.pending = false; return result; } + // The same for every copy submitted: before the copies' images or the command buffers are freed + VkResult WaitForCopies(uint64_t timeoutNs) + { + for (Slot& slot : slots) { + VkResult result = WaitForSlot(slot, timeoutNs); + if (result == VK_TIMEOUT) + return result; + } + return VK_SUCCESS; + } + ~VkInterop() override { - if (WaitForCopy(kShutdownTimeoutNs) == VK_TIMEOUT) { + if (WaitForCopies(kShutdownTimeoutNs) == VK_TIMEOUT) { // Still running on the game's queue: its objects are left to the device OOVR_LOG("Graphics interop: the last Vulkan copy never finished; its objects aren't freed"); return; } for (auto& kv : copies) Drop(kv.second); - if (fence) - vkDestroyFence(vkDevice, fence, nullptr); + for (VkSemaphore semaphore : semaphores) { + if (semaphore) + vkDestroySemaphore(vkDevice, semaphore, nullptr); + } + for (Slot& slot : slots) { + if (slot.fence) + vkDestroyFence(vkDevice, slot.fence, nullptr); + } if (pool) vkDestroyCommandPool(vkDevice, pool, nullptr); } @@ -471,21 +639,75 @@ class VkInterop : public GfxInterop { return false; } - // Signalled, so a teardown before the first copy doesn't wait for it (CopyIn resets it before each submit) + // Signalled, so a teardown before the first copy doesn't wait for them (CopyIn resets one before each submit) VkFenceCreateInfo fenceInfo{ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO }; fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT; - return vkCreateFence(vkDevice, &fenceInfo, nullptr, &fence) == VK_SUCCESS; + for (Slot& slot : slots) { + if (vkCreateFence(vkDevice, &fenceInfo, nullptr, &slot.fence) != VK_SUCCESS) + return false; + } + gpuWait = SetUpGpuWait(); + OOVR_LOGF("Graphics interop: Vulkan copies are waited for %s", gpuWait ? "on the GPU (shared fences)" : "on the CPU"); + return true; + } + + // The shared fences and their semaphores: false (with none left) where either side lacks them + bool SetUpGpuWait() + { + auto importSemaphore = (PFN_vkImportSemaphoreWin32HandleKHR)vkGetDeviceProcAddr(vkDevice, "vkImportSemaphoreWin32HandleKHR"); + ComPtr device5; + ComPtr context; + device->GetImmediateContext(&context); + ComPtr multithread; + if (!importSemaphore || FAILED(device->QueryInterface(IID_PPV_ARGS(&device5))) || !context || FAILED(context.As(&context4)) + || FAILED(context.As(&multithread))) + return false; + // Its context is used from the game's and the overlays' threads + multithread->SetMultithreadProtected(TRUE); + bool ok = true; + for (int i = 0; ok && i < 2; i++) { + HANDLE handle = nullptr; + ok = SUCCEEDED(device5->CreateFence(0, D3D11_FENCE_FLAG_SHARED, IID_PPV_ARGS(&fences[i]))) + && SUCCEEDED(fences[i]->CreateSharedHandle(nullptr, GENERIC_ALL, nullptr, &handle)); + VkSemaphoreCreateInfo semaphoreInfo{ VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO }; + ok = ok && vkCreateSemaphore(vkDevice, &semaphoreInfo, nullptr, &semaphores[i]) == VK_SUCCESS; + if (ok) { + VkImportSemaphoreWin32HandleInfoKHR import{ VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR }; + import.semaphore = semaphores[i]; + import.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT; + import.handle = handle; + ok = importSemaphore(vkDevice, &import) == VK_SUCCESS; + } + // Importing doesn't take the handle over + if (handle) + CloseHandle(handle); + } + if (!ok) { + OOVR_LOG("Graphics interop: no shared fences between D3D11 and the game's Vulkan device"); + for (VkSemaphore& semaphore : semaphores) { + if (semaphore) + vkDestroySemaphore(vkDevice, semaphore, nullptr); + semaphore = VK_NULL_HANDLE; + } + fences[0].Reset(); + fences[1].Reset(); + context4.Reset(); + } + return ok; } - // A command buffer of the game's queue's family (which comes with each texture) + // The slots' command buffers, of the game's queue's family (which comes with each texture) bool CommandsFor(uint32_t queueFamily) { if (pool && family == queueFamily) return true; + if (WaitForCopies(kCopyTimeoutNs) == VK_TIMEOUT) + return false; if (pool) vkDestroyCommandPool(vkDevice, pool, nullptr); pool = VK_NULL_HANDLE; - commands = VK_NULL_HANDLE; + for (Slot& slot : slots) + slot.commands = VK_NULL_HANDLE; family = queueFamily; VkCommandPoolCreateInfo poolInfo{ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO }; poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; @@ -494,20 +716,33 @@ class VkInterop : public GfxInterop { pool = VK_NULL_HANDLE; return false; } + VkCommandBuffer buffers[kSlots] = {}; VkCommandBufferAllocateInfo bufferInfo{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO }; bufferInfo.commandPool = pool; - bufferInfo.commandBufferCount = 1; + bufferInfo.commandBufferCount = kSlots; bufferInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; - return vkAllocateCommandBuffers(vkDevice, &bufferInfo, &commands) == VK_SUCCESS; + if (vkAllocateCommandBuffers(vkDevice, &bufferInfo, buffers) != VK_SUCCESS) { + vkDestroyCommandPool(vkDevice, pool, nullptr); + pool = VK_NULL_HANDLE; + return false; + } + for (int i = 0; i < kSlots; i++) + slots[i].commands = buffers[i]; + return true; } - Copy* CopyFor(const vr::VRVulkanTextureData_t* data) + Copy* CopyFor(const vr::VRVulkanTextureData_t* data, uint32_t layer) { - VkImage src = (VkImage)data->m_nImage; + const std::pair src{ (VkImage)data->m_nImage, layer }; auto it = copies.find(src); if (it != copies.end() && it->second.width == data->m_nWidth && it->second.height == data->m_nHeight && it->second.format == (VkFormat)data->m_nFormat) return &it->second; + // A copy freed below may still be written by one running + if ((it != copies.end() || copies.size() >= kMaxCopies) && WaitForCopies(kCopyTimeoutNs) == VK_TIMEOUT) { + OOVR_LOG_ONCE("Graphics interop: an earlier Vulkan copy is still running: frame left out"); + return nullptr; + } if (it != copies.end()) { Drop(it->second); copies.erase(it); @@ -586,26 +821,39 @@ class VkInterop : public GfxInterop { return &(copies[src] = std::move(copy)); } - ID3D11Texture2D* CopyIn(const vr::Texture_t* tex, const vr::VRTextureBounds_t*) override + Copied CopyIn(const vr::Texture_t* tex, vr::EVRSubmitFlags submitFlags, int) override { auto* data = (const vr::VRVulkanTextureData_t*)tex->handle; - // A copy that didn't finish in time last frame may still be running behind the game's own work - if (WaitForCopy(kCopyTimeoutNs) == VK_TIMEOUT) { - OOVR_LOG_ONCE("Graphics interop: the last Vulkan copy is still running: frame left out"); - return nullptr; + // The layer: SubmitWithArrayIndex's, else the array data's, else the first + uint32_t layer = 0; + if (std::optional slice = SubmitArraySlice::Current()) + layer = *slice; + else if (submitFlags & vr::Submit_VulkanTextureWithArrayData) { + const auto* array = (const vr::VRVulkanTextureArrayData_t*)data; + if (array->m_unArrayIndex >= array->m_unArraySize) { + OOVR_LOG_ONCEF("Graphics interop: Vulkan array layer %u of %u: frame left out", array->m_unArrayIndex, array->m_unArraySize); + return {}; + } + layer = array->m_unArrayIndex; + } + // The slot's command buffer is reused: its copy before (two frames ago) must be over + Slot& slot = slots[nextSlot]; + if (WaitForSlot(slot, kCopyTimeoutNs) == VK_TIMEOUT) { + OOVR_LOG_ONCE("Graphics interop: an earlier Vulkan copy is still running: frame left out"); + return {}; } if (!CommandsFor(data->m_nQueueFamilyIndex)) { OOVR_LOG_ONCE("Graphics interop: no Vulkan command buffer for the game's queue family"); - return nullptr; + return {}; } - Copy* copy = CopyFor(data); + Copy* copy = CopyFor(data, layer); if (!copy) - return nullptr; + return {}; - vkResetCommandBuffer(commands, 0); + vkResetCommandBuffer(slot.commands, 0); VkCommandBufferBeginInfo begin{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO }; begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; - vkBeginCommandBuffer(commands, &begin); + vkBeginCommandBuffer(slot.commands, &begin); // The game's image is in TRANSFER_SRC_OPTIMAL, as OpenVR asks of Vulkan textures; the copy is made ready to be // written, and afterwards handed to D3D11 @@ -617,16 +865,17 @@ class VkInterop : public GfxInterop { toDst.srcQueueFamilyIndex = toDst.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; toDst.image = copy->image; toDst.subresourceRange = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }; - vkCmdPipelineBarrier(commands, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &toDst); + vkCmdPipelineBarrier(slot.commands, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &toDst); + VkImageSubresourceLayers from{ VK_IMAGE_ASPECT_COLOR_BIT, 0, layer, 1 }; VkImageSubresourceLayers layers{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; if (data->m_nSampleCount > 1) { - VkImageResolve region{ layers, { 0, 0, 0 }, layers, { 0, 0, 0 }, { copy->width, copy->height, 1 } }; - vkCmdResolveImage(commands, (VkImage)data->m_nImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, copy->image, + VkImageResolve region{ from, { 0, 0, 0 }, layers, { 0, 0, 0 }, { copy->width, copy->height, 1 } }; + vkCmdResolveImage(slot.commands, (VkImage)data->m_nImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, copy->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); } else { - VkImageCopy region{ layers, { 0, 0, 0 }, layers, { 0, 0, 0 }, { copy->width, copy->height, 1 } }; - vkCmdCopyImage(commands, (VkImage)data->m_nImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, copy->image, + VkImageCopy region{ from, { 0, 0, 0 }, layers, { 0, 0, 0 }, { copy->width, copy->height, 1 } }; + vkCmdCopyImage(slot.commands, (VkImage)data->m_nImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, copy->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); } @@ -637,26 +886,53 @@ class VkInterop : public GfxInterop { release.newLayout = VK_IMAGE_LAYOUT_GENERAL; release.srcQueueFamilyIndex = family; release.dstQueueFamilyIndex = VK_QUEUE_FAMILY_EXTERNAL; - vkCmdPipelineBarrier(commands, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1, &release); - vkEndCommandBuffer(commands); + vkCmdPipelineBarrier(slot.commands, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1, &release); + vkEndCommandBuffer(slot.commands); VkSubmitInfo submit{ VK_STRUCTURE_TYPE_SUBMIT_INFO }; submit.commandBufferCount = 1; - submit.pCommandBuffers = &commands; - vkResetFences(vkDevice, 1, &fence); + submit.pCommandBuffers = &slot.commands; + // On the GPU: the copy waits for D3D11 to be done with the copies so far (it may still read last frame's), and + // D3D11 waits for the copy. Signal goes to the GPU with the Flush, which the Vulkan wait needs. + const VkPipelineStageFlags waitStage = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; + uint64_t readyValue = 0, copiedValue = 0; + VkD3D12FenceSubmitInfoKHR values{ VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR }; + bool waitOnGpu = gpuWait; + if (waitOnGpu) { + readyValue = ++fenceValue; + copiedValue = ++fenceValue; + waitOnGpu = SUCCEEDED(context4->Signal(fences[0].Get(), readyValue)); + context4->Flush(); + } + if (waitOnGpu) { + values.waitSemaphoreValuesCount = 1; + values.pWaitSemaphoreValues = &readyValue; + values.signalSemaphoreValuesCount = 1; + values.pSignalSemaphoreValues = &copiedValue; + submit.pNext = &values; + submit.waitSemaphoreCount = 1; + submit.pWaitSemaphores = &semaphores[0]; + submit.pWaitDstStageMask = &waitStage; + submit.signalSemaphoreCount = 1; + submit.pSignalSemaphores = &semaphores[1]; + } + vkResetFences(vkDevice, 1, &slot.fence); // On the queue that comes with the texture, the game's own VkQueue target = data->m_pQueue ? (VkQueue)data->m_pQueue : queue; - if (vkQueueSubmit(target, 1, &submit, fence) != VK_SUCCESS) { + if (vkQueueSubmit(target, 1, &submit, slot.fence) != VK_SUCCESS) { OOVR_LOG_ONCE("Graphics interop: vkQueueSubmit failed: frame left out"); - return nullptr; + return {}; } - // Done before D3D11 reads it - pending = true; - if (WaitForCopy(kCopyTimeoutNs) != VK_SUCCESS) { + slot.pending = true; + nextSlot = (nextSlot + 1) % kSlots; + // Done before D3D11 reads it: D3D11's own work waits on the GPU, or this thread waits for it + if (waitOnGpu && SUCCEEDED(context4->Wait(fences[1].Get(), copiedValue))) + return { copy->tex.Get(), false }; + if (WaitForSlot(slot, kCopyTimeoutNs) != VK_SUCCESS) { OOVR_LOG_ONCE("Graphics interop: the Vulkan copy didn't finish in time: frame left out"); - return nullptr; + return {}; } - return copy->tex.Get(); + return { copy->tex.Get(), false }; } }; diff --git a/DrvOpenXR/GfxInterop.h b/DrvOpenXR/GfxInterop.h index e2b8b040..9d4700ac 100644 --- a/DrvOpenXR/GfxInterop.h +++ b/DrvOpenXR/GfxInterop.h @@ -24,9 +24,18 @@ class GfxInterop { static std::unique_ptr ForVulkan(VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device, VkQueue queue, ID3D11Device* onDevice = nullptr); #endif - // The D3D11 texture holding this frame's copy of tex (the whole of its first layer, upright as shown, which the - // bounds then apply to); nullptr (logged) if it couldn't be copied - virtual ID3D11Texture2D* CopyIn(const vr::Texture_t* tex, const vr::VRTextureBounds_t* bounds) = 0; + // What CopyIn made: the D3D11 texture holding this frame's copy (nullptr, logged, if it couldn't be copied), and + // whether it lies with the source's rows as they are. That's upside down as shown for an OpenGL source read from + // samples (a renderbuffer, a multisampled texture), which a blit resolves but can't also turn over: the bounds turn + // it then. + struct Copied { + ID3D11Texture2D* texture = nullptr; + bool upsideDown = false; + }; + // Copies the whole of tex's layer that's shown: SubmitWithArrayIndex's slice, else the one the submit flags name + // (Submit_GlArrayTexture: the eye's; Submit_VulkanTextureWithArrayData: the data's), else the first. Upright as + // shown (but see Copied), which the bounds then apply to. + virtual Copied CopyIn(const vr::Texture_t* tex, vr::EVRSubmitFlags submitFlags, int eye) = 0; // The texture type copied through D3D11 virtual vr::ETextureType Type() const = 0; diff --git a/DrvOpenXR/OverlayTextureCopy.cpp b/DrvOpenXR/OverlayTextureCopy.cpp index 18f58ce8..2ef13fe2 100644 --- a/DrvOpenXR/OverlayTextureCopy.cpp +++ b/DrvOpenXR/OverlayTextureCopy.cpp @@ -501,17 +501,21 @@ ID3D11Texture2D* OverlayTextureCopy::CopyIn(const vr::Texture_t* tex, const vr:: return impl->FromD3D12((const vr::D3D12TextureData_t*)tex->handle, why); #endif #ifdef SUPPORT_GL - case vr::TextureType_OpenGL: + case vr::TextureType_OpenGL: { if (!impl->gl) impl->gl = GfxInterop::ForGL(device); if (!impl->gl) { *why = "the program's OpenGL can't share textures with D3D11 (WGL_NV_DX_interop2)"; return nullptr; } - if (ID3D11Texture2D* copied = impl->gl->CopyIn(tex, bounds)) - return copied; - *why = "the OpenGL texture couldn't be copied"; + // An overlay's texture: its first layer, as Submit_Default names it + const GfxInterop::Copied copied = impl->gl->CopyIn(tex, vr::Submit_Default, 0); + // A copy left in OpenGL's row order (a multisampled texture) isn't turned round here: not used + if (copied.texture && !copied.upsideDown) + return copied.texture; + *why = copied.upsideDown ? "the OpenGL texture is multisampled, which can't be copied upright" : "the OpenGL texture couldn't be copied"; return nullptr; + } #endif #ifdef SUPPORT_VK case vr::TextureType_Vulkan: { @@ -525,8 +529,10 @@ ID3D11Texture2D* OverlayTextureCopy::CopyIn(const vr::Texture_t* tex, const vr:: *why = "the program's Vulkan device can't share textures with D3D11 (VK_KHR_external_memory_win32, the runtime's adapter)"; return nullptr; } - if (ID3D11Texture2D* copied = impl->vk->CopyIn(tex, bounds)) - return copied; + // An overlay's texture: its first layer, as Submit_Default names it + const GfxInterop::Copied copied = impl->vk->CopyIn(tex, vr::Submit_Default, 0); + if (copied.texture) + return copied.texture; *why = "the Vulkan texture couldn't be copied"; return nullptr; } diff --git a/DrvOpenXR/OverlayTextureShare.cpp b/DrvOpenXR/OverlayTextureShare.cpp new file mode 100644 index 00000000..913b89a2 --- /dev/null +++ b/DrvOpenXR/OverlayTextureShare.cpp @@ -0,0 +1,709 @@ +#include "stdafx.h" + +#include "OverlayTextureShare.h" + +#if defined(SUPPORT_VK) && !defined(_WIN32) + +#include "../OpenOVR/logging.h" + +#ifdef SUPPORT_GL +#include +#include +#include +#endif + +#include +#include +#include + +namespace { + +// How long a copy on either side is waited for; past it the texture is read back instead +constexpr uint64_t kWaitNs = 100'000'000; + +constexpr VkImageUsageFlags kUsage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; + +// One command buffer of a queue family of a device, and its fence: for one copy at a time, waited for +struct Commands { + VkDevice device = VK_NULL_HANDLE; + uint32_t family = 0; + VkCommandPool pool = VK_NULL_HANDLE; + VkCommandBuffer buffer = VK_NULL_HANDLE; + VkFence fence = VK_NULL_HANDLE; + bool busy = false; // a submission that wasn't seen to finish: its buffer isn't reused until it has + + bool Make(VkDevice d, uint32_t f) + { + Drop(); + device = d; + family = f; + VkCommandPoolCreateInfo poolInfo{ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO }; + poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; + poolInfo.queueFamilyIndex = family; + VkCommandBufferAllocateInfo bufferInfo{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO }; + bufferInfo.commandBufferCount = 1; + bufferInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + VkFenceCreateInfo fenceInfo{ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO }; + if (vkCreateCommandPool(device, &poolInfo, nullptr, &pool) != VK_SUCCESS) { + pool = VK_NULL_HANDLE; + return false; + } + bufferInfo.commandPool = pool; + if (vkAllocateCommandBuffers(device, &bufferInfo, &buffer) == VK_SUCCESS && vkCreateFence(device, &fenceInfo, nullptr, &fence) == VK_SUCCESS) + return true; + buffer = VK_NULL_HANDLE; + Drop(); + return false; + } + void Drop() + { + if (busy && fence && vkWaitForFences(device, 1, &fence, VK_TRUE, kWaitNs) != VK_SUCCESS) { + // Still running: left as it is rather than freed under the GPU + OOVR_LOG("Overlay texture sharing: a copy never finished; its command buffer isn't freed"); + pool = VK_NULL_HANDLE; + fence = VK_NULL_HANDLE; + } + if (fence) + vkDestroyFence(device, fence, nullptr); + if (pool) + vkDestroyCommandPool(device, pool, nullptr); + pool = VK_NULL_HANDLE; + buffer = VK_NULL_HANDLE; + fence = VK_NULL_HANDLE; + busy = false; + } + // Records and submits on queue, and waits for it: false if it couldn't, or didn't finish in time + template + bool Run(VkQueue queue, F&& record) + { + if (busy) { + if (vkWaitForFences(device, 1, &fence, VK_TRUE, kWaitNs) != VK_SUCCESS) + return false; + busy = false; + } + vkResetFences(device, 1, &fence); + vkResetCommandBuffer(buffer, 0); + VkCommandBufferBeginInfo begin{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO }; + begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; + if (vkBeginCommandBuffer(buffer, &begin) != VK_SUCCESS) + return false; + record(buffer); + if (vkEndCommandBuffer(buffer) != VK_SUCCESS) + return false; + VkSubmitInfo submit{ VK_STRUCTURE_TYPE_SUBMIT_INFO }; + submit.commandBufferCount = 1; + submit.pCommandBuffers = &buffer; + if (vkQueueSubmit(queue, 1, &submit, fence) != VK_SUCCESS) + return false; + busy = true; + if (vkWaitForFences(device, 1, &fence, VK_TRUE, kWaitNs) != VK_SUCCESS) + return false; + busy = false; + return true; + } +}; + +VkImageMemoryBarrier Barrier(VkImage image, VkImageLayout from, VkImageLayout to, uint32_t fromFamily, uint32_t toFamily) +{ + VkImageMemoryBarrier b{ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER }; + b.oldLayout = from; + b.newLayout = to; + b.srcQueueFamilyIndex = fromFamily; + b.dstQueueFamilyIndex = toFamily; + b.image = image; + b.subresourceRange = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }; + return b; +} + +// Memory is shared only between the same device on the same driver: both UUIDs. False if they can't be had. +bool DeviceIds(VkPhysicalDevice physicalDevice, uint8_t (&device)[VK_UUID_SIZE], uint8_t (&driver)[VK_UUID_SIZE]) +{ + VkPhysicalDeviceIDProperties id{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES }; + VkPhysicalDeviceProperties2 props{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &id }; + vkGetPhysicalDeviceProperties2(physicalDevice, &props); + memcpy(device, id.deviceUUID, VK_UUID_SIZE); + memcpy(driver, id.driverUUID, VK_UUID_SIZE); + for (uint8_t b : device) + if (b) + return true; + return false; +} + +#ifdef SUPPORT_GL +// The Vulkan format of an OpenGL texture's internal format, for the colour formats programs give overlays +VkFormat VkFormatOfGl(GLint internalFormat) +{ + switch (internalFormat) { + case GL_RGBA8: + return VK_FORMAT_R8G8B8A8_UNORM; + case GL_SRGB8_ALPHA8: + return VK_FORMAT_R8G8B8A8_SRGB; + case GL_RGB10_A2: + return VK_FORMAT_A2B10G10R10_UNORM_PACK32; + case GL_RGBA16F: + return VK_FORMAT_R16G16B16A16_SFLOAT; + case GL_RGBA32F: + return VK_FORMAT_R32G32B32A32_SFLOAT; + default: + return VK_FORMAT_UNDEFINED; + } +} + +// GL_EXT_memory_object(_fd), and what's needed around it, from the current context's driver +struct GlFunctions { + PFNGLGETSTRINGIPROC getStringi = nullptr; + PFNGLGETUNSIGNEDBYTEVEXTPROC getUnsignedBytev = nullptr; + PFNGLGETUNSIGNEDBYTEI_VEXTPROC getUnsignedBytei = nullptr; + PFNGLCREATEMEMORYOBJECTSEXTPROC createMemoryObjects = nullptr; + PFNGLDELETEMEMORYOBJECTSEXTPROC deleteMemoryObjects = nullptr; + PFNGLMEMORYOBJECTPARAMETERIVEXTPROC memoryObjectParameteriv = nullptr; + PFNGLIMPORTMEMORYFDEXTPROC importMemoryFd = nullptr; + PFNGLTEXSTORAGEMEM2DEXTPROC texStorageMem2D = nullptr; + PFNGLCOPYIMAGESUBDATAPROC copyImageSubData = nullptr; + PFNGLFENCESYNCPROC fenceSync = nullptr; + PFNGLCLIENTWAITSYNCPROC clientWaitSync = nullptr; + PFNGLDELETESYNCPROC deleteSync = nullptr; + bool loaded = false, usable = false; + + template + static T Get(const char* name) + { + return (T)glXGetProcAddress((const GLubyte*)name); + } + bool Load() + { + if (loaded) + return usable; + loaded = true; + getStringi = Get("glGetStringi"); + getUnsignedBytev = Get("glGetUnsignedBytevEXT"); + getUnsignedBytei = Get("glGetUnsignedBytei_vEXT"); + createMemoryObjects = Get("glCreateMemoryObjectsEXT"); + deleteMemoryObjects = Get("glDeleteMemoryObjectsEXT"); + memoryObjectParameteriv = Get("glMemoryObjectParameterivEXT"); + importMemoryFd = Get("glImportMemoryFdEXT"); + texStorageMem2D = Get("glTexStorageMem2DEXT"); + copyImageSubData = Get("glCopyImageSubData"); + fenceSync = Get("glFenceSync"); + clientWaitSync = Get("glClientWaitSync"); + deleteSync = Get("glDeleteSync"); + usable = getStringi && getUnsignedBytev && getUnsignedBytei && createMemoryObjects && deleteMemoryObjects && memoryObjectParameteriv && importMemoryFd + && texStorageMem2D && copyImageSubData && fenceSync && clientWaitSync && deleteSync; + return usable; + } + // Whether the current context lists the extension (glXGetProcAddress finds functions whatever the context has) + bool HasExtension(const char* name) const + { + GLint count = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &count); + for (GLint i = 0; i < count; i++) { + const char* e = (const char*)getStringi(GL_EXTENSIONS, (GLuint)i); + if (e && !strcmp(e, name)) + return true; + } + return false; + } +}; +#endif + +} // namespace + +struct OverlayTextureShare::Impl { + VkInstance instance; + VkPhysicalDevice physicalDevice; + VkDevice device; + uint32_t family; + VkQueue queue; + PFN_vkGetMemoryFdKHR getMemoryFd = nullptr; + uint8_t uuid[VK_UUID_SIZE] = {}, driverUuid[VK_UUID_SIZE] = {}; + // Why each program device or context can't share (empty if it can), found at its first texture + std::map deviceVerdicts; + bool usable = false; + VkPhysicalDeviceMemoryProperties memory{}; + Commands session; // on the session's queue + + // The program's Vulkan device, as its last texture named it + Commands program; +#ifdef SUPPORT_GL + GlFunctions gl; + std::map contextVerdicts; +#endif + + // An image of the session's device shared with the program's side, for one overlay + struct Shared { + VkFormat format = VK_FORMAT_UNDEFINED; + uint32_t width = 0, height = 0; + VkImage image = VK_NULL_HANDLE; + VkDeviceMemory memory = VK_NULL_HANDLE; + VkDeviceSize size = 0; + uint32_t memoryType = 0; + bool dedicated = false; + int fd = -1; // exported, kept to import again (each import takes a duplicate) + bool acquired = false; // owned by the session's queue family (CopyIn), not yet handed back (Release) + vr::VRVulkanTextureData_t data{}; + + // The program's side: a Vulkan device's image, or an OpenGL texture + VkDevice programDevice = VK_NULL_HANDLE; + VkImage programImage = VK_NULL_HANDLE; + VkDeviceMemory programMemory = VK_NULL_HANDLE; +#ifdef SUPPORT_GL + GLuint glMemory = 0, glTexture = 0; + GLXContext glContext = nullptr; // the context (and those sharing with it) the names are of +#endif + }; + std::map shared; + + void DropProgramSide(Shared& s) + { + if (s.programImage) + vkDestroyImage(s.programDevice, s.programImage, nullptr); + if (s.programMemory) + vkFreeMemory(s.programDevice, s.programMemory, nullptr); + s.programImage = VK_NULL_HANDLE; + s.programMemory = VK_NULL_HANDLE; + s.programDevice = VK_NULL_HANDLE; +#ifdef SUPPORT_GL + // Only in their context; elsewhere the names may be another texture's, and are left + if ((s.glTexture || s.glMemory) && s.glContext && glXGetCurrentContext() == s.glContext) { + if (s.glTexture) + glDeleteTextures(1, &s.glTexture); + if (s.glMemory && gl.deleteMemoryObjects) + gl.deleteMemoryObjects(1, &s.glMemory); + } + s.glTexture = 0; + s.glMemory = 0; + s.glContext = nullptr; +#endif + } + + // Not while a copy on the session's queue may still use it: left, if it doesn't finish in time + void DropWhenIdle(std::map::iterator it) + { + if (session.busy && vkWaitForFences(device, 1, &session.fence, VK_TRUE, kWaitNs) != VK_SUCCESS) { + OOVR_LOG("Overlay texture sharing: a copy still running; its shared image isn't freed"); + shared.erase(it); + return; + } + session.busy = false; + Drop(it->second); + shared.erase(it); + } + + void Drop(Shared& s) + { + DropProgramSide(s); + if (s.image) + vkDestroyImage(device, s.image, nullptr); + if (s.memory) + vkFreeMemory(device, s.memory, nullptr); + if (s.fd >= 0) + close(s.fd); + s = Shared{}; + } + + VkImageCreateInfo ImageInfo(const Shared& s, const VkExternalMemoryImageCreateInfo* external) const + { + VkImageCreateInfo info{ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, external }; + info.imageType = VK_IMAGE_TYPE_2D; + info.format = s.format; + info.extent = { s.width, s.height, 1 }; + info.mipLevels = 1; + info.arrayLayers = 1; + info.samples = VK_SAMPLE_COUNT_1_BIT; + info.tiling = VK_IMAGE_TILING_OPTIMAL; + info.usage = kUsage; + info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + return info; + } + + // owner's image of this format and size, made (and exported) if it has none like it; nullptr, with why + Shared* SharedFor(const void* owner, VkFormat format, uint32_t width, uint32_t height, std::string* why) + { + auto it = shared.find(owner); + if (it != shared.end() && it->second.format == format && it->second.width == width && it->second.height == height) + return &it->second; + if (it != shared.end()) + DropWhenIdle(it); + + // Whether an image like it can be exported and imported as an opaque file descriptor, and how + VkPhysicalDeviceExternalImageFormatInfo externalInfo{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO }; + externalInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + VkPhysicalDeviceImageFormatInfo2 formatInfo{ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, &externalInfo }; + formatInfo.format = format; + formatInfo.type = VK_IMAGE_TYPE_2D; + formatInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + formatInfo.usage = kUsage; + VkExternalImageFormatProperties externalProps{ VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES }; + VkImageFormatProperties2 formatProps{ VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2, &externalProps }; + if (vkGetPhysicalDeviceImageFormatProperties2(physicalDevice, &formatInfo, &formatProps) != VK_SUCCESS) { + *why = "the session's device can't share an image of Vulkan format " + std::to_string((int)format); + return nullptr; + } + const VkExternalMemoryFeatureFlags features = externalProps.externalMemoryProperties.externalMemoryFeatures; + if (!(features & VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT) || !(features & VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT)) { + *why = "the session's device can't export and import an image of Vulkan format " + std::to_string((int)format); + return nullptr; + } + + Shared s; + s.format = format; + s.width = width; + s.height = height; + s.dedicated = (features & VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT) != 0; + VkExternalMemoryImageCreateInfo external{ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO }; + external.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + const VkImageCreateInfo info = ImageInfo(s, &external); + bool ok = vkCreateImage(device, &info, nullptr, &s.image) == VK_SUCCESS; + VkMemoryRequirements req{}; + if (ok) + vkGetImageMemoryRequirements(device, s.image, &req); + s.memoryType = UINT32_MAX; + for (uint32_t i = 0; ok && i < memory.memoryTypeCount && s.memoryType == UINT32_MAX; i++) + if ((req.memoryTypeBits & (1u << i)) && (memory.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) + s.memoryType = i; + ok = ok && s.memoryType != UINT32_MAX; + s.size = req.size; + VkMemoryDedicatedAllocateInfo dedicated{ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO }; + dedicated.image = s.image; + VkExportMemoryAllocateInfo exportInfo{ VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO, s.dedicated ? &dedicated : nullptr }; + exportInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + VkMemoryAllocateInfo alloc{ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, &exportInfo }; + alloc.allocationSize = s.size; + alloc.memoryTypeIndex = s.memoryType; + ok = ok && vkAllocateMemory(device, &alloc, nullptr, &s.memory) == VK_SUCCESS; + ok = ok && vkBindImageMemory(device, s.image, s.memory, 0) == VK_SUCCESS; + VkMemoryGetFdInfoKHR fdInfo{ VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR }; + fdInfo.memory = s.memory; + fdInfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + ok = ok && getMemoryFd(device, &fdInfo, &s.fd) == VK_SUCCESS; + if (!ok) { + *why = "no shared image of Vulkan format " + std::to_string((int)format) + " could be made"; + Drop(s); + return nullptr; + } + s.data.m_nImage = (uint64_t)s.image; + s.data.m_pDevice = device; + s.data.m_pPhysicalDevice = physicalDevice; + s.data.m_pInstance = instance; + s.data.m_pQueue = queue; + s.data.m_nQueueFamilyIndex = family; + s.data.m_nWidth = width; + s.data.m_nHeight = height; + s.data.m_nFormat = (uint32_t)format; + s.data.m_nSampleCount = 1; + return &(shared[owner] = s); + } + + // The image handed back to the program's side, after the session's copy from it (on the same queue) + bool Release(Shared& s) + { + const bool ran = session.Run(queue, [&](VkCommandBuffer cmd) { + VkImageMemoryBarrier b = Barrier(s.image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_GENERAL, family, VK_QUEUE_FAMILY_EXTERNAL); + b.srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); + }); + if (ran) + s.acquired = false; + return ran; + } + + // The image taken over by the session's queue family from the program's side, which left it in layout + bool Acquire(Shared& s, VkImageLayout layout) + { + const bool ran = session.Run(queue, [&](VkCommandBuffer cmd) { + VkImageMemoryBarrier b = Barrier(s.image, layout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_QUEUE_FAMILY_EXTERNAL, family); + b.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b); + }); + s.acquired = ran; + return ran; + } + + const vr::VRVulkanTextureData_t* CopyInVulkan(const vr::Texture_t* tex, const void* owner, std::string* why) + { + const auto* data = (const vr::VRVulkanTextureData_t*)tex->handle; + if (!data || !data->m_nImage || !data->m_pDevice || !data->m_pPhysicalDevice || !data->m_pQueue || !data->m_nWidth || !data->m_nHeight) { + *why = "the Vulkan texture's data is incomplete"; + return nullptr; + } + auto verdict = deviceVerdicts.find(data->m_pDevice); + if (verdict == deviceVerdicts.end()) { + std::string no; + uint8_t device[VK_UUID_SIZE] = {}, driver[VK_UUID_SIZE] = {}; + // Only there if the program enabled VK_KHR_external_memory_fd on its device (where a driver answers anyway, + // the import fails and the texture is read back) + if (!vkGetDeviceProcAddr(data->m_pDevice, "vkGetMemoryFdKHR")) + no = "the program's Vulkan device doesn't have VK_KHR_external_memory_fd"; + else if (!DeviceIds(data->m_pPhysicalDevice, device, driver) || memcmp(device, uuid, VK_UUID_SIZE) || memcmp(driver, driverUuid, VK_UUID_SIZE)) + no = "the program's Vulkan device is another GPU or driver than the session's"; + verdict = deviceVerdicts.emplace(data->m_pDevice, no).first; + } + if (!verdict->second.empty()) { + *why = verdict->second; + return nullptr; + } + if (program.device != data->m_pDevice || program.family != data->m_nQueueFamilyIndex || !program.fence) { + // Another device: what was imported into the last one goes with it + for (auto& kv : shared) + if (kv.second.programDevice && kv.second.programDevice != data->m_pDevice) + DropProgramSide(kv.second); + if (!program.Make(data->m_pDevice, data->m_nQueueFamilyIndex)) { + *why = "no command buffer for the program's queue family"; + return nullptr; + } + } + Shared* s = SharedFor(owner, (VkFormat)data->m_nFormat, data->m_nWidth, data->m_nHeight, why); + if (!s) + return nullptr; + if (s->acquired && !Release(*s)) { + *why = "the shared image wasn't handed back after the last copy"; + return nullptr; + } + + if (!s->programImage) { + // The same image, made with the same parameters, on the program's device, in the memory it shares + VkExternalMemoryImageCreateInfo external{ VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO }; + external.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + const VkImageCreateInfo info = ImageInfo(*s, &external); + s->programDevice = data->m_pDevice; + bool ok = vkCreateImage(data->m_pDevice, &info, nullptr, &s->programImage) == VK_SUCCESS; + VkMemoryRequirements req{}; + if (ok) + vkGetImageMemoryRequirements(data->m_pDevice, s->programImage, &req); + ok = ok && (req.memoryTypeBits & (1u << s->memoryType)) && req.size <= s->size; + const int fd = ok ? dup(s->fd) : -1; + VkMemoryDedicatedAllocateInfo dedicated{ VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO }; + dedicated.image = s->programImage; + VkImportMemoryFdInfoKHR import{ VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR, s->dedicated ? &dedicated : nullptr }; + import.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + import.fd = fd; + VkMemoryAllocateInfo alloc{ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, &import }; + alloc.allocationSize = s->size; + alloc.memoryTypeIndex = s->memoryType; + const bool imported = ok && fd >= 0 && vkAllocateMemory(data->m_pDevice, &alloc, nullptr, &s->programMemory) == VK_SUCCESS; + // A successful import owns the descriptor; a failed one leaves it to be closed + if (!imported && fd >= 0) + close(fd); + ok = imported && vkBindImageMemory(data->m_pDevice, s->programImage, s->programMemory, 0) == VK_SUCCESS; + if (!ok) { + *why = "the program's Vulkan device couldn't import the shared image"; + DropProgramSide(*s); + return nullptr; + } + } + + // On the program's queue, during its call: its image (TRANSFER_SRC_OPTIMAL) into the shared one, which is then + // handed to the session's device + const uint32_t programFamily = data->m_nQueueFamilyIndex; + const bool ran = program.Run((VkQueue)data->m_pQueue, [&](VkCommandBuffer cmd) { + VkImageMemoryBarrier toDst = Barrier(s->programImage, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_QUEUE_FAMILY_IGNORED, + VK_QUEUE_FAMILY_IGNORED); + toDst.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &toDst); + VkImageSubresourceLayers layers{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; + if (data->m_nSampleCount > 1) { + VkImageResolve region{ layers, { 0, 0, 0 }, layers, { 0, 0, 0 }, { s->width, s->height, 1 } }; + vkCmdResolveImage(cmd, (VkImage)data->m_nImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, s->programImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); + } else { + VkImageCopy region{ layers, { 0, 0, 0 }, layers, { 0, 0, 0 }, { s->width, s->height, 1 } }; + vkCmdCopyImage(cmd, (VkImage)data->m_nImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, s->programImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); + } + VkImageMemoryBarrier release = Barrier(s->programImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_GENERAL, programFamily, VK_QUEUE_FAMILY_EXTERNAL); + release.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1, &release); + }); + if (!ran) { + *why = "the copy on the program's queue didn't finish in time"; + return nullptr; + } + if (!Acquire(*s, VK_IMAGE_LAYOUT_GENERAL)) { + *why = "the session's queue didn't take the shared image in time"; + return nullptr; + } + return &s->data; + } + +#ifdef SUPPORT_GL + const vr::VRVulkanTextureData_t* CopyInGl(const vr::Texture_t* tex, const void* owner, std::string* why) + { + const GLuint name = (GLuint)(uintptr_t)tex->handle; + const GLXContext context = glXGetCurrentContext(); + if (!name || !context) { + *why = "no OpenGL texture, or no GLX context current"; + return nullptr; + } + auto verdict = contextVerdicts.find(context); + if (verdict == contextVerdicts.end()) { + std::string no; + if (!gl.Load() || !gl.HasExtension("GL_EXT_memory_object_fd")) { + no = "the program's OpenGL context doesn't have GL_EXT_memory_object_fd"; + } else { + // The session's driver, and one of the context's devices + GLubyte driver[GL_UUID_SIZE_EXT] = {}; + gl.getUnsignedBytev(GL_DRIVER_UUID_EXT, driver); + GLint devices = 0; + glGetIntegerv(GL_NUM_DEVICE_UUIDS_EXT, &devices); + bool same = false; + for (GLint i = 0; i < devices && !same; i++) { + GLubyte id[GL_UUID_SIZE_EXT] = {}; + gl.getUnsignedBytei(GL_DEVICE_UUID_EXT, (GLuint)i, id); + same = memcmp(id, uuid, VK_UUID_SIZE) == 0; + } + if (!same || memcmp(driver, driverUuid, VK_UUID_SIZE)) + no = "the program's OpenGL context is on another GPU or driver than the session's"; + } + verdict = contextVerdicts.emplace(context, no).first; + } + if (!verdict->second.empty()) { + *why = verdict->second; + return nullptr; + } + + while (glGetError() != GL_NO_ERROR) { + } + GLint previous = 0, width = 0, height = 0, internalFormat = 0; + glGetIntegerv(GL_TEXTURE_BINDING_2D, &previous); + glBindTexture(GL_TEXTURE_2D, name); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &internalFormat); + glBindTexture(GL_TEXTURE_2D, (GLuint)previous); + const VkFormat format = VkFormatOfGl(internalFormat); + if (glGetError() != GL_NO_ERROR || width <= 0 || height <= 0 || format == VK_FORMAT_UNDEFINED) { + *why = "an OpenGL texture of internal format " + std::to_string(internalFormat) + " (or not a 2D texture) can't be shared"; + return nullptr; + } + Shared* s = SharedFor(owner, format, (uint32_t)width, (uint32_t)height, why); + if (!s) + return nullptr; + if (s->acquired && !Release(*s)) { + *why = "the shared image wasn't handed back after the last copy"; + return nullptr; + } + + // Names made in another context aren't this one's to use + if (s->glTexture && s->glContext != context) { + s->glTexture = 0; + s->glMemory = 0; + } + if (!s->glTexture) { + s->glContext = context; + // The shared memory as a texture of the program's context, laid out as the image is (optimal tiling) + const int fd = dup(s->fd); + gl.createMemoryObjects(1, &s->glMemory); + if (s->dedicated) { + const GLint yes = GL_TRUE; + gl.memoryObjectParameteriv(s->glMemory, GL_DEDICATED_MEMORY_OBJECT_EXT, &yes); + } + // A successful import owns the descriptor + bool imported = false; + if (fd >= 0) { + gl.importMemoryFd(s->glMemory, (GLuint64)s->size, GL_HANDLE_TYPE_OPAQUE_FD_EXT, fd); + imported = glGetError() == GL_NO_ERROR; + if (!imported) + close(fd); + } + glGenTextures(1, &s->glTexture); + glBindTexture(GL_TEXTURE_2D, s->glTexture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_TILING_EXT, GL_OPTIMAL_TILING_EXT); + gl.texStorageMem2D(GL_TEXTURE_2D, 1, (GLenum)internalFormat, width, height, s->glMemory, 0); + glBindTexture(GL_TEXTURE_2D, (GLuint)previous); + if (!imported || glGetError() != GL_NO_ERROR) { + // Not tried again in this context + *why = "the program's OpenGL context couldn't import the shared image"; + contextVerdicts[context] = *why; + DropProgramSide(*s); + return nullptr; + } + } + + // In the program's context, during its call: its texture into the shared one, waited for + gl.copyImageSubData(name, GL_TEXTURE_2D, 0, 0, 0, 0, s->glTexture, GL_TEXTURE_2D, 0, 0, 0, 0, width, height, 1); + GLsync sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + const GLenum waited = sync ? gl.clientWaitSync(sync, GL_SYNC_FLUSH_COMMANDS_BIT, kWaitNs) : GL_WAIT_FAILED; + if (sync) + gl.deleteSync(sync); + if (glGetError() != GL_NO_ERROR || (waited != GL_ALREADY_SIGNALED && waited != GL_CONDITION_SATISFIED)) { + *why = "the copy in the program's OpenGL context failed or didn't finish in time"; + return nullptr; + } + // OpenGL says nothing of the image's layout without GL_EXT_semaphore: taken as GENERAL + if (!Acquire(*s, VK_IMAGE_LAYOUT_GENERAL)) { + *why = "the session's queue didn't take the shared image in time"; + return nullptr; + } + return &s->data; + } +#endif +}; + +OverlayTextureShare::OverlayTextureShare(VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device, uint32_t queueFamily, VkQueue queue) + : impl(std::make_unique()) +{ + Impl& i = *impl; + i.instance = instance; + i.physicalDevice = physicalDevice; + i.device = device; + i.family = queueFamily; + i.queue = queue; + i.getMemoryFd = (PFN_vkGetMemoryFdKHR)vkGetDeviceProcAddr(device, "vkGetMemoryFdKHR"); + vkGetPhysicalDeviceMemoryProperties(physicalDevice, &i.memory); + const bool hasUuid = DeviceIds(physicalDevice, i.uuid, i.driverUuid); + i.usable = i.getMemoryFd && hasUuid && i.session.Make(device, queueFamily); + if (!i.usable) + OOVR_LOGF("Overlay texture sharing: the session's Vulkan device can't share images (vkGetMemoryFdKHR %s, device UUID %s); overlay " + "textures are read back", + i.getMemoryFd ? "found" : "missing", hasUuid ? "read" : "unknown"); +} + +OverlayTextureShare::~OverlayTextureShare() +{ + // What's of the program's device or context is left: the program may have destroyed them by now + for (auto& kv : impl->shared) { + kv.second.programImage = VK_NULL_HANDLE; + kv.second.programMemory = VK_NULL_HANDLE; +#ifdef SUPPORT_GL + kv.second.glContext = nullptr; +#endif + impl->Drop(kv.second); + } + impl->session.Drop(); +} + +const vr::VRVulkanTextureData_t* OverlayTextureShare::CopyIn(const vr::Texture_t* tex, const void* owner, bool* flipY, std::string* why) +{ + *flipY = false; + if (!impl->usable) { + *why = "the session's Vulkan device can't share images"; + return nullptr; + } + if (tex->eType == vr::TextureType_Vulkan) + return impl->CopyInVulkan(tex, owner, why); +#ifdef SUPPORT_GL + if (tex->eType == vr::TextureType_OpenGL) { + *flipY = true; + return impl->CopyInGl(tex, owner, why); + } +#endif + *why = "only Vulkan and OpenGL textures are shared"; + return nullptr; +} + +void OverlayTextureShare::Release(const void* owner) +{ + auto it = impl->shared.find(owner); + if (it == impl->shared.end() || !it->second.acquired) + return; + if (!impl->Release(it->second)) + OOVR_LOG_ONCE("Overlay texture sharing: the session's copy from a shared image didn't finish in time"); +} + +void OverlayTextureShare::Forget(const void* owner) +{ + auto it = impl->shared.find(owner); + if (it != impl->shared.end()) + impl->DropWhenIdle(it); +} + +#endif diff --git a/DrvOpenXR/OverlayTextureShare.h b/DrvOpenXR/OverlayTextureShare.h new file mode 100644 index 00000000..05370a03 --- /dev/null +++ b/DrvOpenXR/OverlayTextureShare.h @@ -0,0 +1,40 @@ +#pragma once +// An overlay application's Vulkan or OpenGL texture copied, on the program's thread and on its own queue or context, +// into an image of the overlay session's Vulkan device (OpenLamina's own) whose memory both share +// (VK_KHR_external_memory_fd, GL_EXT_memory_object_fd): only on the same device and driver (by their UUIDs), where the +// program's device or context has the extension. Otherwise the texture is read back into memory (BaseOverlay). + +#if defined(SUPPORT_VK) && !defined(_WIN32) + +#include "generated/interfaces/vrtypes.h" + +#include + +#include +#include + +class OverlayTextureShare { +public: + OverlayTextureShare(VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device, uint32_t queueFamily, VkQueue queue); + ~OverlayTextureShare(); + OverlayTextureShare(const OverlayTextureShare&) = delete; + OverlayTextureShare& operator=(const OverlayTextureShare&) = delete; + + // On the program's thread: tex (a Vulkan texture in VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, as OpenVR asks, or an + // OpenGL texture of the context current on this thread) copied whole into owner's image of the session's device, + // MSAA resolved. That image comes back as a Vulkan texture of the session's device, in + // VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL and owned by its queue's family, for the session's compositor to copy from; + // Release hands it back once that copy is submitted. flipY: its rows run bottom-up as OpenVR's bounds see them (an + // OpenGL texture's). nullptr, with why, if it can't be shared: the caller reads the texture back instead. + const vr::VRVulkanTextureData_t* CopyIn(const vr::Texture_t* tex, const void* owner, bool* flipY, std::string* why); + // On the program's thread, after the session's copy from CopyIn's image was submitted: the image is handed back to + // the program's side once that copy has run (waited for, at most 100 ms) + void Release(const void* owner); + void Forget(const void* owner); + +private: + struct Impl; + std::unique_ptr impl; +}; + +#endif diff --git a/DrvOpenXR/OwnFrameLoop.cpp b/DrvOpenXR/OwnFrameLoop.cpp index 446783e3..0c77ba2b 100644 --- a/DrvOpenXR/OwnFrameLoop.cpp +++ b/DrvOpenXR/OwnFrameLoop.cpp @@ -15,7 +15,9 @@ constexpr milliseconds kRetry{ 11 }; OwnFrameLoop::OwnFrameLoop(Mode mode, LayerSource source, milliseconds idleAfter, FrameRunner runner, ContentCheck hasContent) : mode(mode), source(std::move(source)), idleAfter(idleAfter), runner(std::move(runner)), hasContent(std::move(hasContent)) { - thread = std::thread([this] { Thread(); }); + // A Vulkan queue or an OpenGL context is the game's: used only from inside its calls, so no thread of their own + if (mode != Mode::InCallsOnly) + thread = std::thread([this] { Thread(); }); } OwnFrameLoop::~OwnFrameLoop() @@ -46,6 +48,8 @@ bool OwnFrameLoop::IdleNow(steady_clock::time_point now) const { if (mode == Mode::EveryFrame) return true; + if (mode == Mode::UntilAppFrame) + return !appStarted; return appStarted && now - lastAppActivity >= idleAfter; } diff --git a/DrvOpenXR/OwnFrameLoop.h b/DrvOpenXR/OwnFrameLoop.h index 6ccd27e6..b4d4905a 100644 --- a/DrvOpenXR/OwnFrameLoop.h +++ b/DrvOpenXR/OwnFrameLoop.h @@ -30,6 +30,8 @@ class OwnFrameLoop { enum class Mode { WhenAppIdle, // frames once the game has run one and then not called WaitGetPoses for idleAfter EveryFrame, // every frame (overlay applications, which have no frames of their own) + InCallsOnly, // no thread: frames only from inside the game's own calls (RunWhile), on its thread + UntilAppFrame, // every frame until the program runs one of its own (a background app on a scene session) }; OwnFrameLoop(Mode mode, LayerSource source, std::chrono::milliseconds idleAfter = std::chrono::milliseconds(100)); diff --git a/DrvOpenXR/XrBackend.cpp b/DrvOpenXR/XrBackend.cpp index 815a7fda..18f851e4 100644 --- a/DrvOpenXR/XrBackend.cpp +++ b/DrvOpenXR/XrBackend.cpp @@ -6,7 +6,9 @@ #include "CpuSwapchain.h" #include "HelperSession.h" #include "OverlayTextureCopy.h" +#include "OverlayTextureShare.h" #include "XrGenericTracker.h" +#include "../OpenOVR/Misc/Input/ViveTrackerRoles.h" #include "generated/interfaces/vrtypes.h" #ifdef _WIN32 @@ -36,6 +38,7 @@ #include "../OpenOVR/Misc/ProgramEvents.h" #include "../OpenOVR/Reimpl/BaseApplications.h" #include "../OpenOVR/Reimpl/BaseClientCore.h" +#include "../OpenOVR/Reimpl/BaseCompositor.h" #include "../OpenOVR/Reimpl/BaseInput.h" #include "../OpenOVR/Reimpl/BaseOverlay.h" #include "../OpenOVR/Reimpl/BaseScreenshots.h" @@ -61,6 +64,7 @@ #include "tmp_gfx/TemporaryGraphics.h" #if defined(SUPPORT_VK) +#include "../OpenOVR/Compositor/vkcompositor.h" #include "tmp_gfx/TemporaryVk.h" #endif @@ -81,6 +85,9 @@ using namespace vr; std::mutex inputRestartMutex; +// This thread is a helper program's loop making its lost session again, between its passes: its loop and thread are +// kept through the rebuild (not stopped, nor started again) +static thread_local bool recoveringInHelperLoop = false; std::unique_ptr XrBackend::temporaryGraphics = nullptr; // Runs a step that reads the store's documents. They are files that another program, or another build, wrote: a value @@ -99,25 +106,10 @@ XrBackend::XrBackend(bool useVulkanTmpGfx, bool useD3D11TmpGfx) memset(projectionViews, 0, sizeof(projectionViews)); // setup temporaryGraphics - -#if defined(SUPPORT_VK) - if (useVulkanTmpGfx) { - temporaryGraphics = std::make_unique(); - if (!temporaryGraphics->usable) - temporaryGraphics.reset(); // D3D11 next - } -#endif - -#if defined(SUPPORT_DX) && defined(SUPPORT_DX11) - if (!temporaryGraphics && useD3D11TmpGfx) { - temporaryGraphics = std::make_unique(); - if (!temporaryGraphics->usable) - temporaryGraphics.reset(); - } -#endif - + tmpGfxVulkan = useVulkanTmpGfx; + tmpGfxD3D11 = useD3D11TmpGfx; // Without one, CreateOpenXRBackend gives up (HasTemporaryGraphics) - if (!temporaryGraphics) + if (!MakeTemporaryGraphics()) OOVR_LOG("No temporary graphics API available for the OpenXR session"); // setup the device indexes @@ -158,7 +150,10 @@ XrBackend::~XrBackend() graphicsBinding = nullptr; // This must happen after session destruction (which occurs in FullShutdown), as runtimes (namely Monado) - // may try to access these resources while destroying the session. + // may try to access these resources while destroying the session. What was shared with the device goes first. +#if defined(SUPPORT_VK) && !defined(_WIN32) + overlayShare.reset(); +#endif temporaryGraphics.reset(); gfxInterop.reset(); #if defined(SUPPORT_DX) && defined(SUPPORT_DX10) && defined(SUPPORT_DX11) @@ -373,16 +368,19 @@ static void EnqueueQuit() } /* Submitting Frames */ -bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) +bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex, bool moveToNewDevice) { // A texture OpenComposite can't use: the eye is left out and Submit answers InvalidTexture if (!tex || !tex->handle) return false; // Check we're using the session with the application's device - if (!usingApplicationGraphicsAPI) { + if (!usingApplicationGraphicsAPI || moveToNewDevice) { if (appGraphicsUnusable) return false; // tried once already: the session stays on the temporary device + // Not while the session is lost: the first Submit after it's made again moves it to the game's device + if (sessionLost && !quitting) + return false; // What can be checked before the session goes down is checked here, so a texture that can't be used // leaves the running session alone @@ -461,7 +459,9 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) OOVR_LOG_ONCE("The OpenVR app's Vulkan texture data has no instance, device or queue"); return false; } - if (!xr_ext->xrGetVulkanGraphicsDeviceKHR_Available() && runtimeHasD3D11) { + // Also where the runtime has XR_KHR_vulkan_enable2 alone: the game's own device has none of the runtime's + // extensions (there's no list to tell it), and the interop's are what GetVulkan*ExtensionsRequired answered + if ((!xr_ext->xrGetVulkanGraphicsDeviceKHR_Available() || xr_ext->VulkanEnable2Only()) && runtimeHasD3D11) { interop = GfxInterop::ForVulkan(vktex->m_pInstance, vktex->m_pPhysicalDevice, vktex->m_pDevice, vktex->m_pQueue); if (!interop) { OOVR_LOG("The OpenXR runtime has no Vulkan, and the game's Vulkan frames can't go through D3D11"); @@ -516,8 +516,24 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) // Another thread may have set the session up on the game's device, or given up on it, while this one waited if (appGraphicsUnusable) return false; - if (usingApplicationGraphicsAPI) + // A move another thread has made already, or one there's no session on the game's device for: the usual path + if (moveToNewDevice && !(usingApplicationGraphicsAPI && TextureOnOtherDevice(tex))) + return CheckOrInitCompositors(tex); + if (usingApplicationGraphicsAPI && !moveToNewDevice) return CheckOrInitCompositors(tex); + if (moveToNewDevice) { + deviceRebuilds++; + // Without a device to fall back on, a refused session would end the game + if (!MakeTemporaryGraphics()) { + OOVR_LOG_ONCE("The game's eye textures are on another device than the session's, and there's no temporary device to fall back on: left out"); + return false; + } + OOVR_LOG("The game's eye textures are on another device than the session's: making the session again on it"); + rebuildingForNewDevice = true; + // An eye already stored this frame is of the old session's swapchains + for (XrCompositionLayerProjectionView& view : projectionViews) + view.subImage.swapchain = XR_NULL_HANDLE; + } usingApplicationGraphicsAPI = true; @@ -534,8 +550,10 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) graphicsBinding = nullptr; usingApplicationGraphicsAPI = false; appGraphicsUnusable = true; - if (!temporaryGraphics || XR_FAILED(DrvOpenXR::SetupSession())) { - OnSessionLost(); // not even the temporary device gets a session: OnSessionLost tells the game to quit + if (!temporaryGraphics || XR_FAILED(RebuildSession(RebuildReason::AppGraphics))) { + OnSessionLost(); // not even the temporary device gets a session: lost until one can be made + } else if (rebuildingForNewDevice) { + OOVR_LOG("The game's frames on its new device can't be shown: they're left out"); } else { OOVR_LOG("The game's frames can't be shown: telling the game to quit"); EnqueueQuit(); @@ -553,7 +571,7 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) graphicsBinding = std::make_unique>(d3dInfo); // Kept with the binding, for each later session too gfxInterop = std::move(interop); - if (XR_FAILED(DrvOpenXR::SetupSession())) + if (XR_FAILED(RebuildSession(RebuildReason::AppGraphics))) return giveUp("the OpenXR runtime refused a D3D11 session for the game's copied frames"); } #endif @@ -588,7 +606,7 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) d3dInfo.type = XR_TYPE_GRAPHICS_BINDING_D3D11_KHR; d3dInfo.device = dev; graphicsBinding = std::make_unique>(d3dInfo); - XrResult made = DrvOpenXR::SetupSession(); + XrResult made = RebuildSession(RebuildReason::AppGraphics); dev->Release(); if (XR_FAILED(made)) @@ -614,7 +632,7 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) d3dInfo.device = device.Get(); d3dInfo.queue = d3dTexData->m_pCommandQueue; graphicsBinding = std::make_unique>(d3dInfo); - if (XR_FAILED(DrvOpenXR::SetupSession())) + if (XR_FAILED(RebuildSession(RebuildReason::AppGraphics))) return giveUp("the OpenXR runtime refused a session on the game's D3D12 device"); // The ComPtr releases the device: no explicit Release here @@ -672,7 +690,7 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) return giveUp("the app's VkQueue isn't one of its device's queues"); graphicsBinding = std::make_unique>(binding); - if (XR_FAILED(DrvOpenXR::SetupSession())) + if (XR_FAILED(RebuildSession(RebuildReason::AppGraphics))) return giveUp("the OpenXR runtime refused a session on the game's Vulkan device"); break; } @@ -691,7 +709,7 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) binding.hDC = wglGetCurrentDC(); graphicsBinding = std::make_unique>(binding); - if (XR_FAILED(DrvOpenXR::SetupSession())) + if (XR_FAILED(RebuildSession(RebuildReason::AppGraphics))) return giveUp("the OpenXR runtime refused a session on the game's OpenGL context"); #else // Only support xlib for now (same as Monado) @@ -747,12 +765,13 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) None, }; // clang-format on + gameGlContext = glXGetCurrentContext(); // the game's, which own frames need current: the session's is shared with it binding.glxContext = pfn_glXCreateContextAttribsARB(binding.xDisplay, binding.glxFBConfig, glXGetCurrentContext(), true, contextAttribs); if (!binding.glxContext) return giveUp("glXCreateContextAttribsARB failed"); graphicsBinding = std::make_unique>(binding); - if (XR_FAILED(DrvOpenXR::SetupSession())) + if (XR_FAILED(RebuildSession(RebuildReason::AppGraphics))) return giveUp("the OpenXR runtime refused a session on the game's OpenGL context"); #endif // End of platform-specific code @@ -767,7 +786,7 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) binding.next = nullptr; graphicsBinding = std::make_unique>(binding); - if (XR_FAILED(DrvOpenXR::SetupSession())) + if (XR_FAILED(RebuildSession(RebuildReason::AppGraphics))) return giveUp("the OpenXR runtime refused a session on the game's OpenGL ES context"); #endif break; @@ -779,6 +798,7 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) // Real graphics binding should be setup now - get rid of temporary graphics temporaryGraphics.reset(); + rebuildingForNewDevice = false; } // Copied textures' compositors are made from their D3D11 copies (StoreEyeTexture) @@ -795,10 +815,71 @@ bool XrBackend::CheckOrInitCompositors(const vr::Texture_t* tex) return ready; } +bool XrBackend::FollowEyeTextureDevice(const vr::Texture_t* tex, bool& move) +{ + // The session is made again through CheckOrInitCompositors' first-time path, which checks the new device before the + // old session goes down, with a temporary device to fall back on. Eye textures only (an overlay or a skybox may be on + // a device of its own), and a few times a run at most, so eyes on two devices don't make sessions frame after frame. + // D3D11 and D3D12 only: the old session's objects are freed on the old device, which their COM references keep + // alive, where a Vulkan game may have destroyed its old VkDevice already. + move = false; + if (!usingApplicationGraphicsAPI || gfxInterop || !TextureOnOtherDevice(tex)) + return true; + if (deviceRebuilds >= 3) { + OOVR_LOG_ONCE("The game's eye textures are on another device than the session's once more: left out"); + return false; + } + move = true; + return true; +} + +bool XrBackend::TextureOnOtherDevice(const vr::Texture_t* tex) +{ + const auto* binding = graphicsBinding ? (const XrBaseInStructure*)graphicsBinding->asVoid() : nullptr; + if (!tex || !tex->handle || !binding) + return false; + switch (tex->eType) { +#if defined(SUPPORT_DX) && defined(SUPPORT_DX11) + case vr::TextureType_DirectX: { + if (binding->type != XR_TYPE_GRAPHICS_BINDING_D3D11_KHR) + return false; +#if defined(SUPPORT_DX10) + // Direct3D 10 textures go through the bridge device, which is the session's + if (DX10Compositor::AsD3D10Texture(tex)) + return false; +#endif + ComPtr device; + ((ID3D11Texture2D*)tex->handle)->GetDevice(&device); + return device && device.Get() != ((const XrGraphicsBindingD3D11KHR*)binding)->device; + } +#endif +#if defined(SUPPORT_DX) && defined(SUPPORT_DX12) + case vr::TextureType_DirectX12: { + if (binding->type != XR_TYPE_GRAPHICS_BINDING_D3D12_KHR) + return false; + auto* data = (D3D12TextureData_t*)tex->handle; + if (!data->m_pResource) + return false; + ComPtr device; + data->m_pResource->GetDevice(IID_PPV_ARGS(&device)); + return device && device.Get() != ((const XrGraphicsBindingD3D12KHR*)binding)->device; + } +#endif + default: + // OpenGL's context is the current one, which a game may change for its own reasons + return false; + } +} + void XrBackend::WaitForTrackingData() { // A game that waits for frames before its first submit still sees the session become ready PumpEvents(); + gameFrameThread = std::this_thread::get_id(); + + // A lost session is made again here, between the game's frames, once the system is back + if (sessionLost && !quitting) + RecoverLostSession(); // Make sure the OpenXR session is active before doing anything else, and if not then skip if (!sessionActive) { @@ -824,8 +905,17 @@ void XrBackend::WaitForTrackingData() ShowPendingSkybox(); // A frame the game gave one eye (or ended no other way) is ended with what it has before the next begins - if (renderingFrame && submittedEyeTextures) + if (renderingFrame && submittedEyeTextures) { SubmitFrames(false); + } else if (frameBegun && ownFrames && OwnFramesHere()) { + // One it waited for and didn't submit to (a game that calls WaitGetPoses without Submit, maybe before it has + // given a texture, on OpenLamina's own session) is ended as an own frame would be: its last frame again, the + // skybox, the overlays; not left to be discarded + renderingFrame = true; + repeatLastFrame = true; + SubmitFrames(false); + repeatLastFrame = false; + } // The game's frame from here to its xrEndFrame (SubmitFrames): an own frame in flight is ended first std::unique_lock owner(frameOwner); @@ -954,7 +1044,12 @@ IBackend::openvr_enum_t XrBackend::StoreEyeTexture( frameNewFrameReadyMs = std::chrono::duration(now - frameStart).count(); }); - if (!CheckOrInitCompositors(texture)) { + bool moveToNewDevice = false; + if (!FollowEyeTextureDevice(texture, moveToNewDevice)) { + projectionViews[eye].subImage.swapchain = XR_NULL_HANDLE; + return kCompositorTextureIsOnWrongDevice; + } + if (!CheckOrInitCompositors(texture, moveToNewDevice)) { // A texture OpenComposite can't use (logged): this eye is left out of the frame projectionViews[eye].subImage.swapchain = XR_NULL_HANDLE; return appOnOtherAdapter ? kCompositorTextureIsOnWrongDevice : kCompositorInvalidTexture; @@ -980,23 +1075,31 @@ IBackend::openvr_enum_t XrBackend::StoreEyeTexture( #if defined(_WIN32) && defined(SUPPORT_DX) && defined(SUPPORT_DX11) vr::Texture_t copied; vr::VRTextureBounds_t copiedBounds; + // The copy holds the slice SubmitWithArrayIndex named, as a texture of one slice + std::optional copiedSlice; if (gfxInterop && texture->eType == gfxInterop->Type()) { - ID3D11Texture2D* copy = gfxInterop->CopyIn(texture, bounds); - if (!copy) { + const GfxInterop::Copied copy = gfxInterop->CopyIn(texture, submitFlags, (int)eye); + if (!copy.texture) { layer.subImage.swapchain = XR_NULL_HANDLE; return kCompositorRequestFailed; } // An OpenGL texture's rows run bottom-up and its copy's top-down: the bounds' v, which counted from the bottom, - // counts from the top of the copy - if (bounds && texture->eType == vr::TextureType_OpenGL) { - copiedBounds = { bounds->uMin, 1 - bounds->vMax, bounds->uMax, 1 - bounds->vMin }; + // counts from the top of the copy. A copy left upside down keeps the bounds' v, and the bounds turn it over + // (vMin > vMax), which the compositor's pass does. + if (texture->eType == vr::TextureType_OpenGL) { + const vr::VRTextureBounds_t given = Bounds(bounds); + if (copy.upsideDown) + copiedBounds = { given.uMin, given.vMax, given.uMax, given.vMin }; + else + copiedBounds = { given.uMin, 1 - given.vMax, given.uMax, 1 - given.vMin }; bounds = &copiedBounds; } - copied = { copy, vr::TextureType_DirectX, texture->eColorSpace }; + copied = { copy.texture, vr::TextureType_DirectX, texture->eColorSpace }; texture = &copied; + copiedSlice.emplace(std::nullopt); // A D3D11 compositor for the interop's texture if (!compositors[eye]) - compositors[eye] = std::make_unique(copy); + compositors[eye] = std::make_unique(copy.texture); } #endif @@ -1044,6 +1147,12 @@ IBackend::openvr_enum_t XrBackend::StoreEyeTexture( Image mirror; if (eye == vr::Eye_Left && MirrorWindow::Get().WantsFrame() && comp.ReadbackToCpu(texture, bounds, mirror)) MirrorWindow::Get().Offer(std::move(mirror)); + // CompositorDumpImages: this eye's image, read back once + if (BaseCompositor::_WantsDumpImage(eye)) { + Image dumped; + if (comp.ReadbackToCpu(texture, bounds, dumped)) + BaseCompositor::_OfferDumpImage(eye, dumped); + } // A screenshot the compositor takes: this eye's image, read back if (BaseScreenshots::_WantsEyeImages()) { Image shot; @@ -1066,6 +1175,7 @@ IBackend::openvr_enum_t XrBackend::StoreEyeTexture( void XrBackend::UseSubmittedPose(vr::EVREye eye, const vr::Texture_t* texture, vr::EVRSubmitFlags submitFlags) { + auto lock = xr_session.lock_shared(); // held while reading: a session restart waits for it if (!oovr_global_configuration.UseSubmittedPose() || !(submitFlags & vr::Submit_TextureWithPose) || !xr_gbl) return; // The head pose the game rendered with, in its tracking space: the projection layer's space @@ -1228,6 +1338,13 @@ void XrBackend::SubmitFrames(bool showSkybox) } } + // A frame ended for the game without its eye textures: its last frame again, which the runtime reprojects + bool repeated = false; + if (!app_layer && repeatLastFrame && haveLastProjection && !sceneCleared && !renderingSuspended) { + app_layer = (XrCompositionLayerBaseHeader*)&lastProjection; + repeated = true; + } + // The scene (the game's layer, or the skybox in its place once the grid is fully in), the fade over it, then the // overlays. The overlays' layers stay as they are until the frame has ended. const ScenePlan plan = PlanScene(app_layer != nullptr, SkyboxShown(), CompositorFades::Get().GridAlphaAt(CompositorClockSeconds())); @@ -1304,7 +1421,7 @@ void XrBackend::SubmitFrames(bool showSkybox) const float presentMs = std::chrono::duration(std::chrono::steady_clock::now() - endCall).count(); OOVR_FAILED_XR_SOFT_ABORT(endResult); // A present: the game's eye textures shown - const bool presented = XR_SUCCEEDED(endResult) && app_layer && sceneShown && frameShouldRender; + const bool presented = XR_SUCCEEDED(endResult) && app_layer && !repeated && sceneShown && frameShouldRender; if (presented) { FrameStats::Get().OnAppPresent(); BaseApplications::SetSceneDrawn(); @@ -1432,7 +1549,36 @@ bool XrBackend::SkyboxShown() int XrBackend::SetEquirectSkybox(const vr::Texture_t* textures, uint32_t count) { - // Six faces are read back and turned into one lat-long image first, without any lock: it takes a while + XrCompositionLayerEquirect2KHR layer{ XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR }; + layer.space = xr_space_from_ref_space_type(BaseSystem::currentSpace); + layer.eyeVisibility = XR_EYE_VISIBILITY_BOTH; + layer.pose = { { 0, 0, 0, 1 }, { 0, 0, 0 } }; + layer.radius = 0; // a sphere at infinity + constexpr float pi = 3.14159265f; + layer.centralHorizontalAngle = 2 * pi; + layer.upperVerticalAngle = pi / 2; + layer.lowerVerticalAngle = -pi / 2; + + // Six faces are drawn into one lat-long image on the GPU where the compositor has a pass for it (D3D11). The + // swapchain is refilled while no own frame uses it. + if (count == 6 && textures[0].eType == vr::TextureType_DirectX) { + std::lock_guard owner(frameOwner); + std::lock_guard lock(skyboxLock); + if (!skybox.cube) + skybox.cube = BaseCompositor::CreateCompositorAPI(&textures[0]); + XrSwapchainSubImage drawn{}; + if (skybox.cube && skybox.cube->InvokeCubemap(textures, 2048, drawn)) { + layer.subImage = drawn; + skybox.layers[0] = layer; + skybox.layerCount = 1; + return 0; + } + // Not shown while it's joined on the CPU (the layer may name the pass's swapchain) + skybox.layerCount = 0; + skybox.cube.reset(); + } + + // Else they're read back and turned into one lat-long image first, without any lock: it takes a while Image equirect; if (count == 6) { if (!skyboxReader) @@ -1452,16 +1598,6 @@ int XrBackend::SetEquirectSkybox(const vr::Texture_t* textures, uint32_t count) return 1; // VRCompositorError_RequestFailed } - XrCompositionLayerEquirect2KHR layer{ XR_TYPE_COMPOSITION_LAYER_EQUIRECT2_KHR }; - layer.space = xr_space_from_ref_space_type(BaseSystem::currentSpace); - layer.eyeVisibility = XR_EYE_VISIBILITY_BOTH; - layer.pose = { { 0, 0, 0, 1 }, { 0, 0, 0 } }; - layer.radius = 0; // a sphere at infinity - constexpr float pi = 3.14159265f; - layer.centralHorizontalAngle = 2 * pi; - layer.upperVerticalAngle = pi / 2; - layer.lowerVerticalAngle = -pi / 2; - // The swapchains are refilled, and maybe remade, while no own frame uses them std::lock_guard owner(frameOwner); std::lock_guard lock(skyboxLock); @@ -1512,6 +1648,11 @@ IBackend::openvr_enum_t XrBackend::SetSkyboxOverride(const vr::Texture_t* pTextu if (!CheckOrInitCompositors(pTextures)) return 1; // VRCompositorError_RequestFailed + { + // Shown again on a new session, until ClearSkyboxOverride + std::lock_guard pending(pendingSkyboxLock); + shownSkybox.Set(pTextures, unTextureCount); + } // Taken after CheckOrInitCompositors, which may restart the session, and held to the end: a session restart on // another thread replaces xr_gbl @@ -1668,6 +1809,7 @@ void XrBackend::ClearSkyboxOverride() { std::lock_guard pending(pendingSkyboxLock); pendingSkybox.Clear(); + shownSkybox.Clear(); } std::lock_guard lock(skyboxLock); skybox.layerCount = 0; @@ -1906,14 +2048,30 @@ bool XrBackend::GetPlayAreaPoints(vr::HmdVector3_t* points, int* count) { if (count) *count = 0; + // Held while asking: a session restart waits for it + auto lock = xr_session.lock_shared(); if (!xr_session.get()) return false; // the session is lost XrExtent2Df bounds; - XrResult res = xrGetReferenceSpaceBoundsRect(xr_session.get(), XR_REFERENCE_SPACE_TYPE_STAGE, &bounds); - - if (res == XR_SPACE_BOUNDS_UNAVAILABLE || XR_FAILED(res)) - return false; // no play area (set up, or at all) + { + std::lock_guard lock(playAreaLock); + if (playAreaSession != xr_session.get()) { + XrExtent2Df asked{}; + const XrTime askedAt = xr_time_now(); + XrResult res = xrGetReferenceSpaceBoundsRect(xr_session.get(), XR_REFERENCE_SPACE_TYPE_STAGE, &asked); + playAreaKnown = XR_SUCCEEDED(res) && res != XR_SPACE_BOUNDS_UNAVAILABLE && asked.width > 0 && asked.height > 0; + playAreaRect = playAreaKnown ? asked : XrExtent2Df{}; + // A failed call is asked again next time; an answer (bounds, or none) is kept once the stage's change is in + if (XR_SUCCEEDED(res) && (!playAreaChangeTime || askedAt >= playAreaChangeTime)) { + playAreaSession = xr_session.get(); + playAreaChangeTime = 0; + } + } + if (!playAreaKnown) + return false; // no play area (set up, or at all) + bounds = playAreaRect; + } if (count) *count = 4; @@ -1929,6 +2087,13 @@ bool XrBackend::GetPlayAreaPoints(vr::HmdVector3_t* points, int* count) return true; } +void XrBackend::ForgetPlayArea(XrTime changeTime) +{ + std::lock_guard lock(playAreaLock); + playAreaSession = XR_NULL_HANDLE; + playAreaChangeTime = changeTime; +} + /** Determine whether the bounds are showing right now **/ bool XrBackend::AreBoundsVisible() { @@ -1979,12 +2144,117 @@ static void PostRoleChange() OcPostEvent(VREvent_TrackedDeviceRoleChanged, k_unTrackedDeviceIndexInvalid, VREvent_Data_t{}, false); } -// The runtime ends the game's session by its own choice: the driver asks to quit, and the game is told to +// The user quit from the runtime: the driver asks to quit, and the game is told to, once void XrBackend::OnRuntimeQuit() { - if (!sessionLost) - OcPostEvent(VREvent_DriverRequestedQuit, k_unTrackedDeviceIndexInvalid, VREvent_Data_t{}, false); - OnSessionLost(); + sessionActive = false; + renderingFrame = false; + sessionLost = true; + if (quitting.exchange(true)) + return; + OOVR_LOG("The OpenXR runtime ended the session: telling the game to quit"); + OcPostEvent(VREvent_DriverRequestedQuit, k_unTrackedDeviceIndexInvalid, VREvent_Data_t{}, false); + EnqueueQuit(); +} + +XrBackend::StateOutcome XrBackend::OutcomeOfState(XrSessionState state, bool sawStopping, bool exitExpected) +{ + if (exitExpected) + return StateOutcome::Ignored; + if (state == XR_SESSION_STATE_LOSS_PENDING) + return StateOutcome::Lost; + if (state == XR_SESSION_STATE_EXITING) + return sawStopping ? StateOutcome::Quit : StateOutcome::Lost; + return StateOutcome::Ignored; +} + +bool XrBackend::RecoveryDue(std::chrono::steady_clock::time_point lastTry, std::chrono::steady_clock::time_point now) +{ + return lastTry == std::chrono::steady_clock::time_point{} || now - lastTry >= kRecoveryInterval; +} + +const char* XrBackend::RebuildReasonName(RebuildReason reason) +{ + switch (reason) { + case RebuildReason::AppGraphics: + return "the game's graphics device"; + case RebuildReason::Inputs: + return "the game's inputs"; + case RebuildReason::Loss: + return "a lost session"; + } + return "?"; +} + +// The running backend, if it's OpenXR's (the unit tests run others) +static XrBackend* CurrentBackend() +{ + BackendManager* manager = BackendManager::InstancePtr(); + return manager ? dynamic_cast(manager->GetBackendInstance()) : nullptr; +} + +bool XrBackend::CurrentSessionGone() +{ + XrBackend* backend = CurrentBackend(); + return !xr_gbl || (backend && backend->IsSessionLost()); +} + +bool XrBackend::CurrentSessionLost() +{ + XrBackend* backend = CurrentBackend(); + return backend && backend->IsSessionLost() && !backend->IsQuitting(); +} + +bool XrBackend::InputsMayAttach() +{ + if (IsHelperSession() || BaseClientCore::appType != vr::VRApplication_Scene) + return true; + XrBackend* backend = CurrentBackend(); + if (!backend || backend->usingApplicationGraphicsAPI || backend->appGraphicsUnusable) + return true; + // No Submit yet: a game that never submits (or takes a long time to) gets its inputs after a while + using clock = std::chrono::steady_clock; + const clock::rep now = clock::now().time_since_epoch().count(); + clock::rep expected = 0; + if (backend->inputsFirstAsked.compare_exchange_strong(expected, now)) + return false; + return clock::duration(now - expected) >= kInputsWithoutSubmit; +} + +// The devices the game knows of now: the headset, the hands that have a controller, and the trackers +static std::vector PresentDevices(IBackend& backend) +{ + std::vector present; + for (TrackedDeviceIndex_t i = 0; i < k_unMaxTrackedDeviceCount; i++) { + if (backend.GetDevice(i)) + present.push_back(i); + } + return present; +} + +XrResult XrBackend::RebuildSession(RebuildReason reason) +{ + auto lock = xr_session.lock(); + OOVR_LOGF("Making the OpenXR session again, for %s", RebuildReasonName(reason)); + + // Never in the middle of a frame: one the game has open on a running session is ended as if it had submitted + if (renderingFrame && sessionActive && !sessionLost && xr_gbl) + SubmitFrames(false); + + XrResult res = DrvOpenXR::SetupSession(); + if (XR_FAILED(res)) + return res; + + // The skybox the game set is shown again from its texture, at the new session's first frame + { + std::lock_guard pending(pendingSkyboxLock); + if (!shownSkybox.Empty()) + pendingSkybox = shownSkybox; + } + // The overlays' swapchains went with the old session: made again from their textures + if (BaseOverlay* overlay = GetUnsafeBaseOverlay()) + overlay->_OnSessionRebuilt(); + return XR_SUCCESS; } void XrBackend::PumpEvents() @@ -1995,6 +2265,10 @@ void XrBackend::PumpEvents() std::unique_lock pumpLock(pumping, std::try_to_lock); if (!pumpLock.owns_lock()) return; + // Nor while another thread makes the instance or session again (it holds the session lock, and pumps itself) + SessionLock sessionLock(xr_session, SessionLock::TryShared{}); + if (!sessionLock.IsHeld()) + return; // Poll for OpenXR events while (true) { @@ -2003,7 +2277,7 @@ void XrBackend::PumpEvents() if (XR_FAILED(res)) { OOVR_LOG_ONCE("xrPollEvent failed: no events this frame"); if (res == XR_ERROR_INSTANCE_LOST) - OnRuntimeQuit(); + OnInstanceLost(); break; } @@ -2028,11 +2302,11 @@ void XrBackend::PumpEvents() continue; } - // The instance is going away (the runtime updating or shutting down): the game is told to quit while it can + // The instance is going away (the runtime updating or shutting down): it's made again, with its session if (ev.type == XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING) { OOVR_LOG("The OpenXR instance will be lost"); if (!exitExpected) - OnRuntimeQuit(); + OnInstanceLost(); continue; } @@ -2045,6 +2319,7 @@ void XrBackend::PumpEvents() switch ((int)change->referenceSpaceType) { case (int)XR_REFERENCE_SPACE_TYPE_STAGE: case (int)OC_XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR: + ForgetPlayArea(change->changeTime); // the stage's bounds may change with it OcPostEvent(VREvent_StandingZeroPoseReset, k_unTrackedDeviceIndex_Hmd, VREvent_Data_t{}, false); OcPostEvent(VREvent_ChaperoneUniverseHasChanged, k_unTrackedDeviceIndexInvalid, VREvent_Data_t{}, false); break; @@ -2133,6 +2408,7 @@ void XrBackend::PumpEvents() break; } sessionActive = true; + sawStopping = false; frameAwaitingBegin = false; frameBegun = false; frameCallFailures = 0; @@ -2147,22 +2423,27 @@ void XrBackend::PumpEvents() if (sessionActive && XR_FAILED(xrEndSession(xr_session.get()))) // could be inactive if we missed XR_SESSION_STATE_READY OOVR_LOG("xrEndSession failed"); sessionActive = false; + sawStopping = true; renderingFrame = false; frameBegun = false; frameAwaitingBegin = false; break; } - case XR_SESSION_STATE_EXITING: { - OOVR_LOGF("Exiting"); - // The runtime ending the session (the user quitting from its menu, say) is the game's cue to quit; - // OpenComposite ending it itself isn't - if (!exitExpected) - OnRuntimeQuit(); - break; - } + case XR_SESSION_STATE_EXITING: case XR_SESSION_STATE_LOSS_PENDING: { - // If the headset is unplugged or the user decides to exit the app - OnRuntimeQuit(); + // The user quitting from the runtime's menu (EXITING after STOPPING) is the game's cue to quit; a session + // lost (the headset unplugged, the runtime restarting) is made again once the system is back; OpenLamina + // ending the session itself is neither + switch (OutcomeOfState(sessionState, sawStopping, exitExpected)) { + case StateOutcome::Quit: + OnRuntimeQuit(); + break; + case StateOutcome::Lost: + OnSessionLost(); + break; + case StateOutcome::Ignored: + break; + } break; } default: @@ -2173,6 +2454,10 @@ void XrBackend::PumpEvents() // A session already destroyed (around a restart) has nothing to say about the controllers if (((XrEventDataInteractionProfileChanged*)&ev)->session == xr_session.get()) UpdateInteractionProfile(); + } else if (ev.type == OC_XR_TYPE_EVENT_DATA_VIVE_TRACKER_CONNECTED_HTCX) { + // A Vive tracker came, or its role changed: the trackers again + if (!sessionLost && xr_session.get()) + CreateGenericTrackers(); } else if (ev.type == OC_XR_TYPE_EVENT_DATA_DISPLAY_REFRESH_RATE_CHANGED_FB) { // Prop_DisplayFrequency_Float asks the runtime again auto* changed = (const OcXrEventDataDisplayRefreshRateChangedFB*)&ev; @@ -2215,17 +2500,73 @@ void XrBackend::PumpEvents() Some runtimes (WMR) do not instantly return an interaction profile, so we will keep tryinig to query it until it does. - Note that we check that the session is focused because this means that the application - has already submitted a frame, that frame is visible, and we have input focus. - Waiting until the application has input focus allows us to avoid unnecessarily restarting the - session when we can't even receive input anyway, as well as before the session is restarted for - the temporary session. + Note that we wait for the session to be synchronised, which means the application has waited + for a frame. That may still be on the temporary session, which is restarted at the game's first + Submit: the controllers are found again on the new one, and the game has them in the meantime. */ // Not while a session is being ended (ShutdownSession pumps events while it waits, maybe under the input restart) BaseInput* input = GetUnsafeBaseInput(); - if (input && !exitExpected && !input->AreActionsLoaded() && sessionState == XR_SESSION_STATE_FOCUSED && !Hand(XrController::XCT_LEFT) && !Hand(XrController::XCT_RIGHT)) { - QueryForInteractionProfile(); + // From the game's first frame (SYNCHRONIZED on), not only once it has focus: games look for their controllers in + // their first frames, and runtimes can take seconds to give focus. The profile is read straight after, in case + // the runtime gives it without an event. Not before the game's device is known (InputsMayAttach): another session + // restart for it would follow. + const bool framesStarted = sessionState == XR_SESSION_STATE_SYNCHRONIZED || sessionState == XR_SESSION_STATE_VISIBLE + || sessionState == XR_SESSION_STATE_FOCUSED; + if (input && !exitExpected && !input->AreActionsLoaded() && !input->LegacyInputAsked() && framesStarted + && !Hand(XrController::XCT_LEFT) && !Hand(XrController::XCT_RIGHT) && InputsMayAttach()) { + // Under the session lock (shared, if it's free): not while another thread makes and binds the game's actions + SessionLock sessionLock(xr_session, SessionLock::TryShared{}); + if (sessionLock.IsHeld() && !input->AreActionsLoaded()) { + QueryForInteractionProfile(); + UpdateInteractionProfile(); + } } + + // A hand without a controller is shown as one while hand tracking runs: checked once a second + if (input && !exitExpected && !sessionLost && xr_session.get() && HandsWithoutControllersChanged()) + UpdateInteractionProfile(); +} + +const InteractionProfile* XrBackend::HandWithoutController(int hand) +{ + const InteractionProfile* profile = InteractionProfile::GetProfileByPath("/interaction_profiles/ext/hand_interaction_ext"); + BaseInput* input = GetUnsafeBaseInput(); + if (!profile || !input || !input->handTrackers[hand] || !xr_gbl || xr_gbl->floorSpace == XR_NULL_HANDLE) + return nullptr; + + XrHandJointsLocateInfoEXT locateInfo = { XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT }; + locateInfo.baseSpace = xr_gbl->floorSpace; + locateInfo.time = xr_gbl->GetBestTime(); + std::vector joints(XR_HAND_JOINT_COUNT_EXT); + XrHandJointLocationsEXT locations = { XR_TYPE_HAND_JOINT_LOCATIONS_EXT }; + locations.jointCount = (uint32_t)joints.size(); + locations.jointLocations = joints.data(); + if (XR_FAILED(xr_ext->xrLocateHandJointsEXT(input->handTrackers[hand], &locateInfo, &locations)) || !locations.isActive) + return nullptr; + return profile; +} + +bool XrBackend::HandsWithoutControllersChanged() +{ + const int64_t nowMs = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); + int64_t last = handsCheckedMs; + if (nowMs - last < 1000 || !handsCheckedMs.compare_exchange_strong(last, nowMs)) + return false; + const InteractionProfile* handProfile = InteractionProfile::GetProfileByPath("/interaction_profiles/ext/hand_interaction_ext"); + if (!handProfile) + return false; + bool changed = false; + for (int hand = 0; hand < 2; hand++) { + std::shared_ptr current = Hand(hand == 0 ? XrController::XCT_LEFT : XrController::XCT_RIGHT); + const bool tracked = HandWithoutController(hand) != nullptr; + handMisses[hand] = tracked ? 0 : handMisses[hand] + 1; + if (tracked && !current) + changed = true; + // Gone only after a few checks without it + if (!tracked && current && handFromTracking[hand] && handMisses[hand] >= kHandMissesAllowed) + changed = true; + } + return changed; } bool XrBackend::WaitForEvents(const std::function& done, int timeoutMs) @@ -2244,7 +2585,9 @@ bool XrBackend::WaitForEvents(const std::function& done, int timeoutMs) void XrBackend::OnFrameCallFailed(XrResult res) { renderingFrame = false; - if (res == XR_ERROR_SESSION_LOST || res == XR_ERROR_INSTANCE_LOST || ++frameCallFailures >= 5) + if (res == XR_ERROR_INSTANCE_LOST) + OnInstanceLost(); + else if (res == XR_ERROR_SESSION_LOST || ++frameCallFailures >= 5) OnSessionLost(); // No waited frame to pace the game: about one frame's wait instead of a busy loop std::this_thread::sleep_for(std::chrono::milliseconds(11)); @@ -2254,17 +2597,151 @@ void XrBackend::OnSessionLost() { sessionActive = false; renderingFrame = false; - if (sessionLost) + if (sessionLost.exchange(true)) return; - sessionLost = true; - OOVR_LOG("The OpenXR session is lost: telling the game to quit"); - EnqueueQuit(); + if (quitting) + return; + // An EXITING after the loss is the lost session's, not the user quitting + sawStopping = false; + OOVR_LOG("The OpenXR session is lost: making it again once the system is back"); + // The headset and controllers go away until then, as SteamVR's do when their driver goes + if (!devicesDeactivated.exchange(true)) { + for (TrackedDeviceIndex_t i : PresentDevices(*this)) + OcPostEvent(VREvent_TrackedDeviceDeactivated, i, VREvent_Data_t{}, false); + } +} + +void XrBackend::OnInstanceLost() +{ + if (!instanceLost.exchange(true)) + OOVR_LOG("The OpenXR instance is lost: making it again once the runtime is back"); + OnSessionLost(); +} + +// A new instance's xrCreateSession wants the graphics requirements of the binding's API asked of it first +static void AskGraphicsRequirements(const void* binding) +{ + const auto* header = (const XrBaseInStructure*)binding; + if (!header) + return; + switch (header->type) { +#if defined(_WIN32) && defined(SUPPORT_DX) && defined(SUPPORT_DX11) + case XR_TYPE_GRAPHICS_BINDING_D3D11_KHR: { + XrGraphicsRequirementsD3D11KHR requirements{ XR_TYPE_GRAPHICS_REQUIREMENTS_D3D11_KHR }; + OC_XR_LOG(xr_ext->xrGetD3D11GraphicsRequirementsKHR(xr_instance, xr_system, &requirements)); + break; + } +#endif +#if defined(_WIN32) && defined(SUPPORT_DX) && defined(SUPPORT_DX12) + case XR_TYPE_GRAPHICS_BINDING_D3D12_KHR: { + XrGraphicsRequirementsD3D12KHR requirements{ XR_TYPE_GRAPHICS_REQUIREMENTS_D3D12_KHR }; + OC_XR_LOG(xr_ext->xrGetD3D12GraphicsRequirementsKHR(xr_instance, xr_system, &requirements)); + break; + } +#endif +#if defined(SUPPORT_VK) + case XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR: { + XrGraphicsRequirementsVulkanKHR requirements{ XR_TYPE_GRAPHICS_REQUIREMENTS_VULKAN_KHR }; + OC_XR_LOG(xr_ext->xrGetVulkanGraphicsRequirementsKHR(xr_instance, xr_system, &requirements)); + // The session's device must be the one the new instance names + const auto* vk = (const XrGraphicsBindingVulkanKHR*)binding; + VkPhysicalDevice wanted = VK_NULL_HANDLE; + if (XR_SUCCEEDED(xr_ext->xrGetVulkanGraphicsDeviceKHR(xr_instance, xr_system, vk->instance, &wanted)) && wanted != vk->physicalDevice) + OOVR_LOG("The new OpenXR instance wants another Vulkan device than the session's: its session may fail"); + break; + } +#endif +#if defined(SUPPORT_GL) +#ifdef _WIN32 + case XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR: +#else + case XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR: +#endif + { + XrGraphicsRequirementsOpenGLKHR requirements{ XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_KHR }; + OC_XR_LOG(xr_ext->xrGetOpenGLGraphicsRequirementsKHR(xr_instance, xr_system, &requirements)); + break; + } +#endif +#if defined(SUPPORT_GLES) + case XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR: { + XrGraphicsRequirementsOpenGLESKHR requirements{ XR_TYPE_GRAPHICS_REQUIREMENTS_OPENGL_ES_KHR }; + OC_XR_LOG(xr_ext->xrGetOpenGLESGraphicsRequirementsKHR(xr_instance, xr_system, &requirements)); + break; + } +#endif + default: + break; + } +} + +void XrBackend::RecoverLostSession(std::mutex* passLock) +{ + if (!sessionLost || quitting || ownFramesStopped) + return; + // One thread tries at a time; the others carry on without a session + std::unique_lock guard(recoveryLock, std::try_to_lock); + if (!guard.owns_lock()) + return; + using clock = std::chrono::steady_clock; + const auto now = clock::now(); + if (!RecoveryDue(clock::time_point(clock::duration(lastRecoveryTry.load())), now)) + return; + + // The session lock, then the helper loop's pass (the order its passes take them in). The helper loop never waits + // for the session lock: a thread holding it may be stopping the loop. Not a conditional expression: MSVC wants a + // copy constructor for one, which SessionLock lacks. + auto lock = [passLock] { + if (passLock) + return xr_session.try_lock(); + return xr_session.lock(); + }(); + if (!lock.IsHeld()) + return; // the next pass tries again + lastRecoveryTry = now.time_since_epoch().count(); + std::unique_lock pass; + if (passLock) + pass = std::unique_lock(*passLock); + if (!sessionLost || quitting) + return; + // With a lost instance, the game's actions go first (forgotten: they went with it, and are made again on the new + // one), with the paths and the trackers' list of devices made on it. The info set goes with the session. + if (instanceLost) { + if (BaseInput* input = GetUnsafeBaseInput()) + input->_ForgetInstance(); + subactionPaths[0] = subactionPaths[1] = XR_NULL_PATH; + generic_trackers_generation = UINT64_MAX; + generic_trackers_session = XR_NULL_HANDLE; + } + // The lost session, once: its handles are no use any more + if (!lostSessionDestroyed) { + if (xr_gbl || xr_session.get()) + DrvOpenXR::ShutdownSession(); + lostSessionDestroyed = true; + } + if (instanceLost) { + if (XR_FAILED(DrvOpenXR::RemakeInstance())) + return; // no runtime or headset yet: the next try in a second + instanceLost = false; + } else if (XrResult res = DrvOpenXR::FindSystem(); XR_FAILED(res)) { + if (res == XR_ERROR_INSTANCE_LOST) + instanceLost = true; // the instance went too while the session was lost: made again at the next try + return; // no headset yet: the next try in a second + } + // Asked of the system found (on a new instance, or a new system id), as xrCreateSession wants + AskGraphicsRequirements(GetCurrentGraphicsBinding()); + if (XR_FAILED(RebuildSession(RebuildReason::Loss)) || sessionLost) + return; + // After a new instance: the game's actions and bindings, from its manifest, on it and its session + if (BaseInput* input = GetUnsafeBaseInput()) + input->_RebuildForNewInstance(); + OOVR_LOG("The OpenXR session is back"); } // Own frames call xrEndFrame on their own thread, where the runtime may use the session's device while the game's // threads use it too. A D3D11 device's immediate context is made safe for that (multithread protection, logged once); // a D3D12 queue is free-threaded. A Vulkan queue or an OpenGL context can't be shared with the game's threads that -// way: false, logged once, and there are no own frames. +// way: false, and their own frames run only inside the game's calls (OwnFramesInCallsOnly). static bool DeviceReadyForOwnFrames(const void* binding) { const auto* header = (const XrBaseInStructure*)binding; @@ -2294,17 +2771,58 @@ static bool DeviceReadyForOwnFrames(const void* binding) return true; #endif default: - OOVR_LOG_ONCEF("ownFrames: no own frames on a session of graphics binding type %d (a Vulkan queue or an OpenGL context " - "is the game's own)", - (int)header->type); return false; } } +// A Vulkan queue or an OpenGL context is the game's own: own frames on its session run only inside the game's calls +// to OpenLamina (where OpenVR may use the queue, and on the thread where the context is current), with no thread of +// their own. True for those, with the OpenGL context to look for; false, logged once, for anything else. +static bool OwnFramesInCallsOnly(const void* binding, const void* gameGlContext, const void** glContext) +{ + *glContext = nullptr; + const auto* header = (const XrBaseInStructure*)binding; + if (!header) + return false; + switch (header->type) { + case XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR: + return true; +#if defined(SUPPORT_GL) && defined(_WIN32) + case XR_TYPE_GRAPHICS_BINDING_OPENGL_WIN32_KHR: + *glContext = (const void*)((const XrGraphicsBindingOpenGLWin32KHR*)binding)->hGLRC; + return *glContext != nullptr; +#elif defined(SUPPORT_GL) && !defined(ANDROID) + case XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR: + // The game's context, not the session's (a context of OpenLamina's shared with it) + *glContext = gameGlContext; + return *glContext != nullptr; +#endif + default: + OOVR_LOG_ONCEF("ownFrames: no own frames on a session of graphics binding type %d", (int)header->type); + return false; + } +} + +void XrBackend::ForgetTrackerSpaces() +{ + // The trackers' spaces went with the old session, even if the new one has the same handle + std::unique_lock lock(generic_trackers_mutex); + generic_trackers_session = XR_NULL_HANDLE; +} + void XrBackend::OnSessionCreated() { + ForgetPlayArea(); sessionLost = false; exitExpected = false; + sawStopping = false; + lostSessionDestroyed = false; + lastRecoveryTry = 0; + // The devices are back, whichever path made the session after a loss + if (devicesDeactivated.exchange(false)) { + for (TrackedDeviceIndex_t i : PresentDevices(*this)) + OcPostEvent(VREvent_TrackedDeviceActivated, i, VREvent_Data_t{}, false); + } toldIpd = NAN; // the new session's first IPD is the one the game has // The gap from the old session's last frame isn't dropped frames RestartFrameTiming(); @@ -2335,7 +2853,13 @@ void XrBackend::OnSessionCreated() // A helper program's session has its own loop, whatever ownFrames says: an overlay session's frames are all // OpenLamina's, and a headless one's events come from nowhere else if (IsHelperSession()) { - StartHelperLoop(); + if (!recoveringInHelperLoop) + StartHelperLoop(); + return; + } + + if (BaseClientCore::appType == vr::VRApplication_Background) { + StartBackgroundFrames(); return; } @@ -2345,10 +2869,22 @@ void XrBackend::OnSessionCreated() // Frames of OpenLamina's own while the game runs none and there's a skybox or an overlay to show StopOwnFrames(); - if (ownFramesStopped || !oovr_global_configuration.OwnFrames() || !DeviceReadyForOwnFrames(GetCurrentGraphicsBinding())) + ownFramesGlContext = nullptr; + ownFramesInCalls = false; + if (ownFramesStopped || !oovr_global_configuration.OwnFrames()) return; + const void* binding = GetCurrentGraphicsBinding(); + OwnFrameLoop::Mode mode = OwnFrameLoop::Mode::WhenAppIdle; + if (!DeviceReadyForOwnFrames(binding)) { + const void* glContext = nullptr; + if (!OwnFramesInCallsOnly(binding, gameGlContext, &glContext)) + return; + mode = OwnFrameLoop::Mode::InCallsOnly; + ownFramesGlContext = glContext; + ownFramesInCalls = true; + } ownFrames = std::make_unique( - OwnFrameLoop::Mode::WhenAppIdle, + mode, [this](XrTime, std::vector& layers) { // RunOwnFrame holds frameOwner, under which the skybox and the game's last frame are replaced: the skybox in // the game's place, else its last frame again (which the runtime reprojects); then the overlays @@ -2359,6 +2895,11 @@ void XrBackend::OnSessionCreated() } if (layers.empty() && haveLastProjection) layers.push_back((const XrCompositionLayerBaseHeader*)&lastProjection); + // The fade over the scene, as on the game's frames (a game that stalls in a fade to black stays black) + if (!layers.empty()) { + if (XrCompositionLayerBaseHeader* fade = BuildFadeLayer()) + layers.push_back(fade); + } BaseOverlay* overlay = GetUnsafeBaseOverlay(); if (!overlay) return; @@ -2373,7 +2914,8 @@ void XrBackend::OnSessionCreated() }, [this] { BaseOverlay* overlay = GetUnsafeBaseOverlay(); - return SkyboxShown() || (overlay && overlay->_AnyVisible()); + return SkyboxShown() || (overlay && overlay->_AnyVisible()) + || FadeVisible(CompositorFades::Get().ColourAt(CompositorClockSeconds(), false)); }); } @@ -2397,6 +2939,18 @@ void XrBackend::StartHelperLoop() }, std::chrono::milliseconds(0), [this, overlaySession](const OwnFrameLoop::LayerSource& source, const std::function& wanted) -> XrDuration { + // A lost session is made again here, between passes, about once a second until the runtime has one: no other + // thread of a helper program runs frames to do it. Its loop and thread are kept through the rebuild. + if (sessionLost) { + if (!quitting) { + recoveringInHelperLoop = true; + ScopeGuard done([] { recoveringInHelperLoop = false; }); + RecoverLostSession(&helperPassLock); + } + std::lock_guard pass(helperPassLock); + PumpEvents(); + return 0; + } // The session lock (shared) through the frame, if it's free: a session restart holds it while it stops this // loop. RunOwnFrame's own try then finds it held. SessionLock lock(xr_session, SessionLock::TryShared{}); @@ -2428,6 +2982,26 @@ void XrBackend::StartHelperLoop() }); } +// A background app on a scene session (Linux, where Proton's helper uses one) runs no frames, so the session would +// never be focused and give it no input: empty frames of OpenLamina's (no layers, no device needed), with the events +// pumped, until the program runs a frame of its own +void XrBackend::StartBackgroundFrames() +{ + StopOwnFrames(); + if (ownFramesStopped) + return; + ownFrames = std::make_unique( + OwnFrameLoop::Mode::UntilAppFrame, [](XrTime, std::vector&) {}, + std::chrono::milliseconds(0), + [this](const OwnFrameLoop::LayerSource& source, const std::function& wanted) -> XrDuration { + SessionLock lock(xr_session, SessionLock::TryShared{}); + if (!lock.IsHeld()) + return 0; + PumpEvents(); + return RunOwnFrame(source, wanted); + }); +} + bool XrBackend::EnsureOverlaySession() { if (CurrentSessionKind() != SessionKind::Overlay) @@ -2457,6 +3031,13 @@ bool XrBackend::EnsureOverlaySession() // The program's textures are copied onto the device (D3D11 only) if (binding->type == XR_TYPE_GRAPHICS_BINDING_D3D11_KHR && !overlayCopy) overlayCopy = std::make_unique(((const XrGraphicsBindingD3D11KHR*)binding)->device); +#endif +#if defined(SUPPORT_VK) && !defined(_WIN32) + // The program's Vulkan and OpenGL textures are shared with the device where they can be (on its GPU) + TemporaryVk* vk = temporaryGraphics ? temporaryGraphics->GetAsVk() : nullptr; + if (binding->type == XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR && vk && vk->externalMemoryFd && !overlayShare) + overlayShare = std::make_unique(vk->instance, vk->physicalDevice, vk->device, + ((const XrGraphicsBindingVulkanKHR*)binding)->queueFamilyIndex, vk->queue); #endif return true; } @@ -2465,6 +3046,39 @@ void XrBackend::ForgetOverlayTextures(const void* owner) { if (overlayCopy) overlayCopy->Forget(owner); +#if defined(SUPPORT_VK) && !defined(_WIN32) + if (overlayShare) + overlayShare->Forget(owner); +#endif +} + +const vr::VRVulkanTextureData_t* XrBackend::ShareOverlayTexture(const vr::Texture_t* texture, const void* owner, bool* flipY, std::string* why) +{ +#if defined(SUPPORT_VK) && !defined(_WIN32) + if (overlayShare) + return overlayShare->CopyIn(texture, owner, flipY, why); +#endif + *flipY = false; + if (why) + *why = "the overlay session's device can't share images with the program"; + return nullptr; +} + +void XrBackend::ReleaseSharedOverlayTexture(const void* owner) +{ +#if defined(SUPPORT_VK) && !defined(_WIN32) + if (overlayShare) + overlayShare->Release(owner); +#endif +} + +std::shared_ptr XrBackend::MakeSessionOverlayCompositor(const vr::Texture_t* texture) +{ +#ifdef SUPPORT_VK + if (texture && texture->eType == vr::TextureType_Vulkan) + return std::make_shared(texture); +#endif + return nullptr; } ID3D11Texture2D* XrBackend::CopyOverlayTexture(const vr::Texture_t* texture, const vr::VRTextureBounds_t* bounds, std::string* why, const void* owner) @@ -2525,7 +3139,7 @@ OwnFrameLoop::OwnFrameLoop(Mode mode, LayerSource source, std::chrono::milliseco bool XrBackend::RunOwnFramesWhile(const std::function& keepGoing) { - if (!ownFrames) + if (!ownFrames || !OwnFramesHere()) return false; ownFrames->RunWhile(keepGoing); return true; @@ -2533,8 +3147,27 @@ bool XrBackend::RunOwnFramesWhile(const std::function& keepGoing) void XrBackend::EndOpenAppFrame() { - // As if the game had submitted + // As if the game had submitted: with its last frame again + repeatLastFrame = true; SubmitFrames(false); + repeatLastFrame = false; +} + +bool XrBackend::OwnFramesHere() const +{ + if (!ownFrames) + return false; + if (!ownFramesGlContext) { + const std::thread::id renderThread = gameFrameThread; + return !ownFramesInCalls || renderThread == std::this_thread::get_id(); + } +#if defined(SUPPORT_GL) && defined(_WIN32) + return (const void*)wglGetCurrentContext() == ownFramesGlContext; +#elif defined(SUPPORT_GL) && !defined(ANDROID) + return (const void*)glXGetCurrentContext() == ownFramesGlContext; +#else + return false; +#endif } void XrBackend::ClearSubmittedFrame() @@ -2555,6 +3188,10 @@ void XrBackend::StopOwnFrames(bool forGood) { if (forGood) ownFramesStopped = true; + // The helper loop rebuilding its own session from its thread: it goes on (under the session lock, which a stop for + // good waits for) + if (recoveringInHelperLoop && !forGood) + return; // Joins its thread, which doesn't wait for the session lock that a session restart here holds ownFrames.reset(); // Goes with the interfaces, before them @@ -2788,6 +3425,20 @@ void XrBackend::UpdateInteractionProfile() OC_XR_LOG(xrStringToPath(xr_instance, info.pathstr, &path)); // On failure state.interactionProfile stays XR_NULL_PATH: no controller for this hand yet OC_XR_LOG(xrGetCurrentInteractionProfile(xr_session.get(), path, &state)); + // No controller, but the hand is tracked: the hand, shown as a controller + if (state.interactionProfile == XR_NULL_PATH) { + const int hand = info.hand == XrController::XCT_LEFT ? 0 : 1; + const InteractionProfile* profile = HandWithoutController(hand); + // A hand lost for a moment keeps its controller + std::shared_ptr current = Hand(info.hand); + if (!profile && current && handFromTracking[hand] && handMisses[hand] < kHandMissesAllowed) + profile = current->GetInteractionProfile(); + if (profile) + OC_XR_LOG(xrStringToPath(xr_instance, profile->GetPath().c_str(), &state.interactionProfile)); + handFromTracking[hand] = profile != nullptr; + } else { + handFromTracking[info.hand == XrController::XCT_LEFT ? 0 : 1] = false; + } // interaction profile detected if (state.interactionProfile != XR_NULL_PATH) { @@ -2835,12 +3486,12 @@ void XrBackend::UpdateInteractionProfile() } if (!Hand(XrController::XCT_LEFT) && !Hand(XrController::XCT_RIGHT)) { // Runtime returned an unknown interaction profile: no controller until it gives one we know - OOVR_LOGF("Runtime unexpectedly returned an unknown interaction profile: %s", path_name); + OOVR_LOG_ONCEF("Runtime unexpectedly returned an unknown interaction profile: %s", path_name); } } else { // interaction profile lost/not detected - OOVR_LOGF("%s - No interaction profile detected", info.pathstr); if (Hand(info.hand)) { + OOVR_LOGF("%s - No interaction profile detected", info.pathstr); { std::unique_lock handsLock(hands_mutex); info.controller.reset(); @@ -2871,21 +3522,31 @@ void XrBackend::UpdateInteractionProfile() CreateGenericTrackers(); } -void XrBackend::CreateGenericTrackers() +// Lower case, to compare serials +static std::string LowerCase(std::string s) { - if (!xr_ext->xrMndxXdevSpace_Available()) - return; - - std::unique_lock lock(generic_trackers_mutex); + std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) { return (char)std::tolower(c); }); + return s; +} - OOVR_LOGF("Checking for generic trackers..."); +// A path's text; empty for a null path or one the runtime can't name +static std::string XrPathText(XrPath path) +{ + if (path == XR_NULL_PATH) + return {}; + char buffer[XR_MAX_PATH_LENGTH] = {}; + uint32_t length = 0; + if (XR_FAILED(xrPathToString(xr_instance, path, sizeof(buffer), &length, buffer))) + return {}; + return std::string(buffer, strnlen(buffer, sizeof(buffer))); +} +bool XrBackend::FindXDevTrackers(XrXDevListMNDX& generic_tracker_list, const std::vector& byRole, + const std::function& add) +{ // list containing all generic tracked devices - XrXDevListMNDX generic_tracker_list; + generic_tracker_list = XR_NULL_HANDLE; std::vector generic_tracker_ids(MAX_GENERIC_TRACKERS); - InteractionProfile* profile = InteractionProfile::GetProfileByPath("/interaction_profiles/htc/vive_tracker_htcx"); - if (!profile) - return; uint32_t xdev_count = 0; @@ -2905,12 +3566,13 @@ void XrBackend::CreateGenericTrackers() if (XR_FAILED(xr_ext->xrCreateXDevListMNDX(xr_session.get(), &create_info, &generic_tracker_list))) { OOVR_LOG("xrCreateXDevListMNDX failed: no generic trackers"); generic_tracker_list = XR_NULL_HANDLE; - return; + return false; } if (XR_FAILED(xr_ext->xrEnumerateXDevsMNDX(generic_tracker_list, MAX_GENERIC_TRACKERS, &xdev_count, generic_tracker_ids.data()))) { OOVR_LOG("xrEnumerateXDevsMNDX failed: no generic trackers"); xr_ext->xrDestroyXDevListMNDX(generic_tracker_list); - return; + generic_tracker_list = XR_NULL_HANDLE; + return false; } std::vector forced_tracker_serials{}; @@ -2962,23 +3624,103 @@ void XrBackend::CreateGenericTrackers() if (XR_SUCCEEDED(xr_ext->xrGetXDevListGenerationNumberMNDX(generic_tracker_list, &generation))) generic_trackers_generation = generation; - // A tracker the runtime still lists keeps its place, so the indices the program holds stay right. Its space goes - // with the session it was made in, so after a restart it is made again in the same place. - const bool sameSession = generic_trackers_session == xr_session.get(); - generic_trackers_session = xr_session.get(); + for (const XrXDevIdMNDX id : generic_tracker_ids) { + cur_info.id = id; + OC_XR_LOG(xr_ext->xrGetXDevPropertiesMNDX(generic_tracker_list, &cur_info, &cur_properties)); + // A Vive tracker the runtime also lists by its role is that one + const std::string serial = LowerCase(cur_properties.serial); + if (!serial.empty() && std::any_of(byRole.begin(), byRole.end(), [&](const std::string& path) { return path.ends_with(serial); })) + continue; + add(id, cur_properties); + } + return true; +} + +void XrBackend::CreateGenericTrackers() +{ + const bool htcx = xr_ext->ViveTrackersHTCX_Available(); + const bool mndx = xr_ext->xrMndxXdevSpace_Available(); + if (!htcx && !mndx) + return; + + std::unique_lock lock(generic_trackers_mutex); + + OOVR_LOGF("Checking for generic trackers..."); + + InteractionProfile* profile = InteractionProfile::GetProfileByPath("/interaction_profiles/htc/vive_tracker_htcx"); + if (!profile) + return; + // Each tracker wanted: a Vive tracker by its role (XR_HTCX_vive_tracker_interaction), whose pose is the tracker + // action's on the role's path, or an xdev (XR_MNDX_xdev_space) struct Wanted { - XrXDevIdMNDX id; - XrXDevPropertiesMNDX properties; + XrXDevIdMNDX id = 0; + XrXDevPropertiesMNDX properties{ XR_TYPE_XDEV_PROPERTIES_MNDX }; + XrPath rolePath = XR_NULL_PATH; // a role's tracker + std::string controllerType; bool placed = false; }; std::vector wanted; - for (const XrXDevIdMNDX id : generic_tracker_ids) { - cur_info.id = id; - OC_XR_LOG(xr_ext->xrGetXDevPropertiesMNDX(generic_tracker_list, &cur_info, &cur_properties)); - wanted.push_back({ id, cur_properties }); + std::vector persistentPaths; + + BaseInput* input = GetUnsafeBaseInput(); + const XrAction trackerAction = input ? input->TrackerPoseAction() : XR_NULL_HANDLE; + const uint64_t trackerGeneration = input ? input->TrackerPoseActionGeneration() : 0; + if (htcx) { + uint32_t count = 0; + std::vector paths; + if (XR_SUCCEEDED(xr_ext->xrEnumerateViveTrackerPathsHTCX(xr_instance, 0, &count, nullptr)) && count > 0) { + paths.assign(count, { OC_XR_TYPE_VIVE_TRACKER_PATHS_HTCX }); + if (XR_FAILED(xr_ext->xrEnumerateViveTrackerPathsHTCX(xr_instance, count, &count, paths.data()))) + count = 0; + paths.resize(std::min(count, paths.size())); + } + viveTrackersListed = (uint32_t)paths.size(); + for (const OcXrViveTrackerPathsHTCX& p : paths) { + std::string persistent = XrPathText(p.persistentPath); + // A tracker without a role has no pose to read here (an xdev may still give it) + std::optional role = ViveTrackerRoleForXrPath(XrPathText(p.rolePath)); + if (!role) + continue; + persistentPaths.push_back(LowerCase(persistent)); + // Its pose needs the tracker action attached + if (trackerAction == XR_NULL_HANDLE) + continue; + Wanted want; + want.rolePath = p.rolePath; + want.controllerType = ViveTrackerControllerType(*role); + // The serial: the persistent path's last part + std::string serial = persistent.substr(persistent.rfind('/') + 1); + if (serial.empty()) + serial = want.controllerType; + strcpy_arr(want.properties.name, ("Vive Tracker " + std::string(role->name)).c_str()); + strcpy_arr(want.properties.serial, serial.c_str()); + want.properties.canCreateSpace = XR_TRUE; + wanted.push_back(want); + } } + // The xdevs can't be listed: the trackers stay as they are, and the next poll tries again + XrXDevListMNDX generic_tracker_list = XR_NULL_HANDLE; + if (mndx + && !FindXDevTrackers(generic_tracker_list, persistentPaths, [&](XrXDevIdMNDX id, const XrXDevPropertiesMNDX& properties) { + Wanted want; + want.id = id; + want.properties = properties; + wanted.push_back(want); + })) { + generic_trackers_generation = UINT64_MAX; + return; + } + + // A tracker the runtime still lists keeps its place, so the indices the program holds stay right. Its space goes + // with the session it was made in, so after a restart it is made again in the same place. + // So is a role's tracker's space when the tracker action was made again (new actions from the game) + const bool sessionChanged = generic_trackers_session != xr_session.get(); + const bool sameAction = generic_trackers_action_generation == trackerGeneration; + generic_trackers_session = xr_session.get(); + generic_trackers_action_generation = trackerGeneration; + BaseSystem* system = GetUnsafeBaseSystem(); auto sendEvent = [&](EVREventType type, TrackedDeviceIndex_t device) { if (!system) @@ -2995,6 +3737,18 @@ void XrBackend::CreateGenericTrackers() XrSpace space = XR_NULL_HANDLE; XrPosef pose = { .orientation = { 0, 0, 0, 1 }, .position = { 0, 0, 0 } }; + if (want.rolePath != XR_NULL_PATH) { + XrActionSpaceCreateInfo info = { XR_TYPE_ACTION_SPACE_CREATE_INFO }; + info.action = trackerAction; + info.subactionPath = want.rolePath; + info.poseInActionSpace = pose; + if (XR_FAILED(xrCreateActionSpace(xr_session.get(), &info, &space))) { + OOVR_LOGF("xrCreateActionSpace failed: no tracker for %s", want.properties.name); + return nullptr; + } + return std::make_shared(*profile, want.properties, index, space, want.controllerType); + } + XrCreateXDevSpaceInfoMNDX create_space_info = { .type = XR_TYPE_CREATE_XDEV_SPACE_INFO_MNDX, .next = NULL, @@ -3017,13 +3771,13 @@ void XrBackend::CreateGenericTrackers() if (!current[slot]) continue; const TrackedDeviceIndex_t deviceIndex = (TrackedDeviceIndex_t)slot + RESERVED_DEVICE_INDICES; - auto it = std::find_if(wanted.begin(), wanted.end(), [&](const Wanted& w) { return !w.placed && current[slot]->Serial() == w.properties.serial; }); + auto it = std::find_if(wanted.begin(), wanted.end(), [&](const Wanted& w) { return !w.placed && current[slot]->Serial() == w.properties.serial && current[slot]->ControllerType() == w.controllerType; }); if (it == wanted.end()) { sendEvent(VREvent_TrackedDeviceDeactivated, deviceIndex); continue; } it->placed = true; - if (sameSession) { + if (!sessionChanged && (it->rolePath == XR_NULL_PATH || sameAction)) { generic_trackers[slot] = current[slot]; } else if ((generic_trackers[slot] = createTracker(*it, (uint32_t)slot))) { sendEvent(VREvent_TrackedDeviceActivated, deviceIndex); @@ -3032,7 +3786,7 @@ void XrBackend::CreateGenericTrackers() } } // The old trackers' spaces go with their session when it was replaced - if (!sameSession) { + if (sessionChanged) { for (std::shared_ptr& old : current) if (old) old->ForgetSpace(); @@ -3061,12 +3815,14 @@ void XrBackend::CreateGenericTrackers() generic_trackers.pop_back(); // cleanup - xr_ext->xrDestroyXDevListMNDX(generic_tracker_list); + if (generic_tracker_list != XR_NULL_HANDLE) + xr_ext->xrDestroyXDevListMNDX(generic_tracker_list); } void XrBackend::PollGenericTrackers() { - if (sessionLost || !xr_ext || !xr_ext->xrMndxXdevSpace_Available()) + const bool htcx = xr_ext && xr_ext->ViveTrackersHTCX_Available(); + if (sessionLost || !xr_ext || (!xr_ext->xrMndxXdevSpace_Available() && !htcx)) return; const int64_t nowMs = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); @@ -3078,6 +3834,15 @@ void XrBackend::PollGenericTrackers() if (!xr_session.get()) return; + // A Vive tracker gone: the runtime lists fewer + uint32_t listed = 0; + if (htcx && XR_SUCCEEDED(xr_ext->xrEnumerateViveTrackerPathsHTCX(xr_instance, 0, &listed, nullptr)) && listed != viveTrackersListed) { + CreateGenericTrackers(); + return; + } + if (!xr_ext->xrMndxXdevSpace_Available()) + return; + XrCreateXDevListInfoMNDX create_info = { .type = XR_TYPE_CREATE_XDEV_LIST_INFO_MNDX }; XrXDevListMNDX list = XR_NULL_HANDLE; if (XR_FAILED(xr_ext->xrCreateXDevListMNDX(xr_session.get(), &create_info, &list))) @@ -3100,12 +3865,13 @@ void XrBackend::MaybeRestartForInputs() if (infoSet == XR_NULL_HANDLE && (!input || !input->AreActionsLoaded())) return; - OOVR_LOG("Restarting session for inputs..."); - if (XR_FAILED(DrvOpenXR::SetupSession())) { - // No session to put the actions on: the game is told to quit - auto* backend = (XrBackend*)BackendManager::Instance().GetBackendInstance(); - if (backend) - backend->OnSessionLost(); + auto* backend = (XrBackend*)BackendManager::Instance().GetBackendInstance(); + // A lost session isn't restarted: the one made again has the game's actions bound + if (!backend || backend->IsSessionLost()) + return; + if (XR_FAILED(backend->RebuildSession(RebuildReason::Inputs))) { + // No session to put the actions on: lost until one can be made + backend->OnSessionLost(); return; } OOVR_LOG("Session restart successful!"); @@ -3175,6 +3941,9 @@ void XrBackend::BindInfoSet() [&path_name](std::string s) -> bool { return s.find("/click") != s.npos && s.find(path_name) != s.npos; }); + // The hands have no click: the pinch is read as one + if (profile->GetPath() == "/interaction_profiles/ext/hand_interaction_ext") + click_path = profile->GetValidInputPaths().find(path_name + "/input/pinch_ext/value"); // A profile with no click input for this hand binds nothing for it if (click_path == profile->GetValidInputPaths().end()) continue; @@ -3198,6 +3967,28 @@ void XrBackend::BindInfoSet() OC_XR_LOG(xrAttachSessionActionSets(xr_session.get(), &info)); } +bool XrBackend::MakeTemporaryGraphics() +{ + if (temporaryGraphics) + return true; +#if defined(SUPPORT_VK) + if (tmpGfxVulkan) { + temporaryGraphics = std::make_unique(); + if (!temporaryGraphics->usable) + temporaryGraphics.reset(); // D3D11 next + } +#endif + +#if defined(SUPPORT_DX) && defined(SUPPORT_DX11) + if (!temporaryGraphics && tmpGfxD3D11) { + temporaryGraphics = std::make_unique(); + if (!temporaryGraphics->usable) + temporaryGraphics.reset(); + } +#endif + return temporaryGraphics != nullptr; +} + const void* XrBackend::GetCurrentGraphicsBinding() { if (graphicsBinding) { diff --git a/DrvOpenXR/XrBackend.h b/DrvOpenXR/XrBackend.h index 88e4897b..f718b005 100644 --- a/DrvOpenXR/XrBackend.h +++ b/DrvOpenXR/XrBackend.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -66,6 +67,20 @@ class XrBackend : public IBackend { std::atomic sessionActive{ false }; std::atomic sessionLost{ false }; std::atomic exitExpected{ false }; + // The user quit from the runtime: no session is made again + std::atomic quitting{ false }; + // The session went through STOPPING since it last ran (an EXITING after it is the user quitting) + std::atomic sawStopping{ false }; + // The game has been told the devices are deactivated (a loss), and not yet that they're back + std::atomic devicesDeactivated{ false }; + // The instance was lost with the session (XR_ERROR_INSTANCE_LOST, or INSTANCE_LOSS_PENDING): made again first + std::atomic instanceLost{ false }; + // The instance loss: lost with the session (OnSessionLost) + void OnInstanceLost(); + // The last try to find the system again (RecoverLostSession), and whether the lost session is destroyed yet + std::atomic lastRecoveryTry{ 0 }; // 0 before the first + bool lostSessionDestroyed = false; + std::mutex recoveryLock; // What the game has been told of the session, as SteamVR tells it: whether it lost input focus (sessionEvents), and // the IPD (NaN until the session's first) std::atomic inputFocusLost{ false }; @@ -89,15 +104,76 @@ class XrBackend : public IBackend { // DrvOpenXR::KeepOverlaysInstance void KeepOverlaysInstance(); + /** Why the session is made again (RebuildSession) */ + enum class RebuildReason { + AppGraphics, // the game's first Submit: from the temporary device to the game's own + Inputs, // the game's actions, which can only be attached to a session that has none yet + Loss, // the runtime lost the session (or one couldn't be made): a new one once the system is back + }; + static const char* RebuildReasonName(RebuildReason reason); + + /** + * Makes the session again, under the session lock: never in the middle of a frame (a frame the game has open is + * ended first, as if it had submitted). What the game set on the old session is put back on the new one: its eye + * compositors are made again at its next Submit, the skybox is shown again from the game's texture, and the overlays' + * swapchains are made again from their textures. XR_SUCCESS, or what xrCreateSession answered. + */ + XrResult RebuildSession(RebuildReason reason); + /** - * The session is gone or going (LOSS_PENDING, an EXITING OpenComposite didn't ask for, or a session restart - * that failed): VREvent_Quit is queued once, and no more frames are begun. There's no reconnecting. + * The session is lost (LOSS_PENDING, XR_ERROR_SESSION_LOST, an EXITING the user didn't ask for, or a session that + * couldn't be made): no more frames; the headset and controllers are deactivated, their poses invalid, until + * RecoverLostSession makes a new session. The game isn't told to quit. */ void OnSessionLost(); /** Pumps events until done() is true, for at most timeoutMs: whether it was */ bool WaitForEvents(const std::function& done, int timeoutMs); - /** The runtime ends the session on its own: VREvent_DriverRequestedQuit, then OnSessionLost */ + /** + * The user quit from the runtime (EXITING after STOPPING): VREvent_DriverRequestedQuit and VREvent_Quit, once, and + * no session is made again + */ void OnRuntimeQuit(); + /** + * Whether the game's actions (its manifest's, or legacy input's) and the info set may be attached now: once the + * session is on the game's device (or will stay where it is: a helper program's, or a game whose device can't be + * used). Before that the session restart for its first Submit would follow, and one more for a manifest it loads by + * then. A game that hasn't submitted within kInputsWithoutSubmit of first being asked about gets them all the same. + */ + static bool InputsMayAttach(); + static constexpr std::chrono::seconds kInputsWithoutSubmit{ 2 }; + + /** Whether the current backend's session is gone (lost, or not made again yet): the devices have no poses */ + static bool CurrentSessionGone(); + /** Whether the current backend's session is lost and is to be made again (not the user quitting) */ + static bool CurrentSessionLost(); + /** Whether the user quit from the runtime (OnRuntimeQuit): the session isn't made again */ + bool IsQuitting() const { return quitting; } + + /** What an unasked session state change means for the game */ + enum class StateOutcome { + Ignored, + Lost, + Quit, + }; + /** + * For a state the session went to: LOSS_PENDING is a loss; EXITING is the user quitting if the session went + * through STOPPING since it last ran (sawStopping), a loss otherwise; neither while OpenLamina ends the session + * itself (exitExpected) + */ + static StateOutcome OutcomeOfState(XrSessionState state, bool sawStopping, bool exitExpected); + + /** The wait between tries to find the system again after a loss */ + static constexpr std::chrono::milliseconds kRecoveryInterval{ 1000 }; + /** Whether a try is due at now: the first at once, then one each kRecoveryInterval (lastTry is {} before the first) */ + static bool RecoveryDue(std::chrono::steady_clock::time_point lastTry, std::chrono::steady_clock::time_point now); + + /** + * After a loss, on a thread that holds no session lock and no frame: destroys the lost session (once), then about + * once a second asks for the system (xrGetSystem) and, once it's there, makes the session again (RebuildSession); + * the devices are activated again. Retried for as long as it takes; nothing after the user quit. passLock is the + * helper loop's pass lock, taken after the session lock. + */ + void RecoverLostSession(std::mutex* passLock = nullptr); bool IsSessionLost() const { return sessionLost; } /** The session is lost, not running, or stopping, exiting or about to be lost: nothing can be shown in it any more */ bool IsSessionEnded() const @@ -141,6 +217,17 @@ class XrBackend : public IBackend { /** A compositor for such a copy */ std::shared_ptr MakeOverlayCompositor(ID3D11Texture2D* copy); + /** + * Where the overlay session's device is Vulkan (Linux): an overlay application's Vulkan or OpenGL texture copied + * into an image of that device that shares its memory with the program's device or context (OverlayTextureShare), + * as a Vulkan texture of the session's device; flipY if its rows run bottom-up. nullptr, with why, if it can't be: + * the texture is read back instead. ReleaseSharedOverlayTexture once the session's copy from it is submitted. + */ + const vr::VRVulkanTextureData_t* ShareOverlayTexture(const vr::Texture_t* texture, const void* owner, bool* flipY, std::string* why); + void ReleaseSharedOverlayTexture(const void* owner); + /** A compositor for a texture of the session's own device (ShareOverlayTexture's) */ + std::shared_ptr MakeSessionOverlayCompositor(const vr::Texture_t* texture); + /** * Whether the thread running OpenLamina's frames fills the swapchains drawn from memory (and the pointer's): in an * overlay application, whose session is on OpenLamina's own device. In a game, the game's thread does, as it uses the @@ -175,8 +262,10 @@ class XrBackend : public IBackend { */ void StopOwnFrames(bool forGood = false); - /** Whether OpenLamina runs frames of its own on this session (RunOwnFramesWhile can show something) */ - bool HasOwnFrames() const { return ownFrames != nullptr; } + /** Whether own frames can run on the calling thread now: there are some, and on a session whose frames run only + * inside the game's calls, this is its render thread (OpenGL: the session's context is current here; Vulkan: the + * thread that last waited for a frame, so none before the game's first) */ + bool OwnFramesHere() const; /** * Runs OpenLamina's own frames on the calling thread while keepGoing() holds (OwnFrameLoop::RunWhile): a blocking @@ -195,8 +284,22 @@ class XrBackend : public IBackend { static void VkGetPhysicalDevice(VkInstance instance, VkPhysicalDevice* out); #endif + /** The tracker action is attached: the trackers by role again */ + void OnTrackerActionAttached() { CreateGenericTrackers(); } + /** A new session is being set up: the trackers' spaces are made again in it */ + void ForgetTrackerSpaces(); + private: std::shared_ptr hmd = std::make_shared(); + // The stage's bounds rectangle, asked of the runtime once per session and again after the stage changes + // (XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING); under playAreaLock + std::mutex playAreaLock; + XrSession playAreaSession = XR_NULL_HANDLE; + bool playAreaKnown = false; + XrExtent2Df playAreaRect{}; + // Until the stage's change takes effect (its event's changeTime), the bounds are asked each time, not kept + XrTime playAreaChangeTime = 0; + void ForgetPlayArea(XrTime changeTime = 0); // Replaced when a hand's interaction profile changes, while other threads read input: copied and replaced only // under hands_mutex (Hand), which is held for nothing else std::shared_ptr hand_left; @@ -212,13 +315,26 @@ class XrBackend : public IBackend { std::shared_mutex generic_trackers_mutex; // The session the trackers' spaces belong to, and the xdev list generation they were made from XrSession generic_trackers_session = XR_NULL_HANDLE; + uint64_t generic_trackers_action_generation = 0; // of the tracker action the role trackers' spaces were made from std::atomic generic_trackers_generation{ UINT64_MAX }; std::atomic generic_trackers_polled_ms{ 0 }; // Makes the trackers again when the runtime's list of devices has changed (looked at about once a second) void PollGenericTrackers(); // False if the texture can't be used (logged): no session switch then, or the switch was undone - bool CheckOrInitCompositors(const vr::Texture_t* tex); + // moveToNewDevice: the session is made again on the texture's device (FollowEyeTextureDevice), once the checks + // that can be made before the old session goes down have passed + bool CheckOrInitCompositors(const vr::Texture_t* tex, bool moveToNewDevice = false); + // The texture is of the session's API (D3D11 or D3D12) but on another device than the session's + bool TextureOnOtherDevice(const vr::Texture_t* tex); + // Whether an eye texture's device is followed if the game moved to another one (another GPU, or a device made again + // after a device loss): move set if it is to be; false if it's on another device and can't be, and the eye is left out + bool FollowEyeTextureDevice(const vr::Texture_t* tex, bool& move); + // The session is being made again on the device a game moved to: if that fails, the game isn't told to quit + std::atomic rebuildingForNewDevice{ false }; + std::atomic deviceRebuilds{ 0 }; + // Makes the temporary graphics device the backend was made with, if there's none: false if it can't be made + static bool MakeTemporaryGraphics(); std::unique_ptr compositors[XruEyeCount]; // The D3D11 mirror texture of each eye (an ID3D11Texture2D of OpenLamina's own on the game's device), which the // game's frames are copied into once it has asked for one (mirrorWanted); under mirrorLock @@ -237,7 +353,8 @@ class XrBackend : public IBackend { // next skybox, or let go of with the session. Under skyboxLock. struct Skybox { std::unique_ptr textures[2]; // lat-long textures, one per eye for a stereo pair - std::unique_ptr faces; // six faces, as one lat-long image + std::unique_ptr faces; // six faces, as one lat-long image joined on the CPU + std::unique_ptr cube; // six faces, as one lat-long image drawn on the GPU (InvokeCubemap) XrCompositionLayerEquirect2KHR layers[2]{}; int layerCount = 0; }; @@ -248,6 +365,17 @@ class XrBackend : public IBackend { XrCompositionLayerProjection lastProjection{ XR_TYPE_COMPOSITION_LAYER_PROJECTION }; XrCompositionLayerProjectionView lastProjectionViews[2]{}; std::atomic haveLastProjection{ false }; + // SubmitFrames shows the game's last frame again if this frame has none of its own (a frame the game didn't submit + // to, ended for it) + std::atomic repeatLastFrame{ false }; + // An OpenGL session's context, which its own frames (run only inside the game's calls) need current; else null + std::atomic ownFramesGlContext{ nullptr }; + // The game's OpenGL context on Linux, current when its session's binding was made + const void* gameGlContext = nullptr; + // A Vulkan session's own frames run inside the game's calls on the thread it renders on (the last to wait for a + // frame), where OpenVR may use its queue + std::atomic ownFramesInCalls{ false }; + std::atomic gameFrameThread{}; bool SkyboxShown(); // The layers of the frame being ended, under frameOwner std::vector frameLayers; @@ -269,6 +397,8 @@ class XrBackend : public IBackend { // A skybox asked for while the session wasn't running, shown at the next frame's start; under pendingSkyboxLock std::mutex pendingSkyboxLock; SkyboxRequest pendingSkybox; + // The skybox shown until ClearSkyboxOverride, shown again on a new session (RebuildSession); under pendingSkyboxLock + SkyboxRequest shownSkybox; bool EquirectSkyboxAvailable() const; // The session lock held (shared) and the session running IBackend::openvr_enum_t ShowSkybox(const vr::Texture_t* textures, uint32_t count); @@ -288,10 +418,29 @@ class XrBackend : public IBackend { void UpdateInteractionProfile(); /** - * Queries xdevs from MNDX_xdev_space, if the runtime supports it. Ignores HMD & Controllers. + * The Vive trackers by role (XR_HTCX_vive_tracker_interaction, their poses from the tracker action) and the xdevs + * (XR_MNDX_xdev_space) the runtime doesn't also list with a role. Ignores HMD & Controllers. * These "Generic Trackers" act like an HTC vive tracker, but support no bindings. */ void CreateGenericTrackers(); + /** The hand's profile as a controller (XR_EXT_hand_interaction's) if hand tracking tracks it (0 left, 1 right), + * null if not */ + const InteractionProfile* HandWithoutController(int hand); + /** Once a second: whether a hand without a controller came or went */ + bool HandsWithoutControllersChanged(); + std::atomic handsCheckedMs{ 0 }; + // The checks in a row each hand without a controller wasn't tracked in, and how many it may miss + std::atomic handMisses[2] = { 0, 0 }; + // Whether each hand's controller is the hand itself, shown because hand tracking tracks it + std::atomic handFromTracking[2] = { false, false }; + // The Vive trackers the runtime listed, to notice one going (no event says so) + std::atomic viveTrackersListed{ 0 }; + static constexpr int kHandMissesAllowed = 3; + /** The xdevs that are trackers, in a list it makes (null if it can't), each passed to add; those whose lower-case + * serial ends one of byRole (the lower-case persistent paths of the Vive trackers listed by role) are left out; + * false if they can't be listed */ + bool FindXDevTrackers(XrXDevListMNDX& list, const std::vector& byRole, + const std::function& add); /** * Attempts to force the runtime to expose an interaction profile @@ -306,11 +455,17 @@ class XrBackend : public IBackend { // Whether we've restarted the session to use the application's rendering API yet std::atomic usingApplicationGraphicsAPI{ false }; + // When InputsMayAttach was first asked before a Submit (steady_clock ticks; 0 before) + std::atomic inputsFirstAsked{ 0 }; // An overlay application's textures, copied onto its session's device std::unique_ptr overlayCopy; +#if defined(SUPPORT_VK) && !defined(_WIN32) + std::unique_ptr overlayShare; +#endif // A helper program's frame loop (overlay sessions) or event loop (headless ones), made with each session void StartHelperLoop(); + void StartBackgroundFrames(); // Held through each of its passes std::mutex helperPassLock; @@ -353,7 +508,7 @@ class XrBackend : public IBackend { // waiting for the session lock or for the own frames' thread. std::mutex frameOwner; // A frame was begun (by the game, or SetSkyboxOverride) and not yet ended; under frameOwner - bool frameBegun = false; + std::atomic frameBegun{ false }; // OpenLamina's frames while the game runs none; created with each session, stopped before it ends std::unique_ptr ownFrames; bool ownFramesStopped = false; // for good: OpenLamina is shutting down @@ -457,4 +612,6 @@ class XrBackend : public IBackend { // OpenGL or Vulkan frames copied through D3D11, whose device graphicsBinding has (GfxInterop.h) std::unique_ptr gfxInterop; static std::unique_ptr temporaryGraphics; + // Which temporary graphics APIs the backend may use + inline static bool tmpGfxVulkan = false, tmpGfxD3D11 = false; }; diff --git a/DrvOpenXR/XrController.cpp b/DrvOpenXR/XrController.cpp index 87daa0cb..74847523 100644 --- a/DrvOpenXR/XrController.cpp +++ b/DrvOpenXR/XrController.cpp @@ -1,4 +1,5 @@ #include "XrController.h" +#include "XrBackend.h" #include "../OpenOVR/Misc/LibMonado.h" @@ -146,6 +147,13 @@ void XrController::GetPose(vr::ETrackingUniverseOrigin origin, vr::TrackedDevice pose->bPoseIsValid = false; pose->eTrackingResult = vr::TrackingResult_Running_OutOfRange; + // No session (it was lost): deactivated until it's made again + if (XrBackend::CurrentSessionGone()) { + pose->bDeviceIsConnected = false; + pose->eTrackingResult = vr::TrackingResult_Uninitialized; + return; + } + BaseInput* input = GetUnsafeBaseInput(); if (input == nullptr) return; diff --git a/DrvOpenXR/XrDriverPrivate.h b/DrvOpenXR/XrDriverPrivate.h index 0a1e6b0c..0db84b32 100644 --- a/DrvOpenXR/XrDriverPrivate.h +++ b/DrvOpenXR/XrDriverPrivate.h @@ -18,5 +18,10 @@ namespace DrvOpenXR { // XR_SUCCESS, or what xrCreateSession answered (no session then: the caller decides what next) XrResult SetupSession(); void ShutdownSession(); +// xrGetSystem for the headset again (after a loss): XR_SUCCESS once it is there +XrResult FindSystem(); +// After the instance was lost (its session already ended): the old instance destroyed, a new one made on the same +// extensions, with its function pointers, system and views. XR_SUCCESS once there's a headset on it. +XrResult RemakeInstance(); void FullShutdown(); } // namespace DrvOpenXR diff --git a/DrvOpenXR/XrGenericTracker.cpp b/DrvOpenXR/XrGenericTracker.cpp index 79ce8c3e..36fde031 100644 --- a/DrvOpenXR/XrGenericTracker.cpp +++ b/DrvOpenXR/XrGenericTracker.cpp @@ -5,8 +5,9 @@ #include "../OpenOVR/Reimpl/BaseInput.h" #include "../OpenOVR/convert.h" -XrGenericTracker::XrGenericTracker(const InteractionProfile& profile, XrXDevPropertiesMNDX properties, uint32_t index, XrSpace space) - : profile(profile), xdevProperties(properties), genericTrackerIndex(index), genericTrackerSpace(space) +XrGenericTracker::XrGenericTracker(const InteractionProfile& profile, XrXDevPropertiesMNDX properties, uint32_t index, XrSpace space, + std::string controllerType) + : profile(profile), xdevProperties(properties), genericTrackerIndex(index), genericTrackerSpace(space), controllerType(std::move(controllerType)) { InitialiseDevice(index + RESERVED_DEVICE_INDICES); } @@ -92,6 +93,8 @@ DeviceIdentity XrGenericTracker::Identity() DeviceIdentity id = TrackerIdentity(xdevProperties.name, xdevProperties.serial); if (std::optional name = GetInteractionProfile()->GetOpenVRName()) id.renderModel = *name; + if (!controllerType.empty()) + id.controllerType = controllerType; return id; } diff --git a/DrvOpenXR/XrGenericTracker.h b/DrvOpenXR/XrGenericTracker.h index e80db579..8caecb47 100644 --- a/DrvOpenXR/XrGenericTracker.h +++ b/DrvOpenXR/XrGenericTracker.h @@ -11,7 +11,9 @@ constexpr int MAX_GENERIC_TRACKERS = vr::k_unMaxTrackedDeviceCount - RESERVED_DE class XrGenericTracker : public virtual XrTrackedDevice { public: - explicit XrGenericTracker(const InteractionProfile& profile, XrXDevPropertiesMNDX properties, uint32_t index, XrSpace space); + /** controllerType: a Vive tracker's by its role (vive_tracker_waist); empty for the generic tracker's */ + explicit XrGenericTracker(const InteractionProfile& profile, XrXDevPropertiesMNDX properties, uint32_t index, XrSpace space, + std::string controllerType = {}); ~XrGenericTracker(); void GetPose( @@ -34,10 +36,12 @@ class XrGenericTracker : public virtual XrTrackedDevice { // For a space that went with its session: nothing is left to destroy void ForgetSpace() { genericTrackerSpace = XR_NULL_HANDLE; } std::string Serial() const { return xdevProperties.serial; } + const std::string& ControllerType() const { return controllerType; } private: const InteractionProfile& profile; XrXDevPropertiesMNDX xdevProperties; [[maybe_unused]] uint32_t genericTrackerIndex; XrSpace genericTrackerSpace; + std::string controllerType; }; diff --git a/DrvOpenXR/XrHMD.cpp b/DrvOpenXR/XrHMD.cpp index 529dedcc..2f1b49a7 100644 --- a/DrvOpenXR/XrHMD.cpp +++ b/DrvOpenXR/XrHMD.cpp @@ -391,7 +391,7 @@ void XrHMD::GetPose(vr::ETrackingUniverseOrigin origin, vr::TrackedDevicePose_t* { // Held to the end: a session restart on another thread replaces xr_gbl and its spaces, and waits for this to end auto lock = xr_session.lock_shared(); - if (!xr_gbl) { + if (XrBackend::CurrentSessionGone()) { // No session (it was lost, or a restart failed): no pose if (pose) { *pose = {}; @@ -427,7 +427,11 @@ static const float kDefaultIpd = 0.064f; float XrHMD::GetIPD() { - if (!xr_gbl) + const bool haveSession = [] { + auto lock = xr_session.lock_shared(); // held while reading: a session restart waits for it + return xr_gbl != nullptr; + }(); + if (!haveSession) return kDefaultIpd + IpdOffset(); static float ipd = kDefaultIpd; @@ -669,15 +673,22 @@ DeviceIdentity XrHMD::Identity() // The OpenXR system's name picks the row; read once per instance (it doesn't change while the instance lives) static std::mutex nameMutex; static XrInstance nameInstance = XR_NULL_HANDLE; - static std::string systemName; + static std::string systemName, runtimeName; + static uint32_t vendorId = 0; { std::lock_guard guard(nameMutex); if (xr_instance == XR_NULL_HANDLE) { systemName.clear(); + runtimeName.clear(); + vendorId = 0; nameInstance = XR_NULL_HANDLE; } else if (xr_instance != nameInstance || systemName.empty()) { XrSystemProperties properties = { XR_TYPE_SYSTEM_PROPERTIES }; - systemName = XR_SUCCEEDED(xrGetSystemProperties(xr_instance, xr_system, &properties)) ? properties.systemName : ""; + const bool got = XR_SUCCEEDED(xrGetSystemProperties(xr_instance, xr_system, &properties)); + systemName = got ? properties.systemName : ""; + vendorId = got ? properties.vendorId : 0; + XrInstanceProperties instance = { XR_TYPE_INSTANCE_PROPERTIES }; + runtimeName = XR_SUCCEEDED(xrGetInstanceProperties(xr_instance, &instance)) ? instance.runtimeName : ""; nameInstance = xr_instance; } } @@ -686,12 +697,15 @@ DeviceIdentity XrHMD::Identity() device.name = head->name; device.serial = head->serial; } - std::string name; + std::string name, runtime; + uint32_t vendor = 0; { std::lock_guard guard(nameMutex); name = systemName; + runtime = runtimeName; + vendor = vendorId; } - return HmdIdentity(name, device); + return HmdIdentity(name, device, vendor, runtime); } int32_t XrHMD::GetInt32TrackedDeviceProperty(vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError* pErrorL) diff --git a/DrvOpenXR/tmp_gfx/TemporaryVk.cpp b/DrvOpenXR/tmp_gfx/TemporaryVk.cpp index a91b15cf..bef975b4 100644 --- a/DrvOpenXR/tmp_gfx/TemporaryVk.cpp +++ b/DrvOpenXR/tmp_gfx/TemporaryVk.cpp @@ -60,12 +60,15 @@ TemporaryVk::TemporaryVk() // Create a Vulkan instance that the runtime will find suitable VkApplicationInfo appInfo{ VK_STRUCTURE_TYPE_APPLICATION_INFO }; - appInfo.apiVersion = (std::max)((uint32_t)VK_API_VERSION_1_0, VK_MAKE_VERSION((uint32_t)XR_VERSION_MAJOR(req.minApiVersionSupported), (uint32_t)XR_VERSION_MINOR(req.minApiVersionSupported), 0)); + appInfo.apiVersion = TemporaryVkApiVersion(loaderVersion, req.minApiVersionSupported, req.maxApiVersionSupported); VkInstanceCreateInfo createInfo{ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO }; createInfo.pApplicationInfo = &appInfo; + // XR_KHR_vulkan_enable2 alone has no extension lists: the runtime makes the instance and device, adding its own + const bool throughRuntime = xr_ext->VulkanEnable2Only(); uint32_t extCap = 0; - TMPVK_XR(xr_ext->xrGetVulkanInstanceExtensionsKHR(xr_instance, xr_system, 0, &extCap, nullptr)); + if (!throughRuntime) + TMPVK_XR(xr_ext->xrGetVulkanInstanceExtensionsKHR(xr_instance, xr_system, 0, &extCap, nullptr)); std::vector instanceExtensionsStore; std::vector instanceExtensionsCstr; @@ -83,7 +86,19 @@ TemporaryVk::TemporaryVk() // Don't use any layers here } - if (VkResult vr_ = vkCreateInstance(&createInfo, nullptr, &instance); vr_ != VK_SUCCESS) { + if (throughRuntime) { + XrVulkanInstanceCreateInfoKHR xrInfo{ XR_TYPE_VULKAN_INSTANCE_CREATE_INFO_KHR }; + xrInfo.systemId = xr_system; + xrInfo.pfnGetInstanceProcAddr = &vkGetInstanceProcAddr; + xrInfo.vulkanCreateInfo = &createInfo; + VkResult vr_ = VK_SUCCESS; + XrResult xr_ = xr_ext->xrCreateVulkanInstanceKHR(xr_instance, &xrInfo, &instance, &vr_); + if (XR_FAILED(xr_) || vr_ != VK_SUCCESS) { + OOVR_LOGF("Temporary Vulkan device: xrCreateVulkanInstanceKHR failed: %d (Vulkan %d)", (int)xr_, (int)vr_); + instance = VK_NULL_HANDLE; + return; + } + } else if (VkResult vr_ = vkCreateInstance(&createInfo, nullptr, &instance); vr_ != VK_SUCCESS) { OOVR_LOGF("Temporary Vulkan device: vkCreateInstance failed: %d", (int)vr_); instance = VK_NULL_HANDLE; return; @@ -117,7 +132,9 @@ TemporaryVk::TemporaryVk() std::vector deviceExtensionsStore; std::vector deviceExtensionsCstr; - TMPVK_XR(xr_ext->xrGetVulkanDeviceExtensionsKHR(xr_instance, xr_system, 0, &extCap, nullptr)); + extCap = 0; + if (!throughRuntime) + TMPVK_XR(xr_ext->xrGetVulkanDeviceExtensionsKHR(xr_instance, xr_system, 0, &extCap, nullptr)); if (extCap > 1) { std::string deviceExtensionsStr; deviceExtensionsStr.resize(extCap, 0); @@ -134,22 +151,24 @@ TemporaryVk::TemporaryVk() auto addIfAvailable = [&](const char* name) { for (const char* enabled : deviceExtensionsCstr) { if (strcmp(enabled, name) == 0) - return; // the runtime asked for it already + return true; // the runtime asked for it already } for (const VkExtensionProperties& ext : available) { if (strcmp(ext.extensionName, name) == 0) { deviceExtensionsCstr.push_back(name); - return; + return true; } } OOVR_LOGF("Device extension %s isn't available; continuing without it", name); + return false; }; addIfAvailable(VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME); #ifdef _WIN32 // Don't import vulkan_win32 just for this constant, so hardcode the string addIfAvailable(VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME); #else - addIfAvailable(VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME); + // An overlay application's textures are shared with this device by file descriptor (OverlayTextureShare) + externalMemoryFd = addIfAvailable(VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) && appInfo.apiVersion >= VK_API_VERSION_1_1; #endif devCreateInfo.enabledExtensionCount = deviceExtensionsCstr.size(); @@ -158,7 +177,20 @@ TemporaryVk::TemporaryVk() devCreateInfo.queueCreateInfoCount = 1; devCreateInfo.pQueueCreateInfos = &queueInfo; - if (VkResult vr_ = vkCreateDevice(physicalDevice, &devCreateInfo, nullptr, &device); vr_ != VK_SUCCESS) { + if (throughRuntime) { + XrVulkanDeviceCreateInfoKHR xrInfo{ XR_TYPE_VULKAN_DEVICE_CREATE_INFO_KHR }; + xrInfo.systemId = xr_system; + xrInfo.pfnGetInstanceProcAddr = &vkGetInstanceProcAddr; + xrInfo.vulkanPhysicalDevice = physicalDevice; + xrInfo.vulkanCreateInfo = &devCreateInfo; + VkResult vr_ = VK_SUCCESS; + XrResult xr_ = xr_ext->xrCreateVulkanDeviceKHR(xr_instance, &xrInfo, &device, &vr_); + if (XR_FAILED(xr_) || vr_ != VK_SUCCESS) { + OOVR_LOGF("Temporary Vulkan device: xrCreateVulkanDeviceKHR failed: %d (Vulkan %d)", (int)xr_, (int)vr_); + device = VK_NULL_HANDLE; + return; + } + } else if (VkResult vr_ = vkCreateDevice(physicalDevice, &devCreateInfo, nullptr, &device); vr_ != VK_SUCCESS) { OOVR_LOGF("Temporary Vulkan device: vkCreateDevice failed: %d", (int)vr_); device = VK_NULL_HANDLE; return; diff --git a/DrvOpenXR/tmp_gfx/TemporaryVk.h b/DrvOpenXR/tmp_gfx/TemporaryVk.h index acbb19f7..ebff2506 100644 --- a/DrvOpenXR/tmp_gfx/TemporaryVk.h +++ b/DrvOpenXR/tmp_gfx/TemporaryVk.h @@ -25,6 +25,18 @@ inline bool VulkanVersionMeetsXr(uint32_t vulkanVersion, XrVersion minimum) return VK_VERSION_MAJOR(vulkanVersion) > major || (VK_VERSION_MAJOR(vulkanVersion) == major && VK_VERSION_MINOR(vulkanVersion) >= minor); } +// The instance's API version: the runtime's lowest, raised to 1.1 where the loader and the runtime both have it (its +// device UUID and image sharing, core in 1.1, are then there for sharing overlay applications' textures) +inline uint32_t TemporaryVkApiVersion(uint32_t loaderVersion, XrVersion minimum, XrVersion maximum) +{ + const uint32_t lowest = VK_MAKE_VERSION((uint32_t)XR_VERSION_MAJOR(minimum), (uint32_t)XR_VERSION_MINOR(minimum), 0); + uint32_t version = lowest > VK_API_VERSION_1_0 ? lowest : VK_API_VERSION_1_0; + const bool runtimeHas11 = XR_VERSION_MAJOR(maximum) > 1 || (XR_VERSION_MAJOR(maximum) == 1 && XR_VERSION_MINOR(maximum) >= 1); + if (version < VK_API_VERSION_1_1 && loaderVersion >= VK_API_VERSION_1_1 && runtimeHas11) + version = VK_API_VERSION_1_1; + return version; +} + class TemporaryVk : public TemporaryGraphics { public: TemporaryVk(); @@ -42,4 +54,6 @@ class TemporaryVk : public TemporaryGraphics { VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; VkDevice device = VK_NULL_HANDLE; VkQueue queue = VK_NULL_HANDLE; + // VK_KHR_external_memory_fd is enabled on the device, and the instance is Vulkan 1.1 (its device UUID, image formats) + bool externalMemoryFd = false; }; diff --git a/OCOVR/linux.cpp b/OCOVR/linux.cpp index d9a6c903..2348fdd7 100644 --- a/OCOVR/linux.cpp +++ b/OCOVR/linux.cpp @@ -9,6 +9,7 @@ alternativeCoreFactory_t PlatformGetAlternativeCoreFactory() { // The per-app runtime choice is Windows-only (BaseClientCore::CheckAppEnabled), so this isn't reached - OOVR_LOG("Choosing SteamVR per app isn't supported on Linux; using OpenLamina"); + OOVR_LOG("No per-app runtime list on Linux; using OpenLamina. To start one game on SteamVR, set its launch options to " + "VR_OVERRIDE= %command%, where is SteamVR's folder"); return nullptr; } diff --git a/OCOVR/openvr_api.cpp b/OCOVR/openvr_api.cpp index 6251e793..249a1f87 100644 --- a/OCOVR/openvr_api.cpp +++ b/OCOVR/openvr_api.cpp @@ -16,6 +16,7 @@ #include "Misc/backtrace.h" #include "logging.h" #include "steamvr_abi.h" +#include #include #include #include @@ -277,9 +278,34 @@ VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal(EVRInitError* peError, EVRAppl return VR_InitInternal2(peError, eApplicationType, NULL); } +void oc_abandon_at_exit() +{ + // Not under state_mutex: a thread the process's end stopped may hold it + if (!running) + return; + (void)new std::map(std::move(interfaces)); + BackendManager::Abandon(); +} + +#ifndef _WIN32 +// A game exiting without VR_Shutdown: runs before the static destructors of the bundled OpenXR loader and of the +// runtime, which the session's teardown still calls into. Registered per session, as the runtime's statics are made +// anew each time it is loaded. +static void ShutdownAtExit() +{ + std::lock_guard lock(state_mutex); + if (!running) + return; + OOVR_LOG("The program is exiting without VR_Shutdown: shutting OpenLamina down"); + scene_init_count = 1; + refused_init_count = 0; + VR_ShutdownInternal(); +} +#endif + VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2(EVRInitError* peError, EVRApplicationType eApplicationType, const char* pStartupInfo) { - OOVR_LOG_ONCEF("Initializing OpenLamina, a fork of OpenComposite (github.com/feimos-dev/OpenLamina) - revision %s", OC_VERSION); + OOVR_LOG_ONCEF("Initializing OpenLamina, a fork of OpenComposite (github.com/feimos-dev/OpenLamina) - revision %s, answering as OpenVR runtime %s", OC_VERSION, OPENVR_RUNTIME_VERSION); if (peError) { *peError = VRInitError_None; } @@ -367,6 +393,9 @@ VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2(EVRInitError* peError, EVRApp return RefuseInit(peError, backendError != VRInitError_None ? backendError : VRInitError_Init_Internal); } BackendManager::Create(backend); +#ifndef _WIN32 + atexit(ShutdownAtExit); +#endif DrvOpenXR::KeepOverlaysInstance(); // An earlier Utility Init not yet shut down is matched by a Shutdown too scene_init_count = utility_init ? 2 : 1; @@ -512,6 +541,9 @@ VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal() // Shut down OpenXR BackendManager::Reset(); + // The frames' last store edits are written before the program can end + SharedStore::Get().Flush(); + // The origin outlives the interfaces (SetTrackingSpace may come without IVRSystem): the next Init starts on the default BaseSystem::currentSpace = XR_REFERENCE_SPACE_TYPE_STAGE; diff --git a/OCOVR/plat.h b/OCOVR/plat.h index b480f273..47300743 100644 --- a/OCOVR/plat.h +++ b/OCOVR/plat.h @@ -8,3 +8,6 @@ typedef void* (*alternativeCoreFactory_t)(const char*, int*); alternativeCoreFactory_t PlatformGetAlternativeCoreFactory(); + +// The process is ending with the session still up: the interfaces and the backend are left to it, undestroyed +void oc_abandon_at_exit(); diff --git a/OCOVR/windows.cpp b/OCOVR/windows.cpp index 3ee70e90..460fdd2f 100644 --- a/OCOVR/windows.cpp +++ b/OCOVR/windows.cpp @@ -62,10 +62,13 @@ BOOL APIENTRY DllMain(HMODULE hModule, case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: - // At process exit (lpReserved set) nothing needs freeing, and the loader lock is held anyway - if (chainedImplementation && !lpReserved) { + // At process exit (lpReserved set) nothing needs freeing, and the loader lock is held anyway. A session still + // up isn't shut down: the OpenXR runtime's DLL may be detached already, and the static destructors that + // follow would call into it. + if (lpReserved) + oc_abandon_at_exit(); + else if (chainedImplementation) FreeLibrary(chainedImplementation); - } break; } return TRUE; diff --git a/OpenOVR/Compositor/FormatTable.cpp b/OpenOVR/Compositor/FormatTable.cpp index fe695c20..ced8b0f1 100644 --- a/OpenOVR/Compositor/FormatTable.cpp +++ b/OpenOVR/Compositor/FormatTable.cpp @@ -188,6 +188,29 @@ bool NeverColour(GfxApiKind api, int64_t format) } // namespace +std::optional SameTexelsIn(GfxApiKind from, int64_t format, GfxApiKind to) +{ + const FormatInfo* info = Find(from, format); + if (!info || info->integer || info->depth == DepthClass::Compressed) + return std::nullopt; + const FormatInfo* member = Member(to, info->family, info->kind == K::Srgb ? K::Srgb : K::Linear); + if (!member) + return std::nullopt; + return member->format; +} + +std::optional ConvertibleColourIn(GfxApiKind from, int64_t format, GfxApiKind to) +{ + const FormatInfo* info = Find(from, format); + if (!info || info->integer || info->depth == DepthClass::Compressed) + return std::nullopt; + const bool narrow = info->depth == DepthClass::Bits8 || info->depth == DepthClass::Low; + const FormatInfo* member = Member(to, narrow ? Family::RGBA8 : Family::RGBA16F, narrow && info->kind == K::Srgb ? K::Srgb : K::Linear); + if (!member) + return std::nullopt; + return member->format; +} + bool WantsSrgb(GfxApiKind api, int64_t format, vr::EColorSpace colourSpace) { switch (colourSpace) { diff --git a/OpenOVR/Compositor/FormatTable.h b/OpenOVR/Compositor/FormatTable.h index c9f4d2c0..4a63907f 100644 --- a/OpenOVR/Compositor/FormatTable.h +++ b/OpenOVR/Compositor/FormatTable.h @@ -30,6 +30,15 @@ std::optional ChooseSwapchainFormat(GfxApiKind api, int64_t gameFo // (DXGI's typeless and typed members alike), if it offers it std::optional ChooseDepthSwapchainFormat(GfxApiKind api, int64_t gameFormat, const std::vector& runtimeFormats); +// For a copy between APIs (an OpenGL or Vulkan texture copied through D3D11): the format of another API that holds the +// same texels (the family's member of the same sRGB-ness; a typeless one as its linear member), or std::nullopt if that +// API's table has none, or the format is block-compressed or integer +std::optional SameTexelsIn(GfxApiKind from, int64_t format, GfxApiKind to); +// Where there's no such format, one a converting copy (an OpenGL blit) can write the values into without losing range: +// 8-bit RGBA of the same sRGB-ness for formats of 8 bits a channel or fewer, else 16-bit float RGBA; std::nullopt for +// formats no table knows, and block-compressed or integer ones +std::optional ConvertibleColourIn(GfxApiKind from, int64_t format, GfxApiKind to); + // Whether the format is an sRGB one, and its family member of the given sRGB-ness (the format itself if the family has // none such); for views of a texture whose data a swapchain format reinterprets bool FormatIsSrgb(GfxApiKind api, int64_t format); diff --git a/OpenOVR/Compositor/compositor.cpp b/OpenOVR/Compositor/compositor.cpp index 9e26aa56..dd787b44 100644 --- a/OpenOVR/Compositor/compositor.cpp +++ b/OpenOVR/Compositor/compositor.cpp @@ -132,7 +132,7 @@ bool Compositor::AcquireAndWait(uint32_t imageCount, uint32_t& index, int64_t ti static thread_local std::optional currentSubmitSlice; -SubmitArraySlice::SubmitArraySlice(uint32_t slice) +SubmitArraySlice::SubmitArraySlice(std::optional slice) : previous(currentSubmitSlice) { currentSubmitSlice = slice; diff --git a/OpenOVR/Compositor/compositor.h b/OpenOVR/Compositor/compositor.h index e7145768..695fcbb3 100644 --- a/OpenOVR/Compositor/compositor.h +++ b/OpenOVR/Compositor/compositor.h @@ -46,10 +46,11 @@ inline vr::VRTextureBounds_t Bounds(const vr::VRTextureBounds_t* bounds) // Mirrors an image left to right and/or top to bottom void FlipImage(Image& image, bool flipX, bool flipY); -// SubmitWithArrayIndex's slice, for the Invoke calls made on this thread while it's in scope +// SubmitWithArrayIndex's slice, for the Invoke calls made on this thread while it's in scope (none: a texture of one +// slice, such as the interop's copy of the slice) class SubmitArraySlice { public: - explicit SubmitArraySlice(uint32_t slice); + explicit SubmitArraySlice(std::optional slice); ~SubmitArraySlice(); static std::optional Current(); @@ -70,6 +71,14 @@ class Compositor { * bounds flipped), as RGBA8. False, logged once, where that isn't possible (an API or format without a readback). */ virtual bool ReadbackToCpu(const vr::Texture_t* tex, const vr::VRTextureBounds_t* bounds, Image& out); + /** + * Draws six cube faces of this compositor's API (front, back, left, right, top, bottom, as SetSkyboxOverride takes + * them) into one lat-long image of a swapchain of its own, on the GPU, as CubeFacesToEquirect does on the CPU: up to + * maxWidth wide, four faces across, half as high. True with subImage set to it; false where this compositor has no + * such pass or the faces can't go through it (the caller then joins them on the CPU). A compositor used for this + * is used for nothing else. + */ + virtual bool InvokeCubemap(const vr::Texture_t* faces, uint32_t maxWidth, XrSwapchainSubImage& subImage) { return false; } /** * For a compositor that carries depth: copies a depth texture of its API into an image of a depth swapchain of the diff --git a/OpenOVR/Compositor/dx11compositor.cpp b/OpenOVR/Compositor/dx11compositor.cpp index 4531a2d4..3ce4f8f9 100644 --- a/OpenOVR/Compositor/dx11compositor.cpp +++ b/OpenOVR/Compositor/dx11compositor.cpp @@ -66,6 +66,56 @@ float4 ps_fs(psIn inputPS) : SV_TARGET return c; })_"; +// InvokeCubemap's pass (vs_fs above draws the quad, with offset 0 and scale 1): each texel of the lat-long image +// samples the cube face its direction points at, as CubeFacesToEquirect (Misc/Equirect.cpp) picks them, filtered +// linearly where the CPU join takes the nearest texel. t0 holds the +// faces as slices 0 to 5: front, back, left, right, top, bottom. +static const char cube_shader_code[] = R"_( +Texture2DArray faces : register(t0); + +SamplerState SampleType : register(s0); + +cbuffer ConstData : register(b0) { + float2 offset; + float2 scale; + float decodeSrgb; + float encodeSrgb; + float2 pad; +}; + +struct psIn { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; +}; + +float4 ps_cube(psIn inputPS) : SV_TARGET +{ + // The direction (OpenXR axes: -Z forward, +Y up, +X right): longitude -pi to pi across, latitude pi/2 to -pi/2 down + const float pi = 3.14159265f; + float lon = inputPS.tex.x * 2.0f * pi - pi; + float lat = pi / 2.0f - inputPS.tex.y * pi; + float3 d = float3(cos(lat) * sin(lon), sin(lat), -cos(lat) * cos(lon)); + float3 a = abs(d); + float face; + float2 uv; + if (a.z >= a.x && a.z >= a.y) { + uv = float2((d.z < 0.0f ? d.x : -d.x) / a.z, -d.y / a.z); + face = d.z < 0.0f ? 0.0f : 1.0f; + } else if (a.x >= a.y) { + uv = float2((d.x > 0.0f ? d.z : -d.z) / a.x, -d.y / a.x); + face = d.x > 0.0f ? 3.0f : 2.0f; + } else { + uv = float2(d.x / a.y, (d.y > 0.0f ? -d.z : d.z) / a.y); + face = d.y > 0.0f ? 4.0f : 5.0f; + } + float4 c = faces.Sample(SampleType, float3((uv + 1.0f) / 2.0f, face)); + if (decodeSrgb > 0.5f) + c.rgb = c.rgb <= 0.04045f ? c.rgb / 12.92f : pow(abs((c.rgb + 0.055f) / 1.055f), 2.4f); + if (encodeSrgb > 0.5f) + c.rgb = c.rgb <= 0.0031308f ? c.rgb * 12.92f : 1.055f * pow(abs(c.rgb), 1.0f / 2.4f) - 0.055f; + return c; +})_"; + ID3DBlob* d3d_compile_shader(const char* hlsl, const char* entrypoint, const char* target) { DWORD flags = D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR | D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_WARNINGS_ARE_ERRORS; @@ -187,6 +237,10 @@ DX11Compositor::~DX11Compositor() if (shaderSource) shaderSource->Release(); + if (cubeFaces) + cubeFaces->Release(); + if (cube_pshader) + cube_pshader->Release(); if (constBuffer) constBuffer->Release(); if (context1) @@ -377,7 +431,7 @@ ID3D11Texture2D* DX11Compositor::ShaderSource(const D3D11_TEXTURE2D_DESC& of, DX return shaderSource; } -void DX11Compositor::DrawWithShader(ID3D11ShaderResourceView* view, uint32_t index, const ShaderPass& pass) +void DX11Compositor::DrawWithShader(ID3D11ShaderResourceView* view, uint32_t index, const ShaderPass& pass, ID3D11PixelShader* pixelShader) { ID3DDeviceContextState* appState = nullptr; if (context1 && ownState) @@ -470,7 +524,7 @@ void DX11Compositor::DrawWithShader(ID3D11ShaderResourceView* view, uint32_t ind context->IASetInputLayout(nullptr); context->PSSetShaderResources(0, 1, &view); context->VSSetShader(fs_vshader, nullptr, 0); - context->PSSetShader(fs_pshader, nullptr, 0); + context->PSSetShader(pixelShader ? pixelShader : fs_pshader, nullptr, 0); context->PSSetSamplers(0, 1, &quad_sampleState); context->VSSetConstantBuffers(0, 1, &constBuffer); context->PSSetConstantBuffers(0, 1, &constBuffer); @@ -650,6 +704,123 @@ void DX11Compositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRT SwapchainCallFailed(xrReleaseSwapchainImage(chain, &releaseInfo), "xrReleaseSwapchainImage"); } +bool DX11Compositor::InvokeCubemap(const vr::Texture_t* faces, uint32_t maxWidth, XrSwapchainSubImage& subImage) +{ + if (!shadersUsable || !faces) + return false; + if (!cubeShaderTried) { + cubeShaderTried = true; + ID3DBlob* blob = d3d_compile_shader(cube_shader_code, "ps_cube", "ps_5_0"); + if (blob && FAILED(device->CreatePixelShader(blob->GetBufferPointer(), blob->GetBufferSize(), nullptr, &cube_pshader))) + cube_pshader = nullptr; + if (blob) + blob->Release(); + if (!cube_pshader) + OOVR_LOG("The D3D11 cube map pass couldn't be set up: cube faces are joined on the CPU"); + } + if (!cube_pshader) + return false; + + // Six textures of this device, of one size and format + ID3D11Texture2D* textures[6] = {}; + D3D11_TEXTURE2D_DESC desc{}; + for (int i = 0; i < 6; i++) { + if (faces[i].eType != vr::TextureType_DirectX || !faces[i].handle) + return false; + textures[i] = (ID3D11Texture2D*)faces[i].handle; + ComPtr faceDevice; + textures[i]->GetDevice(&faceDevice); + D3D11_TEXTURE2D_DESC faceDesc; + textures[i]->GetDesc(&faceDesc); + if (faceDevice.Get() != device || (i > 0 && (faceDesc.Width != desc.Width || faceDesc.Height != desc.Height || faceDesc.Format != desc.Format))) { + OOVR_LOG_ONCE("Cube faces of other devices, sizes or formats: joined on the CPU"); + return false; + } + desc = faceDesc; + } + if (!desc.Width || !desc.Height) + return false; + const uint32_t width = std::min(maxWidth, desc.Width * 4) & ~1u; + const uint32_t height = width / 2; + if (width < 2) + return false; + + // The faces as the slices of one texture: views read it, so a typeless format takes its family member of the + // colour space's sRGB-ness + const bool wantSrgb = WantsSrgb(GfxApiKind::D3D11, desc.Format, faces[0].eColorSpace); + const DXGI_FORMAT typedFormat = TypedDxgi(desc.Format) != desc.Format ? (DXGI_FORMAT)FormatWithSrgb(GfxApiKind::D3D11, desc.Format, wantSrgb) : desc.Format; + if (cubeFaces) { + D3D11_TEXTURE2D_DESC have; + cubeFaces->GetDesc(&have); + if (have.Width != desc.Width || have.Height != desc.Height || have.Format != typedFormat) { + cubeFaces->Release(); + cubeFaces = nullptr; + } + } + if (!cubeFaces) { + D3D11_TEXTURE2D_DESC made = desc; + made.Format = typedFormat; + made.SampleDesc = { 1, 0 }; + made.ArraySize = 6; + made.MipLevels = 1; + made.Usage = D3D11_USAGE_DEFAULT; + made.BindFlags = D3D11_BIND_SHADER_RESOURCE; + made.CPUAccessFlags = 0; + made.MiscFlags = 0; + if (FAILED(device->CreateTexture2D(&made, nullptr, &cubeFaces))) { + cubeFaces = nullptr; + OOVR_LOG_ONCE("No texture for the cube faces' pass: joined on the CPU"); + return false; + } + } + + CheckCreateSwapChain(&faces[0], width, height, false); + if (!chain || XR_FAILED(lastResult)) + return false; + uint32_t index = 0; + if (!AcquireAndWait((uint32_t)imagesHandles.size(), index)) + return false; + XrSwapchainImageReleaseInfo releaseInfo{ XR_TYPE_SWAPCHAIN_IMAGE_RELEASE_INFO }; + ID3D11ShaderResourceView* view = nullptr; + D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; + srvDesc.Format = typedFormat; + srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; + srvDesc.Texture2DArray.MostDetailedMip = 0; + srvDesc.Texture2DArray.MipLevels = 1; + srvDesc.Texture2DArray.FirstArraySlice = 0; + srvDesc.Texture2DArray.ArraySize = 6; + if (index >= swapchain_rtvs.size() || !swapchain_rtvs[index] || FAILED(device->CreateShaderResourceView(cubeFaces, &srvDesc, &view)) || !view) { + // Nothing written: the image goes back as it was + xrReleaseSwapchainImage(chain, &releaseInfo); + OOVR_LOG_ONCE("The cube faces' pass has no view or target: joined on the CPU"); + return false; + } + for (UINT i = 0; i < 6; i++) { + const UINT slice = D3D11CalcSubresource(0, i, 1); + if (desc.SampleDesc.Count > 1) + context->ResolveSubresource(cubeFaces, slice, textures[i], 0, typedFormat); + else + context->CopySubresourceRegion(cubeFaces, slice, 0, 0, 0, textures[i], 0, nullptr); + } + ShaderPass pass; + pass.width = width; + pass.height = height; + const bool viewSrgb = FormatIsSrgb(GfxApiKind::D3D11, typedFormat); + const bool targetSrgb = FormatIsSrgb(GfxApiKind::D3D11, createInfo.format); + pass.decodeSrgb = wantSrgb && !viewSrgb && targetSrgb; + pass.encodeSrgb = wantSrgb && viewSrgb && !targetSrgb; + DrawWithShader(view, index, pass, cube_pshader); + view->Release(); + if (SwapchainCallFailed(xrReleaseSwapchainImage(chain, &releaseInfo), "xrReleaseSwapchainImage")) + return false; + + subImage = {}; + subImage.swapchain = chain; + subImage.imageRect = { { 0, 0 }, { (int32_t)width, (int32_t)height } }; + subImage.imageArrayIndex = 0; + return true; +} + bool DX11Compositor::CopyDepth(const vr::Texture_t* depth) { auto* src = (ID3D11Texture2D*)depth->handle; @@ -818,7 +989,7 @@ void DX11Compositor::MirrorUpdate(const vr::Texture_t* texture, const vr::VRText src->GetDevice(&device); D3D11_TEXTURE2D_DESC desc; src->GetDesc(&desc); - // The bounds' area, as it lies in the texture (bounds that run backwards aren't turned round here) + // The bounds' area, as it lies in the texture; bounds that run backwards turn it round (CopyTurned) const bool multisampled = desc.SampleDesc.Count > 1; TextureRegion area; if (!RegionFromBounds(bounds, desc.Width, desc.Height, area)) @@ -851,8 +1022,57 @@ void DX11Compositor::MirrorUpdate(const vr::Texture_t* texture, const vr::VRText device->GetImmediateContext(&ctx); // What fits in the mirror, from the area's origin const UINT width = (std::min)(area.Width(), made.Width), height = (std::min)(area.Height(), made.Height); + // The area of `from` that lands at the mirror's origin: the area's far end where it's turned round + const UINT x0 = area.flipX ? area.x1 - width : area.x0, y0 = area.flipY ? area.y1 - height : area.y0; + // One texture's width x height area at (x, y), to the origin of `to`, turned round as the bounds say: a copy of rows + // (or columns) one at a time, a copy can't turn them; both ways through a texture of that size between + auto copyTurned = [&](ID3D11Texture2D* to, ID3D11Texture2D* from, UINT x, UINT y) { + if (!area.flipX && !area.flipY) { + const D3D11_BOX box{ x, y, 0, x + width, y + height, 1 }; + ctx->CopySubresourceRegion(to, 0, 0, 0, 0, from, 0, &box); + return; + } + ID3D11Texture2D* rowsInto = to; + // Kept for the next frame of the same size, format and device, as `resolved` below + static std::mutex betweenLock; + static ComPtr& between = *new ComPtr(); // never released at exit + std::unique_lock betweenGuard(betweenLock, std::defer_lock); + if (area.flipX && area.flipY) { + betweenGuard.lock(); + D3D11_TEXTURE2D_DESC have{}; + ComPtr haveDevice; + if (between) { + between->GetDesc(&have); + between->GetDevice(&haveDevice); + } + if (!between || have.Width != width || have.Height != height || have.Format != made.Format || haveDevice != device) { + between.Reset(); + between.Attach(MakeMirrorTexture(device.Get(), width, height, made.Format)); + } + if (!between) { + OOVR_LOG_ONCE("No texture to turn a mirror frame round in: frame not copied"); + return; + } + rowsInto = between.Get(); + } + if (area.flipY) { + for (UINT r = 0; r < height; r++) { + const D3D11_BOX row{ x, y + r, 0, x + width, y + r + 1, 1 }; + ctx->CopySubresourceRegion(rowsInto, 0, 0, height - 1 - r, 0, from, 0, &row); + } + } + if (area.flipX) { + // From the rows just turned (both ways), else from the frame + ID3D11Texture2D* columnsFrom = area.flipY ? between.Get() : from; + const UINT cx = area.flipY ? 0 : x, cy = area.flipY ? 0 : y; + for (UINT c = 0; c < width; c++) { + const D3D11_BOX column{ cx + c, cy, 0, cx + c + 1, cy + height, 1 }; + ctx->CopySubresourceRegion(to, 0, width - 1 - c, 0, 0, columnsFrom, 0, &column); + } + } + }; if (multisampled) { - if (made.Width == desc.Width && made.Height == desc.Height) { + if (made.Width == desc.Width && made.Height == desc.Height && !area.flipX && !area.flipY) { ctx->ResolveSubresource(*mirror, 0, src.Get(), 0, typed); } else { // Resolved whole into a texture of the frame's size, of which the mirror takes its part. It is kept for the next @@ -873,12 +1093,10 @@ void DX11Compositor::MirrorUpdate(const vr::Texture_t* texture, const vr::VRText if (!resolved) return; ctx->ResolveSubresource(resolved.Get(), 0, src.Get(), 0, typed); - const D3D11_BOX box{ area.x0, area.y0, 0, area.x0 + width, area.y0 + height, 1 }; - ctx->CopySubresourceRegion(*mirror, 0, 0, 0, 0, resolved.Get(), 0, &box); + copyTurned(*mirror, resolved.Get(), x0, y0); } } else { - const D3D11_BOX box{ area.x0, area.y0, 0, area.x0 + width, area.y0 + height, 1 }; - ctx->CopySubresourceRegion(*mirror, 0, 0, 0, 0, src.Get(), 0, &box); + copyTurned(*mirror, src.Get(), x0, y0); } } diff --git a/OpenOVR/Compositor/dx11compositor.h b/OpenOVR/Compositor/dx11compositor.h index f03c2bda..65d9cd4c 100644 --- a/OpenOVR/Compositor/dx11compositor.h +++ b/OpenOVR/Compositor/dx11compositor.h @@ -13,6 +13,8 @@ class DX11Compositor : public Compositor { bool ReadbackToCpu(const vr::Texture_t* tex, const vr::VRTextureBounds_t* bounds, Image& out) override; + bool InvokeCubemap(const vr::Texture_t* faces, uint32_t maxWidth, XrSwapchainSubImage& subImage) override; + protected: bool CopyDepth(const vr::Texture_t* depth) override; @@ -75,6 +77,12 @@ class DX11Compositor : public Compositor { // The area drawn, from the image's origin uint32_t width = 0, height = 0; }; - // Draws view over pass's area of swapchain image index (its render target view) - void DrawWithShader(ID3D11ShaderResourceView* view, uint32_t index, const ShaderPass& pass); + // Draws view over pass's area of swapchain image index (its render target view), through pixelShader (nullptr: the + // pass's own, ps_fs) + void DrawWithShader(ID3D11ShaderResourceView* view, uint32_t index, const ShaderPass& pass, ID3D11PixelShader* pixelShader = nullptr); + // InvokeCubemap's: the pixel shader, made at its first use (cubeShaderTried), and the faces copied into the slices + // of one texture it can read + ID3D11PixelShader* cube_pshader = nullptr; + bool cubeShaderTried = false; + ID3D11Texture2D* cubeFaces = nullptr; }; diff --git a/OpenOVR/Compositor/vkcompositor.cpp b/OpenOVR/Compositor/vkcompositor.cpp index da5efddb..698197c8 100644 --- a/OpenOVR/Compositor/vkcompositor.cpp +++ b/OpenOVR/Compositor/vkcompositor.cpp @@ -44,15 +44,11 @@ VkCompositor::VkCompositor(const vr::Texture_t* initialTexture) OOVR_LOG("vkCreateCommandPool failed: Vulkan textures can't be copied"); appCommandPool = VK_NULL_HANDLE; } + poolFamily = poolInfo.queueFamilyIndex; } -bool VkCompositor::CreateStage(VkFormat format, uint32_t width, uint32_t height) +bool VkCompositor::MakeTransferImage(VkFormat format, uint32_t width, uint32_t height, VkImage& image, VkDeviceMemory& memory) { - VkFormatProperties properties{}; - if (format != VK_FORMAT_UNDEFINED) - vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &properties); - if (FormatIsSrgb(GfxApiKind::Vulkan, (int64_t)format) || !(properties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT)) - return false; VkImageCreateInfo info{ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO }; info.imageType = VK_IMAGE_TYPE_2D; info.format = format; @@ -64,36 +60,68 @@ bool VkCompositor::CreateStage(VkFormat format, uint32_t width, uint32_t height) info.usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; - if (vkCreateImage(appDevice, &info, nullptr, &stageImage) != VK_SUCCESS) { - stageImage = VK_NULL_HANDLE; + if (vkCreateImage(appDevice, &info, nullptr, &image) != VK_SUCCESS) { + image = VK_NULL_HANDLE; return false; } VkMemoryRequirements requirements{}; - vkGetImageMemoryRequirements(appDevice, stageImage, &requirements); + vkGetImageMemoryRequirements(appDevice, image, &requirements); VkMemoryAllocateInfo allocate{ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO }; allocate.allocationSize = requirements.size; allocate.memoryTypeIndex = VkFindMemoryType(physicalDevice, requirements.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); - if (allocate.memoryTypeIndex == UINT32_MAX || vkAllocateMemory(appDevice, &allocate, nullptr, &stageMemory) != VK_SUCCESS) - stageMemory = VK_NULL_HANDLE; - if (!stageMemory || vkBindImageMemory(appDevice, stageImage, stageMemory, 0) != VK_SUCCESS) { - DestroyStage(); + if (allocate.memoryTypeIndex == UINT32_MAX || vkAllocateMemory(appDevice, &allocate, nullptr, &memory) != VK_SUCCESS) + memory = VK_NULL_HANDLE; + if (!memory || vkBindImageMemory(appDevice, image, memory, 0) != VK_SUCCESS) { + vkDestroyImage(appDevice, image, nullptr); + if (memory) + vkFreeMemory(appDevice, memory, nullptr); + image = VK_NULL_HANDLE; + memory = VK_NULL_HANDLE; return false; } return true; } -void VkCompositor::DestroyStage() +void VkCompositor::DestroyTransferImage(VkImage& image, VkDeviceMemory& memory) { - if (!stageImage && !stageMemory) + if (!image && !memory) return; // Frames copied through it may still be on the queue vkQueueWaitIdle(appQueue); - if (stageImage) - vkDestroyImage(appDevice, stageImage, nullptr); - if (stageMemory) - vkFreeMemory(appDevice, stageMemory, nullptr); - stageImage = VK_NULL_HANDLE; - stageMemory = VK_NULL_HANDLE; + if (image) + vkDestroyImage(appDevice, image, nullptr); + if (memory) + vkFreeMemory(appDevice, memory, nullptr); + image = VK_NULL_HANDLE; + memory = VK_NULL_HANDLE; +} + +bool VkCompositor::CreateResolveImage(VkFormat format, uint32_t width, uint32_t height) +{ + // A resolve writes it and a blit reads it + VkFormatProperties properties{}; + vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &properties); + const VkFormatFeatureFlags needed = VK_FORMAT_FEATURE_BLIT_SRC_BIT | VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT; + if ((properties.optimalTilingFeatures & needed) != needed) + return false; + return MakeTransferImage(format, width, height, resolveImage, resolveMemory); +} + +bool VkCompositor::CreateStage(VkFormat format, uint32_t width, uint32_t height) +{ + VkFormatProperties properties{}; + if (format != VK_FORMAT_UNDEFINED) + vkGetPhysicalDeviceFormatProperties(physicalDevice, format, &properties); + if (FormatIsSrgb(GfxApiKind::Vulkan, (int64_t)format) || !(properties.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT)) + return false; + return MakeTransferImage(format, width, height, stageImage, stageMemory); +} + +void VkCompositor::DestroyStage() +{ + DestroyTransferImage(stageImage, stageMemory); + DestroyTransferImage(resolveImage, resolveMemory); + resolveFailed = false; } VkCompositor::~VkCompositor() @@ -116,14 +144,23 @@ void VkCompositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRTex return; } - // OpenXR only guarantees that the queue we initially gave it will have ownership of our swapchain image - // We could safeguard against any insane applications with a queue that we manage and copy to it, - // but it's simpler (and likely more performant) to just assume our app is sane. - if (appQueue != tex->m_pQueue) { - OOVR_LOG_ONCE("A Vulkan texture on another queue than the first one: not used"); + // The command buffers are of the first texture's device and queue family + if (tex->m_pDevice != appDevice) { + OOVR_LOG_ONCE("A Vulkan texture of another device than the first one: not used"); lastResult = XR_ERROR_VALIDATION_FAILURE; return; } + // A texture on another queue of the same family is copied on the session's queue, which the runtime syncs with, + // after the game's work on its own queue. A queue of another family would need the images handed across families: + // not used. + const bool otherQueue = tex->m_pQueue != appQueue; + if (otherQueue && tex->m_nQueueFamilyIndex != poolFamily) { + OOVR_LOG_ONCEF("A Vulkan texture on a queue of family %u, not the first texture's %u: not used", tex->m_nQueueFamilyIndex, poolFamily); + lastResult = XR_ERROR_VALIDATION_FAILURE; + return; + } + if (otherQueue) + OOVR_LOG_ONCE("A Vulkan texture on another queue than the first one: copied after the game's work on it"); if (!appCommandPool) { lastResult = XR_ERROR_RUNTIME_FAILURE; return; @@ -137,11 +174,17 @@ void VkCompositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRTex OC_UNSUPPORTED_VOID("A Vulkan texture of no size (%u x %u)", tex->m_nWidth, tex->m_nHeight); } - bool usable = chain != XR_NULL_HANDLE && tex->m_nWidth == createInfo.width && tex->m_nHeight == createInfo.height - && tex->m_nSampleCount == createSourceSamples && (int64_t)tex->m_nFormat == createInfoFormat && texture->eColorSpace == createColourSpace; + // A texture that fits in the swapchain is copied to its origin, and the area shown: a smaller one (dynamic + // resolution) keeps the swapchain, and a bigger one makes one that holds both sizes, so a size that comes and goes + // doesn't make a new swapchain each time + const bool sameKind = chain != XR_NULL_HANDLE && tex->m_nSampleCount == createSourceSamples && (int64_t)tex->m_nFormat == createInfoFormat + && texture->eColorSpace == createColourSpace; + bool usable = sameKind && tex->m_nWidth <= createInfo.width && tex->m_nHeight <= createInfo.height; if (!usable) { OOVR_LOG("Generating new swap chain"); + const uint32_t width = sameKind ? std::max(tex->m_nWidth, createInfo.width) : tex->m_nWidth; + const uint32_t height = sameKind ? std::max(tex->m_nHeight, createInfo.height) : tex->m_nHeight; // First, delete the old chain if necessary if (chain) @@ -156,8 +199,8 @@ void VkCompositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRTex createInfo.createFlags = 0; createInfo.usageFlags = XR_SWAPCHAIN_USAGE_TRANSFER_DST_BIT; createInfo.faceCount = 1; - createInfo.width = tex->m_nWidth; - createInfo.height = tex->m_nHeight; + createInfo.width = width; + createInfo.height = height; createInfo.mipCount = 1; // A runtime that has no multisampled swapchains of that count gets a single-sampled one, the image resolved into it createSourceSamples = tex->m_nSampleCount; @@ -178,12 +221,15 @@ void VkCompositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRTex createInfoFormat = (int64_t)tex->m_nFormat; createColourSpace = texture->eColorSpace; if (convertFormat) { - // A blit converts between formats that have it (and not from a multisampled image) + // A blit converts between formats that have it; a multisampled image is resolved into an image of its format + // for it first VkFormatProperties from{}, to{}; vkGetPhysicalDeviceFormatProperties(physicalDevice, (VkFormat)tex->m_nFormat, &from); vkGetPhysicalDeviceFormatProperties(physicalDevice, (VkFormat)createInfo.format, &to); - if (tex->m_nSampleCount > 1 || !(from.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT) + if ((tex->m_nSampleCount > 1 && !CreateResolveImage((VkFormat)tex->m_nFormat, width, height)) + || !(from.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT) || !(to.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT)) { + DestroyStage(); // Submit answers InvalidTexture; the eye is left out chain = XR_NULL_HANDLE; createInfo = {}; @@ -196,7 +242,7 @@ void VkCompositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRTex // blit doesn't encode them again if (FormatIsSrgb(GfxApiKind::Vulkan, createInfo.format) && !FormatIsSrgb(GfxApiKind::Vulkan, (int64_t)tex->m_nFormat) && WantsSrgb(GfxApiKind::Vulkan, (int64_t)tex->m_nFormat, texture->eColorSpace) - && !CreateStage((VkFormat)FormatWithSrgb(GfxApiKind::Vulkan, createInfo.format, false), tex->m_nWidth, tex->m_nHeight)) + && !CreateStage((VkFormat)FormatWithSrgb(GfxApiKind::Vulkan, createInfo.format, false), width, height)) OOVR_LOGF("No image of swapchain format %d's linear sibling to blit into: the blit encodes the values again, and they show too bright", (int)createInfo.format); } @@ -291,16 +337,54 @@ void VkCompositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRTex auto tex = static_cast(texture->handle); arrayLayer = tex->m_unArrayIndex; } - // A blit converts, and flips where the bounds run backwards (invertUsingShaders: always used); a multisampled image - // can't be blitted, and is resolved as it is + // A blit converts, and flips where the bounds run backwards (invertUsingShaders: always used). A multisampled image + // is resolved into the resolve image first, which the blit reads; into a multisampled swapchain it can only be + // copied, as it is. const bool flip = area.flipX || area.flipY; - if (flip && tex->m_nSampleCount > 1) + const bool wantBlit = convertFormat || flip || oovr_global_configuration.InvertUsingShaders(); + const bool multisampled = tex->m_nSampleCount > 1; + if (wantBlit && multisampled && createInfo.sampleCount == 1 && !resolveImage && !resolveFailed) { + resolveFailed = !CreateResolveImage((VkFormat)tex->m_nFormat, createInfo.width, createInfo.height); + if (resolveFailed) + OOVR_LOGF("No image to resolve a multisampled Vulkan image of format %d into for a blit", (int)tex->m_nFormat); + } + const bool resolveFirst = wantBlit && multisampled && resolveImage; + if (flip && multisampled && !resolveFirst) OOVR_LOG_ONCE("A multisampled Vulkan image with flipped bounds: shown as it is, not flipped"); - if ((convertFormat || flip || oovr_global_configuration.InvertUsingShaders()) && tex->m_nSampleCount <= 1) { + if (wantBlit && (!multisampled || resolveFirst)) { + VkImage blitSource = (VkImage)tex->m_nImage; + uint32_t blitLayer = arrayLayer; + if (resolveFirst) { + // The area, resolved to the same place in the resolve image (whose contents before don't matter) + VkImageMemoryBarrier toDst = barrier; + toDst.image = resolveImage; + toDst.srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT; + toDst.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + toDst.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED; + toDst.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + // After the last frame's blit from it, which may be on the queue still + vkCmdPipelineBarrier(currentCommandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &toDst); + VkImageResolve resolve = {}; + resolve.srcSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, arrayLayer, 1 }; + resolve.srcOffset = { (int32_t)area.x0, (int32_t)area.y0, 0 }; + resolve.dstSubresource = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1 }; + resolve.dstOffset = { (int32_t)area.x0, (int32_t)area.y0, 0 }; + resolve.extent = { area.Width(), area.Height(), 1 }; + vkCmdResolveImage(currentCommandBuffer, (VkImage)tex->m_nImage, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, resolveImage, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &resolve); + VkImageMemoryBarrier toSrc = toDst; + toSrc.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; + toSrc.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + toSrc.oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + toSrc.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + vkCmdPipelineBarrier(currentCommandBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &toSrc); + blitSource = resolveImage; + blitLayer = 0; + } VkImageBlit region = {}; region.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; region.srcSubresource.mipLevel = 0; - region.srcSubresource.baseArrayLayer = arrayLayer; + region.srcSubresource.baseArrayLayer = blitLayer; region.srcSubresource.layerCount = 1; // Reversed offsets flip region.srcOffsets[0] = { (int)(area.flipX ? area.x1 : area.x0), (int)(area.flipY ? area.y1 : area.y0), 0 }; @@ -323,7 +407,7 @@ void VkCompositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRTex } vkCmdBlitImage( // currentCommandBuffer, // commandbuffer - (VkImage)tex->m_nImage, // srcImage + blitSource, // srcImage VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, // srcImageLayout stageImage ? stageImage : swapchainImages.at(currentIndex).image, // dstImage VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // dstImageLayout @@ -405,8 +489,30 @@ void VkCompositor::CopyToSwapchain(const vr::Texture_t* texture, const vr::VRTex submitInfo.commandBufferCount = 1; submitInfo.pCommandBuffers = ¤tCommandBuffer; - if (vkFailed(SubmitWithImageFence(tex->m_pQueue, submitInfo, currentIndex) ? VK_SUCCESS : VK_ERROR_UNKNOWN, "vkQueueSubmit")) + // A texture on another queue: the copy waits for a semaphore that queue signals after the game's work + const VkPipelineStageFlags waitStage = VK_PIPELINE_STAGE_TRANSFER_BIT; + if (otherQueue) { + VkSubmitInfo signal = { VK_STRUCTURE_TYPE_SUBMIT_INFO }; + signal.signalSemaphoreCount = 1; + signal.pSignalSemaphores = &imageSemaphores.at(currentIndex); + if (vkFailed(vkQueueSubmit(tex->m_pQueue, 1, &signal, VK_NULL_HANDLE), "vkQueueSubmit (the texture's queue)")) + return; + submitInfo.waitSemaphoreCount = 1; + submitInfo.pWaitSemaphores = &imageSemaphores.at(currentIndex); + submitInfo.pWaitDstStageMask = &waitStage; + } + + if (vkFailed(SubmitWithImageFence(appQueue, submitInfo, currentIndex) ? VK_SUCCESS : VK_ERROR_UNKNOWN, "vkQueueSubmit")) { + if (otherQueue) { + // The semaphore is waited for anyway, so it isn't left signalled + VkSubmitInfo drain = { VK_STRUCTURE_TYPE_SUBMIT_INFO }; + drain.waitSemaphoreCount = 1; + drain.pWaitSemaphores = &imageSemaphores.at(currentIndex); + drain.pWaitDstStageMask = &waitStage; + SubmitWithImageFence(appQueue, drain, currentIndex); + } return; + } // Release the swapchain - OpenXR will use the last-released image in a swapchain SwapchainCallFailed(xrReleaseSwapchainImage(chain, &releaseInfo), "xrReleaseSwapchainImage"); @@ -515,6 +621,14 @@ bool VkCompositor::AllocateImageBuffers(uint32_t count) return false; } } + VkSemaphoreCreateInfo semaphoreInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO }; + imageSemaphores.assign(count, VK_NULL_HANDLE); + for (VkSemaphore& semaphore : imageSemaphores) { + if (vkCreateSemaphore(appDevice, &semaphoreInfo, nullptr, &semaphore) != VK_SUCCESS) { + FreeImageBuffers(); + return false; + } + } return true; } @@ -530,6 +644,11 @@ void VkCompositor::FreeImageBuffers() vkDestroyFence(appDevice, fence, nullptr); } imageFences.clear(); + for (VkSemaphore semaphore : imageSemaphores) { + if (semaphore) + vkDestroySemaphore(appDevice, semaphore, nullptr); + } + imageSemaphores.clear(); if (!appCommandBuffers.empty() && appCommandPool) vkFreeCommandBuffers(appDevice, appCommandPool, (uint32_t)appCommandBuffers.size(), appCommandBuffers.data()); appCommandBuffers.clear(); diff --git a/OpenOVR/Compositor/vkcompositor.h b/OpenOVR/Compositor/vkcompositor.h index 58a380c4..03635dad 100644 --- a/OpenOVR/Compositor/vkcompositor.h +++ b/OpenOVR/Compositor/vkcompositor.h @@ -41,6 +41,17 @@ class VkCompositor : public Compositor { VkDeviceMemory stageMemory = VK_NULL_HANDLE; bool CreateStage(VkFormat format, uint32_t width, uint32_t height); void DestroyStage(); + // A multisampled image that goes through a blit (flipped bounds, a conversion) is resolved into this image of its + // format and size first, as a blit can't read a multisampled one. + VkImage resolveImage = VK_NULL_HANDLE; + VkDeviceMemory resolveMemory = VK_NULL_HANDLE; + bool resolveFailed = false; + bool CreateResolveImage(VkFormat format, uint32_t width, uint32_t height); + // A single-sampled image for transfers in the app's device, with memory of its own: false (with none left) if it + // can't be made + bool MakeTransferImage(VkFormat format, uint32_t width, uint32_t height, VkImage& image, VkDeviceMemory& memory); + // Frees such an image once the copies through it are over + void DestroyTransferImage(VkImage& image, VkDeviceMemory& memory); // The GPU, as the runtime knows it VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; @@ -51,10 +62,13 @@ class VkCompositor : public Compositor { VkDevice appDevice = VK_NULL_HANDLE; VkQueue appQueue = VK_NULL_HANDLE; VkCommandPool appCommandPool = VK_NULL_HANDLE; + uint32_t poolFamily = 0; std::vector appCommandBuffers{}; // A fence for each command buffer, signalled when its last submission is over std::vector imageFences; - // Command buffers and fences for count swapchain images: false (with none left) if they can't be made + // A semaphore for each, for a copy of a texture on another queue to wait for the game's work there + std::vector imageSemaphores; + // Command buffers, fences and semaphores for count swapchain images: false (with none left) if they can't be made bool AllocateImageBuffers(uint32_t count); // Frees them once their submissions are over void FreeImageBuffers(); diff --git a/OpenOVR/Drivers/Backend.cpp b/OpenOVR/Drivers/Backend.cpp index d98a70d8..16c9e400 100644 --- a/OpenOVR/Drivers/Backend.cpp +++ b/OpenOVR/Drivers/Backend.cpp @@ -33,6 +33,11 @@ BackendManager* BackendManager::InstancePtr() bool BackendManager::resetting = false; +void BackendManager::Abandon() +{ + (void)instance.release(); +} + void BackendManager::Reset() { resetting = true; diff --git a/OpenOVR/Drivers/Backend.h b/OpenOVR/Drivers/Backend.h index d365cabe..0ff0299b 100644 --- a/OpenOVR/Drivers/Backend.h +++ b/OpenOVR/Drivers/Backend.h @@ -278,6 +278,8 @@ class BackendManager { static BackendManager& Instance(); static BackendManager* InstancePtr(); static void Reset(); + // Leaves the backend undestroyed, for a process that is ending + static void Abandon(); // main methods diff --git a/OpenOVR/Misc/Bounds.h b/OpenOVR/Misc/Bounds.h index 16af962b..830e2420 100644 --- a/OpenOVR/Misc/Bounds.h +++ b/OpenOVR/Misc/Bounds.h @@ -27,6 +27,11 @@ struct BoundsWall { // committed room setup (the store's Chaperone document), else 0 by 0 XrExtent2Df BoundsPlayArea(const XrExtent2Df* runtime, const Json::Value& chaperoneDoc); +// The play area OpenLamina answers with everywhere (IVRChaperone's getters, GetCalibrationState and the drawn +// bounds): BoundsPlayArea of the OpenXR runtime's stage bounds (asked of it once per session and after the stage +// changes) and the store's committed room setup. 0 by 0 without either. +XrExtent2Df CurrentPlayArea(); + // The walls to draw for a play area width (X) by depth (Z), given the tracked points in the stage. With preview (a // room setup tool's ShowWorkingSetPreview), every wall, whole, wherever the points are. std::vector BoundsWalls(float width, float depth, const std::vector& points, bool preview = false); diff --git a/OpenOVR/Misc/Config.cpp b/OpenOVR/Misc/Config.cpp index 3ad256a7..f2d9abb4 100644 --- a/OpenOVR/Misc/Config.cpp +++ b/OpenOVR/Misc/Config.cpp @@ -9,6 +9,11 @@ #include #include +#ifndef _WIN32 +#include +#include +#endif + using vr::HmdColor_t; Config oovr_global_configuration; @@ -153,6 +158,17 @@ static string parse_layout(string orig, string name, int line) return val; } +// handController: knuckles, oculus_touch, vive_controller or off +static string parse_handController(string orig, string name, int line) +{ + string val = str_tolower(orig); + if (val != "knuckles" && val != "oculus_touch" && val != "vive_controller" && val != "off") { + BAD_VALUE("Value " + orig + " for " + name + " on line " + to_string(line) + " is none of knuckles, oculus_touch, vive_controller and off"); + } + OOVR_LOGF("Setting config param %s to %s", name.c_str(), val.c_str()); + return val; +} + int Config::ini_handler(void* user, const char* pSection, const char* pName, const char* pValue, int lineno) @@ -208,6 +224,7 @@ int Config::ini_handler(void* user, const char* pSection, return true; } CFGOPT(layout, keyboardLayout); + CFGOPT(handController, handController); // Accepted and ignored: Direct3D 10 textures are told apart from Direct3D 11 ones by their interface if (name == "dx10Mode") { @@ -278,48 +295,77 @@ const Config& Config::Loaded() const return *this; } +#ifndef _WIN32 +// The folder of the library's openlamina.ini on Linux: the library's own (bin/), or its parent when the library is in +// bin/linux64/, so both word sizes of an install read the same bin/openlamina.ini +static std::filesystem::path linux_library_ini_dir() +{ + Dl_info info{}; + if (!dladdr((void*)&linux_library_ini_dir, &info) || !info.dli_fname || !*info.dli_fname) + return {}; + std::error_code ec; + std::filesystem::path dir = std::filesystem::absolute(info.dli_fname, ec).parent_path(); + if (ec) + return {}; + if (dir.filename() == "linux64") + dir = dir.parent_path(); + return dir; +} + +// $XDG_CONFIG_HOME/openlamina, ~/.config/openlamina when it isn't set (or isn't absolute, as the XDG spec says) +static std::filesystem::path linux_user_ini_dir() +{ + const char* xdg = getenv("XDG_CONFIG_HOME"); + if (xdg && xdg[0] == '/') + return std::filesystem::path(xdg) / "openlamina"; + const char* home = getenv("HOME"); + if (home && home[0] == '/') + return std::filesystem::path(home) / ".config" / "openlamina"; + return {}; +} +#endif + void Config::Read() { - // If we're on Windows, look for a config file next to the DLL - // If we're on Linux, skip that and just check the working directory. - int err = -1; + // Each file read overrides, key by key, what the ones before it set: on Windows the one next to the DLL, on Linux + // the install's bin/ and then the user's config folder; then, on both, the working directory's + int found = 0; + auto read = [&](const char* what, const std::filesystem::path& dir) { + if (dir.empty()) { + OOVR_LOGF("No %s config file: its folder isn't known", what); + return; + } + OOVR_LOGF("Checking for %s config file...", what); + int err = wini_parse_in(dir, ini_handler, this); + if (err == -1) + return; + found++; + if (err > 0) { + // err is the line number of the first line ini_parse couldn't read; it read the rest + OOVR_LOGF("Warning: the %s config file can't be read on line %d; that line is ignored", what, err); + } + }; + #ifdef _WIN32 wchar_t buffer[MAX_PATH]; DWORD len = GetModuleFileNameW(HINST_THISCOMPONENT, buffer, MAX_PATH); - if (len) { - OOVR_LOG("Checking for global config file..."); - err = wini_parse_in(std::filesystem::path(std::wstring(buffer, len)).parent_path(), ini_handler, this); - } + if (len) + read("global", std::filesystem::path(std::wstring(buffer, len)).parent_path()); +#else + read("global", linux_library_ini_dir()); + read("user", linux_user_ini_dir()); #endif - if (err > 0) { - // err is the line number of the first line ini_parse couldn't read; it read the rest - OOVR_LOGF("Warning: the config file can't be read on line %d; that line is ignored", err); - } - - { - // The working directory's file overrides, key by key, what the first one set - std::error_code ec; - std::filesystem::path workingDir = std::filesystem::current_path(ec); - if (!ec) { - OOVR_LOG("Checking for app specific config file..."); - err = wini_parse_in(workingDir, ini_handler, this); - } else { - OOVR_LOG("Couldn't get the working directory, so there's no app specific config file"); - err = -1; - } - } - - if (err == -1) { - // Couldn't open file, no problen since the config file is optional and - // the defaults are set up as the default values for the variables - return; - } else if (err) { - // err is the line number of the first line ini_parse couldn't read; it read the rest - OOVR_LOGF("Warning: the config file can't be read on line %d; that line is ignored", err); - } + std::error_code ec; + std::filesystem::path workingDir = std::filesystem::current_path(ec); + if (!ec) + read("app specific", workingDir); + else + OOVR_LOG("Couldn't get the working directory, so there's no app specific config file"); - // Everything should have been set up by ini_handler + // No file is no problem: the options are optional, and keep their defaults + if (found > 1) + OOVR_LOGF("%d config files read; each later one overrides the keys it sets", found); } Config::~Config() diff --git a/OpenOVR/Misc/Config.h b/OpenOVR/Misc/Config.h index 88cbb300..5ca4b97a 100644 --- a/OpenOVR/Misc/Config.h +++ b/OpenOVR/Misc/Config.h @@ -56,6 +56,9 @@ class Config { const std::string& BindingEditor() const { return Loaded().bindingEditor; } /** The keyboard's layout: "us", "uk", or empty to choose by the user's locale (UK for en-GB, else US) */ const std::string& KeyboardLayout() const { return Loaded().keyboardLayout; } + /** The controller the hands are shown as when no controller is in them: "knuckles" (an Index controller), + * "oculus_touch", "vive_controller", or "off" for none */ + const std::string& HandController() const { return Loaded().handController; } private: // Reads the files, once, and answers this @@ -96,6 +99,7 @@ class Config { bool logAllOpenVRCalls = false; std::string bindingEditor; std::string keyboardLayout; + std::string handController = "knuckles"; }; extern Config oovr_global_configuration; diff --git a/OpenOVR/Misc/Dashboard.cpp b/OpenOVR/Misc/Dashboard.cpp index 2d3a2b62..3553817f 100644 --- a/OpenOVR/Misc/Dashboard.cpp +++ b/OpenOVR/Misc/Dashboard.cpp @@ -64,14 +64,18 @@ int Dashboard::OnInput(bool leftDown, bool rightDown, double now) toggledThisPress = true; } if (button == Button::PressOrHold) { - if (down && !toggledThisPress && now - heldSince >= kRecentreHold) { - // Held long enough: a recentre, from the hand that began the press if it's still the one held - toggledThisPress = true; + if (down) { + // The hand that began the press if it's still the one held const bool beganHeld = heldHand == 0 ? leftDown : rightDown; - recentre = beganHeld ? heldHand : 1 - heldHand; - } else if (!down && held && !toggledThisPress) { - // Let go before that: a press - open = !open; + recentreHand = beganHeld ? heldHand : 1 - heldHand; + } else if (held && !toggledThisPress) { + // Let go: a press before kRecentreHold, a recentre before kPowerOffHold, and after that the controller + // was being turned off + const double heldFor = now - heldSince; + if (heldFor < kRecentreHold) + open = !open; + else if (heldFor < kPowerOffHold) + recentre = recentreHand; } } held = down; diff --git a/OpenOVR/Misc/Dashboard.h b/OpenOVR/Misc/Dashboard.h index 455d4aeb..7f8e1e62 100644 --- a/OpenOVR/Misc/Dashboard.h +++ b/OpenOVR/Misc/Dashboard.h @@ -26,7 +26,8 @@ class Dashboard { public: // How its button opens it. ini dashboardButton=system|system_long|menu|menu_long|off: the button is a controller's // system button or the left menu button. Menu: each press opens or closes it. MenuLong: held for 0.6 s. - // PressOrHold (system): a press opens or closes it when the button is let go, and a hold of 1 s recentres instead. + // PressOrHold (system): a press opens or closes it when the button is let go, and a hold of 1 s recentres instead, + // when it's let go. A hold of kPowerOffHold or more is the controller being turned off: nothing. enum class Button { MenuLong, Menu, PressOrHold, Off }; // The frame's canvas, and its size in metres: the panel in its middle, tabs above, "Quit game" below @@ -36,6 +37,8 @@ class Dashboard { static constexpr double kLongPress = 0.6; // How long the button is held to recentre (PressOrHold) static constexpr double kRecentreHold = 1.0; + // How long a hold is taken to be turning the controller off (its system button held), with no recentre + static constexpr double kPowerOffHold = 3.0; static constexpr int kNoHand = -1; struct Rect { @@ -52,7 +55,7 @@ class Dashboard { } // The button of each hand (0 left, 1 right) at a time in seconds: opens and closes it. Returns the hand whose button - // has now been held long enough to recentre (once a press, and that press doesn't open or close it), else kNoHand. + // was just let go after a recentre's hold (that press doesn't open or close it), else kNoHand. int OnInput(bool leftDown, bool rightDown, double now); int OnInput(bool leftDown, double now) { return OnInput(leftDown, false, now); } bool Open() const { return open; } @@ -83,7 +86,8 @@ class Dashboard { bool held = false; // the button of either hand, at the last OnInput double heldSince = 0; int heldHand = 0; // the hand that began the press - bool toggledThisPress = false; // or recentred + int recentreHand = 0; // the hand a recentre would come from: the one that began the press, while it's held + bool toggledThisPress = false; mutable std::vector drawnTabs; // as last drawn, for OnClick }; diff --git a/OpenOVR/Misc/Input/Bindings/BindingInfo.cpp b/OpenOVR/Misc/Input/Bindings/BindingInfo.cpp index a6bf8e20..05404a3a 100644 --- a/OpenOVR/Misc/Input/Bindings/BindingInfo.cpp +++ b/OpenOVR/Misc/Input/Bindings/BindingInfo.cpp @@ -49,13 +49,43 @@ std::vector BindingsForAction(const BindingFile& file, const std: b.sourceType = SourceType(b.input, file.controllerType); found.push_back(std::move(b)); }; + // A pose and a skeleton are told by where they're read (/pose/raw, /input/skeleton/left), with no mode + auto addPose = [&](const std::string& path) { + ActionBinding b; + size_t at = path.find("/pose"); + if (at == std::string::npos) + at = path.find("/input/"); + if (at == std::string::npos || at == 0) + return; + b.device = path.substr(0, at); + b.input = path.substr(at); + if (device.empty() || b.device == device) + found.push_back(std::move(b)); + }; for (const auto& [setName, set] : file.sets) { for (const SourceBinding& source : set.sources) { if (source.mode == "none") continue; - for (const auto& [slot, output] : source.inputs) - if (output == action) + for (const auto& [slot, output] : source.inputs) { + // A force sensor is read by its force; one bound by its click binds nothing + if (output == action && !(source.mode == "force_sensor" && slot == "click")) add(source.path, source.mode, slot); + } + } + for (const PoseBinding& pose : set.poses) + if (pose.output == action) + addPose(pose.path); + for (const SkeletonBinding& skeleton : set.skeleton) + if (skeleton.output == action) + addPose(skeleton.path); + // A vibration is told with no device or input path + for (const HapticBinding& haptic : set.haptics) { + if (haptic.output != action) + continue; + const size_t at = haptic.path.find("/output/"); + if (!device.empty() && (at == std::string::npos || haptic.path.substr(0, at) != device)) + continue; + found.emplace_back(); } for (const ChordBinding& chord : set.chords) { if (chord.output != action) diff --git a/OpenOVR/Misc/Input/Bindings/BindingInfo.h b/OpenOVR/Misc/Input/Bindings/BindingInfo.h index e9b6ac11..a26ac95c 100644 --- a/OpenOVR/Misc/Input/Bindings/BindingInfo.h +++ b/OpenOVR/Misc/Input/Bindings/BindingInfo.h @@ -18,7 +18,8 @@ struct ActionBinding { }; /** The bindings of an action (its manifest name, lower-cased) on one device (/user/hand/left; empty for every - * device). A source of mode none binds nothing. */ + * device). A source of mode none binds nothing, nor a force sensor's click. A pose and a skeleton are told by their + * device and the path read (/pose/raw, /input/skeleton/left) with no mode; a vibration with every field empty. */ std::vector BindingsForAction(const BindingFile& file, const std::string& action, const std::string& device = {}); /** The render model component an origin's input path names: the input's name, so /user/hand/left/input/trigger/click diff --git a/OpenOVR/Misc/Input/ExtHandInteractionProfile.cpp b/OpenOVR/Misc/Input/ExtHandInteractionProfile.cpp new file mode 100644 index 00000000..6365d055 --- /dev/null +++ b/OpenOVR/Misc/Input/ExtHandInteractionProfile.cpp @@ -0,0 +1,76 @@ +#include "stdafx.h" + +#include "ExtHandInteractionProfile.h" + +ExtHandInteractionProfile::ExtHandInteractionProfile(std::unique_ptr emulatedProfile, bool bindable) + : emulated(std::move(emulatedProfile)), bindable(bindable) +{ + // The profile's inputs, as XR_EXT_hand_interaction lists them + const char* perHandPaths[] = { + "/input/pinch_ext/pose", + "/input/poke_ext/pose", + "/input/grip/pose", + "/input/aim/pose", + "/input/pinch_ext/value", + "/input/pinch_ext/ready_ext", + "/input/grasp_ext/value", + "/input/grasp_ext/ready_ext", + "/input/aim_activate_ext/value", + "/input/aim_activate_ext/ready_ext", + }; + for (const char* str : perHandPaths) { + validInputPaths.insert("/user/hand/left" + std::string(str)); + validInputPaths.insert("/user/hand/right" + std::string(str)); + } + + // The pinch is the trigger and the grasp the grip; an Index controller's grip is also read by its force + rawSourceNames = { { "pinch_ext", "trigger" }, { "grasp_ext", "grip" } }; + for (const char* hand : { "/user/hand/left", "/user/hand/right" }) + extraRawComponents.emplace_back(std::string(hand) + "/input/grasp_ext/value", std::string(hand) + "/input/grip/force"); + + // The rest of the controller shown: its properties, reference poses and components, but the aim pose is the + // pointer (its tip) + CopyControllerFrom(*emulated); + leftComponentTransforms.erase("tip"); + rightComponentTransforms.erase("tip"); +} + +const std::string& ExtHandInteractionProfile::GetPath() const +{ + static const std::string path = "/interaction_profiles/ext/hand_interaction_ext"; + return path; +} + +std::optional ExtHandInteractionProfile::GetLeftHandRenderModelName() const +{ + return emulated->GetLeftHandRenderModelName(); +} + +std::optional ExtHandInteractionProfile::GetRightHandRenderModelName() const +{ + return emulated->GetRightHandRenderModelName(); +} + +std::optional ExtHandInteractionProfile::GetOpenVRName() const +{ + return emulated->GetOpenVRName(); +} + +std::optional ExtHandInteractionProfile::GetOpenVRTrackinglevel() const +{ + // The fingers are the hand's own + return vr::VRSkeletalTracking_Full; +} + +const InteractionProfile::LegacyBindings* ExtHandInteractionProfile::GetLegacyBindings(const std::string& handPath) const +{ + static LegacyBindings bindings = {}; + if (!bindings.trigger) { + bindings.trigger = "input/pinch_ext/value"; + bindings.triggerClick = "input/pinch_ext/value"; + bindings.grip = "input/grasp_ext/value"; + bindings.gripPoseAction = "input/grip/pose"; + bindings.aimPoseAction = "input/aim/pose"; + } + return &bindings; +} diff --git a/OpenOVR/Misc/Input/ExtHandInteractionProfile.h b/OpenOVR/Misc/Input/ExtHandInteractionProfile.h new file mode 100644 index 00000000..3f13a1b1 --- /dev/null +++ b/OpenOVR/Misc/Input/ExtHandInteractionProfile.h @@ -0,0 +1,31 @@ +// The hands as controllers (XR_EXT_hand_interaction): a pinch and a grasp, each a value, and the aim, grip, pinch and +// poke poses. Games see the hands as another controller (an Index controller unless the handController setting says +// otherwise): its controller type, render models and properties, and its binding files, the pinch being the trigger, +// the grasp the grip and the aim pose the pointer. Also the profile of a hand with no controller while hand tracking +// runs, which has no inputs then. +#pragma once + +#include "InteractionProfile.h" + +#include + +class ExtHandInteractionProfile : public InteractionProfile { +public: + /** emulated: the controller the hands are shown as. bindable: XR_EXT_hand_interaction is enabled, so the profile + * takes suggestions. */ + ExtHandInteractionProfile(std::unique_ptr emulated, bool bindable); + + const std::string& GetPath() const override; + std::optional GetLeftHandRenderModelName() const override; + std::optional GetRightHandRenderModelName() const override; + std::optional GetOpenVRName() const override; + std::optional GetOpenVRTrackinglevel() const override; + bool CanHaveBindings() const override { return bindable; } + +protected: + const LegacyBindings* GetLegacyBindings(const std::string& handPath) const override; + +private: + std::unique_ptr emulated; + bool bindable; +}; diff --git a/OpenOVR/Misc/Input/IndexControllerInteractionProfile.cpp b/OpenOVR/Misc/Input/IndexControllerInteractionProfile.cpp index 4f5d150d..b078ac62 100644 --- a/OpenOVR/Misc/Input/IndexControllerInteractionProfile.cpp +++ b/OpenOVR/Misc/Input/IndexControllerInteractionProfile.cpp @@ -53,7 +53,11 @@ IndexControllerInteractionProfile::IndexControllerInteractionProfile() this->propertiesMap = { { vr::Prop_TrackingSystemName_String, { "lighthouse" } }, { vr::Prop_ModelNumber_String, { "Knuckles Left", "Knuckles Right" } }, - { vr::Prop_ControllerType_String, { GetOpenVRName().value() } } + { vr::Prop_ControllerType_String, { GetOpenVRName().value() } }, + // As SteamVR answers for an Index controller: the third axis (Axis2) is the grip's force, and the buttons are the + // system, menu and grip ones and the first three axes + { vr::Prop_Axis2Type_Int32, { (int32_t)vr::k_eControllerAxis_Trigger } }, + { vr::Prop_SupportedButtons_Uint64, { (uint64_t)0x700000007ull } }, }; /* diff --git a/OpenOVR/Misc/Input/InteractionProfile.cpp b/OpenOVR/Misc/Input/InteractionProfile.cpp index 3a3265bc..874f5e55 100644 --- a/OpenOVR/Misc/Input/InteractionProfile.cpp +++ b/OpenOVR/Misc/Input/InteractionProfile.cpp @@ -9,6 +9,7 @@ #include #include +#include "ExtHandInteractionProfile.h" #include "HolographicInteractionProfile.h" #include "IndexControllerInteractionProfile.h" #include "InteractionProfile.h" @@ -49,10 +50,24 @@ std::vector> InteractionProfile::RawComponen const std::string& steamvrSource = renamed == rawSourceNames.end() ? source : renamed->second; raw.emplace_back(path, path.substr(0, sourceStart) + steamvrSource + "/" + component); } + for (const auto& extra : extraRawComponents) + if (validInputPaths.contains(extra.first)) + raw.push_back(extra); std::sort(raw.begin(), raw.end()); return raw; } +void InteractionProfile::CopyControllerFrom(const InteractionProfile& other) +{ + propertiesMap = other.propertiesMap; + leftComponentTransforms = other.leftComponentTransforms; + rightComponentTransforms = other.rightComponentTransforms; + leftHandGripTransform = other.leftHandGripTransform; + rightHandGripTransform = other.rightHandGripTransform; + leftHandPoses = other.leftHandPoses; + rightHandPoses = other.rightHandPoses; +} + const std::unordered_set& InteractionProfile::GetValidInputPaths() const { return validInputPaths; @@ -154,6 +169,20 @@ InteractionProfile::ProfileList InteractionProfile::CreateProfiles(XrExt& ext) } if (ext.ExtensionEnabled(XR_MSFT_HAND_INTERACTION_EXTENSION_NAME)) profiles.emplace_back(std::make_unique()); + // The hands as a controller: XR_EXT_hand_interaction's profile, also a hand's while hand tracking runs and no + // controller is in it + const bool handInteraction = ext.ExtensionEnabled(OC_XR_EXT_HAND_INTERACTION_EXTENSION_NAME); + const std::string& type = oovr_global_configuration.HandController(); + if (type != "off" && (handInteraction || ext.ExtensionEnabled(XR_EXT_HAND_TRACKING_EXTENSION_NAME))) { + std::unique_ptr emulated; + if (type == "oculus_touch") + emulated = std::make_unique(Touch::Model::Touch); + else if (type == "vive_controller") + emulated = std::make_unique(); + else + emulated = std::make_unique(); + profiles.emplace_back(std::make_unique(std::move(emulated), handInteraction)); + } profiles.emplace_back(std::make_unique()); profiles.emplace_back(std::make_unique()); return profiles; diff --git a/OpenOVR/Misc/Input/InteractionProfile.h b/OpenOVR/Misc/Input/InteractionProfile.h index 64be62ea..06715a44 100644 --- a/OpenOVR/Misc/Input/InteractionProfile.h +++ b/OpenOVR/Misc/Input/InteractionProfile.h @@ -231,6 +231,12 @@ class InteractionProfile { // OpenXR input source names SteamVR calls otherwise on this controller (RawComponents), for example // { "squeeze", "grip" }; a source not in it keeps its name std::map rawSourceNames; + // More raw inputs (OpenXR path, SteamVR raw input path), for a component that feeds a second SteamVR input + std::vector> extraRawComponents; + + /** Takes another controller's properties, reference poses, grip transforms and component transforms, for a + * profile shown to games as that controller */ + void CopyControllerFrom(const InteractionProfile& other); // A map for HMD properties. // Note that for a SteamVR supported device can be extracted from the SteamVR System Report, diff --git a/OpenOVR/Misc/Input/ViveTrackerRoles.cpp b/OpenOVR/Misc/Input/ViveTrackerRoles.cpp new file mode 100644 index 00000000..fa2ccfe8 --- /dev/null +++ b/OpenOVR/Misc/Input/ViveTrackerRoles.cpp @@ -0,0 +1,56 @@ +#include "stdafx.h" + +#include "ViveTrackerRoles.h" + +const std::vector& ViveTrackerRoles() +{ + // The roles of /interaction_profiles/htc/vive_tracker_htcx + static const std::vector roles = { + { "handheld_object", "" }, + { "left_foot", "/user/foot/left" }, + { "right_foot", "/user/foot/right" }, + { "left_shoulder", "/user/shoulder/left" }, + { "right_shoulder", "/user/shoulder/right" }, + { "left_elbow", "/user/elbow/left" }, + { "right_elbow", "/user/elbow/right" }, + { "left_knee", "/user/knee/left" }, + { "right_knee", "/user/knee/right" }, + { "left_wrist", "/user/wrist/left" }, + { "right_wrist", "/user/wrist/right" }, + { "left_ankle", "/user/ankle/left" }, + { "right_ankle", "/user/ankle/right" }, + { "waist", "/user/waist" }, + { "chest", "/user/chest" }, + { "camera", "/user/camera" }, + { "keyboard", "/user/keyboard" }, + }; + return roles; +} + +std::string ViveTrackerRolePath(const ViveTrackerRole& role) +{ + return std::string("/user/vive_tracker_htcx/role/") + role.name; +} + +std::string ViveTrackerControllerType(const ViveTrackerRole& role) +{ + return std::string("vive_tracker_") + role.name; +} + +std::optional ViveTrackerRoleForXrPath(const std::string& rolePath) +{ + for (const ViveTrackerRole& role : ViveTrackerRoles()) + if (ViveTrackerRolePath(role) == rolePath) + return role; + return std::nullopt; +} + +std::optional ViveTrackerRoleForSteamVRPath(const std::string& path) +{ + for (const ViveTrackerRole& role : ViveTrackerRoles()) { + const std::string base = role.steamvrPath; + if (!base.empty() && path.starts_with(base) && (path.size() == base.size() || path[base.size()] == '/')) + return role; + } + return std::nullopt; +} diff --git a/OpenOVR/Misc/Input/ViveTrackerRoles.h b/OpenOVR/Misc/Input/ViveTrackerRoles.h new file mode 100644 index 00000000..70bda3d7 --- /dev/null +++ b/OpenOVR/Misc/Input/ViveTrackerRoles.h @@ -0,0 +1,26 @@ +#pragma once + +// The roles a Vive tracker can have under XR_HTCX_vive_tracker_interaction, with what SteamVR calls them: the path +// a game's binding file binds a tracker's pose on (/user/waist) and the tracker's controller type. + +#include +#include +#include + +struct ViveTrackerRole { + const char* name; // the role's part of the OpenXR path: waist, left_foot + const char* steamvrPath; // /user/waist, /user/foot/left; empty for one SteamVR binds nothing on +}; + +/** Every role, in the extension's order */ +const std::vector& ViveTrackerRoles(); + +/** The role's OpenXR user path: /user/vive_tracker_htcx/role/waist */ +std::string ViveTrackerRolePath(const ViveTrackerRole& role); + +/** The role's controller type, as SteamVR names a tracker with that role: vive_tracker_waist */ +std::string ViveTrackerControllerType(const ViveTrackerRole& role); + +/** The role of an OpenXR role path, or of the path a game binds a tracker's pose on (and anything below it) */ +std::optional ViveTrackerRoleForXrPath(const std::string& rolePath); +std::optional ViveTrackerRoleForSteamVRPath(const std::string& path); diff --git a/OpenOVR/Misc/OverlayMaths.cpp b/OpenOVR/Misc/OverlayMaths.cpp index ea66dd5a..9587751a 100644 --- a/OpenOVR/Misc/OverlayMaths.cpp +++ b/OpenOVR/Misc/OverlayMaths.cpp @@ -262,4 +262,28 @@ XrPosef InversePose(const XrPosef& a) return Inverse(a); } +std::optional BeamPlacement(const XrVector3f& from, const XrVector3f& to, const XrVector3f& head, float thickness) +{ + const glm::vec3 a = V(from), b = V(to); + const float length = glm::length(b - a); + if (!(length >= 0.001f) || !(thickness > 0)) + return std::nullopt; + const glm::vec3 up = (b - a) / length; + const glm::vec3 middle = (a + b) * 0.5f; + // Towards the head, less what's along the beam; seen end on, any face across it + glm::vec3 face = V(head) - middle; + face -= up * glm::dot(face, up); + if (glm::length(face) < 1e-5f) + face = std::fabs(up.y) < 0.9f ? glm::vec3(0, 1, 0) - up * up.y : glm::vec3(1, 0, 0) - up * up.x; + face = glm::normalize(face); + const glm::vec3 right = glm::cross(up, face); + const glm::quat q = glm::normalize(glm::quat_cast(glm::mat3(right, up, face))); + Placement p{}; + p.pose = XrPosef{ { q.x, q.y, q.z, q.w }, { middle.x, middle.y, middle.z } }; + p.width = thickness; + p.height = length; + p.curvature = 0; + return p; +} + } // namespace overlay_maths diff --git a/OpenOVR/Misc/OverlayMaths.h b/OpenOVR/Misc/OverlayMaths.h index 5658ad51..0125d9f0 100644 --- a/OpenOVR/Misc/OverlayMaths.h +++ b/OpenOVR/Misc/OverlayMaths.h @@ -7,6 +7,7 @@ #include #include +#include #include // IVROverlay's intersection mask primitives (SetOverlayIntersectionMask) @@ -132,4 +133,9 @@ float SubtendedAngle(float width, float distance); XrPosef ComposePoses(const XrPosef& a, const XrPosef& b); XrPosef InversePose(const XrPosef& a); +// A laser's beam from one point to another as a quad thickness wide: its middle half way, its height (+Y) the beam's +// length along it, its face (+Z) turned as near the head as a quad along the beam can be. Nothing for a beam under a +// millimetre long. +std::optional BeamPlacement(const XrVector3f& from, const XrVector3f& to, const XrVector3f& head, float thickness); + } // namespace overlay_maths diff --git a/OpenOVR/Misc/ProgramEvents.cpp b/OpenOVR/Misc/ProgramEvents.cpp index 5f1e7de1..76384226 100644 --- a/OpenOVR/Misc/ProgramEvents.cpp +++ b/OpenOVR/Misc/ProgramEvents.cpp @@ -85,3 +85,64 @@ std::optional OcEventForProgram(const StoreEvent& s, uint32_t sel return std::nullopt; return OcUnpackEvent(s.eventType, s.data); } + +std::optional> OcPackOverlayCommand(const OcOverlayCommand& c) +{ + if (c.eventType >= (1u << 24)) + return std::nullopt; + std::array packed{}; + packed[0] = c.handle; + packed[1] = ((uint64_t)c.pid << 32) | ((uint64_t)c.kind << 24) | c.eventType; + switch (c.kind) { + case OcOverlayCommand::Alpha: + case OcOverlayCommand::Width: { + uint32_t bits = 0; + memcpy(&bits, &c.number, sizeof(bits)); + packed[2] = bits; + break; + } + case OcOverlayCommand::Flag: + packed[2] = c.flag; + packed[3] = c.enabled ? 1 : 0; + break; + case OcOverlayCommand::SortOrder: + packed[2] = c.sortOrder; + break; + case OcOverlayCommand::Event: + memcpy(&packed[2], c.data, sizeof(c.data)); + break; + default: + break; + } + return packed; +} + +OcOverlayCommand OcUnpackOverlayCommand(const uint64_t (&packed)[4]) +{ + OcOverlayCommand c; + c.handle = packed[0]; + c.pid = (uint32_t)(packed[1] >> 32); + c.kind = (OcOverlayCommand::Kind)(uint8_t)(packed[1] >> 24); + c.eventType = (uint32_t)(packed[1] & 0xFFFFFF); + switch (c.kind) { + case OcOverlayCommand::Alpha: + case OcOverlayCommand::Width: { + const uint32_t bits = (uint32_t)packed[2]; + memcpy(&c.number, &bits, sizeof(bits)); + break; + } + case OcOverlayCommand::Flag: + c.flag = (uint32_t)packed[2]; + c.enabled = packed[3] != 0; + break; + case OcOverlayCommand::SortOrder: + c.sortOrder = (uint32_t)packed[2]; + break; + case OcOverlayCommand::Event: + memcpy(c.data, &packed[2], sizeof(c.data)); + break; + default: + break; + } + return c; +} diff --git a/OpenOVR/Misc/ProgramEvents.h b/OpenOVR/Misc/ProgramEvents.h index a12902aa..57279ccc 100644 --- a/OpenOVR/Misc/ProgramEvents.h +++ b/OpenOVR/Misc/ProgramEvents.h @@ -19,6 +19,9 @@ constexpr uint32_t OcEvent_RemotePointer = OcEvent_First; // An event for one program only: data[0..1] the event's data's first 16 bytes, data[2] its type (low 32 bits) and the // process id it's for (high 32 bits), data[3] the device constexpr uint32_t OcEvent_ToProgram = OcEvent_First + 1; +// A change to an overlay of the one program it's for, asked for by another program through FindOverlay's handle for +// it: that program applies it (OcOverlayCommand) +constexpr uint32_t OcEvent_OverlayCommand = OcEvent_First + 2; constexpr uint32_t OcEvent_Last = vr::VREvent_VendorSpecific_Reserved_Start + 99; inline bool OcIsPrivateEvent(uint32_t eventType) { @@ -46,3 +49,31 @@ void OcSetLocalEventSink(OcLocalEventSink sink); * other program gets the event with that part zeroed. */ std::array OcPackEvent(vr::TrackedDeviceIndex_t device, const vr::VREvent_Data_t& data); vr::VREvent_t OcUnpackEvent(uint32_t eventType, const uint64_t (&packed)[4]); + +/** What another program asks of an overlay (OcEvent_OverlayCommand). Show and Hide take nothing; Alpha and Width a + * float (number); Flag the flag's bit number (flag) and whether it's set (enabled); SortOrder a number; Event an overlay + * event of eventType with the first 16 bytes of its data (data), as PostOverlayEvent posts it. */ +struct OcOverlayCommand { + enum Kind : uint8_t { + Show = 1, + Hide, + Alpha, + Width, + Flag, + SortOrder, + Event, + }; + uint32_t pid = 0; // the program whose overlay it is + uint64_t handle = 0; // the overlay's handle in that program + Kind kind = Show; + uint32_t eventType = 0; // an Event's, below 2^24 + float number = 0; + uint32_t flag = 0; + bool enabled = false; + uint32_t sortOrder = 0; + uint8_t data[16] = {}; +}; +/** A command as it crosses between programs: data[0] the handle, data[1] the pid (high 32 bits), the kind (the next 8) + * and an event's type (the low 24), data[2..3] what it takes; and back. Nothing for an event type of 2^24 or more. */ +std::optional> OcPackOverlayCommand(const OcOverlayCommand& command); +OcOverlayCommand OcUnpackOverlayCommand(const uint64_t (&packed)[4]); diff --git a/OpenOVR/Misc/SharedStore.cpp b/OpenOVR/Misc/SharedStore.cpp index 7a5c0744..e950f851 100644 --- a/OpenOVR/Misc/SharedStore.cpp +++ b/OpenOVR/Misc/SharedStore.cpp @@ -4,14 +4,17 @@ #include "Misc/Process.h" +#include #include #include +#include #include #include #include #include #include #include +#include #ifdef _WIN32 #include @@ -23,6 +26,7 @@ #include #include #include +#include #include #endif @@ -409,6 +413,22 @@ class StoreFileLock { const bool held; }; +struct SharedStore::Later { + struct Edit { + uint64_t id; + StoreDoc doc; + std::string key; + std::function edit; + }; + uint64_t nextId = 1; + std::mutex m; + std::condition_variable cv; + std::vector queue; + std::thread thread; + bool stop = false; + bool writing = false; // the writer thread is making edits it took +}; + SharedStore& SharedStore::Get() { // Never destroyed: the backend writes to it from static destructors at exit, which may run after this one would @@ -417,7 +437,7 @@ SharedStore& SharedStore::Get() } SharedStore::SharedStore(const fs::path& directory) - : dir(directory), platform(std::make_unique()) + : dir(directory), platform(std::make_unique()), later(std::make_unique()) { std::error_code ec; if (dir.empty()) @@ -457,7 +477,87 @@ SharedStore::SharedStore(const fs::path& directory) state = view; } -SharedStore::~SharedStore() = default; +SharedStore::~SharedStore() +{ + // The writer thread ends, and what it hadn't made is made here (Get's store is never destroyed) + { + std::lock_guard guard(later->m); + later->stop = true; + } + later->cv.notify_all(); + if (later->thread.joinable()) + later->thread.join(); + for (StoreDoc doc : { StoreDoc::Settings, StoreDoc::Applications, StoreDoc::Chaperone, StoreDoc::Scene, StoreDoc::Dashboard, StoreDoc::Overlays, StoreDoc::Offsets }) + WriteUpdate(doc, nullptr, Wait::UpToTwoSeconds, true); +} + +void SharedStore::UpdateLater(StoreDoc doc, const std::string& key, std::function edit) +{ + if (!Usable() || !edit) + return; + std::lock_guard guard(later->m); + if (later->stop) + return; + if (!key.empty()) { + auto& q = later->queue; + q.erase(std::remove_if(q.begin(), q.end(), [&](const Later::Edit& e) { return e.doc == doc && e.key == key; }), q.end()); + } + later->queue.push_back({ later->nextId++, doc, key, std::move(edit) }); + if (!later->thread.joinable()) + later->thread = std::thread([this] { WriterLoop(); }); + later->cv.notify_all(); +} + +std::vector>> SharedStore::PendingEdits(StoreDoc doc) +{ + std::vector>> edits; + std::lock_guard guard(later->m); + for (const Later::Edit& e : later->queue) + if (e.doc == doc) + edits.emplace_back(e.id, e.edit); + return edits; +} + +void SharedStore::WriterLoop() +{ + std::unique_lock guard(later->m); + std::map failures; // tries in a row that wrote nothing, per document + while (true) { + later->cv.wait(guard, [&] { return later->stop || !later->queue.empty(); }); + if (later->stop) + return; + const StoreDoc doc = later->queue.front().doc; + later->writing = true; + guard.unlock(); + // The document's edits are made under the store's lock; none left (an Update made them): nothing written + const bool written = WriteUpdate(doc, nullptr, Wait::UpToTwoSeconds, true); + guard.lock(); + later->writing = false; + const bool left = std::any_of(later->queue.begin(), later->queue.end(), [&](const Later::Edit& e) { return e.doc == doc; }); + if (written || !left) { + failures.erase(doc); + } else if (++failures[doc] >= 5) { + // The store's lock not had for seconds on end (or the document can't be written): these edits are dropped + OOVR_LOGF("Store document %d: edits from the frame dropped, it couldn't be written", (int)doc); + auto& q = later->queue; + q.erase(std::remove_if(q.begin(), q.end(), [&](const Later::Edit& e) { return e.doc == doc; }), q.end()); + failures.erase(doc); + } else { + // Tried again shortly, after the other documents' edits (moved behind them) + auto& q = later->queue; + std::stable_partition(q.begin(), q.end(), [&](const Later::Edit& e) { return e.doc != doc; }); + if (q.front().doc == doc) + later->cv.wait_for(guard, std::chrono::milliseconds(100), [&] { return later->stop; }); + } + later->cv.notify_all(); + } +} + +void SharedStore::Flush() +{ + std::unique_lock guard(later->m); + later->cv.wait_for(guard, std::chrono::seconds(5), [&] { return later->queue.empty() && !later->writing; }); +} SharedStore::Header* SharedStore::header() const { @@ -484,14 +584,46 @@ Json::Value SharedStore::Read(StoreDoc doc) if (!Usable()) return Json::Value(Json::objectValue); Refresh(doc); - std::lock_guard guard(lock); - return cache[doc].data; + Json::Value data; + std::vector> edits; + { + // Both at once, in Update's order: the cached copy and the edits not yet in it + std::lock_guard queued(later->m); + std::lock_guard guard(lock); + data = cache[doc].data; + for (const Later::Edit& e : later->queue) + if (e.doc == doc) + edits.push_back(e.edit); + } + // With this process's edits not yet made + for (const auto& edit : edits) { + try { + edit(data); + } catch (const std::exception&) { + } + } + if (!data.isObject()) + data = Json::Value(Json::objectValue); + return data; } Json::Value SharedStore::ReadAt(StoreDoc doc, const std::vector& path) { if (!Usable()) return Json::Value(); + if (!PendingEdits(doc).empty()) { + // With this process's edits not yet made + const Json::Value data = Read(doc); + const Json::Value* v = &data; + for (const std::string& name : path) { + if (!v->isObject()) + return Json::Value(); + v = v->find(name.data(), name.data() + name.size()); + if (!v) + return Json::Value(); + } + return *v; + } Refresh(doc); std::lock_guard guard(lock); const Json::Value* v = &cache[doc].data; @@ -543,17 +675,19 @@ void SharedStore::Refresh(StoreDoc doc) } bool SharedStore::Update(StoreDoc doc, const std::function& edit, Wait wait) +{ + return WriteUpdate(doc, &edit, wait, false); +} + +bool SharedStore::WriteUpdate(StoreDoc doc, const std::function* edit, Wait wait, bool pendingOnly) { if (!Usable()) return false; // Not the cache's lock: Read and PollEvents mustn't wait while this waits for another process - std::unique_lock writing(writeLock, std::defer_lock); - if (wait == Wait::Never) { - if (!writing.try_lock()) - return false; - } else { - writing.lock(); - } + std::unique_lock writing(writeLock, std::defer_lock); + // Bounded: a writer thread ended mid-write at exit doesn't hold the others up for ever + if (wait == Wait::Never ? !writing.try_lock() : !writing.try_lock_for(std::chrono::seconds(2))) + return false; StoreFileLock fileLock(*platform, wait != Wait::Never); if (!fileLock.held) return false; @@ -595,8 +729,21 @@ bool SharedStore::Update(StoreDoc doc, const std::functiongenerations[(int)doc]) + 1; Store(header()->generations[(int)doc], generation); + // The cache and the queue together: a read never sees the edits both written and still pending, or neither + std::lock_guard queued(later->m); std::lock_guard guard(lock); cache[doc] = { generation, data, true }; + if (!pending.empty()) { + auto& q = later->queue; + q.erase(std::remove_if(q.begin(), q.end(), [&](const Later::Edit& e) { + return std::any_of(pending.begin(), pending.end(), [&](const auto& p) { return p.first == e.id; }); + }), + q.end()); + later->cv.notify_all(); + } return true; } @@ -637,13 +794,10 @@ bool SharedStore::PostEvent(uint32_t eventType, const std::array& d { if (!Usable()) return false; - std::unique_lock writing(writeLock, std::defer_lock); - if (wait == Wait::Never) { - if (!writing.try_lock()) - return false; - } else { - writing.lock(); - } + std::unique_lock writing(writeLock, std::defer_lock); + // Bounded: a writer thread ended mid-write at exit doesn't hold the others up for ever + if (wait == Wait::Never ? !writing.try_lock() : !writing.try_lock_for(std::chrono::seconds(2))) + return false; StoreFileLock fileLock(*platform, wait != Wait::Never); if (!fileLock.held) return false; @@ -772,6 +926,66 @@ bool SharedStore::IsSameProcessAlive(uint32_t pid, uint64_t start) return ProcessStartTime(pid) == start; } +bool SharedStore::KillProcess(uint32_t pid, uint64_t start) +{ + if (pid == 0 || start == 0) + return false; +#ifdef _WIN32 + // The start time read from the handle that ends it: the pid can't be another process's by then + HANDLE process = OpenProcess(PROCESS_TERMINATE | PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid); + if (!process) + return false; + FILETIME created{}, exited{}, kernel{}, user{}; + bool killed = false; + if (GetProcessTimes(process, &created, &exited, &kernel, &user) + && (((uint64_t)created.dwHighDateTime << 32) | created.dwLowDateTime) == start) + killed = TerminateProcess(process, 1) != 0; + CloseHandle(process); + return killed; +#else +#if defined(SYS_pidfd_open) && defined(SYS_pidfd_send_signal) + // A pidfd names the process itself: checked after it's opened, the signal can't reach another that took the pid + const int fd = (int)syscall(SYS_pidfd_open, (pid_t)pid, 0); + if (fd >= 0) { + const bool same = ProcessStartTime(pid) == start; + const bool killed = same && syscall(SYS_pidfd_send_signal, fd, SIGKILL, nullptr, 0) == 0; + close(fd); + return killed; + } +#endif + // Without pidfds: checked just before + if (ProcessStartTime(pid) != start) + return false; + return kill((pid_t)pid, SIGKILL) == 0; +#endif +} + +uint64_t SharedStore::KnownProcessStart(uint32_t pid) +{ + if (pid == 0) + return 0; + const std::string name = std::to_string(pid); + std::vector starts; + auto add = [&](const Json::Value& v) { + if (v.isUInt64() && v.asUInt64()) + starts.push_back(v.asUInt64()); + }; + const Json::Value apps = Read(StoreDoc::Applications); + if (apps["pid_starts"].isObject()) + add(apps["pid_starts"][name]); + const Json::Value scene = Read(StoreDoc::Scene); + if (scene.isObject() && scene["pid"].isUInt() && scene["pid"].asUInt() == pid) + add(scene["start"]); + const Json::Value overlays = Read(StoreDoc::Overlays); + if (overlays.isObject() && overlays[name].isObject()) + add(overlays[name]["start"]); + const uint64_t now = ProcessStartTime(pid); + for (uint64_t start : starts) + if (start == now) + return start; + return 0; +} + bool SharedStore::OtherLiveProgram(const Json::Value& overlaysDoc, uint32_t self) { if (!overlaysDoc.isObject()) diff --git a/OpenOVR/Misc/SharedStore.h b/OpenOVR/Misc/SharedStore.h index 2400af9f..0496d66b 100644 --- a/OpenOVR/Misc/SharedStore.h +++ b/OpenOVR/Misc/SharedStore.h @@ -64,6 +64,16 @@ class SharedStore { * format (which is read but never written), or the lock wasn't had in time */ bool Update(StoreDoc doc, const std::function& edit, Wait wait = Wait::UpToTwoSeconds); + /** Update from the game's frame: the edit is made on the process's writer thread (one per store), so the frame + * never waits for the store's lock or its file. A later edit with the same non-empty key replaces one not yet + * made (only the last of them is made); edits without a key are all made, in order. Reads in this process see + * the edits not yet made, and an Update of the document makes them first. The edit is kept and called later, + * maybe more than once (each read before it's made): it captures by value. */ + void UpdateLater(StoreDoc doc, const std::string& key, std::function edit); + + /** Waits, a few seconds at most, until the edits UpdateLater was given so far are made (or given up on) */ + void Flush(); + /** Changes with every Update of the document, in any process; 0 if the store can't be used */ uint64_t Generation(StoreDoc doc); @@ -85,6 +95,12 @@ class SharedStore { /** Whether pid is running and is the process that started at start; with start 0 (an entry written without it), * whether any process with that pid is running */ static bool IsSameProcessAlive(uint32_t pid, uint64_t start); + /** Ends pid at once if it's the process that started at start (not 0), checked as near to the kill as the system + * allows; false if it isn't, or couldn't be ended */ + static bool KillProcess(uint32_t pid, uint64_t start); + /** The start time the store has for a pid (the Applications document's processes, the scene's, the overlay + * programs'), if it's still that process; 0 for a pid the store doesn't know or that's gone */ + uint64_t KnownProcessStart(uint32_t pid); /** Whether a program other than self has an entry in the Overlays document and is still running */ static bool OtherLiveProgram(const Json::Value& overlaysDoc, uint32_t self); /** The same, or the Scene document's scene application (other than self) is still running */ @@ -110,7 +126,7 @@ class SharedStore { std::unique_ptr platform; uint8_t* state = nullptr; // state.bin, mapped - std::mutex writeLock; // this store's writers, which share its lock file handle + std::timed_mutex writeLock; // this store's writers, which share its lock file handle std::mutex lock; // the cache and ownEvents struct Cached { uint64_t generation = 0; @@ -119,4 +135,13 @@ class SharedStore { }; std::map cache; std::set ownEvents; // seqs this store posted, which its own polls skip + + // UpdateLater's edits not yet made, and the writer thread that makes them + struct Later; + std::unique_ptr later; + /** The document's edits not yet made, with their ids */ + std::vector>> PendingEdits(StoreDoc doc); + /** Update, making the pending edits first (and, with pendingOnly, writing nothing if there are none) */ + bool WriteUpdate(StoreDoc doc, const std::function* edit, Wait wait, bool pendingOnly); + void WriterLoop(); }; diff --git a/OpenOVR/Misc/StbJpeg.h b/OpenOVR/Misc/StbJpeg.h new file mode 100644 index 00000000..6a6f6b72 --- /dev/null +++ b/OpenOVR/Misc/StbJpeg.h @@ -0,0 +1,10 @@ +#pragma once + +#include "Misc/Image.h" + +#include +#include + +/** A JPEG file's bytes as RGBA8 (stb_image), at most kMaxImageFileSide pixels on a side; nothing (with why) for bytes + * that aren't a JPEG it can read, or are too big */ +std::optional DecodeJpeg(const std::string& bytes, std::string* why); diff --git a/OpenOVR/Misc/SteamVRRenderModels.cpp b/OpenOVR/Misc/SteamVRRenderModels.cpp index 19c71aa6..8670b2b2 100644 --- a/OpenOVR/Misc/SteamVRRenderModels.cpp +++ b/OpenOVR/Misc/SteamVRRenderModels.cpp @@ -7,12 +7,15 @@ #include "Misc/AppManifest.h" #include "Misc/JsonFile.h" #include "Misc/Numbers.h" +#include "Misc/StbJpeg.h" #include "Misc/SteamVRPaths.h" #include +#include #include #include #include +#include #include #include #include @@ -22,6 +25,10 @@ #include #include +#ifndef _WIN32 +#include +#endif + namespace fs = std::filesystem; namespace { @@ -325,9 +332,20 @@ fs::path SteamVRRenderModelFolder(const fs::path& steamvr, const std::string& na } std::optional LoadSteamVRRenderModel(const fs::path& steamvr, const std::string& name) +{ + fs::path folder; + try { + folder = SteamVRRenderModelFolder(steamvr, name); + } catch (const std::exception& e) { + OOVR_LOGF("Render model %s can't be read: %s", name.c_str(), e.what()); + return std::nullopt; + } + return LoadRenderModelFolder(folder, name); +} + +std::optional LoadRenderModelFolder(const fs::path& folder, const std::string& name) { try { - fs::path folder = SteamVRRenderModelFolder(steamvr, name); if (folder.empty() || !IsDirectory(folder)) return std::nullopt; fs::path stem = PathFromUtf8(FileStem(name)); @@ -644,6 +662,17 @@ std::optional LoadRenderModelMesh(const RmModel& model, const std::strin if (mesh.indices.empty()) return std::nullopt; SetTextures(mesh, vertexTextures); + const XrPosef& s = model.space; + if (s.orientation.w != 1 || s.position.x != 0 || s.position.y != 0 || s.position.z != 0) { + glm::quat rot = glm::normalize(glm::quat(s.orientation.w, s.orientation.x, s.orientation.y, s.orientation.z)); + glm::vec3 pos(s.position.x, s.position.y, s.position.z); + for (RmVertex& v : mesh.vertices) { + glm::vec3 p = rot * glm::vec3(v.vPosition.v[0], v.vPosition.v[1], v.vPosition.v[2]) + pos; + glm::vec3 n = rot * glm::vec3(v.vNormal.v[0], v.vNormal.v[1], v.vNormal.v[2]); + v.vPosition = V3(p); + v.vNormal = V3(n); + } + } return mesh; } @@ -732,6 +761,14 @@ std::optional DecodeTga(const std::string& bytes, std::string* why) return image; } +// A file that starts as a JPEG does +bool IsJpeg(const fs::path& file) +{ + std::ifstream in(file, std::ios::binary); + unsigned char magic[3] = {}; + return in.read((char*)magic, 3) && magic[0] == 0xFF && magic[1] == 0xD8 && magic[2] == 0xFF; +} + bool IsTga(const fs::path& file) { std::string ext = PathToUtf8(file.extension()); @@ -749,6 +786,11 @@ std::optional LoadRenderModelTexture(const fs::path& file) image = bytes ? DecodeTga(*bytes, &why) : std::nullopt; if (!bytes) why = "it can't be read, or is too big"; + } else if (IsJpeg(file)) { + std::optional bytes = ReadFile(file, kMaxImageFileBytes); + image = bytes ? DecodeJpeg(*bytes, &why) : std::nullopt; + if (!bytes) + why = "it can't be read, or is too big"; } else { image = LoadImageFile(file, &why); } @@ -879,6 +921,39 @@ XrPosef ComponentPose(const RmComponent& c, float value, vr::HmdVector2_t axis) return ToPose(r); } +namespace { +Rigid SpaceOf(const RmModel& model) +{ + const XrPosef& s = model.space; + return Rigid{ glm::normalize(glm::quat(s.orientation.w, s.orientation.x, s.orientation.y, s.orientation.z)), + glm::vec3(s.position.x, s.position.y, s.position.z) }; +} + +Rigid FromPose(const XrPosef& p) +{ + return Rigid{ glm::quat(p.orientation.w, p.orientation.x, p.orientation.y, p.orientation.z), + glm::vec3(p.position.x, p.position.y, p.position.z) }; +} + +Rigid Inverse(const Rigid& r) +{ + glm::quat inv = glm::inverse(r.rot); + return Rigid{ inv, -(inv * r.pos) }; +} +} // namespace + +XrPosef ModelComponentPose(const RmModel& model, const RmComponent& c, float value, vr::HmdVector2_t axis) +{ + // The motion is in the files' space: there, then back + Rigid space = SpaceOf(model); + return ToPose(Then(space, Then(FromPose(ComponentPose(c, value, axis)), Inverse(space)))); +} + +XrPosef ModelComponentLocal(const RmModel& model, const RmComponent& c) +{ + return ToPose(Then(SpaceOf(model), FromPose(c.local))); +} + bool ComponentVisible(const RmComponent& c, bool touched, bool pressed) { const Json::Value& vis = c.visibility; @@ -936,3 +1011,140 @@ const std::vector& SteamVRRenderModelNames() Install() ? ListSteamVRRenderModels(*Install()) : std::vector()); return names; } + +namespace { +// The folder of the library (or program) this code is in; empty if it can't be told +fs::path LibraryFolder() +{ +#ifdef _WIN32 + HMODULE module = nullptr; + if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + (LPCWSTR)&LibraryFolder, &module)) + return {}; + std::wstring buffer(MAX_PATH, L'\0'); + for (;;) { + DWORD n = GetModuleFileNameW(module, buffer.data(), (DWORD)buffer.size()); + if (n == 0) + return {}; + if (n < buffer.size()) { + buffer.resize(n); + break; + } + if (buffer.size() >= 32768) + return {}; + buffer.resize(buffer.size() * 2); + } + return fs::path(buffer).parent_path(); +#else + Dl_info info{}; + if (!dladdr((void*)&LibraryFolder, &info) || !info.dli_fname) + return {}; + return fs::path(info.dli_fname).parent_path(); +#endif +} +} // namespace + +fs::path OwnRenderModelsFolder() +{ + // A test's folder where it names one; else the one beside the library, found once + const char* testDir = getenv("OC_TEST_RENDERMODELS_DIR"); + if (testDir && *testDir) + return PathFromUtf8(testDir); + static const fs::path& folder = *[] { + auto* found = new fs::path; + try { + fs::path lib = LibraryFolder(); + if (!lib.empty()) { + lib = fs::absolute(lib); + for (const fs::path& candidate : { lib / "rendermodels", lib.parent_path() / "rendermodels" }) { + if (IsDirectory(candidate)) { + *found = candidate; + break; + } + } + } + } catch (const std::exception& e) { + OOVR_LOGF("OpenLamina's controller models can't be found: %s", e.what()); + } + if (found->empty()) + OOVR_LOG("OpenLamina's controller models aren't installed beside the library"); + return found; + }(); + return folder; +} + +namespace { +// "-": the profile's folder, or empty for a name that isn't one +std::string OwnModelProfile(const std::string& name) +{ + for (const char* hand : { "-left", "-right" }) { + size_t n = strlen(hand); + if (name.size() > n && name.compare(name.size() - n, n, hand) == 0) { + std::string profile = name.substr(0, name.size() - n); + return IsPlainName(profile) ? profile : std::string(); + } + } + return {}; +} +} // namespace + +std::shared_ptr FindOwnRenderModel(const std::string& name, const XrPosef& space) +{ + const fs::path root = OwnRenderModelsFolder(); + std::string profile = OwnModelProfile(name); + if (root.empty() || profile.empty() || !IsPlainName(name)) + return nullptr; + // By folder, name and space: a test can name another folder, and the space is known once there's an instance + using Key = std::tuple>; + static std::map>& cache = *new std::map>; + const Key key(root, name, + std::array{ space.orientation.x, space.orientation.y, space.orientation.z, space.orientation.w, + space.position.x, space.position.y, space.position.z }); + { + std::lock_guard guard(ModelsLock()); + auto it = cache.find(key); + if (it != cache.end()) + return it->second; + } + std::shared_ptr model; + try { + std::optional loaded = LoadRenderModelFolder(root / PathFromUtf8(profile), name); + if (loaded) { + loaded->space = space; + model = std::make_shared(std::move(*loaded)); + } + } catch (const std::exception& e) { + OOVR_LOGF("Render model %s can't be read: %s", name.c_str(), e.what()); + } + std::lock_guard guard(ModelsLock()); + // Only names that are a model's folder get here: a few dozen at most + cache.emplace(key, model); + return model; +} + +const std::vector& OwnRenderModelNames() +{ + // By folder, each read once: a test can name another folder + static std::map>& byFolder = *new std::map>; + const fs::path root = OwnRenderModelsFolder(); + std::lock_guard guard(ModelsLock()); + auto found = byFolder.find(root); + if (found != byFolder.end()) + return found->second; + std::vector& all = byFolder[root]; + if (root.empty()) + return all; + std::error_code ec; + for (fs::directory_iterator it(root, ec), end; !ec && it != end; it.increment(ec)) { + std::string profile = PathToUtf8(it->path().filename()); + if (!IsPlainName(profile)) + continue; + for (const char* hand : { "-left", "-right" }) { + fs::path json = it->path() / PathFromUtf8(profile + hand + ".json"); + if (IsFile(json)) + all.push_back(profile + hand); + } + } + std::sort(all.begin(), all.end()); + return all; +} diff --git a/OpenOVR/Misc/SteamVRRenderModels.h b/OpenOVR/Misc/SteamVRRenderModels.h index 4091ebac..b9ce21b1 100644 --- a/OpenOVR/Misc/SteamVRRenderModels.h +++ b/OpenOVR/Misc/SteamVRRenderModels.h @@ -6,7 +6,10 @@ // A model's folder holds .obj (the whole model) and, optionally, .json, whose "components" name the parts // that move or that games attach things to: each with its own OBJ ("filename", in the model's coordinates), its local // frame ("component_local": "origin" and "rotate_xyz" in degrees) and how it moves ("motion"). An OBJ's material -// library names each material's texture (map_Kd); textures are read as PNG or TGA. +// library names each material's texture (map_Kd); textures are read as PNG, JPEG or TGA. +// +// OpenLamina's own controller models (made from the WebXR Input Profiles by scripts/rendermodels.py) are in the same +// layout, in a folder installed beside the library: rendermodels//-.json, in grip space. #include "Misc/Image.h" #include "generated/interfaces/deleted_types.h" @@ -39,6 +42,9 @@ struct RmModel { std::vector components; std::filesystem::path folder; std::string thumbnail; // the "thumbnail" file, relative to the folder; empty for none + // Where the model's files are in the space games get the model in: identity for SteamVR's; for OpenLamina's own, + // the grip in the device's space. The meshes are moved by it as they're loaded, and the components' motion with them. + XrPosef space = { { 0, 0, 0, 1 }, { 0, 0, 0 } }; }; // A model's (or one component's) triangles, ready for RenderModel_t @@ -70,6 +76,10 @@ std::filesystem::path SteamVRRenderModelFolder(const std::filesystem::path& stea * Never throws. */ std::optional LoadSteamVRRenderModel(const std::filesystem::path& steamvr, const std::string& name); +/** A model of that name from its folder: /.json and the files it names, the stem being the name without a + * driver's "{}". As LoadSteamVRRenderModel otherwise. */ +std::optional LoadRenderModelFolder(const std::filesystem::path& folder, const std::string& name); + /** Reads an OBJ's triangles from its text (faces of more than three corners as fans; negative indices count back), one * vertex for each distinct position/UV/normal corner of a material. v is turned into 1 - v: OBJ's v starts at the * texture's bottom row, a RenderModel_TextureMap_t's first row is its top. Positions and normals are as the text has @@ -86,12 +96,12 @@ bool LoadObj(const std::filesystem::path& obj, std::vector& verts, std std::optional LoadObjMesh(const std::filesystem::path& obj); /** The triangles of a model: its component's OBJ, or with an empty component name .obj, else (if there is - * none) every component with an OBJ that's visible by default, together, with every material's texture. - * nullopt if there's nothing to draw. */ + * none) every component with an OBJ that's visible by default, together, with every material's texture; moved by the + * model's space. nullopt if there's nothing to draw. */ std::optional LoadRenderModelMesh(const RmModel& model, const std::string& component); -/** A texture file as RGBA8: a TGA file (true-colour or greyscale, plain or run-length encoded) by its extension, - * anything else through LoadImageFile. nullopt (logged) for a file it refuses. */ +/** A texture file as RGBA8: a TGA file (true-colour or greyscale, plain or run-length encoded) by its extension, a + * JPEG by its first bytes, anything else through LoadImageFile. nullopt (logged) for a file it refuses. */ std::optional LoadRenderModelTexture(const std::filesystem::path& file); /** A mesh's textures (RmMesh::textures) as one image: the texture itself for one; for several their atlas, each @@ -116,6 +126,10 @@ std::vector BuildMipChain(const Image& base, uint32_t levels); * Other types (and none) are static. */ XrPosef ComponentPose(const RmComponent& c, float value, vr::HmdVector2_t axis); +/** ComponentPose, and the component's local frame, in the space games get the model in (moved by its space) */ +XrPosef ModelComponentPose(const RmModel& model, const RmComponent& c, float value, vr::HmdVector2_t axis); +XrPosef ModelComponentLocal(const RmModel& model, const RmComponent& c); + /** Whether a component is drawn: "visibility"'s "default" (true without one), else its "touch" or "press" entry * while touched or pressed */ bool ComponentVisible(const RmComponent& c, bool touched, bool pressed); @@ -126,3 +140,16 @@ std::shared_ptr FindSteamVRRenderModel(const std::string& name); /** The SteamVR install's model names (ListSteamVRRenderModels), read once. Empty without SteamVR. */ const std::vector& SteamVRRenderModelNames(); + +/** The folder of OpenLamina's own controller models: rendermodels beside the library, else beside the folder it's in + * (one copy serves bin/ and bin/linux64/); OC_TEST_RENDERMODELS_DIR instead where it's set. Empty if there is none. */ +std::filesystem::path OwnRenderModelsFolder(); + +/** One of OpenLamina's own models by name ("-left" or "-right"), its files in grip space put at + * space (RmModel::space), cached by name and space for the process (a failure too). Null for a name that isn't one, + * or without the folder. Thread-safe. */ +std::shared_ptr FindOwnRenderModel(const std::string& name, const XrPosef& space); + +/** The names of OpenLamina's own models (each -.json of the folder), sorted; read once for each folder. + * Thread-safe. */ +const std::vector& OwnRenderModelNames(); diff --git a/OpenOVR/Misc/stb_image.cpp b/OpenOVR/Misc/stb_image.cpp new file mode 100644 index 00000000..d3f15716 --- /dev/null +++ b/OpenOVR/Misc/stb_image.cpp @@ -0,0 +1,64 @@ +// stb_image (BundledLibs/stb_image.h, public domain), for the JPEG textures of the controller models +#include "stdafx.h" + +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#pragma GCC diagnostic ignored "-Wdouble-promotion" +#pragma GCC diagnostic ignored "-Wconversion" +#elif defined(_MSC_VER) +#pragma warning(push, 0) +#endif + +#define STB_IMAGE_IMPLEMENTATION +#define STB_IMAGE_STATIC +#define STBI_ONLY_JPEG +#define STBI_NO_STDIO +#define STBI_NO_HDR +#define STBI_NO_LINEAR +#define STBI_NO_THREAD_LOCALS +#include "stb_image.h" + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#elif defined(_MSC_VER) +#pragma warning(pop) +#endif + +#include "Misc/StbJpeg.h" + +#include + +std::optional DecodeJpeg(const std::string& bytes, std::string* why) +{ + auto fail = [&](const char* reason) -> std::optional { + if (why) + *why = reason; + return std::nullopt; + }; + if (bytes.size() > (size_t)INT_MAX) + return fail("it's too big"); + int width = 0, height = 0, channels = 0; + const auto* data = (const stbi_uc*)bytes.data(); + if (!stbi_info_from_memory(data, (int)bytes.size(), &width, &height, &channels)) + return fail("it isn't a JPEG image it can read"); + if (width <= 0 || height <= 0 || (uint32_t)width > kMaxImageFileSide || (uint32_t)height > kMaxImageFileSide) + return fail("it's bigger than 8192 pixels on a side"); + stbi_uc* pixels = stbi_load_from_memory(data, (int)bytes.size(), &width, &height, &channels, 4); + if (!pixels) + return fail("it's damaged"); + Image image; + image.width = (uint32_t)width; + image.height = (uint32_t)height; + try { + image.rgba.assign(pixels, pixels + (size_t)width * (size_t)height * 4); + } catch (const std::exception&) { + stbi_image_free(pixels); + return fail("it's too big for memory"); + } + stbi_image_free(pixels); + return image; +} diff --git a/OpenOVR/Misc/xr_ext.h b/OpenOVR/Misc/xr_ext.h index 9e25a6ea..ceea9030 100644 --- a/OpenOVR/Misc/xr_ext.h +++ b/OpenOVR/Misc/xr_ext.h @@ -88,6 +88,22 @@ struct OcXrSystemUserPresencePropertiesEXT { XrBool32 supportsUserPresence; }; +// XR_HTCX_vive_tracker_interaction, newer than the bundled OpenXR headers: Vive trackers by their role +#define OC_XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME "XR_HTCX_vive_tracker_interaction" +static const XrStructureType OC_XR_TYPE_VIVE_TRACKER_PATHS_HTCX = (XrStructureType)1000103000; +static const XrStructureType OC_XR_TYPE_EVENT_DATA_VIVE_TRACKER_CONNECTED_HTCX = (XrStructureType)1000103001; +struct OcXrViveTrackerPathsHTCX { + XrStructureType type; + void* next; + XrPath persistentPath; + XrPath rolePath; +}; +typedef XrResult(XRAPI_PTR* OcPFN_xrEnumerateViveTrackerPathsHTCX)(XrInstance instance, uint32_t pathCapacityInput, uint32_t* pathCountOutput, + OcXrViveTrackerPathsHTCX* paths); + +// XR_EXT_hand_interaction, newer than the bundled OpenXR headers: the hands as controllers (a profile only) +#define OC_XR_EXT_HAND_INTERACTION_EXTENSION_NAME "XR_EXT_hand_interaction" + // Flag bits for supported graphics apis static const XrGraphicsApiSupportedFlags XR_SUPPORTED_GRAPHICS_API_D3D11 = 0x0001; static const XrGraphicsApiSupportedFlags XR_SUPPORTED_GRAPHICS_API_D3D12 = 0x0002; @@ -139,6 +155,14 @@ class XrExt { return pfnXrGetVisibilityMaskKHR(session, viewConfigurationType, viewIndex, visibilityMaskType, visibilityMask); } + bool ViveTrackersHTCX_Available() { return pfnXrEnumerateViveTrackerPathsHTCX != nullptr; } + XrResult xrEnumerateViveTrackerPathsHTCX(XrInstance instance, uint32_t capacity, uint32_t* count, OcXrViveTrackerPathsHTCX* paths) + { + if (!pfnXrEnumerateViveTrackerPathsHTCX) + return XR_ERROR_FUNCTION_UNSUPPORTED; + return pfnXrEnumerateViveTrackerPathsHTCX(instance, capacity, count, paths); + } + bool DisplayRefreshRateFB_Available() { return pfnXrGetDisplayRefreshRateFB != nullptr; } XrResult xrGetDisplayRefreshRateFB(XrSession session, float* displayRefreshRate) { @@ -265,16 +289,41 @@ class XrExt { return XR_ERROR_FUNCTION_UNSUPPORTED; // the runtime lacks the extension; callers check the result return pfnXrGetVulkanDeviceExtensionsKHR(instance, systemId, bufferCapacityInput, bufferCountOutput, buffer); } - bool xrGetVulkanGraphicsDeviceKHR_Available() { return pfnXrGetVulkanGraphicsDeviceKHR != nullptr; } + // XR_KHR_vulkan_enable2's instance and device creation, through the runtime (which adds what it needs) + XrResult xrCreateVulkanInstanceKHR(XrInstance instance, const XrVulkanInstanceCreateInfoKHR* createInfo, VkInstance* vulkanInstance, VkResult* vulkanResult) + { + if (!pfnXrCreateVulkanInstanceKHR) + return XR_ERROR_FUNCTION_UNSUPPORTED; + return pfnXrCreateVulkanInstanceKHR(instance, createInfo, vulkanInstance, vulkanResult); + } + XrResult xrCreateVulkanDeviceKHR(XrInstance instance, const XrVulkanDeviceCreateInfoKHR* createInfo, VkDevice* vulkanDevice, VkResult* vulkanResult) + { + if (!pfnXrCreateVulkanDeviceKHR) + return XR_ERROR_FUNCTION_UNSUPPORTED; + return pfnXrCreateVulkanDeviceKHR(instance, createInfo, vulkanDevice, vulkanResult); + } + // The runtime has XR_KHR_vulkan_enable2 alone: the graphics device and requirements calls go through its functions, + // there are no extension lists to ask for, and the temporary device is made through the runtime + bool VulkanEnable2Only() const { return !pfnXrGetVulkanGraphicsDeviceKHR && pfnXrGetVulkanGraphicsDevice2KHR; } + bool xrGetVulkanGraphicsDeviceKHR_Available() { return pfnXrGetVulkanGraphicsDeviceKHR != nullptr || pfnXrGetVulkanGraphicsDevice2KHR != nullptr; } XrResult xrGetVulkanGraphicsDeviceKHR(XrInstance instance, XrSystemId systemId, VkInstance vkInstance, VkPhysicalDevice* vkPhysicalDevice) { + if (!pfnXrGetVulkanGraphicsDeviceKHR && pfnXrGetVulkanGraphicsDevice2KHR) { + XrVulkanGraphicsDeviceGetInfoKHR info{ XR_TYPE_VULKAN_GRAPHICS_DEVICE_GET_INFO_KHR }; + info.systemId = systemId; + info.vulkanInstance = vkInstance; + return pfnXrGetVulkanGraphicsDevice2KHR(instance, &info, vkPhysicalDevice); + } if (!pfnXrGetVulkanGraphicsDeviceKHR) return XR_ERROR_FUNCTION_UNSUPPORTED; // the runtime lacks the extension; callers check the result return pfnXrGetVulkanGraphicsDeviceKHR(instance, systemId, vkInstance, vkPhysicalDevice); } - bool xrGetVulkanGraphicsRequirementsKHR_Available() { return pfnXrGetVulkanGraphicsRequirementsKHR != nullptr; } + bool xrGetVulkanGraphicsRequirementsKHR_Available() { return pfnXrGetVulkanGraphicsRequirementsKHR != nullptr || pfnXrGetVulkanGraphicsRequirements2KHR != nullptr; } XrResult xrGetVulkanGraphicsRequirementsKHR(XrInstance instance, XrSystemId systemId, XrGraphicsRequirementsVulkanKHR* graphicsRequirements) { + // XrGraphicsRequirementsVulkan2KHR is the same structure, of the same structure type + if (!pfnXrGetVulkanGraphicsRequirementsKHR && pfnXrGetVulkanGraphicsRequirements2KHR) + return pfnXrGetVulkanGraphicsRequirements2KHR(instance, systemId, graphicsRequirements); if (!pfnXrGetVulkanGraphicsRequirementsKHR) return XR_ERROR_FUNCTION_UNSUPPORTED; // the runtime lacks the extension; callers check the result return pfnXrGetVulkanGraphicsRequirementsKHR(instance, systemId, graphicsRequirements); @@ -318,6 +367,7 @@ class XrExt { PFN_xrDestroyXDevListMNDX pfnxrDestroyXDevListMNDX = nullptr; PFN_xrCreateXDevSpaceMNDX pfnxrCreateXDevSpaceMNDX = nullptr; + OcPFN_xrEnumerateViveTrackerPathsHTCX pfnXrEnumerateViveTrackerPathsHTCX = nullptr; OcPFN_xrGetDisplayRefreshRateFB pfnXrGetDisplayRefreshRateFB = nullptr; OcPFN_xrEnumerateDisplayRefreshRatesFB pfnXrEnumerateDisplayRefreshRatesFB = nullptr; OcPFN_xrRequestDisplayRefreshRateFB pfnXrRequestDisplayRefreshRateFB = nullptr; @@ -343,6 +393,10 @@ class XrExt { PFN_xrGetVulkanInstanceExtensionsKHR pfnXrGetVulkanInstanceExtensionsKHR = nullptr; PFN_xrGetVulkanDeviceExtensionsKHR pfnXrGetVulkanDeviceExtensionsKHR = nullptr; PFN_xrGetVulkanGraphicsDeviceKHR pfnXrGetVulkanGraphicsDeviceKHR = nullptr; + PFN_xrGetVulkanGraphicsRequirements2KHR pfnXrGetVulkanGraphicsRequirements2KHR = nullptr; + PFN_xrGetVulkanGraphicsDevice2KHR pfnXrGetVulkanGraphicsDevice2KHR = nullptr; + PFN_xrCreateVulkanInstanceKHR pfnXrCreateVulkanInstanceKHR = nullptr; + PFN_xrCreateVulkanDeviceKHR pfnXrCreateVulkanDeviceKHR = nullptr; #endif #ifdef SUPPORT_GL PFN_xrGetOpenGLGraphicsRequirementsKHR pfnXrGetOpenGLGraphicsRequirementsKHR = nullptr; diff --git a/OpenOVR/Misc/xrutil.cpp b/OpenOVR/Misc/xrutil.cpp index a479da45..0d11aeea 100644 --- a/OpenOVR/Misc/xrutil.cpp +++ b/OpenOVR/Misc/xrutil.cpp @@ -74,6 +74,10 @@ XrExt::XrExt(XrGraphicsApiSupportedFlags apis, const std::vector& e if (strcmp(ext, OC_XR_EXT_LOCAL_FLOOR_EXTENSION_NAME) == 0) supportsLocalFloor = true; } +#ifdef SUPPORT_VK + const bool vulkanEnable1 = enabledExtensions.count(XR_KHR_VULKAN_ENABLE_EXTENSION_NAME) != 0; + const bool vulkanEnable2 = enabledExtensions.count(XR_KHR_VULKAN_ENABLE2_EXTENSION_NAME) != 0; +#endif #define XR_BIND(name, function) OOVR_FAILED_XR_ABORT(xrGetInstanceProcAddr(xr_instance, #name, (PFN_xrVoidFunction*)&this->function)) #define XR_BIND_OPT(name, function) xrGetInstanceProcAddr(xr_instance, #name, (PFN_xrVoidFunction*)&this->function) @@ -89,6 +93,10 @@ XrExt::XrExt(XrGraphicsApiSupportedFlags apis, const std::vector& e XR_BIND_OPT(xrRequestDisplayRefreshRateFB, pfnXrRequestDisplayRefreshRateFB); } + // Vive trackers by their role + if (enabledExtensions.contains(OC_XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME)) + XR_BIND_OPT(xrEnumerateViveTrackerPathsHTCX, pfnXrEnumerateViveTrackerPathsHTCX); + if (hasHandTracking) { XR_BIND(xrCreateHandTrackerEXT, pfnXrCreateHandTrackerExt); XR_BIND(xrDestroyHandTrackerEXT, pfnXrDestroyHandTrackerExt); @@ -127,11 +135,17 @@ XrExt::XrExt(XrGraphicsApiSupportedFlags apis, const std::vector& e #endif #ifdef SUPPORT_VK - if (apis & XR_SUPPORTED_GRAPHICS_API_VK) { + // XR_KHR_vulkan_enable, else XR_KHR_vulkan_enable2 (a runtime that has only the second) + if ((apis & XR_SUPPORTED_GRAPHICS_API_VK) && (vulkanEnable1 || !vulkanEnable2)) { XR_BIND(xrGetVulkanGraphicsRequirementsKHR, pfnXrGetVulkanGraphicsRequirementsKHR); XR_BIND(xrGetVulkanInstanceExtensionsKHR, pfnXrGetVulkanInstanceExtensionsKHR); XR_BIND(xrGetVulkanDeviceExtensionsKHR, pfnXrGetVulkanDeviceExtensionsKHR); XR_BIND(xrGetVulkanGraphicsDeviceKHR, pfnXrGetVulkanGraphicsDeviceKHR); + } else if (apis & XR_SUPPORTED_GRAPHICS_API_VK) { + XR_BIND(xrGetVulkanGraphicsRequirements2KHR, pfnXrGetVulkanGraphicsRequirements2KHR); + XR_BIND(xrGetVulkanGraphicsDevice2KHR, pfnXrGetVulkanGraphicsDevice2KHR); + XR_BIND(xrCreateVulkanInstanceKHR, pfnXrCreateVulkanInstanceKHR); + XR_BIND(xrCreateVulkanDeviceKHR, pfnXrCreateVulkanDeviceKHR); } #endif @@ -457,6 +471,11 @@ SessionLock SessionWrapper::try_lock_shared() return SessionLock(*this, SessionLock::TryShared{}); } +SessionLock SessionWrapper::try_lock() +{ + return SessionLock(*this, SessionLock::TryExclusive{}); +} + void SessionWrapper::reset() { session = XR_NULL_HANDLE; @@ -513,6 +532,18 @@ SessionLock::SessionLock(SessionWrapper& p, TryShared) owner = true; } +SessionLock::SessionLock(SessionWrapper& p, TryExclusive) + : parent(p) +{ + if (thread_lock != Held::Unlocked) + return; // this thread holds it already + if (!p.mutex.try_lock()) + return; + lock = std::unique_lock(p.mutex, std::adopt_lock); + thread_lock = Held::Exclusive; + owner = true; +} + SessionLock::~SessionLock() { if (upgraded) { diff --git a/OpenOVR/Misc/xrutil.h b/OpenOVR/Misc/xrutil.h index 794a5b55..354d8ea4 100644 --- a/OpenOVR/Misc/xrutil.h +++ b/OpenOVR/Misc/xrutil.h @@ -159,6 +159,11 @@ class SessionWrapper { */ [[nodiscard]] SessionLock try_lock_shared(); + /* + * The exclusive lock if it's free now, without waiting (see SessionLock::IsHeld) + */ + [[nodiscard]] SessionLock try_lock(); + /* * Resets the underlying XrSession to XR_NULL_HANDLE. Does not actually call xrDestroySession. */ @@ -183,10 +188,12 @@ class SessionLock { public: struct TryShared {}; + struct TryExclusive {}; SessionLock(SessionWrapper& p, bool exclusive); SessionLock(SessionWrapper& p, std::chrono::milliseconds limit); SessionLock(SessionWrapper& p, TryShared); + SessionLock(SessionWrapper& p, TryExclusive); ~SessionLock(); operator XrSession&(); // Whether this thread holds the lock, through this SessionLock or an outer one diff --git a/OpenOVR/Reimpl/BaseApplications.cpp b/OpenOVR/Reimpl/BaseApplications.cpp index 401e7299..fab02dc7 100644 --- a/OpenOVR/Reimpl/BaseApplications.cpp +++ b/OpenOVR/Reimpl/BaseApplications.cpp @@ -11,6 +11,7 @@ #include "Misc/SharedStore.h" #include +#include #include #include #include @@ -86,6 +87,8 @@ constexpr uint64_t kNewAppLaunchMs = 30000; // How long after the old application was first asked to quit the transition lasts: it holds other launches off // while the old application runs, and its launch is taken over if the old one ended without launching it constexpr uint64_t kTakeOverMs = 5 * 60 * 1000; +// How long an old application asked to quit for a launch has to do so before it's ended (ForceQuitProcess's way) +constexpr uint64_t kForceQuitMs = 10000; // Launch arguments kept for running applications at most: the oldest go first constexpr size_t kMaxLaunchArgs = 32; @@ -282,6 +285,26 @@ std::optional BaseApplications::Find(const char* pchAppKey) } namespace { +// On Linux, an application whose binary is a Windows program can't be started: there's no Proton or Wine to start it +// with. Refused (logged) before anything else is done for the launch. +bool WindowsBinaryRefused(const AppManifestEntry& app) +{ +#ifdef _WIN32 + (void)app; + return false; +#else + if (app.launchType == "url") + return false; + std::string ext = app.ResolvedBinary().extension().string(); + std::transform(ext.begin(), ext.end(), ext.begin(), [](unsigned char c) { return (char)std::tolower(c); }); + if (ext != ".exe") + return false; + OOVR_LOGF("Not launching application %s: its binary (%s) is a Windows program, which can't be started on Linux", + app.appKey.c_str(), app.ResolvedBinary().string().c_str()); + return true; +#endif +} + // Whether this process has drawn since it became the scene application, and whether the store has that std::atomic sceneDrawn{ false }, sceneDrawnStored{ false }; } // namespace @@ -416,9 +439,21 @@ void BaseApplications::TakeOverPendingLaunch(SharedStore& store) // first program to notice does const Json::Value pending = store.ReadAt(StoreDoc::Scene, { "transition" }); if (!pending.isObject() || !BoolOr(pending["launch"], false) || !pending["state"].isInt() - || pending["state"].asInt() != VRApplicationTransition_OldAppQuitSent || PidOf(pending["old_pid"]) == oc_current_pid() - || SharedStore::IsSameProcessAlive(PidOf(pending["old_pid"]), UInt64Or(pending["old_start"], 0))) + || pending["state"].asInt() != VRApplicationTransition_OldAppQuitSent || PidOf(pending["old_pid"]) == oc_current_pid()) return; + if (SharedStore::IsSameProcessAlive(PidOf(pending["old_pid"]), UInt64Or(pending["old_start"], 0))) { + // An old application that ignored the quit for kForceQuitMs is ended, if it's still the one asked (its start + // time known); its launch is taken over once it's gone + const uint64_t since = UInt64Or(pending["since_ms"], 0), now = NowMs(); + const uint64_t start = UInt64Or(pending["old_start"], 0); + if (start && now >= since + kForceQuitMs && now < since + kTakeOverMs) { + const uint32_t oldPid = PidOf(pending["old_pid"]); + static std::atomic loggedStart{ 0 }; // a process not yet reaped is ended again: logged once + if (SharedStore::KillProcess(oldPid, start) && loggedStart.exchange(start) != start) + OOVR_LOGF("The scene application (pid %u) didn't quit for the launch of %s: ended", oldPid, StringOr(pending["app_key"]).c_str()); + } + return; + } std::string key; uint32_t oldPid = 0; bool dropped = false; @@ -697,6 +732,8 @@ EVRApplicationError BaseApplications::Launch(const AppManifestEntry& app, const { if (app.isTemplate) return VRApplicationError_IsTemplate; + if (WindowsBinaryRefused(app)) + return VRApplicationError_LaunchFailed; std::optional pid; if (app.launchType == "url") { @@ -733,6 +770,8 @@ EVRApplicationError BaseApplications::LaunchApplication(const char* pchAppKey) // One copy of an application at a time if (app->launchType != "url" && GetApplicationProcessId(pchAppKey) != 0) return VRApplicationError_ApplicationAlreadyRunning; + if (!app->isTemplate && WindowsBinaryRefused(*app)) + return VRApplicationError_LaunchFailed; // Another scene application is asked to quit, and this one starts when it has if (IsSceneApplication(*app)) { EVRApplicationError error = AskSceneApplicationToQuit(app->appKey, true); diff --git a/OpenOVR/Reimpl/BaseChaperone.cpp b/OpenOVR/Reimpl/BaseChaperone.cpp index 5c798511..75c42cf3 100644 --- a/OpenOVR/Reimpl/BaseChaperone.cpp +++ b/OpenOVR/Reimpl/BaseChaperone.cpp @@ -6,6 +6,7 @@ #include "generated/static_bases.gen.h" #include "Drivers/Backend.h" +#include "Misc/Bounds.h" #include "Misc/ChaperoneData.h" #include "Misc/SharedStore.h" @@ -17,9 +18,35 @@ using namespace vr; BaseChaperone::BaseChaperoneCalibrationState BaseChaperone::GetCalibrationState() { - // OK whether or not the runtime gives stage bounds: runtimes without them (Monado among them) have nothing for the - // player to set up, and games read an error here as a room setup to do first - return ChaperoneCalibrationState_OK; + // OK with a play area (the runtime's, else the committed room setup's), as the getters answer. Without one, a + // warning rather than an error: games read an error as a room setup to do before they start, and a runtime + // without stage bounds (Monado among them) still tracks standing + const XrExtent2Df area = CurrentPlayArea(); + return area.width > 0 && area.height > 0 ? ChaperoneCalibrationState_OK : ChaperoneCalibrationState_Warning; +} + +XrExtent2Df CurrentPlayArea() +{ + XrExtent2Df runtime{}; + bool known = false; + if (BackendManager* backends = BackendManager::InstancePtr()) { + int count = 0; + if (backends->GetPlayAreaPoints(nullptr, &count) && count >= 2) { + std::vector points(count); + if (backends->GetPlayAreaPoints(points.data(), nullptr)) { + float minX = points[0].v[0], maxX = minX, minZ = points[0].v[2], maxZ = minZ; + for (const vr::HmdVector3_t& p : points) { + minX = std::min(minX, p.v[0]); + maxX = std::max(maxX, p.v[0]); + minZ = std::min(minZ, p.v[2]); + maxZ = std::max(maxZ, p.v[2]); + } + runtime = { maxX - minX, maxZ - minZ }; + known = true; + } + } + } + return BoundsPlayArea(known ? &runtime : nullptr, known ? Json::Value() : SharedStore::Get().Read(StoreDoc::Chaperone)); } bool BaseChaperone::GetPlayAreaSize(float* pSizeX, float* pSizeZ) { @@ -92,7 +119,8 @@ bool BaseChaperone::GetPlayAreaRect(HmdQuad_t* rect) } void BaseChaperone::ReloadInfo(void) { - // The play area is asked of the OpenXR runtime, and the committed room setup read from the store, each time + // The play area is the OpenXR runtime's (asked once per session and after it changes), else the committed room + // setup's, read from the store each time } void BaseChaperone::SetSceneColor(HmdColor_t color) { @@ -124,31 +152,12 @@ void BaseChaperone::ForceBoundsVisible(bool bForce) bool BaseChaperone::GetMinMaxPoints(vr::HmdVector3_t& minPoint, vr::HmdVector3_t& maxPoint) { - int count; - bool success = BackendManager::Instance().GetPlayAreaPoints(nullptr, &count); - - if (!success) - return false; // the play area isn't set up, or is unsupported by the backend - - std::vector points(count); - success = BackendManager::Instance().GetPlayAreaPoints(points.data(), nullptr); - - if (!success) - return false; // shouldn't happen - should be caught by first check - - if (points.size() < 2) - return false; // not enough points to find a min/max - - minPoint = points[0]; - maxPoint = points[0]; - - for (const auto& point : points) { - for (int i = 0; i < 3; i++) { - minPoint.v[i] = std::min(minPoint.v[i], point.v[i]); - maxPoint.v[i] = std::max(maxPoint.v[i], point.v[i]); - } - } - + // The play area, centred on the standing origin + const XrExtent2Df area = CurrentPlayArea(); + if (!(area.width > 0) || !(area.height > 0)) + return false; // no play area: the runtime has none and no room setup was committed + minPoint = { -area.width / 2, 0, -area.height / 2 }; + maxPoint = { area.width / 2, 0, area.height / 2 }; return true; } diff --git a/OpenOVR/Reimpl/BaseClientCore.cpp b/OpenOVR/Reimpl/BaseClientCore.cpp index b2445473..ed0acf92 100644 --- a/OpenOVR/Reimpl/BaseClientCore.cpp +++ b/OpenOVR/Reimpl/BaseClientCore.cpp @@ -98,7 +98,9 @@ enum Runtime { bool BaseClientCore::CheckAppEnabled() { #ifndef _WIN32 - OOVR_LOG_ONCE("Launcher configuration not yet supported on Linux"); + // No per-app runtime list on Linux: a game's runtime is chosen with VR_OVERRIDE in its launch options + OOVR_LOG_ONCE("Choosing a runtime per game on Linux: set the game's launch options to VR_OVERRIDE= %command%, " + "where is the runtime's folder (OpenLamina's install, or SteamVR's)"); return true; #else wstring dlldir = GetDllDir(); diff --git a/OpenOVR/Reimpl/BaseCompositor.cpp b/OpenOVR/Reimpl/BaseCompositor.cpp index 72f30a61..8e39f245 100644 --- a/OpenOVR/Reimpl/BaseCompositor.cpp +++ b/OpenOVR/Reimpl/BaseCompositor.cpp @@ -273,7 +273,7 @@ static bool OtherProgramsAround() // The scene app's frame statistics in the Scene document, for other programs' GetCumulativeStats: at most once a // second, and only while another OpenLamina program is around to read them. Written after the frame was handed over, -// and never waited for: while another program holds the store they're left for the next second. +// by the store's writer thread, never waited for. static void PublishSceneStats() { // Called for each eye, maybe from two threads: the compare-exchange lets one of them through each second @@ -287,14 +287,15 @@ static void PublishSceneStats() OOVR_Compositor_CumulativeStats stats{}; FrameStats::Get().Cumulative(oc_current_pid(), &stats, sizeof(stats)); const uint32_t self = oc_current_pid(); - SharedStore::Get().Update(StoreDoc::Scene, [&](Json::Value& scene) { + // Written by the store's writer thread: the frame doesn't wait for the file + SharedStore::Get().UpdateLater(StoreDoc::Scene, "frame_stats", [self, stats](Json::Value& scene) { // Only while it's this program's if (!scene.isObject() || !scene["pid"].isUInt() || scene["pid"].asUInt() != self) return; scene["frame_stats"]["presents"] = stats.m_nNumFramePresents; scene["frame_stats"]["dropped"] = stats.m_nNumDroppedFrames; scene["frame_stats"]["reprojected"] = stats.m_nNumReprojectedFrames; - }, SharedStore::Wait::Never); + }); } ovr_enum_t BaseCompositor::Submit(EVREye eye, const Texture_t* texture, const VRTextureBounds_t* bounds, EVRSubmitFlags submitFlags) @@ -311,6 +312,7 @@ ovr_enum_t BaseCompositor::Submit(EVREye eye, const Texture_t* texture, const VR return VRCompositorError_InvalidBounds; } + std::lock_guard submitGuard(submitLock); bool isFirstEye = !leftEyeSubmitted && !rightEyeSubmitted; ovr_enum_t result = VRCompositorError_None; @@ -354,7 +356,7 @@ ovr_enum_t BaseCompositor::Submit(EVREye eye, const Texture_t* texture, const VR result = (ovr_enum_t)BackendManager::Instance().StoreEyeTexture(eye, texture, bounds, submitFlags, isFirstEye); if (leftEyeSubmitted && rightEyeSubmitted) { - if (!isNullRender && SubmitEndsFrame(explicitTimingMode, usesPostPresentHandoff)) + if (!isNullRender && SubmitEndsFrame(explicitTimingMode)) BackendManager::Instance().SubmitFrames(isInSkybox); leftEyeSubmitted = false; @@ -394,12 +396,13 @@ void BaseCompositor::PostPresentHandoff() // // Some apps provide a GUI through layers that are submitted after any eye textures are submitted. The app then // calls PostPresentHandOff to signal that all data is submitted and compositor can start work. Mimick this by - // ending the frame here for a game that calls this, and not at its second Submit. + // ending the frame here; in the timing mode where the game says it does that + // (Explicit_ApplicationPerformsPostPresentHandoff), the second Submit doesn't. In any other mode the frame was + // ended there already, and this ends none. // An overlay or background application has no frame of its own to end if (IsHelperSession()) return; - usesPostPresentHandoff = true; // As in Submit: the session isn't restarted while the frame is ended auto lock = xr_session.lock_shared(); BackendManager::Instance().SubmitFrames(isInSkybox); @@ -796,9 +799,36 @@ bool BaseCompositor::IsMirrorWindowVisible() return MirrorWindow::Get().Visible(); } +namespace { +// The eyes whose next image CompositorDumpImages wants: bit 0 the left, bit 1 the right +std::atomic dumpEyesWanted{ 0 }; +} // namespace + void BaseCompositor::CompositorDumpImages() { - OC_UNSUPPORTED_VOID("CompositorDumpImages: not supported"); + if (IsHelperSession()) + return; // an overlay or background application submits no eyes + dumpEyesWanted = 3; +} + +bool BaseCompositor::_WantsDumpImage(vr::EVREye eye) +{ + return (dumpEyesWanted.load() & (1 << (int)eye)) != 0; +} + +void BaseCompositor::_OfferDumpImage(vr::EVREye eye, const Image& image) +{ + // Once per call: the first image of each eye after it + if (!(dumpEyesWanted.fetch_and(~(1 << (int)eye)) & (1 << (int)eye))) + return; + const std::string folder = oovr_log_folder(); + const std::filesystem::path path = folder.empty() ? std::filesystem::path(DumpImageName(oc_current_pid(), eye)) + : std::filesystem::path(folder) / DumpImageName(oc_current_pid(), eye); + std::string why; + if (WritePngFile(image, path, &why)) + OOVR_LOGF("CompositorDumpImages: wrote %s", path.string().c_str()); + else + OOVR_LOGF("CompositorDumpImages: couldn't write %s: %s", path.string().c_str(), why.c_str()); } bool BaseCompositor::ShouldAppRenderWithLowResources() @@ -892,6 +922,7 @@ void BaseCompositor::UnlockGLSharedTextureForAccess(glSharedTextureHandle_t glSh uint32_t BaseCompositor::GetVulkanInstanceExtensionsRequired(char* pchValue, uint32_t unBufferSize) { + auto lock = xr_session.lock_shared(); // held while asking: a new instance waits for it if (pchValue && unBufferSize) pchValue[0] = 0; #if defined(SUPPORT_VK) @@ -914,13 +945,50 @@ uint32_t BaseCompositor::GetVulkanInstanceExtensionsRequired(char* pchValue, uin uint32_t BaseCompositor::GetVulkanDeviceExtensionsRequired(VkPhysicalDevice_T* pPhysicalDevice, char* pchValue, uint32_t unBufferSize) { + auto lock = xr_session.lock_shared(); // held while asking: a new instance waits for it if (pchValue && unBufferSize) pchValue[0] = 0; #if defined(SUPPORT_VK) + // The extensions the game's physical device has, where it names one GetOutputDevice answered + std::vector available; + bool knowAvailable = false; + if (pPhysicalDevice && KnownPhysicalDevice(pPhysicalDevice)) { + uint32_t count = 0; + if (vkEnumerateDeviceExtensionProperties(pPhysicalDevice, nullptr, &count, nullptr) == VK_SUCCESS) { + std::vector props(count); + if (vkEnumerateDeviceExtensionProperties(pPhysicalDevice, nullptr, &count, props.data()) >= 0) { + for (uint32_t i = 0; i < count && i < props.size(); i++) + available.emplace_back(props[i].extensionName); + knowAvailable = true; + } + } + } #if defined(_WIN32) && defined(SUPPORT_DX) && defined(SUPPORT_DX11) - if (!xr_ext->xrGetVulkanDeviceExtensionsKHR_Available() && xr_ext->xrGetD3D11GraphicsRequirementsKHR_Available()) - return ExtensionListSize(InteropVulkanExtensions(true), pchValue, unBufferSize); + if (!xr_ext->xrGetVulkanDeviceExtensionsKHR_Available() && xr_ext->xrGetD3D11GraphicsRequirementsKHR_Available()) { + // The copies' own, and their GPU-side wait's where the device has them (else they're waited for on the CPU) + std::string list = InteropVulkanExtensions(true); + const std::string semaphores = knowAvailable ? ExtensionsAmong(InteropVulkanSemaphoreExtensions(), available) : std::string(); + if (semaphores == InteropVulkanSemaphoreExtensions()) + list += " " + semaphores; + return ExtensionListSize(list.c_str(), pchValue, unBufferSize); + } #endif + if (knowAvailable && xr_ext->xrGetVulkanDeviceExtensionsKHR_Available()) { + // The runtime's list, less what the game's physical device lacks: asking for one it lacks fails vkCreateDevice + // outright, where without it only the session may fail (and falls back) + uint32_t size = 0; + XrResult res = xr_ext->xrGetVulkanDeviceExtensionsKHR(xr_instance, xr_system, 0, &size, nullptr); + std::string full(size, '\0'); + if (XR_SUCCEEDED(res) && size > 0) + res = xr_ext->xrGetVulkanDeviceExtensionsKHR(xr_instance, xr_system, size, &size, full.data()); + if (XR_SUCCEEDED(res)) { + full.resize(strnlen(full.c_str(), full.size())); + const std::string kept = ExtensionsAmong(full, available); + if (kept.size() != full.size()) + OOVR_LOG_ONCEF("GetVulkanDeviceExtensionsRequired: the runtime's \"%s\", of which the game's GPU has \"%s\"", full.c_str(), kept.c_str()); + return ExtensionListSize(kept.c_str(), pchValue, unBufferSize); + } + } uint32_t size = 0; XrResult res = xr_ext->xrGetVulkanDeviceExtensionsKHR(xr_instance, xr_system, pchValue ? unBufferSize : 0, &size, pchValue); if (res != XR_ERROR_SIZE_INSUFFICIENT) diff --git a/OpenOVR/Reimpl/BaseCompositor.h b/OpenOVR/Reimpl/BaseCompositor.h index f3940557..1c5e4696 100644 --- a/OpenOVR/Reimpl/BaseCompositor.h +++ b/OpenOVR/Reimpl/BaseCompositor.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -10,6 +11,7 @@ #include "../Compositor/compositor_backend.h" // TODO don't import from OCOVR, and remove the "../" #include +#include #include typedef unsigned int GLuint; @@ -150,6 +152,9 @@ class BaseCompositor { private: std::shared_ptr overlayReader; // reads SetOverlay's textures back std::atomic leftEyeSubmitted{ false }, rightEyeSubmitted{ false }; + // Held through Submit: the eyes' flags are checked and set, and the frame ended, as one step when a game submits + // its eyes from two threads + std::mutex submitLock; // The old compositor window calls (IVRCompositor_005-008) and SetGraphicsDevice (005, 006) bool oldVSync = true; @@ -172,12 +177,20 @@ class BaseCompositor { // True if the current frame has only nullptr textures supplied, and should be ignored std::atomic isNullRender{ false }; std::atomic explicitTimingMode{ 0 }; - // The game has called PostPresentHandoff: it ends its frames there, not at its second Submit - std::atomic usesPostPresentHandoff{ false }; // What the game last set with SetTrackingSpace std::atomic trackingUniverse{ vr::TrackingUniverseStanding }; public: + // CompositorDumpImages: whether the eye's next submitted image is wanted, and that image (written to the log + // folder as a PNG) + static bool _WantsDumpImage(vr::EVREye eye); + static void _OfferDumpImage(vr::EVREye eye, const Image& image); + // The file an eye's image is dumped to, in that folder, by the process's id + static std::string DumpImageName(uint32_t pid, vr::EVREye eye) + { + return "compositor-dump." + std::to_string(pid) + (eye == vr::Eye_Left ? ".left.png" : ".right.png"); + } + // Submitted bounds with a NaN in them are no bounds at all static bool BoundsAreNumbers(const vr::VRTextureBounds_t* bounds) { @@ -196,7 +209,49 @@ class BaseCompositor { static const char* InteropVulkanExtensions(bool device) { return device ? "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2" - : "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"; + : "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"; + } + // The physical devices GetOutputDevice named: the only ones GetVulkanDeviceExtensionsRequired asks about (a game + // may pass anything, and a pointer that isn't a physical device can't be told apart from one) + static void NotePhysicalDevice(void* physicalDevice) + { + std::lock_guard lock(physicalDevicesLock); + if (physicalDevice && physicalDevices.size() < 16 + && std::find(physicalDevices.begin(), physicalDevices.end(), physicalDevice) == physicalDevices.end()) + physicalDevices.push_back(physicalDevice); + } + static bool KnownPhysicalDevice(void* physicalDevice) + { + std::lock_guard lock(physicalDevicesLock); + for (void* known : physicalDevices) + if (known == physicalDevice) + return true; + return false; + } + inline static std::mutex physicalDevicesLock; + inline static std::vector physicalDevices; + // The extensions that let the copies through D3D11 be waited for on the GPU (shared fences as semaphores): asked + // for only where the game's physical device has them + static const char* InteropVulkanSemaphoreExtensions() { return "VK_KHR_external_semaphore VK_KHR_external_semaphore_win32"; } + // The names of a space-separated extension list that are among `available`, space separated again, in the list's + // order + static std::string ExtensionsAmong(const std::string& list, const std::vector& available) + { + std::string out; + size_t start = 0; + while (start < list.size()) { + size_t end = list.find(' ', start); + if (end == std::string::npos) + end = list.size(); + const std::string name = list.substr(start, end - start); + bool has = false; + for (const std::string& a : available) + has = has || a == name; + if (!name.empty() && has) + out += (out.empty() ? "" : " ") + name; + start = end + 1; + } + return out; } // Copies a list into the game's buffer (as much as fits, always ended) and answers the size it needs, as with the // runtime's own lists @@ -210,11 +265,11 @@ class BaseCompositor { } return needed; } - // Whether the second eye's Submit ends the frame: not for a game that ends its frames with PostPresentHandoff, - // whether it says so in its timing mode or has called it - static bool SubmitEndsFrame(int32_t timingMode, bool calledHandoff) + // Whether the second eye's Submit ends the frame: not in the timing mode (SetExplicitTimingMode) where the game + // ends its frames with PostPresentHandoff + static bool SubmitEndsFrame(int32_t timingMode) { - return timingMode != (int32_t)VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff && !calledHandoff; + return timingMode != (int32_t)VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff; } typedef int ovr_enum_t; @@ -367,7 +422,8 @@ class BaseCompositor { /** Returns true if the mirror window is shown. */ bool IsMirrorWindowVisible(); - /** Writes all images that the compositor knows about (including overlays) to a 'screenshots' folder in the SteamVR runtime root. */ + /** Writes all images that the compositor knows about (including overlays) to a 'screenshots' folder in the SteamVR runtime root. + * Here: each eye's next submitted image, as a PNG in the log folder (DumpImageName). */ void CompositorDumpImages(); /** Let an app know it should be rendering with low resources. */ diff --git a/OpenOVR/Reimpl/BaseControlPanel.cpp b/OpenOVR/Reimpl/BaseControlPanel.cpp index 9ce5c684..6a6d77d8 100644 --- a/OpenOVR/Reimpl/BaseControlPanel.cpp +++ b/OpenOVR/Reimpl/BaseControlPanel.cpp @@ -155,7 +155,19 @@ bool BaseControlPanel::QuitProcess(uint32_t pidProcessToQuit) bool BaseControlPanel::ForceQuitProcess(uint32_t pidProcessToQuit) { - OC_UNSUPPORTED(false, "ForceQuitProcess (IVRControlPanel_001): other processes aren't OpenComposite's to quit"); + // Only a process the store knows (an application, the scene's, an overlay program), and only if it's still the + // one the store has (its start time): any other, or one that took over a listed pid, isn't OpenLamina's to end. + // Not this one. + if (pidProcessToQuit == 0 || pidProcessToQuit == oc_current_pid()) + return false; + const uint64_t start = SharedStore::Get().KnownProcessStart(pidProcessToQuit); + if (!start) { + OOVR_LOG_ONCE("ForceQuitProcess (IVRControlPanel_001): a process the store doesn't know isn't OpenLamina's to end"); + return false; + } + const bool ended = SharedStore::KillProcess(pidProcessToQuit, start); + OOVR_LOGF("ForceQuitProcess: pid %u %s", pidProcessToQuit, ended ? "ended" : "couldn't be ended"); + return ended; } uint32_t BaseControlPanel::StartVRProcess(const char* pchExecutable, const char** pchArguments, uint32_t unArgumentCount, const char* pchWorkingDirectory) diff --git a/OpenOVR/Reimpl/BaseInput.cpp b/OpenOVR/Reimpl/BaseInput.cpp index ad2ccc66..f4b1a316 100644 --- a/OpenOVR/Reimpl/BaseInput.cpp +++ b/OpenOVR/Reimpl/BaseInput.cpp @@ -197,16 +197,6 @@ static std::string escapePathString(const std::string& str) return std::string(out.data(), out.size()); } -static std::string pathFromParts(const std::initializer_list& parts) -{ - std::string str; - for (const std::string& part : parts) { - str += "/"; - str += part; - } - return str; -} - // Must be defined non-inline to avoid it ending up in stubs.gen.cpp BaseInput::Action::~Action() = default; // The input value handles GetInputSourceHandle has handed out (they're pointers): cast_IVH answers null for any @@ -411,6 +401,13 @@ EVRInputError BaseInput::SetActionManifestPath(const char* pchActionManifestPath // no other thread reads input. Taken before evaluatorLock (see its declaration). auto sessionLock = xr_session.lock(); + // While a lost instance is made again: this manifest is the one loaded on the new instance + if (rebuildPending) { + manifestToRebuild = pchActionManifestPath; + rebuildLegacy = false; + return vr::VRInputError_None; + } + bool reloading = hasLoadedActions; if (hasLoadedActions) { // It stands to reason that nothing would happen if we try to load the same manifest again @@ -418,31 +415,7 @@ EVRInputError BaseInput::SetActionManifestPath(const char* pchActionManifestPath return vr::VRInputError_None; OOVR_LOG("Received another manifest! Restarting session to reattach inputs..."); - std::lock_guard evalGuard(evaluatorLock); - for (std::unique_ptr& as : actionSets.GetItems()) { - OC_XR_LOG(xrDestroyActionSet(as->xr)); - } - OC_XR_LOG(xrDestroyActionSet(legacyInputsSet)); - legacyInputsSet = XR_NULL_HANDLE; - eyeGazeAction = XR_NULL_HANDLE; - eyeGazeSpace = XR_NULL_HANDLE; - if (rawInputsSet != XR_NULL_HANDLE) - OC_XR_LOG(xrDestroyActionSet(rawInputsSet)); - rawInputsSet = XR_NULL_HANDLE; - rawActions.clear(); - rawComponents.clear(); - evaluators.clear(); - bindingFiles.clear(); - aliasedBindingFiles.clear(); - evaluatedThisSync.clear(); - legacyEvaluators.clear(); - { - std::lock_guard queueGuard(hapticQueueLock); - pendingHaptics.clear(); - } - actions.Reset(); - actionSets.Reset(); - usingLegacyInput = false; + DropActions(true); } restartingSession = true; @@ -723,6 +696,7 @@ EVRInputError BaseInput::SetActionManifestPath(const char* pchActionManifestPath const std::filesystem::path workingDir = std::filesystem::current_path(cwdError); const std::filesystem::path manifestDir = PathFromUtf8(dirnameOf(pchActionManifestPath)); + trackerPoseRoutes.clear(); for (Json::Value item : root["default_bindings"]) try { if (!item.isObject()) { OOVR_LOG("Warning: skipping a default_bindings entry that isn't a JSON object"); @@ -738,6 +712,18 @@ EVRInputError BaseInput::SetActionManifestPath(const char* pchActionManifestPath path = PathToUtf8(*found); } + // A tracker's binding file: the poses it binds on a tracker's path (/user/waist/pose/raw) are that tracker's + if (controller_type.starts_with("vive_tracker")) { + const BindingFile tracker = LoadBindingFile(PathFromUtf8(path)); + for (const auto& [setName, set] : tracker.sets) + for (const PoseBinding& pose : set.poses) + if (std::optional role = ViveTrackerRoleForSteamVRPath(pose.path)) { + std::vector& roles = trackerPoseRoutes[pose.output]; + if (std::find(roles.begin(), roles.end(), role->name) == roles.end()) + roles.push_back(role->name); + } + } + // look if we know about this OpenVR name // have to loop through every binding type because default_bindings is an array for some reason auto iter = OpenVRNameToProfile.find(controller_type); @@ -777,14 +763,116 @@ EVRInputError BaseInput::SetActionManifestPath(const char* pchActionManifestPath return vr::VRInputError_None; } +void BaseInput::DropActions(bool destroyHandles) +{ + std::lock_guard evalGuard(evaluatorLock); + if (destroyHandles) { + for (std::unique_ptr& as : actionSets.GetItems()) { + OC_XR_LOG(xrDestroyActionSet(as->xr)); + } + if (legacyInputsSet != XR_NULL_HANDLE) + OC_XR_LOG(xrDestroyActionSet(legacyInputsSet)); + if (rawInputsSet != XR_NULL_HANDLE) + OC_XR_LOG(xrDestroyActionSet(rawInputsSet)); + } + legacyInputsSet = XR_NULL_HANDLE; + eyeGazeAction = XR_NULL_HANDLE; + eyeGazeSpace = XR_NULL_HANDLE; + trackerPoseAction = XR_NULL_HANDLE; + trackerPoseSession = XR_NULL_HANDLE; + rawInputsSet = XR_NULL_HANDLE; + rawActions.clear(); + rawComponents.clear(); + evaluators.clear(); + bindingFiles.clear(); + aliasedBindingFiles.clear(); + evaluatedThisSync.clear(); + legacyEvaluators.clear(); + { + std::lock_guard queueGuard(hapticQueueLock); + pendingHaptics.clear(); + } + actions.Reset(); + actionSets.Reset(); + usingLegacyInput = false; +} + +void BaseInput::_ForgetInstance() +{ + auto sessionLock = xr_session.lock(); + // Paths are the instance's own too: looked up again on the new one + pathsStale = true; + // Until the new instance has a session, the game's input calls only say what to load on it + if (rebuildPending) + return; // forgotten at an earlier try + rebuildPending = true; + rebuildLegacy = false; + manifestToRebuild.clear(); + if (!hasLoadedActions) + return; + { + std::lock_guard pathGuard(loadedActionsPathLock); + manifestToRebuild = loadedActionsPath; + loadedActionsPath.clear(); + } + rebuildLegacy = manifestToRebuild.empty(); + // Their handles went with the old instance: forgotten, not destroyed + DropActions(false); + for (XrHandTrackerEXT& handTracker : handTrackers) + handTracker = XR_NULL_HANDLE; + hasLoadedActions = false; +} + +void BaseInput::_RebuildForNewInstance() +{ + // Exclusive to the end, as a manifest's loading is + auto sessionLock = xr_session.lock(); + if (pathsStale) { + pathsStale = false; + for (size_t i = 0; i < allSubactionPathNames.size() && i < allSubactionPaths.size(); i++) { + allSubactionPaths[i] = XR_NULL_PATH; + OC_XR_LOG(xrStringToPath(xr_instance, allSubactionPathNames[i].c_str(), &allSubactionPaths[i])); + } + std::fill(handInteractionProfiles.begin(), handInteractionProfiles.end(), nullptr); + std::lock_guard registryGuard(inputHandleRegistryLock); + for (auto& [name, handle] : inputHandleRegistry) { + handle->devicePath = XR_NULL_PATH; + if (!handle->devicePathString.empty()) + OC_XR_LOG(xrStringToPath(xr_instance, handle->devicePathString.c_str(), &handle->devicePath)); + } + } + if (!rebuildPending) + return; + rebuildPending = false; + if (manifestToRebuild.empty() && !rebuildLegacy) + return; // the game had no actions + OOVR_LOG("Making the game's actions again on the new OpenXR instance"); + if (!manifestToRebuild.empty()) { + if (EVRInputError err = SetActionManifestPath(manifestToRebuild.c_str()); err == vr::VRInputError_None) + return; + else + OOVR_LOGF("The game's manifest couldn't be loaded again (%d): legacy input instead", (int)err); + } + LoadEmptyManifestIfRequired(); +} + void BaseInput::LoadEmptyManifestIfRequired() { if (hasLoadedActions) return; + // Asked for, legacy input comes in place of the info set (which would cost a session restart) + legacyInputAsked = true; + // Not before the game's first frame on its own device: the session restart for it would come anyway, and a + // manifest the game loads by then would need another + if (!XrBackend::InputsMayAttach()) + return; - // As in SetActionManifestPath, exclusive to the end; another thread may have loaded the actions while this waited + // As in SetActionManifestPath, exclusive to the end; another thread may have loaded the actions while this waited. + // Nor while a lost instance is made again: the actions are made on the new one. auto sessionLock = xr_session.lock(); - if (hasLoadedActions) + if (rebuildPending && manifestToRebuild.empty()) + rebuildLegacy = true; + if (hasLoadedActions || rebuildPending) return; restartingSession = true; @@ -840,11 +928,17 @@ void BaseInput::LoadEmptyManifestIfRequired() void BaseInput::BindInputsForSession() { + // Not attached to this session (yet) + trackerPoseSession = XR_NULL_HANDLE; + // This is called from DrvOpenXR::SetupSession. If we requested a session restart ourselves, we're also // going to bind the inputs ourselves anyway, so we don't want to do that twice. // If we didn't request the restart but we also haven't even loaded actions yet, there's nothing to bind yet. if (restartingSession || !hasLoadedActions) return; + // No session to bind to (a lost one was destroyed): the one made again binds them + if (!xr_gbl || !xr_session.get()) + return; // Since the session has changed, any actionspaces we previously created are now invalid for (const std::unique_ptr& action : actions.GetItems()) { @@ -892,7 +986,14 @@ void BaseInput::BindInputsForSession() XrSessionActionSetsAttachInfo attachInfo = { XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO }; attachInfo.actionSets = sets.data(); attachInfo.countActionSets = sets.size(); - OC_XR_LOG(xrAttachSessionActionSets(xr_session.get(), &attachInfo)); + const XrResult attached = xrAttachSessionActionSets(xr_session.get(), &attachInfo); + OC_XR_LOG(attached); + if (XR_SUCCEEDED(attached) && trackerPoseAction != XR_NULL_HANDLE) + trackerPoseSession = xr_session.get(); + // The trackers by role connected before the attach get their spaces now + if (TrackerPoseAction() != XR_NULL_HANDLE) + if (auto* backend = dynamic_cast(BackendManager::Instance().GetBackendInstance())) + backend->OnTrackerActionAttached(); // Setup hand tracking if supported if (xr_gbl->handTrackingProperties.supportsHandTracking) { @@ -1103,6 +1204,47 @@ XrResult BaseInput::SuggestBindings(XrInteractionProfileSuggestedBinding& sugges return xr_suggest_bindings_logged(suggested); } +// With XR_HTCX_vive_tracker_interaction: one pose action for every tracker role, each role a subaction path, bound to +// each role's grip pose. Its profile is the trackers' own (no binding file is loaded for it), so it's suggested here. +static XrAction CreateTrackerPoseAction(XrActionSet set) +{ + if (!xr_ext->ViveTrackersHTCX_Available()) + return XR_NULL_HANDLE; + std::vector roles; + std::vector poses; + for (const ViveTrackerRole& role : ViveTrackerRoles()) { + XrPath rolePath = XR_NULL_PATH, posePath = XR_NULL_PATH; + OC_XR_LOG(xrStringToPath(xr_instance, ViveTrackerRolePath(role).c_str(), &rolePath)); + OC_XR_LOG(xrStringToPath(xr_instance, (ViveTrackerRolePath(role) + "/input/grip/pose").c_str(), &posePath)); + if (rolePath == XR_NULL_PATH || posePath == XR_NULL_PATH) + continue; + roles.push_back(rolePath); + poses.push_back(posePath); + } + XrActionCreateInfo info = { XR_TYPE_ACTION_CREATE_INFO }; + info.actionType = XR_ACTION_TYPE_POSE_INPUT; + strcpy_arr(info.actionName, "tracker-pose"); + strcpy_arr(info.localizedActionName, "Tracker Pose"); + info.countSubactionPaths = (uint32_t)roles.size(); + info.subactionPaths = roles.data(); + XrAction action = XR_NULL_HANDLE; + OC_XR_LOG(xrCreateAction(set, &info, &action)); + if (action == XR_NULL_HANDLE) + return XR_NULL_HANDLE; + + XrPath profile = XR_NULL_PATH; + OC_XR_LOG(xrStringToPath(xr_instance, "/interaction_profiles/htc/vive_tracker_htcx", &profile)); + std::vector bindings; + for (XrPath pose : poses) + bindings.push_back({ action, pose }); + XrInteractionProfileSuggestedBinding suggested = { XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING }; + suggested.interactionProfile = profile; + suggested.suggestedBindings = bindings.data(); + suggested.countSuggestedBindings = (uint32_t)bindings.size(); + OC_XR_LOG(xr_suggest_bindings_logged(suggested)); + return action; +} + void BaseInput::CreateLegacyActions() { // Add the stuff required to make the backend work @@ -1190,6 +1332,10 @@ void BaseInput::CreateLegacyActions() suggested.countSuggestedBindings = 1; OC_XR_LOG(xr_suggest_bindings_logged(suggested)); } + + trackerPoseSession = XR_NULL_HANDLE; + trackerPoseAction = CreateTrackerPoseAction(legacyInputsSet); + trackerPoseActionGeneration++; } // The evaluators' clock: seconds, for the modes' delays and the actions' change times @@ -1248,9 +1394,10 @@ void BaseInput::SuggestRawInputs(const InteractionProfile& profile, std::vector< std::vector>& components = rawComponents[&profile]; components = profile.RawComponents(); + std::set suggested; // a component feeding two SteamVR inputs is suggested once for (const auto& [xrPath, steamvrPath] : components) { auto action = rawActions.find(WithoutHand(xrPath)); - if (action == rawActions.end()) + if (action == rawActions.end() || !suggested.insert(xrPath).second) continue; XrPath path = XR_NULL_PATH; OC_XR_LOG(xrStringToPath(xr_instance, xrPath.c_str(), &path)); @@ -1303,10 +1450,10 @@ bool BaseInput::SuggestRawBindings(const InteractionProfile& profile, const std: return true; } -std::optional> BaseInput::BindingsFromFiles(const Action& action) +std::optional> BaseInput::BindingsFromFiles(const Action& action, bool allTypes) { - // The files bind inputs; a pose, a skeleton and a vibration keep OpenXR's bound sources - if (action.type == ActionType::Pose || action.type == ActionType::Skeleton || action.type == ActionType::Vibration) + // The files bind inputs, so a pose, a skeleton and a vibration are answered only when allTypes + if (!allTypes && (action.type == ActionType::Pose || action.type == ActionType::Skeleton || action.type == ActionType::Vibration)) return std::nullopt; std::lock_guard evalGuard(evaluatorLock); std::optional> found; @@ -1923,9 +2070,55 @@ EVRInputError BaseInput::GetPoseActionData(VRActionHandle_t action, ETrackingUni break; } + // Bound on no hand: a tracker, if a tracker's binding file binds it + if (!pActionData->bActive) + TrackerPoseData(act->manifestName, eOrigin, restrictToDevice, pActionData); + return VRInputError_None; } +bool BaseInput::TrackerPoseData(const std::string& action, vr::ETrackingUniverseOrigin origin, const InputValueHandle* restrictToDevice, + InputPoseActionData_t* data) +{ + auto routes = trackerPoseRoutes.find(action); + if (routes == trackerPoseRoutes.end()) + return false; + for (const std::string& roleName : routes->second) { + std::optional role; + for (const ViveTrackerRole& r : ViveTrackerRoles()) + if (roleName == r.name) + role = r; + if (!role || (restrictToDevice && restrictToDevice->devicePathString != role->steamvrPath)) + continue; + std::shared_ptr dev = TrackerForRole(*role); + if (!dev) + continue; + data->bActive = true; + data->activeOrigin = vr::k_ulInvalidInputValueHandle; + GetInputSourceHandle(role->steamvrPath, &data->activeOrigin); + dev->GetPose(origin, &data->pose, TrackingStateType_Now); + return true; + } + return false; +} + +std::shared_ptr BaseInput::TrackerForRole(const ViveTrackerRole& role) +{ + // The tracker with that role: its controller type names it + const std::string type = ViveTrackerControllerType(role); + for (vr::TrackedDeviceIndex_t i = 0; i < vr::k_unMaxTrackedDeviceCount; i++) { + std::shared_ptr dev = BackendManager::Instance().GetDevice(i); + if (!dev || dev->GetTrackedDeviceClass() != vr::TrackedDeviceClass_GenericTracker) + continue; + char buffer[vr::k_unMaxPropertyStringSize] = {}; + vr::ETrackedPropertyError err = vr::TrackedProp_Success; + dev->GetStringTrackedDeviceProperty(vr::Prop_ControllerType_String, buffer, sizeof(buffer), &err); + if (err == vr::TrackedProp_Success && type == buffer) + return dev; + } + return nullptr; +} + EVRInputError BaseInput::GetPoseActionDataRelativeToNow(VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, InputPoseActionData_t* pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice) { // Same function, different name - the 'RelativeToNow' suffix was added when GetPoseActionDataForNextFrame was added @@ -2494,10 +2687,17 @@ EVRInputError BaseInput::GetActionOrigins(VRActionSetHandle_t actionSetHandle, V VR_ARRAY_COUNT(originOutCount) VRInputValueHandle_t* originsOut, uint32_t originOutCount) { auto sessionLock = xr_session.lock_shared(); // held while reading: a session restart waits for it - GET_ACTION_SET_FROM_HANDLE(set, actionSetHandle); GET_ACTION_FROM_HANDLE(act, digitalActionHandle); + if (!originsOut && originOutCount) + return VRInputError_InvalidParam; + // No set: no origins, and no error, as SteamVR answers + if (actionSetHandle == vr::k_ulInvalidActionSetHandle) { + if (originsOut) + ZeroMemory(originsOut, originOutCount * sizeof(*originsOut)); + return VRInputError_None; + } + GET_ACTION_SET_FROM_HANDLE(set, actionSetHandle); - // TODO find something that passes in non-matching values and see what results it wants, or try it with SteamVR if (act->set != set) { // The action isn't in that set: no origins for it there OOVR_LOGF("GetActionOrigins: set mismatch %s vs %s", set->name.c_str(), act->fullName.c_str()); @@ -2507,8 +2707,6 @@ EVRInputError BaseInput::GetActionOrigins(VRActionSetHandle_t actionSetHandle, V if (act->type == ActionType::EyeTracking) return VRInputError_InvalidHandle; - if (!originsOut && originOutCount) - return VRInputError_InvalidParam; if (originsOut) ZeroMemory(originsOut, originOutCount * sizeof(*originsOut)); @@ -2680,8 +2878,8 @@ EVRInputError BaseInput::GetActionBindingInfo(VRActionHandle_t actionHandle, OOV return VRInputError_None; // From the controllers' binding files, as SteamVR answers: OpenXR's bound sources have no mode or slot, and - // nothing for a d-pad - if (std::optional> fromFiles = BindingsFromFiles(*action)) { + // nothing for a d-pad. A pose and a skeleton are listed too, and a vibration with no device or input path. + if (std::optional> fromFiles = BindingsFromFiles(*action, true)) { uint32_t written = 0; for (const ActionBinding& b : *fromFiles) { if (written >= unBindingInfoCount) @@ -2711,57 +2909,17 @@ EVRInputError BaseInput::GetActionBindingInfo(VRActionHandle_t actionHandle, OOV // TODO should we return an error if there are no sources bound? - // The bindings written, in order, without the sources left out + // A vibration's binding is told with every field empty, as SteamVR answers: one per bound output (a source that + // isn't one is left out) uint32_t written = 0; for (size_t i = 0; i < boundActionPaths.size() && written < unBindingInfoCount; i++) { - OOVR_InputBindingInfo_t& info = bindingInfo[written]; - XrPath path = boundActionPaths[i]; - - uint32_t pathLen = 0; - OC_XR_LOG(xrPathToString(xr_instance, path, 0, &pathLen, nullptr)); - if (pathLen == 0) - continue; // the path couldn't be read: this binding is left out - std::vector chars(pathLen); - OC_XR_LOG(xrPathToString(xr_instance, path, chars.size(), &pathLen, chars.data())); - std::string pathStr(chars.data(), chars.size()); - - std::vector parts; - stringSplit(pathStr, parts); - if (parts.size() < 5) { - // Not a /user///input/ path: this binding is left out - OOVR_LOG_ONCEF("A bound source path with fewer than five parts, left out: %s", pathStr.c_str()); + char chars[XR_MAX_PATH_LENGTH] = {}; + uint32_t len = 0; + if (XR_FAILED(xrPathToString(xr_instance, boundActionPaths[i], sizeof(chars), &len, chars))) continue; - } - - // The last part of the string - which is something like '/user/hand/right/input/a/click' - is the mode - strcpy_arr(info.rchModeName, parts.back().c_str()); - - // Hardcode the first three parts of the string as being the device path, and the 4th and 5th ones as - // being the input path. - std::string devicePath = pathFromParts({ parts.at(0), parts.at(1), parts.at(2) }); - std::string inputPath = pathFromParts({ parts.at(3), parts.at(4) }); - strcpy_arr(info.rchDevicePathName, devicePath.c_str()); - strcpy_arr(info.rchInputPathName, inputPath.c_str()); - - // FIXME replace this initial hacky thing - switch (action->type) { - case ActionType::Boolean: - strcpy_arr(info.rchModeName, "button"); - strcpy_arr(info.rchInputSourceType, "button"); - break; - case ActionType::Vector1: - strcpy_arr(info.rchModeName, "trigger"); - strcpy_arr(info.rchInputSourceType, "trigger"); - break; - case ActionType::Vector2: - strcpy_arr(info.rchModeName, "joystick"); - strcpy_arr(info.rchInputSourceType, "joystick"); - break; - default: - OOVR_LOGF("Unimplemented action type %d for %s: no mode name", static_cast(action->type), pathStr.c_str()); - break; - } - written++; + const std::string path(chars, strnlen(chars, sizeof(chars))); + if (path.starts_with("/user/") && path.find("/output/") != std::string::npos) + written++; } if (punReturnedBindingInfoCount) *punReturnedBindingInfoCount = written; @@ -2865,6 +3023,9 @@ std::shared_ptr BaseInput::ivhToDev(VRInputValueHandle_t handle) hand = ITrackedDevice::HAND_RIGHT; break; default: + // A tracker by the path SteamVR binds its pose on + if (std::optional role = ViveTrackerRoleForSteamVRPath(ivh->devicePathString)) + return TrackerForRole(*role); OOVR_SOFT_ABORTF("Cannot get invalid device from handle '%s'", ivh->path.c_str()); return nullptr; } diff --git a/OpenOVR/Reimpl/BaseInput.h b/OpenOVR/Reimpl/BaseInput.h index 4dc6fefe..b54a1d34 100644 --- a/OpenOVR/Reimpl/BaseInput.h +++ b/OpenOVR/Reimpl/BaseInput.h @@ -4,6 +4,7 @@ // FIXME don't do that, it's ugly and slows down the build when modifying headers #include "Drivers/Backend.h" +#include "Misc/Input/ViveTrackerRoles.h" #include #include #include @@ -244,6 +245,12 @@ class BaseInput { XrHandTrackerEXT handTrackers[2] = { XR_NULL_HANDLE, XR_NULL_HANDLE }; + /** With XR_HTCX_vive_tracker_interaction: the one pose action of every tracker role (each role's path is one of + * its subaction paths), in OpenLamina's own action set; null without it or before the actions are made */ + XrAction TrackerPoseAction() const { return trackerPoseSession != XR_NULL_HANDLE && trackerPoseSession == xr_session.get() ? trackerPoseAction : XR_NULL_HANDLE; } + /** Counts the tracker actions made: a new one needs new spaces */ + uint64_t TrackerPoseActionGeneration() const { return trackerPoseActionGeneration; } + // --------------- Handle management --------------- // /** Sets the path to the action manifest JSON file that is used by this application. If this information @@ -484,6 +491,12 @@ class BaseInput { */ void LoadEmptyManifestIfRequired(); + // The OpenXR instance is lost: the actions' handles went with it, and are forgotten (the session lock held) + void _ForgetInstance(); + // On the new instance and its session: the actions and bindings are made again from the manifest that was loaded + // (or legacy input's), if _ForgetInstance forgot any + void _RebuildForNewInstance(); + /** * Update the input stuff, called by BaseSystem. * @@ -508,7 +521,22 @@ class BaseInput { void GetHandSpace(ITrackedDevice::TrackedDeviceType hand, XrSpace& space, bool aimPose); bool AreActionsLoaded(); + // The game asked for legacy input: it's loaded (at once, or at its next call once it may be attached), with no info + // set before it + bool LegacyInputAsked() const { return legacyInputAsked; } + +private: + // The actions, action sets and their evaluators go (destroyHandles: with xrDestroyActionSet; not when the instance + // they belonged to is gone) + void DropActions(bool destroyHandles); + // The manifest (empty for legacy input) whose actions _ForgetInstance forgot, to be loaded again; under the session + // lock + std::string manifestToRebuild; + bool rebuildPending = false; + bool rebuildLegacy = false; // legacy input's actions are made again (there's no manifest to) + bool pathsStale = false; // the cached paths are the lost instance's +public: /** One hand's laser for pointing at overlays (LaserMouse) */ struct HandPointer { XrPosef aim; // the aim pose: the laser runs along its -Z @@ -751,6 +779,12 @@ class BaseInput { return info; } } + // A tracker by the path SteamVR binds its pose on: /user/waist, /user/foot/left + if (std::optional role = ViveTrackerRoleForSteamVRPath(path)) { + info.type = InputSource::OTHER; + info.devicePath = role->steamvrPath; + return info; + } // Trackers are named by their role or serial: /user/vive_tracker_htcx/role/waist static const std::string trackerPrefix = "/user/vive_tracker"; if (path.starts_with(trackerPrefix)) { @@ -871,6 +905,7 @@ class BaseInput { // Set under the exclusive session lock; read without it on the way in to LoadEmptyManifestIfRequired std::atomic hasLoadedActions = false; + std::atomic legacyInputAsked = false; std::string loadedActionsPath; std::mutex loadedActionsPathLock; // read before the session lock, to answer a repeated manifest at once bool usingLegacyInput = false; @@ -896,6 +931,19 @@ class BaseInput { XrActionSet legacyInputsSet = XR_NULL_HANDLE; + // In the legacy set when XR_HTCX_vive_tracker_interaction is enabled: every tracker role's grip pose + XrAction trackerPoseAction = XR_NULL_HANDLE; + std::atomic trackerPoseSession{ XR_NULL_HANDLE }; // the session the action is attached to + std::atomic trackerPoseActionGeneration{ 0 }; + // The pose actions (manifest names, lower-cased) the game's binding files for trackers bind, and the roles they + // bind them on (waist, left_foot...) + std::map> trackerPoseRoutes; + /** A pose action's data from the tracker whose role a tracker's binding file binds it on; false if none does */ + bool TrackerPoseData(const std::string& action, vr::ETrackingUniverseOrigin origin, const InputValueHandle* restrictToDevice, + InputPoseActionData_t* data); + /** The tracker with that role; null if none has it */ + static std::shared_ptr TrackerForRole(const ViveTrackerRole& role); + // In the legacy set when XR_EXT_eye_gaze_interaction is enabled: the gaze pose, and its space in this session XrAction eyeGazeAction = XR_NULL_HANDLE; XrSpace eyeGazeSpace = XR_NULL_HANDLE; @@ -932,8 +980,8 @@ class BaseInput { * controller has to one of the manifest's actions or bindings holds a haptic; false (nothing done) if not */ bool SuggestRawBindings(const InteractionProfile& profile, const std::string& bindingsPath, std::vector& bindings); /** An input action's bindings on the controllers in use, from their binding files; nothing if no controller in - * use has one, or for a pose, a skeleton or a vibration. Takes evaluatorLock. */ - std::optional> BindingsFromFiles(const Action& action); + * use has one, or for a pose, a skeleton or a vibration unless allTypes. Takes evaluatorLock. */ + std::optional> BindingsFromFiles(const Action& action, bool allTypes = false); /** One hand's raw inputs (index into allSubactionPaths) on a profile, by SteamVR path, into state */ void ReadRawInputs(size_t hand, const InteractionProfile& profile, RawInputState& state); /** The old input's evaluator for a controller's profile, evaluated once per sync; null if it has none. @@ -1053,9 +1101,11 @@ std::string HandBoneName(vr::BoneIndex_t bone, bool rightHand); /** The inverse of BaseInput::ParentSpaceSkeletonToModelSpace */ void ModelSpaceSkeletonToParentSpace(vr::VRBoneTransform_t* joints); -/** Compressed bone data, OpenComposite's own format: little-endian { char magic[4] = "OCSK"; uint16_t version = 1; - * uint8_t space; uint8_t range; uint32_t count = 31; } then the 31 transforms */ -constexpr uint32_t kCompressedBonesSize = 12 + 31 * sizeof(vr::VRBoneTransform_t); +/** Compressed bone data, OpenComposite's own format: a 2-byte header { uint8_t tag = 0xB1; uint8_t space | range << 4; } + * then the 31 transforms, little-endian (sizeof(VRBoneTransform_t) * boneCount + 2, the OpenVR header's limit). The + * older layout, { char magic[4] = "OCSK"; uint16_t version = 1; + * uint8_t space; uint8_t range; uint32_t count = 31; } then the transforms (1004 bytes), is still read. */ +constexpr uint32_t kCompressedBonesSize = 2 + 31 * sizeof(vr::VRBoneTransform_t); /** Writes the bones into out if outSize is big enough; the size needed (kCompressedBonesSize) */ uint32_t CompressBones(OOVR_EVRSkeletalTransformSpace space, vr::EVRSkeletalMotionRange range, const vr::VRBoneTransform_t* bones31, void* out, uint32_t outSize); /** Reads bones back into out31, converted to the space wanted. *storedSpace (if given) is the space they were in. */ diff --git a/OpenOVR/Reimpl/BaseInput_Hand.cpp b/OpenOVR/Reimpl/BaseInput_Hand.cpp index 21c127c2..42b66ca5 100644 --- a/OpenOVR/Reimpl/BaseInput_Hand.cpp +++ b/OpenOVR/Reimpl/BaseInput_Hand.cpp @@ -643,7 +643,11 @@ struct CompressedHeader { uint32_t count; }; static_assert(sizeof(CompressedHeader) == 12, "the compressed header is 12 bytes"); +// The first byte of the 2-byte header; the second has the space in its low four bits and the range in its high four +constexpr uint8_t kCompressedTag = 0xB1; static_assert(sizeof(VRBoneTransform_t) == 32, "a bone is 32 bytes"); +// The older layout's size: CompressedHeader then the bones, still read +constexpr uint32_t kOldCompressedBonesSize = sizeof(CompressedHeader) + eBone_Count * sizeof(VRBoneTransform_t); } // namespace @@ -687,9 +691,9 @@ uint32_t CompressBones(OOVR_EVRSkeletalTransformSpace space, EVRSkeletalMotionRa { if (!out || outSize < kCompressedBonesSize || !bones31) return kCompressedBonesSize; - CompressedHeader header = { { 'O', 'C', 'S', 'K' }, 1, (uint8_t)space, (uint8_t)range, eBone_Count }; - // Every platform OpenComposite builds for is little-endian, so the structs go as they are - memcpy(out, &header, sizeof(header)); + // Every platform OpenComposite builds for is little-endian, so the bones go as they are + uint8_t header[2] = { kCompressedTag, (uint8_t)(((uint8_t)space & 0xF) | (((uint8_t)range & 0xF) << 4)) }; + memcpy(out, header, sizeof(header)); memcpy((uint8_t*)out + sizeof(header), bones31, sizeof(VRBoneTransform_t) * eBone_Count); return kCompressedBonesSize; } @@ -699,16 +703,29 @@ EVRInputError DecompressBones(const void* in, uint32_t size, std::optional> givenSize; bool copyMirrorX = false, copyMirrorY = false; + // The texture is shown from an image whose rows run the other way up (an OpenGL texture shared into a Vulkan + // image): its bounds are taken upside down + bool shownFlipY = false; + // The texture was shared (ShowShared) from the program's Vulkan texture data, which is gone once the call returned + bool sharedFromVulkan = false; + // The bounds as they apply to the image shown + VRTextureBounds_t ShownBounds() const + { + VRTextureBounds_t b = textureBounds; + if (shownFlipY) + std::swap(b.vMin, b.vMax); + return b; + } + // The shared image's texture data (OverlayTextureShare), which the shown texture points at + vr::VRVulkanTextureData_t sharedImage{}; // Sets the layer's image rectangle to the bounds' area of the texture's copy void ApplyTextureBounds() @@ -206,7 +221,8 @@ class BaseOverlay::OverlayData { if (!texture.handle || textureCopySize.width <= 0 || textureCopySize.height <= 0) return; TextureRegion region; - if (!RegionFromBounds(&textureBounds, (uint32_t)textureCopySize.width, (uint32_t)textureCopySize.height, region)) + const VRTextureBounds_t shownBounds = ShownBounds(); + if (!RegionFromBounds(&shownBounds, (uint32_t)textureCopySize.width, (uint32_t)textureCopySize.height, region)) return; compositionLayer.quad.subImage.imageRect = overlay_maths::ImageRect(region.x0, region.y0, region.x1, region.y1, (uint32_t)textureCopySize.width, (uint32_t)textureCopySize.height, copyMirrorX, copyMirrorY); @@ -215,8 +231,9 @@ class BaseOverlay::OverlayData { // Copies the texture whole into the compositor's swapchain, mirrored where the bounds run backwards void CopyTexture(Compositor& compositor, const Texture_t& shown) { - copyMirrorX = textureBounds.uMin > textureBounds.uMax; - copyMirrorY = textureBounds.vMin > textureBounds.vMax; + const VRTextureBounds_t shownBounds = ShownBounds(); + copyMirrorX = shownBounds.uMin > shownBounds.uMax; + copyMirrorY = shownBounds.vMin > shownBounds.vMax; const VRTextureBounds_t whole = { copyMirrorX ? 1.0f : 0.0f, copyMirrorY ? 1.0f : 0.0f, copyMirrorX ? 0.0f : 1.0f, copyMirrorY ? 0.0f : 1.0f }; XrSwapchainSubImage& subImage = compositionLayer.quad.subImage; // the same for quad and cylinder layers compositor.Invoke(&shown, &whole, subImage); @@ -330,9 +347,21 @@ struct BaseOverlay::Sharing { uint32_t pid; uint64_t handle; // in its own program vr::VROverlayHandle_t local; // the handle FindOverlay gave for it + // What this program asked of it (SendRemoteCommand) and its program hasn't published yet: what this program's + // getters answer, each until its program publishes it, or for at most kPendingSeconds + struct Pending { + std::optional shown; + std::optional alpha, width; + std::optional sortOrder; + std::map flags; + double until = 0; + } pending; }; + static constexpr double kPendingSeconds = 2.0; std::map> remotes; std::map remoteKeys; + // FindOverlay's handle for the dashboard's panel (system.systemui), once asked for + vr::VROverlayHandle_t systemUi = vr::k_ulOverlayHandleInvalid; }; struct BaseOverlay::DashboardState { @@ -734,6 +763,10 @@ namespace { // The cursor: a circle on a 2 cm quad constexpr int kCursorPixels = 64; constexpr float kCursorMetres = 0.02f; +// The lasers' beams: a gradient image, faint at the hand and bright where it meets a target, this thick; ahead this far +// while the dashboard is open and the laser meets nothing +constexpr int kBeamPixelsWide = 4, kBeamPixelsLong = 64; +constexpr float kBeamMetres = 0.004f, kBeamReach = 2.0f; // A message box: a panel a millimetre per pixel, its buttons in a row along the bottom constexpr int kPanelWidth = 1000, kPanelHeight = 500; @@ -923,6 +956,34 @@ class BaseOverlay::Pointing { bool cursorShown = false; XrPosef cursorPose{ { 0, 0, 0, 1 }, { 0, 0, 0 } }; + // Each hand's beam, from where it aims to where it meets a target: one swapchain for both, made and filled on + // the game's thread + std::unique_ptr beamChain; + bool beamUnavailable = false; + bool beamShown[2] = { false, false }; + overlay_maths::Placement beams[2]{}; + XrCompositionLayerQuad beamLayers[2]{}; + void HideBeams() { beamShown[0] = beamShown[1] = false; } + bool BeamReady() + { + if (!beamChain && !beamUnavailable) { + beamChain = CpuSwapchain::Create(kBeamPixelsWide, kBeamPixelsLong); + beamUnavailable = !beamChain; + } + if (!beamChain) + return false; + if (!beamChain->Live()) { + // Rows top (the far end) to bottom (the hand) + Canvas canvas(kBeamPixelsWide, kBeamPixelsLong); + for (int y = 0; y < kBeamPixelsLong; y++) { + const uint32_t alpha = 0xe0 - (uint32_t)((0xe0 - 0x20) * y / (kBeamPixelsLong - 1)); + canvas.FillRect(0, y, kBeamPixelsWide, 1, 0x7fbfff00 | alpha); + } + beamChain->Upload(canvas.Pixels()); + } + return beamChain->Live(); + } + // The keyboard's quad; its placement in keyboardOrigin, and in the frame's space as last drawn std::unique_ptr keyboardChain; bool keyboardShown = false; @@ -1035,10 +1096,46 @@ bool BaseOverlay::SceneAppPoints() const && SharedStore::IsSameProcessAlive(pid, scene["start"].isUInt64() ? scene["start"].asUInt64() : 0); } -void BaseOverlay::TakeRemotePointerEvents() +void BaseOverlay::TakeRemoteEvents() { const uint32_t self = oc_current_pid(); for (const StoreEvent& s : SharedStore::Get().PollEvents(sharing->eventCursor)) { + if (s.eventType == OcEvent_OverlayCommand) { + // Another program's change to one of this program's overlays, made as this program's own call makes it + const OcOverlayCommand c = OcUnpackOverlayCommand(s.data); + OverlayData* o = c.pid == self ? OverlayAt(c.handle) : nullptr; + if (!o) + continue; + switch (c.kind) { + case OcOverlayCommand::Show: + ShowOverlay(c.handle); + break; + case OcOverlayCommand::Hide: + HideOverlay(c.handle); + break; + case OcOverlayCommand::Alpha: + SetOverlayAlpha(c.handle, c.number); + break; + case OcOverlayCommand::Width: + SetOverlayWidthInMeters(c.handle, c.number); + break; + case OcOverlayCommand::Flag: + if (c.flag < 64) + SetOverlayFlag(c.handle, (VROverlayFlags)c.flag, c.enabled); + break; + case OcOverlayCommand::SortOrder: + SetOverlaySortOrder(c.handle, c.sortOrder); + break; + case OcOverlayCommand::Event: { + VREvent_t e{}; + e.eventType = c.eventType; + memcpy(&e.data, c.data, sizeof(c.data)); + o->QueueEvent(e); + break; + } + } + continue; + } if (s.eventType != OcEvent_RemotePointer) continue; const RemotePointerEvent r = UnpackRemotePointer(s.data); @@ -1110,7 +1207,7 @@ void BaseOverlay::_UpdateDashboard() DashboardChanged(d.dashboard.Open(), requestedKey.c_str()); } else if (!d.dashboard.Open() && PidOf(doc["scene_pid"]) == self && doc["open"].isBool() && doc["open"].asBool()) { // The document says this program's dashboard is open when it isn't: it is put right - store.Update(StoreDoc::Dashboard, [&](Json::Value& written) { + store.UpdateLater(StoreDoc::Dashboard, "", [self](Json::Value& written) { if (written.isObject() && PidOf(written["scene_pid"]) == self) written["open"] = false; }); @@ -1190,7 +1287,8 @@ void BaseOverlay::_RecentreIfAsked() // The open dashboard's panel stays where it is in the room const glm::mat4 toNew = glm::affineInverse(S2G_m34(BaseChaperoneSetup::RecentredOrigin(head.mDeviceToAbsoluteTracking))); const uint32_t self = oc_current_pid(); - SharedStore::Get().Update(StoreDoc::Dashboard, [&](Json::Value& doc) { + // Not keyed: each recentre moves the panel on from where the last one left it + SharedStore::Get().UpdateLater(StoreDoc::Dashboard, "", [self, toNew](Json::Value& doc) { XrPosef panel{}; if (!doc.isObject() || PidOf(doc["scene_pid"]) != self || !PoseFromJson(doc["panel_pose"], panel)) return; @@ -1229,15 +1327,12 @@ void BaseOverlay::_UpdateBounds() auto session = xr_session.lock_shared(); // the play area and the devices' poses are read from the session if (!xr_session.get()) return; - // The play area: the stage's bounds, else the committed room setup's (Monado reports no stage bounds), read again - // at most once a second + // The play area the chaperone getters answer with (the stage's bounds, else the committed room setup's: Monado + // reports no stage bounds), read again at most once a second const double now = NowSeconds(); if (!preview && (b.areaRead < 0 || now - b.areaRead >= 1.0)) { b.areaRead = now; - XrExtent2Df extent{}; - XrResult res = xrGetReferenceSpaceBoundsRect(xr_session.get(), XR_REFERENCE_SPACE_TYPE_STAGE, &extent); - const bool known = XR_SUCCEEDED(res) && res != XR_SPACE_BOUNDS_UNAVAILABLE && extent.width > 0 && extent.height > 0; - const XrExtent2Df area = BoundsPlayArea(known ? &extent : nullptr, known ? Json::Value() : SharedStore::Get().Read(StoreDoc::Chaperone)); + const XrExtent2Df area = CurrentPlayArea(); b.width = area.width; b.depth = area.height; } @@ -1302,17 +1397,20 @@ void BaseOverlay::DashboardChanged(bool open, const char* overlayKey) active = &t; } const XrPosef panel = AheadOfHead(vr::TrackingUniverseStanding, 1.5f, 0.2f); - store.Update(StoreDoc::Dashboard, [&](Json::Value& doc) { + const uint32_t activePid = active ? active->pid : 0; + const uint64_t activeOverlay = active ? active->handle : 0; + // From the frame: written by the store's writer thread, the whole document, so only the last is made + store.UpdateLater(StoreDoc::Dashboard, "open", [self, activePid, activeOverlay, panel](Json::Value& doc) { doc = Json::Value(Json::objectValue); doc["open"] = true; doc["scene_pid"] = self; doc["scene_start"] = (Json::UInt64)SharedStore::OwnStartTime(); - doc["active_pid"] = active ? active->pid : 0; - doc["active_overlay"] = (Json::UInt64)(active ? active->handle : 0); + doc["active_pid"] = activePid; + doc["active_overlay"] = (Json::UInt64)activeOverlay; doc["panel_pose"] = PoseJson(panel); }); } else { - store.Update(StoreDoc::Dashboard, [&](Json::Value& doc) { + store.UpdateLater(StoreDoc::Dashboard, "open", [self](Json::Value& doc) { doc = Json::Value(Json::objectValue); doc["open"] = false; doc["scene_pid"] = self; @@ -1359,6 +1457,10 @@ void BaseOverlay::_PublishOverlays() if (sh.lastTry >= 0 && now - sh.lastTry < 0.1) return; sh.lastTry = now; + { + std::lock_guard lock(layersLock); + TakeRemoteEvents(); + } if (!sh.appKeyRead) { sh.appKey = CurrentProcessAppKey(); sh.appKeyRead = true; @@ -1454,6 +1556,13 @@ void BaseOverlay::_PublishOverlays() // As the game's own targets have it: a signed number on the pointer's side e["sort_order"] = std::min(o->sortOrder, INT_MAX - 1); e["visible"] = placed && (o->visible || o->dashboard) && (o->texture.handle != nullptr || !o->rawImage.Empty()); + // As IsOverlayVisible answers it in this program, and what else other programs read through FindOverlay + e["shown"] = ShownOnItsOwn(*o) && ParentsShown(*o); + e["alpha"] = round(o->colour.a, 0.001f); + e["mouse_scale"] = Json::Value(Json::arrayValue); + e["mouse_scale"].append(round(o->mouseScale.v[0], 0.001f)); + e["mouse_scale"].append(round(o->mouseScale.v[1], 0.001f)); + e["rendering_pid"] = o->renderingPid; e["dashboard"] = o->dashboard; if (o->thumbnail) e["thumbnail"] = true; @@ -1478,7 +1587,9 @@ void BaseOverlay::_PublishOverlays() return; const double wallClock = std::chrono::duration(std::chrono::system_clock::now().time_since_epoch()).count(); - SharedStore::Get().Update(StoreDoc::Overlays, [&](Json::Value& d) { + const std::string appKey = sh.appKey; + // Written by the store's writer thread after the frame: only the last list not yet written is + SharedStore::Get().UpdateLater(StoreDoc::Overlays, "overlays", [ended, list, helper, self, appKey, wallClock](Json::Value& d) { if (!d.isObject()) d = Json::Value(Json::objectValue); for (const std::string& name : d.getMemberNames()) @@ -1491,7 +1602,7 @@ void BaseOverlay::_PublishOverlays() } Json::Value& mine = d[std::to_string(self)]; mine = Json::Value(Json::objectValue); - mine["app"] = sh.appKey; + mine["app"] = appKey; mine["start"] = (Json::UInt64)SharedStore::OwnStartTime(); mine["updated"] = wallClock; mine["overlays"] = list; @@ -1811,6 +1922,44 @@ void BaseOverlay::_UpdatePointer() if (std::optional point = sharing->remote.CursorPoint()) p.ShowCursor(*point); } + + // The beams: each tracked hand's, to what it meets (whether or not the target hides the cursor there), or + // straight ahead while the dashboard is open; none otherwise. Turned towards the head. + p.HideBeams(); + std::optional head; + if (std::shared_ptr hmd = p.running ? BackendManager::Instance().GetDevice(vr::k_unTrackedDeviceIndex_Hmd) : nullptr) { + TrackedDevicePose_t pose{}; + hmd->GetPose(space, &pose, ETrackingStateType::TrackingStateType_Rendering); + if (pose.bPoseIsValid) { + const HmdMatrix34_t& m = pose.mDeviceToAbsoluteTracking; + head = XrVector3f{ m.m[0][3], m.m[1][3], m.m[2][3] }; + } + } + for (const PointerRay& ray : rays) { + const int h = ray.hand & 1; + if (!head || !ray.valid) + continue; + std::optional end; + if (std::optional at = p.mouse.Cursor(h)) { + end = at->point; + } else if (h == hand && pointRemote) { + if (std::optional point = sharing->remote.CursorPoint()) + end = point->position; + } + const float dirLength = std::sqrt(ray.dir.x * ray.dir.x + ray.dir.y * ray.dir.y + ray.dir.z * ray.dir.z); + if (!end && dash->shown && dirLength > 0) { + const float k = kBeamReach / dirLength; + end = XrVector3f{ ray.origin.x + ray.dir.x * k, ray.origin.y + ray.dir.y * k, ray.origin.z + ray.dir.z * k }; + } + if (!end) + continue; + if (std::optional beam = overlay_maths::BeamPlacement(ray.origin, *end, *head, kBeamMetres)) { + if (p.BeamReady()) { + p.beams[h] = *beam; + p.beamShown[h] = true; + } + } + } } dropped.reset(); // To the other programs, after any left from earlier frames. More than a few seconds' worth left: the other @@ -1838,7 +1987,7 @@ void BaseOverlay::_UpdatePointer() if (colon != std::string::npos) { const uint32_t pid = (uint32_t)std::strtoul(rest.substr(0, colon).c_str(), nullptr, 10); const uint64_t handle = std::strtoull(rest.substr(colon + 1).c_str(), nullptr, 10); - SharedStore::Get().Update(StoreDoc::Dashboard, [&](Json::Value& doc) { + SharedStore::Get().UpdateLater(StoreDoc::Dashboard, "tab", [pid, handle](Json::Value& doc) { if (doc.isObject() && doc["open"].isBool() && doc["open"].asBool()) { doc["active_pid"] = pid; doc["active_overlay"] = (Json::UInt64)handle; @@ -1869,6 +2018,18 @@ bool BaseOverlay::_AnyVisible() return false; } +void BaseOverlay::_OnSessionRebuilt() +{ + std::lock_guard lock(layersLock); + for (const auto& kv : overlays) { + OverlayData* overlay = kv.second; + // An image from memory finds its own swapchain gone (its upload is made again); a texture's compositor went + // with the session, and the layer mustn't name its swapchain any more + if (overlay && overlay->rawImage.Empty() && !overlay->compositor.lock()) + overlay->compositionLayer.quad.subImage = XrSwapchainSubImage{}; + } +} + int BaseOverlay::_BuildLayers(XrCompositionLayerBaseHeader* sceneLayer, XrCompositionLayerBaseHeader const* const*& layers, bool mayUpload) { // Note that at least on MSVC, this shouldn't be doing any memory allocations @@ -2063,6 +2224,12 @@ int BaseOverlay::_BuildLayers(XrCompositionLayerBaseHeader* sceneLayer, XrCompos kNotificationHeight * kPanelMetresPerPixel); layerHeaders.push_back((XrCompositionLayerBaseHeader*)&p.notificationLayer); } + for (int h = 0; h < 2; h++) { + if (p.beamShown[h] && p.beamChain && p.beamChain->Live()) { + p.beamLayers[h] = OwnQuad(*p.beamChain, p.beams[h].pose, p.beams[h].width, p.beams[h].height); + layerHeaders.push_back((XrCompositionLayerBaseHeader*)&p.beamLayers[h]); + } + } if (p.cursorShown && p.cursorChain && p.cursorChain->Live()) { p.cursorLayer = OwnQuad(*p.cursorChain, p.cursorPose, kCursorMetres, kCursorMetres); layerHeaders.push_back((XrCompositionLayerBaseHeader*)&p.cursorLayer); @@ -2092,7 +2259,17 @@ EVROverlayError BaseOverlay::FindOverlay(const char* pchOverlayKey, VROverlayHan } } - // Another program's overlay, as the store has it: a handle its state can be read through (not changed) + // The dashboard's panel, wherever the scene app shows it: a handle its placement can be read through + if (std::string(pchOverlayKey) == "system.systemui") { + std::lock_guard lock(layersLock); + if (sharing->systemUi == k_ulOverlayHandleInvalid) + sharing->systemUi = nextOverlayHandle++; + *pOverlayHandle = sharing->systemUi; + return VROverlayError_None; + } + + // Another program's overlay, as the store has it: a handle its state can be read through, and changed through its + // program (SendRemoteCommand) const uint32_t self = oc_current_pid(); const Json::Value doc = SharedStore::Get().Read(StoreDoc::Overlays); if (doc.isObject()) { @@ -2110,6 +2287,9 @@ EVROverlayError BaseOverlay::FindOverlay(const char* pchOverlayKey, VROverlayHan remote = std::make_unique(); remote->local = nextOverlayHandle++; } + // Another overlay under the key: nothing asked of the last one applies to it + if (remote->pid != pid || remote->handle != o["handle"].asUInt64()) + remote->pending = {}; remote->pid = pid; remote->handle = o["handle"].asUInt64(); sharing->remoteKeys[remote->local] = pchOverlayKey; @@ -2126,6 +2306,37 @@ bool BaseOverlay::RemoteOverlayEntry(VROverlayHandle_t handle, Json::Value& entr { uint32_t pid = 0; uint64_t theirs = 0; + bool systemUi = false; + { + std::lock_guard lock(layersLock); + systemUi = handle != k_ulOverlayHandleInvalid && handle == sharing->systemUi; + } + if (systemUi) { + // The panel as the store's Dashboard document has it: where it is while it's open, shown only then + const Json::Value doc = SharedStore::Get().Read(StoreDoc::Dashboard); + XrPosef panel{ { 0, 0, 0, 1 }, { 0, 0, 0 } }; + const bool open = DashboardDocOpen(doc, SharedStore::IsSameProcessAlive) && PoseFromJson(doc["panel_pose"], panel); + entry = Json::Value(Json::objectValue); + entry["key"] = "system.systemui"; + entry["name"] = "System UI"; + entry["pose"] = PoseJson(panel); + entry["space"] = "standing"; + entry["width"] = Dashboard::kWidthMetres; + entry["height"] = Dashboard::kHeightMetres; + entry["curvature"] = 0.0; + entry["flags"] = (Json::UInt64)0; + entry["sort_order"] = 0; + entry["alpha"] = 1.0; + entry["visible"] = open; + entry["shown"] = open; + entry["mask"] = Json::Value(Json::arrayValue); + entry["mouse_scale"] = Json::Value(Json::arrayValue); + entry["mouse_scale"].append(Dashboard::kWidth); + entry["mouse_scale"].append(Dashboard::kHeight); + // Drawn by OpenLamina in the scene app + entry["rendering_pid"] = PidOf(doc["scene_pid"]); + return true; + } { std::lock_guard lock(layersLock); auto key = sharing->remoteKeys.find(handle); @@ -2142,12 +2353,140 @@ bool BaseOverlay::RemoteOverlayEntry(VROverlayHandle_t handle, Json::Value& entr for (const Json::Value& o : program["overlays"]) { if (o.isObject() && o["handle"].isUInt64() && o["handle"].asUInt64() == theirs) { entry = o; + ApplyPending(handle, entry); return true; } } return false; } +void BaseOverlay::ApplyPending(VROverlayHandle_t handle, Json::Value& entry) +{ + // Each value asked for is answered until the owner has published it: then its own (which may have changed since) + std::lock_guard lock(layersLock); + auto key = sharing->remoteKeys.find(handle); + if (key == sharing->remoteKeys.end()) + return; + Sharing::Remote::Pending& p = sharing->remotes[key->second]->pending; + if (NowSeconds() >= p.until) { + p = {}; + return; + } + auto settle = [&](auto& value, const char* field, auto published, auto equal) { + if (!value) + return; + if (entry[field].isNull() || !equal(published(entry[field]), *value)) + entry[field] = *value; + else + value.reset(); + }; + auto same = [](auto a, auto b) { return a == b; }; + auto nearly = [](float a, float b) { return std::fabs(a - b) < 0.002f; }; + settle(p.shown, "shown", [](const Json::Value& v) { return v.asBool(); }, same); + settle(p.alpha, "alpha", [](const Json::Value& v) { return v.asFloat(); }, nearly); + settle(p.width, "width", [](const Json::Value& v) { return v.asFloat(); }, nearly); + settle(p.sortOrder, "sort_order", [](const Json::Value& v) { return v.asUInt(); }, same); + uint64_t flags = entry["flags"].asUInt64(); + for (auto it = p.flags.begin(); it != p.flags.end();) { + const bool published = (flags & (1uLL << it->first)) != 0; + if (published == it->second) { + it = p.flags.erase(it); + continue; + } + flags = it->second ? flags | (1uLL << it->first) : flags & ~(1uLL << it->first); + ++it; + } + entry["flags"] = (Json::UInt64)flags; +} + +bool BaseOverlay::SendRemoteCommand(VROverlayHandle_t handle, OcOverlayCommand command, EVROverlayError& sent) +{ + { + std::lock_guard lock(layersLock); + auto key = sharing->remoteKeys.find(handle); + if (key == sharing->remoteKeys.end()) + return false; + const Sharing::Remote& remote = *sharing->remotes[key->second]; + command.pid = remote.pid; + command.handle = remote.handle; + } + // An overlay its program no longer has (or a program that ended) is gone, as an overlay destroyed here is + Json::Value entry; + if (!RemoteOverlayEntry(handle, entry)) { + sent = VROverlayError_InvalidHandle; + return true; + } + // A value already in effect (as published, rounded) isn't sent again: programs set some every frame, and the ring + // is every program's. Not a Hide: an overlay not shown under a hidden parent is still shown on its own. + const uint64_t flags = entry["flags"].asUInt64(); + const bool unchanged = (command.kind == OcOverlayCommand::Show && entry["shown"].asBool()) + || (command.kind == OcOverlayCommand::Alpha && entry["alpha"].isNumeric() && std::fabs(entry["alpha"].asFloat() - command.number) < 0.0005f) + || (command.kind == OcOverlayCommand::Width && entry["width"].isNumeric() && std::fabs(entry["width"].asFloat() - command.number) < 0.0005f) + || (command.kind == OcOverlayCommand::SortOrder && entry["sort_order"].isNumeric() && entry["sort_order"].asUInt() == std::min(command.sortOrder, INT_MAX - 1)) + || (command.kind == OcOverlayCommand::Flag && ((flags >> command.flag) & 1) == (command.enabled ? 1u : 0u)); + if (unchanged) { + sent = VROverlayError_None; + return true; + } + // Posted without the layers' lock: the store's own lock may be held by another program + std::optional> packed = OcPackOverlayCommand(command); + if (!packed || !SharedStore::Get().PostEvent(OcEvent_OverlayCommand, *packed)) { + sent = VROverlayError_RequestFailed; + return true; + } + sent = VROverlayError_None; + std::lock_guard lock(layersLock); + auto key = sharing->remoteKeys.find(handle); + if (key == sharing->remoteKeys.end()) + return true; + Sharing::Remote::Pending& p = sharing->remotes[key->second]->pending; + switch (command.kind) { + case OcOverlayCommand::Show: + case OcOverlayCommand::Hide: + p.shown = command.kind == OcOverlayCommand::Show; + break; + case OcOverlayCommand::Alpha: + p.alpha = command.number; + break; + case OcOverlayCommand::Width: + p.width = command.number; + break; + case OcOverlayCommand::Flag: + p.flags[command.flag] = command.enabled; + break; + case OcOverlayCommand::SortOrder: + p.sortOrder = std::min(command.sortOrder, INT_MAX - 1); // as it's published + break; + case OcOverlayCommand::Event: + return true; + } + p.until = NowSeconds() + Sharing::kPendingSeconds; + return true; +} + +void BaseOverlay::_PostOverlayEvent(VROverlayHandle_t handle, const VREvent_t* event) +{ + if (!event) + return; + { + std::lock_guard lock(layersLock); + if (OverlayData* o = OverlayAt(handle)) { + o->QueueEvent(*event); + return; + } + } + // Only the first 16 bytes of the event's data reach another program + OcOverlayCommand command; + command.kind = OcOverlayCommand::Event; + command.eventType = event->eventType; + memcpy(command.data, &event->data, sizeof(command.data)); + EVROverlayError sent; + if (!SendRemoteCommand(handle, command, sent)) + OOVR_LOG_ONCEF("PostOverlayEvent: no overlay with handle %llu", (unsigned long long)handle); + else if (sent != VROverlayError_None) + OOVR_LOG_ONCE("PostOverlayEvent: the event couldn't be sent to the overlay's program"); +} + bool BaseOverlay::RemoteOverlayPlacement(const Json::Value& entry, vr::ETrackingUniverseOrigin origin, overlay_maths::Placement& out) { if (!PoseFromJson(entry["pose"], out.pose)) @@ -2358,6 +2697,8 @@ EVROverlayError BaseOverlay::GetOverlayImageData(VROverlayHandle_t ulOverlayHand { std::lock_guard lock(layersLock); copied = overlay->rawImage; + if (overlay->sharedFromVulkan && copied.Empty()) + OC_UNSUPPORTED(VROverlayError_RequestFailed, "GetOverlayImageData: a Vulkan texture shared with the session's device can't be read back"); texture = overlay->texture; textureBounds = overlay->textureBounds; shared = overlay->compositor.lock(); @@ -2414,6 +2755,9 @@ EVROverlayError BaseOverlay::SetOverlayRenderingPid(VROverlayHandle_t ulOverlayH } uint32_t BaseOverlay::GetOverlayRenderingPid(VROverlayHandle_t ulOverlayHandle) { + Json::Value remote; + if (RemoteOverlayEntry(ulOverlayHandle, remote)) + return remote["rendering_pid"].asUInt(); OverlayData* overlay = LiveOverlay(ulOverlayHandle); if (!overlay) return 0; @@ -2421,6 +2765,16 @@ uint32_t BaseOverlay::GetOverlayRenderingPid(VROverlayHandle_t ulOverlayHandle) } EVROverlayError BaseOverlay::SetOverlayFlag(VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled) { + // A flag of 64 or more has no bit in the mask, and isn't sent + if ((uint32_t)eOverlayFlag < 64) { + OcOverlayCommand command; + command.kind = OcOverlayCommand::Flag; + command.flag = (uint32_t)eOverlayFlag; + command.enabled = bEnabled; + EVROverlayError sent; + if (SendRemoteCommand(ulOverlayHandle, command, sent)) + return sent; + } USEH_LOCKED(); if (bEnabled) { @@ -2472,6 +2826,14 @@ EVROverlayError BaseOverlay::GetOverlayColor(VROverlayHandle_t ulOverlayHandle, } EVROverlayError BaseOverlay::SetOverlayAlpha(VROverlayHandle_t ulOverlayHandle, float fAlpha) { + { + OcOverlayCommand command; + command.kind = OcOverlayCommand::Alpha; + command.number = fAlpha; + EVROverlayError sent; + if (SendRemoteCommand(ulOverlayHandle, command, sent)) + return sent; + } USEH_LOCKED(); overlay->colour.a = fAlpha; @@ -2480,6 +2842,13 @@ EVROverlayError BaseOverlay::SetOverlayAlpha(VROverlayHandle_t ulOverlayHandle, } EVROverlayError BaseOverlay::GetOverlayAlpha(VROverlayHandle_t ulOverlayHandle, float* pfAlpha) { + Json::Value remote; + if (RemoteOverlayEntry(ulOverlayHandle, remote)) { + if (!pfAlpha) + return VROverlayError_InvalidParameter; + *pfAlpha = remote["alpha"].isNumeric() ? remote["alpha"].asFloat() : 1.0f; + return VROverlayError_None; + } USEH(); if (!pfAlpha) return VROverlayError_InvalidParameter; @@ -2509,6 +2878,14 @@ EVROverlayError BaseOverlay::GetOverlayTexelAspect(VROverlayHandle_t ulOverlayHa } EVROverlayError BaseOverlay::SetOverlaySortOrder(VROverlayHandle_t ulOverlayHandle, uint32_t unSortOrder) { + { + OcOverlayCommand command; + command.kind = OcOverlayCommand::SortOrder; + command.sortOrder = unSortOrder; + EVROverlayError sent; + if (SendRemoteCommand(ulOverlayHandle, command, sent)) + return sent; + } USEH_LOCKED(); overlay->sortOrder = unSortOrder; return VROverlayError_None; @@ -2517,12 +2894,25 @@ EVROverlayError BaseOverlay::GetOverlaySortOrder(VROverlayHandle_t ulOverlayHand { if (!punSortOrder) return VROverlayError_InvalidParameter; + Json::Value remote; + if (RemoteOverlayEntry(ulOverlayHandle, remote)) { + *punSortOrder = remote["sort_order"].asUInt(); + return VROverlayError_None; + } USEH(); *punSortOrder = overlay->sortOrder; return VROverlayError_None; } EVROverlayError BaseOverlay::SetOverlayWidthInMeters(VROverlayHandle_t ulOverlayHandle, float fWidthInMeters) { + { + OcOverlayCommand command; + command.kind = OcOverlayCommand::Width; + command.number = fWidthInMeters; + EVROverlayError sent; + if (SendRemoteCommand(ulOverlayHandle, command, sent)) + return sent; + } USEH_LOCKED(); overlay->widthMeters = fWidthInMeters; @@ -2838,6 +3228,13 @@ EVROverlayError BaseOverlay::SetOverlayTransformProjection(VROverlayHandle_t ulO } EVROverlayError BaseOverlay::ShowOverlay(VROverlayHandle_t ulOverlayHandle) { + { + OcOverlayCommand command; + command.kind = OcOverlayCommand::Show; + EVROverlayError sent; + if (SendRemoteCommand(ulOverlayHandle, command, sent)) + return sent; + } USEH_LOCKED(); // A dashboard overlay is shown by the dashboard alone, which tells it if (!overlay->visible && !overlay->dashboard) @@ -2847,6 +3244,13 @@ EVROverlayError BaseOverlay::ShowOverlay(VROverlayHandle_t ulOverlayHandle) } EVROverlayError BaseOverlay::HideOverlay(VROverlayHandle_t ulOverlayHandle) { + { + OcOverlayCommand command; + command.kind = OcOverlayCommand::Hide; + EVROverlayError sent; + if (SendRemoteCommand(ulOverlayHandle, command, sent)) + return sent; + } USEH_LOCKED(); if (overlay->visible && !overlay->dashboard) overlay->QueueVisibilityEvent(false); @@ -2857,7 +3261,7 @@ bool BaseOverlay::IsOverlayVisible(VROverlayHandle_t ulOverlayHandle) { Json::Value remote; if (RemoteOverlayEntry(ulOverlayHandle, remote)) - return remote["visible"].asBool(); + return remote["shown"].isBool() ? remote["shown"].asBool() : remote["visible"].asBool(); USEHB(); std::lock_guard lock(layersLock); // Not while a parent it's placed relative to is hidden: it isn't drawn then @@ -2901,7 +3305,7 @@ bool BaseOverlay::PollNextOverlayEvent(VROverlayHandle_t ulOverlayHandle, VREven // The lasers and the keyboard queue events on the game's thread, and another program's pointer through the store std::lock_guard lock(layersLock); - TakeRemotePointerEvents(); + TakeRemoteEvents(); if (overlay->eventQueue.empty()) return false; @@ -2918,7 +3322,7 @@ bool BaseOverlay::PollNextAnyOverlayEvent(VREvent_t* pEvent, uint32_t eventSize, return false; std::lock_guard lock(layersLock); - TakeRemotePointerEvents(); + TakeRemoteEvents(); for (const auto& kv : overlays) { OverlayData* o = kv.second; if (!o || o->eventQueue.empty()) @@ -2956,7 +3360,18 @@ EVROverlayError BaseOverlay::SetOverlayInputMethod(VROverlayHandle_t ulOverlayHa } EVROverlayError BaseOverlay::GetOverlayMouseScale(VROverlayHandle_t ulOverlayHandle, HmdVector2_t* pvecMouseScale) { + Json::Value remote; + if (RemoteOverlayEntry(ulOverlayHandle, remote)) { + if (!pvecMouseScale) + return VROverlayError_InvalidParameter; + const Json::Value& scale = remote["mouse_scale"]; + const bool given = scale.isArray() && scale.size() == 2; + *pvecMouseScale = HmdVector2_t{ { given ? scale[0].asFloat() : 1.0f, given ? scale[1].asFloat() : 1.0f } }; + return VROverlayError_None; + } USEH(); + if (!pvecMouseScale) + return VROverlayError_InvalidParameter; *pvecMouseScale = overlay->mouseScale; @@ -3286,6 +3701,11 @@ EVROverlayError BaseOverlay::ClearOverlayCursorPositionOverride(VROverlayHandle_ } EVROverlayError BaseOverlay::SetOverlayTexture(VROverlayHandle_t ulOverlayHandle, const Texture_t* pTexture) { + // Only its creator, or the program it names as rendering it, sets an overlay's texture; a texture can't be handed + // to another program from here + Json::Value remote; + if (RemoteOverlayEntry(ulOverlayHandle, remote) && remote["rendering_pid"].asUInt() == oc_current_pid()) + OC_UNSUPPORTED(VROverlayError_RequestFailed, "SetOverlayTexture: another program's overlay's texture can't be set from this one"); USEH(); if (!pTexture) return VROverlayError_InvalidTexture; @@ -3345,6 +3765,13 @@ EVROverlayError BaseOverlay::SetOverlayTexture(VROverlayHandle_t ulOverlayHandle #else copy = xrBackend ? xrBackend->CopyOverlayTexture(&texture, &overlay->textureBounds, &why, overlay) : nullptr; #endif + // A Vulkan or OpenGL texture that can't be copied onto the session's device (through D3D11, on Windows) is + // shared with that device where it can be (Linux); else it's read back on the program's thread + if (!copy && (texture.eType == TextureType_Vulkan || texture.eType == TextureType_OpenGL)) { + if (ShowShared(*overlay, texture)) + return VROverlayError_None; + return ShowReadBack(*overlay, texture, why); + } if (!copy) OC_UNSUPPORTED(VROverlayError_InvalidTexture, "SetOverlayTexture: the overlay application's texture (type %d) can't be shown: %s", (int)texture.eType, why.c_str()); shown = Texture_t{ copy, TextureType_DirectX, texture.eColorSpace }; @@ -3359,6 +3786,8 @@ EVROverlayError BaseOverlay::SetOverlayTexture(VROverlayHandle_t ulOverlayHandle overlay->compositor.reset(); } overlay->SetTexture(texture); + overlay->shownFlipY = false; + overlay->sharedFromVulkan = false; overlay->textureCopySize = {}; overlay->givenSize = OverlayTextureSize(texture); // A texture replaces an image from memory @@ -3387,12 +3816,96 @@ EVROverlayError BaseOverlay::SetOverlayTexture(VROverlayHandle_t ulOverlayHandle return VROverlayError_None; } +bool BaseOverlay::ShowShared(OverlayData& overlay, const Texture_t& texture) +{ + auto* backend = (XrBackend*)BackendManager::Instance().GetBackendInstance(); + if (!backend) + return false; + bool flipY = false; + std::string why; + const VRVulkanTextureData_t* image = backend->ShareOverlayTexture(&texture, &overlay, &flipY, &why); + if (!image) { + OOVR_LOG_ONCEF("SetOverlayTexture: an overlay application's texture (type %d) isn't shared with the session's device (%s): it's read back", (int)texture.eType, why.c_str()); + return false; + } + overlay.sharedImage = *image; + Texture_t shown{ &overlay.sharedImage, TextureType_Vulkan, texture.eColorSpace }; + shown.eColorSpace = overlay.TextureColourSpace(shown.eColorSpace); + // The overlay is changed only once nothing can fail + std::shared_ptr compositor = overlay.compositor.lock(); + if (!compositor) { + compositor = backend->MakeSessionOverlayCompositor(&shown); + if (!compositor) { + backend->ReleaseSharedOverlayTexture(&overlay); + return false; + } + overlay.compositor = std::weak_ptr(compositor); + backend->RegisterOverlayCompositor(compositor); + } + + overlay.raw.reset(); + overlay.rawImage = {}; + overlay.SetTexture(texture); + overlay.textureCopySize = {}; + overlay.givenSize = OverlayTextureSize(texture); + overlay.shownFlipY = flipY; + overlay.sharedFromVulkan = texture.eType == TextureType_Vulkan; + compositor->LoadSubmitContext(); + overlay.CopyTexture(*compositor, shown); + compositor->ResetSubmitContext(); + // Back to the program's side once the copy from it has run + backend->ReleaseSharedOverlayTexture(&overlay); + overlay.compositionLayer.base.space = xr_space_from_ref_space_type(BaseSystem::currentSpace); + return true; +} +EVROverlayError BaseOverlay::ShowReadBack(OverlayData& overlay, const Texture_t& texture, const std::string& whyNotCopied) +{ + // Under the session's and the layers' locks. The texture's own API reads its bounds' area back (the program's queue + // waited for, or its OpenGL context, current on this thread): this stalls the overlay program, never the game. + Image image; + std::unique_ptr reader = BaseCompositor::CreateCompositorAPI(&texture); + if (!reader || !reader->ReadbackToCpu(&texture, &overlay.textureBounds, image) || image.Empty()) { + OC_UNSUPPORTED(VROverlayError_InvalidTexture, "SetOverlayTexture: the overlay application's texture (type %d) can't be copied (%s) nor read back", + (int)texture.eType, whyNotCopied.c_str()); + } + reader.reset(); + + auto* backend = (XrBackend*)BackendManager::Instance().GetBackendInstance(); + if (std::shared_ptr comp = overlay.compositor.lock(); comp && backend) + backend->UnregisterOverlayCompositor(comp); + overlay.compositor.reset(); + overlay.DropLive(); + if (backend) + backend->ForgetOverlayTextures(&overlay); + // The texture stays the overlay's (GetOverlayTexture's type and colour space); its image, already in its bounds' + // area and their flip, is what's shown, whole + overlay.SetTexture(texture); + overlay.shownFlipY = false; + overlay.sharedFromVulkan = false; + overlay.textureCopySize = {}; + overlay.givenSize = OverlayTextureSize(texture); + overlay.rawImage = std::move(image); + if (!overlay.raw) + overlay.raw = CpuSwapchain::Create(overlay.rawImage.width, overlay.rawImage.height); + if (!overlay.raw) { + // Logged (a soft failure) by Create: no session with a graphics API + overlay.rawImage = {}; + return VROverlayError_RequestFailed; + } + // A failed upload (logged) is tried again when the frame's layers are built + if (overlay.raw->Upload(overlay.rawImage)) + overlay.compositionLayer.quad.subImage = overlay.raw->SubImage(); + overlay.compositionLayer.base.space = xr_space_from_ref_space_type(BaseSystem::currentSpace); + return VROverlayError_None; +} EVROverlayError BaseOverlay::ClearOverlayTexture(VROverlayHandle_t ulOverlayHandle) { USEH(); auto session = xr_session.lock_shared(); std::lock_guard lock(layersLock); overlay->SetTexture({}); + overlay->shownFlipY = false; + overlay->sharedFromVulkan = false; overlay->textureCopySize = {}; overlay->givenSize.reset(); overlay->DropLive(); @@ -3430,9 +3943,12 @@ EVROverlayError BaseOverlay::SetOverlayRaw(VROverlayHandle_t ulOverlayHandle, vo if (std::shared_ptr comp = overlay->compositor.lock()) { auto* backend = (XrBackend*)BackendManager::Instance().GetBackendInstance(); backend->UnregisterOverlayCompositor(comp); + backend->ForgetOverlayTextures(overlay); } overlay->compositor.reset(); overlay->SetTexture({}); + overlay->shownFlipY = false; + overlay->sharedFromVulkan = false; overlay->textureCopySize = {}; overlay->givenSize.reset(); overlay->rawImage = std::move(image); @@ -3980,6 +4496,13 @@ EVROverlayError BaseOverlay::SetOverlayIntersectionMask(VROverlayHandle_t ulOver } EVROverlayError BaseOverlay::GetOverlayFlags(VROverlayHandle_t ulOverlayHandle, uint32_t* pFlags) { + Json::Value remote; + if (RemoteOverlayEntry(ulOverlayHandle, remote)) { + if (!pFlags) + return VROverlayError_InvalidParameter; + *pFlags = (uint32_t)remote["flags"].asUInt64(); + return VROverlayError_None; + } USEH(); if (!pFlags) return VROverlayError_InvalidParameter; @@ -3990,7 +4513,8 @@ BaseOverlay::VRMessageOverlayResponse BaseOverlay::ShowMessageOverlay(const char { // Shown in frames of OpenLamina's own, run here until a button is clicked: without them, it can't be auto* backend = (XrBackend*)BackendManager::Instance().GetBackendInstance(); - if (!oovr_global_configuration.OwnFrames() || !backend || !backend->HasOwnFrames() || !backend->sessionActive) + // (on an OpenGL session, only on the thread where its context is current) + if (!oovr_global_configuration.OwnFrames() || !backend || !backend->OwnFramesHere() || !backend->sessionActive) OC_UNSUPPORTED(VRMessageOverlayResponse_CouldntFindSystemOverlay, "ShowMessageOverlay: no frames of OpenLamina's own to show it in (ownFrames)"); // Answered with the controllers' lasers, which read the game's input actions: before it has any, nothing could // answer it @@ -4032,6 +4556,7 @@ BaseOverlay::VRMessageOverlayResponse BaseOverlay::ShowMessageOverlay(const char pointing->closeMessage = false; pointing->message = std::move(message); pointing->cursorShown = false; + pointing->HideBeams(); } } if (busy) { @@ -4102,6 +4627,7 @@ BaseOverlay::VRMessageOverlayResponse BaseOverlay::ShowMessageOverlay(const char if (!m.uploaded || !m.chain->Live()) m.uploaded = m.chain->Upload(m.image); p.cursorShown = false; + p.HideBeams(); const int hand = m.mouse.ActiveHand(); if (std::optional hit = m.mouse.Cursor(hand); hit && m.mouse.Target(hand) == m.Handle()) p.ShowCursor(overlay_maths::PointOn(m.placement, hit->u, hit->v)); diff --git a/OpenOVR/Reimpl/BaseOverlay.h b/OpenOVR/Reimpl/BaseOverlay.h index e2155c94..db2c1c69 100644 --- a/OpenOVR/Reimpl/BaseOverlay.h +++ b/OpenOVR/Reimpl/BaseOverlay.h @@ -2,6 +2,7 @@ #include "../BaseCommon.h" // TODO don't import from OCOVR, and remove the "../" #include "../Misc/Keyboard/VRKeyboard.h" // TODO don't import from OCOVR, and remove the "../" #include "../Misc/OverlayMaths.h" +#include "../Misc/ProgramEvents.h" #include #include #include @@ -238,13 +239,21 @@ class BaseOverlay { // events from other programs (BaseOverlay.cpp) struct Sharing; std::unique_ptr sharing; - // Other programs' pointer events for this program's overlays, queued on them; with layersLock held - void TakeRemotePointerEvents(); + // Other programs' pointer events for this program's overlays, queued on them, and their commands for them + // (OcOverlayCommand), applied; with layersLock held + void TakeRemoteEvents(); + // A handle FindOverlay gave for another program's overlay: the command sent to that program, which applies it, and + // what it changes kept here until that program has published it (sent says whether it went). False, sending + // nothing, if the handle isn't such a one. + bool SendRemoteCommand(vr::VROverlayHandle_t handle, OcOverlayCommand command, vr::EVROverlayError& sent); // An overlay application while a scene app is running: the scene app's instance points, and this one doesn't bool SceneAppPoints() const; // A handle FindOverlay gave for another program's overlay: its entry in the store's Overlays document. False if the - // handle isn't such a one, or its program has ended or no longer has the overlay. + // handle isn't such a one, or its program has ended or no longer has the overlay. Values this program set and that + // program hasn't published yet are as they were set. The dashboard's panel (system.systemui) is such an entry. bool RemoteOverlayEntry(vr::VROverlayHandle_t handle, Json::Value& entry); + // What's pending for such a handle (SendRemoteCommand), put over its entry; what the entry shows is pending no more + void ApplyPending(vr::VROverlayHandle_t handle, Json::Value& entry); // Where such an entry's overlay is, in origin; false if it isn't placed bool RemoteOverlayPlacement(const Json::Value& entry, vr::ETrackingUniverseOrigin origin, overlay_maths::Placement& out); @@ -258,6 +267,13 @@ class BaseOverlay { // The scene app's dashboard opens or closes: the store, the events, the game's input void DashboardChanged(bool open, const char* overlayKey = nullptr); + + // An overlay application's Vulkan or OpenGL texture that can't be copied onto its session's device, shown from an + // image of that device that shares its memory: false, changing nothing, if it can't be. Under the session's and the + // layers' locks. + bool ShowShared(OverlayData& overlay, const vr::Texture_t& texture); + // Such a texture read back into memory (whyNotCopied: why it wasn't copied) and shown from there. The same locks. + vr::EVROverlayError ShowReadBack(OverlayData& overlay, const vr::Texture_t& texture, const std::string& whyNotCopied); // Where a dashboard overlay is drawn while it's the one shown (false while it isn't); with layersLock held bool DashboardPlacement(const OverlayData& overlay, vr::ETrackingUniverseOrigin origin, overlay_maths::Placement& out) const; @@ -285,6 +301,12 @@ class BaseOverlay { // Whether the handle is one of this program's overlays bool _IsOwnOverlay(vr::VROverlayHandle_t handle); + // IVROverlayView::PostOverlayEvent: queued on this program's overlay, or sent to the program whose overlay it is + void _PostOverlayEvent(vr::VROverlayHandle_t handle, const vr::VREvent_t* event); + + // A new session (XrBackend::RebuildSession): the overlays' texture swapchains went with the old one, and are made + // again from their textures as they're next shown + void _OnSessionRebuilt(); // Whether the keyboard is shown bool _KeyboardShown() diff --git a/OpenOVR/Reimpl/BaseOverlayView.cpp b/OpenOVR/Reimpl/BaseOverlayView.cpp index 39196415..e12c8239 100644 --- a/OpenOVR/Reimpl/BaseOverlayView.cpp +++ b/OpenOVR/Reimpl/BaseOverlayView.cpp @@ -1,6 +1,8 @@ #include "stdafx.h" #define BASE_IMPL +#include "BaseOverlay.h" #include "BaseOverlayView.h" +#include "generated/static_bases.gen.h" /** Acquire an OverlayView_t from an overlay handle * @@ -42,7 +44,8 @@ vr::EVROverlayError BaseOverlayView::ReleaseOverlayView(OOVR_VROverlayView_t* pO /** Posts an overlay event */ void BaseOverlayView::PostOverlayEvent(vr::VROverlayHandle_t ulOverlayHandle, const vr::VREvent_t* pvrEvent) { - OC_UNSUPPORTED_VOID("PostOverlayEvent: other programs' overlays can't be reached"); + if (BaseOverlay* overlay = GetUnsafeBaseOverlay()) + overlay->_PostOverlayEvent(ulOverlayHandle, pvrEvent); } /** Determines whether this process is permitted to view an overlay's content. */ diff --git a/OpenOVR/Reimpl/BaseRenderModels.cpp b/OpenOVR/Reimpl/BaseRenderModels.cpp index 6f665d1d..517e7567 100644 --- a/OpenOVR/Reimpl/BaseRenderModels.cpp +++ b/OpenOVR/Reimpl/BaseRenderModels.cpp @@ -133,6 +133,128 @@ static bool IsKnownRenderModel(const char* name) return strcmp(name, "oculusHmdRenderModel") == 0 || IsOwnRenderModel(name); } +// OpenLamina's own controller model of each interaction profile: the WebXR Input Profile it's made from +static const struct { + const char* path; + const char* model; +} kOwnControllerModels[] = { + { "/interaction_profiles/oculus/touch_controller", "oculus-touch-v3" }, + { "/interaction_profiles/meta/touch_controller_plus", "meta-quest-touch-plus" }, + { "/interaction_profiles/facebook/touch_controller_pro", "meta-quest-touch-pro" }, + { "/interaction_profiles/valve/index_controller", "valve-index" }, + { "/interaction_profiles/htc/vive_controller", "htc-vive" }, + { "/interaction_profiles/microsoft/motion_controller", "microsoft-mixed-reality" }, + { "/interaction_profiles/samsung/odyssey_controller", "microsoft-mixed-reality" }, + { "/interaction_profiles/hp/mixed_reality_controller", "hp-mixed-reality" }, + { "/interaction_profiles/htc/vive_cosmos_controller", "htc-vive-cosmos" }, + { "/interaction_profiles/htc/vive_focus3_controller", "htc-vive-focus-3" }, + { "/interaction_profiles/bytedance/pico_neo3_controller", "pico-neo3" }, + { "/interaction_profiles/bytedance/pico4_controller", "pico-4" }, + { "/interaction_profiles/bytedance/pico_g3_controller", "generic-trigger-squeeze-thumbstick" }, + { "/interaction_profiles/khr/simple_controller", "generic-trigger-squeeze-thumbstick" }, +}; + +static bool EndsWith(const string& s, const char* end) +{ + size_t n = strlen(end); + return s.size() >= n && s.compare(s.size() - n, n, end) == 0; +} + +static bool IsOwnControllerModel(const string& name) +{ + const std::vector& names = OwnRenderModelNames(); + return std::binary_search(names.begin(), names.end(), name); +} + +// The own controller model of the profile the hand's controller has now; empty without one +static string OwnModelOfHand(ITrackedDevice::TrackedDeviceType hand) +{ + auto sessionLock = xr_session.lock_shared(); // held while reading: a session restart waits for it + BackendManager* backend = BackendManager::InstancePtr(); + std::shared_ptr dev = backend ? backend->GetDeviceByHand(hand) : nullptr; + const InteractionProfile* profile = dev ? dev->GetInteractionProfile() : nullptr; + if (!profile) + return {}; + for (const auto& own : kOwnControllerModels) + if (profile->GetPath() == own.path) + return string(own.model) + (hand == ITrackedDevice::HAND_LEFT ? "-left" : "-right"); + return {}; +} + +// The own controller model a name is drawn with: one of their names; a hand's model (renderLeftHand, renderRightHand) +// as the controller in that hand; the Touch's and Index's names as those controllers (the Touch's as the one in that +// hand where it's a Touch Plus or Pro). Empty for any other name, or if the models aren't installed. +static string OwnModelName(const string& name) +{ + if (OwnRenderModelNames().empty()) + return {}; + if (IsOwnControllerModel(name)) + return name; + bool left = name == "renderLeftHand" || name == "oculus_quest2_controller_left" || name == "{indexcontroller}valve_controller_knu_1_0_left"; + bool right = name == "renderRightHand" || name == "oculus_quest2_controller_right" || name == "{indexcontroller}valve_controller_knu_1_0_right"; + if (!left && !right) + return {}; + string own = OwnModelOfHand(left ? ITrackedDevice::HAND_LEFT : ITrackedDevice::HAND_RIGHT); + const char* hand = left ? "-left" : "-right"; + if (name.starts_with("oculus_quest2_controller_")) { + if (own.empty() || !(own.starts_with("oculus-touch") || own.starts_with("meta-quest-touch"))) + own = string("oculus-touch-v3") + hand; + } else if (name.starts_with("{indexcontroller}")) { + own = string("valve-index") + hand; + } + return IsOwnControllerModel(own) ? own : string(); +} + +// Where an own model's files (in grip space) are in its device's space: the grip, as its profile places it. The +// profiles are made with the OpenXR instance: before there is one, the grip is taken as the device's pose. +static XrPosef OwnModelSpace(const string& own) +{ + XrPosef pose = { { 0, 0, 0, 1 }, { 0, 0, 0 } }; + if (!xr_ext) + return pose; + bool left = EndsWith(own, "-left"); + string model = own.substr(0, own.size() - (left ? 5 : 6)); + for (const auto& entry : kOwnControllerModels) { + if (model != entry.model) + continue; + const InteractionProfile* profile = InteractionProfile::GetProfileByPath(entry.path); + if (!profile) + break; + glm::mat4 gripInDevice = glm::affineInverse(profile->GetGripToSteamVRTransform(left ? ITrackedDevice::HAND_LEFT : ITrackedDevice::HAND_RIGHT)); + glm::quat rot = glm::normalize(glm::quat_cast(glm::mat3(gripInDevice))); + pose.orientation = { rot.x, rot.y, rot.z, rot.w }; + pose.position = { gripInDevice[3].x, gripInDevice[3].y, gripInDevice[3].z }; + break; + } + return pose; +} + +// A model by name: SteamVR's of that name where SteamVR has one, else OpenLamina's own controller model it's drawn with +static std::shared_ptr FindModel(const string& name) +{ + if (std::shared_ptr model = FindSteamVRRenderModel(name)) + return model; + string own = OwnModelName(name); + return own.empty() ? nullptr : FindOwnRenderModel(own, OwnModelSpace(own)); +} + +// The name a load is kept under: an own model's name (and component) for a name drawn with one, else the name +static string LoadName(const string& name) +{ + if (FindSteamVRRenderModel(name)) + return name; + string own = OwnModelName(name); + if (!own.empty()) + return own; + size_t slash = name.rfind('/'); + if (slash != string::npos && slash > 0 && !FindSteamVRRenderModel(name.substr(0, slash))) { + own = OwnModelName(name.substr(0, slash)); + if (!own.empty()) + return own + name.substr(slash); + } + return name; +} + // Copies value into an app's buffer, cut short and terminated if it doesn't fit; returns the size needed with the // terminator, as SteamVR does, and BufferTooSmall in *error (when given) if the buffer can't hold both static uint32_t CopyOutModelString(const string& value, char* buffer, uint32_t size, EVRRenderModelError* error = nullptr) @@ -332,7 +454,7 @@ static const RmComponent* FindComponent(const RmModel& model, const char* name) return nullptr; } -// The OpenVR names of every model: SteamVR's, then OpenLamina's own that SteamVR doesn't have +// The OpenVR names of every model: SteamVR's, then OpenLamina's own that SteamVR doesn't have, then its controllers' static const std::vector& AllModelNames() { static const std::vector& names = *[] { @@ -340,6 +462,8 @@ static const std::vector& AllModelNames() for (const char* own : kOwnModelNames) if (std::find(all->begin(), all->end(), own) == all->end()) all->push_back(own); + for (const string& own : OwnRenderModelNames()) + all->push_back(own); return all; }(); return names; @@ -424,14 +548,14 @@ ModelLoads& Loads() } } // namespace -static std::shared_ptr LoadModel(const string& name); +static std::shared_ptr LoadModel(const string& name, std::shared_ptr own); EVRRenderModelError BaseRenderModels::LoadRenderModel_Async(const char* pchRenderModelName, RenderModel_t** renderModel) { if (!pchRenderModelName || !renderModel) return VRRenderModelError_InvalidArg; *renderModel = nullptr; - string name = pchRenderModelName; + string name = LoadName(pchRenderModelName); // Started on the first call for a name, answered once it's done, at once from then on std::shared_future> load; @@ -443,9 +567,13 @@ EVRRenderModelError BaseRenderModels::LoadRenderModel_Async(const char* pchRende if (loads.byName.size() >= ModelLoads::kMaxNames) OC_UNSUPPORTED(VRRenderModelError_NotSupported, "LoadRenderModel_Async: too many model names, '%s' isn't loaded", pchRenderModelName); OOVR_LOGF("LoadRenderModel_Async %s", pchRenderModelName); + // An own controller model is found here, where the profiles are; its load's thread only reads it + std::shared_ptr own; + if (string base = name.substr(0, name.find('/')); IsOwnControllerModel(base) && !FindSteamVRRenderModel(base)) + own = FindModel(base); std::shared_future> started; try { - started = std::async(std::launch::async, LoadModel, name).share(); + started = std::async(std::launch::async, LoadModel, name, own).share(); } catch (const std::exception& e) { OC_UNSUPPORTED(VRRenderModelError_NotSupported, "LoadRenderModel_Async: can't start loading '%s': %s", pchRenderModelName, e.what()); } @@ -497,15 +625,17 @@ BaseRenderModels::~BaseRenderModels() WaitForLoads(); } -// The model of a name, on a load's thread: SteamVR's of that name, as SteamVR answers it; else (no SteamVR, or a -// model it can't load) OpenLamina's own -static std::shared_ptr BuildModel(const string& name) +// The model of a name, on a load's thread: own's where it's given (name being its name or "/"), else +// SteamVR's of that name as SteamVR answers it, else (no SteamVR, or a model it can't load) OpenLamina's built-in one +static std::shared_ptr BuildModel(const string& name, const std::shared_ptr& own) { auto loaded = std::make_shared(); - if (std::optional mesh = SteamVRMesh(name)) { - loaded->vertices = std::move(mesh->vertices); - loaded->indices = std::move(mesh->indices); - loaded->texture = SteamVRTextureId(mesh->textures); + size_t slash = name.find('/'); + string component = slash == string::npos ? "" : name.substr(slash + 1); + if (std::optional found = own ? LoadRenderModelMesh(*own, component) : SteamVRMesh(name)) { + loaded->vertices = std::move(found->vertices); + loaded->indices = std::move(found->indices); + loaded->texture = SteamVRTextureId(found->textures); return loaded; } @@ -556,10 +686,10 @@ static std::shared_ptr BuildModel(const string& name) } // BuildModel, with a model it can't build (out of memory) as one it doesn't support -static std::shared_ptr LoadModel(const string& name) +static std::shared_ptr LoadModel(const string& name, std::shared_ptr own) { try { - return BuildModel(name); + return BuildModel(name, own); } catch (const std::exception& e) { OOVR_LOGF("Render model %s can't be loaded: %s", name.c_str(), e.what()); auto failed = std::make_shared(); @@ -821,7 +951,7 @@ uint32_t BaseRenderModels::GetRenderModelCount() uint32_t BaseRenderModels::GetComponentCount(const char* pchRenderModelName) { if (pchRenderModelName) { - if (std::shared_ptr model = FindSteamVRRenderModel(pchRenderModelName)) + if (std::shared_ptr model = FindModel(pchRenderModelName)) return (uint32_t)model->components.size(); } @@ -833,7 +963,7 @@ uint32_t BaseRenderModels::GetComponentName(const char* pchRenderModelName, uint char* pchComponentName, uint32_t unComponentNameLen) { if (pchRenderModelName) { - if (std::shared_ptr model = FindSteamVRRenderModel(pchRenderModelName)) { + if (std::shared_ptr model = FindModel(pchRenderModelName)) { if (unComponentIndex >= model->components.size()) { if (pchComponentName && unComponentNameLen) pchComponentName[0] = 0; @@ -863,7 +993,7 @@ uint32_t BaseRenderModels::GetComponentName(const char* pchRenderModelName, uint uint64_t BaseRenderModels::GetComponentButtonMask(const char* pchRenderModelName, const char* pchComponentName) { // A SteamVR model's component: the button and the axis its motion follows - std::shared_ptr model = pchRenderModelName ? FindSteamVRRenderModel(pchRenderModelName) : nullptr; + std::shared_ptr model = pchRenderModelName ? FindModel(pchRenderModelName) : nullptr; const RmComponent* c = model ? FindComponent(*model, pchComponentName) : nullptr; if (!c || !c->motion.isObject()) return 0; @@ -882,7 +1012,7 @@ uint32_t BaseRenderModels::GetComponentRenderModelName(const char* pchRenderMode { // A SteamVR model's component with something to draw: "/", which LoadRenderModel_Async loads if (pchRenderModelName) { - if (std::shared_ptr model = FindSteamVRRenderModel(pchRenderModelName)) { + if (std::shared_ptr model = FindModel(pchRenderModelName)) { const RmComponent* c = FindComponent(*model, pchComponentName); if (!c || c->objFile.empty()) { if (componentModelName && componentModelNameLen) @@ -940,8 +1070,11 @@ bool BaseRenderModels::GetComponentState(const char* pchRenderModelName, const c std::string componentName = pchComponentName; - // A SteamVR model's component: where its motion puts it for the controller state (at rest without one) + // A SteamVR or own controller model's component: where its motion puts it for the controller state (at rest without one) + const string own = pchRenderModelName ? OwnModelName(pchRenderModelName) : string(); std::shared_ptr steamvr = pchRenderModelName ? FindSteamVRRenderModel(pchRenderModelName) : nullptr; + if (!steamvr && !own.empty()) + steamvr = FindOwnRenderModel(own, OwnModelSpace(own)); if (const RmComponent* c = steamvr ? FindComponent(*steamvr, pchComponentName) : nullptr) { float value = 0; vr::HmdVector2_t axis = { { 0, 0 } }; @@ -971,9 +1104,9 @@ bool BaseRenderModels::GetComponentState(const char* pchRenderModelName, const c if (c->motionType == "trackpad" || c->motionType == "joystick") value = pressed ? 1.0f : 0.0f; } - glm::mat4 motion = X2G_om34_pose(ComponentPose(*c, value, axis)); + glm::mat4 motion = X2G_om34_pose(ModelComponentPose(*steamvr, *c, value, axis)); pComponentState->mTrackingToComponentRenderModel = G2S_m34(motion); - pComponentState->mTrackingToComponentLocal = G2S_m34(motion * X2G_om34_pose(c->local)); + pComponentState->mTrackingToComponentLocal = G2S_m34(motion * X2G_om34_pose(ModelComponentLocal(*steamvr, *c))); uint32_t properties = 0; if (c->motionType.empty()) properties |= VRComponentProperty_IsStatic; @@ -1009,6 +1142,9 @@ bool BaseRenderModels::GetComponentState(const char* pchRenderModelName, const c hand = ITrackedDevice::HAND_LEFT; } else if (IsOwnRenderModel(renderModelName.c_str()) && renderModelName.ends_with("_right")) { hand = ITrackedDevice::HAND_RIGHT; + } else if (!own.empty()) { + // An own controller model's tip, base and handgrip: the profile's, as for the hand's own model + hand = EndsWith(own, "-left") ? ITrackedDevice::HAND_LEFT : ITrackedDevice::HAND_RIGHT; } } @@ -1018,7 +1154,8 @@ bool BaseRenderModels::GetComponentState(const char* pchRenderModelName, const c return true; // A built-in model's tip and handgrip always exist: where the model is, until its device can tell more - if (pchRenderModelName && IsOwnRenderModel(pchRenderModelName) && (componentName == "tip" || componentName == "handgrip")) { + if (pchRenderModelName && (IsOwnRenderModel(pchRenderModelName) || !own.empty()) + && (componentName == "tip" || componentName == "handgrip")) { const glm::mat4 identity = glm::identity(); pComponentState->mTrackingToComponentRenderModel = G2S_m34(identity); pComponentState->mTrackingToComponentLocal = G2S_m34(identity); @@ -1034,7 +1171,7 @@ bool BaseRenderModels::GetComponentState(const char* pchRenderModelName, const c bool BaseRenderModels::TryGetComponentState(ITrackedDevice::TrackedDeviceType hand, const std::string& componentName, OOVR_RenderModel_ComponentState_t* result) { auto sessionLock = xr_session.lock_shared(); // held while reading: a session restart waits for it - if (hand == ITrackedDevice::HAND_NONE) + if (hand == ITrackedDevice::HAND_NONE || !BackendManager::InstancePtr()) return false; std::shared_ptr dev = BackendManager::Instance().GetDeviceByHand(hand); @@ -1103,7 +1240,7 @@ bool BaseRenderModels::TryGetComponentState(ITrackedDevice::TrackedDeviceType ha bool BaseRenderModels::RenderModelHasComponent(const char* pchRenderModelName, const char* pchComponentName) { if (pchRenderModelName) { - if (std::shared_ptr model = FindSteamVRRenderModel(pchRenderModelName)) + if (std::shared_ptr model = FindModel(pchRenderModelName)) return FindComponent(*model, pchComponentName) != nullptr; } // The models' one component is named after the model (GetComponentName) @@ -1114,7 +1251,7 @@ bool BaseRenderModels::RenderModelHasComponent(const char* pchRenderModelName, c uint32_t BaseRenderModels::GetRenderModelThumbnailURL(const char* pchRenderModelName, VR_OUT_STRING() char* pchThumbnailURL, uint32_t unThumbnailURLLen, EVRRenderModelError* peError) { // A SteamVR model: its thumbnail file as a file URL ("" if it names none) - if (std::shared_ptr model = pchRenderModelName ? FindSteamVRRenderModel(pchRenderModelName) : nullptr) { + if (std::shared_ptr model = pchRenderModelName ? FindModel(pchRenderModelName) : nullptr) { if (peError) *peError = VRRenderModelError_None; string url; @@ -1134,9 +1271,12 @@ uint32_t BaseRenderModels::GetRenderModelThumbnailURL(const char* pchRenderModel uint32_t BaseRenderModels::GetRenderModelOriginalPath(const char* pchRenderModelName, VR_OUT_STRING() char* pchOriginalPath, uint32_t unOriginalPathLen, EVRRenderModelError* peError) { // A SteamVR model: its OBJ in its folder, as SteamVR answers (LoadRenderModel_Async takes it) - if (std::shared_ptr model = pchRenderModelName ? FindSteamVRRenderModel(pchRenderModelName) : nullptr) { + if (std::shared_ptr model = pchRenderModelName ? FindModel(pchRenderModelName) : nullptr) { if (peError) *peError = VRRenderModelError_None; + // An own controller model has no OBJ of the whole: its name is what loads it + if (IsOwnControllerModel(model->name) && !FindSteamVRRenderModel(pchRenderModelName)) + return CopyOutModelString(model->name, pchOriginalPath, unOriginalPathLen, peError); string stem = model->name; if (!stem.empty() && stem[0] == '{') stem = stem.substr(stem.find('}') + 1); diff --git a/OpenOVR/Reimpl/BaseSettings.cpp b/OpenOVR/Reimpl/BaseSettings.cpp index 12b755ea..c8445e0a 100644 --- a/OpenOVR/Reimpl/BaseSettings.cpp +++ b/OpenOVR/Reimpl/BaseSettings.cpp @@ -44,12 +44,17 @@ std::optional StoredValue(SharedStore& store, const std::string& se return v; } -// The OpenXR system's name, which picks the HMD's identity row; empty before a session (and in the unit tests) -std::string HmdSystemName() +// The OpenXR system's name, which picks the HMD's identity row, with its vendor ID and the runtime's name; empty before +// a session (and in the unit tests) +std::string HmdSystemName(uint32_t* vendorId, std::string* runtimeName) { auto sessionLock = xr_session.lock_shared(); // held while reading: a session restart waits for it if (!xr_gbl) return {}; + *vendorId = xr_gbl->systemProperties.vendorId; + XrInstanceProperties properties = { XR_TYPE_INSTANCE_PROPERTIES }; + if (xr_instance != XR_NULL_HANDLE && XR_SUCCEEDED(xrGetInstanceProperties(xr_instance, &properties))) + *runtimeName = properties.runtimeName; return xr_gbl->systemProperties.systemName; } @@ -230,8 +235,10 @@ std::optional BaseSettings::Lookup(const std::string& section, cons if (key == kk::k_pch_SteamVR_MotionSmoothing_Bool) return Json::Value(false); // OpenComposite doesn't make frames up } else if (section == kk::k_pch_LastKnown_Section) { - const std::string systemName = HmdSystemName(); - const DeviceIdentity& hmd = HmdIdentity(systemName); + uint32_t vendorId = 0; + std::string runtimeName; + const std::string systemName = HmdSystemName(&vendorId, &runtimeName); + const DeviceIdentity& hmd = HmdIdentity(systemName, {}, vendorId, runtimeName); if (key == kk::k_pch_LastKnown_HMDManufacturer_String) return Json::Value(hmd.manufacturer); if (key == kk::k_pch_LastKnown_HMDModel_String) { diff --git a/OpenOVR/Reimpl/BaseSystem.cpp b/OpenOVR/Reimpl/BaseSystem.cpp index 6ea1b66a..e7b4a35e 100644 --- a/OpenOVR/Reimpl/BaseSystem.cpp +++ b/OpenOVR/Reimpl/BaseSystem.cpp @@ -1,6 +1,7 @@ #include "logging.h" #include "stdafx.h" #define BASE_IMPL +#include "BaseClientCore.h" #include "BaseCompositor.h" #include "BaseExtendedDisplay.h" #include "BaseInput.h" @@ -180,6 +181,7 @@ bool BaseSystem::GetTimeSinceLastVsync(float* pfSecondsSinceLastVsync, uint64_t* bool BaseSystem::_RuntimeAdapterLuid(uint64_t* luid) { #ifdef SUPPORT_DX + auto lock = xr_session.lock_shared(); // held while asking: a new instance waits for it if (!xr_ext || xr_instance == XR_NULL_HANDLE) return false; auto pack = [luid](const LUID& l) { @@ -309,6 +311,7 @@ void BaseSystem::GetOutputDevice(uint64_t* pnDevice, ETextureType textureType, V VkPhysicalDevice physDev; XrBackend::VkGetPhysicalDevice(pInstance, &physDev); *pnDevice = (uint64_t)physDev; + BaseCompositor::NotePhysicalDevice(physDev); #else OC_UNSUPPORTED_VOID("GetOutputDevice: this build has no Vulkan support"); #endif @@ -332,6 +335,7 @@ bool BaseSystem::SetDisplayVisibility(bool bIsVisibleOnDesktop) void BaseSystem::GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin toOrigin, float predictedSecondsToPhotonsFromNow, TrackedDevicePose_t* poseArray, uint32_t poseArrayCount) { + InputWithoutFrames(); BackendManager::Instance().GetDeviceToAbsoluteTrackingPose(toOrigin, predictedSecondsToPhotonsFromNow, poseArray, poseArrayCount); } @@ -442,6 +446,7 @@ vr::TrackedDeviceIndex_t BaseSystem::GetTrackedDeviceIndexForControllerRole(vr:: { if (unDeviceType == TrackedControllerRole_Invalid) return vr::k_unTrackedDeviceIndexInvalid; + InputWithoutFrames(); for (vr::TrackedDeviceIndex_t index = 0; index < vr::k_unMaxTrackedDeviceCount; index++) { std::shared_ptr dev = BackendManager::Instance().GetDevice(index); @@ -465,6 +470,7 @@ ETrackedDeviceClass BaseSystem::GetTrackedDeviceClass(vr::TrackedDeviceIndex_t d { if (deviceIndex >= vr::k_unMaxTrackedDeviceCount) return TrackedDeviceClass_Invalid; + InputWithoutFrames(); // A slot that held a device keeps its class once the device is gone std::shared_ptr dev = BackendManager::Instance().GetDevice(deviceIndex); @@ -479,7 +485,9 @@ ETrackedDeviceClass BaseSystem::GetTrackedDeviceClass(vr::TrackedDeviceIndex_t d bool BaseSystem::IsTrackedDeviceConnected(vr::TrackedDeviceIndex_t deviceIndex) { - return BackendManager::Instance().GetDevice(deviceIndex) != nullptr; + InputWithoutFrames(); + // None while the session is lost: the devices are deactivated until it's made again + return BackendManager::Instance().GetDevice(deviceIndex) != nullptr && !XrBackend::CurrentSessionLost(); } bool BaseSystem::GetBoolTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError* pErrorL) @@ -843,11 +851,16 @@ bool BaseSystem::GetControllerState(vr::TrackedDeviceIndex_t controllerDeviceInd memset(controllerState, 0, controllerStateSize); // The headset's proximity sensor, while the runtime says whether the user wears it - if (controllerDeviceIndex == k_unTrackedDeviceIndex_Hmd && xr_gbl && xr_gbl->supportsUserPresence) { + const bool userPresence = [] { + auto lock = xr_session.lock_shared(); // held while reading: a session restart waits for it + return xr_gbl && xr_gbl->supportsUserPresence; + }(); + if (controllerDeviceIndex == k_unTrackedDeviceIndex_Hmd && userPresence) { std::shared_ptr hmd = BackendManager::Instance().GetDevice(k_unTrackedDeviceIndex_Hmd); return hmd && hmd->GetControllerState(controllerState); } + InputWithoutFrames(); std::shared_ptr input = InputSystem(false); // Since we can only bind the manifest once, and some games may never call it or may @@ -861,7 +874,7 @@ bool BaseSystem::GetControllerState(vr::TrackedDeviceIndex_t controllerDeviceInd if (!input) { return true; } - if (frameNumber > 0) + if (frameNumber > 0 || BaseClientCore::appType == VRApplication_Overlay || BaseClientCore::appType == VRApplication_Background) input->LoadEmptyManifestIfRequired(); const bool result = input->GetLegacyControllerState(controllerDeviceIndex, controllerState); @@ -883,6 +896,25 @@ bool BaseSystem::GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, vr: return GetControllerState(unControllerDeviceIndex, pControllerState, unControllerStateSize); } +// A game's controllers come up after its first submitted frame (_OnPostFrame); an overlay or background app submits +// none, so its device reads make the input system (no manifest yet: the program may still load its own) and pump the +// OpenXR events and sync the input, at most every few milliseconds, as a game's frames do. The hands are found once +// the session is focused, which an overlay session is without frames. +void BaseSystem::InputWithoutFrames() +{ + if (BaseClientCore::appType != VRApplication_Overlay && BaseClientCore::appType != VRApplication_Background) + return; + static std::atomic last{ 0 }; + const int64_t now = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); + int64_t was = last.load(); + if (now - was < 5 || !last.compare_exchange_strong(was, now)) + return; + std::shared_ptr input = InputSystem(true); + BackendManager::Instance().PumpEvents(); + if (input) + input->InternalUpdate(); +} + std::shared_ptr BaseSystem::InputSystem(bool create) { // The game's threads read the controllers while its frames are submitted: the pointer is set under a lock, and @@ -974,7 +1006,7 @@ uint32_t BaseSystem::GetAppContainerFilePaths(VR_OUT_STRING() char* pchBuffer, u const char* BaseSystem::GetRuntimeVersion() { - return "1.16.8"; + return OPENVR_RUNTIME_VERSION; } DistortionCoordinates_t BaseSystem::ComputeDistortion(EVREye eEye, float fU, float fV) @@ -1240,6 +1272,7 @@ static bool GazeInHead(glm::quat* gazeInHead) // session locked (shared). static glm::quat EyeInHead(EVREye eye) { + auto lock = xr_session.lock_shared(); // held while reading: a session restart waits for it if (!xr_gbl) return glm::identity(); XruCachedViews cached = xr_gbl->GetCachedViews(xr_gbl->viewSpace); diff --git a/OpenOVR/Reimpl/BaseSystem.h b/OpenOVR/Reimpl/BaseSystem.h index 482d414e..98104993 100644 --- a/OpenOVR/Reimpl/BaseSystem.h +++ b/OpenOVR/Reimpl/BaseSystem.h @@ -16,6 +16,9 @@ namespace Json { class Value; } +// The SteamVR version GetRuntimeVersion answers: one new enough that games checking for features don't turn them off +constexpr const char* OPENVR_RUNTIME_VERSION = "2.15.6"; + class BaseSystem { // Copied from IVRSystem, because MSVC made me. @@ -53,6 +56,8 @@ class BaseSystem { std::recursive_mutex inputSystemLock; // The input system, looked for (and made, with create) the first time; under inputSystemLock std::shared_ptr InputSystem(bool create); + // For a program that submits no scene frames (an overlay or background app): brings its controllers up + void InputWithoutFrames(); std::atomic frameNumber{ 0 }; diff --git a/OpenOVR/logging.cpp b/OpenOVR/logging.cpp index ccbf3981..3abed277 100644 --- a/OpenOVR/logging.cpp +++ b/OpenOVR/logging.cpp @@ -191,24 +191,14 @@ static std::string ProgramName() return name.empty() ? "program" : name; } -static std::ofstream init_stream() +std::string oovr_log_folder() { - std::ofstream stream; - // One file per program, by its executable's name: a game and the tools beside it each keep their own - string outputFilePath = "openlamina." + ProgramName() + ".log"; - - // Try and write to standard location - // fall back to exe dir if can't create dir - // OC_LOG_DIR (used by the tests) replaces the standard location + // The standard location; OC_LOG_DIR (used by the tests) replaces it string overrideFolder = GetEnv("OC_LOG_DIR"); #ifdef _WIN32 string outputFolder = GetEnv("LOCALAPPDATA"); if (!outputFolder.empty()) outputFolder = outputFolder + "\\OpenLamina\\logs"; - if (!overrideFolder.empty()) - outputFolder = overrideFolder; - if (!outputFolder.empty() && makePath(outputFolder)) - outputFilePath = outputFolder + "\\" + outputFilePath; #else string outputFolder = GetEnv("XDG_STATE_HOME"); if (outputFolder.empty()) { @@ -218,9 +208,28 @@ static std::ofstream init_stream() } if (!outputFolder.empty()) outputFolder = outputFolder + "/OpenLamina/logs"; +#endif if (!overrideFolder.empty()) outputFolder = overrideFolder; if (!outputFolder.empty() && makePath(outputFolder)) + return outputFolder; + return {}; +} + +static std::ofstream init_stream() +{ + std::ofstream stream; + // One file per program, by its executable's name: a game and the tools beside it each keep their own + string outputFilePath = "openlamina." + ProgramName() + ".log"; + + // Try and write to standard location + // fall back to exe dir if can't create dir + const string outputFolder = oovr_log_folder(); +#ifdef _WIN32 + if (!outputFolder.empty()) + outputFilePath = outputFolder + "\\" + outputFilePath; +#else + if (!outputFolder.empty()) outputFilePath = outputFolder + "/" + outputFilePath; #endif diff --git a/OpenOVR/logging.h b/OpenOVR/logging.h index 5e0a914b..040f0d39 100644 --- a/OpenOVR/logging.h +++ b/OpenOVR/logging.h @@ -31,6 +31,10 @@ OC_NORETURN void oovr_abort_raw(const char* file, long line, const char* func, c std::string GetEnv(const std::string& var); +// The folder the log file is written to (made if it isn't there); empty if there's none, the log then being in the +// working directory +std::string oovr_log_folder(); + #define OOVR_ABORT(msg) \ do { \ oovr_abort_raw(__FILE__, __LINE__, __FUNCTION__, msg); \ diff --git a/README.md b/README.md index a5c391b1..4c9088ae 100644 --- a/README.md +++ b/README.md @@ -119,21 +119,37 @@ Unpack `OpenLamina-Windows-Portable.zip` or `OpenLamina-Linux.tar.gz` and put th For one Windows game only, replace its `openvr_api.dll` with `vrclient_x64.dll` (or `vrclient.dll` for 32-bit games) renamed to `openvr_api.dll`. Keep a backup; verifying the game's files in Steam undoes it. + ### Linux notes -Most VR games are Windows games running in Proton, inside the Steam Runtime, which needs a few paths made visible: +`install.sh` puts OpenLamina in `~/.local/share/OpenLamina` (`~/.var/app/com.valvesoftware.Steam/.local/share/OpenLamina` +for Flatpak Steam), with the libraries in `bin/linux64/vrclient.so` and `bin/vrclient.so`. Use that folder wherever a +runtime folder is asked for. -- Your home folder is visible as it is. -- `/usr` is at `/run/host/usr`, for example `/run/host/usr/share/openxr/1/openxr_monado.json`. -- Anything else can be added with `PRESSURE_VESSEL_FILESYSTEMS_RW`. +Most VR games are Windows games running in Proton, inside the Steam Runtime. To let them reach your OpenXR runtime +(Monado, WiVRn, ...), add this to their launch options (the game's Properties, General, Launch options); +`install.sh --launch-options` prints it. Flatpak Steam needs it too, and the runtime visible inside the Flatpak: -To use OpenLamina for one game only, set `VR_OVERRIDE` in its launch options. With Monado installed system-wide: +``` +PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES=1 %command% +``` + +To choose the OpenVR runtime for one game only, whatever `openvrpaths.vrpath` names first, set `VR_OVERRIDE` to the +runtime's folder in its launch options: ``` -VR_OVERRIDE=~/OpenLamina XR_RUNTIME_JSON=/run/host/usr/share/openxr/1/openxr_monado.json PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/monado_comp_ipc %command% +VR_OVERRIDE=$HOME/.local/share/OpenLamina PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES=1 %command% ``` -For a native Linux game, copy `bin/linux64/vrclient.so` over the game's `libopenvr_api.so`. +Proton needs an `openvrpaths.vrpath` to exist (`~/.config/openvr/`) even then. Running `install.sh` once, or SteamVR +once, makes it. + +WiVRn and Envision write `openvrpaths.vrpath` themselves when they start, with their own OpenVR runtime first. Point +them at OpenLamina instead: WiVRn's `openvr-compat-path` in its `config.json`, Envision's profile setting for the +OpenVR runtime path. `install.sh` says so when it finds them. + +For a native Linux game, copy `bin/linux64/vrclient.so` over the game's `libopenvr_api.so`. A Windows game's `.exe` +started without Proton (through Wine alone) isn't supported: OpenLamina refuses it and logs why. ## Coming from OpenComposite @@ -149,7 +165,12 @@ The Windows installer installs next to OpenComposite's. Uninstall OpenComposite ## Configuration Options go in `openlamina.ini`, one `name=value` per line (`;` or `#` for comments, names are case sensitive). It is -read next to the game's `openvr_api.dll` (Windows only), then from the game's working directory, which overrides it. +read from, in order, each file overriding the keys it sets of the ones before it (the log says which were read): + +- Windows: next to the DLL, then the game's working directory. +- Linux: the install's `bin/` (next to `bin/vrclient.so`, so both word sizes read it), then + `$XDG_CONFIG_HOME/openlamina/openlamina.ini` (`~/.config/openlamina/` by default), then the game's working directory. + On Windows the app's *Settings* window edits the common options. An unknown option or bad value is logged and ignored. | Option | Default | What it does | @@ -160,6 +181,7 @@ On Windows the app's *Settings* window edits the common options. An unknown opti | `laserMouse` | on | Controllers act as a mouse on overlays that take mouse input. | | `keyboard` | on | The keyboard games show for typing text. | | `keyboardLayout` | from locale | `us` or `uk`. | +| `handController` | `knuckles` | The controller hands are shown as when no controller is in them (through `XR_EXT_hand_interaction`, or hand tracking alone): `knuckles` (an Index controller), `oculus_touch`, `vive_controller`, or `off` to show none. | | `dashboardButton` | `system` | What opens the dashboard: `system`, `system_long`, `menu`, `menu_long` or `off`. With `system`, holding it for a second recentres. | | `helperApps` | on | Run overlay and background apps beside the game (needs a runtime with overlay sessions, like Monado). | | `overlayLayersPlacement` | `1` | Where an overlay app's layers go among other programs'; higher is on top. | diff --git a/assets/controllers/LICENSE.md b/assets/controllers/LICENSE.md new file mode 100644 index 00000000..af9f7946 --- /dev/null +++ b/assets/controllers/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Amazon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/assets/controllers/generic-trigger-squeeze-thumbstick/left.glb b/assets/controllers/generic-trigger-squeeze-thumbstick/left.glb new file mode 100644 index 00000000..16abb111 Binary files /dev/null and b/assets/controllers/generic-trigger-squeeze-thumbstick/left.glb differ diff --git a/assets/controllers/generic-trigger-squeeze-thumbstick/profile.json b/assets/controllers/generic-trigger-squeeze-thumbstick/profile.json new file mode 100644 index 00000000..5734af60 --- /dev/null +++ b/assets/controllers/generic-trigger-squeeze-thumbstick/profile.json @@ -0,0 +1,309 @@ +{ + "profileId": "generic-trigger-squeeze-thumbstick", + "fallbackProfileIds": [], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "generic-trigger-squeeze-thumbstick-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "generic-trigger-squeeze-thumbstick-right", + "assetPath": "right.glb" + }, + "none": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + }, + "xr_standard_squeeze_pressed_mirror": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_mirror_value", + "minNodeName": "xr_standard_squeeze_pressed_mirror_min", + "maxNodeName": "xr_standard_squeeze_pressed_mirror_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "generic-trigger-squeeze-thumbstick-none", + "assetPath": "none.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/generic-trigger-squeeze-thumbstick/right.glb b/assets/controllers/generic-trigger-squeeze-thumbstick/right.glb new file mode 100644 index 00000000..1787077d Binary files /dev/null and b/assets/controllers/generic-trigger-squeeze-thumbstick/right.glb differ diff --git a/assets/controllers/hp-mixed-reality/left.glb b/assets/controllers/hp-mixed-reality/left.glb new file mode 100644 index 00000000..fd62ee24 Binary files /dev/null and b/assets/controllers/hp-mixed-reality/left.glb differ diff --git a/assets/controllers/hp-mixed-reality/profile.json b/assets/controllers/hp-mixed-reality/profile.json new file mode 100644 index 00000000..3636f3fc --- /dev/null +++ b/assets/controllers/hp-mixed-reality/profile.json @@ -0,0 +1,287 @@ +{ + "profileId": "hp-mixed-reality", + "fallbackProfileIds": [ + "oculus-touch", + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "hp-mixed-reality-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "hp-mixed-reality-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/hp-mixed-reality/right.glb b/assets/controllers/hp-mixed-reality/right.glb new file mode 100644 index 00000000..af8d1bed Binary files /dev/null and b/assets/controllers/hp-mixed-reality/right.glb differ diff --git a/assets/controllers/htc-vive-cosmos/left.glb b/assets/controllers/htc-vive-cosmos/left.glb new file mode 100644 index 00000000..5ac90655 Binary files /dev/null and b/assets/controllers/htc-vive-cosmos/left.glb differ diff --git a/assets/controllers/htc-vive-cosmos/profile.json b/assets/controllers/htc-vive-cosmos/profile.json new file mode 100644 index 00000000..c5777dfa --- /dev/null +++ b/assets/controllers/htc-vive-cosmos/profile.json @@ -0,0 +1,328 @@ +{ + "profileId": "htc-vive-cosmos", + "fallbackProfileIds": [ + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + }, + "bumper": { + "type": "button", + "gamepadIndices": { + "button": 6 + }, + "rootNodeName": "bumper", + "visualResponses": { + "bumper_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "bumper_pressed_value", + "minNodeName": "bumper_pressed_min", + "maxNodeName": "bumper_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc-vive-cosmos-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + }, + "bumper": { + "type": "button", + "gamepadIndices": { + "button": 6 + }, + "rootNodeName": "bumper", + "visualResponses": { + "bumper_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "bumper_pressed_value", + "minNodeName": "bumper_pressed_min", + "maxNodeName": "bumper_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc-vive-cosmos-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/htc-vive-cosmos/right.glb b/assets/controllers/htc-vive-cosmos/right.glb new file mode 100644 index 00000000..d6a34e80 Binary files /dev/null and b/assets/controllers/htc-vive-cosmos/right.glb differ diff --git a/assets/controllers/htc-vive-focus-3/left.glb b/assets/controllers/htc-vive-focus-3/left.glb new file mode 100644 index 00000000..5b394fbc Binary files /dev/null and b/assets/controllers/htc-vive-focus-3/left.glb differ diff --git a/assets/controllers/htc-vive-focus-3/profile.json b/assets/controllers/htc-vive-focus-3/profile.json new file mode 100644 index 00000000..1fe79b34 --- /dev/null +++ b/assets/controllers/htc-vive-focus-3/profile.json @@ -0,0 +1,286 @@ +{ + "profileId": "htc-vive-focus-3", + "fallbackProfileIds": [ + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc-vive-focus-3-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc-vive-focus-3-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/htc-vive-focus-3/right.glb b/assets/controllers/htc-vive-focus-3/right.glb new file mode 100644 index 00000000..1efd1d2b Binary files /dev/null and b/assets/controllers/htc-vive-focus-3/right.glb differ diff --git a/assets/controllers/htc-vive/none.glb b/assets/controllers/htc-vive/none.glb new file mode 100644 index 00000000..2d733152 Binary files /dev/null and b/assets/controllers/htc-vive/none.glb differ diff --git a/assets/controllers/htc-vive/profile.json b/assets/controllers/htc-vive/profile.json new file mode 100644 index 00000000..77dce660 --- /dev/null +++ b/assets/controllers/htc-vive/profile.json @@ -0,0 +1,413 @@ +{ + "profileId": "htc-vive", + "fallbackProfileIds": [ + "generic-trigger-squeeze-touchpad" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-touchpad": { + "type": "touchpad", + "gamepadIndices": { + "button": 2, + "xAxis": 0, + "yAxis": 1 + }, + "rootNodeName": "xr_standard_touchpad", + "visualResponses": { + "xr_standard_touchpad_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_pressed_value", + "minNodeName": "xr_standard_touchpad_pressed_min", + "maxNodeName": "xr_standard_touchpad_pressed_max" + }, + "xr_standard_touchpad_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_xaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_xaxis_pressed_max" + }, + "xr_standard_touchpad_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_yaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_yaxis_pressed_max" + }, + "xr_standard_touchpad_xaxis_touched": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_touched_value", + "minNodeName": "xr_standard_touchpad_xaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_xaxis_touched_max" + }, + "xr_standard_touchpad_yaxis_touched": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_touched_value", + "minNodeName": "xr_standard_touchpad_yaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_yaxis_touched_max" + }, + "xr_standard_touchpad_axes_touched": { + "componentProperty": "state", + "states": [ + "touched", + "pressed" + ], + "valueNodeProperty": "visibility", + "valueNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "touchPointNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc_vive_none", + "assetPath": "none.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-touchpad": { + "type": "touchpad", + "gamepadIndices": { + "button": 2, + "xAxis": 0, + "yAxis": 1 + }, + "rootNodeName": "xr_standard_touchpad", + "visualResponses": { + "xr_standard_touchpad_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_pressed_value", + "minNodeName": "xr_standard_touchpad_pressed_min", + "maxNodeName": "xr_standard_touchpad_pressed_max" + }, + "xr_standard_touchpad_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_xaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_xaxis_pressed_max" + }, + "xr_standard_touchpad_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_yaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_yaxis_pressed_max" + }, + "xr_standard_touchpad_xaxis_touched": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_touched_value", + "minNodeName": "xr_standard_touchpad_xaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_xaxis_touched_max" + }, + "xr_standard_touchpad_yaxis_touched": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_touched_value", + "minNodeName": "xr_standard_touchpad_yaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_yaxis_touched_max" + }, + "xr_standard_touchpad_axes_touched": { + "componentProperty": "state", + "states": [ + "touched", + "pressed" + ], + "valueNodeProperty": "visibility", + "valueNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "touchPointNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc_vive_none", + "assetPath": "none.glb" + }, + "none": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + }, + "xr_standard_squeeze_pressed_mirror": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_mirror_value", + "minNodeName": "xr_standard_squeeze_pressed_mirror_min", + "maxNodeName": "xr_standard_squeeze_pressed_mirror_max" + } + } + }, + "xr-standard-touchpad": { + "type": "touchpad", + "gamepadIndices": { + "button": 2, + "xAxis": 0, + "yAxis": 1 + }, + "rootNodeName": "xr_standard_touchpad", + "visualResponses": { + "xr_standard_touchpad_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_pressed_value", + "minNodeName": "xr_standard_touchpad_pressed_min", + "maxNodeName": "xr_standard_touchpad_pressed_max" + }, + "xr_standard_touchpad_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_xaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_xaxis_pressed_max" + }, + "xr_standard_touchpad_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_yaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_yaxis_pressed_max" + }, + "xr_standard_touchpad_xaxis_touched": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_touched_value", + "minNodeName": "xr_standard_touchpad_xaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_xaxis_touched_max" + }, + "xr_standard_touchpad_yaxis_touched": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_touched_value", + "minNodeName": "xr_standard_touchpad_yaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_yaxis_touched_max" + }, + "xr_standard_touchpad_axes_touched": { + "componentProperty": "state", + "states": [ + "touched", + "pressed" + ], + "valueNodeProperty": "visibility", + "valueNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "touchPointNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "htc-vive-none", + "assetPath": "none.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/meta-quest-touch-plus/left.glb b/assets/controllers/meta-quest-touch-plus/left.glb new file mode 100644 index 00000000..1bd74214 Binary files /dev/null and b/assets/controllers/meta-quest-touch-plus/left.glb differ diff --git a/assets/controllers/meta-quest-touch-plus/profile.json b/assets/controllers/meta-quest-touch-plus/profile.json new file mode 100644 index 00000000..f595863e --- /dev/null +++ b/assets/controllers/meta-quest-touch-plus/profile.json @@ -0,0 +1,351 @@ +{ + "profileId": "meta-quest-touch-plus", + "fallbackProfileIds": [ + "oculus-touch-v3", + "oculus-touch", + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + }, + "thumbrest": { + "type": "button", + "gamepadIndices": { + "button": 6 + }, + "rootNodeName": "thumbrest", + "visualResponses": { + "thumbrest_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "thumbrest_pressed_value", + "minNodeName": "thumbrest_pressed_min", + "maxNodeName": "thumbrest_pressed_max" + } + } + }, + "menu": { + "type": "button", + "gamepadIndices": { + "button": 7 + }, + "rootNodeName": "menu", + "visualResponses": { + "menu_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "menu_pressed_value", + "minNodeName": "menu_pressed_min", + "maxNodeName": "menu_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "meta-quest-touch-plus-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + }, + "thumbrest": { + "type": "button", + "gamepadIndices": { + "button": 6 + }, + "rootNodeName": "thumbrest", + "visualResponses": { + "thumbrest_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "thumbrest_pressed_value", + "minNodeName": "thumbrest_pressed_min", + "maxNodeName": "thumbrest_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "meta-quest-touch-plus-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/meta-quest-touch-plus/right.glb b/assets/controllers/meta-quest-touch-plus/right.glb new file mode 100644 index 00000000..ed0d521c Binary files /dev/null and b/assets/controllers/meta-quest-touch-plus/right.glb differ diff --git a/assets/controllers/meta-quest-touch-pro/left.glb b/assets/controllers/meta-quest-touch-pro/left.glb new file mode 100644 index 00000000..df8c76b8 Binary files /dev/null and b/assets/controllers/meta-quest-touch-pro/left.glb differ diff --git a/assets/controllers/meta-quest-touch-pro/profile.json b/assets/controllers/meta-quest-touch-pro/profile.json new file mode 100644 index 00000000..4a2f8f2a --- /dev/null +++ b/assets/controllers/meta-quest-touch-pro/profile.json @@ -0,0 +1,351 @@ +{ + "profileId": "meta-quest-touch-pro", + "fallbackProfileIds": [ + "oculus-touch-v2", + "oculus-touch", + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + }, + "thumbrest": { + "type": "button", + "gamepadIndices": { + "button": 6 + }, + "rootNodeName": "thumbrest", + "visualResponses": { + "thumbrest_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "thumbrest_pressed_value", + "minNodeName": "thumbrest_pressed_min", + "maxNodeName": "thumbrest_pressed_max" + } + } + }, + "menu": { + "type": "button", + "gamepadIndices": { + "button": 7 + }, + "rootNodeName": "menu", + "visualResponses": { + "menu_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "menu_pressed_value", + "minNodeName": "menu_pressed_min", + "maxNodeName": "menu_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "meta-quest-touch-pro-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + }, + "thumbrest": { + "type": "button", + "gamepadIndices": { + "button": 6 + }, + "rootNodeName": "thumbrest", + "visualResponses": { + "thumbrest_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "thumbrest_pressed_value", + "minNodeName": "thumbrest_pressed_min", + "maxNodeName": "thumbrest_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "meta-quest-touch-pro-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/meta-quest-touch-pro/right.glb b/assets/controllers/meta-quest-touch-pro/right.glb new file mode 100644 index 00000000..79d235dc Binary files /dev/null and b/assets/controllers/meta-quest-touch-pro/right.glb differ diff --git a/assets/controllers/microsoft-mixed-reality/left.glb b/assets/controllers/microsoft-mixed-reality/left.glb new file mode 100644 index 00000000..b5cdad22 Binary files /dev/null and b/assets/controllers/microsoft-mixed-reality/left.glb differ diff --git a/assets/controllers/microsoft-mixed-reality/profile.json b/assets/controllers/microsoft-mixed-reality/profile.json new file mode 100644 index 00000000..b09bd088 --- /dev/null +++ b/assets/controllers/microsoft-mixed-reality/profile.json @@ -0,0 +1,364 @@ +{ + "profileId": "microsoft-mixed-reality", + "fallbackProfileIds": [ + "generic-trigger-squeeze-touchpad-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-touchpad": { + "type": "touchpad", + "gamepadIndices": { + "button": 2, + "xAxis": 0, + "yAxis": 1 + }, + "rootNodeName": "xr_standard_touchpad", + "visualResponses": { + "xr_standard_touchpad_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_pressed_value", + "minNodeName": "xr_standard_touchpad_pressed_min", + "maxNodeName": "xr_standard_touchpad_pressed_max" + }, + "xr_standard_touchpad_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_xaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_xaxis_pressed_max" + }, + "xr_standard_touchpad_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_yaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_yaxis_pressed_max" + }, + "xr_standard_touchpad_xaxis_touched": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_touched_value", + "minNodeName": "xr_standard_touchpad_xaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_xaxis_touched_max" + }, + "xr_standard_touchpad_yaxis_touched": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_touched_value", + "minNodeName": "xr_standard_touchpad_yaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_yaxis_touched_max" + }, + "xr_standard_touchpad_axes_touched": { + "componentProperty": "state", + "states": [ + "touched", + "pressed" + ], + "valueNodeProperty": "visibility", + "valueNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "touchPointNodeName": "xr_standard_touchpad_axes_touched_value" + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "microsoft-mixed-reality-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-touchpad": { + "type": "touchpad", + "gamepadIndices": { + "button": 2, + "xAxis": 0, + "yAxis": 1 + }, + "rootNodeName": "xr_standard_touchpad", + "visualResponses": { + "xr_standard_touchpad_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_pressed_value", + "minNodeName": "xr_standard_touchpad_pressed_min", + "maxNodeName": "xr_standard_touchpad_pressed_max" + }, + "xr_standard_touchpad_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_xaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_xaxis_pressed_max" + }, + "xr_standard_touchpad_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_yaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_yaxis_pressed_max" + }, + "xr_standard_touchpad_xaxis_touched": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_touched_value", + "minNodeName": "xr_standard_touchpad_xaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_xaxis_touched_max" + }, + "xr_standard_touchpad_yaxis_touched": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_touched_value", + "minNodeName": "xr_standard_touchpad_yaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_yaxis_touched_max" + }, + "xr_standard_touchpad_axes_touched": { + "componentProperty": "state", + "states": [ + "touched", + "pressed" + ], + "valueNodeProperty": "visibility", + "valueNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "touchPointNodeName": "xr_standard_touchpad_axes_touched_value" + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "microsoft-mixed-reality-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/microsoft-mixed-reality/right.glb b/assets/controllers/microsoft-mixed-reality/right.glb new file mode 100644 index 00000000..3c423134 Binary files /dev/null and b/assets/controllers/microsoft-mixed-reality/right.glb differ diff --git a/assets/controllers/oculus-touch-v3/left.glb b/assets/controllers/oculus-touch-v3/left.glb new file mode 100644 index 00000000..e247b11c Binary files /dev/null and b/assets/controllers/oculus-touch-v3/left.glb differ diff --git a/assets/controllers/oculus-touch-v3/profile.json b/assets/controllers/oculus-touch-v3/profile.json new file mode 100644 index 00000000..f6a39eb0 --- /dev/null +++ b/assets/controllers/oculus-touch-v3/profile.json @@ -0,0 +1,351 @@ +{ + "profileId": "oculus-touch-v3", + "fallbackProfileIds": [ + "oculus-touch-v2", + "oculus-touch", + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + }, + "thumbrest": { + "type": "button", + "gamepadIndices": { + "button": 6 + }, + "rootNodeName": "thumbrest", + "visualResponses": { + "thumbrest_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "thumbrest_pressed_value", + "minNodeName": "thumbrest_pressed_min", + "maxNodeName": "thumbrest_pressed_max" + } + } + }, + "menu": { + "type": "button", + "gamepadIndices": { + "button": 7 + }, + "rootNodeName": "menu", + "visualResponses": { + "menu_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "menu_pressed_value", + "minNodeName": "menu_pressed_min", + "maxNodeName": "menu_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "oculus-touch-v3-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + }, + "thumbrest": { + "type": "button", + "gamepadIndices": { + "button": 6 + }, + "rootNodeName": "thumbrest", + "visualResponses": { + "thumbrest_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "thumbrest_pressed_value", + "minNodeName": "thumbrest_pressed_min", + "maxNodeName": "thumbrest_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "oculus-touch-v3-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/oculus-touch-v3/right.glb b/assets/controllers/oculus-touch-v3/right.glb new file mode 100644 index 00000000..79ffc272 Binary files /dev/null and b/assets/controllers/oculus-touch-v3/right.glb differ diff --git a/assets/controllers/pico-4/left.glb b/assets/controllers/pico-4/left.glb new file mode 100644 index 00000000..e98215f0 Binary files /dev/null and b/assets/controllers/pico-4/left.glb differ diff --git a/assets/controllers/pico-4/profile.json b/assets/controllers/pico-4/profile.json new file mode 100644 index 00000000..61fb7202 --- /dev/null +++ b/assets/controllers/pico-4/profile.json @@ -0,0 +1,286 @@ +{ + "profileId": "pico-4", + "fallbackProfileIds": [ + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "pico-4-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "pico-4-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/pico-4/right.glb b/assets/controllers/pico-4/right.glb new file mode 100644 index 00000000..2ba9a967 Binary files /dev/null and b/assets/controllers/pico-4/right.glb differ diff --git a/assets/controllers/pico-neo3/left.glb b/assets/controllers/pico-neo3/left.glb new file mode 100644 index 00000000..fb983686 Binary files /dev/null and b/assets/controllers/pico-neo3/left.glb differ diff --git a/assets/controllers/pico-neo3/profile.json b/assets/controllers/pico-neo3/profile.json new file mode 100644 index 00000000..ec90a910 --- /dev/null +++ b/assets/controllers/pico-neo3/profile.json @@ -0,0 +1,286 @@ +{ + "profileId": "pico-neo3", + "fallbackProfileIds": [ + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "pico-neo3-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "pico-neo3-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/pico-neo3/right.glb b/assets/controllers/pico-neo3/right.glb new file mode 100644 index 00000000..043055bd Binary files /dev/null and b/assets/controllers/pico-neo3/right.glb differ diff --git a/assets/controllers/valve-index/left.glb b/assets/controllers/valve-index/left.glb new file mode 100644 index 00000000..ec338027 Binary files /dev/null and b/assets/controllers/valve-index/left.glb differ diff --git a/assets/controllers/valve-index/profile.json b/assets/controllers/valve-index/profile.json new file mode 100644 index 00000000..e30cbc33 --- /dev/null +++ b/assets/controllers/valve-index/profile.json @@ -0,0 +1,406 @@ +{ + "profileId": "valve-index", + "fallbackProfileIds": [ + "generic-trigger-squeeze-touchpad-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-touchpad": { + "type": "touchpad", + "gamepadIndices": { + "button": 2, + "xAxis": 0, + "yAxis": 1 + }, + "rootNodeName": "xr_standard_touchpad", + "visualResponses": { + "xr_standard_touchpad_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_pressed_value", + "minNodeName": "xr_standard_touchpad_pressed_min", + "maxNodeName": "xr_standard_touchpad_pressed_max" + }, + "xr_standard_touchpad_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_xaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_xaxis_pressed_max" + }, + "xr_standard_touchpad_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_yaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_yaxis_pressed_max" + }, + "xr_standard_touchpad_xaxis_touched": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_touched_value", + "minNodeName": "xr_standard_touchpad_xaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_xaxis_touched_max" + }, + "xr_standard_touchpad_yaxis_touched": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_touched_value", + "minNodeName": "xr_standard_touchpad_yaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_yaxis_touched_max" + }, + "xr_standard_touchpad_axes_touched": { + "componentProperty": "state", + "states": [ + "touched", + "pressed" + ], + "valueNodeProperty": "visibility", + "valueNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "touchPointNodeName": "xr_standard_touchpad_axes_touched_value" + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "valve-index-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-touchpad": { + "type": "touchpad", + "gamepadIndices": { + "button": 2, + "xAxis": 0, + "yAxis": 1 + }, + "rootNodeName": "xr_standard_touchpad", + "visualResponses": { + "xr_standard_touchpad_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_pressed_value", + "minNodeName": "xr_standard_touchpad_pressed_min", + "maxNodeName": "xr_standard_touchpad_pressed_max" + }, + "xr_standard_touchpad_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_xaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_xaxis_pressed_max" + }, + "xr_standard_touchpad_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_pressed_value", + "minNodeName": "xr_standard_touchpad_yaxis_pressed_min", + "maxNodeName": "xr_standard_touchpad_yaxis_pressed_max" + }, + "xr_standard_touchpad_xaxis_touched": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_xaxis_touched_value", + "minNodeName": "xr_standard_touchpad_xaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_xaxis_touched_max" + }, + "xr_standard_touchpad_yaxis_touched": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_touchpad_yaxis_touched_value", + "minNodeName": "xr_standard_touchpad_yaxis_touched_min", + "maxNodeName": "xr_standard_touchpad_yaxis_touched_max" + }, + "xr_standard_touchpad_axes_touched": { + "componentProperty": "state", + "states": [ + "touched", + "pressed" + ], + "valueNodeProperty": "visibility", + "valueNodeName": "xr_standard_touchpad_axes_touched_value" + } + }, + "touchPointNodeName": "xr_standard_touchpad_axes_touched_value" + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "valve-index-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/valve-index/right.glb b/assets/controllers/valve-index/right.glb new file mode 100644 index 00000000..d92874b8 Binary files /dev/null and b/assets/controllers/valve-index/right.glb differ diff --git a/assets/notes.txt b/assets/notes.txt index 4c455e02..dc865d76 100644 --- a/assets/notes.txt +++ b/assets/notes.txt @@ -15,3 +15,11 @@ is licensed under Creative Commons Attribution The Ubuntu font has been packaged for use with the keyboard, and has been converted via SudoFont https://github.com/SudoMike/SudoFont + +Controller models + +The controllers' models in assets/controllers are the WebXR Input Profiles' assets +(https://github.com/immersive-web/webxr-input-profiles, packages/assets, version 1.0.20 on npm), +Copyright (c) 2019 Amazon, under the MIT licence (assets/controllers/LICENSE.md, shipped as +LICENSE_webxr-input-profiles.txt). They are as published, but for the Valve Index ones, whose textures are +downscaled to 1024 pixels. scripts/rendermodels.py converts them to SteamVR's render-model layout at build time. diff --git a/installer/OpenLamina.iss b/installer/OpenLamina.iss index 904c5e8c..260819af 100644 --- a/installer/OpenLamina.iss +++ b/installer/OpenLamina.iss @@ -2,6 +2,7 @@ ; %LOCALAPPDATA%\Programs\OpenLamina, which is then the OpenLamina folder openvrpaths.vrpath names: ; ; bin\vrclient_x64.dll, bin\vrclient.dll, bin\version.txt the runtime (64- and 32-bit games) +; bin\rendermodels\ the controller models ; OpenLamina.exe, Newtonsoft.Json.dll the app: the switch, per-app settings, updates ; SOURCE.txt, LICENSE*.txt the release and its licences ; diff --git a/installer/install.sh b/installer/install.sh index 910d76aa..f5356ae7 100755 --- a/installer/install.sh +++ b/installer/install.sh @@ -14,14 +14,15 @@ Usage: install.sh [command] [--flatpak | --native] Commands (one; with none, install): (none) Copy OpenLamina to ~/.local/share/OpenLamina and make OpenVR games use it: it goes first in the "runtime" list of ~/.config/openvr/openvrpaths.vrpath, other entries kept after it. The file - is backed up to openvrpaths.vrpath.bak first. Files you put in bin/ (openlamina.ini, - apps-config.json) are kept. + is backed up first, to openvrpaths.vrpath..bak. Files you put in bin/ + (openlamina.ini, apps-config.json) are kept. --no-switch Install or update the copy, but leave openvrpaths.vrpath as it is. --openlamina Make OpenVR games use the installed copy (--opencomposite, its name before, does the same). Files you put in bin/ named openlamina.ini or, from before, opencomposite.ini both work. --steamvr Make OpenVR games use SteamVR again: the copy is taken out of the list and SteamVR's folder put first. Starting SteamVR from Steam does that too. - --uninstall --steamvr, then delete the installed copy. + --uninstall --steamvr, then delete the installed copy. Files you put in its bin/ are moved aside first, to + OpenLamina-kept- next to it. --status Say what OpenVR games use, what is installed, and the OpenXR runtime. --update [--pre] Download the newest release from github.com/feimos-dev/OpenLamina (--pre: pre-releases too), check its SHA-256, and install it if it is newer. The switch is left as it is. @@ -107,7 +108,7 @@ command -v python3 >/dev/null 2>&1 || die "python3 is needed (to edit $paths_fil # "runtime" is written back as it was read, in its order. PY=$( cat <<'EOF' -import json, os, re, shutil, sys +import json, os, re, shlex, shutil, sys, time def steamvr(path): return os.path.basename(path.rstrip("/")) == "SteamVR" @@ -130,18 +131,27 @@ def load(file): sys.exit(f"install.sh: {file} isn't an OpenVR paths file (\"runtime\" isn't a list of folders).") return data -# Written next to the real file (a symlink stays a symlink), with its permissions. A file that can't be written, as when -# made read-only to keep SteamVR from changing it, is refused and left as it is. +# Written next to the real file (a symlink stays a symlink), with its permissions, after a backup named by the date and +# time (an earlier backup is never overwritten). A file that can't be written, as when made read-only to keep SteamVR +# from changing it, is refused and left as it is. def save(file, data, old): file = os.path.realpath(file) folder = os.path.dirname(file) temp = file + ".install-tmp" try: os.makedirs(folder, exist_ok=True) - if (old is not None and not os.access(file, os.W_OK)) or not os.access(folder, os.W_OK): + if old is not None and not os.access(file, os.W_OK): raise PermissionError(None, None, file) + if not os.access(folder, os.W_OK): + raise PermissionError(None, None, folder) if old is not None: - shutil.copyfile(file, file + ".bak") + stamp = time.strftime("%Y-%m-%d-%H%M%S") + backup, n = f"{file}.{stamp}.bak", 1 + while os.path.exists(backup): + n += 1 + backup = f"{file}.{stamp}-{n}.bak" + shutil.copyfile(file, backup) + print(f"Backed up {file} to {backup}") with open(temp, "w", encoding="utf-8") as f: json.dump(data, f, indent="\t", ensure_ascii=False) f.write("\n") @@ -151,8 +161,12 @@ def save(file, data, old): except PermissionError as e: if os.path.exists(temp): os.remove(temp) - name = e.filename or file - sys.exit(f"install.sh: {name} can't be written (it or its folder is read-only), so {'it' if name == file else file} was left as it is.") + # A read-only file, else its folder (temporary and backup files go there too) + name = file if e.filename == file else folder + what = "file" if name == file else "folder" + sys.exit(f"install.sh: {name} can't be written (it or its folder is read-only), so {'it' if name == file else file} was left as it is.\n" + f"To let install.sh change it, make the {what} writable (chmod u+w {shlex.quote(name)}) and run this again; " + f"SteamVR can then change it too. Or leave it, and choose the runtime per game with VR_OVERRIDE (README, \"Linux notes\").") def version_key(v): m = re.fullmatch(r"(\d+(?:\.\d+)*)(?:-([0-9A-Za-z.-]+))?", v or "") @@ -224,14 +238,6 @@ def main(command, *args): best = (key, version, asset["browser_download_url"], digest[7:].lower()) if best: print("\t".join(best[1:])) - elif command == "runtime-library": - # The library_path of an OpenXR runtime manifest. - (file,) = args - try: - with open(file, encoding="utf-8") as f: - print(json.load(f)["runtime"]["library_path"]) - except (OSError, ValueError, KeyError, TypeError): - print("") main(*sys.argv[1:]) EOF @@ -261,6 +267,16 @@ copy_files() { for file in bin/linux64/vrclient.so bin/vrclient.so bin/version.txt SOURCE.txt install.sh; do put "$here/$file" "$copy/$file" done + # The controller models: the new folder beside the old, then in its place + if [ -d "$here/bin/rendermodels" ]; then + rm -rf "$copy/bin/rendermodels.install-tmp" "$copy/bin/rendermodels.old" + cp -R "$here/bin/rendermodels" "$copy/bin/rendermodels.install-tmp" + if [ -d "$copy/bin/rendermodels" ]; then + mv "$copy/bin/rendermodels" "$copy/bin/rendermodels.old" + fi + mv "$copy/bin/rendermodels.install-tmp" "$copy/bin/rendermodels" + rm -rf "$copy/bin/rendermodels.old" + fi for file in "$here"/LICENSE*.txt "$here"/LICENCE*.txt "$here"/NOTES*.txt; do if [ -f "$file" ]; then put "$file" "$copy/${file##*/}" @@ -279,6 +295,7 @@ use_openlamina() { py use "$paths_file" "$copy" say "OpenVR games now use OpenLamina ($copy)." say "Starting SteamVR from Steam switches them back to SteamVR; $copy/install.sh --openlamina switches again." + manager_hints } # steamvr: the copy out of the list and SteamVR first. remove (the uninstall): the copy out of the list, and SteamVR @@ -343,67 +360,64 @@ openxr_runtime() { IFS=$old_ifs } -# A launch option's value, in double quotes: Steam runs the launch options with sh, which would split it at a space. -quote() { - printf '"%s"' "$(printf '%s' "$1" | sed 's/[\\"$`]/\\&/g')" -} - +# What a game in the Steam Runtime (most Proton games) needs to reach the OpenXR runtime: pressure-vessel imports the +# host's active runtime, its manifest and library, when asked to. launch_options() { manifest=$(openxr_runtime) if [ -z "$manifest" ]; then say "No active OpenXR runtime found: set your headset's runtime as the active one (its own app or docs say how)." return fi + resolved=$(readlink -f "$manifest" || printf '%s' "$manifest") + say "OpenXR runtime: $manifest$([ "$resolved" != "$manifest" ] && printf ' -> %s' "$resolved")" + say "Games in the Steam Runtime (most Proton games) need this launch option (Steam: the game's Properties," + say "General, Launch options) to reach it:" + say "" + say " PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES=1 %command%" if [ $target = flatpak ]; then - say "Flatpak Steam: your OpenXR runtime ($manifest) has to be visible inside the Flatpak; see the README's" - say "\"Linux-specific info\". install.sh doesn't work out launch options for it." - return + say "" + say "Flatpak Steam: the runtime has to be visible inside the Flatpak as well (one installed for Flatpak Steam," + say "or the Flatpak given access to its files)." fi - resolved=$(readlink -f "$manifest") - options= - # Inside the Steam Runtime, the home folder is as it is, the host's /usr and /etc are under /run/host, and other - # folders aren't there unless named. - case $manifest in - "$home"/*) in_home=1 ;; - *) in_home=0 ;; - esac - library=$(py runtime-library "$resolved") - case $resolved in - "$home"/*) [ $in_home = 1 ] || options="XR_RUNTIME_JSON=$(quote "$resolved")" ;; - /usr/* | /etc/*) options="XR_RUNTIME_JSON=$(quote "/run/host$resolved")" ;; - *) - # The manifest's folder, and its library's if that is elsewhere (a library_path with a / is relative to the - # manifest), separated by ":". - folders=$(dirname "$resolved") - case $library in - */*) library_file=$(cd "$folders" && readlink -f "$library") || library_file= ;; - *) library_file= ;; - esac - case ${library_file%/*} in - "" | "$folders" | "$folders"/* | "$home"/* | /usr/* | /etc/*) ;; - *) folders=$folders:${library_file%/*} ;; - esac - options="XR_RUNTIME_JSON=$(quote "$resolved") PRESSURE_VESSEL_FILESYSTEMS_RO=$(quote "$folders")" - ;; - esac - case $library in - /usr/*) say "Note: $resolved names its library by an absolute path ($library), which games in the Steam Runtime may not find (there, /usr is the runtime's own)." ;; + say "" + say "The README's \"Linux notes\" explain more." +} + +# A VR server that writes openvrpaths.vrpath itself when it starts puts its own OpenVR runtime first again: say how to +# make it choose OpenLamina. +manager_hints() { + config=${XDG_CONFIG_HOME:-$home/.config} + listed=$(cat "$paths_file" 2>/dev/null || true) + case $listed in + *[Ww]i[Vv][Rr]n*) wivrn=1 ;; + *) wivrn=0 ;; esac - case "$resolved $library" in - *wivrn* | *WiVRn*) options="${options:+$options }PRESSURE_VESSEL_FILESYSTEMS_RW=\$XDG_RUNTIME_DIR/wivrn/comp_ipc" ;; - *monado* | *Monado*) options="${options:+$options }PRESSURE_VESSEL_FILESYSTEMS_RW=\$XDG_RUNTIME_DIR/monado_comp_ipc" ;; + if [ $wivrn = 1 ] || [ -d "$config/wivrn" ] || [ -d "$home/.var/app/io.github.wivrn.wivrn" ]; then + say "WiVRn writes $paths_file when it starts, with its own OpenVR runtime first. To make it choose OpenLamina," + say "set \"openvr-compat-path\": \"$copy\" in its config.json ($config/wivrn/config.json, or in the" + say "Flatpak's ~/.var/app/io.github.wivrn.wivrn/config/wivrn/)." + fi + case $listed in + *[Ee]nvision*) envision=1 ;; + *) envision=0 ;; esac - say "OpenXR runtime: $manifest$([ "$resolved" != "$manifest" ] && printf ' -> %s' "$resolved")" - if [ -n "$options" ]; then - say "Games in the Steam Runtime (most Proton games) need these launch options (Steam: the game's Properties," - say "General, Launch options) to reach it:" - say "" - say " $options %command%" - else - say "Games in the Steam Runtime should find it without launch options." + if [ $envision = 1 ] || [ -d "$config/envision" ] || [ -d "${XDG_DATA_HOME:-$home/.local/share}/envision" ]; then + say "Envision writes $paths_file when it starts a profile, with the profile's OpenVR runtime first. To make it" + say "choose OpenLamina, set that profile's OpenVR runtime path to $copy." fi - say "" - say "This is worked out from the runtime's files and may not cover yours; the README's \"Linux-specific info\" explains." +} + +# Files the owner put in the copy's bin/ (openlamina.ini, say), moved to OpenLamina-kept- next to the copy before +# the copy is deleted. Prints where, or nothing when there were none. +keep_own_files() { + [ -d "$copy/bin" ] || return 0 + rm -f "$copy/bin/linux64/vrclient.so" "$copy/bin/vrclient.so" "$copy/bin/version.txt" + find "$copy/bin" -depth -type d -empty -delete + [ -d "$copy/bin" ] || return 0 + aside=$copy-kept-$(date +%Y-%m-%d-%H%M%S) + mkdir -p "$aside" + mv "$copy/bin" "$aside/bin" + say "Kept the files you put in $copy/bin: they are in $aside/bin." } fetch() { @@ -456,6 +470,7 @@ steamvr) use_steamvr steamvr ;; uninstall) use_steamvr remove if [ -d "$copy" ]; then + keep_own_files rm -rf "$copy" say "Deleted $copy." fi @@ -463,6 +478,7 @@ uninstall) status) status other_steam + manager_hints ;; update) update ;; launch) launch_options ;; diff --git a/scripts/ci/build-linux.sh b/scripts/ci/build-linux.sh index bf298a4b..c47e70f7 100755 --- a/scripts/ci/build-linux.sh +++ b/scripts/ci/build-linux.sh @@ -5,7 +5,8 @@ # # scripts/ci/build-linux.sh [--tests] x64|x86 [build-dir] [version] # -# --tests also builds the tests (OC_BUILD_TESTS) and runs the unit tests. +# --tests also builds the tests (OC_BUILD_TESTS) and runs the unit tests. OC_CMAKE_ARGS adds CMake options (split at +# spaces), as CI's variants do: -DUSE_SYSTEM_OPENXR=ON -DUSE_SYSTEM_GLM=ON, say. CXXFLAGS is CMake's own. # # x64 makes /bin/linux64/vrclient.so; x86 (scripts/ci/x86-toolchain.cmake) makes /bin/vrclient.so. set -eu @@ -39,6 +40,8 @@ set -- -S "$root" -B "$out" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DERR if [ "$arch" = x86 ]; then set -- "$@" "-DCMAKE_TOOLCHAIN_FILE=$root/scripts/ci/x86-toolchain.cmake" fi +# shellcheck disable=SC2086 # split on purpose +set -- "$@" ${OC_CMAKE_ARGS:-} rm -rf "$out" cmake "$@" diff --git a/scripts/ci/conformance-linux.sh b/scripts/ci/conformance-linux.sh index dfbc3a34..013b9ac0 100755 --- a/scripts/ci/conformance-linux.sh +++ b/scripts/ci/conformance-linux.sh @@ -8,8 +8,9 @@ # scripts/ci/conformance-linux.sh x64|x86 [build-dir] [out-dir] # # Exits non-zero if any run failed; every run is made all the same. Left out, as they don't apply here: the cases of -# Direct3D (their Vulkan and OpenGL counterparts run), OpenGL and Vulkan through D3D11, OpenLamina's own frames (on -# D3D sessions only), the Steam client observer and the background apps' refusals (background apps get a scene session +# Direct3D (their Vulkan and OpenGL counterparts run), OpenGL and Vulkan through D3D11, OpenLamina's own frames on a +# thread of their own when the game is idle (on D3D sessions only: Vulkan and OpenGL ones run them only inside the +# game's calls), the Steam client observer and the background apps' refusals (background apps get a scene session # on Linux, for Proton). set -u @@ -62,8 +63,15 @@ run --cases session-events --script tests/conformance/scripts/session_events.jso run --cases velocities --script tests/conformance/scripts/velocities.json --expect tests/conformance/expect/velocities.json --out "$out"/velocities # The binding evaluator evaluates a toggle_button, and reads a vector3 run --cases input-frames --script tests/conformance/scripts/input_toggle.json --manifest tests/unit/data/manifest_toggle.json --expect tests/conformance/expect/input_evaluator.json --out "$out"/input-steamvr -# A bound source that isn't an input path: GetActionBindingInfo leaves it out +# GetActionBindingInfo from the binding file (poses and vibrations included), and without one a vibration's bound outputs run --cases binding-info --script tests/conformance/scripts/bound_source_odd.json --manifest tests/unit/data/manifest_toggle.json --expect tests/conformance/expect/binding_info.json --out "$out"/binding-info +run --cases binding-info --script tests/conformance/scripts/bound_source_odd.json --manifest tests/unit/data/manifest_haptic_no_bindings.json --expect tests/conformance/expect/binding_info_runtime.json --out "$out"/binding-info-runtime +# Vive trackers by their role: a device per role, and a pose action a tracker's binding file binds read from it +run --cases vive-trackers --script tests/conformance/scripts/vive_trackers.json --manifest tests/unit/data/manifest_trackers.json --expect tests/conformance/expect/vive_trackers.json --out "$out"/vive-trackers +# The hands as controllers: through XR_EXT_hand_interaction, with hand tracking alone, and shown as Touch controllers +run --cases hand-controllers --script tests/conformance/scripts/hand_interaction.json --manifest tests/unit/data/manifest_trackers.json --expect tests/conformance/expect/hand_controllers.json --out "$out"/hand-controllers +run --cases hand-controllers --script tests/conformance/scripts/hand_tracking_only.json --manifest tests/unit/data/manifest_trackers.json --expect tests/conformance/expect/hand_controllers_tracking.json --out "$out"/hand-controllers-tracking +run --cases hand-controllers --script tests/conformance/scripts/hand_interaction.json --manifest tests/unit/data/manifest_trackers.json --ini tests/conformance/ini/hand_controller_touch.ini --expect tests/conformance/expect/hand_controllers_touch.json --out "$out"/hand-controllers-touch # The compositor's calls with every graphics API offered: the Vulkan extension lists with a null buffer run --only "IVRCompositor_0(19|2[0-9])" --script tests/conformance/scripts/gfx_all_apis.json --out "$out"/compositor-all-apis # Eye-tracked foveation from the eye gaze: with an action manifest and with legacy input, canted views, @@ -84,6 +92,17 @@ run --cases display-frequency --script tests/conformance/scripts/refresh_72_120. run --cases display-frequency --script tests/conformance/scripts/display_120.json --expect tests/conformance/expect/display_frequency_measured.json --out "$out"/display-frequency-measured # Every interface as an overlay application on its session: nothing crashes, ends or hangs run --apptypes 2 --script tests/conformance/scripts/helper_apps.json --out "$out"/helper-apps-interfaces +# An overlay app's Vulkan and OpenGL textures: shared with OpenLamina's own device (VK_KHR_external_memory_fd, +# GL_EXT_memory_object_fd, which lavapipe and llvmpipe have), and read back into memory where the program has neither. +# One case a run, so that its log says whether it was shared. +for api in vk gl; do + run --cases overlay-app-$api --script tests/conformance/scripts/helper_apps.json --expect tests/conformance/expect/helper_apps_linux_$api.json --out "$out"/helper-apps-shared-$api + check sh -c 'ls "$1"/logs/*.log >/dev/null && ! grep "isn.t shared with the session" "$1"/logs/*.log' - "$out"/helper-apps-shared-$api + check env OC_CONFORMANCE_NO_EXTERNAL_MEMORY=1 MESA_EXTENSION_OVERRIDE=-GL_EXT_memory_object_fd \ + python3 tests/conformance/run.py --runtime "$build/$lib" --conformance "$build/tests/oc_conformance" --xr-runtime stand-in --ci \ + --cases overlay-app-$api --script tests/conformance/scripts/helper_apps.json --expect tests/conformance/expect/helper_apps_linux_$api.json --out "$out"/helper-apps-readback-$api + check sh -c 'grep -q "isn.t shared with the session" "$1"/logs/*.log' - "$out"/helper-apps-readback-$api +done # The game's pointer on an overlay app's overlay, and an overlay app that ends without shutting down (two programs each) run --cases remote-pointer,remote-pointer-overlay --jobs 2 --script tests/conformance/scripts/remote_pointer.json --ini tests/conformance/ini/laser_mouse.ini --expect tests/conformance/expect/remote_pointer.json --out "$out"/remote-pointer run --cases remote-pointer-peer-dies,remote-pointer-dying-overlay --jobs 2 --script tests/conformance/scripts/remote_pointer.json --ini tests/conformance/ini/laser_mouse.ini --expect tests/conformance/expect/remote_pointer_peer_dies.json --out "$out"/remote-pointer-peer-dies @@ -91,6 +110,8 @@ run --cases remote-pointer-peer-dies,remote-pointer-dying-overlay --jobs 2 --scr run --cases dashboard,dashboard-overlay --jobs 2 --script tests/conformance/scripts/dashboard.json --ini tests/conformance/ini/dashboard.ini --manifest tests/unit/data/manifest_basic.json --expect tests/conformance/expect/dashboard.json --out "$out"/dashboard # A controller's system button held recentres and opens no dashboard; pressed, it opens and closes the dashboard run --cases recentre --script tests/conformance/scripts/recentre.json --ini tests/conformance/ini/recentre.ini --expect tests/conformance/expect/recentre.json --out "$out"/recentre +# Controllers found from the game's first frames +run --cases controllers-early --script tests/conformance/scripts/controllers_early.json --expect tests/conformance/expect/controllers_early.json --out "$out"/controllers-early # The play area's walls near its edge with drawBounds, and none without run --cases bounds --script tests/conformance/scripts/bounds.json --ini tests/conformance/ini/draw_bounds.ini --expect tests/conformance/expect/bounds.json --out "$out"/bounds run --cases bounds-room-setup --script tests/conformance/scripts/bounds_room_setup.json --ini tests/conformance/ini/draw_bounds.ini --expect tests/conformance/expect/bounds_room_setup.json --out "$out"/bounds-room-setup @@ -101,17 +122,35 @@ run --shipped-defaults --cases laser-mouse --script tests/conformance/scripts/la run --shipped-defaults --cases session-events --script tests/conformance/scripts/session_events.json --expect tests/conformance/expect/session_events.json --out "$out"/defaults-session-events run --shipped-defaults --cases bounds --script tests/conformance/scripts/bounds.json --expect tests/conformance/expect/bounds.json --out "$out"/defaults-bounds run --shipped-defaults --cases recentre --script tests/conformance/scripts/recentre.json --expect tests/conformance/expect/recentre.json --out "$out"/defaults-recentre +# A message box in OpenLamina's own frames, run inside the blocked call (no thread on a Vulkan or OpenGL session), +# answered with the laser; one the session ends under answers as the game's quit +run --cases message-overlay --script tests/conformance/scripts/message_box.json --ini tests/conformance/ini/own_frames.ini --expect tests/conformance/expect/message_overlay.json --out "$out"/message-overlay +run --cases message-overlay --script tests/conformance/scripts/message_box_exit.json --ini tests/conformance/ini/own_frames.ini --expect tests/conformance/expect/message_overlay_exit.json --out "$out"/message-overlay-exit +run --shipped-defaults --cases message-overlay --script tests/conformance/scripts/message_box.json --expect tests/conformance/expect/message_overlay.json --out "$out"/defaults-message-overlay +# A game that calls WaitGetPoses without Submit: its frames are ended for it inside the call +run --cases wait-without-submit --ini tests/conformance/ini/own_frames.ini --expect tests/conformance/expect/wait_without_submit.json --out "$out"/wait-without-submit +run --cases gfx-vk-wait-without-submit,gfx-gl-wait-without-submit --script tests/conformance/scripts/gfx_all_apis.json --ini tests/conformance/ini/own_frames.ini --expect tests/conformance/expect/gfx_wait_without_submit.json --out "$out"/gfx-wait-without-submit # The keyboard, typed on with the laser run --cases keyboard --script tests/conformance/scripts/keyboard.json --ini tests/conformance/ini/keyboard_us.ini --expect tests/conformance/expect/keyboard.json --out "$out"/keyboard # Frames and overlays from the Vulkan and OpenGL games, as the stand-in reads them back (the Direct3D cases skip) d3d='gfx-d3d1[012]-.*|overlay-(raw|texture-readback)-d3d1[12]|overlay-images' run --cases overlay-images,gfx-d3d11-basic,gfx-d3d12-basic,gfx-vk-basic,gfx-gl-basic,gfx-d3d10-basic,gfx-d3d11-odd,gfx-d3d11-bounds,gfx-d3d12-bounds,gfx-vk-bounds,gfx-gl-bounds,overlay-raw-d3d11,overlay-raw-d3d12,overlay-raw-vk,overlay-raw-gl,overlay-texture-readback-d3d11,overlay-texture-readback-d3d12,overlay-texture-readback-vk,overlay-texture-readback-gl --script tests/conformance/scripts/gfx_all_apis.json --expect tests/conformance/expect/gfx.json --allow-skip "$d3d" --out "$out"/gfx +# CompositorDumpImages: the eyes' next images as PNGs in the log folder +run --cases gfx-vk-dump-images,gfx-gl-dump-images --script tests/conformance/scripts/gfx_all_apis.json --expect tests/conformance/expect/dump_images.json --out "$out"/dump-images +# A runtime with XR_KHR_vulkan_enable2 alone: the temporary device made through it, and the game's session on it +run --cases gfx-vk-basic,gfx-vk-bounds --script tests/conformance/scripts/gfx_vk_enable2.json --expect tests/conformance/expect/gfx_vk_enable2.json --out "$out"/gfx-vk-enable2 # Formats the runtime doesn't offer (it has RGBA8 sRGB only), converted into the one it has run --cases gfx-d3d11-formats,gfx-d3d12-formats,gfx-vk-formats,gfx-gl-formats --script tests/conformance/scripts/gfx_rgba8_only.json --expect tests/conformance/expect/gfx_formats.json --allow-skip "$d3d" --out "$out"/gfx-formats # The pose and depth a frame was submitted with: used with useSubmittedPose and submitDepth on, not without run --cases gfx-d3d11-pose-depth,gfx-d3d12-pose-depth,gfx-vk-pose-depth,gfx-gl-pose-depth --script tests/conformance/scripts/gfx_depth.json --ini tests/conformance/ini/pose_depth.ini --expect tests/conformance/expect/gfx_pose_depth.json --allow-skip "$d3d" --out "$out"/gfx-pose-depth run --cases gfx-d3d11-pose-depth,gfx-d3d12-pose-depth,gfx-vk-pose-depth,gfx-gl-pose-depth --script tests/conformance/scripts/gfx_depth.json --expect tests/conformance/expect/gfx_pose_depth_off.json --allow-skip "$d3d" --out "$out"/gfx-pose-depth-off run --shipped-defaults --cases gfx-d3d11-pose-depth,gfx-d3d12-pose-depth,gfx-vk-pose-depth,gfx-gl-pose-depth --script tests/conformance/scripts/gfx_depth.json --expect tests/conformance/expect/gfx_pose_depth.json --allow-skip "$d3d" --out "$out"/defaults-pose-depth +# The cases whose answers wait on a SteamVR recording, with both controllers on (every record ok; the values +# are the baselines' and the recordings') +steamvr_run=app-type-answers,device-properties,init-again,chaperone-colours,submit-refusals,skeletal-input,legacy-controller,render-model-components,overlay-defaults,settings-defaults,application-list,io-buffer +run --cases "$steamvr_run" --script tests/conformance/scripts/controllers_on.json --out "$out"/steamvr-run +# An overlay app and a background app that submit no frames see the controllers through IVRSystem +run --cases helper-app-controllers --script tests/conformance/scripts/helper_apps_controllers.json --expect tests/conformance/expect/helper_app_controllers.json --out "$out"/helper-app-controllers echo "$failed failed" exit $((failed > 0)) diff --git a/scripts/ci/package.py b/scripts/ci/package.py index 56e07fd6..7d3880ed 100755 --- a/scripts/ci/package.py +++ b/scripts/ci/package.py @@ -18,8 +18,9 @@ --windows-folder writes the Windows archive's OpenLamina folder into DIR instead, unpacked, for the installer. Both binary archives also have an empty bin/version.txt (it keeps Steam from rewriting openvrpaths.vrpath while that -names the folder), the licences of OpenLamina and of what is built into it, and SOURCE.txt. Each archive's entries -carry the commit's time, so the same commit packs the same bytes. +names the folder), the controller models in bin/rendermodels (scripts/rendermodels.py converts them), the licences of +OpenLamina and of what is built into it, and SOURCE.txt. Each archive's entries carry the commit's time, so the same +commit packs the same bytes. """ import argparse @@ -29,14 +30,17 @@ import subprocess import sys import tarfile +import tempfile import time import zipfile from pathlib import Path ROOT = Path(__file__).resolve().parents[2] +sys.path.insert(0, str(ROOT / "scripts")) +import rendermodels # noqa: E402 -# OpenLamina's licence and those of what is built into the library (the hand models, glm, the OpenXR loader and its -# jsoncpp): source path -> name in the archive. +# OpenLamina's licence and those of what is built into the library or comes with it (the hand models, the controller +# models, glm, the OpenXR loader and its jsoncpp): source path -> name in the archive. LICENCES = { "LICENSE.txt": "LICENSE.txt", "LICENSE_OPENVR.txt": "LICENSE_OPENVR.txt", @@ -44,6 +48,7 @@ "LICENCE_BUILD_UTIL.txt": "LICENCE_BUILD_UTIL.txt", "assets/LICENSE.txt": "LICENSE_assets.txt", "assets/notes.txt": "NOTES_assets.txt", + "assets/controllers/LICENSE.md": "LICENSE_webxr-input-profiles.txt", "libs/glm/copying.txt": "LICENSE_glm.txt", "libs/openxr-sdk/LICENSE": "LICENSE_openxr-sdk.txt", "libs/openxr-sdk/LICENSES/LicenseRef-jsoncpp-public-domain.txt": "LICENSE_jsoncpp.txt", @@ -91,6 +96,8 @@ def binary_files(os_name: str, artifacts: Path, version: str, commit: str, repos sys.exit(f"{path} is missing: the {folder} build's artifact.") files[target] = (path.read_bytes(), 0o755) files["bin/version.txt"] = (b"", 0o644) + for path, data in controller_models().items(): + files[f"bin/rendermodels/{path}"] = (data, 0o644) licences = LICENCES | (LINUX_LICENCES if os_name == "linux" else {}) for source, target in licences.items(): path = ROOT / source @@ -103,6 +110,16 @@ def binary_files(os_name: str, artifacts: Path, version: str, commit: str, repos return files +def controller_models() -> dict[str, bytes]: + """The controller models (scripts/rendermodels.py) from assets/controllers: path in bin/rendermodels -> contents""" + with tempfile.TemporaryDirectory() as tmp: + try: + rendermodels.convert(ROOT / "assets" / "controllers", Path(tmp)) + except rendermodels.ConversionError as e: + sys.exit(f"The controller models can't be converted: {e}") + return {p.relative_to(tmp).as_posix(): p.read_bytes() for p in sorted(Path(tmp).rglob("*")) if p.is_file()} + + def write_folder(out: Path, files: dict[str, tuple[bytes, int]]) -> None: """The archive's folder, unpacked: what the Windows installer installs.""" if out.exists() and any(out.iterdir()): diff --git a/scripts/ci/test-install.sh b/scripts/ci/test-install.sh index ee833aa8..2bc912f7 100755 --- a/scripts/ci/test-install.sh +++ b/scripts/ci/test-install.sh @@ -1,13 +1,14 @@ #!/bin/sh # Tries the Linux archive's install.sh on a scratch home folder: install, switch both ways, keep the owner's files, -# uninstall, and the paths file's other keys kept throughout. No network, no Steam. +# uninstall (moving the owner's files aside), dated backups, a read-only paths file refused, and the paths file's other +# keys kept throughout. No network, no Steam. # # scripts/ci/test-install.sh dist/OpenLamina-Linux.tar.gz set -eu archive=$(cd "$(dirname "$1")" && pwd)/$(basename "$1") work=$(mktemp -d) -trap 'rm -rf "$work"' EXIT +trap 'chmod -R u+w "$work" 2>/dev/null; rm -rf "$work"' EXIT fail() { echo "test-install.sh: $*" >&2 exit 1 @@ -56,13 +57,20 @@ $1" } sh "$installer" >"$work/log" || fail "install failed: $(cat "$work/log")" -for file in bin/linux64/vrclient.so bin/vrclient.so bin/version.txt SOURCE.txt install.sh LICENSE.txt; do +for file in bin/linux64/vrclient.so bin/vrclient.so bin/version.txt SOURCE.txt install.sh LICENSE.txt LICENSE_webxr-input-profiles.txt bin/rendermodels/valve-index/valve-index-left.json; do [ -f "$copy/$file" ] || fail "the install has no $file." done expect "$copy $steamvr /opt/other-runtime" "install" -cmp -s "$paths.bak" "$work/original" || fail "openvrpaths.vrpath.bak isn't the file as it was." +set -- "$paths".*.bak +if [ $# != 1 ] || ! cmp -s "$1" "$work/original"; then + fail "the dated backup of openvrpaths.vrpath isn't the file as it was." +fi +case $(cat "$work/log") in +*"PRESSURE_VESSEL_IMPORT_OPENXR_1_RUNTIMES=1 %command%"* | *"No active OpenXR runtime found"*) ;; +*) fail "install printed no launch options: $(cat "$work/log")" ;; +esac status=$(sh "$copy/install.sh" --status) case $status in @@ -79,6 +87,27 @@ sh "$installer" --no-switch >/dev/null sh "$copy/install.sh" --steamvr >/dev/null expect "$steamvr /opt/other-runtime" "--steamvr" +set -- "$paths".*.bak +[ $# = 2 ] || fail "--steamvr didn't make a second backup (or overwrote the first): $*" + +# A read-only paths file is refused, and left as it is (root can write to it all the same) +if [ "$(id -u)" != 0 ]; then + chmod a-w "$paths" + cp "$paths" "$work/read-only" + if sh "$copy/install.sh" --openlamina >"$work/log" 2>&1; then + fail "--openlamina changed a read-only paths file." + fi + grep -q "chmod u+w" "$work/log" || fail "the refusal doesn't say how to make the file writable: $(cat "$work/log")" + cmp -s "$paths" "$work/read-only" || fail "the read-only paths file changed." + chmod u+w "$paths" + # A read-only folder too: the message names the folder + chmod a-w "$(dirname "$paths")" + if sh "$copy/install.sh" --openlamina >"$work/log" 2>&1; then + fail "--openlamina changed the paths file in a read-only folder." + fi + grep -qF "make the folder writable" "$work/log" || fail "the refusal doesn't name the folder: $(cat "$work/log")" + chmod u+w "$(dirname "$paths")" +fi sh "$copy/install.sh" --openlamina >/dev/null expect "$copy @@ -94,5 +123,10 @@ sh "$copy/install.sh" --uninstall >/dev/null expect "$steamvr /opt/other-runtime" "--uninstall" [ ! -e "$copy" ] || fail "--uninstall left $copy." +set -- "$copy"-kept-* +if [ ! -f "$1/bin/openlamina.ini" ] || [ ! -f "$1/bin/opencomposite.ini" ]; then + fail "--uninstall didn't keep the files put in bin/." +fi +[ ! -e "$1/bin/linux64/vrclient.so" ] || fail "--uninstall kept its own library with the owner's files." echo "install.sh: install, status, reinstall, --steamvr, --openlamina and --uninstall work." diff --git a/scripts/fatal_sites.txt b/scripts/fatal_sites.txt index fa027825..d42734ee 100644 --- a/scripts/fatal_sites.txt +++ b/scripts/fatal_sites.txt @@ -3,3 +3,4 @@ OpenOVR/logging.cpp|oovr_abort_raw_va|_Exit|1|the hard stop itself, which the macros above lead to: only reached from an allowed site OpenOVR/logging.cpp|oovr_abort_raw_va|abort|1|the hard stop itself, which the macros above lead to: only reached from an allowed site OpenOVR/logging.cpp|oovr_message_raw|MessageBoxA|1|OOVR_MESSAGE's box: shown only by the hard stop above (and debug_helper's GetStackWalk, which nothing calls) +OpenOVR/Misc/SharedStore.cpp|SharedStore::KillProcess|TerminateProcess|1|ends another OpenLamina program (ForceQuitProcess, a scene app ignoring a launch's quit), checked by its start time on the handle it ends; never this one diff --git a/scripts/openvr_inventory.py b/scripts/openvr_inventory.py index d0b7164c..03082cb7 100644 --- a/scripts/openvr_inventory.py +++ b/scripts/openvr_inventory.py @@ -2,9 +2,16 @@ """Inventory of the OpenVR interface versions Valve has shipped, against the ones OpenLamina offers. openvr_inventory.py --valve-repo --write tests/conformance/interfaces.txt + openvr_inventory.py --valve-repo --compare tests/conformance/interfaces.txt # fails on anything new openvr_inventory.py --check # every listed version is offered (a GEN_INTERFACE line) or in not_implemented.txt + openvr_inventory.py --write-how-real tests/conformance/how_real.txt openvr_inventory.py --self-test +--write-how-real writes, per interface (its OpenOVR/Reimpl/Base*.cpp), how many of the methods defined there answer +OC_UNSUPPORTED always or in some cases, or only log and return (a logged no-op), against all of them; and the +interfaces of OpenVRHeaders/custom_interfaces with why each is there (custom_interfaces.txt's reasons). --check also +checks that file is what --write-how-real would write. + A blobless clone is enough: git clone --filter=blob:none --no-checkout https://github.com/ValveSoftware/openvr.git Every tag's headers/openvr.h gives the app-facing versions ("app"); a version found only in headers/openvr_capi.h is reachable only through the C API ("capi"); one found only in headers/openvr_driver.h is a driver interface and left out. @@ -80,6 +87,32 @@ def write(repo, out): return inv +def compare(repo, path): + """What Valve's tags have that the listed file doesn't: a version it lacks, or one whose kind or tags changed (a + newer tag still shipping it). 1 if anything is new.""" + inv, commit, date = inventory(repo) + listed = {} + for line in Path(path).read_text(encoding="utf-8").splitlines(): + parts = line.split() + if parts and not line.startswith("#"): + listed[parts[0]] = parts[1:] + new = 0 + for v, (kind, first, last) in sorted(inv.items(), key=lambda i: version_key(i[0])): + if v not in listed: + print(f"new version: {v} {kind} {first} {last}") + new += 1 + elif listed[v] != [kind, first, last]: + print(f"changed: {v} {' '.join(listed[v])} -> {kind} {first} {last}") + new += 1 + for v in sorted(set(listed) - set(inv), key=version_key): + print(f"listed but not in Valve's tags: {v}") + print(f"{len(inv)} versions in Valve's tags at {commit} ({date}), {len(listed)} listed; {new} new or changed") + if new: + print(f"Update the list: openvr_inventory.py --valve-repo --write {path}, then offer each new version " + "or set it aside in not_implemented.txt") + return 1 if new else 0 + + def read_listed(path): listed = {} for line in Path(path).read_text(encoding="utf-8").splitlines(): @@ -107,7 +140,146 @@ def check(root): for v in missing: print(f"not offered: {v} ({listed[v]})") print(f"{len(listed)} listed, {len(listed) - len(missing)} offered or set aside, {len(missing)} missing") - return 1 if missing else 0 + stale = False + how_real_txt = root / "tests" / "conformance" / "how_real.txt" + if not how_real_txt.exists() or how_real_txt.read_text(encoding="utf-8").replace("\r\n", "\n") != format_how_real(root): + print(f"{how_real_txt.relative_to(root)} is out of date: scripts/openvr_inventory.py --write-how-real {how_real_txt.relative_to(root).as_posix()}") + stale = True + return 1 if missing or stale else 0 + + +METHOD_RE = re.compile(r'^[A-Za-z_][\w:<>,\s\*&]*?\b(Base\w+)::(~?\w+)\s*\(', re.M) +# Headers in OpenVRHeaders/custom_interfaces that conformance doesn't call (not in custom_interfaces.txt), and why +# each is there +HEADER_ONLY_REASONS = { + "IVRClientCore_002": "IVRClientCore's old versions, which openvr_api.dll asks vrclient for: Valve never published them", + "IVRClientCore_003": "IVRClientCore's old versions, which openvr_api.dll asks vrclient for: Valve never published them", + "IVRCompositor_017": "used by The Lab, never published by Valve: 018 without its grid fade methods", +} + + +def strip_code(text): + """C++ with comments, string and character literals blanked out (lengths kept).""" + out = [] + i, n = 0, len(text) + while i < n: + c = text[i] + if text.startswith("//", i): + j = text.find("\n", i) + j = n if j < 0 else j + out.append(" " * (j - i)) + i = j + elif text.startswith("/*", i): + j = text.find("*/", i + 2) + j = n if j < 0 else j + 2 + out.append(re.sub(r"[^\n]", " ", text[i:j])) + i = j + elif c in "\"'": + j = i + 1 + while j < n and text[j] != c: + j += 2 if text[j] == "\\" else 1 + out.append(c + " " * (min(j, n) - i - 1) + (c if j < n else "")) + i = j + 1 + else: + out.append(c) + i += 1 + return "".join(out) + + +def method_bodies(text): + """[(class, method, body)] of the methods defined at the top level of a Base*.cpp, bodies with comments and + literals blanked.""" + code = strip_code(text) + found = [] + for m in METHOD_RE.finditer(code): + # The parameter list, then the body's braces + depth, i = 0, m.end() - 1 + while i < len(code): + if code[i] == "(": + depth += 1 + elif code[i] == ")": + depth -= 1 + if depth == 0: + break + i += 1 + j = i + 1 + while j < len(code) and code[j] not in "{;": + j += 1 + if j >= len(code) or code[j] != "{": + continue # a declaration, not a definition + depth, k = 0, j + while k < len(code): + if code[k] == "{": + depth += 1 + elif code[k] == "}": + depth -= 1 + if depth == 0: + break + k += 1 + found.append((m.group(1), m.group(2), code[j + 1:k])) + return found + + +def how_real_kind(body): + """'unsupported' (OC_UNSUPPORTED first thing), 'partly' (in some cases), 'noop' (only logs and returns) or 'real'.""" + statements = [st.strip() for st in re.split(r";", body) if st.strip()] + if statements and re.match(r"OC_UNSUPPORTED(_VOID)?\s*\(", statements[0]): + return "unsupported" + if re.search(r"\bOC_UNSUPPORTED(_VOID)?\s*\(", body): + return "partly" + logs = [st for st in statements if re.match(r"OOVR_LOG\w*\s*\(", st)] + others = [st for st in statements if st not in logs and not re.match(r"return\b", st)] + if logs and not others and "{" not in body: + return "noop" + return "real" + + +def how_real(root): + """{class: {kind: count}} of OpenOVR/Reimpl/Base*.cpp, leaving out constructors, destructors and OpenLamina's own + _ methods.""" + table = {} + for cpp in sorted((root / "OpenOVR" / "Reimpl").glob("Base*.cpp")): + for cls, method, body in method_bodies(cpp.read_text(encoding="utf-8", errors="replace")): + if method.startswith("~") or method == cls or method.startswith("_") or not cpp.stem == cls: + continue + counts = table.setdefault(cls, {"methods": 0, "unsupported": 0, "partly": 0, "noop": 0}) + counts["methods"] += 1 + kind = how_real_kind(body) + if kind != "real": + counts[kind] += 1 + return table + + +def custom_interfaces(root): + """[(version, reason)] of the headers in OpenVRHeaders/custom_interfaces.""" + reasons = {} + for line in (root / "tests" / "conformance" / "custom_interfaces.txt").read_text(encoding="utf-8").splitlines(): + parts = line.split(None, 1) + if parts and not line.startswith("#"): + reasons[parts[0]] = parts[1].strip() if len(parts) > 1 else "" + out = [] + for h in sorted((root / "OpenVRHeaders" / "custom_interfaces").glob("IVR*.h"), key=lambda p: version_key(p.stem)): + out.append((h.stem, reasons.get(h.stem) or HEADER_ONLY_REASONS.get(h.stem, ""))) + return out + + +def format_how_real(root): + lines = ["# How real each interface is: generated by scripts/openvr_inventory.py --write-how-real. Per OpenOVR/Reimpl/Base*.cpp,", + "# the methods defined there (not constructors or OpenLamina's own _ methods); those answering OC_UNSUPPORTED", + "# always, or in some cases; those that only log and return (logged no-ops); and the share that is neither.", + "# interface methods unsupported partly no-op real%"] + total = {"methods": 0, "unsupported": 0, "partly": 0, "noop": 0} + for cls, c in sorted(how_real(root).items()): + for k in total: + total[k] += c[k] + real = 100 * (c["methods"] - c["unsupported"] - c["noop"]) // max(c["methods"], 1) + lines.append(f'{cls[4:]} {c["methods"]} {c["unsupported"]} {c["partly"]} {c["noop"]} {real}') + real = 100 * (total["methods"] - total["unsupported"] - total["noop"]) // max(total["methods"], 1) + lines.append(f'all {total["methods"]} {total["unsupported"]} {total["partly"]} {total["noop"]} {real}') + lines += ["", "# Interface versions of OpenLamina's own (OpenVRHeaders/custom_interfaces), and why each is there"] + for version, reason in custom_interfaces(root): + lines.append(f"{version} {reason}".rstrip()) + return "\n".join(lines) + "\n" def self_test(): @@ -141,15 +313,37 @@ def commit(tag, openvr, capi, driver, when): print(" got: ", got) print(" want:", want) return 1 - print("self-test passed") - return 0 + # The kinds of method body + cpp = """int BaseFoo::Gone() { OC_UNSUPPORTED(0, "no"); } +void BaseFoo::Half(int a) +{ + if (a) // "{" in a comment + OC_UNSUPPORTED_VOID("not that"); + Do(a); +} +bool BaseFoo::Quiet() { OOVR_LOG_ONCE("No implementation"); return false; } +float BaseFoo::Real() const { return 1.0f; } +BaseFoo::BaseFoo() { OC_UNSUPPORTED_VOID("a constructor isn't a method"); } +void BaseFoo::_Own() { } +""" + got = [(m, how_real_kind(b)) for _, m, b in method_bodies(cpp)] + want = [("Gone", "unsupported"), ("Half", "partly"), ("Quiet", "noop"), ("Real", "real"), ("_Own", "real")] + if got != want: + print("self-test FAILED") + print(" got: ", got) + print(" want:", want) + return 1 + print("self-test passed") + return 0 def main(): ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument("--valve-repo") ap.add_argument("--write") + ap.add_argument("--compare", help="the list to compare Valve's tags with (interfaces.txt): fails on anything new") ap.add_argument("--check", action="store_true") + ap.add_argument("--write-how-real", metavar="FILE") ap.add_argument("--self-test", action="store_true") args = ap.parse_args() if args.self_test: @@ -160,9 +354,16 @@ def main(): inv = write(args.valve_repo, args.write) kinds = [k for k, _, _ in inv.values()] print(f"wrote {args.write}: {kinds.count('app')} app, {kinds.count('capi')} capi") + if args.write_how_real: + Path(args.write_how_real).write_text(format_how_real(ROOT), encoding="utf-8", newline="\n") + print(f"wrote {args.write_how_real}") + if args.compare: + if not args.valve_repo: + ap.error("--compare needs --valve-repo") + return compare(args.valve_repo, args.compare) if args.check: return check(ROOT) - if not (args.write or args.check): + if not (args.write or args.check or args.write_how_real): ap.print_help() return 0 diff --git a/scripts/rendermodels.py b/scripts/rendermodels.py new file mode 100644 index 00000000..1c7478ff --- /dev/null +++ b/scripts/rendermodels.py @@ -0,0 +1,891 @@ +#!/usr/bin/env python3 +"""Converts the controller models of the WebXR Input Profiles (assets/controllers) into SteamVR's render-model layout. + + scripts/rendermodels.py --assets assets/controllers --out DIR + +Each controller's GLB (a profile's left.glb and right.glb, or none.glb for both hands) becomes a folder +DIR/-/ of SteamVR's layout: -.json, whose "components" name the parts and how each moves, +an OBJ of each part, a material library and the base-colour textures. The positions are in the controller's grip space, +in metres; OpenLamina puts them in the device's space as it loads them. + +Every node's transform is baked into the parts' vertices, with the moving parts at rest (buttons up, sticks centred). +A part's motion comes from the WebXR profile's min and max nodes: a button's or trigger's as a rotation about a pivot or a +movement along an axis, a thumbstick's as SteamVR's "joystick", a touchpad's as "trackpad" with a "trackpad_touch" dot +shown while it's touched. Each motion is checked against the GLB's own poses half and fully pressed: no vertex may be +more than 0.5 mm off, or the conversion fails. + +Only the standard library is used: CMake runs it at build time. +""" + +import argparse +import json +import math +import struct +import sys +import zlib +from pathlib import Path + +TOLERANCE_M = 0.0005 + +# SteamVR's legacy button ids (EVRButtonId) and the axis of the legacy controller state each input is on +SYSTEM, MENU, GRIP, BUTTON_A = 0, 1, 2, 7 + +# WebXR component -> (SteamVR component, legacy button, legacy axis). The legacy inputs are those OpenLamina's built-in +# legacy bindings give the controller type (Misc/Input/Bindings/LegacyBindings.cpp). +OCULUS = { + "xr-standard-trigger": ("trigger", None, 1), + "xr-standard-squeeze": ("grip", GRIP, 2), + "xr-standard-thumbstick": ("thumbstick", None, 0), + "x-button": ("x_button", BUTTON_A, None), + "y-button": ("y_button", MENU, None), + "a-button": ("a_button", BUTTON_A, None), + "b-button": ("b_button", MENU, None), + "menu": ("system", SYSTEM, None), + "thumbrest": ("thumbrest", None, None), +} +KNUCKLES = { + "xr-standard-trigger": ("trigger", None, 1), + "xr-standard-squeeze": ("grip", GRIP, None), + # The trackpad shares axis 0 with the stick in the legacy state: it's left still, its touch dot hidden + "xr-standard-touchpad": ("trackpad", None, None), + "xr-standard-thumbstick": ("thumbstick", None, 0), + "a-button": ("button_a", GRIP, None), + "b-button": ("button_b", MENU, None), +} +VIVE = { + "xr-standard-trigger": ("trigger", None, 1), + "xr-standard-squeeze": ("grip", GRIP, None), + "xr-standard-touchpad": ("trackpad", None, 0), + "menu": ("button", MENU, None), +} +# The other controllers' legacy bindings: trackpad axis 0, trigger axis 1, stick axis 2, no A button +GENERIC = { + "xr-standard-trigger": ("trigger", None, 1), + "xr-standard-squeeze": ("grip", GRIP, None), + "xr-standard-touchpad": ("trackpad", None, 0), + "xr-standard-thumbstick": ("thumbstick", None, 2), + "x-button": ("x_button", None, None), + "y-button": ("y_button", None, None), + "a-button": ("a_button", None, None), + "b-button": ("b_button", None, None), + "menu": ("button", MENU, None), + "bumper": ("bumper", None, None), +} + +# The profiles converted, each with its component table +PROFILES = { + "oculus-touch-v3": OCULUS, + "meta-quest-touch-plus": OCULUS, + "meta-quest-touch-pro": OCULUS, + "valve-index": KNUCKLES, + "htc-vive": VIVE, + "microsoft-mixed-reality": GENERIC, + "hp-mixed-reality": GENERIC, + "htc-vive-cosmos": GENERIC, + "htc-vive-focus-3": GENERIC, + "pico-neo3": GENERIC, + "pico-4": GENERIC, + "generic-trigger-squeeze-thumbstick": GENERIC, +} + + +class ConversionError(Exception): + pass + + +# --- Maths: 4x4 matrices as row-major lists of 16, quaternions as (x, y, z, w) like glTF's --- + + +def mat_mul(a, b): + return [sum(a[r * 4 + k] * b[k * 4 + c] for k in range(4)) for r in range(4) for c in range(4)] + + +def mat_identity(): + return [1.0 if r == c else 0.0 for r in range(4) for c in range(4)] + + +def quat_matrix(q): + x, y, z, w = q + return [ + 1 - 2 * (y * y + z * z), 2 * (x * y - z * w), 2 * (x * z + y * w), + 2 * (x * y + z * w), 1 - 2 * (x * x + z * z), 2 * (y * z - x * w), + 2 * (x * z - y * w), 2 * (y * z + x * w), 1 - 2 * (x * x + y * y), + ] + + +def trs_matrix(t, q, s): + r = quat_matrix(q) + return [ + r[0] * s[0], r[1] * s[1], r[2] * s[2], t[0], + r[3] * s[0], r[4] * s[1], r[5] * s[2], t[1], + r[6] * s[0], r[7] * s[1], r[8] * s[2], t[2], + 0.0, 0.0, 0.0, 1.0, + ] + + +def apply(m, p): + return tuple(m[r * 4] * p[0] + m[r * 4 + 1] * p[1] + m[r * 4 + 2] * p[2] + m[r * 4 + 3] for r in range(3)) + + +def apply_dir(m, d): + return tuple(m[r * 4] * d[0] + m[r * 4 + 1] * d[1] + m[r * 4 + 2] * d[2] for r in range(3)) + + +def det3(m): + return (m[0] * (m[5] * m[10] - m[6] * m[9]) - m[1] * (m[4] * m[10] - m[6] * m[8]) + + m[2] * (m[4] * m[9] - m[5] * m[8])) + + +def normal_matrix(m): + """The inverse transpose of m's 3x3 part, as rows""" + a = [[m[r * 4 + c] for c in range(3)] for r in range(3)] + d = det3(m) + if abs(d) < 1e-20: + raise ConversionError("a node's transform collapses its mesh") + cof = [[(a[(r + 1) % 3][(c + 1) % 3] * a[(r + 2) % 3][(c + 2) % 3] + - a[(r + 1) % 3][(c + 2) % 3] * a[(r + 2) % 3][(c + 1) % 3]) / d for c in range(3)] for r in range(3)] + return cof # cofactor / det = inverse transpose + + +def mat_inverse_rigid(m): + """The inverse of a rotation and translation (scale divided out per column)""" + r = [[m[i * 4 + j] for j in range(3)] for i in range(3)] + rt = [[r[j][i] for j in range(3)] for i in range(3)] + t = [m[3], m[7], m[11]] + out = mat_identity() + for i in range(3): + for j in range(3): + out[i * 4 + j] = rt[i][j] + out[i * 4 + 3] = -sum(rt[i][k] * t[k] for k in range(3)) + return out + + +def rotation_part(m): + """m's rotation, its columns' scale divided out""" + cols = [[m[r * 4 + c] for r in range(3)] for c in range(3)] + lengths = [math.sqrt(sum(v * v for v in col)) for col in cols] + out = mat_identity() + for c in range(3): + for r in range(3): + out[r * 4 + c] = cols[c][r] / lengths[c] + return out + + +def sub(a, b): + return tuple(x - y for x, y in zip(a, b)) + + +def add(a, b): + return tuple(x + y for x, y in zip(a, b)) + + +def scale(a, s): + return tuple(x * s for x in a) + + +def dot(a, b): + return sum(x * y for x, y in zip(a, b)) + + +def cross(a, b): + return (a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]) + + +def length(a): + return math.sqrt(dot(a, a)) + + +def normalize(a): + n = length(a) + return scale(a, 1 / n) if n > 1e-12 else (0.0, 0.0, 0.0) + + +def quat_mul(a, b): + ax, ay, az, aw = a + bx, by, bz, bw = b + return (aw * bx + ax * bw + ay * bz - az * by, aw * by - ax * bz + ay * bw + az * bx, + aw * bz + ax * by - ay * bx + az * bw, aw * bw - ax * bx - ay * by - az * bz) + + +def quat_conj(q): + return (-q[0], -q[1], -q[2], q[3]) + + +def quat_normalize(q): + n = math.sqrt(sum(v * v for v in q)) + return tuple(v / n for v in q) + + +def slerp(a, b, t): + a, b = quat_normalize(a), quat_normalize(b) + d = sum(x * y for x, y in zip(a, b)) + if d < 0: + b, d = tuple(-v for v in b), -d + if d > 0.9995: + return quat_normalize(tuple(x + (y - x) * t for x, y in zip(a, b))) + theta = math.acos(min(1.0, d)) + s = math.sin(theta) + wa, wb = math.sin((1 - t) * theta) / s, math.sin(t * theta) / s + return tuple(wa * x + wb * y for x, y in zip(a, b)) + + +def axis_angle(q): + """A rotation as (unit axis, degrees from 0 to 180)""" + q = quat_normalize(q) + if q[3] < 0: + q = tuple(-v for v in q) + s = math.sqrt(max(0.0, 1 - q[3] * q[3])) + angle = math.degrees(2 * math.acos(min(1.0, q[3]))) + if s < 1e-9: + return (1.0, 0.0, 0.0), 0.0 + return (q[0] / s, q[1] / s, q[2] / s), angle + + +def matrix_quat(m): + """The rotation of a matrix (scale-free) as a quaternion""" + m00, m01, m02 = m[0], m[1], m[2] + m10, m11, m12 = m[4], m[5], m[6] + m20, m21, m22 = m[8], m[9], m[10] + tr = m00 + m11 + m22 + if tr > 0: + s = math.sqrt(tr + 1) * 2 + q = ((m21 - m12) / s, (m02 - m20) / s, (m10 - m01) / s, s / 4) + elif m00 > m11 and m00 > m22: + s = math.sqrt(1 + m00 - m11 - m22) * 2 + q = (s / 4, (m01 + m10) / s, (m02 + m20) / s, (m21 - m12) / s) + elif m11 > m22: + s = math.sqrt(1 + m11 - m00 - m22) * 2 + q = ((m01 + m10) / s, s / 4, (m12 + m21) / s, (m02 - m20) / s) + else: + s = math.sqrt(1 + m22 - m00 - m11) * 2 + q = ((m02 + m20) / s, (m12 + m21) / s, s / 4, (m10 - m01) / s) + return quat_normalize(q) + + +def angle_axis_quat(axis, degrees): + h = math.radians(degrees) / 2 + s = math.sin(h) + a = normalize(axis) + return (a[0] * s, a[1] * s, a[2] * s, math.cos(h)) + + +def quat_rotate(q, v): + p = quat_mul(quat_mul(q, (v[0], v[1], v[2], 0.0)), quat_conj(q)) + return p[:3] + + +def euler_xyz(degrees): + """SteamVR's rotate_xyz: about X, then Y, then Z""" + x, y, z = degrees + return quat_mul(quat_mul(angle_axis_quat((0, 0, 1), z), angle_axis_quat((0, 1, 0), y)), angle_axis_quat((1, 0, 0), x)) + + +def frame_euler(x_axis, y_axis, z_axis): + """rotate_xyz (degrees) of the frame whose axes are these (orthonormal, right-handed)""" + # R = Rz(c) Ry(b) Rx(a); its columns are the axes + r20, r21, r22 = x_axis[2], y_axis[2], z_axis[2] + r10, r00 = x_axis[1], x_axis[0] + b = math.asin(max(-1.0, min(1.0, -r20))) + a = math.atan2(r21, r22) + c = math.atan2(r10, r00) + return [math.degrees(a), math.degrees(b), math.degrees(c)] + + +# --- SteamVR's component motion (Misc/SteamVRRenderModels.cpp ComponentPose), for the self-check --- + + +def lerp(r, t): + return r[0] + (r[1] - r[0]) * t + + +def rigid_then(a, b): + """a after b; each (quat, translation)""" + return quat_mul(a[0], b[0]), add(quat_rotate(a[0], b[1]), a[1]) + + +def rotate_about(point, q): + return q, sub(point, quat_rotate(q, point)) + + +def component_pose(motion, value, axis): + kind = motion.get("type", "") + x, y = axis + ident = ((0.0, 0.0, 0.0, 1.0), (0.0, 0.0, 0.0)) + if kind == "rotate": + degrees = lerp(motion.get("value_mapping", [0, 0]), value) + return rotate_about(tuple(motion.get("pivot", [0, 0, 0])), angle_axis_quat(motion["axis"], degrees)) + if kind == "translate": + return (0.0, 0.0, 0.0, 1.0), scale(tuple(motion["axis"]), lerp(motion.get("value_mapping", [0, 0]), value)) + if kind in ("trackpad", "joystick"): + pad = kind == "trackpad" + frame = euler_xyz(motion.get("rotate_xyz", [0, 0, 0])) + about_z = lerp(motion.get("press_rotation_x" if pad else "joystick_rotation_x", [0, 0]), (x + 1) / 2) + about_x = lerp(motion.get("press_rotation_y" if pad else "joystick_rotation_y", [0, 0]), (y + 1) / 2) + if pad: + about_z *= value + about_x *= value + tilt = quat_mul(quat_mul(quat_mul(frame, angle_axis_quat((0, 0, 1), about_z)), angle_axis_quat((1, 0, 0), about_x)), + quat_conj(frame)) + r = rotate_about(tuple(motion.get("center", [0, 0, 0])), tilt) + move = scale(tuple(motion.get("press_translate", [0, 0, 0])), value) + if pad: + touch = (lerp(motion.get("touch_translate_x", [0, 0]), (x + 1) / 2), 0.0, + lerp(motion.get("touch_translate_y", [0, 0]), (y + 1) / 2)) + move = add(move, quat_rotate(frame, touch)) + return rigid_then(((0.0, 0.0, 0.0, 1.0), move), r) + return ident + + +# --- GLB reading --- + + +class Glb: + def __init__(self, path: Path): + data = path.read_bytes() + if len(data) < 20 or data[:4] != b"glTF": + raise ConversionError(f"{path} isn't a GLB file") + json_len, json_type = struct.unpack_from(" 1 else vals[0]) + return out + + def image(self, index): + img = self.json["images"][index] + if "bufferView" not in img: + raise ConversionError("an image outside the GLB isn't read") + data, _ = self.view(img["bufferView"]) + if data[:8] == b"\x89PNG\r\n\x1a\n": + return data, "png" + if data[:3] == b"\xff\xd8\xff": + return data, "jpg" + raise ConversionError("an image that's neither PNG nor JPEG") + + def local(self, i, override=None): + n = self.nodes[i] + if override is not None: + t, q = override + return trs_matrix(t, q, n.get("scale", [1, 1, 1])) + if "matrix" in n: + m = n["matrix"] # column-major + return [m[c * 4 + r] for r in range(4) for c in range(4)] + return trs_matrix(n.get("translation", [0, 0, 0]), n.get("rotation", [0, 0, 0, 1]), n.get("scale", [1, 1, 1])) + + def trs(self, i): + n = self.nodes[i] + if "matrix" in n: + m = self.local(i) + return (m[3], m[7], m[11]), matrix_quat(rotation_part(m)) + return tuple(n.get("translation", [0, 0, 0])), tuple(n.get("rotation", [0, 0, 0, 1])) + + def ancestors(self, i): + while i in self.parent: + i = self.parent[i] + yield i + + +# --- Conversion --- + + +class Response: + """A visual response: a value node and what drives it""" + + def __init__(self, glb, component, prop, resp): + self.component = component + self.prop = prop # button, xAxis, yAxis, state + self.kind = resp.get("valueNodeProperty", "transform") + self.value = node(glb, resp["valueNodeName"]) + self.states = resp.get("states", []) + self.min = node(glb, resp["minNodeName"]) if self.kind == "transform" else None + self.max = node(glb, resp["maxNodeName"]) if self.kind == "transform" else None + self.touched = "touched" in resp["valueNodeName"] + + def pose(self, glb, t): + (t0, q0), (t1, q1) = glb.trs(self.min), glb.trs(self.max) + return tuple(a + (b - a) * t for a, b in zip(t0, t1)), slerp(q0, q1, t) + + +def node(glb, name): + if name not in glb.by_name: + raise ConversionError(f"no node {name}") + return glb.by_name[name] + + +def rest_value(r): + return 0.0 if r.prop == "button" else 0.5 + + +def world_matrices(glb, overrides): + """Every node's world matrix, with the value nodes posed as overrides says""" + out = {} + + def world(i): + if i not in out: + local = glb.local(i, overrides.get(i)) + out[i] = mat_mul(world(glb.parent[i]), local) if i in glb.parent else local + return out[i] + + for i in range(len(glb.nodes)): + world(i) + return out + + +def poses(glb, responses, value_of): + return {r.value: r.pose(glb, value_of(r)) for r in responses if r.kind == "transform"} + + +def vec(v): + return [round(x, 6) + 0.0 for x in v] + + +def fit_button(glb, r, rest, maximum): + """A button's or trigger's one transform: a rotation about a pivot, or a movement along an axis""" + w0, w1 = rest[r.value], maximum[r.value] + d = mat_mul(rotation_part(w1), mat_inverse_rigid(rotation_part(w0))) + q = matrix_quat(d) + axis, angle = axis_angle(q) + o0, o1 = (w0[3], w0[7], w0[11]), (w1[3], w1[7], w1[11]) + if angle < 0.05: + return {"type": "translate", "axis": vec(sub(o1, o0)), "value_mapping": [0, 1]} + # The pivot: the point the change of pose keeps (nearest to it), on the plane through o0 across the axis + t = sub(o1, quat_rotate(q, o0)) + t_perp = sub(t, scale(axis, dot(t, axis))) + half = math.radians(angle) / 2 + pivot = scale(add(t_perp, scale(cross(axis, t_perp), 1 / math.tan(half))), 0.5) + return {"type": "rotate", "axis": vec(axis), "pivot": vec(pivot), "value_mapping": [0, round(angle, 4)]} + + +def stick_fit(glb, active, rest, parents_rest, kind, touch=None): + """A thumbstick's or touchpad's motion: its press, its tilts (x about the frame's Z, y about its X), and for a + touchpad's touch dot the touch point's movement across the frame's X and Z""" + by = {} + for r in active: + by.setdefault((r.prop, r.touched), r) + motion = {"type": kind} + press = by.get(("button", False)) + if press: + p = parents_rest[press.value] + (t0, q0), (t1, q1) = press.pose(glb, 0), press.pose(glb, 1) + _, angle = axis_angle(quat_mul(q1, quat_conj(q0))) + if angle > 0.05: + raise ConversionError(f"{press.component}: its press turns it, which SteamVR's {kind} can't") + motion["press_translate"] = vec(apply_dir(p, sub(t1, t0))) + tilts = {} + for prop in ("xAxis", "yAxis"): + r = by.get((prop, False)) + if not r: + continue + (_, q0), (_, q1) = r.pose(glb, 0), r.pose(glb, 1) + axis, angle = axis_angle(quat_mul(q1, quat_conj(q0))) + if angle < 0.05: + continue + p = parents_rest[r.value] + # An axis is turned as a rotation's, not a point's: through a mirroring parent it points the other way + world_axis = normalize(apply_dir(rotation_part(p), axis)) + if det3(p) < 0: + world_axis = scale(world_axis, -1) + centre = apply(rest[r.value], (0, 0, 0)) + tilts[prop] = (world_axis, angle, centre) + frame = None + if touch: + # The touch frame: the touched X node's parent, its X across the pad and its Z along it + p = rotation_part(parents_rest[touch[0].value]) + frame = (apply_dir(p, (1, 0, 0)), apply_dir(p, (0, 1, 0)), apply_dir(p, (0, 0, 1))) + elif tilts: + z = tilts["xAxis"][0] if "xAxis" in tilts else None + x = tilts["yAxis"][0] if "yAxis" in tilts else None + if z is None: + z = normalize(cross(x, (0, 1, 0) if abs(x[1]) < 0.9 else (1, 0, 0))) + if x is None: + x = normalize(cross((0, 1, 0) if abs(z[1]) < 0.9 else (1, 0, 0), z)) + x = normalize(sub(x, scale(z, dot(x, z)))) + frame = (x, cross(z, x), z) + if frame: + motion["rotate_xyz"] = [round(a, 4) for a in frame_euler(*frame)] + if tilts: + centre = tilts.get("xAxis", tilts.get("yAxis"))[2] + motion["center"] = vec(centre) + names = ("press_rotation_x", "press_rotation_y") if kind == "trackpad" else ("joystick_rotation_x", "joystick_rotation_y") + for prop, name, sign in (("xAxis", names[0], 1), ("yAxis", names[1], -1)): + if prop in tilts: + world_axis, angle, _ = tilts[prop] + about = frame[2] if prop == "xAxis" else frame[0] + s = 1 if dot(world_axis, about) >= 0 else -1 + # WebXR's x runs left to right as OpenVR's; its y runs forward to back, OpenVR's back to forward + h = round(s * angle / 2, 4) + motion[name] = [-h, h] if sign > 0 else [h, -h] + if touch: + tx, ty = touch + for r, name, along, flip in ((tx, "touch_translate_x", 0, False), (ty, "touch_translate_y", 2, True)): + if not r: + continue + (t0, _), (t1, _) = r.pose(glb, 0), r.pose(glb, 1) + mid = [(a + b) / 2 for a, b in zip(t0, t1)] + lo, hi = round(t0[along] - mid[along], 6), round(t1[along] - mid[along], 6) + motion[name] = [hi, lo] if flip else [lo, hi] + return motion + + +def touch_dot(centre, frame_y, frame_x): + """A touch dot: a flat disc 4 mm across the pad, a little above it, both sides""" + up = normalize(frame_y) + ax = normalize(frame_x) + az = cross(ax, up) + c = add(centre, scale(up, 0.0005)) + ring = [add(c, add(scale(ax, 0.004 * math.cos(a)), scale(az, 0.004 * math.sin(a)))) + for a in (2 * math.pi * k / 16 for k in range(16))] + verts, tris = [], [] + for side, n in ((1, up), (-1, scale(up, -1))): + base = len(verts) + verts.append((c, n, (0.5, 0.5))) + for p in ring: + verts.append((p, n, (0.5, 0.5))) + for k in range(16): + a, b = base + 1 + k, base + 1 + (k + 1) % 16 + tris.append((base, b, a) if side > 0 else (base, a, b)) + return verts, tris + + +def png_bytes(width, height, rgba_rows): + raw = b"".join(b"\x00" + bytes(row) for row in rgba_rows) + + def chunk(kind, data): + return struct.pack(">I", len(data)) + kind + data + struct.pack(">I", zlib.crc32(kind + data) & 0xFFFFFFFF) + + return (b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", width, height, 8, 6, 0, 0, 0)) + + chunk(b"IDAT", zlib.compress(raw, 0)) + chunk(b"IEND", b"")) + + +def srgb(c): + c = max(0.0, min(1.0, c)) + return round(255 * (12.92 * c if c <= 0.0031308 else 1.055 * c ** (1 / 2.4) - 0.055)) + + +def fmt(v, places=6): + s = f"{v:.{places}f}" + return "0" if s.strip("-0.") == "" else s.rstrip("0").rstrip(".") + + +def obj_text(mtllib, groups): + """groups: [(material name, vertices [(pos, normal, uv)], triangles)]. Positions to 10 um, each distinct position, + UV and normal written once.""" + lines = [f"mtllib {mtllib}"] + seen = [{}, {}, {}] # text -> its index, for v, vt, vn + + def index(kind, text): + table = seen[kind] + if text not in table: + table[text] = len(table) + 1 + lines.append(("v ", "vt ", "vn ")[kind] + text) + return table[text] + + for material, verts, tris in groups: + corners = [] + for p, n, uv in verts: + # OBJ's v counts from the texture's bottom row, glTF's from its top + corners.append((index(0, " ".join(fmt(x, 5) for x in p)), index(1, f"{fmt(uv[0], 5)} {fmt(1 - uv[1], 5)}"), + index(2, " ".join(fmt(x, 3) for x in n)))) + lines.append(f"usemtl {material}") + for tri in tris: + lines.append("f " + " ".join("%d/%d/%d" % corners[i] for i in tri)) + return "\n".join(lines) + "\n" + + +def convert_layout(glb_path: Path, layout: dict, table: dict, name: str, files: dict): + """One hand's model into files (name -> bytes); the worst distance off the max pose""" + glb = Glb(glb_path) + responses = [] + for cid, comp in layout["components"].items(): + if cid not in table: + raise ConversionError(f"{name}: component {cid} isn't in its table") + for resp in comp["visualResponses"].values(): + # A response whose nodes the model hasn't (a part that's in the body) is left out, as WebXR's library does + names = [resp["valueNodeName"]] + ([resp["minNodeName"], resp["maxNodeName"]] + if resp.get("valueNodeProperty", "transform") == "transform" else []) + if all(n in glb.by_name for n in names): + responses.append(Response(glb, cid, resp["componentProperty"], resp)) + value_nodes = {r.value: r for r in responses} + + rest_overrides = poses(glb, responses, rest_value) + max_overrides = poses(glb, responses, lambda r: 1.0) + rest = world_matrices(glb, rest_overrides) + maximum = world_matrices(glb, max_overrides) + parents_rest = {i: (rest[glb.parent[i]] if i in glb.parent else mat_identity()) for i in range(len(glb.nodes))} + + # Each mesh node's component, by its nearest value node; and whether it's in a touchpad's touch dot + parts = {} # SteamVR name -> {"webxr", "meshes": [node], "touch": bool} + for i, n in enumerate(glb.nodes): + if "mesh" not in n: + continue + owner = None + touch = False + for a in [i, *glb.ancestors(i)]: + r = value_nodes.get(a) + if r is None: + continue + if r.touched or r.kind == "visibility": + touch = True + owner = r.component + break + if owner is None: + key, webxr = "body", None + else: + key, webxr = table[owner][0] + ("_touch" if touch else ""), owner + parts.setdefault(key, {"webxr": webxr, "meshes": [], "touch": touch})["meshes"].append(i) + + # Touchpads without a touch dot of their own get one + for cid, comp in layout["components"].items(): + if comp["type"] != "touchpad": + continue + key = table[cid][0] + "_touch" + if key not in parts: + parts[key] = {"webxr": cid, "meshes": [], "touch": True} + + # Textures: each material's base colour, else a 2x2 of its colour + materials = glb.json.get("materials", [{}]) + textures = {} # material index -> file name + mtl_lines = [] + for mi, mat in enumerate(materials): + pbr = mat.get("pbrMetallicRoughness", {}) + tex = pbr.get("baseColorTexture") + if tex is not None: + if tex.get("texCoord", 0) != 0: + raise ConversionError(f"{name}: a material's texture uses a second set of UVs") + data, ext = glb.image(glb.json["textures"][tex["index"]]["source"]) + file = f"texture_{mi}.{ext}" + else: + colour = pbr.get("baseColorFactor", [1, 1, 1, 1]) + px = [srgb(colour[0]), srgb(colour[1]), srgb(colour[2]), 255] + data, file = png_bytes(2, 2, [px * 2, px * 2]), f"texture_{mi}.png" + files[file] = data + textures[mi] = file + mtl_lines += [f"newmtl m{mi}", f"map_Kd {file}", ""] + dot_file = "touch.png" + needs_dot = any(not p["meshes"] for p in parts.values()) + if needs_dot: + px = [200, 230, 255, 255] + files[dot_file] = png_bytes(2, 2, [px * 2, px * 2]) + mtl_lines += ["newmtl touch", f"map_Kd {dot_file}", ""] + mtl = "materials.mtl" + files[mtl] = "\n".join(mtl_lines).encode() + + def mesh_groups(meshes, worlds): + groups = [] + for i in meshes: + m = worlds[i] + nm = normal_matrix(m) + flip = det3(m) < 0 + for prim in glb.json["meshes"][glb.nodes[i]["mesh"]]["primitives"]: + if prim.get("mode", 4) != 4: + raise ConversionError(f"{name}: a mesh that isn't triangles") + attrs = prim["attributes"] + pos = glb.accessor(attrs["POSITION"]) + nor = glb.accessor(attrs["NORMAL"]) if "NORMAL" in attrs else [(0, 1, 0)] * len(pos) + uvs = glb.accessor(attrs["TEXCOORD_0"]) if "TEXCOORD_0" in attrs else [(0, 0)] * len(pos) + idx = glb.accessor(prim["indices"]) if "indices" in prim else list(range(len(pos))) + verts = [] + for p, n, uv in zip(pos, nor, uvs): + wn = normalize(tuple(sum(nm[r][c] * n[c] for c in range(3)) for r in range(3))) + verts.append((apply(m, p), wn, uv)) + tris = [tuple(idx[k:k + 3]) for k in range(0, len(idx) - 2, 3)] + if flip: + tris = [(a, c, b) for a, b, c in tris] + groups.append((f"m{prim.get('material', 0)}", verts, tris)) + return groups + + components = {} + worst = 0.0 + for key in sorted(parts): + part = parts[key] + webxr = part["webxr"] + entry = {} + groups = mesh_groups(part["meshes"], rest) + dot_point = None # the node a generated touch dot is at + if webxr is not None: + _, button, axis = table[webxr] + ctype = layout["components"][webxr]["type"] + mine = [r for r in responses if r.component == webxr] + meshes = part["meshes"] + active = [r for r in mine if r.kind == "transform" + and any(r.value == a for m in meshes for a in [m, *glb.ancestors(m)])] + touch_x = next((r for r in mine if r.touched and r.prop == "xAxis" and r.kind == "transform"), None) + touch_y = next((r for r in mine if r.touched and r.prop == "yAxis" and r.kind == "transform"), None) + if part["touch"]: + if not touch_x or not touch_y: + raise ConversionError(f"{name}: {webxr} has no touch point to move a dot with") + # The dot moves with the pad's press and with the touch point + pad = [r for r in mine if r.kind == "transform" and not r.touched + and any(r.value == a for a in glb.ancestors(touch_x.value))] + active = pad + [touch_x, touch_y] + motion = stick_fit(glb, pad, rest, parents_rest, "trackpad", (touch_x, touch_y)) + entry["visibility"] = {"default": False, "touch": True, "press": True} + if not groups: + vis = next((r for r in mine if r.kind == "visibility"), None) + point = dot_point = vis.value if vis else touch_y.value + frame = rotation_part(parents_rest[touch_x.value]) + verts, tris = touch_dot(apply(rest[point], (0, 0, 0)), apply_dir(frame, (0, 1, 0)), + apply_dir(frame, (1, 0, 0))) + groups = [("touch", verts, tris)] + elif ctype == "thumbstick": + motion = stick_fit(glb, active, rest, parents_rest, "joystick") + elif ctype == "touchpad": + motion = stick_fit(glb, active, rest, parents_rest, "trackpad") + else: + if len(active) > 1: + raise ConversionError(f"{name}: {webxr} moves by more than one response") + motion = fit_button(glb, active[0], rest, maximum) if active else None + if motion: + if axis is not None: + motion["controller_axis"] = axis + if button is not None: + motion["controller_button"] = button + entry["motion"] = motion + # The self-check: SteamVR's motion half and fully pressed (x right, y back) against the GLB posed so + for f in (0.5, 1.0) if part["meshes"] or dot_point is not None else (): + q, t = component_pose(motion, f, (f, -f)) + full = dict(rest_overrides) + full.update({r.value: r.pose(glb, f if r.prop == "button" else (1 + f) / 2) for r in active}) + posed = world_matrices(glb, full) + if dot_point is None: + want = mesh_groups(part["meshes"], posed) + pairs = [(p, target) for (_, v0, _), (_, v1, _) in zip(groups, want) + for (p, _, _), (target, _, _) in zip(v0, v1)] + else: + # A generated dot: its centre against the touch point + pairs = [(apply(rest[dot_point], (0, 0, 0)), apply(posed[dot_point], (0, 0, 0)))] + for p, target in pairs: + off = length(sub(add(quat_rotate(q, p), t), target)) + worst = max(worst, off) + if off > TOLERANCE_M: + raise ConversionError( + f"{name}: {key}'s motion is {off * 1000:.2f} mm off the model's pose at {f}") + if not groups: + continue + if sum(len(v) for _, v, _ in groups) > 65535: + raise ConversionError(f"{name}: {key} has more vertices than a render model's 65535") + obj = f"{key}.obj" + files[obj] = obj_text(mtl, groups).encode() + entry["filename"] = obj + components[key] = entry + + files[f"{name}.json"] = (json.dumps({"components": components}, indent=1, sort_keys=True) + "\n").encode() + return worst + + +def merge_hands(hands: dict) -> dict: + """Both hands' files as one folder's: a file the same for both keeps its name, one that differs gets the hand's + "_" in front, and the names in the files that refer to it are changed to match""" + out = {} + renamed = {hand: {} for hand in hands} + # Textures first, then the material libraries naming them, the OBJs naming those, the JSON naming the OBJs + order = lambda f: (f.endswith(".json"), f.endswith(".obj"), f.endswith(".mtl"), f) + names = sorted({f for files in hands.values() for f in files}, key=order) + for f in names: + contents = {} + for hand, files in hands.items(): + if f not in files: + continue + data = files[f] + for old, new in sorted(renamed[hand].items(), key=lambda kv: -len(kv[0])): + if f.endswith((".mtl", ".obj")): + data = data.replace(f"map_Kd {old}\n".encode(), f"map_Kd {new}\n".encode()) + data = data.replace(f"mtllib {old}\n".encode(), f"mtllib {new}\n".encode()) + elif f.endswith(".json"): + data = data.replace(f'"filename": "{old}"'.encode(), f'"filename": "{new}"'.encode()) + contents[hand] = data + if len(set(contents.values())) == 1: + out[f] = next(iter(contents.values())) + else: + for hand, data in contents.items(): + name = f if f.endswith(".json") else f"{hand}_{f}" + renamed[hand][f] = name + out[name] = data + return out + + +def convert(assets: Path, out: Path) -> list[str]: + """Every profile's models into out//: -left.json and -right.json, and their files""" + report = [] + for profile_id, table in PROFILES.items(): + folder = assets / profile_id + profile = json.loads((folder / "profile.json").read_text(encoding="utf-8")) + layouts = profile["layouts"] + hands = {} + for hand in ("left", "right"): + layout = layouts.get(hand) or layouts.get("left-right") or layouts.get("none") or layouts.get("left-right-none") + if layout is None: + raise ConversionError(f"{profile_id}: no layout for the {hand} hand") + name = f"{profile_id}-{hand}" + hands[hand] = {} + try: + worst = convert_layout(folder / layout["assetPath"], layout, table, name, hands[hand]) + except ConversionError as e: + raise ConversionError(f"{profile_id} ({hand}): {e}") from e + report.append(f"{name}: within {worst * 1000:.3f} mm of the model's poses") + target = out / profile_id + target.mkdir(parents=True, exist_ok=True) + files = merge_hands(hands) + for old in target.iterdir(): + if old.name not in files: + old.unlink() + for f, data in files.items(): + path = target / f + if not path.is_file() or path.read_bytes() != data: + path.write_bytes(data) + return report + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("--assets", type=Path, required=True) + parser.add_argument("--out", type=Path, required=True) + parser.add_argument("--quiet", action="store_true") + args = parser.parse_args() + try: + report = convert(args.assets, args.out) + except (ConversionError, OSError, KeyError, ValueError) as e: + sys.exit(f"rendermodels.py: {e}") + if not args.quiet: + print("\n".join(report)) + + +if __name__ == "__main__": + main() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 161ac3a4..b4dacbb6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -36,7 +36,7 @@ target_include_directories(oc_callers PUBLIC ${CMAKE_SOURCE_DIR}/OpenVRHeaders ${CMAKE_BINARY_DIR} ) -target_link_libraries(oc_callers PUBLIC jsoncpp) +target_link_libraries(oc_callers PUBLIC ${jsoncppLib}) if (WIN32) target_link_libraries(oc_callers PUBLIC d3d11) # The generated file is one large translation unit @@ -56,6 +56,7 @@ add_executable(oc_conformance conformance/gfx_cases.cpp conformance/helper_cases.cpp conformance/coverage_cases.cpp + conformance/steamvr_run_cases.cpp conformance/gfx/GfxApi.h conformance/crash_report.cpp ) @@ -134,6 +135,7 @@ add_executable(oc_unit_tests unit/KeyboardTests.cpp unit/RenderModelTests.cpp unit/HmdTests.cpp + unit/SessionLifecycleTests.cpp unit/DeviceSlotsTests.cpp unit/EntryPointsTests.cpp unit/BaseMailboxTests.cpp @@ -167,6 +169,9 @@ target_compile_definitions(oc_unit_tests PRIVATE ${GRAPHICS_API_SUPPORT_FLAGS} D OC_TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/unit/data" OC_ECHO_APP="$") # The program the launch test starts add_dependencies(oc_unit_tests oc_echo_app) +# The controller models the render model tests read +add_dependencies(oc_unit_tests OCRenderModels) +target_compile_definitions(oc_unit_tests PRIVATE OC_TEST_RENDERMODELS="${OC_RENDERMODELS_DIR}") if (NOT WIN32) # The runtime library the entry point tests load add_dependencies(oc_unit_tests OCOVR) @@ -179,5 +184,9 @@ else () endif () add_test(NAME unit COMMAND oc_unit_tests) set_tests_properties(unit PROPERTIES LABELS unit) +if (NOT WIN32) + # An empty config folder of its own, so the user's own openlamina.ini (~/.config/openlamina) isn't read + set_tests_properties(unit PROPERTIES ENVIRONMENT XDG_CONFIG_HOME=${CMAKE_CURRENT_BINARY_DIR}/unit_config) +endif () add_subdirectory(runtime) diff --git a/tests/PngWriter.h b/tests/PngWriter.h index a14a66f1..cfe94734 100644 --- a/tests/PngWriter.h +++ b/tests/PngWriter.h @@ -19,57 +19,73 @@ inline uint32_t Crc(const uint8_t* data, size_t size, uint32_t crc = 0xffffffffu return crc; } -inline void Put32(std::vector& out, uint32_t v) +// Each buffer is sized first and written at offsets: GCC's -Wstringop-overflow takes growing vectors for overflows +// when the standard library's assertions are on (-D_GLIBCXX_ASSERTIONS) +inline void Set32(uint8_t* at, uint32_t v) { - for (int s = 24; s >= 0; s -= 8) - out.push_back((uint8_t)(v >> s)); + at[0] = (uint8_t)(v >> 24); + at[1] = (uint8_t)(v >> 16); + at[2] = (uint8_t)(v >> 8); + at[3] = (uint8_t)v; } -inline void Chunk(std::vector& out, const char* type, const std::vector& data) +// Appends a chunk (length, type, data, CRC) to out +inline void Chunk(std::vector& out, const char* type, const uint8_t* data, size_t size) { - Put32(out, (uint32_t)data.size()); size_t start = out.size(); - out.insert(out.end(), type, type + 4); - out.insert(out.end(), data.begin(), data.end()); - Put32(out, Crc(&out[start], out.size() - start) ^ 0xffffffffu); + out.resize(start + 12 + size); + uint8_t* p = out.data() + start; + Set32(p, (uint32_t)size); + memcpy(p + 4, type, 4); + if (size) + memcpy(p + 8, data, size); + Set32(p + 8 + size, Crc(p + 4, 4 + size) ^ 0xffffffffu); } inline std::vector Encode(const uint8_t* rgba, uint32_t width, uint32_t height) { - std::vector raw; + const size_t row = (size_t)width * 4; + std::vector raw((row + 1) * height); for (uint32_t y = 0; y < height; y++) { - raw.push_back(0); // no filter - raw.insert(raw.end(), rgba + (size_t)y * width * 4, rgba + (size_t)(y + 1) * width * 4); + raw[y * (row + 1)] = 0; // no filter + if (row) + memcpy(raw.data() + y * (row + 1) + 1, rgba + y * row, row); } - std::vector z = { 0x78, 0x01 }; - for (size_t at = 0; at < raw.size() || at == 0;) { + // Stored blocks of at most 65535 bytes (one, empty, for no data), then the Adler-32 + const size_t blocks = std::max(1, (raw.size() + 65534) / 65535); + std::vector z(2 + blocks * 5 + raw.size() + 4); + z[0] = 0x78; + z[1] = 0x01; + size_t w = 2; + for (size_t at = 0, i = 0; i < blocks; i++) { size_t n = std::min(65535, raw.size() - at); - bool last = at + n >= raw.size(); - z.push_back(last ? 1 : 0); - z.push_back((uint8_t)n); - z.push_back((uint8_t)(n >> 8)); - z.push_back((uint8_t)~n); - z.push_back((uint8_t)(~n >> 8)); - z.insert(z.end(), raw.begin() + at, raw.begin() + at + n); + z[w++] = i + 1 == blocks ? 1 : 0; + z[w++] = (uint8_t)n; + z[w++] = (uint8_t)(n >> 8); + z[w++] = (uint8_t)~n; + z[w++] = (uint8_t)(~n >> 8); + if (n) + memcpy(z.data() + w, raw.data() + at, n); + w += n; at += n; - if (last) - break; } uint32_t a = 1, b = 0; for (uint8_t v : raw) { a = (a + v) % 65521; b = (b + a) % 65521; } - Put32(z, (b << 16) | a); + Set32(z.data() + w, (b << 16) | a); - std::vector png = { 0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n' }; - std::vector header; - Put32(header, width); - Put32(header, height); - header.insert(header.end(), { 8, 6, 0, 0, 0 }); // 8-bit RGBA - Chunk(png, "IHDR", header); - Chunk(png, "IDAT", z); - Chunk(png, "IEND", {}); + static const uint8_t signature[8] = { 0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n' }; + std::vector png(signature, signature + 8); + uint8_t header[13] = {}; + Set32(header, width); + Set32(header + 4, height); + header[8] = 8; // 8-bit RGBA + header[9] = 6; + Chunk(png, "IHDR", header, sizeof(header)); + Chunk(png, "IDAT", z.data(), z.size()); + Chunk(png, "IEND", nullptr, 0); return png; } diff --git a/tests/conformance/README.md b/tests/conformance/README.md index cf0acd23..fc10b99d 100644 --- a/tests/conformance/README.md +++ b/tests/conformance/README.md @@ -53,6 +53,14 @@ reaches: the C exports of `openvr_api` (`c-api-exports`), the client core's othe (`app-type-interfaces`), `IVRMailbox_001` (`mailbox`), `IVRNotifications_002` (`notifications`) and the interfaces that keep state across a Shutdown and Init, with SteamVR's resource files (`state-and-resources`). +`app-type-answers` starts each application type in turn (scene, overlay, background, utility, other) and records the +answers that depend on the session and the controllers: device roles and properties, the compositor's, overlays', +applications' and chaperone's state. Run it with both controllers on (`scripts/controllers_on.json` on the stand-in; +switched on with SteamVR), so a SteamVR recording gives the answers to compare with. `steamvr_run_cases.cpp` has more +of those, run the same way: device properties and roles, a second Init, chaperone bounds and colours, refused submits, +skeletal input (`manifest_skeleton.json`), legacy controller state, render model components, a new overlay's defaults +and events, settings defaults, the application list and IVRIOBuffer. + `out/summary.txt` has the counts per status (`ok`, `ended`: OpenLamina ended the program, `crashed`, `timeout`) and every record that wasn't ok; `out/results.json` has every record. When a child ends early the runner starts it again after the call that ended it, so one bad call doesn't hide the rest. When a child crashes, `crash_report.cpp` writes @@ -67,11 +75,20 @@ driver (no headset needed) and writes `expected/steamvr-.json`. It back SteamVR's settings, room setup and app config first, puts every one back afterwards and fails unless their SHA-256s match; `-WhatIf` only lists them. Close SteamVR, Monado and anything VR first. +`-Controllers` loads SteamVR's other drivers beside the null headset, so switched-on Lighthouse controllers take part +(for `app-type-answers` and `steamvr_run_cases.cpp`). Programs run one at a time (a program that brings SteamVR down +would take the others with it). A SteamVR whose server stops answering (each child then waits on its shared namespace +until the timeout) is ended and started again after two timeouts in a row, or at once when a program times out in Init or gets init error 310 (that program then runs again); `results.json` counts these restarts +(`runtime_restarts`). `-Resume` keeps what an earlier run into the same `-Out` finished (each job's +`.result.json`) and runs the rest; `results.json` then has `"resumed": true`. Against a real runtime the methods +of `unsafe_methods.txt` aren't called (their records say `"skipped": "unsafe"`), among them `ShowMessageOverlay`, which +waits for a click in the headset: so no recording has SteamVR's answer to it. + `differences.json` lists the differences that are expected between SteamVR's null HMD and OpenLamina (display geometry, timing and poses, device properties, handle numbers, the PC's own apps and settings, and the app types OpenLamina doesn't support yet), each with its reason. Every other difference is a bug to fix or to explain there. An entry matches `interface` and `method` (regexes) and `field`, and, if it has one, `apptype` (a regex of the app type -numbers). Records SteamVR answered while restarting between children (init errors 115, 117, 119) aren't compared. +numbers). Records SteamVR answered while restarting between children (init errors 115, 117, 119) or without its shared namespace (310) aren't compared. An entry with `"arch": "x86"` applies only when `--runtime` is a 32-bit DLL: the reference was recorded by 64-bit SteamVR, and answers that hold a pointer are compared as raw bytes, so they are shorter in a 32-bit run. diff --git a/tests/conformance/baseline/none-linux.json b/tests/conformance/baseline/none-linux.json index c7f602e9..c06f4586 100644 --- a/tests/conformance/baseline/none-linux.json +++ b/tests/conformance/baseline/none-linux.json @@ -1438,6 +1438,19 @@ "IVRTrackedCamera_006/#-1/2/valid": {"#v": {"found": false, "init_error": 130, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "2a7541babb", "lookup_error": "a1422e6a16", "s": "ok"}, "IVRTrackedCamera_006/#-1/3/valid": {"#v": {"found": false, "init_error": 124, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "f38cfe2e2f", "lookup_error": "a1422e6a16", "s": "ok"}, "IVRTrackedCamera_006/#-1/4/valid": {"#v": {"found": false, "init_error": 0, "lookup_error": 123}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "40bd001563", "s": "ok"}, + "app-type-answers/background Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "app-type-answers/other Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "app-type-answers/overlay Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "app-type-answers/scene Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "app-type-answers/utility IVRApplications state#/-/-": {"#v": {"GetStartingApplication": 102, "SceneApplicationState": 0, "SceneProcessId is none": true, "SceneProcessId is this": false}, "GetStartingApplication": "c8306ae139", "SceneApplicationState": "b6589fc6ab", "SceneProcessId is none": "5ffe533b83", "SceneProcessId is this": "7cb6efb98b", "s": "ok"}, + "app-type-answers/utility Init#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "app-type-answers/utility no IVRChaperone_004#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRCompositor_029#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRInput_010#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVROverlay_028#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRSystem_022#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/vrmonitor Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "application-list/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "applications/AddApplicationManifest#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "applications/GetApplicationPropertyString Name#/-/-": {"#v": {"error": 0, "ret": 5, "value": "Echo"}, "error": "b6589fc6ab", "ret": "ac3478d69a", "s": "ok", "value": "b208a293d6"}, "applications/IsApplicationInstalled after removal#/-/-": {"#v": {"ret": false}, "ret": "7cb6efb98b", "s": "ok"}, @@ -1445,7 +1458,12 @@ "applications/LastLaunchTime#/-/-": {"#v": {"after_launch": true}, "after_launch": "5ffe533b83", "s": "ok"}, "applications/LaunchApplication#/-/-": {"#v": {"marker": true, "marker_text": "launched", "ret": 0}, "marker": "5ffe533b83", "marker_text": "595cf86673", "ret": "b6589fc6ab", "s": "ok"}, "applications/RemoveApplicationManifest#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "chaperone-colours/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "device-properties/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "frame-loop/Init failed#/-/-": {"s": "ok"}, + "helper-app-controllers/background Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "helper-app-controllers/overlay Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "init-again/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "init-matrix/BIsHmdPresent#/-/-": {"#v": {"ret": false}, "ret": "7cb6efb98b", "s": "ok"}, "init-matrix/Init(0)#/-/-": {"#v": {"init_error": 130}, "init_error": "2a7541babb", "s": "ok"}, "init-matrix/Init(1)#/-/-": {"#v": {"init_error": 124}, "init_error": "f38cfe2e2f", "s": "ok"}, @@ -1465,6 +1483,8 @@ "init-other-thread/Init on another thread#/-/-": {"#v": {"init_error": 124}, "init_error": "f38cfe2e2f", "s": "ok"}, "init-repeat/200 rounds#/-/-": {"#v": {"inits_ok": 0, "interfaces_found": 0, "last_init_error": 124}, "inits_ok": "b6589fc6ab", "interfaces_found": "b6589fc6ab", "last_init_error": "f38cfe2e2f", "s": "ok"}, "input-manifest/Init failed#/-/-": {"s": "ok"}, + "io-buffer/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "legacy-controller/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_001#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_002#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_003#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, @@ -1703,8 +1723,14 @@ "lookup-before-init/before Init: IVRTrackedCamera_004#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/before Init: IVRTrackedCamera_005#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/before Init: IVRTrackedCamera_006#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, + "overlay-defaults/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "overlay-lifecycle/Init failed#/-/-": {"s": "ok"}, + "render-model-components/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "settings-defaults/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "skeletal-input/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "submit-edges/Init failed#/-/-": {"s": "ok"}, + "submit-refusals/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "submit-refusals/Overlay app submit#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, "unknown-interface/FnTable:IVRNope_001#/-/-": {"#v": {"found": false, "init_error": 124, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "f38cfe2e2f", "lookup_error": "a1422e6a16", "s": "ok"}, "unknown-interface/FnTable:IVRSystem_022#/-/-": {"#v": {"found": false, "init_error": 124, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "f38cfe2e2f", "lookup_error": "a1422e6a16", "s": "ok"}, "unknown-interface/IVRNope_001#/-/-": {"#v": {"found": false, "init_error": 124, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "f38cfe2e2f", "lookup_error": "a1422e6a16", "s": "ok"}, diff --git a/tests/conformance/baseline/none.json b/tests/conformance/baseline/none.json index 473c7b1c..09ecf506 100644 --- a/tests/conformance/baseline/none.json +++ b/tests/conformance/baseline/none.json @@ -1438,6 +1438,19 @@ "IVRTrackedCamera_006/#-1/2/valid": {"#v": {"found": false, "init_error": 130, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "2a7541babb", "lookup_error": "a1422e6a16", "s": "ok"}, "IVRTrackedCamera_006/#-1/3/valid": {"#v": {"found": false, "init_error": 121, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "8bd7954c40", "lookup_error": "a1422e6a16", "s": "ok"}, "IVRTrackedCamera_006/#-1/4/valid": {"#v": {"found": false, "init_error": 0, "lookup_error": 123}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "40bd001563", "s": "ok"}, + "app-type-answers/background Init#/-/-": {"#v": {"ret": 121}, "ret": "8bd7954c40", "s": "ok"}, + "app-type-answers/other Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "app-type-answers/overlay Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "app-type-answers/scene Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "app-type-answers/utility IVRApplications state#/-/-": {"#v": {"GetStartingApplication": 102, "SceneApplicationState": 0, "SceneProcessId is none": true, "SceneProcessId is this": false}, "GetStartingApplication": "c8306ae139", "SceneApplicationState": "b6589fc6ab", "SceneProcessId is none": "5ffe533b83", "SceneProcessId is this": "7cb6efb98b", "s": "ok"}, + "app-type-answers/utility Init#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "app-type-answers/utility no IVRChaperone_004#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRCompositor_029#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRInput_010#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVROverlay_028#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRSystem_022#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/vrmonitor Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "application-list/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "applications/AddApplicationManifest#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "applications/GetApplicationPropertyString Name#/-/-": {"#v": {"error": 0, "ret": 5, "value": "Echo"}, "error": "b6589fc6ab", "ret": "ac3478d69a", "s": "ok", "value": "b208a293d6"}, "applications/IsApplicationInstalled after removal#/-/-": {"#v": {"ret": false}, "ret": "7cb6efb98b", "s": "ok"}, @@ -1445,7 +1458,12 @@ "applications/LastLaunchTime#/-/-": {"#v": {"after_launch": true}, "after_launch": "5ffe533b83", "s": "ok"}, "applications/LaunchApplication#/-/-": {"#v": {"marker": true, "marker_text": "launched", "ret": 0}, "marker": "5ffe533b83", "marker_text": "595cf86673", "ret": "b6589fc6ab", "s": "ok"}, "applications/RemoveApplicationManifest#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "chaperone-colours/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "device-properties/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "frame-loop/Init failed#/-/-": {"s": "ok"}, + "helper-app-controllers/background Init#/-/-": {"#v": {"ret": 121}, "ret": "8bd7954c40", "s": "ok"}, + "helper-app-controllers/overlay Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "init-again/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "init-matrix/BIsHmdPresent#/-/-": {"#v": {"ret": false}, "ret": "7cb6efb98b", "s": "ok"}, "init-matrix/Init(0)#/-/-": {"#v": {"init_error": 130}, "init_error": "2a7541babb", "s": "ok"}, "init-matrix/Init(1)#/-/-": {"#v": {"init_error": 124}, "init_error": "f38cfe2e2f", "s": "ok"}, @@ -1465,6 +1483,8 @@ "init-other-thread/Init on another thread#/-/-": {"#v": {"init_error": 124}, "init_error": "f38cfe2e2f", "s": "ok"}, "init-repeat/200 rounds#/-/-": {"#v": {"inits_ok": 0, "interfaces_found": 0, "last_init_error": 124}, "inits_ok": "b6589fc6ab", "interfaces_found": "b6589fc6ab", "last_init_error": "f38cfe2e2f", "s": "ok"}, "input-manifest/Init failed#/-/-": {"s": "ok"}, + "io-buffer/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "legacy-controller/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_001#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_002#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_003#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, @@ -1703,8 +1723,14 @@ "lookup-before-init/before Init: IVRTrackedCamera_004#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/before Init: IVRTrackedCamera_005#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/before Init: IVRTrackedCamera_006#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, + "overlay-defaults/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "overlay-lifecycle/Init failed#/-/-": {"s": "ok"}, + "render-model-components/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "settings-defaults/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "skeletal-input/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, "submit-edges/Init failed#/-/-": {"s": "ok"}, + "submit-refusals/Init#/-/-": {"#v": {"ret": 124}, "ret": "f38cfe2e2f", "s": "ok"}, + "submit-refusals/Overlay app submit#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, "unknown-interface/FnTable:IVRNope_001#/-/-": {"#v": {"found": false, "init_error": 124, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "f38cfe2e2f", "lookup_error": "a1422e6a16", "s": "ok"}, "unknown-interface/FnTable:IVRSystem_022#/-/-": {"#v": {"found": false, "init_error": 124, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "f38cfe2e2f", "lookup_error": "a1422e6a16", "s": "ok"}, "unknown-interface/IVRNope_001#/-/-": {"#v": {"found": false, "init_error": 124, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "f38cfe2e2f", "lookup_error": "a1422e6a16", "s": "ok"}, diff --git a/tests/conformance/baseline/stand-in-linux.json b/tests/conformance/baseline/stand-in-linux.json index 6b44e594..60355989 100644 --- a/tests/conformance/baseline/stand-in-linux.json +++ b/tests/conformance/baseline/stand-in-linux.json @@ -4596,7 +4596,7 @@ "FnTable:IVRCompositor_026/GetLastPosePredictionIDs#100/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_026/GetLastPosePredictionIDs#100/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_026/GetLastPosePredictionIDs#100/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 94, "pRenderPosePredictionID": 94}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "158e72b024", "ret": "b6589fc6ab", "s": "ok"}, - "FnTable:IVRCompositor_026/GetLastPosePredictionIDs#100/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 93, "pRenderPosePredictionID": 93}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "3a1a4d6cdb", "ret": "b6589fc6ab", "s": "ok"}, + "FnTable:IVRCompositor_026/GetLastPosePredictionIDs#100/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_026/GetLastPoses#54/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_026/GetLastPoses#54/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_026/GetLastPoses#54/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePoseArray": "null", "pRenderPoseArray": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "baa7dae2d1", "ret": "b6589fc6ab", "s": "ok"}, @@ -4851,7 +4851,7 @@ "FnTable:IVRCompositor_027/GetLastPosePredictionIDs#100/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_027/GetLastPosePredictionIDs#100/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_027/GetLastPosePredictionIDs#100/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 94, "pRenderPosePredictionID": 94}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "158e72b024", "ret": "b6589fc6ab", "s": "ok"}, - "FnTable:IVRCompositor_027/GetLastPosePredictionIDs#100/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 93, "pRenderPosePredictionID": 93}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "3a1a4d6cdb", "ret": "b6589fc6ab", "s": "ok"}, + "FnTable:IVRCompositor_027/GetLastPosePredictionIDs#100/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_027/GetLastPoses#54/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_027/GetLastPoses#54/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_027/GetLastPoses#54/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePoseArray": "null", "pRenderPoseArray": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "baa7dae2d1", "ret": "b6589fc6ab", "s": "ok"}, @@ -5106,7 +5106,7 @@ "FnTable:IVRCompositor_028/GetLastPosePredictionIDs#102/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_028/GetLastPosePredictionIDs#102/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_028/GetLastPosePredictionIDs#102/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 94, "pRenderPosePredictionID": 94}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "158e72b024", "ret": "b6589fc6ab", "s": "ok"}, - "FnTable:IVRCompositor_028/GetLastPosePredictionIDs#102/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 93, "pRenderPosePredictionID": 93}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "3a1a4d6cdb", "ret": "b6589fc6ab", "s": "ok"}, + "FnTable:IVRCompositor_028/GetLastPosePredictionIDs#102/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_028/GetLastPoses#55/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_028/GetLastPoses#55/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_028/GetLastPoses#55/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePoseArray": "null", "pRenderPoseArray": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "baa7dae2d1", "ret": "b6589fc6ab", "s": "ok"}, @@ -5366,7 +5366,7 @@ "FnTable:IVRCompositor_029/GetLastPosePredictionIDs#104/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_029/GetLastPosePredictionIDs#104/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_029/GetLastPosePredictionIDs#104/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 94, "pRenderPosePredictionID": 94}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "158e72b024", "ret": "b6589fc6ab", "s": "ok"}, - "FnTable:IVRCompositor_029/GetLastPosePredictionIDs#104/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 93, "pRenderPosePredictionID": 93}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "3a1a4d6cdb", "ret": "b6589fc6ab", "s": "ok"}, + "FnTable:IVRCompositor_029/GetLastPosePredictionIDs#104/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_029/GetLastPoses#56/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_029/GetLastPoses#56/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRCompositor_029/GetLastPoses#56/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePoseArray": "null", "pRenderPoseArray": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "baa7dae2d1", "ret": "b6589fc6ab", "s": "ok"}, @@ -14716,7 +14716,7 @@ "FnTable:IVROverlay_026/WaitFrameSync#129/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVROverlay_026/WaitFrameSync#129/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVROverlay_026/WaitFrameSync#129/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, - "FnTable:IVROverlay_026/WaitFrameSync#129/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, + "FnTable:IVROverlay_026/WaitFrameSync#129/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVROverlay_027/ClearOverlayCursorPositionOverride#137/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "17ba079149", "s": "ok"}, "FnTable:IVROverlay_027/ClearOverlayCursorPositionOverride#137/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "17ba079149", "s": "ok"}, "FnTable:IVROverlay_027/ClearOverlayCursorPositionOverride#137/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "17ba079149", "s": "ok"}, @@ -15116,7 +15116,7 @@ "FnTable:IVROverlay_027/WaitFrameSync#125/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVROverlay_027/WaitFrameSync#125/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVROverlay_027/WaitFrameSync#125/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, - "FnTable:IVROverlay_027/WaitFrameSync#125/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, + "FnTable:IVROverlay_027/WaitFrameSync#125/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVROverlay_028/ClearOverlayCursorPositionOverride#141/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "17ba079149", "s": "ok"}, "FnTable:IVROverlay_028/ClearOverlayCursorPositionOverride#141/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "17ba079149", "s": "ok"}, "FnTable:IVROverlay_028/ClearOverlayCursorPositionOverride#141/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "17ba079149", "s": "ok"}, @@ -15526,7 +15526,7 @@ "FnTable:IVROverlay_028/WaitFrameSync#129/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVROverlay_028/WaitFrameSync#129/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVROverlay_028/WaitFrameSync#129/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, - "FnTable:IVROverlay_028/WaitFrameSync#129/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, + "FnTable:IVROverlay_028/WaitFrameSync#129/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVRPaths_001/HandleToString#7/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchBuffer": "", "punBufferSizeUsed": 0}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "49318f3b7e", "ret": "17ba079149", "s": "ok"}, "FnTable:IVRPaths_001/HandleToString#7/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchBuffer": "null", "punBufferSizeUsed": "null"}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "78fa6001cf", "ret": "17ba079149", "s": "ok"}, "FnTable:IVRPaths_001/HandleToString#7/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchBuffer": "null", "punBufferSizeUsed": "null"}, "ret": 11}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "78fa6001cf", "ret": "17ba079149", "s": "ok"}, @@ -15597,11 +15597,11 @@ "FnTable:IVRRenderModels_001/GetComponentState#17/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_001/GetComponentState#17/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_001/GetComponentState#17/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_001/GetRenderModelName#11/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRRenderModels_001/GetRenderModelName#11/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "FnTable:IVRRenderModels_001/GetRenderModelName#11/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -15647,11 +15647,11 @@ "FnTable:IVRRenderModels_002/GetComponentState#22/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_002/GetComponentState#22/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_002/GetComponentState#22/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_002/GetRenderModelName#16/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRRenderModels_002/GetRenderModelName#16/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "FnTable:IVRRenderModels_002/GetRenderModelName#16/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -15712,11 +15712,11 @@ "FnTable:IVRRenderModels_004/GetComponentState#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_004/GetComponentState#26/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_004/GetComponentState#26/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_004/GetRenderModelName#20/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRRenderModels_004/GetRenderModelName#20/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "FnTable:IVRRenderModels_004/GetRenderModelName#20/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -15782,11 +15782,11 @@ "FnTable:IVRRenderModels_005/GetComponentState#31/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_005/GetComponentState#31/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_005/GetComponentState#31/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_005/GetRenderModelErrorNameFromEnum#35/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (-1)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b556311e69", "s": "ok"}, "FnTable:IVRRenderModels_005/GetRenderModelErrorNameFromEnum#35/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (32767)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "d35bc06b8f", "s": "ok"}, "FnTable:IVRRenderModels_005/GetRenderModelErrorNameFromEnum#35/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "VRRenderModelError_None (0)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "fca1a7bcf5", "s": "ok"}, @@ -15877,11 +15877,11 @@ "FnTable:IVRRenderModels_006/GetComponentStateForDevicePath#32/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_006/GetComponentStateForDevicePath#32/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_006/GetComponentStateForDevicePath#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_006/GetRenderModelErrorNameFromEnum#37/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (-1)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b556311e69", "s": "ok"}, "FnTable:IVRRenderModels_006/GetRenderModelErrorNameFromEnum#37/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (32767)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "d35bc06b8f", "s": "ok"}, "FnTable:IVRRenderModels_006/GetRenderModelErrorNameFromEnum#37/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "VRRenderModelError_None (0)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "fca1a7bcf5", "s": "ok"}, @@ -16241,12 +16241,12 @@ "FnTable:IVRSystem_003/GetControllerState#67/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_003/GetControllerState#67/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_003/GetControllerState#67/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_003/GetControllerState#67/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_003/GetControllerState#67/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_003/GetControllerStateWithPose#68/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_003/GetControllerStateWithPose#68/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_003/GetControllerStateWithPose#68/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_003/GetControllerStateWithPose#68/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_003/GetControllerStateWithPose#68/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_003/GetControllerStateWithPose#68/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_003/GetD3D9AdapterIndex#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_003/GetD3D9AdapterIndex#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_003/GetD3D9AdapterIndex#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -16431,12 +16431,12 @@ "FnTable:IVRSystem_004/GetControllerState#63/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_004/GetControllerState#63/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_004/GetControllerState#63/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_004/GetControllerState#63/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_004/GetControllerState#63/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_004/GetControllerStateWithPose#64/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_004/GetControllerStateWithPose#64/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_004/GetControllerStateWithPose#64/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_004/GetControllerStateWithPose#64/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_004/GetControllerStateWithPose#64/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_004/GetControllerStateWithPose#64/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_004/GetD3D9AdapterIndex#44/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_004/GetD3D9AdapterIndex#44/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_004/GetD3D9AdapterIndex#44/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -16611,12 +16611,12 @@ "FnTable:IVRSystem_005/GetControllerState#65/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_005/GetControllerState#65/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_005/GetControllerState#65/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_005/GetControllerState#65/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_005/GetControllerState#65/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_005/GetControllerStateWithPose#66/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_005/GetControllerStateWithPose#66/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_005/GetControllerStateWithPose#66/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_005/GetControllerStateWithPose#66/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_005/GetControllerStateWithPose#66/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_005/GetControllerStateWithPose#66/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_005/GetD3D9AdapterIndex#45/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_005/GetD3D9AdapterIndex#45/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_005/GetD3D9AdapterIndex#45/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -16796,12 +16796,12 @@ "FnTable:IVRSystem_006/GetControllerState#70/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_006/GetControllerState#70/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_006/GetControllerState#70/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_006/GetControllerState#70/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_006/GetControllerState#70/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_006/GetControllerStateWithPose#71/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_006/GetControllerStateWithPose#71/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_006/GetControllerStateWithPose#71/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_006/GetControllerStateWithPose#71/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_006/GetControllerStateWithPose#71/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_006/GetControllerStateWithPose#71/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_006/GetD3D9AdapterIndex#48/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_006/GetD3D9AdapterIndex#48/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_006/GetD3D9AdapterIndex#48/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -17001,12 +17001,12 @@ "FnTable:IVRSystem_007/GetControllerState#74/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_007/GetControllerState#74/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_007/GetControllerState#74/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_007/GetControllerState#74/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_007/GetControllerState#74/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_007/GetControllerStateWithPose#75/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_007/GetControllerStateWithPose#75/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_007/GetControllerStateWithPose#75/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_007/GetControllerStateWithPose#75/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_007/GetControllerStateWithPose#75/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_007/GetControllerStateWithPose#75/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_007/GetD3D9AdapterIndex#51/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_007/GetD3D9AdapterIndex#51/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_007/GetD3D9AdapterIndex#51/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -17221,12 +17221,12 @@ "FnTable:IVRSystem_009/GetControllerState#72/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_009/GetControllerState#72/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_009/GetControllerState#72/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_009/GetControllerState#72/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_009/GetControllerState#72/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_009/GetControllerStateWithPose#73/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_009/GetControllerStateWithPose#73/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_009/GetControllerStateWithPose#73/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_009/GetControllerStateWithPose#73/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_009/GetControllerStateWithPose#73/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_009/GetControllerStateWithPose#73/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_009/GetD3D9AdapterIndex#48/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_009/GetD3D9AdapterIndex#48/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_009/GetD3D9AdapterIndex#48/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -17436,12 +17436,12 @@ "FnTable:IVRSystem_010/GetControllerState#78/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_010/GetControllerState#78/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_010/GetControllerState#78/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_010/GetControllerState#78/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_010/GetControllerState#78/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_010/GetControllerStateWithPose#79/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_010/GetControllerStateWithPose#79/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_010/GetControllerStateWithPose#79/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_010/GetControllerStateWithPose#79/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_010/GetControllerStateWithPose#79/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_010/GetControllerStateWithPose#79/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_010/GetD3D9AdapterIndex#52/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_010/GetD3D9AdapterIndex#52/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_010/GetD3D9AdapterIndex#52/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -17666,12 +17666,12 @@ "FnTable:IVRSystem_011/GetControllerState#78/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_011/GetControllerState#78/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_011/GetControllerState#78/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_011/GetControllerState#78/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_011/GetControllerState#78/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_011/GetControllerStateWithPose#79/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_011/GetControllerStateWithPose#79/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_011/GetControllerStateWithPose#79/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_011/GetControllerStateWithPose#79/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_011/GetControllerStateWithPose#79/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_011/GetControllerStateWithPose#79/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_011/GetD3D9AdapterIndex#52/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_011/GetD3D9AdapterIndex#52/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_011/GetD3D9AdapterIndex#52/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -17896,12 +17896,12 @@ "FnTable:IVRSystem_012/GetControllerState#76/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_012/GetControllerState#76/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_012/GetControllerState#76/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_012/GetControllerState#76/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_012/GetControllerState#76/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_012/GetControllerStateWithPose#77/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "FnTable:IVRSystem_012/GetControllerStateWithPose#77/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_012/GetControllerStateWithPose#77/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_012/GetControllerStateWithPose#77/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "FnTable:IVRSystem_012/GetControllerStateWithPose#77/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "FnTable:IVRSystem_012/GetControllerStateWithPose#77/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_012/GetD3D9AdapterIndex#50/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_012/GetD3D9AdapterIndex#50/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "FnTable:IVRSystem_012/GetD3D9AdapterIndex#50/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -19136,7 +19136,7 @@ "FnTable:IVRSystem_019/IsInputAvailable#86/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_019/IsInputAvailable#86/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_019/IsInputAvailable#86/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRSystem_019/IsInputAvailable#86/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "FnTable:IVRSystem_019/IsInputAvailable#86/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVRSystem_019/IsSteamVRDrawingControllers#87/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_019/IsSteamVRDrawingControllers#87/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_019/IsSteamVRDrawingControllers#87/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -19322,11 +19322,11 @@ "FnTable:IVRSystem_020/GetRecommendedRenderTargetSize#48/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_020/GetRecommendedRenderTargetSize#48/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_020/GetRecommendedRenderTargetSize#48/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#61/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#61/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#61/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -19376,7 +19376,7 @@ "FnTable:IVRSystem_020/IsInputAvailable#87/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_020/IsInputAvailable#87/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_020/IsInputAvailable#87/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRSystem_020/IsInputAvailable#87/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "FnTable:IVRSystem_020/IsInputAvailable#87/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVRSystem_020/IsSteamVRDrawingControllers#88/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_020/IsSteamVRDrawingControllers#88/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_020/IsSteamVRDrawingControllers#88/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -19557,11 +19557,11 @@ "FnTable:IVRSystem_021/GetRecommendedRenderTargetSize#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_021/GetRecommendedRenderTargetSize#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_021/GetRecommendedRenderTargetSize#47/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#60/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#60/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#60/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -19611,7 +19611,7 @@ "FnTable:IVRSystem_021/IsInputAvailable#86/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_021/IsInputAvailable#86/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_021/IsInputAvailable#86/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRSystem_021/IsInputAvailable#86/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "FnTable:IVRSystem_021/IsInputAvailable#86/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVRSystem_021/IsSteamVRDrawingControllers#87/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_021/IsSteamVRDrawingControllers#87/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_021/IsSteamVRDrawingControllers#87/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -19792,11 +19792,11 @@ "FnTable:IVRSystem_022/GetRecommendedRenderTargetSize#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_022/GetRecommendedRenderTargetSize#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_022/GetRecommendedRenderTargetSize#46/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#58/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#58/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#58/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -19846,7 +19846,7 @@ "FnTable:IVRSystem_022/IsInputAvailable#84/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_022/IsInputAvailable#84/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_022/IsInputAvailable#84/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRSystem_022/IsInputAvailable#84/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "FnTable:IVRSystem_022/IsInputAvailable#84/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVRSystem_022/IsSteamVRDrawingControllers#85/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_022/IsSteamVRDrawingControllers#85/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_022/IsSteamVRDrawingControllers#85/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -20022,11 +20022,11 @@ "FnTable:IVRSystem_023/GetRecommendedRenderTargetSize#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_023/GetRecommendedRenderTargetSize#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_023/GetRecommendedRenderTargetSize#47/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#59/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#59/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#59/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -20076,7 +20076,7 @@ "FnTable:IVRSystem_023/IsInputAvailable#86/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_023/IsInputAvailable#86/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_023/IsInputAvailable#86/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRSystem_023/IsInputAvailable#86/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "FnTable:IVRSystem_023/IsInputAvailable#86/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVRSystem_023/IsSteamVRDrawingControllers#87/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_023/IsSteamVRDrawingControllers#87/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_023/IsSteamVRDrawingControllers#87/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -20272,11 +20272,11 @@ "FnTable:IVRSystem_026/GetRecommendedRenderTargetSize#51/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_026/GetRecommendedRenderTargetSize#51/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_026/GetRecommendedRenderTargetSize#51/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#64/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#64/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#64/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -20326,7 +20326,7 @@ "FnTable:IVRSystem_026/IsInputAvailable#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_026/IsInputAvailable#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_026/IsInputAvailable#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRSystem_026/IsInputAvailable#93/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "FnTable:IVRSystem_026/IsInputAvailable#93/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "FnTable:IVRSystem_026/IsSteamVRDrawingControllers#94/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_026/IsSteamVRDrawingControllers#94/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRSystem_026/IsSteamVRDrawingControllers#94/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -25453,7 +25453,7 @@ "IVRCompositor_026/GetLastPosePredictionIDs#49/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_026/GetLastPosePredictionIDs#49/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_026/GetLastPosePredictionIDs#49/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 92, "pRenderPosePredictionID": 92}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2eaf4527a6", "ret": "b6589fc6ab", "s": "ok"}, - "IVRCompositor_026/GetLastPosePredictionIDs#49/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 92, "pRenderPosePredictionID": 92}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2eaf4527a6", "ret": "b6589fc6ab", "s": "ok"}, + "IVRCompositor_026/GetLastPosePredictionIDs#49/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_026/GetLastPoses#3/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_026/GetLastPoses#3/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_026/GetLastPoses#3/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePoseArray": "null", "pRenderPoseArray": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "baa7dae2d1", "ret": "b6589fc6ab", "s": "ok"}, @@ -25711,7 +25711,7 @@ "IVRCompositor_027/GetLastPosePredictionIDs#49/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_027/GetLastPosePredictionIDs#49/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_027/GetLastPosePredictionIDs#49/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 92, "pRenderPosePredictionID": 92}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2eaf4527a6", "ret": "b6589fc6ab", "s": "ok"}, - "IVRCompositor_027/GetLastPosePredictionIDs#49/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 92, "pRenderPosePredictionID": 92}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2eaf4527a6", "ret": "b6589fc6ab", "s": "ok"}, + "IVRCompositor_027/GetLastPosePredictionIDs#49/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_027/GetLastPoses#3/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_027/GetLastPoses#3/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_027/GetLastPoses#3/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePoseArray": "null", "pRenderPoseArray": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "baa7dae2d1", "ret": "b6589fc6ab", "s": "ok"}, @@ -25969,7 +25969,7 @@ "IVRCompositor_028/GetLastPosePredictionIDs#50/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_028/GetLastPosePredictionIDs#50/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_028/GetLastPosePredictionIDs#50/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 92, "pRenderPosePredictionID": 92}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2eaf4527a6", "ret": "b6589fc6ab", "s": "ok"}, - "IVRCompositor_028/GetLastPosePredictionIDs#50/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 92, "pRenderPosePredictionID": 92}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2eaf4527a6", "ret": "b6589fc6ab", "s": "ok"}, + "IVRCompositor_028/GetLastPosePredictionIDs#50/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_028/GetLastPoses#3/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_028/GetLastPoses#3/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_028/GetLastPoses#3/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePoseArray": "null", "pRenderPoseArray": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "baa7dae2d1", "ret": "b6589fc6ab", "s": "ok"}, @@ -26232,7 +26232,7 @@ "IVRCompositor_029/GetLastPosePredictionIDs#51/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_029/GetLastPosePredictionIDs#51/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": "null", "pRenderPosePredictionID": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c2387b7c83", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_029/GetLastPosePredictionIDs#51/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 92, "pRenderPosePredictionID": 92}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2eaf4527a6", "ret": "b6589fc6ab", "s": "ok"}, - "IVRCompositor_029/GetLastPosePredictionIDs#51/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePosePredictionID": 92, "pRenderPosePredictionID": 92}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2eaf4527a6", "ret": "b6589fc6ab", "s": "ok"}, + "IVRCompositor_029/GetLastPosePredictionIDs#51/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_029/GetLastPoses#3/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_029/GetLastPoses#3/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "75c441a708", "ret": "b6589fc6ab", "s": "ok"}, "IVRCompositor_029/GetLastPoses#3/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pGamePoseArray": "null", "pRenderPoseArray": "null"}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "baa7dae2d1", "ret": "b6589fc6ab", "s": "ok"}, @@ -35735,7 +35735,7 @@ "IVROverlay_026/WaitFrameSync#47/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "IVROverlay_026/WaitFrameSync#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "IVROverlay_026/WaitFrameSync#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, - "IVROverlay_026/WaitFrameSync#47/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, + "IVROverlay_026/WaitFrameSync#47/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVROverlay_027/#-1/0/valid": {"#v": {"found": false, "init_error": 130, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "2a7541babb", "lookup_error": "a1422e6a16", "s": "ok"}, "IVROverlay_027/#-1/2/valid": {"#v": {"found": false, "init_error": 130, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "2a7541babb", "lookup_error": "a1422e6a16", "s": "ok"}, "IVROverlay_027/#-1/4/valid": {"#v": {"found": false, "init_error": 0, "lookup_error": 123}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "40bd001563", "s": "ok"}, @@ -36138,7 +36138,7 @@ "IVROverlay_027/WaitFrameSync#45/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "IVROverlay_027/WaitFrameSync#45/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "IVROverlay_027/WaitFrameSync#45/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, - "IVROverlay_027/WaitFrameSync#45/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, + "IVROverlay_027/WaitFrameSync#45/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVROverlay_028/#-1/0/valid": {"#v": {"found": false, "init_error": 130, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "2a7541babb", "lookup_error": "a1422e6a16", "s": "ok"}, "IVROverlay_028/#-1/2/valid": {"#v": {"found": false, "init_error": 130, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "2a7541babb", "lookup_error": "a1422e6a16", "s": "ok"}, "IVROverlay_028/#-1/4/valid": {"#v": {"found": false, "init_error": 0, "lookup_error": 123}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "40bd001563", "s": "ok"}, @@ -36551,7 +36551,7 @@ "IVROverlay_028/WaitFrameSync#47/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "IVROverlay_028/WaitFrameSync#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, "IVROverlay_028/WaitFrameSync#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, - "IVROverlay_028/WaitFrameSync#47/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b6589fc6ab", "s": "ok"}, + "IVROverlay_028/WaitFrameSync#47/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVRPaths_001/#-1/0/valid": {"#v": {"found": false, "init_error": 130, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "2a7541babb", "lookup_error": "a1422e6a16", "s": "ok"}, "IVRPaths_001/#-1/2/valid": {"#v": {"found": false, "init_error": 130, "lookup_error": 109}, "found": "7cb6efb98b", "init_error": "2a7541babb", "lookup_error": "a1422e6a16", "s": "ok"}, "IVRPaths_001/#-1/4/valid": {"#v": {"found": false, "init_error": 0, "lookup_error": 123}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "40bd001563", "s": "ok"}, @@ -36631,11 +36631,11 @@ "IVRRenderModels_001/GetComponentState#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_001/GetComponentState#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_001/GetComponentState#8/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_001/GetRenderModelName#2/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "IVRRenderModels_001/GetRenderModelName#2/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "IVRRenderModels_001/GetRenderModelName#2/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -36684,11 +36684,11 @@ "IVRRenderModels_002/GetComponentState#10/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_002/GetComponentState#10/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_002/GetComponentState#10/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_002/GetRenderModelName#4/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "IVRRenderModels_002/GetRenderModelName#4/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "IVRRenderModels_002/GetRenderModelName#4/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -36752,11 +36752,11 @@ "IVRRenderModels_004/GetComponentState#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_004/GetComponentState#12/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_004/GetComponentState#12/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_004/GetRenderModelName#6/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "IVRRenderModels_004/GetRenderModelName#6/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "IVRRenderModels_004/GetRenderModelName#6/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -36825,11 +36825,11 @@ "IVRRenderModels_005/GetComponentState#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_005/GetComponentState#13/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_005/GetComponentState#13/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_005/GetRenderModelErrorNameFromEnum#17/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (-1)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b556311e69", "s": "ok"}, "IVRRenderModels_005/GetRenderModelErrorNameFromEnum#17/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (32767)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "d35bc06b8f", "s": "ok"}, "IVRRenderModels_005/GetRenderModelErrorNameFromEnum#17/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "VRRenderModelError_None (0)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "fca1a7bcf5", "s": "ok"}, @@ -36923,11 +36923,11 @@ "IVRRenderModels_006/GetComponentStateForDevicePath#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_006/GetComponentStateForDevicePath#13/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_006/GetComponentStateForDevicePath#13/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_006/GetRenderModelErrorNameFromEnum#18/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (-1)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "b556311e69", "s": "ok"}, "IVRRenderModels_006/GetRenderModelErrorNameFromEnum#18/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (32767)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "d35bc06b8f", "s": "ok"}, "IVRRenderModels_006/GetRenderModelErrorNameFromEnum#18/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "VRRenderModelError_None (0)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "fca1a7bcf5", "s": "ok"}, @@ -37305,12 +37305,12 @@ "IVRSystem_003/GetControllerState#29/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_003/GetControllerState#29/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_003/GetControllerState#29/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_003/GetControllerState#29/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_003/GetControllerState#29/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_003/GetControllerStateWithPose#30/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_003/GetControllerStateWithPose#30/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_003/GetControllerStateWithPose#30/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_003/GetControllerStateWithPose#30/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_003/GetControllerStateWithPose#30/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_003/GetControllerStateWithPose#30/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_003/GetD3D9AdapterIndex#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_003/GetD3D9AdapterIndex#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_003/GetD3D9AdapterIndex#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -37498,12 +37498,12 @@ "IVRSystem_004/GetControllerState#27/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_004/GetControllerState#27/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_004/GetControllerState#27/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_004/GetControllerState#27/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_004/GetControllerState#27/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_004/GetControllerStateWithPose#28/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_004/GetControllerStateWithPose#28/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_004/GetControllerStateWithPose#28/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_004/GetControllerStateWithPose#28/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_004/GetControllerStateWithPose#28/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_004/GetControllerStateWithPose#28/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_004/GetD3D9AdapterIndex#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_004/GetD3D9AdapterIndex#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_004/GetD3D9AdapterIndex#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -37681,12 +37681,12 @@ "IVRSystem_005/GetControllerState#28/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_005/GetControllerState#28/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_005/GetControllerState#28/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_005/GetControllerState#28/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_005/GetControllerState#28/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_005/GetControllerStateWithPose#29/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_005/GetControllerStateWithPose#29/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_005/GetControllerStateWithPose#29/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_005/GetControllerStateWithPose#29/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_005/GetControllerStateWithPose#29/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_005/GetControllerStateWithPose#29/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_005/GetD3D9AdapterIndex#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_005/GetD3D9AdapterIndex#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_005/GetD3D9AdapterIndex#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -37869,12 +37869,12 @@ "IVRSystem_006/GetControllerState#30/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_006/GetControllerState#30/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_006/GetControllerState#30/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_006/GetControllerState#30/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_006/GetControllerState#30/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_006/GetControllerStateWithPose#31/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_006/GetControllerStateWithPose#31/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_006/GetControllerStateWithPose#31/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_006/GetControllerStateWithPose#31/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_006/GetControllerStateWithPose#31/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_006/GetControllerStateWithPose#31/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_006/GetD3D9AdapterIndex#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_006/GetD3D9AdapterIndex#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_006/GetD3D9AdapterIndex#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -38077,12 +38077,12 @@ "IVRSystem_007/GetControllerState#31/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_007/GetControllerState#31/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_007/GetControllerState#31/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_007/GetControllerState#31/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_007/GetControllerState#31/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_007/GetControllerStateWithPose#32/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_007/GetControllerStateWithPose#32/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_007/GetControllerStateWithPose#32/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_007/GetControllerStateWithPose#32/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_007/GetControllerStateWithPose#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_007/GetControllerStateWithPose#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_007/GetD3D9AdapterIndex#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_007/GetD3D9AdapterIndex#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_007/GetD3D9AdapterIndex#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -38300,12 +38300,12 @@ "IVRSystem_009/GetControllerState#30/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_009/GetControllerState#30/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_009/GetControllerState#30/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_009/GetControllerState#30/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_009/GetControllerState#30/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_009/GetControllerStateWithPose#31/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_009/GetControllerStateWithPose#31/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_009/GetControllerStateWithPose#31/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_009/GetControllerStateWithPose#31/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_009/GetControllerStateWithPose#31/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_009/GetControllerStateWithPose#31/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_009/GetD3D9AdapterIndex#6/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_009/GetD3D9AdapterIndex#6/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_009/GetD3D9AdapterIndex#6/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -38518,12 +38518,12 @@ "IVRSystem_010/GetControllerState#32/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_010/GetControllerState#32/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_010/GetControllerState#32/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_010/GetControllerState#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_010/GetControllerState#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_010/GetControllerStateWithPose#33/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_010/GetControllerStateWithPose#33/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_010/GetControllerStateWithPose#33/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_010/GetControllerStateWithPose#33/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_010/GetControllerStateWithPose#33/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_010/GetControllerStateWithPose#33/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_010/GetD3D9AdapterIndex#6/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_010/GetD3D9AdapterIndex#6/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_010/GetD3D9AdapterIndex#6/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -38751,12 +38751,12 @@ "IVRSystem_011/GetControllerState#32/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_011/GetControllerState#32/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_011/GetControllerState#32/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_011/GetControllerState#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_011/GetControllerState#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_011/GetControllerStateWithPose#33/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_011/GetControllerStateWithPose#33/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_011/GetControllerStateWithPose#33/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_011/GetControllerStateWithPose#33/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_011/GetControllerStateWithPose#33/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_011/GetControllerStateWithPose#33/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_011/GetD3D9AdapterIndex#6/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_011/GetD3D9AdapterIndex#6/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_011/GetD3D9AdapterIndex#6/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -38984,12 +38984,12 @@ "IVRSystem_012/GetControllerState#32/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_012/GetControllerState#32/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "702a17b9d9", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_012/GetControllerState#32/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_012/GetControllerState#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_012/GetControllerState#32/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "469844caac", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_012/GetControllerStateWithPose#33/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "60a96b4f45", "ret": "5ffe533b83", "s": "ok"}, "IVRSystem_012/GetControllerStateWithPose#33/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_012/GetControllerStateWithPose#33/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pControllerState": "null", "pTrackedDevicePose": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "47f094000c", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_012/GetControllerStateWithPose#33/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, - "IVRSystem_012/GetControllerStateWithPose#33/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": true}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "5ffe533b83", "s": "ok"}, + "IVRSystem_012/GetControllerStateWithPose#33/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "2e0890a6ea", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_012/GetD3D9AdapterIndex#6/1/edge": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_012/GetD3D9AdapterIndex#6/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "IVRSystem_012/GetD3D9AdapterIndex#6/1/null": {"#v": {"init_error": 0, "lookup_error": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, @@ -40239,7 +40239,7 @@ "IVRSystem_019/IsInputAvailable#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_019/IsInputAvailable#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_019/IsInputAvailable#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "IVRSystem_019/IsInputAvailable#39/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "IVRSystem_019/IsInputAvailable#39/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVRSystem_019/IsSteamVRDrawingControllers#40/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_019/IsSteamVRDrawingControllers#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_019/IsSteamVRDrawingControllers#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -40428,11 +40428,11 @@ "IVRSystem_020/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_020/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_020/GetRecommendedRenderTargetSize#0/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -40482,7 +40482,7 @@ "IVRSystem_020/IsInputAvailable#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_020/IsInputAvailable#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_020/IsInputAvailable#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "IVRSystem_020/IsInputAvailable#39/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "IVRSystem_020/IsInputAvailable#39/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVRSystem_020/IsSteamVRDrawingControllers#40/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_020/IsSteamVRDrawingControllers#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_020/IsSteamVRDrawingControllers#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -40666,11 +40666,11 @@ "IVRSystem_021/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_021/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_021/GetRecommendedRenderTargetSize#0/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -40720,7 +40720,7 @@ "IVRSystem_021/IsInputAvailable#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_021/IsInputAvailable#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_021/IsInputAvailable#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "IVRSystem_021/IsInputAvailable#39/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "IVRSystem_021/IsInputAvailable#39/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVRSystem_021/IsSteamVRDrawingControllers#40/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_021/IsSteamVRDrawingControllers#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_021/IsSteamVRDrawingControllers#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -40904,11 +40904,11 @@ "IVRSystem_022/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_022/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_022/GetRecommendedRenderTargetSize#0/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -40958,7 +40958,7 @@ "IVRSystem_022/IsInputAvailable#38/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_022/IsInputAvailable#38/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_022/IsInputAvailable#38/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "IVRSystem_022/IsInputAvailable#38/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "IVRSystem_022/IsInputAvailable#38/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVRSystem_022/IsSteamVRDrawingControllers#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_022/IsSteamVRDrawingControllers#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_022/IsSteamVRDrawingControllers#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -41137,11 +41137,11 @@ "IVRSystem_023/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_023/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_023/GetRecommendedRenderTargetSize#0/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -41191,7 +41191,7 @@ "IVRSystem_023/IsInputAvailable#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_023/IsInputAvailable#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_023/IsInputAvailable#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "IVRSystem_023/IsInputAvailable#39/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "IVRSystem_023/IsInputAvailable#39/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVRSystem_023/IsSteamVRDrawingControllers#40/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_023/IsSteamVRDrawingControllers#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_023/IsSteamVRDrawingControllers#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -41390,11 +41390,11 @@ "IVRSystem_026/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_026/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_026/GetRecommendedRenderTargetSize#0/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -41444,7 +41444,7 @@ "IVRSystem_026/IsInputAvailable#42/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_026/IsInputAvailable#42/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_026/IsInputAvailable#42/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, - "IVRSystem_026/IsInputAvailable#42/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, + "IVRSystem_026/IsInputAvailable#42/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "s": "ok"}, "IVRSystem_026/IsSteamVRDrawingControllers#43/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_026/IsSteamVRDrawingControllers#43/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, "IVRSystem_026/IsSteamVRDrawingControllers#43/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7cb6efb98b", "s": "ok"}, @@ -41903,6 +41903,39 @@ "IVRTrackedCamera_006/SetCameraTrackingSpace#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRTrackedCamera_006/SetCameraTrackingSpace#12/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRTrackedCamera_006/SetCameraTrackingSpace#12/3/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, + "app-type-answers/background GetSortedTrackedDeviceIndicesOfClass#/-/-": {"#v": {"controllers": 0}, "controllers": "b6589fc6ab", "s": "ok"}, + "app-type-answers/background IVRApplications state#/-/-": {"#v": {"GetStartingApplication": 102, "SceneApplicationState": 0, "SceneProcessId is none": true, "SceneProcessId is this": false}, "GetStartingApplication": "c8306ae139", "SceneApplicationState": "b6589fc6ab", "SceneProcessId is none": "5ffe533b83", "SceneProcessId is this": "7cb6efb98b", "s": "ok"}, + "app-type-answers/background IVRChaperone state#/-/-": {"#v": {"AreBoundsVisible": false, "GetCalibrationState": 1}, "AreBoundsVisible": "7cb6efb98b", "GetCalibrationState": "356a192b79", "s": "ok"}, + "app-type-answers/background IVRCompositor state#/-/-": {"#v": {"CanRenderScene": true, "CurrentSceneFocusProcess is none": false, "CurrentSceneFocusProcess is this": true, "GetTrackingSpace": 1, "IsCurrentSceneFocusAppLoading": false, "IsFullscreen": true, "IsMirrorWindowVisible": false, "IsMotionSmoothingEnabled": false, "IsMotionSmoothingSupported": false, "LastFrameRenderer is this": true, "ShouldAppRenderWithLowResources": false}, "CanRenderScene": "5ffe533b83", "CurrentSceneFocusProcess is none": "7cb6efb98b", "CurrentSceneFocusProcess is this": "5ffe533b83", "GetTrackingSpace": "356a192b79", "IsCurrentSceneFocusAppLoading": "7cb6efb98b", "IsFullscreen": "5ffe533b83", "IsMirrorWindowVisible": "7cb6efb98b", "IsMotionSmoothingEnabled": "7cb6efb98b", "IsMotionSmoothingSupported": "7cb6efb98b", "LastFrameRenderer is this": "5ffe533b83", "ShouldAppRenderWithLowResources": "7cb6efb98b", "s": "ok"}, + "app-type-answers/background IVRInput state#/-/-": {"#v": {"IsUsingLegacyInput": false}, "IsUsingLegacyInput": "7cb6efb98b", "s": "ok"}, + "app-type-answers/background IVROverlay state#/-/-": {"#v": {"CreateOverlay": 0, "DestroyOverlay": 0, "IsDashboardVisible": false, "PrimaryDashboardDevice": -1}, "CreateOverlay": "b6589fc6ab", "DestroyOverlay": "b6589fc6ab", "IsDashboardVisible": "7cb6efb98b", "PrimaryDashboardDevice": "7984b0a0e1", "s": "ok"}, + "app-type-answers/background IVRSystem state#/-/-": {"#v": {"HmdActivityLevel": 1, "IsInputAvailable": true, "IsSteamVRDrawingControllers": false, "ShouldApplicationPause": false, "ShouldApplicationReduceRenderingWork": false}, "HmdActivityLevel": "356a192b79", "IsInputAvailable": "5ffe533b83", "IsSteamVRDrawingControllers": "7cb6efb98b", "ShouldApplicationPause": "7cb6efb98b", "ShouldApplicationReduceRenderingWork": "7cb6efb98b", "s": "ok"}, + "app-type-answers/background Init#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "app-type-answers/background left controller#/-/-": {"#v": {"found": false}, "found": "7cb6efb98b", "s": "ok"}, + "app-type-answers/background right controller#/-/-": {"#v": {"found": false}, "found": "7cb6efb98b", "s": "ok"}, + "app-type-answers/background startup events#/-/-": {"#v": {"any": true}, "any": "5ffe533b83", "s": "ok"}, + "app-type-answers/other Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "app-type-answers/overlay Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "app-type-answers/scene GetSortedTrackedDeviceIndicesOfClass#/-/-": {"#v": {"controllers": 0}, "controllers": "b6589fc6ab", "s": "ok"}, + "app-type-answers/scene IVRApplications state#/-/-": {"#v": {"GetStartingApplication": 102, "SceneApplicationState": 4, "SceneProcessId is none": false, "SceneProcessId is this": true}, "GetStartingApplication": "c8306ae139", "SceneApplicationState": "1b64538924", "SceneProcessId is none": "7cb6efb98b", "SceneProcessId is this": "5ffe533b83", "s": "ok"}, + "app-type-answers/scene IVRChaperone state#/-/-": {"#v": {"AreBoundsVisible": false, "GetCalibrationState": 1}, "AreBoundsVisible": "7cb6efb98b", "GetCalibrationState": "356a192b79", "s": "ok"}, + "app-type-answers/scene IVRCompositor state#/-/-": {"#v": {"CanRenderScene": true, "CurrentSceneFocusProcess is none": false, "CurrentSceneFocusProcess is this": true, "GetTrackingSpace": 1, "IsCurrentSceneFocusAppLoading": false, "IsFullscreen": true, "IsMirrorWindowVisible": false, "IsMotionSmoothingEnabled": false, "IsMotionSmoothingSupported": false, "LastFrameRenderer is this": true, "ShouldAppRenderWithLowResources": false}, "CanRenderScene": "5ffe533b83", "CurrentSceneFocusProcess is none": "7cb6efb98b", "CurrentSceneFocusProcess is this": "5ffe533b83", "GetTrackingSpace": "356a192b79", "IsCurrentSceneFocusAppLoading": "7cb6efb98b", "IsFullscreen": "5ffe533b83", "IsMirrorWindowVisible": "7cb6efb98b", "IsMotionSmoothingEnabled": "7cb6efb98b", "IsMotionSmoothingSupported": "7cb6efb98b", "LastFrameRenderer is this": "5ffe533b83", "ShouldAppRenderWithLowResources": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene IVRInput state#/-/-": {"#v": {"IsUsingLegacyInput": false}, "IsUsingLegacyInput": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene IVROverlay state#/-/-": {"#v": {"CreateOverlay": 0, "DestroyOverlay": 0, "IsDashboardVisible": false, "PrimaryDashboardDevice": -1}, "CreateOverlay": "b6589fc6ab", "DestroyOverlay": "b6589fc6ab", "IsDashboardVisible": "7cb6efb98b", "PrimaryDashboardDevice": "7984b0a0e1", "s": "ok"}, + "app-type-answers/scene IVRSystem state#/-/-": {"#v": {"HmdActivityLevel": 1, "IsInputAvailable": true, "IsSteamVRDrawingControllers": false, "ShouldApplicationPause": false, "ShouldApplicationReduceRenderingWork": false}, "HmdActivityLevel": "356a192b79", "IsInputAvailable": "5ffe533b83", "IsSteamVRDrawingControllers": "7cb6efb98b", "ShouldApplicationPause": "7cb6efb98b", "ShouldApplicationReduceRenderingWork": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene Init#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "app-type-answers/scene left controller#/-/-": {"#v": {"found": false}, "found": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene right controller#/-/-": {"#v": {"found": false}, "found": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene startup events#/-/-": {"#v": {"any": true}, "any": "5ffe533b83", "s": "ok"}, + "app-type-answers/utility IVRApplications state#/-/-": {"#v": {"GetStartingApplication": 102, "SceneApplicationState": 0, "SceneProcessId is none": true, "SceneProcessId is this": false}, "GetStartingApplication": "c8306ae139", "SceneApplicationState": "b6589fc6ab", "SceneProcessId is none": "5ffe533b83", "SceneProcessId is this": "7cb6efb98b", "s": "ok"}, + "app-type-answers/utility Init#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "app-type-answers/utility no IVRChaperone_004#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRCompositor_029#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRInput_010#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVROverlay_028#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRSystem_022#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/vrmonitor Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "application-list/GetApplicationCount#/-/-": {"#v": {"count": 0}, "count": "b6589fc6ab", "s": "ok"}, "applications/AddApplicationManifest#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "applications/GetApplicationPropertyString Name#/-/-": {"#v": {"error": 0, "ret": 5, "value": "Echo"}, "error": "b6589fc6ab", "ret": "ac3478d69a", "s": "ok", "value": "b208a293d6"}, "applications/IsApplicationInstalled after removal#/-/-": {"#v": {"ret": false}, "ret": "7cb6efb98b", "s": "ok"}, @@ -41910,6 +41943,12 @@ "applications/LastLaunchTime#/-/-": {"#v": {"after_launch": true}, "after_launch": "5ffe533b83", "s": "ok"}, "applications/LaunchApplication#/-/-": {"#v": {"marker": true, "marker_text": "launched", "ret": 0}, "marker": "5ffe533b83", "marker_text": "595cf86673", "ret": "b6589fc6ab", "s": "ok"}, "applications/RemoveApplicationManifest#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "chaperone-colours/GetBoundsColor after SetSceneColor red#/-/-": {"#v": {"first g": 0.0, "first r": 0.0}, "first g": "38f6d7875e", "first r": "38f6d7875e", "s": "ok"}, + "chaperone-colours/GetBoundsColor#/-/-": {"#v": {"AreBoundsVisible": false, "camera a": 0.0, "colours": ["0.000000,0.000000,0.000000,0.000000", "0.000000,0.000000,0.000000,0.000000"]}, "AreBoundsVisible": "7cb6efb98b", "camera a": "38f6d7875e", "colours": "9adffda5cc", "s": "ok"}, + "chaperone-colours/GetLiveCollisionBoundsInfo#/-/-": {"#v": {"count": 4, "first quad": [[1.0, 0.0, -1.5], [1.0, 2.43, -1.5], [-1.0, 2.43, -1.5], [-1.0, 0.0, -1.5]], "ret": true}, "count": "1b64538924", "first quad": "48d78259b8", "ret": "5ffe533b83", "s": "ok"}, + "chaperone-colours/GetWorkingCollisionBoundsInfo#/-/-": {"#v": {"count": 4, "first quad": [[1.0, 0.0, -1.5], [1.0, 2.43, -1.5], [-1.0, 2.43, -1.5], [-1.0, 0.0, -1.5]], "ret": true}, "count": "1b64538924", "first quad": "48d78259b8", "ret": "5ffe533b83", "s": "ok"}, + "device-properties/GetTrackedDeviceIndexForControllerRole#/-/-": {"#v": {"0": -1, "1": -1, "2": -1, "3": -1, "4": -1, "5": -1}, "0": "7984b0a0e1", "1": "7984b0a0e1", "2": "7984b0a0e1", "3": "7984b0a0e1", "4": "7984b0a0e1", "5": "7984b0a0e1", "s": "ok"}, + "device-properties/device 0#/-/-": {"#v": {"ActivityLevel": 1, "ControllerType": "oculus", "ControllerType error": 0, "HandSelectionPriority": 0, "HandSelectionPriority error": 4, "HeadToEyeDepth": 0.0, "HeadToEyeDepth error": 0, "InputProfilePath": "oculus", "InputProfilePath error": 0, "RegisteredDeviceType": "oculus/F00BAAF00F", "RegisteredDeviceType error": 0, "RenderModelName": "oculusHmdRenderModel", "RenderModelName error": 0, "class": 1, "role": 0}, "ActivityLevel": "356a192b79", "ControllerType": "98c9da5c30", "ControllerType error": "b6589fc6ab", "HandSelectionPriority": "b6589fc6ab", "HandSelectionPriority error": "1b64538924", "HeadToEyeDepth": "38f6d7875e", "HeadToEyeDepth error": "b6589fc6ab", "InputProfilePath": "98c9da5c30", "InputProfilePath error": "b6589fc6ab", "RegisteredDeviceType": "ecc0d93a63", "RegisteredDeviceType error": "b6589fc6ab", "RenderModelName": "abb294af9e", "RenderModelName error": "b6589fc6ab", "class": "356a192b79", "role": "b6589fc6ab", "s": "ok"}, "frame-loop/frame 1#/-/-": {"#v": {"left": 0, "right": 0, "wait": 0}, "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, "frame-loop/frame 10#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, "frame-loop/frame 100#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, @@ -42030,6 +42069,12 @@ "frame-loop/frame 97#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, "frame-loop/frame 98#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, "frame-loop/frame 99#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, + "helper-app-controllers/background controllers#/-/-": {"#v": {"GetControllerState": false, "left connected": false, "left pose valid": false, "right connected": false, "right pose valid": false}, "GetControllerState": "7cb6efb98b", "left connected": "7cb6efb98b", "left pose valid": "7cb6efb98b", "right connected": "7cb6efb98b", "right pose valid": "7cb6efb98b", "s": "ok"}, + "helper-app-controllers/overlay Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "init-again/Init 0 while a scene app#/-/-": {"#v": {"IVRSystem after": true, "ret": 130}, "IVRSystem after": "5ffe533b83", "ret": "2a7541babb", "s": "ok"}, + "init-again/Init 2 while a scene app#/-/-": {"#v": {"IVRSystem after": true, "ret": 130}, "IVRSystem after": "5ffe533b83", "ret": "2a7541babb", "s": "ok"}, + "init-again/Init 3 while a scene app#/-/-": {"#v": {"IVRSystem after": true, "ret": 0}, "IVRSystem after": "5ffe533b83", "ret": "b6589fc6ab", "s": "ok"}, + "init-again/Init 4 while a scene app#/-/-": {"#v": {"IVRSystem after": true, "ret": 0}, "IVRSystem after": "5ffe533b83", "ret": "b6589fc6ab", "s": "ok"}, "init-matrix/BIsHmdPresent#/-/-": {"#v": {"ret": true}, "ret": "5ffe533b83", "s": "ok"}, "init-matrix/Init(0)#/-/-": {"#v": {"init_error": 130}, "init_error": "2a7541babb", "s": "ok"}, "init-matrix/Init(1)#/-/-": {"#v": {"init_error": 0}, "init_error": "b6589fc6ab", "s": "ok"}, @@ -42060,6 +42105,14 @@ "input-manifest/SetActionManifestPath#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "input-manifest/TriggerHapticVibrationAction#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "input-manifest/UpdateActionState#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "io-buffer/HasReaders#/-/-": {"#v": {"HasReaders": false, "PropertyContainer not 0": false}, "HasReaders": "7cb6efb98b", "PropertyContainer not 0": "7cb6efb98b", "s": "ok"}, + "io-buffer/Open create write#/-/-": {"#v": {"ret": 102}, "ret": "c8306ae139", "s": "ok"}, + "io-buffer/Open missing for reading#/-/-": {"#v": {"ret": 102}, "ret": "c8306ae139", "s": "ok"}, + "io-buffer/Open read#/-/-": {"#v": {"ret": 102}, "ret": "c8306ae139", "s": "ok"}, + "io-buffer/Read#/-/-": {"#v": {"read": 0, "ret": -1, "same": false}, "read": "b6589fc6ab", "ret": "7984b0a0e1", "s": "ok", "same": "7cb6efb98b"}, + "io-buffer/Write#/-/-": {"#v": {"ret": -1}, "ret": "7984b0a0e1", "s": "ok"}, + "legacy-controller/left no controller#/-/-": {"s": "ok"}, + "legacy-controller/right no controller#/-/-": {"s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_001#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_002#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_003#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, @@ -42298,6 +42351,9 @@ "lookup-before-init/before Init: IVRTrackedCamera_004#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/before Init: IVRTrackedCamera_005#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/before Init: IVRTrackedCamera_006#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, + "overlay-defaults/CreateOverlay#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "overlay-defaults/new overlay defaults#/-/-": {"#v": {"Panorama": false, "Panorama set": {"after": true, "ret": 0}, "SideBySide_Crossed": false, "SideBySide_Crossed set": {"after": true, "ret": 0}, "SideBySide_Parallel": false, "SideBySide_Parallel set": {"after": true, "ret": 0}, "StereoPanorama": false, "StereoPanorama set": {"after": true, "ret": 0}, "alpha": 1.0, "curvature": 0.0, "sort order": 0, "width": 1.0}, "Panorama": "7cb6efb98b", "Panorama set": "a0448f5be6", "SideBySide_Crossed": "7cb6efb98b", "SideBySide_Crossed set": "a0448f5be6", "SideBySide_Parallel": "7cb6efb98b", "SideBySide_Parallel set": "a0448f5be6", "StereoPanorama": "7cb6efb98b", "StereoPanorama set": "a0448f5be6", "alpha": "e8dc057d33", "curvature": "38f6d7875e", "s": "ok", "sort order": "b6589fc6ab", "width": "e8dc057d33"}, + "overlay-defaults/overlay events#/-/-": {"#v": {"overlay": [500, 501]}, "overlay": "f5548e34db", "s": "ok"}, "overlay-lifecycle/Alpha#/-/-": {"#v": {"expected": 0.5, "get": 0, "set": 0, "value": 0.5}, "expected": "1b390cd54a", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "1b390cd54a"}, "overlay-lifecycle/Color#/-/-": {"#v": {"expected": 80.25, "get": 0, "set": 0, "value": 80.25}, "expected": "af82116d4a", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "af82116d4a"}, "overlay-lifecycle/CreateOverlay#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, @@ -42314,6 +42370,35 @@ "overlay-lifecycle/TexelAspect#/-/-": {"#v": {"expected": 2.0, "get": 0, "set": 0, "value": 2.0}, "expected": "70142f6647", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "70142f6647"}, "overlay-lifecycle/TransformAbsolute#/-/-": {"#v": {"expected": 1.25, "get": 0, "set": 0, "value": 1.25}, "expected": "8e007eaa50", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "8e007eaa50"}, "overlay-lifecycle/WidthInMeters#/-/-": {"#v": {"expected": 1.5, "get": 0, "set": 0, "value": 1.5}, "expected": "aa8f289ebe", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "aa8f289ebe"}, + "render-model-components/GetRenderModelName#/-/-": {"#v": {"count": 31}, "count": "632667547e", "s": "ok"}, + "render-model-components/left render model components#/-/-": {"#v": {"components": 0, "model": ""}, "components": "b6589fc6ab", "model": "dd29ecf524", "s": "ok"}, + "render-model-components/right render model components#/-/-": {"#v": {"components": 0, "model": ""}, "components": "b6589fc6ab", "model": "dd29ecf524", "s": "ok"}, + "settings-defaults/SetFloat collisionBounds fade distance: events#/-/-": {"s": "ok"}, + "settings-defaults/audio/playbackDevice#/-/-": {"#v": {"empty": true, "error": 5}, "empty": "5ffe533b83", "error": "ac3478d69a", "s": "ok"}, + "settings-defaults/audio/recordingDevice#/-/-": {"#v": {"empty": true, "error": 5}, "empty": "5ffe533b83", "error": "ac3478d69a", "s": "ok"}, + "settings-defaults/collisionBounds/CollisionBoundsColorGammaA#/-/-": {"#v": {"error": 5, "float": 0.0}, "error": "ac3478d69a", "float": "38f6d7875e", "s": "ok"}, + "settings-defaults/collisionBounds/CollisionBoundsFadeDistance#/-/-": {"#v": {"error": 0, "float": 1.0}, "error": "b6589fc6ab", "float": "e8dc057d33", "s": "ok"}, + "settings-defaults/steamvr/background#/-/-": {"#v": {"empty": true, "error": 5}, "empty": "5ffe533b83", "error": "ac3478d69a", "s": "ok"}, + "settings-defaults/steamvr/ipd#/-/-": {"#v": {"error": 0, "float": 0.063}, "error": "b6589fc6ab", "float": "75aeb0fd5c", "s": "ok"}, + "settings-defaults/steamvr/supersampleScale#/-/-": {"#v": {"error": 0, "float": 1.0}, "error": "b6589fc6ab", "float": "e8dc057d33", "s": "ok"}, + "skeletal-input/GetActionOrigins#/-/-": {"#v": {"count": 0, "ret": 0}, "count": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/GetOriginLocalizedName -1#/-/-": {"#v": {"name": "", "ret": -1}, "name": "dd29ecf524", "ret": "7984b0a0e1", "s": "ok"}, + "skeletal-input/GetOriginLocalizedName 1#/-/-": {"#v": {"name": "", "ret": -1}, "name": "dd29ecf524", "ret": "7984b0a0e1", "s": "ok"}, + "skeletal-input/GetOriginLocalizedName 2#/-/-": {"#v": {"name": "", "ret": -1}, "name": "dd29ecf524", "ret": "7984b0a0e1", "s": "ok"}, + "skeletal-input/GetOriginLocalizedName 4#/-/-": {"#v": {"name": "", "ret": -1}, "name": "dd29ecf524", "ret": "7984b0a0e1", "s": "ok"}, + "skeletal-input/GetPoseActionDataForNextFrame#/-/-": {"#v": {"bActive": false, "bPoseIsValid": false, "ret": 0}, "bActive": "7cb6efb98b", "bPoseIsValid": "7cb6efb98b", "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/SetActionManifestPath again, another file#/-/-": {"#v": {"ret": 0, "trigger handle": 0}, "ret": "b6589fc6ab", "s": "ok", "trigger handle": "b6589fc6ab"}, + "skeletal-input/SetActionManifestPath#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/left GetSkeletalActionData#/-/-": {"#v": {"bActive": false, "ret": 0}, "bActive": "7cb6efb98b", "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/left GetSkeletalBoneData WithController#/-/-": {"#v": {"bone 1": [0.0, 0.0, 0.0], "bone 9": [0.0, 0.0, 0.0], "ret": 9}, "bone 1": "d1dd86519d", "bone 9": "d1dd86519d", "ret": "0ade7c2cf9", "s": "ok"}, + "skeletal-input/left GetSkeletalBoneData WithoutController#/-/-": {"#v": {"bone 1": [0.0, 0.0, 0.0], "bone 9": [0.0, 0.0, 0.0], "ret": 9}, "bone 1": "d1dd86519d", "bone 9": "d1dd86519d", "ret": "0ade7c2cf9", "s": "ok"}, + "skeletal-input/left GetSkeletalSummaryData FromAnimation#/-/-": {"#v": {"curl": [0.0, 0.0, 0.0, 0.0, 0.0], "ret": 0, "splay": [0.2, 0.2, 0.2, 0.2]}, "curl": "b83ccdd780", "ret": "b6589fc6ab", "s": "ok", "splay": "9037a65314"}, + "skeletal-input/left GetSkeletalSummaryData FromDevice#/-/-": {"#v": {"curl": [0.0, 0.0, 0.0, 0.0, 0.0], "ret": 0, "splay": [0.2, 0.2, 0.2, 0.2]}, "curl": "b83ccdd780", "ret": "b6589fc6ab", "s": "ok", "splay": "9037a65314"}, + "skeletal-input/right GetSkeletalActionData#/-/-": {"#v": {"bActive": false, "ret": 0}, "bActive": "7cb6efb98b", "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/right GetSkeletalBoneData WithController#/-/-": {"#v": {"bone 1": [0.0, 0.0, 0.0], "bone 9": [0.0, 0.0, 0.0], "ret": 9}, "bone 1": "d1dd86519d", "bone 9": "d1dd86519d", "ret": "0ade7c2cf9", "s": "ok"}, + "skeletal-input/right GetSkeletalBoneData WithoutController#/-/-": {"#v": {"bone 1": [0.0, 0.0, 0.0], "bone 9": [0.0, 0.0, 0.0], "ret": 9}, "bone 1": "d1dd86519d", "bone 9": "d1dd86519d", "ret": "0ade7c2cf9", "s": "ok"}, + "skeletal-input/right GetSkeletalSummaryData FromAnimation#/-/-": {"#v": {"curl": [0.0, 0.0, 0.0, 0.0, 0.0], "ret": 0, "splay": [0.2, 0.2, 0.2, 0.2]}, "curl": "b83ccdd780", "ret": "b6589fc6ab", "s": "ok", "splay": "9037a65314"}, + "skeletal-input/right GetSkeletalSummaryData FromDevice#/-/-": {"#v": {"curl": [0.0, 0.0, 0.0, 0.0, 0.0], "ret": 0, "splay": [0.2, 0.2, 0.2, 0.2]}, "curl": "b83ccdd780", "ret": "b6589fc6ab", "s": "ok", "splay": "9037a65314"}, "submit-edges/Background submit#/-/-": {"#v": {"init_error": 0, "ret": 103}, "init_error": "b6589fc6ab", "ret": "934385f53d", "s": "ok"}, "submit-edges/SetSkyboxOverride six faces#/-/-": {"#v": {"ret": 1}, "ret": "356a192b79", "s": "ok"}, "submit-edges/left again#/-/-": {"#v": {"ret": 108}, "ret": "17503a6b23", "s": "ok"}, @@ -42321,6 +42406,8 @@ "submit-edges/left#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "submit-edges/right not null#/-/-": {"#v": {"ret": 102}, "ret": "c8306ae139", "s": "ok"}, "submit-edges/right#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "submit-refusals/Overlay app submit#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "submit-refusals/Submit bounds#/-/-": {"#v": {"flipped bounds": 0, "zero-area bounds": 0}, "flipped bounds": "b6589fc6ab", "s": "ok", "zero-area bounds": "b6589fc6ab"}, "unknown-interface/FnTable:IVRNope_001#/-/-": {"#v": {"found": false, "init_error": 0, "lookup_error": 105}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "e114c448f4", "s": "ok"}, "unknown-interface/FnTable:IVRSystem_022#/-/-": {"#v": {"found": true, "init_error": 0, "lookup_error": 0}, "found": "5ffe533b83", "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "unknown-interface/IVRNope_001#/-/-": {"#v": {"found": false, "init_error": 0, "lookup_error": 105}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "e114c448f4", "s": "ok"}, diff --git a/tests/conformance/baseline/stand-in.json b/tests/conformance/baseline/stand-in.json index 8155b0a1..e4951ec0 100644 --- a/tests/conformance/baseline/stand-in.json +++ b/tests/conformance/baseline/stand-in.json @@ -2854,10 +2854,10 @@ "FnTable:IVRCompositor_019/GetVulkanDeviceExtensionsRequired#79/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_019/GetVulkanDeviceExtensionsRequired#79/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_019/GetVulkanDeviceExtensionsRequired#79/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_019/GetVulkanInstanceExtensionsRequired#78/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_019/GetVulkanInstanceExtensionsRequired#78/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_019/GetVulkanInstanceExtensionsRequired#78/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_019/GetVulkanInstanceExtensionsRequired#78/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_019/GetVulkanInstanceExtensionsRequired#78/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_019/GetVulkanInstanceExtensionsRequired#78/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_019/GetVulkanInstanceExtensionsRequired#78/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_019/GetVulkanInstanceExtensionsRequired#78/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_019/HideMirrorWindow#66/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_019/HideMirrorWindow#66/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_019/HideMirrorWindow#66/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -3014,10 +3014,10 @@ "FnTable:IVRCompositor_020/GetVulkanDeviceExtensionsRequired#81/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_020/GetVulkanDeviceExtensionsRequired#81/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_020/GetVulkanDeviceExtensionsRequired#81/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_020/GetVulkanInstanceExtensionsRequired#80/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_020/GetVulkanInstanceExtensionsRequired#80/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_020/GetVulkanInstanceExtensionsRequired#80/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_020/GetVulkanInstanceExtensionsRequired#80/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_020/GetVulkanInstanceExtensionsRequired#80/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_020/GetVulkanInstanceExtensionsRequired#80/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_020/GetVulkanInstanceExtensionsRequired#80/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_020/GetVulkanInstanceExtensionsRequired#80/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_020/HideMirrorWindow#67/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_020/HideMirrorWindow#67/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_020/HideMirrorWindow#67/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -3178,10 +3178,10 @@ "FnTable:IVRCompositor_021/GetVulkanDeviceExtensionsRequired#83/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_021/GetVulkanDeviceExtensionsRequired#83/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_021/GetVulkanDeviceExtensionsRequired#83/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_021/GetVulkanInstanceExtensionsRequired#82/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_021/GetVulkanInstanceExtensionsRequired#82/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_021/GetVulkanInstanceExtensionsRequired#82/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_021/GetVulkanInstanceExtensionsRequired#82/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_021/GetVulkanInstanceExtensionsRequired#82/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_021/GetVulkanInstanceExtensionsRequired#82/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_021/GetVulkanInstanceExtensionsRequired#82/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_021/GetVulkanInstanceExtensionsRequired#82/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_021/HideMirrorWindow#69/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_021/HideMirrorWindow#69/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_021/HideMirrorWindow#69/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -3350,10 +3350,10 @@ "FnTable:IVRCompositor_022/GetVulkanDeviceExtensionsRequired#86/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_022/GetVulkanDeviceExtensionsRequired#86/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_022/GetVulkanDeviceExtensionsRequired#86/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_022/GetVulkanInstanceExtensionsRequired#85/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_022/GetVulkanInstanceExtensionsRequired#85/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_022/GetVulkanInstanceExtensionsRequired#85/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_022/GetVulkanInstanceExtensionsRequired#85/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_022/GetVulkanInstanceExtensionsRequired#85/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_022/GetVulkanInstanceExtensionsRequired#85/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_022/GetVulkanInstanceExtensionsRequired#85/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_022/GetVulkanInstanceExtensionsRequired#85/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_022/HideMirrorWindow#72/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_022/HideMirrorWindow#72/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_022/HideMirrorWindow#72/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -3538,10 +3538,10 @@ "FnTable:IVRCompositor_024/GetVulkanDeviceExtensionsRequired#88/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_024/GetVulkanDeviceExtensionsRequired#88/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_024/GetVulkanDeviceExtensionsRequired#88/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_024/GetVulkanInstanceExtensionsRequired#87/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_024/GetVulkanInstanceExtensionsRequired#87/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_024/GetVulkanInstanceExtensionsRequired#87/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_024/GetVulkanInstanceExtensionsRequired#87/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_024/GetVulkanInstanceExtensionsRequired#87/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_024/GetVulkanInstanceExtensionsRequired#87/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_024/GetVulkanInstanceExtensionsRequired#87/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_024/GetVulkanInstanceExtensionsRequired#87/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_024/HideMirrorWindow#74/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_024/HideMirrorWindow#74/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_024/HideMirrorWindow#74/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -3742,10 +3742,10 @@ "FnTable:IVRCompositor_026/GetVulkanDeviceExtensionsRequired#91/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_026/GetVulkanDeviceExtensionsRequired#91/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_026/GetVulkanDeviceExtensionsRequired#91/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_026/GetVulkanInstanceExtensionsRequired#90/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_026/GetVulkanInstanceExtensionsRequired#90/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_026/GetVulkanInstanceExtensionsRequired#90/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_026/GetVulkanInstanceExtensionsRequired#90/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_026/GetVulkanInstanceExtensionsRequired#90/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_026/GetVulkanInstanceExtensionsRequired#90/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_026/GetVulkanInstanceExtensionsRequired#90/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_026/GetVulkanInstanceExtensionsRequired#90/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_026/HideMirrorWindow#77/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_026/HideMirrorWindow#77/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_026/HideMirrorWindow#77/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -3946,10 +3946,10 @@ "FnTable:IVRCompositor_027/GetVulkanDeviceExtensionsRequired#91/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_027/GetVulkanDeviceExtensionsRequired#91/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_027/GetVulkanDeviceExtensionsRequired#91/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_027/GetVulkanInstanceExtensionsRequired#90/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_027/GetVulkanInstanceExtensionsRequired#90/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_027/GetVulkanInstanceExtensionsRequired#90/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_027/GetVulkanInstanceExtensionsRequired#90/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_027/GetVulkanInstanceExtensionsRequired#90/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_027/GetVulkanInstanceExtensionsRequired#90/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_027/GetVulkanInstanceExtensionsRequired#90/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_027/GetVulkanInstanceExtensionsRequired#90/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_027/HideMirrorWindow#77/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_027/HideMirrorWindow#77/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_027/HideMirrorWindow#77/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -4150,10 +4150,10 @@ "FnTable:IVRCompositor_028/GetVulkanDeviceExtensionsRequired#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_028/GetVulkanDeviceExtensionsRequired#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_028/GetVulkanDeviceExtensionsRequired#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_028/GetVulkanInstanceExtensionsRequired#92/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_028/GetVulkanInstanceExtensionsRequired#92/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_028/GetVulkanInstanceExtensionsRequired#92/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_028/GetVulkanInstanceExtensionsRequired#92/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_028/GetVulkanInstanceExtensionsRequired#92/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_028/GetVulkanInstanceExtensionsRequired#92/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_028/GetVulkanInstanceExtensionsRequired#92/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_028/GetVulkanInstanceExtensionsRequired#92/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_028/HideMirrorWindow#79/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_028/HideMirrorWindow#79/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_028/HideMirrorWindow#79/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -4362,10 +4362,10 @@ "FnTable:IVRCompositor_029/GetVulkanDeviceExtensionsRequired#95/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_029/GetVulkanDeviceExtensionsRequired#95/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "FnTable:IVRCompositor_029/GetVulkanDeviceExtensionsRequired#95/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "FnTable:IVRCompositor_029/GetVulkanInstanceExtensionsRequired#94/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_029/GetVulkanInstanceExtensionsRequired#94/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_029/GetVulkanInstanceExtensionsRequired#94/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "FnTable:IVRCompositor_029/GetVulkanInstanceExtensionsRequired#94/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "FnTable:IVRCompositor_029/GetVulkanInstanceExtensionsRequired#94/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_029/GetVulkanInstanceExtensionsRequired#94/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_029/GetVulkanInstanceExtensionsRequired#94/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "FnTable:IVRCompositor_029/GetVulkanInstanceExtensionsRequired#94/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "FnTable:IVRCompositor_029/HideMirrorWindow#81/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_029/HideMirrorWindow#81/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRCompositor_029/HideMirrorWindow#81/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -12518,10 +12518,10 @@ "FnTable:IVRRenderModels_001/GetComponentState#17/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_001/GetComponentState#17/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_001/GetComponentState#17/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_001/GetRenderModelCount#12/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_001/GetRenderModelName#11/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRRenderModels_001/GetRenderModelName#11/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "FnTable:IVRRenderModels_001/GetRenderModelName#11/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -12558,10 +12558,10 @@ "FnTable:IVRRenderModels_002/GetComponentState#22/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_002/GetComponentState#22/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_002/GetComponentState#22/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_002/GetRenderModelCount#17/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_002/GetRenderModelName#16/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRRenderModels_002/GetRenderModelName#16/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "FnTable:IVRRenderModels_002/GetRenderModelName#16/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -12610,10 +12610,10 @@ "FnTable:IVRRenderModels_004/GetComponentState#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_004/GetComponentState#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_004/GetComponentState#26/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_004/GetRenderModelCount#21/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_004/GetRenderModelName#20/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "FnTable:IVRRenderModels_004/GetRenderModelName#20/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "FnTable:IVRRenderModels_004/GetRenderModelName#20/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -12666,10 +12666,10 @@ "FnTable:IVRRenderModels_005/GetComponentState#31/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_005/GetComponentState#31/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_005/GetComponentState#31/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_005/GetRenderModelCount#26/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_005/GetRenderModelErrorNameFromEnum#35/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (2147483647)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "cad273f75e", "s": "ok"}, "FnTable:IVRRenderModels_005/GetRenderModelErrorNameFromEnum#35/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (32767)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "d35bc06b8f", "s": "ok"}, "FnTable:IVRRenderModels_005/GetRenderModelErrorNameFromEnum#35/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "VRRenderModelError_None (0)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "fca1a7bcf5", "s": "ok"}, @@ -12742,10 +12742,10 @@ "FnTable:IVRRenderModels_006/GetComponentStateForDevicePath#32/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_006/GetComponentStateForDevicePath#32/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "FnTable:IVRRenderModels_006/GetComponentStateForDevicePath#32/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "FnTable:IVRRenderModels_006/GetRenderModelCount#27/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "FnTable:IVRRenderModels_006/GetRenderModelErrorNameFromEnum#37/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (2147483647)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "cad273f75e", "s": "ok"}, "FnTable:IVRRenderModels_006/GetRenderModelErrorNameFromEnum#37/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (32767)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "d35bc06b8f", "s": "ok"}, "FnTable:IVRRenderModels_006/GetRenderModelErrorNameFromEnum#37/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "VRRenderModelError_None (0)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "fca1a7bcf5", "s": "ok"}, @@ -15505,10 +15505,10 @@ "FnTable:IVRSystem_020/GetRecommendedRenderTargetSize#48/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_020/GetRecommendedRenderTargetSize#48/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_020/GetRecommendedRenderTargetSize#48/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_020/GetRuntimeVersion#95/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#61/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#61/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#61/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -15693,10 +15693,10 @@ "FnTable:IVRSystem_021/GetRecommendedRenderTargetSize#47/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_021/GetRecommendedRenderTargetSize#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_021/GetRecommendedRenderTargetSize#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_021/GetRuntimeVersion#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#60/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#60/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#60/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -15881,10 +15881,10 @@ "FnTable:IVRSystem_022/GetRecommendedRenderTargetSize#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_022/GetRecommendedRenderTargetSize#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_022/GetRecommendedRenderTargetSize#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_022/GetRuntimeVersion#91/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#58/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#58/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#58/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -16065,10 +16065,10 @@ "FnTable:IVRSystem_023/GetRecommendedRenderTargetSize#47/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_023/GetRecommendedRenderTargetSize#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_023/GetRecommendedRenderTargetSize#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_023/GetRuntimeVersion#93/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#59/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#59/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#59/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -16265,10 +16265,10 @@ "FnTable:IVRSystem_026/GetRecommendedRenderTargetSize#51/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_026/GetRecommendedRenderTargetSize#51/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "FnTable:IVRSystem_026/GetRecommendedRenderTargetSize#51/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "FnTable:IVRSystem_026/GetRuntimeVersion#100/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "FnTable:IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#64/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#64/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "FnTable:IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#64/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -19618,10 +19618,10 @@ "IVRCompositor_019/GetVulkanDeviceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_019/GetVulkanDeviceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_019/GetVulkanDeviceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_019/GetVulkanInstanceExtensionsRequired#38/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_019/GetVulkanInstanceExtensionsRequired#38/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_019/GetVulkanInstanceExtensionsRequired#38/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_019/GetVulkanInstanceExtensionsRequired#38/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_019/GetVulkanInstanceExtensionsRequired#38/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_019/GetVulkanInstanceExtensionsRequired#38/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_019/GetVulkanInstanceExtensionsRequired#38/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_019/GetVulkanInstanceExtensionsRequired#38/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_019/HideMirrorWindow#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_019/HideMirrorWindow#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_019/HideMirrorWindow#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -19782,10 +19782,10 @@ "IVRCompositor_020/GetVulkanDeviceExtensionsRequired#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_020/GetVulkanDeviceExtensionsRequired#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_020/GetVulkanDeviceExtensionsRequired#40/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_020/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_020/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_020/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_020/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_020/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_020/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_020/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_020/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_020/HideMirrorWindow#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_020/HideMirrorWindow#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_020/HideMirrorWindow#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -19950,10 +19950,10 @@ "IVRCompositor_021/GetVulkanDeviceExtensionsRequired#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_021/GetVulkanDeviceExtensionsRequired#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_021/GetVulkanDeviceExtensionsRequired#40/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_021/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_021/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_021/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_021/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_021/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_021/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_021/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_021/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_021/HideMirrorWindow#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_021/HideMirrorWindow#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_021/HideMirrorWindow#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -20126,10 +20126,10 @@ "IVRCompositor_022/GetVulkanDeviceExtensionsRequired#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_022/GetVulkanDeviceExtensionsRequired#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_022/GetVulkanDeviceExtensionsRequired#40/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_022/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_022/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_022/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_022/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_022/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_022/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_022/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_022/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_022/HideMirrorWindow#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_022/HideMirrorWindow#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_022/HideMirrorWindow#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -20318,10 +20318,10 @@ "IVRCompositor_024/GetVulkanDeviceExtensionsRequired#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_024/GetVulkanDeviceExtensionsRequired#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_024/GetVulkanDeviceExtensionsRequired#40/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_024/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_024/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_024/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_024/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_024/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_024/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_024/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_024/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_024/HideMirrorWindow#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_024/HideMirrorWindow#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_024/HideMirrorWindow#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -20526,10 +20526,10 @@ "IVRCompositor_026/GetVulkanDeviceExtensionsRequired#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_026/GetVulkanDeviceExtensionsRequired#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_026/GetVulkanDeviceExtensionsRequired#40/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_026/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_026/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_026/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_026/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_026/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_026/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_026/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_026/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_026/HideMirrorWindow#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_026/HideMirrorWindow#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_026/HideMirrorWindow#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -20734,10 +20734,10 @@ "IVRCompositor_027/GetVulkanDeviceExtensionsRequired#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_027/GetVulkanDeviceExtensionsRequired#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_027/GetVulkanDeviceExtensionsRequired#40/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_027/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_027/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_027/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_027/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_027/GetVulkanInstanceExtensionsRequired#39/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_027/GetVulkanInstanceExtensionsRequired#39/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_027/GetVulkanInstanceExtensionsRequired#39/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_027/GetVulkanInstanceExtensionsRequired#39/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_027/HideMirrorWindow#26/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_027/HideMirrorWindow#26/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_027/HideMirrorWindow#26/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -20942,10 +20942,10 @@ "IVRCompositor_028/GetVulkanDeviceExtensionsRequired#41/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_028/GetVulkanDeviceExtensionsRequired#41/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_028/GetVulkanDeviceExtensionsRequired#41/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_028/GetVulkanInstanceExtensionsRequired#40/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_028/GetVulkanInstanceExtensionsRequired#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_028/GetVulkanInstanceExtensionsRequired#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_028/GetVulkanInstanceExtensionsRequired#40/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_028/GetVulkanInstanceExtensionsRequired#40/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_028/GetVulkanInstanceExtensionsRequired#40/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_028/GetVulkanInstanceExtensionsRequired#40/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_028/GetVulkanInstanceExtensionsRequired#40/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_028/HideMirrorWindow#27/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_028/HideMirrorWindow#27/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_028/HideMirrorWindow#27/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -21158,10 +21158,10 @@ "IVRCompositor_029/GetVulkanDeviceExtensionsRequired#42/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_029/GetVulkanDeviceExtensionsRequired#42/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "601ca99d55", "s": "ok"}, "IVRCompositor_029/GetVulkanDeviceExtensionsRequired#42/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_dedicated_allocation VK_KHR_get_memory_requirements2"}, "ret": 112}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6820b2e9b9", "ret": "601ca99d55", "s": "ok"}, - "IVRCompositor_029/GetVulkanInstanceExtensionsRequired#41/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_029/GetVulkanInstanceExtensionsRequired#41/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_029/GetVulkanInstanceExtensionsRequired#41/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "450ddec8dd", "s": "ok"}, - "IVRCompositor_029/GetVulkanInstanceExtensionsRequired#41/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 75}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "58f21aab45", "ret": "450ddec8dd", "s": "ok"}, + "IVRCompositor_029/GetVulkanInstanceExtensionsRequired#41/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": ""}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4a514918a4", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_029/GetVulkanInstanceExtensionsRequired#41/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_029/GetVulkanInstanceExtensionsRequired#41/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "null"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d993daa493", "ret": "ecb7937db5", "s": "ok"}, + "IVRCompositor_029/GetVulkanInstanceExtensionsRequired#41/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchValue": "VK_KHR_external_memory_capabilities VK_KHR_external_semaphore_capabilities VK_KHR_get_physical_device_properties2"}, "ret": 114}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "e560873797", "ret": "ecb7937db5", "s": "ok"}, "IVRCompositor_029/HideMirrorWindow#28/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_029/HideMirrorWindow#28/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRCompositor_029/HideMirrorWindow#28/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, @@ -29530,10 +29530,10 @@ "IVRRenderModels_001/GetComponentState#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_001/GetComponentState#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_001/GetComponentState#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_001/GetRenderModelCount#3/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_001/GetRenderModelCount#3/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_001/GetRenderModelName#2/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "IVRRenderModels_001/GetRenderModelName#2/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "IVRRenderModels_001/GetRenderModelName#2/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -29574,10 +29574,10 @@ "IVRRenderModels_002/GetComponentState#10/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_002/GetComponentState#10/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_002/GetComponentState#10/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_002/GetRenderModelCount#5/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_002/GetRenderModelCount#5/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_002/GetRenderModelName#4/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "IVRRenderModels_002/GetRenderModelName#4/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "IVRRenderModels_002/GetRenderModelName#4/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -29630,10 +29630,10 @@ "IVRRenderModels_004/GetComponentState#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_004/GetComponentState#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_004/GetComponentState#12/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_004/GetRenderModelCount#7/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_004/GetRenderModelCount#7/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_004/GetRenderModelName#6/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": ""}, "ret": 0}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "d869e87f65", "ret": "b6589fc6ab", "s": "ok"}, "IVRRenderModels_004/GetRenderModelName#6/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, "IVRRenderModels_004/GetRenderModelName#6/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pchRenderModelName": "null"}, "ret": 15}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "a561d7c5c8", "ret": "f1abd67035", "s": "ok"}, @@ -29690,10 +29690,10 @@ "IVRRenderModels_005/GetComponentState#13/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_005/GetComponentState#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_005/GetComponentState#13/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_005/GetRenderModelCount#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_005/GetRenderModelCount#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_005/GetRenderModelErrorNameFromEnum#17/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (2147483647)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "cad273f75e", "s": "ok"}, "IVRRenderModels_005/GetRenderModelErrorNameFromEnum#17/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (32767)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "d35bc06b8f", "s": "ok"}, "IVRRenderModels_005/GetRenderModelErrorNameFromEnum#17/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "VRRenderModelError_None (0)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "fca1a7bcf5", "s": "ok"}, @@ -29770,10 +29770,10 @@ "IVRRenderModels_006/GetComponentStateForDevicePath#13/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_006/GetComponentStateForDevicePath#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pComponentState": "null"}, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "6fe1ffadd1", "ret": "7cb6efb98b", "s": "ok"}, "IVRRenderModels_006/GetComponentStateForDevicePath#13/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "ret": false}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "c479dc2ed1", "ret": "7cb6efb98b", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, - "IVRRenderModels_006/GetRenderModelCount#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 7}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "902ba3cda1", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, + "IVRRenderModels_006/GetRenderModelCount#8/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": 31}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632667547e", "s": "ok"}, "IVRRenderModels_006/GetRenderModelErrorNameFromEnum#18/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (2147483647)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "cad273f75e", "s": "ok"}, "IVRRenderModels_006/GetRenderModelErrorNameFromEnum#18/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "Unknown render model error (32767)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "d35bc06b8f", "s": "ok"}, "IVRRenderModels_006/GetRenderModelErrorNameFromEnum#18/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "VRRenderModelError_None (0)"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "fca1a7bcf5", "s": "ok"}, @@ -32614,10 +32614,10 @@ "IVRSystem_020/GetRecommendedRenderTargetSize#0/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_020/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_020/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_020/GetRuntimeVersion#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_020/GetRuntimeVersion#47/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_020/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -32806,10 +32806,10 @@ "IVRSystem_021/GetRecommendedRenderTargetSize#0/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_021/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_021/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_021/GetRuntimeVersion#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_021/GetRuntimeVersion#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_021/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -32998,10 +32998,10 @@ "IVRSystem_022/GetRecommendedRenderTargetSize#0/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_022/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_022/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_022/GetRuntimeVersion#45/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_022/GetRuntimeVersion#45/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_022/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -33186,10 +33186,10 @@ "IVRSystem_023/GetRecommendedRenderTargetSize#0/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_023/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_023/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_023/GetRuntimeVersion#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_023/GetRuntimeVersion#46/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_023/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -33390,10 +33390,10 @@ "IVRSystem_026/GetRecommendedRenderTargetSize#0/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_026/GetRecommendedRenderTargetSize#0/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": "null", "pnWidth": "null"}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "0bd3635301", "ret": "2be88ca424", "s": "ok"}, "IVRSystem_026/GetRecommendedRenderTargetSize#0/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {"pnHeight": 1920, "pnWidth": 1920}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "4e9291bf49", "ret": "2be88ca424", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, - "IVRSystem_026/GetRuntimeVersion#49/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "1.16.8"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "4b1ef92222", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, + "IVRSystem_026/GetRuntimeVersion#49/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "2.15.6"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "632b07e450", "s": "ok"}, "IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/edge": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, "IVRSystem_026/GetSeatedZeroPoseToStandingAbsoluteTrackingPose#13/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": "0000803f000000000000000000000000000000000000803f000000000000000000000000000000000000803f00000000"}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "7e6fdd13b6", "s": "ok"}, @@ -33810,6 +33810,29 @@ "IVRTrackedCamera_006/SetCameraTrackingSpace#12/1/invalid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRTrackedCamera_006/SetCameraTrackingSpace#12/1/null": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, "IVRTrackedCamera_006/SetCameraTrackingSpace#12/1/valid": {"#v": {"init_error": 0, "lookup_error": 0, "out": {}, "ret": null}, "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "out": "bf21a9e8fb", "ret": "2be88ca424", "s": "ok"}, + "app-type-answers/background Init#/-/-": {"#v": {"ret": 121}, "ret": "8bd7954c40", "s": "ok"}, + "app-type-answers/other Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "app-type-answers/overlay Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "app-type-answers/scene GetSortedTrackedDeviceIndicesOfClass#/-/-": {"#v": {"controllers": 0}, "controllers": "b6589fc6ab", "s": "ok"}, + "app-type-answers/scene IVRApplications state#/-/-": {"#v": {"GetStartingApplication": 102, "SceneApplicationState": 4, "SceneProcessId is none": false, "SceneProcessId is this": true}, "GetStartingApplication": "c8306ae139", "SceneApplicationState": "1b64538924", "SceneProcessId is none": "7cb6efb98b", "SceneProcessId is this": "5ffe533b83", "s": "ok"}, + "app-type-answers/scene IVRChaperone state#/-/-": {"#v": {"AreBoundsVisible": false, "GetCalibrationState": 1}, "AreBoundsVisible": "7cb6efb98b", "GetCalibrationState": "356a192b79", "s": "ok"}, + "app-type-answers/scene IVRCompositor state#/-/-": {"#v": {"CanRenderScene": true, "CurrentSceneFocusProcess is none": false, "CurrentSceneFocusProcess is this": true, "GetTrackingSpace": 1, "IsCurrentSceneFocusAppLoading": false, "IsFullscreen": true, "IsMirrorWindowVisible": false, "IsMotionSmoothingEnabled": false, "IsMotionSmoothingSupported": false, "LastFrameRenderer is this": true, "ShouldAppRenderWithLowResources": false}, "CanRenderScene": "5ffe533b83", "CurrentSceneFocusProcess is none": "7cb6efb98b", "CurrentSceneFocusProcess is this": "5ffe533b83", "GetTrackingSpace": "356a192b79", "IsCurrentSceneFocusAppLoading": "7cb6efb98b", "IsFullscreen": "5ffe533b83", "IsMirrorWindowVisible": "7cb6efb98b", "IsMotionSmoothingEnabled": "7cb6efb98b", "IsMotionSmoothingSupported": "7cb6efb98b", "LastFrameRenderer is this": "5ffe533b83", "ShouldAppRenderWithLowResources": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene IVRInput state#/-/-": {"#v": {"IsUsingLegacyInput": false}, "IsUsingLegacyInput": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene IVROverlay state#/-/-": {"#v": {"CreateOverlay": 0, "DestroyOverlay": 0, "IsDashboardVisible": false, "PrimaryDashboardDevice": -1}, "CreateOverlay": "b6589fc6ab", "DestroyOverlay": "b6589fc6ab", "IsDashboardVisible": "7cb6efb98b", "PrimaryDashboardDevice": "7984b0a0e1", "s": "ok"}, + "app-type-answers/scene IVRSystem state#/-/-": {"#v": {"HmdActivityLevel": 1, "IsInputAvailable": true, "IsSteamVRDrawingControllers": false, "ShouldApplicationPause": false, "ShouldApplicationReduceRenderingWork": false}, "HmdActivityLevel": "356a192b79", "IsInputAvailable": "5ffe533b83", "IsSteamVRDrawingControllers": "7cb6efb98b", "ShouldApplicationPause": "7cb6efb98b", "ShouldApplicationReduceRenderingWork": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene Init#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "app-type-answers/scene left controller#/-/-": {"#v": {"found": false}, "found": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene right controller#/-/-": {"#v": {"found": false}, "found": "7cb6efb98b", "s": "ok"}, + "app-type-answers/scene startup events#/-/-": {"#v": {"any": true}, "any": "5ffe533b83", "s": "ok"}, + "app-type-answers/utility IVRApplications state#/-/-": {"#v": {"GetStartingApplication": 102, "SceneApplicationState": 0, "SceneProcessId is none": true, "SceneProcessId is this": false}, "GetStartingApplication": "c8306ae139", "SceneApplicationState": "b6589fc6ab", "SceneProcessId is none": "5ffe533b83", "SceneProcessId is this": "7cb6efb98b", "s": "ok"}, + "app-type-answers/utility Init#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "app-type-answers/utility no IVRChaperone_004#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRCompositor_029#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRInput_010#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVROverlay_028#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/utility no IVRSystem_022#/-/-": {"#v": {"ret": 123}, "ret": "40bd001563", "s": "ok"}, + "app-type-answers/vrmonitor Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "application-list/GetApplicationCount#/-/-": {"#v": {"count": 0}, "count": "b6589fc6ab", "s": "ok"}, "applications/AddApplicationManifest#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "applications/GetApplicationPropertyString Name#/-/-": {"#v": {"error": 0, "ret": 5, "value": "Echo"}, "error": "b6589fc6ab", "ret": "ac3478d69a", "s": "ok", "value": "b208a293d6"}, "applications/IsApplicationInstalled after removal#/-/-": {"#v": {"ret": false}, "ret": "7cb6efb98b", "s": "ok"}, @@ -33817,6 +33840,12 @@ "applications/LastLaunchTime#/-/-": {"#v": {"after_launch": true}, "after_launch": "5ffe533b83", "s": "ok"}, "applications/LaunchApplication#/-/-": {"#v": {"marker": true, "marker_text": "launched", "ret": 0}, "marker": "5ffe533b83", "marker_text": "595cf86673", "ret": "b6589fc6ab", "s": "ok"}, "applications/RemoveApplicationManifest#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "chaperone-colours/GetBoundsColor after SetSceneColor red#/-/-": {"#v": {"first g": 0.0, "first r": 0.0}, "first g": "38f6d7875e", "first r": "38f6d7875e", "s": "ok"}, + "chaperone-colours/GetBoundsColor#/-/-": {"#v": {"AreBoundsVisible": false, "camera a": 0.0, "colours": ["0.000000,0.000000,0.000000,0.000000", "0.000000,0.000000,0.000000,0.000000"]}, "AreBoundsVisible": "7cb6efb98b", "camera a": "38f6d7875e", "colours": "9adffda5cc", "s": "ok"}, + "chaperone-colours/GetLiveCollisionBoundsInfo#/-/-": {"#v": {"count": 4, "first quad": [[1.0, 0.0, -1.5], [1.0, 2.43, -1.5], [-1.0, 2.43, -1.5], [-1.0, 0.0, -1.5]], "ret": true}, "count": "1b64538924", "first quad": "48d78259b8", "ret": "5ffe533b83", "s": "ok"}, + "chaperone-colours/GetWorkingCollisionBoundsInfo#/-/-": {"#v": {"count": 4, "first quad": [[1.0, 0.0, -1.5], [1.0, 2.43, -1.5], [-1.0, 2.43, -1.5], [-1.0, 0.0, -1.5]], "ret": true}, "count": "1b64538924", "first quad": "48d78259b8", "ret": "5ffe533b83", "s": "ok"}, + "device-properties/GetTrackedDeviceIndexForControllerRole#/-/-": {"#v": {"0": -1, "1": -1, "2": -1, "3": -1, "4": -1, "5": -1}, "0": "7984b0a0e1", "1": "7984b0a0e1", "2": "7984b0a0e1", "3": "7984b0a0e1", "4": "7984b0a0e1", "5": "7984b0a0e1", "s": "ok"}, + "device-properties/device 0#/-/-": {"#v": {"ActivityLevel": 1, "ControllerType": "oculus", "ControllerType error": 0, "HandSelectionPriority": 0, "HandSelectionPriority error": 4, "HeadToEyeDepth": 0.0, "HeadToEyeDepth error": 0, "InputProfilePath": "oculus", "InputProfilePath error": 0, "RegisteredDeviceType": "oculus/F00BAAF00F", "RegisteredDeviceType error": 0, "RenderModelName": "oculusHmdRenderModel", "RenderModelName error": 0, "class": 1, "role": 0}, "ActivityLevel": "356a192b79", "ControllerType": "98c9da5c30", "ControllerType error": "b6589fc6ab", "HandSelectionPriority": "b6589fc6ab", "HandSelectionPriority error": "1b64538924", "HeadToEyeDepth": "38f6d7875e", "HeadToEyeDepth error": "b6589fc6ab", "InputProfilePath": "98c9da5c30", "InputProfilePath error": "b6589fc6ab", "RegisteredDeviceType": "ecc0d93a63", "RegisteredDeviceType error": "b6589fc6ab", "RenderModelName": "abb294af9e", "RenderModelName error": "b6589fc6ab", "class": "356a192b79", "role": "b6589fc6ab", "s": "ok"}, "frame-loop/frame 1#/-/-": {"#v": {"left": 0, "right": 0, "wait": 0}, "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, "frame-loop/frame 10#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, "frame-loop/frame 100#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, @@ -33937,6 +33966,12 @@ "frame-loop/frame 97#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, "frame-loop/frame 98#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, "frame-loop/frame 99#/-/-": {"#v": {"events": [], "left": 0, "right": 0, "wait": 0}, "events": "97d170e155", "left": "b6589fc6ab", "right": "b6589fc6ab", "s": "ok", "wait": "b6589fc6ab"}, + "helper-app-controllers/background Init#/-/-": {"#v": {"ret": 121}, "ret": "8bd7954c40", "s": "ok"}, + "helper-app-controllers/overlay Init#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "init-again/Init 0 while a scene app#/-/-": {"#v": {"IVRSystem after": true, "ret": 130}, "IVRSystem after": "5ffe533b83", "ret": "2a7541babb", "s": "ok"}, + "init-again/Init 2 while a scene app#/-/-": {"#v": {"IVRSystem after": true, "ret": 130}, "IVRSystem after": "5ffe533b83", "ret": "2a7541babb", "s": "ok"}, + "init-again/Init 3 while a scene app#/-/-": {"#v": {"IVRSystem after": true, "ret": 121}, "IVRSystem after": "5ffe533b83", "ret": "8bd7954c40", "s": "ok"}, + "init-again/Init 4 while a scene app#/-/-": {"#v": {"IVRSystem after": true, "ret": 0}, "IVRSystem after": "5ffe533b83", "ret": "b6589fc6ab", "s": "ok"}, "init-matrix/BIsHmdPresent#/-/-": {"#v": {"ret": true}, "ret": "5ffe533b83", "s": "ok"}, "init-matrix/Init(0)#/-/-": {"#v": {"init_error": 130}, "init_error": "2a7541babb", "s": "ok"}, "init-matrix/Init(1)#/-/-": {"#v": {"init_error": 0}, "init_error": "b6589fc6ab", "s": "ok"}, @@ -33967,6 +34002,14 @@ "input-manifest/SetActionManifestPath#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "input-manifest/TriggerHapticVibrationAction#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "input-manifest/UpdateActionState#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "io-buffer/HasReaders#/-/-": {"#v": {"HasReaders": false, "PropertyContainer not 0": false}, "HasReaders": "7cb6efb98b", "PropertyContainer not 0": "7cb6efb98b", "s": "ok"}, + "io-buffer/Open create write#/-/-": {"#v": {"ret": 102}, "ret": "c8306ae139", "s": "ok"}, + "io-buffer/Open missing for reading#/-/-": {"#v": {"ret": 102}, "ret": "c8306ae139", "s": "ok"}, + "io-buffer/Open read#/-/-": {"#v": {"ret": 102}, "ret": "c8306ae139", "s": "ok"}, + "io-buffer/Read#/-/-": {"#v": {"read": 0, "ret": -1, "same": false}, "read": "b6589fc6ab", "ret": "7984b0a0e1", "s": "ok", "same": "7cb6efb98b"}, + "io-buffer/Write#/-/-": {"#v": {"ret": -1}, "ret": "7984b0a0e1", "s": "ok"}, + "legacy-controller/left no controller#/-/-": {"s": "ok"}, + "legacy-controller/right no controller#/-/-": {"s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_001#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_002#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/after Cleanup: IVRApplications_003#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, @@ -34205,6 +34248,9 @@ "lookup-before-init/before Init: IVRTrackedCamera_004#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/before Init: IVRTrackedCamera_005#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, "lookup-before-init/before Init: IVRTrackedCamera_006#/-/-": {"#v": {"found": false, "lookup_error": 109}, "found": "7cb6efb98b", "lookup_error": "a1422e6a16", "s": "ok"}, + "overlay-defaults/CreateOverlay#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "overlay-defaults/new overlay defaults#/-/-": {"#v": {"Panorama": false, "Panorama set": {"after": true, "ret": 0}, "SideBySide_Crossed": false, "SideBySide_Crossed set": {"after": true, "ret": 0}, "SideBySide_Parallel": false, "SideBySide_Parallel set": {"after": true, "ret": 0}, "StereoPanorama": false, "StereoPanorama set": {"after": true, "ret": 0}, "alpha": 1.0, "curvature": 0.0, "sort order": 0, "width": 1.0}, "Panorama": "7cb6efb98b", "Panorama set": "a0448f5be6", "SideBySide_Crossed": "7cb6efb98b", "SideBySide_Crossed set": "a0448f5be6", "SideBySide_Parallel": "7cb6efb98b", "SideBySide_Parallel set": "a0448f5be6", "StereoPanorama": "7cb6efb98b", "StereoPanorama set": "a0448f5be6", "alpha": "e8dc057d33", "curvature": "38f6d7875e", "s": "ok", "sort order": "b6589fc6ab", "width": "e8dc057d33"}, + "overlay-defaults/overlay events#/-/-": {"#v": {"overlay": [500, 501]}, "overlay": "f5548e34db", "s": "ok"}, "overlay-lifecycle/Alpha#/-/-": {"#v": {"expected": 0.5, "get": 0, "set": 0, "value": 0.5}, "expected": "1b390cd54a", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "1b390cd54a"}, "overlay-lifecycle/Color#/-/-": {"#v": {"expected": 80.25, "get": 0, "set": 0, "value": 80.25}, "expected": "af82116d4a", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "af82116d4a"}, "overlay-lifecycle/CreateOverlay#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, @@ -34221,6 +34267,35 @@ "overlay-lifecycle/TexelAspect#/-/-": {"#v": {"expected": 2.0, "get": 0, "set": 0, "value": 2.0}, "expected": "70142f6647", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "70142f6647"}, "overlay-lifecycle/TransformAbsolute#/-/-": {"#v": {"expected": 1.25, "get": 0, "set": 0, "value": 1.25}, "expected": "8e007eaa50", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "8e007eaa50"}, "overlay-lifecycle/WidthInMeters#/-/-": {"#v": {"expected": 1.5, "get": 0, "set": 0, "value": 1.5}, "expected": "aa8f289ebe", "get": "b6589fc6ab", "s": "ok", "set": "b6589fc6ab", "value": "aa8f289ebe"}, + "render-model-components/GetRenderModelName#/-/-": {"#v": {"count": 31}, "count": "632667547e", "s": "ok"}, + "render-model-components/left render model components#/-/-": {"#v": {"components": 0, "model": ""}, "components": "b6589fc6ab", "model": "dd29ecf524", "s": "ok"}, + "render-model-components/right render model components#/-/-": {"#v": {"components": 0, "model": ""}, "components": "b6589fc6ab", "model": "dd29ecf524", "s": "ok"}, + "settings-defaults/SetFloat collisionBounds fade distance: events#/-/-": {"s": "ok"}, + "settings-defaults/audio/playbackDevice#/-/-": {"#v": {"empty": true, "error": 5}, "empty": "5ffe533b83", "error": "ac3478d69a", "s": "ok"}, + "settings-defaults/audio/recordingDevice#/-/-": {"#v": {"empty": true, "error": 5}, "empty": "5ffe533b83", "error": "ac3478d69a", "s": "ok"}, + "settings-defaults/collisionBounds/CollisionBoundsColorGammaA#/-/-": {"#v": {"error": 5, "float": 0.0}, "error": "ac3478d69a", "float": "38f6d7875e", "s": "ok"}, + "settings-defaults/collisionBounds/CollisionBoundsFadeDistance#/-/-": {"#v": {"error": 0, "float": 1.0}, "error": "b6589fc6ab", "float": "e8dc057d33", "s": "ok"}, + "settings-defaults/steamvr/background#/-/-": {"#v": {"empty": true, "error": 5}, "empty": "5ffe533b83", "error": "ac3478d69a", "s": "ok"}, + "settings-defaults/steamvr/ipd#/-/-": {"#v": {"error": 0, "float": 0.063}, "error": "b6589fc6ab", "float": "75aeb0fd5c", "s": "ok"}, + "settings-defaults/steamvr/supersampleScale#/-/-": {"#v": {"error": 0, "float": 1.0}, "error": "b6589fc6ab", "float": "e8dc057d33", "s": "ok"}, + "skeletal-input/GetActionOrigins#/-/-": {"#v": {"count": 0, "ret": 0}, "count": "b6589fc6ab", "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/GetOriginLocalizedName -1#/-/-": {"#v": {"name": "", "ret": -1}, "name": "dd29ecf524", "ret": "7984b0a0e1", "s": "ok"}, + "skeletal-input/GetOriginLocalizedName 1#/-/-": {"#v": {"name": "", "ret": -1}, "name": "dd29ecf524", "ret": "7984b0a0e1", "s": "ok"}, + "skeletal-input/GetOriginLocalizedName 2#/-/-": {"#v": {"name": "", "ret": -1}, "name": "dd29ecf524", "ret": "7984b0a0e1", "s": "ok"}, + "skeletal-input/GetOriginLocalizedName 4#/-/-": {"#v": {"name": "", "ret": -1}, "name": "dd29ecf524", "ret": "7984b0a0e1", "s": "ok"}, + "skeletal-input/GetPoseActionDataForNextFrame#/-/-": {"#v": {"bActive": false, "bPoseIsValid": false, "ret": 0}, "bActive": "7cb6efb98b", "bPoseIsValid": "7cb6efb98b", "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/SetActionManifestPath again, another file#/-/-": {"#v": {"ret": 0, "trigger handle": 0}, "ret": "b6589fc6ab", "s": "ok", "trigger handle": "b6589fc6ab"}, + "skeletal-input/SetActionManifestPath#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/left GetSkeletalActionData#/-/-": {"#v": {"bActive": false, "ret": 0}, "bActive": "7cb6efb98b", "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/left GetSkeletalBoneData WithController#/-/-": {"#v": {"bone 1": [0.0, 0.0, 0.0], "bone 9": [0.0, 0.0, 0.0], "ret": 9}, "bone 1": "d1dd86519d", "bone 9": "d1dd86519d", "ret": "0ade7c2cf9", "s": "ok"}, + "skeletal-input/left GetSkeletalBoneData WithoutController#/-/-": {"#v": {"bone 1": [0.0, 0.0, 0.0], "bone 9": [0.0, 0.0, 0.0], "ret": 9}, "bone 1": "d1dd86519d", "bone 9": "d1dd86519d", "ret": "0ade7c2cf9", "s": "ok"}, + "skeletal-input/left GetSkeletalSummaryData FromAnimation#/-/-": {"#v": {"curl": [0.0, 0.0, 0.0, 0.0, 0.0], "ret": 0, "splay": [0.2, 0.2, 0.2, 0.2]}, "curl": "b83ccdd780", "ret": "b6589fc6ab", "s": "ok", "splay": "9037a65314"}, + "skeletal-input/left GetSkeletalSummaryData FromDevice#/-/-": {"#v": {"curl": [0.0, 0.0, 0.0, 0.0, 0.0], "ret": 0, "splay": [0.2, 0.2, 0.2, 0.2]}, "curl": "b83ccdd780", "ret": "b6589fc6ab", "s": "ok", "splay": "9037a65314"}, + "skeletal-input/right GetSkeletalActionData#/-/-": {"#v": {"bActive": false, "ret": 0}, "bActive": "7cb6efb98b", "ret": "b6589fc6ab", "s": "ok"}, + "skeletal-input/right GetSkeletalBoneData WithController#/-/-": {"#v": {"bone 1": [0.0, 0.0, 0.0], "bone 9": [0.0, 0.0, 0.0], "ret": 9}, "bone 1": "d1dd86519d", "bone 9": "d1dd86519d", "ret": "0ade7c2cf9", "s": "ok"}, + "skeletal-input/right GetSkeletalBoneData WithoutController#/-/-": {"#v": {"bone 1": [0.0, 0.0, 0.0], "bone 9": [0.0, 0.0, 0.0], "ret": 9}, "bone 1": "d1dd86519d", "bone 9": "d1dd86519d", "ret": "0ade7c2cf9", "s": "ok"}, + "skeletal-input/right GetSkeletalSummaryData FromAnimation#/-/-": {"#v": {"curl": [0.0, 0.0, 0.0, 0.0, 0.0], "ret": 0, "splay": [0.2, 0.2, 0.2, 0.2]}, "curl": "b83ccdd780", "ret": "b6589fc6ab", "s": "ok", "splay": "9037a65314"}, + "skeletal-input/right GetSkeletalSummaryData FromDevice#/-/-": {"#v": {"curl": [0.0, 0.0, 0.0, 0.0, 0.0], "ret": 0, "splay": [0.2, 0.2, 0.2, 0.2]}, "curl": "b83ccdd780", "ret": "b6589fc6ab", "s": "ok", "splay": "9037a65314"}, "submit-edges/Background submit#/-/-": {"#v": {"init_error": 121}, "init_error": "8bd7954c40", "s": "ok"}, "submit-edges/SetSkyboxOverride six faces#/-/-": {"#v": {"ret": 1}, "ret": "356a192b79", "s": "ok"}, "submit-edges/left DXGI format 78#/-/-": {"#v": {"ret": 105, "texture_made": true}, "ret": "e114c448f4", "s": "ok", "texture_made": "5ffe533b83"}, @@ -34229,6 +34304,8 @@ "submit-edges/left#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, "submit-edges/right not null#/-/-": {"#v": {"ret": 102}, "ret": "c8306ae139", "s": "ok"}, "submit-edges/right#/-/-": {"#v": {"ret": 0}, "ret": "b6589fc6ab", "s": "ok"}, + "submit-refusals/Overlay app submit#/-/-": {"#v": {"ret": 130}, "ret": "2a7541babb", "s": "ok"}, + "submit-refusals/Submit bounds#/-/-": {"#v": {"flipped bounds": 0, "zero-area bounds": 0}, "flipped bounds": "b6589fc6ab", "s": "ok", "zero-area bounds": "b6589fc6ab"}, "unknown-interface/FnTable:IVRNope_001#/-/-": {"#v": {"found": false, "init_error": 0, "lookup_error": 105}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "e114c448f4", "s": "ok"}, "unknown-interface/FnTable:IVRSystem_022#/-/-": {"#v": {"found": true, "init_error": 0, "lookup_error": 0}, "found": "5ffe533b83", "init_error": "b6589fc6ab", "lookup_error": "b6589fc6ab", "s": "ok"}, "unknown-interface/IVRNope_001#/-/-": {"#v": {"found": false, "init_error": 0, "lookup_error": 105}, "found": "7cb6efb98b", "init_error": "b6589fc6ab", "lookup_error": "e114c448f4", "s": "ok"}, diff --git a/tests/conformance/cases.cpp b/tests/conformance/cases.cpp index 5bcaf521..f6066ba4 100644 --- a/tests/conformance/cases.cpp +++ b/tests/conformance/cases.cpp @@ -86,6 +86,16 @@ Json::Value conformance::ReadStandInDump() namespace { +// The process id OpenVR's calls answer for this program +uint32_t ThisProcessId() +{ +#ifdef _WIN32 + return (uint32_t)GetCurrentProcessId(); +#else + return (uint32_t)getpid(); +#endif +} + Json::Value Err(int e) { Json::Value v; @@ -1761,8 +1771,9 @@ void InputThreadsCase(CaseContext& c) } // GetActionBindingInfo (expect/binding_info.json), on the stand-in with scripts/bound_source_odd.json and --manifest -// manifest_toggle.json: an input action is told as the binding file binds it; a vibration from the runtime's bound -// sources, which here include one that isn't an input path, and that one is left out +// manifest_toggle.json: each action is told as the binding file binds it, a pose too, and a vibration with no device +// or input path (as SteamVR answers); the runtime's bound sources, which here include one that isn't an input path, +// aren't told. GetActionOrigins with no set answers no origins and no error. void BindingInfoCase(CaseContext& c) { using namespace vr::IVRInput_010; @@ -1794,20 +1805,26 @@ void BindingInfoCase(CaseContext& c) InputBindingInfo_t info[4]{}; uint32_t returned = 99; Json::Value r; - // The vibration is answered from the runtime's bound sources: the real bindings come first, the odd source is - // the last one the stand-in lists + // The vibration: one binding in the file, told with every field empty vr::VRActionHandle_t haptic = 0; in->GetActionHandle("/actions/main/out/haptic", &haptic); r["err"] = (int)in->GetActionBindingInfo(haptic, info, sizeof(info[0]), 4, &returned); - r["returned_at_least_one"] = returned >= 1 && returned <= 4; - bool oddShown = false; - for (uint32_t i = 0; i < returned && i < 4; i++) - oddShown = oddShown || std::string(info[i].rchDevicePathName).find("mnd") != std::string::npos || std::string(info[i].rchModeName).find("1419") != std::string::npos; - r["odd_source_left_out"] = !oddShown; - bool noBlank = true; // every entry counted is filled in + r["haptic_bindings"] = returned; + bool allEmpty = true; for (uint32_t i = 0; i < returned && i < 4; i++) - noBlank = noBlank && info[i].rchDevicePathName[0] != 0; - r["no_blank_entries"] = noBlank; + allEmpty = allEmpty && !info[i].rchDevicePathName[0] && !info[i].rchInputPathName[0] && !info[i].rchModeName[0]; + r["haptic_paths_empty"] = allEmpty; + // The pose: the right hand's raw pose + vr::VRActionHandle_t pose = 0; + in->GetActionHandle("/actions/main/in/pose", &pose); + memset(info, 0, sizeof(info)); + returned = 99; + r["pose_err"] = (int)in->GetActionBindingInfo(pose, info, sizeof(info[0]), 4, &returned); + r["pose_bindings"] = returned; + if (returned >= 1) { + r["pose_device"] = info[0].rchDevicePathName; + r["pose_input"] = info[0].rchInputPathName; + } // The toggle is answered from the binding file: a toggle_button on the right trigger memset(info, 0, sizeof(info)); returned = 99; @@ -1825,6 +1842,9 @@ void BindingInfoCase(CaseContext& c) vr::VRInputValueHandle_t right = 0; in->GetInputSourceHandle("/user/hand/right/input/trigger", &right); r["origin_is_the_right_trigger"] = origins[0] == right && origins[1] == vr::k_ulInvalidInputValueHandle; + origins[0] = 1; + r["no_set_origins_err"] = (int)in->GetActionOrigins(vr::k_ulInvalidActionSetHandle, toggle, origins, 4); + r["no_set_origins_empty"] = origins[0] == vr::k_ulInvalidInputValueHandle; c.Record("odd source", r); c.core->Cleanup(); } @@ -2289,6 +2309,137 @@ void VelocitiesCase(CaseContext& c) c.core->Cleanup(); } +// Frames of a game reading the manifest's actions: n frames, each with UpdateActionState on /actions/main +static void ManifestFrames(CaseContext& c, Frames& f, vr::IVRInput_010::IVRInput* in, vr::VRActionSetHandle_t set, int n) +{ + callers::Texture tex(ArgSet::Valid, *c.call); + for (int frame = 1; frame <= n; frame++) { + vr::TrackedDevicePose_t poses[16]; + f.comp->WaitGetPoses(poses, 16, nullptr, 0); + vr::IVRInput_010::VRActiveActionSet_t active{}; + active.ulActionSet = set; + in->UpdateActionState(&active, sizeof(active), 1); + f.comp->Submit(vr::Eye_Left, tex.get(), nullptr, vr::Submit_Default); + f.comp->Submit(vr::Eye_Right, tex.get(), nullptr, vr::Submit_Default); + } +} + +// The controller type (Prop_ControllerType_String) of each device that has one, by class: "controller" and "tracker" +static Json::Value DeviceTypes(vr::IVRSystem_022::IVRSystem* sys) +{ + Json::Value out(Json::objectValue); + for (vr::TrackedDeviceIndex_t i = 1; i < vr::k_unMaxTrackedDeviceCount; i++) { + const vr::ETrackedDeviceClass cls = sys->GetTrackedDeviceClass(i); + if (cls != vr::TrackedDeviceClass_Controller && cls != vr::TrackedDeviceClass_GenericTracker) + continue; + char type[256] = {}; + sys->GetStringTrackedDeviceProperty(i, vr::Prop_ControllerType_String, type, sizeof(type), nullptr); + out[cls == vr::TrackedDeviceClass_Controller ? "controller" : "tracker"].append(type); + } + return out; +} + +// Vive trackers by their role (expect/vive_trackers.json), on the stand-in with scripts/vive_trackers.json and +// --manifest manifest_trackers.json: a tracker device for each role, with the role's controller type (the left foot's +// once it connects), and the pose action a waist tracker's binding file binds read from the waist tracker +void ViveTrackersCase(CaseContext& c) +{ + using namespace vr::IVRInput_010; + Frames f; + if (!OpenFrames(c, f)) + return; + vr::EVRInitError le; + auto* in = (IVRInput*)c.core->GetGenericInterface("IVRInput_010", &le); + if (!in) { + c.Record("no IVRInput_010", Err(le)); + c.core->Cleanup(); + return; + } + in->SetActionManifestPath(c.manifest.c_str()); + vr::VRActionSetHandle_t set = vr::k_ulInvalidActionSetHandle; + vr::VRActionHandle_t waist = 0; + in->GetActionSetHandle("/actions/main", &set); + in->GetActionHandle("/actions/main/in/waist", &waist); + ManifestFrames(c, f, in, set, 10); + c.Record("devices before the foot", DeviceTypes(f.sys)); + ManifestFrames(c, f, in, set, 30); + c.Record("devices", DeviceTypes(f.sys)); + + Json::Value r; + InputPoseActionData_t data{}; + r["err"] = (int)in->GetPoseActionDataForNextFrame(waist, vr::TrackingUniverseStanding, &data, sizeof(data), vr::k_ulInvalidInputValueHandle); + r["active"] = data.bActive; + r["valid"] = data.pose.bPoseIsValid; + const vr::HmdMatrix34_t& m = data.pose.mDeviceToAbsoluteTracking; + r["at"] = ThousandthsOf({ { m.m[0][3], m.m[1][3], m.m[2][3] } }); + vr::VRInputValueHandle_t waistPath = 0, footPath = 0; + in->GetInputSourceHandle("/user/waist", &waistPath); + in->GetInputSourceHandle("/user/foot/left", &footPath); + r["origin_is_the_waist"] = data.activeOrigin == waistPath && waistPath != vr::k_ulInvalidInputValueHandle; + // The origin's device is the waist tracker + InputOriginInfo_t origin{}; + r["origin_info_err"] = (int)in->GetOriginTrackedDeviceInfo(data.activeOrigin, &origin, sizeof(origin)); + char type[256] = {}; + f.sys->GetStringTrackedDeviceProperty(origin.trackedDeviceIndex, vr::Prop_ControllerType_String, type, sizeof(type), nullptr); + r["origin_device"] = type; + // Restricted to the waist it's the same; to the left foot, which the file doesn't bind it on, nothing + InputPoseActionData_t restricted{}; + in->GetPoseActionDataForNextFrame(waist, vr::TrackingUniverseStanding, &restricted, sizeof(restricted), waistPath); + r["restricted_to_the_waist"] = restricted.bActive; + restricted = {}; + in->GetPoseActionDataForNextFrame(waist, vr::TrackingUniverseStanding, &restricted, sizeof(restricted), footPath); + r["restricted_to_the_foot"] = restricted.bActive; + c.Record("waist pose", r); + c.core->Cleanup(); +} + +// The hands as controllers (expect/hand_controllers*.json), on the stand-in with --manifest manifest_trackers.json: +// with scripts/hand_interaction.json both hands are Index controllers ("knuckles", or the handController setting's) +// and the right hand's pinch is the trigger the binding file binds; with scripts/hand_tracking_only.json there is no +// controller, but the hands' own joints are tracked, and the hands are those controllers all the same +void HandControllersCase(CaseContext& c) +{ + using namespace vr::IVRInput_010; + Frames f; + if (!OpenFrames(c, f)) + return; + vr::EVRInitError le; + auto* in = (IVRInput*)c.core->GetGenericInterface("IVRInput_010", &le); + if (!in) { + c.Record("no IVRInput_010", Err(le)); + c.core->Cleanup(); + return; + } + in->SetActionManifestPath(c.manifest.c_str()); + vr::VRActionSetHandle_t set = vr::k_ulInvalidActionSetHandle; + vr::VRActionHandle_t squeeze = 0; + in->GetActionSetHandle("/actions/main", &set); + in->GetActionHandle("/actions/main/in/squeeze", &squeeze); + // Hand tracking is checked once a second for a hand without a controller + ManifestFrames(c, f, in, set, 30); + for (int i = 0; i < 12 && f.sys->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_RightHand) >= 16; i++) { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + ManifestFrames(c, f, in, set, 2); + } + c.Record("devices", DeviceTypes(f.sys)); + Json::Value r; + const vr::TrackedDeviceIndex_t right = f.sys->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_RightHand); + r["right_found"] = right < 16; + if (right < 16) { + char model[256] = {}; + f.sys->GetStringTrackedDeviceProperty(right, vr::Prop_RenderModelName_String, model, sizeof(model), nullptr); + r["render_model"] = model; + vr::TrackedDevicePose_t poses[16]{}; + f.sys->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseStanding, 0, poses, 16); + r["pose_valid"] = poses[right].bPoseIsValid; + } + InputAnalogActionData_t analog{}; + r["squeeze_err"] = (int)in->GetAnalogActionData(squeeze, &analog, sizeof(analog), vr::k_ulInvalidInputValueHandle); + r["squeeze"] = analog.x; + c.Record("right hand", r); + c.core->Cleanup(); +} + void SubmitEdges(CaseContext& c) { Frames f; @@ -2554,6 +2705,42 @@ void OwnFramesNothingShownCase(CaseContext& c) c.Record("frames", r); } +// A game that stalls in a fade to black (expect/own_frames.json, with ownFrames=true): 10 frames, an instant fade to +// opaque black, 2 more frames, then half a second without any call and nothing else shown. The visible fade keeps +// OpenLamina's own frames going, and each of them draws it over the game's last frame: at least 30 frames with both the +// game's frame and an opaque black quad (the fade; nothing else shows a quad here). +void OwnFramesFadeCase(CaseContext& c) +{ + Frames f; + if (!OpenFrames(c, f)) + return; + callers::Texture tex(ArgSet::Valid, *c.call); + for (int frame = 0; frame < 10; frame++) + GameFrame(f, tex.get()); + f.comp->FadeToColor(0, 0, 0, 0, 1, false); + for (int frame = 0; frame < 2; frame++) + GameFrame(f, tex.get()); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + c.core->Cleanup(); + + Json::Value r; + Json::Value dump = ReadStandInDump(); + if (!dump.isNull()) { + std::map> frames; // frame: black quad, projection + for (const Json::Value& layer : dump["layers"]) { + auto& fr = frames[layer["frame"].asInt64()]; + fr.first |= layer["type"].asString() == "quad" && layer["samples"]["tl"].asString() == "000000ff"; + fr.second |= layer["type"].asString() == "projection"; + } + int faded = 0; + for (auto& [frame, fr] : frames) + faded += fr.first && fr.second; + r["faded_frames_at_least_30"] = faded >= 30; + r["frame_order_errors"] = dump["frame_order_errors"]; + } + c.Record("frames", r); +} + // The game stalling and coming back again and again while another thread reads input (expect/own_frames.json): 20 // rounds of 5 frames and a 150 ms pause, each pause long enough for OpenLamina's own frames to start, so the game's // next frame often meets one of them. No frame call may come out of order, and nothing may crash. @@ -3328,9 +3515,205 @@ void RenderModelsCase(CaseContext& c) } c.Record("answers", r); + // OpenLamina's own controller models (bin/rendermodels): what SteamVR doesn't have is answered from them + r = Json::Value(); + const char* vive = "htc-vive-left"; + model = nullptr; + r["ret"] = load(vive, &model); + if (model) { + r["has_vertices"] = model->unVertexCount > 1000; + bool inRange = true; + for (uint32_t i = 0; i < model->unTriangleCount * 3; i++) + inRange = inRange && model->rIndexData[i] < model->unVertexCount; + r["indices_in_range"] = inRange; + RenderModel_TextureMap_t* tex = nullptr; + TextureID_t id = model->diffuseTextureId; + r["texture_ret"] = (int)untilLoaded([&] { return rm->LoadTexture_Async(id, &tex); }); + if (tex) { + r["texture"] = std::to_string(tex->unWidth) + "x" + std::to_string(tex->unHeight); + rm->FreeTexture(tex); + } + rm->FreeRenderModel(model); + } + Json::Value parts(Json::arrayValue); + for (uint32_t i = 0; i < rm->GetComponentCount(vive) && i < 16; i++) { + char part[64] = {}; + rm->GetComponentName(vive, i, part, sizeof(part)); + parts.append(part); + } + r["components"] = parts; + r["has_tip"] = rm->RenderModelHasComponent(vive, "tip"); + r["trigger_buttons"] = (Json::UInt64)rm->GetComponentButtonMask(vive, "trigger"); + model = nullptr; + r["trigger_ret"] = load("htc-vive-left/trigger", &model); + if (model) + rm->FreeRenderModel(model); + vr::VRControllerState_t touch{}; + vr::RenderModel_ComponentState_t touchState{}; + rm->GetComponentState(vive, "trackpad_touch", &touch, &mode, &touchState); + r["touch_dot_at_rest"] = touchState.uProperties; + touch.ulButtonTouched = vr::ButtonMaskFromId(vr::k_EButton_Axis0); + touch.rAxis[0].x = 1.0f; + rm->GetComponentState(vive, "trackpad_touch", &touch, &mode, &touchState); + r["touch_dot_touched"] = touchState.uProperties; + r["touch_dot_moves_right"] = touchState.mTrackingToComponentRenderModel.m[0][3] > 0.015f; + vr::RenderModel_ComponentState_t tipState{}; + r["tip_ret"] = rm->GetComponentState(vive, "tip", nullptr, nullptr, &tipState); + char ownOriginal[64] = {}; + pe = VRRenderModelError_Loading; + rm->GetRenderModelOriginalPath(vive, ownOriginal, sizeof(ownOriginal), &pe); + r["original"] = ownOriginal; + r["original_error"] = (int)pe; + c.Record("own controller", r); + c.core->Cleanup(); } +// What each application type (scene, overlay, background, utility, other) is answered by the calls whose answers +// depend on the session and on the controllers, for comparing with SteamVR's: run with controllers on +// (scripts/controllers_on.json on the stand-in runtime; two controllers switched on with SteamVR). Each type is an +// Init of its own, a few frames' worth of events pumped first, so the answers are those of a session that has started. +void AppTypeAnswersCase(CaseContext& c) +{ + static const std::pair types[] = { + { vr::VRApplication_Scene, "scene" }, + { vr::VRApplication_Overlay, "overlay" }, + { vr::VRApplication_Background, "background" }, + { vr::VRApplication_Utility, "utility" }, + { vr::VRApplication_Other, "other" }, + { vr::VRApplication_VRMonitor, "vrmonitor" }, + }; + for (const auto& [type, name] : types) { + const std::string t = name; + vr::EVRInitError ie = c.core->Init(type, nullptr); + c.Record(t + " Init", Err(ie)); + if (ie != vr::VRInitError_None) + continue; + auto get = [&](const char* version) { + vr::EVRInitError le = vr::VRInitError_None; + void* p = c.core->GetGenericInterface(version, &le); + if (!p) + c.Record(t + " no " + version, Err(le)); + return p; + }; + auto* sys = (vr::IVRSystem_022::IVRSystem*)get("IVRSystem_022"); + auto* comp = (vr::IVRCompositor_029::IVRCompositor*)get("IVRCompositor_029"); + auto* ov = (vr::IVROverlay_028::IVROverlay*)get("IVROverlay_028"); + auto* apps = (vr::IVRApplications_007::IVRApplications*)get("IVRApplications_007"); + auto* chap = (vr::IVRChaperone_004::IVRChaperone*)get("IVRChaperone_004"); + auto* input = (vr::IVRInput_010::IVRInput*)get("IVRInput_010"); + + // The session's start-up events, as a game's first frames would see them + if (sys) { + vr::VREvent_t ev; + int events = 0; + for (int frame = 0; frame < 10; frame++) { + if (comp && type == vr::VRApplication_Scene) { + vr::TrackedDevicePose_t poses[vr::k_unMaxTrackedDeviceCount]; + comp->WaitGetPoses(poses, vr::k_unMaxTrackedDeviceCount, nullptr, 0); + } else { + std::this_thread::sleep_for(std::chrono::milliseconds(11)); + } + while (events < 256 && sys->PollNextEvent(&ev, sizeof(ev))) + events++; + } + Json::Value r; + r["any"] = events > 0; + c.Record(t + " startup events", r); + } + + if (sys) { + Json::Value r; + r["IsInputAvailable"] = sys->IsInputAvailable(); + r["IsSteamVRDrawingControllers"] = sys->IsSteamVRDrawingControllers(); + r["ShouldApplicationPause"] = sys->ShouldApplicationPause(); + r["ShouldApplicationReduceRenderingWork"] = sys->ShouldApplicationReduceRenderingWork(); + r["HmdActivityLevel"] = (int)sys->GetTrackedDeviceActivityLevel(vr::k_unTrackedDeviceIndex_Hmd); + c.Record(t + " IVRSystem state", r); + + for (auto role : { vr::TrackedControllerRole_LeftHand, vr::TrackedControllerRole_RightHand }) { + const std::string hand = role == vr::TrackedControllerRole_LeftHand ? "left" : "right"; + vr::TrackedDeviceIndex_t i = sys->GetTrackedDeviceIndexForControllerRole(role); + Json::Value d; + d["found"] = i != vr::k_unTrackedDeviceIndexInvalid; + if (i != vr::k_unTrackedDeviceIndexInvalid) { + d["class"] = (int)sys->GetTrackedDeviceClass(i); + d["connected"] = sys->IsTrackedDeviceConnected(i); + d["role"] = (int)sys->GetControllerRoleForTrackedDeviceIndex(i); + vr::ETrackedPropertyError pe = vr::TrackedProp_Success; + d["RoleHint"] = sys->GetInt32TrackedDeviceProperty(i, vr::Prop_ControllerRoleHint_Int32, &pe); + d["RoleHint error"] = (int)pe; + d["ProvidesBatteryStatus"] = sys->GetBoolTrackedDeviceProperty(i, vr::Prop_DeviceProvidesBatteryStatus_Bool, &pe); + d["ProvidesBatteryStatus error"] = (int)pe; + float battery = sys->GetFloatTrackedDeviceProperty(i, vr::Prop_DeviceBatteryPercentage_Float, &pe); + d["Battery error"] = (int)pe; + d["Battery in 0..1"] = battery >= 0.0f && battery <= 1.0f; + d["ActivityLevel"] = (int)sys->GetTrackedDeviceActivityLevel(i); + vr::VRControllerState_t state{}; + d["GetControllerState"] = sys->GetControllerState(i, &state, sizeof(state)); + } + c.Record(t + " " + hand + " controller", d); + } + vr::TrackedDeviceIndex_t sorted[vr::k_unMaxTrackedDeviceCount]; + Json::Value r2; + r2["controllers"] = sys->GetSortedTrackedDeviceIndicesOfClass(vr::TrackedDeviceClass_Controller, sorted, vr::k_unMaxTrackedDeviceCount); + c.Record(t + " GetSortedTrackedDeviceIndicesOfClass", r2); + } + + if (comp) { + Json::Value r; + r["GetTrackingSpace"] = (int)comp->GetTrackingSpace(); + r["CanRenderScene"] = comp->CanRenderScene(); + r["IsFullscreen"] = comp->IsFullscreen(); + r["CurrentSceneFocusProcess is this"] = comp->GetCurrentSceneFocusProcess() == ThisProcessId(); + r["CurrentSceneFocusProcess is none"] = comp->GetCurrentSceneFocusProcess() == 0; + r["LastFrameRenderer is this"] = comp->GetLastFrameRenderer() == ThisProcessId(); + r["IsMirrorWindowVisible"] = comp->IsMirrorWindowVisible(); + r["ShouldAppRenderWithLowResources"] = comp->ShouldAppRenderWithLowResources(); + r["IsMotionSmoothingEnabled"] = comp->IsMotionSmoothingEnabled(); + r["IsMotionSmoothingSupported"] = comp->IsMotionSmoothingSupported(); + r["IsCurrentSceneFocusAppLoading"] = comp->IsCurrentSceneFocusAppLoading(); + c.Record(t + " IVRCompositor state", r); + } + + if (ov) { + Json::Value r; + r["IsDashboardVisible"] = ov->IsDashboardVisible(); + r["PrimaryDashboardDevice"] = (int)ov->GetPrimaryDashboardDevice(); + vr::VROverlayHandle_t h = vr::k_ulOverlayHandleInvalid; + r["CreateOverlay"] = (int)ov->CreateOverlay(("oc.apptype." + t).c_str(), "App type", &h); + if (h != vr::k_ulOverlayHandleInvalid) + r["DestroyOverlay"] = (int)ov->DestroyOverlay(h); + c.Record(t + " IVROverlay state", r); + } + + if (apps) { + Json::Value r; + r["SceneProcessId is this"] = apps->GetCurrentSceneProcessId() == ThisProcessId(); + r["SceneProcessId is none"] = apps->GetCurrentSceneProcessId() == 0; + r["SceneApplicationState"] = (int)apps->GetSceneApplicationState(); + char key[128] = {}; + r["GetStartingApplication"] = (int)apps->GetStartingApplication(key, sizeof(key)); + c.Record(t + " IVRApplications state", r); + } + + if (chap) { + Json::Value r; + r["GetCalibrationState"] = (int)chap->GetCalibrationState(); + r["AreBoundsVisible"] = chap->AreBoundsVisible(); + c.Record(t + " IVRChaperone state", r); + } + + if (input) { + Json::Value r; + r["IsUsingLegacyInput"] = input->IsUsingLegacyInput(); + c.Record(t + " IVRInput state", r); + } + + c.core->Cleanup(); + } +} + } // namespace const std::map& conformance::Cases() @@ -3368,11 +3751,14 @@ const std::map& conformance::Cases() { "events-commit", EventsCommitCase }, { "session-events", SessionEventsCase }, { "velocities", VelocitiesCase }, + { "vive-trackers", ViveTrackersCase }, + { "hand-controllers", HandControllersCase }, { "submit-edges", SubmitEdges }, { "observer", ObserverCase }, { "own-frames", OwnFramesCase }, { "own-frames-race", OwnFramesRaceCase }, { "own-frames-nothing-shown", OwnFramesNothingShownCase }, + { "own-frames-fade", OwnFramesFadeCase }, { "own-frames-overlay-churn", OwnFramesOverlayChurnCase }, { "laser-mouse", LaserMouseCase }, { "message-overlay", MessageOverlayCase }, @@ -3382,12 +3768,14 @@ const std::map& conformance::Cases() { "gpu-other-adapter", GpuOtherAdapterCase }, { "display-frequency", DisplayFrequencyCase }, { "render-models", RenderModelsCase }, + { "app-type-answers", AppTypeAnswersCase }, }; static const std::map all = [] { std::map m = cases; m.insert(GfxCases().begin(), GfxCases().end()); m.insert(HelperCases().begin(), HelperCases().end()); m.insert(CoverageCases().begin(), CoverageCases().end()); + m.insert(SteamVRRunCases().begin(), SteamVRRunCases().end()); return m; }(); return all; diff --git a/tests/conformance/conformance.h b/tests/conformance/conformance.h index b16584cc..26bb8312 100644 --- a/tests/conformance/conformance.h +++ b/tests/conformance/conformance.h @@ -57,6 +57,7 @@ const std::map& Cases(); const std::map& GfxCases(); // gfx_cases.cpp, part of Cases() const std::map& HelperCases(); // helper_cases.cpp, part of Cases() const std::map& CoverageCases(); // coverage_cases.cpp, part of Cases() +const std::map& SteamVRRunCases(); // steamvr_run_cases.cpp, part of Cases() // The stand-in runtime's dump (OC_TEST_RUNTIME_DUMP), written when OpenLamina destroys its instance: read it after // Cleanup. Null without one (another runtime, or none written). diff --git a/tests/conformance/custom_interfaces.txt b/tests/conformance/custom_interfaces.txt index 3dbe8b10..1211bbea 100644 --- a/tests/conformance/custom_interfaces.txt +++ b/tests/conformance/custom_interfaces.txt @@ -1,7 +1,8 @@ # Interface versions Valve never published (or only in its C API), with headers in OpenVRHeaders/custom_interfaces that # OpenLamina offers. gen_callers.py calls their methods like those of interfaces.txt; run.py runs them like the others. -IVRPaths_001 -IVRPaths_002 -IVRMailbox_001 -IVRControlPanel_006 -IVRInputInternal_002 +# Columns: version, then why it's offered (scripts/openvr_inventory.py lists it in how_real.txt). +IVRPaths_001 SteamVR's path-keyed property store, offered by Valve only through the C API (SDK 1.12.5 to 2.12.14) +IVRPaths_002 SteamVR's path-keyed property store, offered by Valve only through the C API (SDK 2.15.6) +IVRMailbox_001 used by Half-Life: Alyx, never published by Valve +IVRControlPanel_006 used by Half-Life: Alyx, never published by Valve +IVRInputInternal_002 used by Half-Life: Alyx, never published by Valve diff --git a/tests/conformance/expect/binding_info.json b/tests/conformance/expect/binding_info.json index 9c089453..3a1d8886 100644 --- a/tests/conformance/expect/binding_info.json +++ b/tests/conformance/expect/binding_info.json @@ -1,9 +1,12 @@ { "binding-info/odd source/-/-": { "err": 0, - "returned_at_least_one": true, - "odd_source_left_out": true, - "no_blank_entries": true, + "haptic_bindings": 1, + "haptic_paths_empty": true, + "pose_err": 0, + "pose_bindings": 1, + "pose_device": "/user/hand/right", + "pose_input": "/pose/raw", "toggle_err": 0, "toggle_bindings": 1, "device": "/user/hand/right", @@ -11,6 +14,8 @@ "mode": "toggle_button", "slot": "click", "source_type": "trigger", - "origin_is_the_right_trigger": true + "origin_is_the_right_trigger": true, + "no_set_origins_err": 0, + "no_set_origins_empty": true } } diff --git a/tests/conformance/expect/binding_info_runtime.json b/tests/conformance/expect/binding_info_runtime.json new file mode 100644 index 00000000..0e9a75ef --- /dev/null +++ b/tests/conformance/expect/binding_info_runtime.json @@ -0,0 +1,4 @@ +{ + "#": "GetActionBindingInfo without a binding file, on the stand-in with scripts/bound_source_odd.json (run.py --cases binding-info --script scripts/bound_source_odd.json --manifest ../unit/data/manifest_haptic_no_bindings.json --expect expect/binding_info_runtime.json): the vibration from the runtime's bound sources, of which the one that isn't an output is left out", + "binding-info/odd source/-/-": { "err": 0, "haptic_bindings": 0 } +} diff --git a/tests/conformance/expect/bounds.json b/tests/conformance/expect/bounds.json index 806f13f7..2da3fb05 100644 --- a/tests/conformance/expect/bounds.json +++ b/tests/conformance/expect/bounds.json @@ -1,5 +1,5 @@ { - "#": "The play area's walls (scripts/bounds.json): with drawBounds (ini/draw_bounds.ini) one 3 m wide wall on the +X edge, where the HMD is 0.2 m from it", + "#": "The play area's walls (scripts/bounds.json): with drawBounds (ini/draw_bounds.ini) one 3 m wide wall on the +X edge, where the HMD is 0.2 m from it. The chaperone getters answer the same play area (the stage's 2 x 3 m bounds), calibrated, and the runtime is asked for its bounds once a session (the stand-in's few sessions), not every frame", "bounds/walls/-/-": { "walls": 1, "positions": [ @@ -9,5 +9,17 @@ 0.0 ] ] + }, + "bounds/play area/-/-": { + "ret": true, + "size": [ + 2.0, + 3.0 + ], + "calibration": 1, + "bounds_rect_calls": { + "near": 2, + "within": 1 + } } } diff --git a/tests/conformance/expect/bounds_room_setup.json b/tests/conformance/expect/bounds_room_setup.json index bdae08c0..90a735d2 100644 --- a/tests/conformance/expect/bounds_room_setup.json +++ b/tests/conformance/expect/bounds_room_setup.json @@ -1,5 +1,5 @@ { - "#": "The play area's walls without stage bounds (scripts/bounds_room_setup.json), with drawBounds (ini/draw_bounds.ini): the committed 2 x 3 m room setup's play area, so one 3 m wide wall on the +X edge, where the HMD is 0.2 m from it", + "#": "The play area's walls without stage bounds (scripts/bounds_room_setup.json), with drawBounds (ini/draw_bounds.ini): the committed 2 x 3 m room setup's play area, so one 3 m wide wall on the +X edge, where the HMD is 0.2 m from it. The chaperone getters answer the same play area (the committed room setup's 2 x 3 m, without stage bounds), calibrated, and the runtime is asked for its bounds once a session (the stand-in's few sessions), not every frame", "bounds-room-setup/walls/-/-": { "walls": 1, "positions": [ @@ -9,5 +9,17 @@ 0.0 ] ] + }, + "bounds-room-setup/play area/-/-": { + "ret": true, + "size": [ + 2.0, + 3.0 + ], + "calibration": 1, + "bounds_rect_calls": { + "near": 2, + "within": 1 + } } } diff --git a/tests/conformance/expect/compositor.json b/tests/conformance/expect/compositor.json index 7b928017..3c12cc13 100644 --- a/tests/conformance/expect/compositor.json +++ b/tests/conformance/expect/compositor.json @@ -1,5 +1,5 @@ { - "#": "The compositor's statistics and timing after 30 of the game's frames (run.py --cases compositor-stats): presents counted (and frames waited for without a submit not counted), the last 5 frames' timings newest first, a frame's time left within it, the last frame's poses by its prediction id and an older id refused (107, IndexOutOfRange); no motion smoothing; fullscreen. mirror (a D3D11 scene under scripts/gfx_all_apis.json, with ini/mirror_window.ini): the mirror window shown and hidden; the game's textures never referenced; a mirror texture given before any frame was copied; then a view of the left eye's, held, shows the game's last left frame and after two frames of the other pattern that one: the texture follows the game's frames. Given the device or the texture.", + "#": "The compositor's statistics and timing after 30 of the game's frames (run.py --cases compositor-stats): presents counted (and frames waited for without a submit not counted), the last 5 frames' timings newest first, a frame's time left within it, the last frame's poses by its prediction id and an older id refused (107, IndexOutOfRange); no motion smoothing; fullscreen. mirror (a D3D11 scene under scripts/gfx_all_apis.json, with ini/mirror_window.ini): the mirror window shown and hidden; the game's textures never referenced; a mirror texture given before any frame was copied; then a view of the left eye's, held, shows the game's last left frame and after two frames of the other pattern that one: the texture follows the game's frames. Given the device or the texture. mirror-flipped: the D3D11 mirror texture of frames whose bounds run backwards, read at its top-left: as the eye shows it (red for full bounds, blue upside down, green left to right, white both ways).", "compositor-stats/stats/-/-": { "pid_set": true, "presents_at_least_29": true, @@ -28,5 +28,24 @@ "get_with_resource": 0, "game_textures_never_referenced": true, "hidden": true + }, + "mirror-flipped/mirror flipped/-/-": { + "first_get": 0, + "full": { + "get": 0, + "top_left": "ff0000ff" + }, + "flipped v": { + "get": 0, + "top_left": "0000ffff" + }, + "flipped u": { + "get": 0, + "top_left": "00ff00ff" + }, + "flipped both": { + "get": 0, + "top_left": "ffffffff" + } } } diff --git a/tests/conformance/expect/controllers_early.json b/tests/conformance/expect/controllers_early.json new file mode 100644 index 00000000..22bab6f5 --- /dev/null +++ b/tests/conformance/expect/controllers_early.json @@ -0,0 +1,4 @@ +{ + "#": "A game with legacy input finds its controllers in its first frames, before the stand-in gives the session focus on its third (run.py --cases controllers-early --script scripts/controllers_early.json --expect expect/controllers_early.json)", + "controllers-early/connected/-/-": { "first_frame": { "near": 1.5, "within": 0.5 } } +} diff --git a/tests/conformance/expect/dashboard.json b/tests/conformance/expect/dashboard.json index f941ff68..01f38b07 100644 --- a/tests/conformance/expect/dashboard.json +++ b/tests/conformance/expect/dashboard.json @@ -1,5 +1,5 @@ { - "#": "OpenLamina's dashboard (scripts/dashboard.json, ini/dashboard.ini, --manifest tests/unit/data/manifest_basic.json, --jobs 2): a long press of the left menu button opens it over the game, which gets DashboardActivated and whose actions read inactive while it's open; the overlay app draws its dashboard overlay at the panel's pose in its own frames; 'Quit game' gives the game VREvent_Quit and closes it; the game's own dashboard overlay is published for its tab, and its other overlays aren't Each program also finds the other's dashboard overlay by its key (FindOverlay) and reads it through that handle: the game sees the overlay app's shown, 1 m wide, at the panel; the overlay app reads the game's key, and can't change it. The overlay app's dashboard overlay gets OverlayShown when the dashboard shows it and OverlayHidden when it closes, and IsOverlayVisible and GetTransformForOverlayCoordinates answer as the dashboard shows it.", + "#": "OpenLamina's dashboard (scripts/dashboard.json, ini/dashboard.ini, --manifest tests/unit/data/manifest_basic.json, --jobs 2): a long press of the left menu button opens it over the game, which gets DashboardActivated and whose actions read inactive while it's open; the overlay app draws its dashboard overlay at the panel's pose in its own frames; 'Quit game' gives the game VREvent_Quit and closes it; the game's own dashboard overlay is published for its tab, and its other overlays aren't Each program also finds the other's dashboard overlay by its key (FindOverlay) and reads it through that handle: the game sees the overlay app's shown, 1 m wide, at the panel; the overlay app reads the game's key, and changes its width (read back at once, applied by the game) and posts it an event (PostOverlayEvent), which the game polls on it. The game reads the panel itself through system.systemui: shown, at the panel, and not to be changed. The overlay app's dashboard overlay gets OverlayShown when the dashboard shows it and OverlayHidden when it closes, and IsOverlayVisible and GetTransformForOverlayCoordinates answer as the dashboard shows it.", "dashboard/dashboard/-/-": { "saw_overlay_app": true, "open_at_120": true, @@ -22,7 +22,16 @@ 0.0, 1.5, -1.5 - ] + ], + "systemui_visible": true, + "systemui_position": [ + 0.0, + 1.5, + -1.5 + ], + "systemui_set_refused": true, + "own_dashboard_posted_event": true, + "own_dashboard_width": 0.75 }, "dashboard-overlay/dashboard overlay/-/-": { "init": 0, @@ -41,7 +50,8 @@ ], "game_overlay_found": true, "game_overlay_key": "oc.test.game.dashboard", - "game_overlay_set_refused": true, - "missing_overlay_found": false + "missing_overlay_found": false, + "game_overlay_set": 0, + "game_overlay_width_read_back": 0.75 } } diff --git a/tests/conformance/expect/device_identity.json b/tests/conformance/expect/device_identity.json index 1d591c3b..43fab36b 100644 --- a/tests/conformance/expect/device_identity.json +++ b/tests/conformance/expect/device_identity.json @@ -1,14 +1,14 @@ { - "#": "The HMD's answers on the stand-in: the generic answers games branch on, and the manufacturer the stand-in's system name (run.py --cases device-identity --expect expect/device_identity.json). A string that doesn't fit: its size with the terminator, BufferTooSmall (3), an empty string. IVRSystem_003's ComputeDistortion: the coordinates given, as the OpenXR runtime distorts the frames itself.", + "#": "The HMD's answers on the stand-in: the generic answers games branch on, and the manufacturer from the stand-in's vendor ID, which no maker has, so the first word of its runtime name (run.py --cases device-identity --expect expect/device_identity.json). A string that doesn't fit: its size with the terminator, BufferTooSmall (3), an empty string. IVRSystem_003's ComputeDistortion: the coordinates given, as the OpenXR runtime distorts the frames itself.", "device-identity/HMD TrackingSystemName/-/-": { "ret": 7, "error": 0, "value": "oculus" }, "device-identity/HMD ManufacturerName/-/-": { - "ret": 27, + "ret": 14, "error": 0, - "value": "OpenComposite test runtime" + "value": "OpenComposite" }, "device-identity/HMD RenderModelName/-/-": { "ret": 21, diff --git a/tests/conformance/expect/dump_images.json b/tests/conformance/expect/dump_images.json new file mode 100644 index 00000000..421d6382 --- /dev/null +++ b/tests/conformance/expect/dump_images.json @@ -0,0 +1,5 @@ +{ + "#": "CompositorDumpImages: each eye's next submitted image, read back and written as a PNG to the log folder (run.py --cases gfx-vk-dump-images,gfx-gl-dump-images --script scripts/gfx_all_apis.json --expect expect/dump_images.json)", + "gfx-vk-dump-images/dump images/-/-": { "left_png": true, "right_png": true }, + "gfx-gl-dump-images/dump images/-/-": { "left_png": true, "right_png": true } +} diff --git a/tests/conformance/expect/events.json b/tests/conformance/expect/events.json index e67876eb..adc75799 100644 --- a/tests/conformance/expect/events.json +++ b/tests/conformance/expect/events.json @@ -3,5 +3,5 @@ "events/ResetSeatedZeroPose then PollNextEvent/-/-": { "polled": true, "type": 804 }, "events/trigger button events/-/-": { "press_in_frames_10_to_16": true, "held_10_frames": true, "device": 2 }, "events/trigger controller state/-/-": { "pressed_from_10_to_16": true, "pressed_10_frames": true, "trigger_axis_full": true }, - "events/a button controller state/-/-": { "a_bit": false, "grip_bit": true, "supported_buttons": 12884901895, "axis0_type": 1, "axis1_type": 3, "axis2_type": 0 } + "events/a button controller state/-/-": { "a_bit": false, "grip_bit": true, "supported_buttons": 30064771079, "axis0_type": 1, "axis1_type": 3, "axis2_type": 3 } } diff --git a/tests/conformance/expect/gfx.json b/tests/conformance/expect/gfx.json index c71582bc..d963f899 100644 --- a/tests/conformance/expect/gfx.json +++ b/tests/conformance/expect/gfx.json @@ -1,5 +1,5 @@ { - "#": "The frame and overlay cases (run.py --cases --script scripts/gfx_all_apis.json --expect expect/gfx.json): the test pattern of gfx/GfxApi.h as the stand-in runtime read back the last projection layer's views or the last quad layer (dump:). gfx--basic (D3D10 too, through the D3D11 path): 1024 x 1024 RGBA8 sRGB per eye with full bounds; eye 1's quadrants are rotated once clockwise. overlay-raw-: a 64 x 64 RGBA image set with SetOverlayRaw on a scene app of that API, and read back with GetOverlayImageData (short: a buffer a byte too small). overlay-texture-readback-: a 64 x 64 texture overlay read back. gfx-d3d11-odd: a 1 x 1 texture (eye 0 all white, eye 1 all green), 4097 x 2049, 4x MSAA R8G8B8A8_TYPELESS, slice 1 of a two-slice array (SubmitWithArrayIndex; slice 1 has the other eye's pattern) and an sRGB texture under ColorSpace_Linear (into R8G8B8A8_UNORM, 28), each found in the dump by its size. gfx--bounds: the whole texture (768 x 768 per eye), side-by-side halves of one 2048 x 1024 texture of eye 0's pattern ({0,0,0.5,1} and {0.5,0,1,1}), the whole flipped ({0,1,1,0}, 640 x 640: shown upside down), flipped halves of one 1200 x 600 texture, and one above the other in one 896 x 1792 texture ({0,0,1,0.5} and {0,0.5,1,1}: the left eye is the top half as shown, or OpenGL's bottom half, whose v counts from the bottom row); each view's rect is the bounds' area, at the origin of a swapchain image of the texture's size (image:). Known failures are in expect/gfx_known.json. The centre (c) of a whole texture is the pattern's mid-grey block.", + "#": "The frame and overlay cases (run.py --cases --script scripts/gfx_all_apis.json --expect expect/gfx.json): the test pattern of gfx/GfxApi.h as the stand-in runtime read back the last projection layer's views or the last quad layer (dump:). gfx--basic (D3D10 too, through the D3D11 path): 1024 x 1024 RGBA8 sRGB per eye with full bounds; eye 1's quadrants are rotated once clockwise. overlay-raw-: a 64 x 64 RGBA image set with SetOverlayRaw on a scene app of that API, and read back with GetOverlayImageData (short: a buffer a byte too small). overlay-texture-readback-: a 64 x 64 texture overlay read back. gfx-d3d11-odd: a 1 x 1 texture (eye 0 all white, eye 1 all green), 4097 x 2049, 4x MSAA R8G8B8A8_TYPELESS, slice 1 of a two-slice array (SubmitWithArrayIndex; slice 1 has the other eye's pattern) and an sRGB texture under ColorSpace_Linear (into R8G8B8A8_UNORM, 28), each found in the dump by its size. gfx--bounds: the whole texture (768 x 768 per eye), side-by-side halves of one 2048 x 1024 texture of eye 0's pattern ({0,0,0.5,1} and {0.5,0,1,1}), the whole flipped ({0,1,1,0}, 640 x 640: shown upside down), flipped halves of one 1200 x 600 texture, and one above the other in one 896 x 1792 texture ({0,0,1,0.5} and {0,0.5,1,1}: the left eye is the top half as shown, or OpenGL's bottom half, whose v counts from the bottom row); each view's rect is the bounds' area, at the origin of a swapchain image of the texture's size (image:; Vulkan's swapchain grows instead, to hold each size the eye's texture has had, so its later cases' images are of the cases before too). Known failures are in expect/gfx_known.json. The centre (c) of a whole texture is the pattern's mid-grey block.", "gfx-d3d11-basic/frame/-/-": { "left": 0, "right": 0, @@ -777,8 +777,8 @@ 600 ], "dump:views[0].image": [ - 1200, - 600 + 2048, + 1024 ], "dump:views[0].samples.tl": "0000ffff", "dump:views[0].samples.tr": "0000ffff", @@ -792,8 +792,8 @@ 600 ], "dump:views[1].image": [ - 1200, - 600 + 2048, + 1024 ], "dump:views[1].samples.tl": "ffffffff", "dump:views[1].samples.tr": "ffffffff", @@ -812,7 +812,7 @@ 896 ], "dump:views[0].image": [ - 896, + 2048, 1792 ], "dump:views[0].samples.tl": "ff0000ff", @@ -828,7 +828,7 @@ 896 ], "dump:views[1].image": [ - 896, + 2048, 1792 ], "dump:views[1].samples.tl": "0000ffff", diff --git a/tests/conformance/expect/gfx_interop.json b/tests/conformance/expect/gfx_interop.json index 815fd45e..6b3d7c47 100644 --- a/tests/conformance/expect/gfx_interop.json +++ b/tests/conformance/expect/gfx_interop.json @@ -1,5 +1,5 @@ { - "#": "OpenGL and Vulkan frames through Direct3D 11 (run.py --cases gfx-gl-interop,gfx-vk-interop --expect expect/gfx_interop.json, with the stand-in's default script: D3D11 alone): the session is D3D11, and the test pattern of gfx-gl-basic and gfx-vk-basic shows as it does on their own APIs. Skipped without an OpenGL or Vulkan driver (and so on CI). The bounds cases (gfx-gl-interop-bounds, gfx-vk-interop-bounds) show what gfx-gl-bounds and gfx-vk-bounds show: an OpenGL texture's v counts from its bottom row there too.", + "#": "OpenGL and Vulkan frames through Direct3D 11 (run.py --cases gfx-gl-interop,gfx-vk-interop --expect expect/gfx_interop.json, with the stand-in's default script: D3D11 alone): the session is D3D11, and the test pattern of gfx-gl-basic and gfx-vk-basic shows as it does on their own APIs. Skipped without an OpenGL or Vulkan driver (and so on CI). The bounds cases (gfx-gl-interop-bounds, gfx-vk-interop-bounds) show what gfx-gl-bounds and gfx-vk-bounds show: an OpenGL texture's v counts from its bottom row there too. gfx-gl-interop-odd: OpenGL slice 1 of two-slice arrays (SubmitWithArrayIndex: the other eye's pattern), a two-slice array of eye 0's pattern with Submit_GlArrayTexture (the left eye slice 0, the right slice 1), a 4x multisampled texture, a renderbuffer, a 4x multisampled renderbuffer and a renderbuffer with flipped bounds (upside down), each its own size; all the right way up. gfx-vk-interop-odd: Vulkan slice 1 of two-slice arrays through SubmitWithArrayIndex and through Submit_VulkanTextureWithArrayData (the other eye's pattern). gfx-vk-interop-gpu-wait: a game whose device has the extensions GetVulkanDeviceExtensionsRequired names (semaphores_asked: VK_KHR_external_semaphore_win32 among them, for the GPU-side wait), shown as the basic case; then 960 x 960 textures cleared to another colour each frame on its busy queue: the last one (red) shows.", "gfx-gl-interop/frame/-/-": { "left": 0, "right": 0, @@ -357,5 +357,686 @@ "dump:views[1].samples.bl": "0000ffff", "dump:views[1].samples.br": "ffffffff", "dump:views[1].samples.c": "ffffffff" + }, + "gfx-gl-interop-odd/array slice 1/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 320, + 320 + ], + "dump:views[0].image": [ + 320, + 320 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 320, + 320 + ], + "dump:views[1].image": [ + 320, + 320 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-gl-interop-odd/array flag/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 352, + 352 + ], + "dump:views[0].image": [ + 352, + 352 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 352, + 352 + ], + "dump:views[1].image": [ + 352, + 352 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-gl-interop-odd/msaa/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 384, + 384 + ], + "dump:views[0].image": [ + 384, + 384 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 384, + 384 + ], + "dump:views[1].image": [ + 384, + 384 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-gl-interop-odd/renderbuffer/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 416, + 416 + ], + "dump:views[0].image": [ + 416, + 416 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 416, + 416 + ], + "dump:views[1].image": [ + 416, + 416 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-gl-interop-odd/msaa renderbuffer/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 448, + 448 + ], + "dump:views[0].image": [ + 448, + 448 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 448, + 448 + ], + "dump:views[1].image": [ + 448, + 448 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-gl-interop-odd/renderbuffer flipped/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 480, + 480 + ], + "dump:views[0].image": [ + 480, + 480 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 480, + 480 + ], + "dump:views[1].image": [ + 480, + 480 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-interop-odd/array slice 1/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 320, + 320 + ], + "dump:views[0].image": [ + 320, + 320 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 320, + 320 + ], + "dump:views[1].image": [ + 320, + 320 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-interop-odd/array data/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 352, + 352 + ], + "dump:views[0].image": [ + 352, + 352 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 352, + 352 + ], + "dump:views[1].image": [ + 352, + 352 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-interop-gpu-wait/frame/-/-": { + "left": 0, + "right": 0, + "semaphores_asked": true, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 1024, + 1024 + ], + "dump:views[0].image": [ + 1024, + 1024 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 1024, + 1024 + ], + "dump:views[1].image": [ + 1024, + 1024 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-interop-gpu-wait/painted/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 960, + 960 + ], + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 960, + 960 + ], + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "ff0000ff", + "within": 2 + } } } diff --git a/tests/conformance/expect/gfx_interop_formats.json b/tests/conformance/expect/gfx_interop_formats.json new file mode 100644 index 00000000..79bad960 --- /dev/null +++ b/tests/conformance/expect/gfx_interop_formats.json @@ -0,0 +1,555 @@ +{ + "#": "OpenGL and Vulkan formats through the interop, under a runtime with D3D11 alone that offers RGBA8 sRGB swapchains only (run.py --cases gfx-gl-interop-formats,gfx-vk-interop-formats --script scripts/gfx_interop_rgba8_only.json --expect expect/gfx_interop_formats.json): GL_RGB8, GL_R11F_G11F_B10F, GL_RGBA16F and GL_RGB10_A2, and Vulkan B10G11R11_UFLOAT, R16G16B16A16_SFLOAT, A2B10G10R10_UNORM and B8G8R8A8_SRGB, each its own size, copied into D3D11 and converted into RGBA8 sRGB. Needs OpenGL and Vulkan drivers (skipped on CI).", + "gfx-gl-interop-formats/format rgb8/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-gl-interop-formats/format r11g11b10f/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 448, + 448 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 448, + 448 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-gl-interop-formats/format rgba16f/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 384, + 384 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 384, + 384 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-gl-interop-formats/format rgb10a2/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 320, + 320 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 320, + 320 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-interop-formats/format b10g11r11/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-interop-formats/format rgba16f/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 448, + 448 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 448, + 448 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-interop-formats/format rgb10a2/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 384, + 384 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 384, + 384 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-interop-formats/format bgra8/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 320, + 320 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 320, + 320 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + } +} diff --git a/tests/conformance/expect/gfx_new_device.json b/tests/conformance/expect/gfx_new_device.json new file mode 100644 index 00000000..6707b19f --- /dev/null +++ b/tests/conformance/expect/gfx_new_device.json @@ -0,0 +1,296 @@ +{ + "#": "A game that makes its device again mid-run (run.py --cases gfx-d3d11-new-device,gfx-d3d11-eyes-two-devices,gfx-d3d12-new-device,gfx-vk-new-device --script scripts/gfx_all_apis.json --expect expect/gfx_new_device.json): 512 x 512 frames of its first device, then 576 x 576 ones of a new device. D3D11: the session is made again on the new device and shows them. D3D12's second device is on WARP (D3D12 has one device per adapter), which isn't the runtime's adapter: the runtime refuses its session, and the frames are left out (104, TextureIsOnWrongDevice); with WARP the only adapter, as on CI, that case is skipped. Vulkan isn't followed: the new device's frames are refused (102, InvalidTexture). The game is never told to quit. gfx-d3d11-eyes-two-devices: the left eye on one device and the right on another: the session follows a few times, ending on the right eye's device, and the left is then left out (104); no frame names a swapchain of a session that's gone.", + "gfx-d3d11-new-device/first device/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-d3d11-new-device/new device/-/-": { + "left": 0, + "quit": false, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 576, + 576 + ], + "dump:views[0].image": [ + 576, + 576 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 576, + 576 + ], + "dump:views[1].image": [ + 576, + 576 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-d3d12-new-device/first device/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-d3d12-new-device/new device/-/-": { + "left": 104, + "quit": false, + "right": 104 + }, + "gfx-vk-new-device/first device/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-new-device/new device/-/-": { + "left": 102, + "quit": false, + "right": 102 + }, + "gfx-d3d11-eyes-two-devices/eyes on two devices/-/-": { + "left": 104, + "right": 0, + "quit": false, + "no_invalid_layers": true + } +} diff --git a/tests/conformance/expect/gfx_new_device_refused.json b/tests/conformance/expect/gfx_new_device_refused.json new file mode 100644 index 00000000..9e95f101 --- /dev/null +++ b/tests/conformance/expect/gfx_new_device_refused.json @@ -0,0 +1,225 @@ +{ + "#": "The new-device cases under a runtime that refuses the session for the new device (run.py --cases gfx-d3d11-new-device,gfx-d3d12-new-device,gfx-vk-new-device --script scripts/gfx_new_device_refused.json --expect expect/gfx_new_device_refused.json): the new device's frames are left out (102, or D3D12's 104) and the game isn't told to quit.", + "gfx-d3d11-new-device/first device/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-d3d11-new-device/new device/-/-": { + "left": 102, + "quit": false, + "right": 102 + }, + "gfx-d3d12-new-device/first device/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 29, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 29, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-d3d12-new-device/new device/-/-": { + "left": 104, + "quit": false, + "right": 104 + }, + "gfx-vk-new-device/first device/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-new-device/new device/-/-": { + "left": 102, + "quit": false, + "right": 102 + } +} diff --git a/tests/conformance/expect/gfx_vk_enable2.json b/tests/conformance/expect/gfx_vk_enable2.json new file mode 100644 index 00000000..3e405f89 --- /dev/null +++ b/tests/conformance/expect/gfx_vk_enable2.json @@ -0,0 +1,158 @@ +{ + "#": "The Vulkan frame cases under a runtime with XR_KHR_vulkan_enable2 alone (run.py --cases gfx-vk-basic,gfx-vk-bounds --script scripts/gfx_vk_enable2.json --expect expect/gfx_vk_enable2.json): what expect/gfx.json has for them, but for the swapchain images' sizes", + "gfx-vk-basic/frame/-/-": { + "left": 0, + "right": 0, + "dump:views[0].invalid": [], + "dump:views[1].invalid": [], + "dump:views[0].samples.tl": "ff0000ff", + "dump:views[0].samples.tr": "00ff00ff", + "dump:views[0].samples.bl": "0000ffff", + "dump:views[0].samples.br": "ffffffff", + "dump:views[0].samples.c": "808080ff", + "dump:views[1].samples.tl": "0000ffff", + "dump:views[1].samples.tr": "ff0000ff", + "dump:views[1].samples.bl": "ffffffff", + "dump:views[1].samples.br": "00ff00ff", + "dump:views[1].samples.c": "808080ff" + }, + "gfx-vk-bounds/full/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 768, + 768 + ], + "dump:views[0].samples.tl": "ff0000ff", + "dump:views[0].samples.tr": "00ff00ff", + "dump:views[0].samples.bl": "0000ffff", + "dump:views[0].samples.br": "ffffffff", + "dump:views[1].invalid": [], + "dump:views[1].rect": [ + 0, + 0, + 768, + 768 + ], + "dump:views[1].samples.tl": "0000ffff", + "dump:views[1].samples.tr": "ff0000ff", + "dump:views[1].samples.bl": "ffffffff", + "dump:views[1].samples.br": "00ff00ff" + }, + "gfx-vk-bounds/halves/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 1024, + 1024 + ], + "dump:views[0].samples.tl": "ff0000ff", + "dump:views[0].samples.tr": "ff0000ff", + "dump:views[0].samples.bl": "0000ffff", + "dump:views[0].samples.br": "0000ffff", + "dump:views[0].samples.c": "0000ffff", + "dump:views[1].invalid": [], + "dump:views[1].rect": [ + 0, + 0, + 1024, + 1024 + ], + "dump:views[1].samples.tl": "00ff00ff", + "dump:views[1].samples.tr": "00ff00ff", + "dump:views[1].samples.bl": "ffffffff", + "dump:views[1].samples.br": "ffffffff", + "dump:views[1].samples.c": "ffffffff" + }, + "gfx-vk-bounds/flipped/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 640, + 640 + ], + "dump:views[0].samples.tl": "0000ffff", + "dump:views[0].samples.tr": "ffffffff", + "dump:views[0].samples.bl": "ff0000ff", + "dump:views[0].samples.br": "00ff00ff", + "dump:views[1].invalid": [], + "dump:views[1].rect": [ + 0, + 0, + 640, + 640 + ], + "dump:views[1].samples.tl": "ffffffff", + "dump:views[1].samples.tr": "00ff00ff", + "dump:views[1].samples.bl": "0000ffff", + "dump:views[1].samples.br": "ff0000ff" + }, + "gfx-vk-bounds/flipped halves/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 600, + 600 + ], + "dump:views[0].samples.tl": "0000ffff", + "dump:views[0].samples.tr": "0000ffff", + "dump:views[0].samples.bl": "ff0000ff", + "dump:views[0].samples.br": "ff0000ff", + "dump:views[1].invalid": [], + "dump:views[1].rect": [ + 0, + 0, + 600, + 600 + ], + "dump:views[1].samples.tl": "ffffffff", + "dump:views[1].samples.tr": "ffffffff", + "dump:views[1].samples.bl": "00ff00ff", + "dump:views[1].samples.br": "00ff00ff" + }, + "gfx-vk-bounds/stacked/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 896, + 896 + ], + "dump:views[0].samples.tl": "ff0000ff", + "dump:views[0].samples.tr": "00ff00ff", + "dump:views[0].samples.bl": "ff0000ff", + "dump:views[0].samples.br": "00ff00ff", + "dump:views[0].samples.c": "00ff00ff", + "dump:views[1].invalid": [], + "dump:views[1].rect": [ + 0, + 0, + 896, + 896 + ], + "dump:views[1].samples.tl": "0000ffff", + "dump:views[1].samples.tr": "ffffffff", + "dump:views[1].samples.bl": "0000ffff", + "dump:views[1].samples.br": "ffffffff", + "dump:views[1].samples.c": "ffffffff" + } +} diff --git a/tests/conformance/expect/gfx_vk_odd.json b/tests/conformance/expect/gfx_vk_odd.json new file mode 100644 index 00000000..6eb67bc7 --- /dev/null +++ b/tests/conformance/expect/gfx_vk_odd.json @@ -0,0 +1,555 @@ +{ + "#": "Vulkan textures out of the ordinary (run.py --cases gfx-vk-odd,gfx-vk-dynamic-resolution,gfx-vk-msaa-formats --script scripts/gfx_vk_odd.json --expect expect/gfx_vk_odd.json), under a runtime with single-sampled swapchains only, of RGBA8 sRGB alone. gfx-vk-odd: 4x MSAA RGBA8 sRGB of 600 x 600 (resolved), the same of 640 x 640 with flipped bounds (resolved, then flipped: shown upside down), and 512 x 512 textures on a second queue of the family (skipped where the family has one queue). Multisampled patterns have the quadrants alone, so their centre (c) is the bottom-right quadrant's colour. gfx-vk-dynamic-resolution: textures of 800, 640, 720 and 960 a side; the swapchain (image) is made again only when the texture grows past it. Needs a Vulkan driver (skipped on CI). gfx-vk-msaa-formats: 4x MSAA BGRA8 sRGB, resolved and then converted into RGBA8 sRGB.", + "gfx-vk-odd/msaa/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 600, + 600 + ], + "dump:views[0].image": [ + 600, + 600 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 600, + 600 + ], + "dump:views[1].image": [ + 600, + 600 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "00ff00ff", + "within": 2 + } + }, + "gfx-vk-odd/msaa flipped/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 640, + 640 + ], + "dump:views[0].image": [ + 640, + 640 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 640, + 640 + ], + "dump:views[1].image": [ + 640, + 640 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "ff0000ff", + "within": 2 + } + }, + "gfx-vk-odd/other queue/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-dynamic-resolution/800/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 800, + 800 + ], + "dump:views[0].image": [ + 800, + 800 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 800, + 800 + ], + "dump:views[1].image": [ + 800, + 800 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-dynamic-resolution/640/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 640, + 640 + ], + "dump:views[0].image": [ + 800, + 800 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 640, + 640 + ], + "dump:views[1].image": [ + 800, + 800 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-dynamic-resolution/720/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 720, + 720 + ], + "dump:views[0].image": [ + 800, + 800 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 720, + 720 + ], + "dump:views[1].image": [ + 800, + 800 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-dynamic-resolution/960/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 960, + 960 + ], + "dump:views[0].image": [ + 960, + 960 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "808080ff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 960, + 960 + ], + "dump:views[1].image": [ + 960, + 960 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "808080ff", + "within": 2 + } + }, + "gfx-vk-msaa-formats/format msaa bgra8/-/-": { + "left": 0, + "right": 0, + "dump:invalid": [], + "dump:views[0].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[0].image": [ + 512, + 512 + ], + "dump:views[0].format": 43, + "dump:views[0].invalid": [], + "dump:views[0].samples.tl": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[0].samples.tr": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[0].samples.bl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[0].samples.br": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[0].samples.c": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].rect": [ + 0, + 0, + 512, + 512 + ], + "dump:views[1].image": [ + 512, + 512 + ], + "dump:views[1].format": 43, + "dump:views[1].invalid": [], + "dump:views[1].samples.tl": { + "near": "0000ffff", + "within": 2 + }, + "dump:views[1].samples.tr": { + "near": "ff0000ff", + "within": 2 + }, + "dump:views[1].samples.bl": { + "near": "ffffffff", + "within": 2 + }, + "dump:views[1].samples.br": { + "near": "00ff00ff", + "within": 2 + }, + "dump:views[1].samples.c": { + "near": "00ff00ff", + "within": 2 + } + } +} diff --git a/tests/conformance/expect/gfx_wait_without_submit.json b/tests/conformance/expect/gfx_wait_without_submit.json new file mode 100644 index 00000000..345d0cb5 --- /dev/null +++ b/tests/conformance/expect/gfx_wait_without_submit.json @@ -0,0 +1,5 @@ +{ + "#": "Vulkan and OpenGL games that submit 5 frames and then call WaitGetPoses 20 times without Submit (run.py --cases gfx-vk-wait-without-submit,gfx-gl-wait-without-submit --script scripts/gfx_all_apis.json --ini ini/own_frames.ini --expect expect/gfx_wait_without_submit.json): each frame they waited for is ended inside their next call, on their render thread (OpenGL: with the game's context current), with no frame call out of order", + "gfx-vk-wait-without-submit/frames/-/-": { "frames_ended_at_least_22": true, "frame_order_errors": 0 }, + "gfx-gl-wait-without-submit/frames/-/-": { "frames_ended_at_least_22": true, "frame_order_errors": 0 } +} diff --git a/tests/conformance/expect/hand_controllers.json b/tests/conformance/expect/hand_controllers.json new file mode 100644 index 00000000..8bd99e3c --- /dev/null +++ b/tests/conformance/expect/hand_controllers.json @@ -0,0 +1,5 @@ +{ + "#": "The hands as Index controllers, on the stand-in with scripts/hand_interaction.json (run.py --cases hand-controllers --script scripts/hand_interaction.json --manifest ../unit/data/manifest_trackers.json --expect expect/hand_controllers.json)", + "hand-controllers/devices/-/-": {"controller": ["knuckles", "knuckles"]}, + "hand-controllers/right hand/-/-": {"pose_valid": true, "render_model": "{indexcontroller}valve_controller_knu_1_0_right", "right_found": true, "squeeze": 1.0, "squeeze_err": 0} +} diff --git a/tests/conformance/expect/hand_controllers_touch.json b/tests/conformance/expect/hand_controllers_touch.json new file mode 100644 index 00000000..77f35b70 --- /dev/null +++ b/tests/conformance/expect/hand_controllers_touch.json @@ -0,0 +1,5 @@ +{ + "#": "The hands as Touch controllers with handController=oculus_touch, on the stand-in with scripts/hand_interaction.json (run.py --cases hand-controllers --script scripts/hand_interaction.json --manifest ../unit/data/manifest_trackers.json --ini ini/hand_controller_touch.ini --expect expect/hand_controllers_touch.json)", + "hand-controllers/devices/-/-": {"controller": ["oculus_touch", "oculus_touch"]}, + "hand-controllers/right hand/-/-": {"pose_valid": true, "render_model": "oculus_quest2_controller_right", "right_found": true, "squeeze": 1.0, "squeeze_err": 0} +} diff --git a/tests/conformance/expect/hand_controllers_tracking.json b/tests/conformance/expect/hand_controllers_tracking.json new file mode 100644 index 00000000..7b897b14 --- /dev/null +++ b/tests/conformance/expect/hand_controllers_tracking.json @@ -0,0 +1,5 @@ +{ + "#": "The tracked hands as Index controllers with no controller in them, on the stand-in with scripts/hand_tracking_only.json (run.py --cases hand-controllers --script scripts/hand_tracking_only.json --manifest ../unit/data/manifest_trackers.json --expect expect/hand_controllers_tracking.json)", + "hand-controllers/devices/-/-": {"controller": ["knuckles", "knuckles"]}, + "hand-controllers/right hand/-/-": {"pose_valid": true, "render_model": "{indexcontroller}valve_controller_knu_1_0_right", "right_found": true, "squeeze": 0.0, "squeeze_err": 0} +} diff --git a/tests/conformance/expect/helper_app_controllers.json b/tests/conformance/expect/helper_app_controllers.json new file mode 100644 index 00000000..437744f2 --- /dev/null +++ b/tests/conformance/expect/helper_app_controllers.json @@ -0,0 +1,17 @@ +{ + "#": "An overlay app and a background app that submit no frames, on the stand-in with both controllers on (scripts/helper_apps_controllers.json): IVRSystem alone sees both controllers, their poses and the left one's state.", + "helper-app-controllers/overlay controllers/-/-": { + "left connected": true, + "right connected": true, + "left pose valid": true, + "right pose valid": true, + "GetControllerState": true + }, + "helper-app-controllers/background controllers/-/-": { + "left connected": true, + "right connected": true, + "left pose valid": true, + "right pose valid": true, + "GetControllerState": true + } +} diff --git a/tests/conformance/expect/helper_apps_linux_gl.json b/tests/conformance/expect/helper_apps_linux_gl.json new file mode 100644 index 00000000..c4651525 --- /dev/null +++ b/tests/conformance/expect/helper_apps_linux_gl.json @@ -0,0 +1,11 @@ +{ + "#": "An overlay app's OpenGL texture on Linux, shown from OpenLamina's own Vulkan device: shared with it, or read back into memory where the program can't share it (scripts/helper_apps.json)", + "overlay-app-gl/textures/-/-": { + "init": 0, + "gl": 0, + "again": 0, + "binding": "vulkan", + "frame_order_errors": 0, + "quads_with_pattern": 1 + } +} diff --git a/tests/conformance/expect/helper_apps_linux_vk.json b/tests/conformance/expect/helper_apps_linux_vk.json new file mode 100644 index 00000000..30edf5ef --- /dev/null +++ b/tests/conformance/expect/helper_apps_linux_vk.json @@ -0,0 +1,11 @@ +{ + "#": "An overlay app's Vulkan texture on Linux, shown from OpenLamina's own Vulkan device: shared with it, or read back into memory where the program can't share it (scripts/helper_apps.json)", + "overlay-app-vk/textures/-/-": { + "init": 0, + "vulkan": 0, + "again": 0, + "binding": "vulkan", + "frame_order_errors": 0, + "quads_with_pattern": 1 + } +} diff --git a/tests/conformance/expect/own_frames.json b/tests/conformance/expect/own_frames.json index 09281208..acde0c76 100644 --- a/tests/conformance/expect/own_frames.json +++ b/tests/conformance/expect/own_frames.json @@ -1,5 +1,5 @@ { - "#": "OpenLamina's own frames (run.py --cases own-frames,own-frames-race,own-frames-nothing-shown --ini ini/own_frames.ini, on the stand-in at 90 Hz). own-frames: with an overlay shown, 10 game frames, a second without calls, 10 more; OpenLamina keeps frames going in the pause (at least 60), each with the game's last frame again under the overlay. own-frames-race: 20 rounds of 5 frames and a 150 ms pause while another thread reads input; the game's frames and OpenLamina's never overlap. own-frames-nothing-shown: the same stall with nothing of its own to show runs no frames of its own. own-frames-overlay-churn: an overlay's image replaced 60 times in alternating sizes from another thread while own frames draw it.", + "#": "OpenLamina's own frames (run.py --cases own-frames,own-frames-race,own-frames-nothing-shown --ini ini/own_frames.ini, on the stand-in at 90 Hz). own-frames: with an overlay shown, 10 game frames, a second without calls, 10 more; OpenLamina keeps frames going in the pause (at least 60), each with the game's last frame again under the overlay. own-frames-race: 20 rounds of 5 frames and a 150 ms pause while another thread reads input; the game's frames and OpenLamina's never overlap. own-frames-nothing-shown: the same stall with nothing of its own to show runs no frames of its own. own-frames-overlay-churn: an overlay's image replaced 60 times in alternating sizes from another thread while own frames draw it. own-frames-fade: a game that stalls in a fade to opaque black with nothing else shown: own frames keep going and each draws the fade over the game's last frame (at least 30 such frames in half a second).", "own-frames/frames/-/-": { "frames": 20, "overlay_shown": true, @@ -22,5 +22,9 @@ "sets": 60, "own_frames_ran": true, "frame_order_errors": 0 + }, + "own-frames-fade/frames/-/-": { + "faded_frames_at_least_30": true, + "frame_order_errors": 0 } } diff --git a/tests/conformance/expect/recentre.json b/tests/conformance/expect/recentre.json index 0db9d981..b25260ce 100644 --- a/tests/conformance/expect/recentre.json +++ b/tests/conformance/expect/recentre.json @@ -1,5 +1,5 @@ { - "#": "A controller's system button with dashboardButton=system (run.py --cases recentre --script scripts/recentre.json --ini ini/recentre.ini --expect expect/recentre.json; the same under --shipped-defaults). Held for over a second it recentres once and opens no dashboard: on the stand-in, whose stage can't be moved, the seated origin goes under the head, facing the way it faces (the head stands away from the stage's origin, turned, and has moved and turned again before the second hold), the standing space stays, the game gets VREvent_SeatedZeroPoseReset and no chaperone event, and the controller that was held gets one pulse. Nothing happens before the second is up. Pressed, it opens the dashboard when it's let go, and closes it the same way.", + "#": "A controller's system button with dashboardButton=system (run.py --cases recentre --script scripts/recentre.json --ini ini/recentre.ini --expect expect/recentre.json; the same under --shipped-defaults). Held for over a second (and under three, which is the controller being turned off) it recentres once, when it is let go, and opens no dashboard: on the stand-in, whose stage can't be moved, the seated origin goes under the head, facing the way it faces (the head stands away from the stage's origin, turned, and has moved and turned again before the second hold), the standing space stays, the game gets VREvent_SeatedZeroPoseReset and no chaperone event, and the controller that was held gets one pulse. Nothing happens before the second is up. Pressed, it opens the dashboard when it's let go, and closes it the same way.", "recentre/recentre/-/-": { "standing_head_before": [0.5, 1.7, 0.3], "events_before_a_second_held": 0, diff --git a/tests/conformance/expect/render_models.json b/tests/conformance/expect/render_models.json index 3833691f..b559ae4b 100644 --- a/tests/conformance/expect/render_models.json +++ b/tests/conformance/expect/render_models.json @@ -1,8 +1,8 @@ { - "#": "SteamVR's render models read from its install, on the stand-in (run.py --cases render-models --expect expect/render_models.json; run.py makes tests/unit/data/steamvr, our own fixture, SteamVR's install for this case). The fixture's models are listed with the built-in ones it doesn't have. test_controller has no OBJ of its own, so it is its two components together (a four-cornered plate and a triangle: 7 vertices, 3 triangles) with its 2x2 PNG, also as a D3D11 texture. Each component's render model is /; the trigger (controller_axis 1, so Axis1's button bit) turns -20 degrees about X through its pivot when pulled, its local frame with it; the body is static at its component_local. The thumbnail is the JSON's, as a file URL; the original path is the model's OBJ. vive_tracker's JSON isn't JSON: the built-in tracker (10659 vertices, no texture) is answered.", + "#": "SteamVR's render models read from its install, on the stand-in (run.py --cases render-models --expect expect/render_models.json; run.py makes tests/unit/data/steamvr, our own fixture, SteamVR's install for this case). The fixture's models are listed with the built-in ones it doesn't have, then OpenLamina's own controller models (bin/rendermodels, both hands of twelve controllers). test_controller has no OBJ of its own, so it is its two components together (a four-cornered plate and a triangle: 7 vertices, 3 triangles) with its 2x2 PNG, also as a D3D11 texture. Each component's render model is /; the trigger (controller_axis 1, so Axis1's button bit) turns -20 degrees about X through its pivot when pulled, its local frame with it; the body is static at its component_local. The thumbnail is the JSON's, as a file URL; the original path is the model's OBJ. vive_tracker's JSON isn't JSON: the built-in tracker (10659 vertices, no texture) is answered. htc-vive-left, one of OpenLamina's own controller models (not in the fixture), loads with its 2048x2048 texture; its components are those the Vive's WebXR model moves (no tip, base or handgrip, which GetComponentState still answers); the trigger is Axis1's; its trackpad's touch dot is hidden until Axis0 is touched, then follows the touch; its original path is its name.", "render-models/models/-/-": { - "count": 8, - "names": ["test_controller", "vive_tracker", "renderLeftHand", "renderRightHand", "oculus_quest2_controller_left", "oculus_quest2_controller_right", "{indexcontroller}valve_controller_knu_1_0_left", "{indexcontroller}valve_controller_knu_1_0_right"] + "count": 32, + "names": ["test_controller", "vive_tracker", "renderLeftHand", "renderRightHand", "oculus_quest2_controller_left", "oculus_quest2_controller_right", "{indexcontroller}valve_controller_knu_1_0_left", "{indexcontroller}valve_controller_knu_1_0_right", "generic-trigger-squeeze-thumbstick-left", "generic-trigger-squeeze-thumbstick-right", "hp-mixed-reality-left", "hp-mixed-reality-right", "htc-vive-cosmos-left", "htc-vive-cosmos-right", "htc-vive-focus-3-left", "htc-vive-focus-3-right", "htc-vive-left", "htc-vive-right", "meta-quest-touch-plus-left", "meta-quest-touch-plus-right", "meta-quest-touch-pro-left", "meta-quest-touch-pro-right", "microsoft-mixed-reality-left", "microsoft-mixed-reality-right", "oculus-touch-v3-left", "oculus-touch-v3-right", "pico-4-left", "pico-4-right", "pico-neo3-left", "pico-neo3-right", "valve-index-left", "valve-index-right"] }, "render-models/load test_controller/-/-": { "ret": 0, @@ -79,5 +79,22 @@ "hand_texture": "1x1", "path_ret": 0, "path_has_vertices": true + }, + "render-models/own controller/-/-": { + "components": ["body", "grip", "trackpad", "trackpad_touch", "trigger"], + "has_tip": false, + "has_vertices": true, + "indices_in_range": true, + "original": "htc-vive-left", + "original_error": 0, + "ret": 0, + "texture": "2048x2048", + "texture_ret": 0, + "tip_ret": true, + "touch_dot_at_rest": 0, + "touch_dot_moves_right": true, + "touch_dot_touched": 6, + "trigger_buttons": 8589934592, + "trigger_ret": 0 } } diff --git a/tests/conformance/expect/skybox.json b/tests/conformance/expect/skybox.json index 403a5865..dd143a35 100644 --- a/tests/conformance/expect/skybox.json +++ b/tests/conformance/expect/skybox.json @@ -1,5 +1,5 @@ { - "#": "Skyboxes with ownFrames=true (run.py --cases skybox-1,skybox-2,skybox-6 --script scripts/skybox.json --ini ini/own_frames.ini): set while the game stalls, shown in OpenLamina's own frames as equirect layers, upright. 1 texture: one lat-long layer; 2: one per eye; 6 cube faces: one lat-long image made from them (1024x512 from 256x256 faces), whose top-left is straight up: the middle of the top face, the pattern's mid-grey block, which comes through as it went in.", + "#": "Skyboxes with ownFrames=true (run.py --cases skybox-1,skybox-2,skybox-6 --script scripts/skybox.json --ini ini/own_frames.ini): set while the game stalls, shown in OpenLamina's own frames as equirect layers, upright. 1 texture: one lat-long layer; 2: one per eye; 6 cube faces: one lat-long image made from them (1024x512 from 256x256 faces), whose top-left is straight up: the middle of the top face, the pattern's mid-grey block, which comes through as it went in. Each lat-long layer's grid: 8 x 4 samples at the cells' centres, rows from the top (the stand-in's); the six faces' is the CPU join's, which the GPU pass matches.", "skybox-1/skybox/-/-": { "set": 0, "frames_with_skybox_at_least_10": true, @@ -14,7 +14,41 @@ 256 ], "tl": "ff0000ff", - "invalid": [] + "invalid": [], + "grid": [ + "ff0000ff", + "ff0000ff", + "ff0000ff", + "ff0000ff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "ff0000ff", + "ff0000ff", + "ff0000ff", + "808080ff", + "808080ff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "0000ffff", + "0000ffff", + "0000ffff", + "0000ffff", + "ffffffff", + "ffffffff", + "ffffffff", + "ffffffff", + "0000ffff", + "0000ffff", + "0000ffff", + "0000ffff", + "ffffffff", + "ffffffff", + "ffffffff", + "ffffffff" + ] } ] }, @@ -32,7 +66,41 @@ 256 ], "tl": "ff0000ff", - "invalid": [] + "invalid": [], + "grid": [ + "ff0000ff", + "ff0000ff", + "ff0000ff", + "ff0000ff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "ff0000ff", + "ff0000ff", + "ff0000ff", + "808080ff", + "808080ff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "0000ffff", + "0000ffff", + "0000ffff", + "0000ffff", + "ffffffff", + "ffffffff", + "ffffffff", + "ffffffff", + "0000ffff", + "0000ffff", + "0000ffff", + "0000ffff", + "ffffffff", + "ffffffff", + "ffffffff", + "ffffffff" + ] }, { "type": "equirect2", @@ -44,7 +112,41 @@ 256 ], "tl": "0000ffff", - "invalid": [] + "invalid": [], + "grid": [ + "0000ffff", + "0000ffff", + "0000ffff", + "0000ffff", + "ff0000ff", + "ff0000ff", + "ff0000ff", + "ff0000ff", + "0000ffff", + "0000ffff", + "0000ffff", + "808080ff", + "808080ff", + "ff0000ff", + "ff0000ff", + "ff0000ff", + "ffffffff", + "ffffffff", + "ffffffff", + "ffffffff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "ffffffff", + "ffffffff", + "ffffffff", + "ffffffff", + "00ff00ff", + "00ff00ff", + "00ff00ff", + "00ff00ff" + ] } ] }, @@ -62,7 +164,41 @@ 512 ], "tl": "808080ff", - "invalid": [] + "invalid": [], + "grid": [ + "ff0000ff", + "ff0000ff", + "0000ffff", + "0000ffff", + "ffffffff", + "ffffffff", + "00ff00ff", + "00ff00ff", + "ff0000ff", + "ff0000ff", + "00ff00ff", + "ff0000ff", + "00ff00ff", + "0000ffff", + "ff0000ff", + "0000ffff", + "00ff00ff", + "0000ffff", + "ffffffff", + "0000ffff", + "ffffffff", + "ffffffff", + "00ff00ff", + "ffffffff", + "ffffffff", + "ffffffff", + "0000ffff", + "0000ffff", + "ff0000ff", + "ff0000ff", + "00ff00ff", + "00ff00ff" + ] } ] } diff --git a/tests/conformance/expect/vive_trackers.json b/tests/conformance/expect/vive_trackers.json new file mode 100644 index 00000000..e27ab6b7 --- /dev/null +++ b/tests/conformance/expect/vive_trackers.json @@ -0,0 +1,6 @@ +{ + "#": "Vive trackers by their role, on the stand-in with scripts/vive_trackers.json (run.py --cases vive-trackers --script scripts/vive_trackers.json --manifest ../unit/data/manifest_trackers.json --expect expect/vive_trackers.json)", + "vive-trackers/devices before the foot/-/-": {"controller": ["knuckles", "knuckles"], "tracker": ["vive_tracker_waist", "vive_tracker_handheld_object"]}, + "vive-trackers/devices/-/-": {"controller": ["knuckles", "knuckles"], "tracker": ["vive_tracker_waist", "vive_tracker_handheld_object", "vive_tracker_left_foot"]}, + "vive-trackers/waist pose/-/-": {"active": true, "at": [0.1, 0.9, 0.2], "err": 0, "origin_device": "vive_tracker_waist", "origin_info_err": 0, "origin_is_the_waist": true, "restricted_to_the_foot": false, "restricted_to_the_waist": true, "valid": true} +} diff --git a/tests/conformance/expect/wait_without_submit.json b/tests/conformance/expect/wait_without_submit.json new file mode 100644 index 00000000..c3bbe787 --- /dev/null +++ b/tests/conformance/expect/wait_without_submit.json @@ -0,0 +1,4 @@ +{ + "#": "A game that calls WaitGetPoses 30 times and never Submit, with an overlay shown (run.py --cases wait-without-submit --ini ini/own_frames.ini --expect expect/wait_without_submit.json): each frame it waited for is ended for it, inside its next WaitGetPoses, with the overlay; none is discarded, and no frame call is out of order", + "wait-without-submit/frames/-/-": { "frames_ended_at_least_25": true, "overlay_quad": true, "frame_order_errors": 0 } +} diff --git a/tests/conformance/expect/xr_failures.json b/tests/conformance/expect/xr_failures.json index ed400e35..178aa58e 100644 --- a/tests/conformance/expect/xr_failures.json +++ b/tests/conformance/expect/xr_failures.json @@ -37,8 +37,101 @@ "frame-loop" ], "frames": 120, - "quit_events": 1, - "quit_from_frame": 60 + "quit_events": 0, + "device_events": [ + 101, + 100 + ], + "sessions_lost": 1, + "sessions_created_min": 3, + "frames_ended_min": 30 + }, + "lost_unavailable": { + "cases": [ + "frame-loop" + ], + "frames": 120, + "quit_events": 0, + "device_events": [ + 101, + 100 + ], + "sessions_lost": 1, + "sessions_created_min": 3 + }, + "lost_before_submit": { + "cases": [ + "frame-loop" + ], + "frames": 120, + "quit_events": 0, + "device_events": [ + 101, + 100 + ], + "sessions_lost": 1, + "sessions_created_min": 3, + "frames_ended_min": 20 + }, + "lost_input": { + "cases": [ + "input-frames" + ], + "action_attaches_min": 3 + }, + "lost_overlay": { + "cases": [ + "overlay-app-loss" + ], + "loss_record": { + "device_events": [ + 101, + 100 + ], + "sessions_lost": 1, + "sessions_created_min": 2, + "frames_ended_min": 20, + "manifest": 0 + } + }, + "instance_lost": { + "cases": [ + "frame-loop" + ], + "frames": 120, + "quit_events": 0, + "device_events": [ + 101, + 100 + ], + "instances_lost": 1, + "instances_created_min": 2, + "sessions_created_min": 3 + }, + "instance_lost_overlay": { + "cases": [ + "overlay-app-loss" + ], + "loss_record": { + "device_events": [ + 101, + 100 + ], + "instances_lost": 1, + "instances_created_min": 2, + "sessions_created_min": 2, + "frames_ended_min": 20 + } + }, + "instance_lost_input": { + "cases": [ + "input-frames" + ], + "rebuilt_actions": [ + "haptic", + "legacy-right-trigger" + ], + "action_attaches_min": 3 }, "exiting": { "cases": [ diff --git a/tests/conformance/gfx/D3D12Gfx.cpp b/tests/conformance/gfx/D3D12Gfx.cpp index af8d29a1..a16a8171 100644 --- a/tests/conformance/gfx/D3D12Gfx.cpp +++ b/tests/conformance/gfx/D3D12Gfx.cpp @@ -219,7 +219,7 @@ class D3D12Gfx : public GfxApi { } // namespace -std::unique_ptr MakeD3D12Gfx(std::string* whyNot) +std::unique_ptr MakeD3D12Gfx(std::string* whyNot, bool warpOnly) { auto g = std::make_unique(); IDXGIFactory4* factory = nullptr; @@ -228,7 +228,7 @@ std::unique_ptr MakeD3D12Gfx(std::string* whyNot) return nullptr; } IDXGIAdapter1* adapter = nullptr; - if (factory->EnumAdapters1(0, &adapter) == S_OK) { + if (!warpOnly && factory->EnumAdapters1(0, &adapter) == S_OK) { if (FAILED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&g->device)))) g->device = nullptr; adapter->Release(); diff --git a/tests/conformance/gfx/GLGfx.cpp b/tests/conformance/gfx/GLGfx.cpp index e41d99d9..ad13b82c 100644 --- a/tests/conformance/gfx/GLGfx.cpp +++ b/tests/conformance/gfx/GLGfx.cpp @@ -1,7 +1,7 @@ // OpenGL for the frame cases: a hidden window's context (WGL on Windows, GLX on Linux: DISPLAY's X server), current // on the case's thread (OpenLamina takes the game's context from the thread that submits). Textures are filled with -// glTexImage2D, rows bottom-up as OpenGL has them. Windows' own OpenGL 1.1 isn't enough: a driver's OpenGL 3 or later -// is needed. +// glTexImage2D, rows bottom-up as OpenGL has them; multisampled textures and renderbuffers get a plain texture's pattern +// through glBlitFramebuffer. Windows' own OpenGL 1.1 isn't enough: a driver's OpenGL 3 or later is needed. #include "GfxApi.h" @@ -18,12 +18,24 @@ #endif #include +#include namespace { constexpr GLenum kTexture2DArray = 0x8C1A, kTextureBinding2DArray = 0x8C1D, kDepthComponent32F = 0x8CAC; +constexpr GLenum kTexture2DMultisample = 0x9100, kTextureBinding2DMultisample = 0x9104, kRenderbuffer = 0x8D41, + kRenderbufferBinding = 0x8CA7, kReadFramebuffer = 0x8CA8, kDrawFramebuffer = 0x8CA9, + kReadFramebufferBinding = 0x8CAA, kDrawFramebufferBinding = 0x8CA6, kColorAttachment0 = 0x8CE0; constexpr int64_t kSRGB8Alpha8 = 0x8C43, kRGBA8 = 0x8058, kRGBA16F = 0x881A, kRGB10A2 = 0x8059, kR11G11B10F = 0x8C3A, kRGB8 = 0x8051; using PFNTexImage3D = void(APIENTRY*)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*); +using PFNGenObjects = void(APIENTRY*)(GLsizei, GLuint*); +using PFNDeleteObjects = void(APIENTRY*)(GLsizei, const GLuint*); +using PFNBindObject = void(APIENTRY*)(GLenum, GLuint); +using PFNFramebufferTexture2D = void(APIENTRY*)(GLenum, GLenum, GLenum, GLuint, GLint); +using PFNFramebufferRenderbuffer = void(APIENTRY*)(GLenum, GLenum, GLenum, GLuint); +using PFNRenderbufferStorageMultisample = void(APIENTRY*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei); +using PFNTexImage2DMultisample = void(APIENTRY*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean); +using PFNBlitFramebuffer = void(APIENTRY*)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); #ifdef _WIN32 void* GetProc(const char* name) @@ -51,12 +63,22 @@ class GLGfx : public GfxApi { GLXContext rc = nullptr; #endif PFNTexImage3D texImage3D = nullptr; - std::vector made; + PFNGenObjects genFramebuffers = nullptr, genRenderbuffers = nullptr; + PFNDeleteObjects deleteFramebuffers = nullptr, deleteRenderbuffers = nullptr; + PFNBindObject bindFramebuffer = nullptr, bindRenderbuffer = nullptr; + PFNFramebufferTexture2D framebufferTexture2D = nullptr; + PFNFramebufferRenderbuffer framebufferRenderbuffer = nullptr; + PFNRenderbufferStorageMultisample renderbufferStorageMultisample = nullptr; + PFNTexImage2DMultisample texImage2DMultisample = nullptr; + PFNBlitFramebuffer blitFramebuffer = nullptr; + std::vector made, madeRenderbuffers; ~GLGfx() override { if (rc && !made.empty()) glDeleteTextures((GLsizei)made.size(), made.data()); + if (rc && !madeRenderbuffers.empty() && deleteRenderbuffers) + deleteRenderbuffers((GLsizei)madeRenderbuffers.size(), madeRenderbuffers.data()); #ifdef _WIN32 if (rc) { wglMakeCurrent(nullptr, nullptr); @@ -175,9 +197,102 @@ class GLGfx : public GfxApi { return false; } texImage3D = (PFNTexImage3D)GetProc("glTexImage3D"); + genFramebuffers = (PFNGenObjects)GetProc("glGenFramebuffers"); + genRenderbuffers = (PFNGenObjects)GetProc("glGenRenderbuffers"); + deleteFramebuffers = (PFNDeleteObjects)GetProc("glDeleteFramebuffers"); + deleteRenderbuffers = (PFNDeleteObjects)GetProc("glDeleteRenderbuffers"); + bindFramebuffer = (PFNBindObject)GetProc("glBindFramebuffer"); + bindRenderbuffer = (PFNBindObject)GetProc("glBindRenderbuffer"); + framebufferTexture2D = (PFNFramebufferTexture2D)GetProc("glFramebufferTexture2D"); + framebufferRenderbuffer = (PFNFramebufferRenderbuffer)GetProc("glFramebufferRenderbuffer"); + renderbufferStorageMultisample = (PFNRenderbufferStorageMultisample)GetProc("glRenderbufferStorageMultisample"); + texImage2DMultisample = (PFNTexImage2DMultisample)GetProc("glTexImage2DMultisample"); + blitFramebuffer = (PFNBlitFramebuffer)GetProc("glBlitFramebuffer"); return true; } + bool CanBlit() const + { + return genFramebuffers && deleteFramebuffers && bindFramebuffer && framebufferTexture2D && framebufferRenderbuffer && blitFramebuffer; + } + + // The single-sampled pattern texture src (w x h) blitted as it is into dst, attached as attach does to the draw + // framebuffer: a multisampled texture or a renderbuffer gets every sample of each texel the pattern's. False on a + // GL error. + bool BlitPattern(GLuint src, uint32_t w, uint32_t h, const std::function& attach) + { + GLint read = 0, draw = 0; + glGetIntegerv(kReadFramebufferBinding, &read); + glGetIntegerv(kDrawFramebufferBinding, &draw); + GLuint fbos[2] = {}; + genFramebuffers(2, fbos); + bindFramebuffer(kReadFramebuffer, fbos[0]); + framebufferTexture2D(kReadFramebuffer, kColorAttachment0, GL_TEXTURE_2D, src, 0); + bindFramebuffer(kDrawFramebuffer, fbos[1]); + attach(); + blitFramebuffer(0, 0, (GLint)w, (GLint)h, 0, 0, (GLint)w, (GLint)h, GL_COLOR_BUFFER_BIT, GL_NEAREST); + bindFramebuffer(kReadFramebuffer, (GLuint)read); + bindFramebuffer(kDrawFramebuffer, (GLuint)draw); + deleteFramebuffers(2, fbos); + glFinish(); + return glGetError() == GL_NO_ERROR; + } + + // A multisampled texture of the pattern (the grey block too: blitted from a plain one) + GfxTexture MultisampledPattern(uint32_t w, uint32_t h, int64_t nativeFormat, int eye, uint32_t samples) + { + if (!texImage2DMultisample || !CanBlit()) + return Wrap(0); + GfxTexture plain = Pattern(w, h, nativeFormat, eye, 1, 1); + if (!plain.Made()) + return Wrap(0); + GLint previous = 0; + glGetIntegerv(kTextureBinding2DMultisample, &previous); + GLuint tex = 0; + glGenTextures(1, &tex); + glBindTexture(kTexture2DMultisample, tex); + texImage2DMultisample(kTexture2DMultisample, (GLsizei)samples, (GLenum)nativeFormat, (GLsizei)w, (GLsizei)h, GL_TRUE); + glBindTexture(kTexture2DMultisample, (GLuint)previous); + const GLuint src = (GLuint)(uintptr_t)plain.keep; + const bool ok = glGetError() == GL_NO_ERROR + && BlitPattern(src, w, h, [&] { framebufferTexture2D(kDrawFramebuffer, kColorAttachment0, kTexture2DMultisample, tex, 0); }); + if (!ok) { + glDeleteTextures(1, &tex); + return Wrap(0); + } + return Wrap(tex); + } + + GfxTexture Renderbuffer(uint32_t w, uint32_t h, int64_t nativeFormat, int eye, uint32_t samples) override + { + if (!genRenderbuffers || !bindRenderbuffer || !renderbufferStorageMultisample || !CanBlit()) + return {}; + GfxTexture plain = Pattern(w, h, nativeFormat, eye, 1, 1); + if (!plain.Made()) + return {}; + GLint previous = 0; + glGetIntegerv(kRenderbufferBinding, &previous); + GLuint rb = 0; + genRenderbuffers(1, &rb); + bindRenderbuffer(kRenderbuffer, rb); + renderbufferStorageMultisample(kRenderbuffer, samples > 1 ? (GLsizei)samples : 0, (GLenum)nativeFormat, (GLsizei)w, (GLsizei)h); + bindRenderbuffer(kRenderbuffer, (GLuint)previous); + const GLuint src = (GLuint)(uintptr_t)plain.keep; + const bool ok = glGetError() == GL_NO_ERROR + && BlitPattern(src, w, h, [&] { framebufferRenderbuffer(kDrawFramebuffer, kColorAttachment0, kRenderbuffer, rb); }); + if (!ok) { + deleteRenderbuffers(1, &rb); + return {}; + } + madeRenderbuffers.push_back(rb); + GfxTexture g; + g.tex.eType = vr::TextureType_OpenGL; + g.tex.eColorSpace = vr::ColorSpace_Auto; + g.tex.handle = (void*)(uintptr_t)rb; + g.keep = (void*)(uintptr_t)rb; + return g; + } + GfxTexture Wrap(GLuint name) { GfxTexture g; @@ -195,8 +310,10 @@ class GLGfx : public GfxApi { bool known = nativeFormat == kSRGB8Alpha8 || nativeFormat == kRGBA8 || nativeFormat == kRGBA16F || nativeFormat == kRGB10A2 || nativeFormat == kR11G11B10F || nativeFormat == kRGB8; arraySize = arraySize ? arraySize : 1; + if (known && w && h && samples > 1 && arraySize == 1) + return MultisampledPattern(w, h, nativeFormat, eye, samples); if (!known || !w || !h || samples > 1 || (arraySize > 1 && !texImage3D)) - return Wrap(0); // multisampled patterns: D3D11 only for now + return Wrap(0); // RGBA8 bytes whatever the internal format: OpenGL converts. A float or 10-bit format holds linear values, so // the bytes are the colours' linear values for those. const bool linear = nativeFormat == kRGBA16F || nativeFormat == kRGB10A2 || nativeFormat == kR11G11B10F; @@ -251,6 +368,13 @@ class GLGfx : public GfxApi { return Wrap(tex); } + void LeaveTextureBound() override + { + GfxTexture plain = Pattern(16, 16, kSRGB8Alpha8, 0, 1, 1); + if (plain.Made()) + glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr_t)plain.keep); + } + void Flush() override { glFinish(); } }; diff --git a/tests/conformance/gfx/GfxApi.h b/tests/conformance/gfx/GfxApi.h index 0fb9baf3..8e236dc4 100644 --- a/tests/conformance/gfx/GfxApi.h +++ b/tests/conformance/gfx/GfxApi.h @@ -10,13 +10,14 @@ // In the middle of both, a quarter of each side wide, a mid-grey block (0x80 as an sRGB byte): the corners' 0 and 255 // are the same in sRGB and linear, the grey isn't, so a conversion that decodes or encodes once too often shows in // it. Float and 10-bit formats hold linear values, and get the grey's linear value (0.216). Textures under 8 pixels -// on a side, and multisampled ones, have the quadrants alone. +// on a side, and multisampled ones of D3D11, have the quadrants alone (OpenGL's are blitted from a plain one). #include "callers_support.h" #include #include #include +#include #include #include #include @@ -48,14 +49,34 @@ class GfxApi { public: // nullptr, with why in *whyNot, when no device of the kind can be made here static std::unique_ptr Create(GfxKind kind, std::string* whyNot); // WARP for the D3D kinds when no adapter + // D3D12 on WARP whether or not there is an adapter (D3D12 has one device per adapter: a second device of another + // object than the first is on another adapter); the other kinds as Create + static std::unique_ptr CreateOnWarp(GfxKind kind, std::string* whyNot); // The test pattern (above), w x h, in nativeFormat (the API's own enum value), with samples samples and arraySize // layers: layer i has the pattern of eye (eye + i) % 2, so a layer shown is told from another (multisampled // arrays: each layer the same) virtual GfxTexture Pattern(uint32_t w, uint32_t h, int64_t nativeFormat, int eye, uint32_t samples = 1, uint32_t arraySize = 1) = 0; // A depth texture (32-bit float) filled with value virtual GfxTexture Depth(uint32_t w, uint32_t h, float value) = 0; + // OpenGL: a renderbuffer of the pattern (samples > 1: multisampled), its name as the texture's handle, to submit with + // Submit_GlRenderBuffer; a texture that wasn't made (null handle) for the other APIs + virtual GfxTexture Renderbuffer(uint32_t w, uint32_t h, int64_t nativeFormat, int eye, uint32_t samples) + { + (void)w, (void)h, (void)nativeFormat, (void)eye, (void)samples; + return {}; + } + // Vulkan: queues n clears of a 4096 x 4096 image and returns without waiting, a game's rendering still under way + // when it submits; nothing for the other APIs + virtual void Busy(int n) { (void)n; } + // Vulkan: queues a clear of the texture (made by Pattern) to rgba (0xRRGGBBAA) and returns without waiting + virtual void Paint(GfxTexture& tex, uint32_t rgba) { (void)tex, (void)rgba; } + // OpenGL: leaves a plain 2D texture bound, as a game's context mostly has one + virtual void LeaveTextureBound() {} // Waits until everything the device was asked to do is done virtual void Flush() = 0; + // Vulkan: textures made after it are filled on, and name, a second queue of the same family; false (nothing + // changed) where the API or the device has none + virtual bool UseOtherQueue() { return false; } virtual ~GfxApi() = default; }; @@ -178,10 +199,14 @@ inline std::vector PatternTexels(Texels t, uint32_t w, uint32_t h, int // gfx/*Gfx.cpp: Vulkan and OpenGL everywhere, the D3D kinds on Windows std::unique_ptr MakeVkGfx(std::string* whyNot); +// A Vulkan device with the device extensions deviceExtensions names for the instance and physical device made (as a +// game asks OpenVR's GetVulkanDeviceExtensionsRequired before it makes its device), where the GPU has them +std::unique_ptr MakeVkGfxWith(std::string* whyNot, + const std::function(void* instance, void* physicalDevice)>& deviceExtensions); std::unique_ptr MakeGLGfx(std::string* whyNot); #ifdef _WIN32 std::unique_ptr MakeD3D11Gfx(std::string* whyNot); -std::unique_ptr MakeD3D12Gfx(std::string* whyNot); +std::unique_ptr MakeD3D12Gfx(std::string* whyNot, bool warpOnly = false); std::unique_ptr MakeD3D10Gfx(std::string* whyNot); gfx::Texels TexelsOfDxgi(int64_t format); #endif diff --git a/tests/conformance/gfx/VkGfx.cpp b/tests/conformance/gfx/VkGfx.cpp index f2e1802d..ccee145f 100644 --- a/tests/conformance/gfx/VkGfx.cpp +++ b/tests/conformance/gfx/VkGfx.cpp @@ -1,11 +1,13 @@ // Vulkan for the frame cases: an instance (Vulkan 1.1 where the loader has it), the first physical device and a device -// with one graphics queue (and on Windows VK_KHR_external_memory_win32 where the driver has it, as a game that shares -// images with D3D11 enables it), all through vulkan-1.dll (libvulkan.so.1) looked up at run time (oc_conformance starts -// without it). Textures are filled from a staging buffer and left in VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, as OpenVR's -// Vulkan games submit them. +// with a graphics queue, and a second one of its family where it has one (and VK_KHR_external_memory_win32 on Windows, +// VK_KHR_external_memory_fd elsewhere, where the driver has it, as a program that shares images enables it), all +// through vulkan-1.dll (libvulkan.so.1) looked up at run time (oc_conformance starts without it). Textures are filled +// from a staging buffer and left in VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, as OpenVR's Vulkan games submit them. #include "GfxApi.h" +#include + #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN @@ -20,6 +22,7 @@ #endif #include +#include #include namespace { @@ -52,6 +55,10 @@ class VkGfx : public GfxApi { VkPhysicalDevice physical = VK_NULL_HANDLE; VkDevice device = VK_NULL_HANDLE; VkQueue queue = VK_NULL_HANDLE; + // The family's second queue where it has one (UseOtherQueue) + VkQueue otherQueue = VK_NULL_HANDLE; + // The queue textures are filled on and submitted with + VkQueue current = VK_NULL_HANDLE; uint32_t family = 0; VkPhysicalDeviceMemoryProperties memProps{}; struct Made { @@ -69,6 +76,12 @@ class VkGfx : public GfxApi { { if (device) { Flush(); + if (busyFence) + D("vkDestroyFence")(device, busyFence, nullptr); + if (paintPool) + D("vkDestroyCommandPool")(device, paintPool, nullptr); + if (busyPool) + D("vkDestroyCommandPool")(device, busyPool, nullptr); for (const Made& m : made) { D("vkDestroyImage")(device, m.image, nullptr); D("vkFreeMemory")(device, m.memory, nullptr); @@ -79,6 +92,10 @@ class VkGfx : public GfxApi { I("vkDestroyInstance")(instance, nullptr); } + // The case's device extensions (MakeVkGfxWith), and the ones enabled + std::function(void*, void*)> deviceExtensions; + std::vector enabledDeviceExtensions; + bool Init(std::string* whyNot) { #ifdef _WIN32 @@ -129,31 +146,47 @@ class VkGfx : public GfxApi { *whyNot = "no Vulkan graphics queue"; return false; } - float priority = 1; + const float priorities[2] = { 1, 1 }; VkDeviceQueueCreateInfo qci{ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO }; qci.queueFamilyIndex = family; - qci.queueCount = 1; - qci.pQueuePriorities = &priority; + qci.queueCount = props[family].queueCount >= 2 ? 2 : 1; + qci.pQueuePriorities = priorities; VkDeviceCreateInfo dci{ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO }; dci.queueCreateInfoCount = 1; dci.pQueueCreateInfos = &qci; + // The extensions wanted that the GPU has: external memory is core in 1.1, its handles an extension: Windows ones + // for D3D11, file descriptors for sharing images with OpenLamina's own device (unless + // OC_CONFORMANCE_NO_EXTERNAL_MEMORY is set); and those the case asks for + std::vector wanted; #ifdef _WIN32 - // External memory is core in 1.1; its Windows handles are an extension - const char* externalMemory = "VK_KHR_external_memory_win32"; - if (app.apiVersion >= VK_API_VERSION_1_1) { - auto enumerateExtensions = I("vkEnumerateDeviceExtensionProperties"); - uint32_t extensionCount = 0; - enumerateExtensions(physical, nullptr, &extensionCount, nullptr); - std::vector extensions(extensionCount); - enumerateExtensions(physical, nullptr, &extensionCount, extensions.data()); + if (app.apiVersion >= VK_API_VERSION_1_1) + wanted.push_back("VK_KHR_external_memory_win32"); +#else + if (app.apiVersion >= VK_API_VERSION_1_1 && !std::getenv("OC_CONFORMANCE_NO_EXTERNAL_MEMORY")) + wanted.push_back("VK_KHR_external_memory_fd"); +#endif + if (deviceExtensions) { + for (const std::string& e : deviceExtensions(instance, physical)) + wanted.push_back(e); + } + auto enumerateExtensions = I("vkEnumerateDeviceExtensionProperties"); + uint32_t extensionCount = 0; + enumerateExtensions(physical, nullptr, &extensionCount, nullptr); + std::vector extensions(extensionCount); + enumerateExtensions(physical, nullptr, &extensionCount, extensions.data()); + std::vector names; + for (const std::string& w : wanted) { for (const VkExtensionProperties& e : extensions) { - if (!std::strcmp(e.extensionName, externalMemory)) { - dci.enabledExtensionCount = 1; - dci.ppEnabledExtensionNames = &externalMemory; - } + if (w == e.extensionName && std::find(names.begin(), names.end(), w) == names.end()) + names.push_back(w); } } -#endif + std::vector enabled; + for (const std::string& n : names) + enabled.push_back(n.c_str()); + dci.enabledExtensionCount = (uint32_t)enabled.size(); + dci.ppEnabledExtensionNames = enabled.data(); + enabledDeviceExtensions = names; r = I("vkCreateDevice")(physical, &dci, nullptr, &device); if (r != VK_SUCCESS) { device = VK_NULL_HANDLE; @@ -162,6 +195,9 @@ class VkGfx : public GfxApi { } gdpa = I("vkGetDeviceProcAddr"); D("vkGetDeviceQueue")(device, family, 0, &queue); + if (qci.queueCount >= 2) + D("vkGetDeviceQueue")(device, family, 1, &otherQueue); + current = queue; I("vkGetPhysicalDeviceMemoryProperties")(physical, &memProps); return true; } @@ -196,7 +232,7 @@ class VkGfx : public GfxApi { VkSubmitInfo si{ VK_STRUCTURE_TYPE_SUBMIT_INFO }; si.commandBufferCount = 1; si.pCommandBuffers = &cb; - ok = D("vkQueueSubmit")(queue, 1, &si, VK_NULL_HANDLE) == VK_SUCCESS; + ok = D("vkQueueSubmit")(current, 1, &si, VK_NULL_HANDLE) == VK_SUCCESS; Flush(); } D("vkDestroyCommandPool")(device, pool, nullptr); @@ -218,7 +254,7 @@ class VkGfx : public GfxApi { } // An image with its own memory, kept until the GfxApi goes - VkImage MakeImage(VkFormat format, uint32_t w, uint32_t h, uint32_t layers, VkImageUsageFlags usage) + VkImage MakeImage(VkFormat format, uint32_t w, uint32_t h, uint32_t layers, VkImageUsageFlags usage, uint32_t samples = 1) { VkImageCreateInfo ici{ VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO }; ici.imageType = VK_IMAGE_TYPE_2D; @@ -226,7 +262,7 @@ class VkGfx : public GfxApi { ici.extent = { w, h, 1 }; ici.mipLevels = 1; ici.arrayLayers = layers; - ici.samples = VK_SAMPLE_COUNT_1_BIT; + ici.samples = (VkSampleCountFlagBits)samples; ici.tiling = VK_IMAGE_TILING_OPTIMAL; ici.usage = usage; ici.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; @@ -260,7 +296,7 @@ class VkGfx : public GfxApi { g.vk.m_pDevice = (VkDevice_T*)device; g.vk.m_pPhysicalDevice = (VkPhysicalDevice_T*)physical; g.vk.m_pInstance = (VkInstance_T*)instance; - g.vk.m_pQueue = (VkQueue_T*)queue; + g.vk.m_pQueue = (VkQueue_T*)current; g.vk.m_nQueueFamilyIndex = family; g.vk.m_nWidth = w; g.vk.m_nHeight = h; @@ -275,8 +311,10 @@ class VkGfx : public GfxApi { { gfx::Texels texels = TexelsOfVk(nativeFormat); auto format = (VkFormat)nativeFormat; - if (texels == gfx::Texels::Unknown || !w || !h || samples > 1) - return Wrap(VK_NULL_HANDLE, format, w, h, samples); // multisampled patterns: D3D11 only for now + if (texels == gfx::Texels::Unknown || !w || !h) + return Wrap(VK_NULL_HANDLE, format, w, h, samples); + if (samples > 1) + return Multisampled(w, h, format, eye, samples); arraySize = arraySize ? arraySize : 1; VkImage image = MakeImage(format, w, h, arraySize, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); @@ -350,10 +388,199 @@ class VkGfx : public GfxApi { return Wrap(ok ? image : VK_NULL_HANDLE, VK_FORMAT_D32_SFLOAT, w, h, 1); } + // A multisampled pattern: the quadrants alone (no grey block), each cleared in a render pass, as a game's renders + // leave a multisampled image (every sample of a texel the same). Left in TRANSFER_SRC_OPTIMAL. + GfxTexture Multisampled(uint32_t w, uint32_t h, VkFormat format, int eye, uint32_t samples) + { + VkImage image = MakeImage(format, w, h, 1, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, samples); + if (!image) + return Wrap(VK_NULL_HANDLE, format, w, h, samples); + VkAttachmentDescription attachment{}; + attachment.format = format; + attachment.samples = (VkSampleCountFlagBits)samples; + attachment.loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; + attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; + attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; + attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; + attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + attachment.finalLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + VkAttachmentReference ref{ 0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL }; + VkSubpassDescription subpass{}; + subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; + subpass.colorAttachmentCount = 1; + subpass.pColorAttachments = &ref; + // The pass's writes are over before a later transfer reads the image + VkSubpassDependency after{}; + after.srcSubpass = 0; + after.dstSubpass = VK_SUBPASS_EXTERNAL; + after.srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; + after.dstStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; + after.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; + after.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; + VkRenderPassCreateInfo rpci{ VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO }; + rpci.attachmentCount = 1; + rpci.pAttachments = &attachment; + rpci.subpassCount = 1; + rpci.pSubpasses = &subpass; + rpci.dependencyCount = 1; + rpci.pDependencies = &after; + VkRenderPass pass = VK_NULL_HANDLE; + VkImageView view = VK_NULL_HANDLE; + VkFramebuffer framebuffer = VK_NULL_HANDLE; + bool ok = D("vkCreateRenderPass")(device, &rpci, nullptr, &pass) == VK_SUCCESS; + if (ok) { + VkImageViewCreateInfo vci{ VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO }; + vci.image = image; + vci.viewType = VK_IMAGE_VIEW_TYPE_2D; + vci.format = format; + vci.subresourceRange = { VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }; + ok = D("vkCreateImageView")(device, &vci, nullptr, &view) == VK_SUCCESS; + } + if (ok) { + VkFramebufferCreateInfo fci{ VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO }; + fci.renderPass = pass; + fci.attachmentCount = 1; + fci.pAttachments = &view; + fci.width = w; + fci.height = h; + fci.layers = 1; + ok = D("vkCreateFramebuffer")(device, &fci, nullptr, &framebuffer) == VK_SUCCESS; + } + if (ok) { + ok = Run([&](VkCommandBuffer cb) { + VkRenderPassBeginInfo bi{ VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO }; + bi.renderPass = pass; + bi.framebuffer = framebuffer; + bi.renderArea = { { 0, 0 }, { w, h } }; + D("vkCmdBeginRenderPass")(cb, &bi, VK_SUBPASS_CONTENTS_INLINE); + const uint32_t halfW = w / 2, halfH = h / 2; + const VkRect2D quadrants[4] = { + { { 0, 0 }, { halfW, halfH } }, + { { (int32_t)halfW, 0 }, { w - halfW, halfH } }, + { { 0, (int32_t)halfH }, { halfW, h - halfH } }, + { { (int32_t)halfW, (int32_t)halfH }, { w - halfW, h - halfH } }, + }; + // Each quadrant's colour, from its outer corner (away from the grey block) + const uint32_t corners[4][2] = { { 0, 0 }, { w - 1, 0 }, { 0, h - 1 }, { w - 1, h - 1 } }; + for (int i = 0; i < 4; i++) { + const VkRect2D& q = quadrants[i]; + // The quadrants' colours are 0 and 255 in each channel: the same in sRGB and linear + uint32_t c = gfx::PatternColour(corners[i][0], corners[i][1], w, h, eye); + VkClearAttachment clear{}; + clear.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + clear.colorAttachment = 0; + clear.clearValue.color = { { (c >> 24) / 255.0f, ((c >> 16) & 0xff) / 255.0f, ((c >> 8) & 0xff) / 255.0f, (c & 0xff) / 255.0f } }; + VkClearRect rect{ q, 0, 1 }; + D("vkCmdClearAttachments")(cb, 1, &clear, 1, &rect); + } + D("vkCmdEndRenderPass")(cb); + }); + } + if (framebuffer) + D("vkDestroyFramebuffer")(device, framebuffer, nullptr); + if (view) + D("vkDestroyImageView")(device, view, nullptr); + if (pass) + D("vkDestroyRenderPass")(device, pass, nullptr); + return Wrap(ok ? image : VK_NULL_HANDLE, format, w, h, samples); + } + + bool UseOtherQueue() override + { + if (!otherQueue) + return false; + Flush(); + current = otherQueue; + return true; + } + + VkCommandPool paintPool = VK_NULL_HANDLE; + std::vector paints; + + void Paint(GfxTexture& tex, uint32_t rgba) override + { + VkCommandPoolCreateInfo pci{ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO }; + pci.queueFamilyIndex = family; + if (!paintPool && D("vkCreateCommandPool")(device, &pci, nullptr, &paintPool) != VK_SUCCESS) + return; + VkCommandBufferAllocateInfo ai{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO }; + ai.commandPool = paintPool; + ai.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + ai.commandBufferCount = 1; + VkCommandBuffer cb = VK_NULL_HANDLE; + if (D("vkAllocateCommandBuffers")(device, &ai, &cb) != VK_SUCCESS) + return; + paints.push_back(cb); + VkCommandBufferBeginInfo bi{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO }; + bi.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; + D("vkBeginCommandBuffer")(cb, &bi); + const VkImage image = (VkImage)tex.vk.m_nImage; + Barrier(cb, image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); + // 0 and 255 in each channel: the same in sRGB and linear + VkClearColorValue colour{ { (rgba >> 24) / 255.0f, ((rgba >> 16) & 0xff) / 255.0f, ((rgba >> 8) & 0xff) / 255.0f, (rgba & 0xff) / 255.0f } }; + VkImageSubresourceRange range{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, VK_REMAINING_ARRAY_LAYERS }; + D("vkCmdClearColorImage")(cb, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &colour, 1, &range); + Barrier(cb, image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL); + D("vkEndCommandBuffer")(cb); + VkSubmitInfo si{ VK_STRUCTURE_TYPE_SUBMIT_INFO }; + si.commandBufferCount = 1; + si.pCommandBuffers = &cb; + D("vkQueueSubmit")(queue, 1, &si, VK_NULL_HANDLE); + } + + VkImage busyImage = VK_NULL_HANDLE; + VkCommandPool busyPool = VK_NULL_HANDLE; + VkCommandBuffer busyCommands = VK_NULL_HANDLE; + VkFence busyFence = VK_NULL_HANDLE; + + void Busy(int n) override + { + if (n <= 0) + return; + if (!busyImage) { + busyImage = MakeImage(VK_FORMAT_R8G8B8A8_UNORM, 4096, 4096, 1, VK_IMAGE_USAGE_TRANSFER_DST_BIT); + VkCommandPoolCreateInfo pci{ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO }; + pci.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; + pci.queueFamilyIndex = family; + VkFenceCreateInfo fci{ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO }; + fci.flags = VK_FENCE_CREATE_SIGNALED_BIT; + if (!busyImage || D("vkCreateCommandPool")(device, &pci, nullptr, &busyPool) != VK_SUCCESS + || D("vkCreateFence")(device, &fci, nullptr, &busyFence) != VK_SUCCESS) + return; + VkCommandBufferAllocateInfo ai{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO }; + ai.commandPool = busyPool; + ai.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + ai.commandBufferCount = 1; + D("vkAllocateCommandBuffers")(device, &ai, &busyCommands); + } + if (!busyCommands) + return; + // The last round's clears are over before the command buffer is recorded again + D("vkWaitForFences")(device, 1, &busyFence, VK_TRUE, UINT64_MAX); + D("vkResetFences")(device, 1, &busyFence); + VkCommandBufferBeginInfo bi{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO }; + bi.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; + D("vkBeginCommandBuffer")(busyCommands, &bi); + Barrier(busyCommands, busyImage, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); + VkImageSubresourceRange range{ VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1 }; + for (int i = 0; i < n; i++) { + VkClearColorValue colour{ { (float)(i % 2), 0, 0, 1 } }; + D("vkCmdClearColorImage")(busyCommands, busyImage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &colour, 1, &range); + Barrier(busyCommands, busyImage, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); + } + D("vkEndCommandBuffer")(busyCommands); + VkSubmitInfo si{ VK_STRUCTURE_TYPE_SUBMIT_INFO }; + si.commandBufferCount = 1; + si.pCommandBuffers = &busyCommands; + D("vkQueueSubmit")(queue, 1, &si, busyFence); + } + void Flush() override { if (queue) D("vkQueueWaitIdle")(queue); + if (otherQueue) + D("vkQueueWaitIdle")(otherQueue); } }; @@ -366,3 +593,12 @@ std::unique_ptr MakeVkGfx(std::string* whyNot) return nullptr; return g; } + +std::unique_ptr MakeVkGfxWith(std::string* whyNot, const std::function(void*, void*)>& deviceExtensions) +{ + auto g = std::make_unique(); + g->deviceExtensions = deviceExtensions; + if (!g->Init(whyNot)) + return nullptr; + return g; +} diff --git a/tests/conformance/gfx_cases.cpp b/tests/conformance/gfx_cases.cpp index 247343a6..ea993c56 100644 --- a/tests/conformance/gfx_cases.cpp +++ b/tests/conformance/gfx_cases.cpp @@ -10,9 +10,11 @@ #include "IVRCompositor_029.h" #include "IVROverlay_028.h" +#include "IVRSystem_022.h" #ifdef _WIN32 #include +#include #endif #include @@ -23,6 +25,10 @@ #include #include #include +#include +#ifndef _WIN32 +#include +#endif using namespace conformance; @@ -56,6 +62,15 @@ std::unique_ptr GfxApi::Create(GfxKind kind, std::string* whyNot) #endif } +std::unique_ptr GfxApi::CreateOnWarp(GfxKind kind, std::string* whyNot) +{ +#ifdef _WIN32 + if (kind == GfxKind::D3D12) + return MakeD3D12Gfx(whyNot, true); +#endif + return Create(kind, whyNot); +} + namespace { // Formats in each API's own enum: RGBA8 sRGB @@ -74,7 +89,18 @@ Json::Value Skipped(const std::string& why) } // 1024x1024 per eye, full bounds, kFrames frames -void Basic(CaseContext& c, GfxKind kind, int64_t format) +// The file OpenLamina's CompositorDumpImages writes an eye's image to (BaseCompositor::DumpImageName) +std::string BaseCompositorDumpName(vr::EVREye eye) +{ +#ifdef _WIN32 + const unsigned long pid = GetCurrentProcessId(); +#else + const unsigned long pid = (unsigned long)getpid(); +#endif + return "compositor-dump." + std::to_string(pid) + (eye == vr::Eye_Left ? ".left.png" : ".right.png"); +} + +void Basic(CaseContext& c, GfxKind kind, int64_t format, bool dump = false) { std::string why; std::unique_ptr gfx = GfxApi::Create(kind, &why); @@ -111,6 +137,9 @@ void Basic(CaseContext& c, GfxKind kind, int64_t format) r["wait"] = (int)comp->WaitGetPoses(poses, 16, nullptr, 0); r["left"] = (int)comp->Submit(vr::Eye_Left, left.Texture(), &bounds, vr::Submit_Default); r["right"] = (int)comp->Submit(vr::Eye_Right, right.Texture(), &bounds, vr::Submit_Default); + // CompositorDumpImages: the next frame's eyes, as PNGs in the log folder + if (dump && frame == 2) + comp->CompositorDumpImages(); } r["frames"] = kFrames; r["dump_join"] = "last_projection"; @@ -118,6 +147,59 @@ void Basic(CaseContext& c, GfxKind kind, int64_t format) // OpenLamina first, then the textures and the device (OpenVR's rule for every API) c.core->Cleanup(); gfx->Flush(); + if (dump) { + Json::Value d; + const char* logs = std::getenv("OC_LOG_DIR"); + const std::filesystem::path folder = logs ? logs : "."; + for (vr::EVREye eye : { vr::Eye_Left, vr::Eye_Right }) { + std::error_code ec; + const std::filesystem::path png = folder / BaseCompositorDumpName(eye); + const auto size = std::filesystem::file_size(png, ec); + d[eye == vr::Eye_Left ? "left_png" : "right_png"] = !ec && size > 1000; + } + c.Record("dump images", d); + } +} + +// A game of the API that submits a few frames, then calls WaitGetPoses without Submit: those frames are ended for it +// inside the call (its last frame again), on the thread it renders on (and, for OpenGL, with its context current) +void WaitWithoutSubmit(CaseContext& c, GfxKind kind, int64_t format) +{ + std::string why; + std::unique_ptr gfx = GfxApi::Create(kind, &why); + if (!gfx) { + c.Record("frames", Skipped(why)); + return; + } + GfxTexture eye = gfx->Pattern(256, 256, format, 0); + gfx->Flush(); + if (!eye.Made() || c.core->Init(vr::VRApplication_Scene, nullptr) != vr::VRInitError_None) { + c.Record("Init failed"); + return; + } + vr::EVRInitError le = vr::VRInitError_None; + auto* comp = (vr::IVRCompositor_029::IVRCompositor*)c.core->GetGenericInterface("IVRCompositor_029", &le); + if (!comp) { + c.Record("no compositor"); + c.core->Cleanup(); + return; + } + vr::VRTextureBounds_t bounds{ 0, 0, 1, 1 }; + vr::TrackedDevicePose_t poses[16]; + for (int frame = 1; frame <= 5; frame++) { + comp->WaitGetPoses(poses, 16, nullptr, 0); + comp->Submit(vr::Eye_Left, eye.Texture(), &bounds, vr::Submit_Default); + comp->Submit(vr::Eye_Right, eye.Texture(), &bounds, vr::Submit_Default); + } + for (int frame = 1; frame <= 20; frame++) + comp->WaitGetPoses(poses, 16, nullptr, 0); + c.core->Cleanup(); + gfx->Flush(); + Json::Value dump = ReadStandInDump(); + Json::Value r; + r["frames_ended_at_least_22"] = dump["frames_ended"].asInt64() >= 22; + r["frame_order_errors"] = dump["frame_order_errors"]; + c.Record("frames", r); } // The test pattern of eye 0, w x h, as RGBA8 bytes, rows top to bottom @@ -321,8 +403,9 @@ std::string RectJoin(uint32_t w, uint32_t h) } // One texture per eye of each format, a size of its own each (the dump's projection layer is found by its rect), under -// a script whose runtime offers RGBA8 sRGB only: each is converted into it -void Formats(CaseContext& c, GfxKind kind, const std::vector>& formats) +// a script whose runtime offers RGBA8 sRGB only: each is converted into it. samples > 1: multisampled textures +// (resolved, then converted), which have the quadrants alone. +void Formats(CaseContext& c, GfxKind kind, const std::vector>& formats, uint32_t samples = 1) { Scene s(c); if (!s.Start(kind, "format " + formats[0].first)) @@ -330,8 +413,8 @@ void Formats(CaseContext& c, GfxKind kind, const std::vectorPattern(size, size, format, 0); - GfxTexture right = s.gfx->Pattern(size, size, format, 1); + GfxTexture left = s.gfx->Pattern(size, size, format, 0, samples); + GfxTexture right = s.gfx->Pattern(size, size, format, 1, samples); s.gfx->Flush(); Json::Value r; if (!left.Made() || !right.Made()) { @@ -444,6 +527,197 @@ void Bounds(CaseContext& c, GfxKind kind, int64_t format) } } +// Vulkan textures out of the ordinary, under a script whose runtime has single-sampled swapchains only (so a multisampled +// texture is resolved): 4x MSAA RGBA8 sRGB of 600 x 600 with full bounds, the same of 640 x 640 with flipped bounds +// (resolved, then flipped by a blit), and 512 x 512 textures filled on, and submitted with, a second queue of the first +// one's family (skipped where the family has one queue), done there before they're submitted. +// Multisampled patterns have the quadrants alone. Each found in the dump by its size. +void VkOdd(CaseContext& c) +{ + Scene s(c); + if (!s.Start(GfxKind::Vulkan, "msaa")) + return; + struct Odd { + const char* name; + uint32_t size, samples; + vr::VRTextureBounds_t bounds; + bool otherQueue; + }; + const Odd odds[] = { + { "msaa", 600, 4, kFull, false }, + { "msaa flipped", 640, 4, { 0, 1, 1, 0 }, false }, + { "other queue", 512, 1, kFull, true }, + }; + bool first = true; + for (const Odd& o : odds) { + Json::Value r; + if (o.otherQueue && !s.gfx->UseOtherQueue()) { + c.Record(o.name, Skipped("the queue family has one queue")); + continue; + } + GfxTexture left = s.gfx->Pattern(o.size, o.size, kVkRGBA8Srgb, 0, o.samples); + GfxTexture right = s.gfx->Pattern(o.size, o.size, kVkRGBA8Srgb, 1, o.samples); + s.gfx->Flush(); + if (!left.Made() || !right.Made()) { + r["error"] = "the pattern textures couldn't be made"; + } else { + s.Frames(first ? kFrames : 4, left, right, o.bounds, o.bounds, r); + r["dump_join"] = RectJoin(o.size, o.size); + } + c.Record(o.name, r); + first = false; + } +} + +// A Vulkan game whose textures change size from frame to frame (dynamic resolution): 800, 640, 720 and then 960 pixels a +// side, each for 4 frames. Each size's view shows its whole texture; the swapchain under it (image) is made again +// only when the texture grows past it: 800 x 800 for the first three, 960 x 960 for the last. +void VkDynamicResolution(CaseContext& c) +{ + Scene s(c); + if (!s.Start(GfxKind::Vulkan, "800")) + return; + bool first = true; + for (uint32_t size : { 800u, 640u, 720u, 960u }) { + GfxTexture left = s.gfx->Pattern(size, size, kVkRGBA8Srgb, 0); + GfxTexture right = s.gfx->Pattern(size, size, kVkRGBA8Srgb, 1); + s.gfx->Flush(); + Json::Value r; + if (!left.Made() || !right.Made()) { + r["error"] = "the pattern textures couldn't be made"; + } else { + s.Frames(first ? kFrames : 4, left, right, kFull, kFull, r); + r["dump_join"] = RectJoin(size, size); + } + c.Record(std::to_string(size), r); + first = false; + } +} + +// A game that makes its device again mid-run (as after a device removal, or a GPU switch in its settings): 512 x 512 +// textures of its first device for 10 frames, then 576 x 576 ones of a new device of the same API for 10 frames. +// D3D11 and D3D12: the session follows the textures onto the new device; under a script whose runtime refuses that +// session (the third xrCreateSession), the game's frames are left out. Vulkan: the new device's are refused. The game +// isn't told to quit ("quit": a VREvent_Quit came). +void NewDevice(CaseContext& c, GfxKind kind, int64_t format) +{ + Scene s(c); + if (!s.Start(kind, "first device")) + return; + vr::EVRInitError le = vr::VRInitError_None; + auto* sys = (vr::IVRSystem_022::IVRSystem*)c.core->GetGenericInterface("IVRSystem_022", &le); + bool quit = false; + auto frames = [&](GfxTexture& left, GfxTexture& right, Json::Value& r) { + for (int frame = 1; frame <= kFrames; frame++) { + s.Frames(1, left, right, kFull, kFull, r); + vr::VREvent_t ev{}; + while (sys && sys->PollNextEvent(&ev, sizeof(ev))) + quit = quit || ev.eventType == vr::VREvent_Quit; + } + }; + { + GfxTexture left = s.gfx->Pattern(512, 512, format, 0); + GfxTexture right = s.gfx->Pattern(512, 512, format, 1); + s.gfx->Flush(); + Json::Value r; + if (!left.Made() || !right.Made()) { + r["error"] = "the pattern textures couldn't be made"; + } else { + frames(left, right, r); + r["dump_join"] = RectJoin(512, 512); + } + c.Record("first device", r); + } + std::string why; + std::unique_ptr second = GfxApi::CreateOnWarp(kind, &why); + if (!second) { + c.Record("new device", Skipped(why)); + return; + } + GfxTexture left = second->Pattern(576, 576, format, 0); + GfxTexture right = second->Pattern(576, 576, format, 1); + second->Flush(); +#ifdef _WIN32 + if (kind == GfxKind::D3D12 && left.Made()) { + // One D3D12 device per adapter: with WARP the only adapter, the second device is the first + GfxTexture probe = s.gfx->Pattern(8, 8, format, 0); + ID3D12Device *a = nullptr, *b = nullptr; + if (probe.Made()) + probe.d3d12.m_pResource->GetDevice(IID_PPV_ARGS(&a)); + left.d3d12.m_pResource->GetDevice(IID_PPV_ARGS(&b)); + const bool same = a == b; + if (a) + a->Release(); + if (b) + b->Release(); + if (same) { + c.Record("new device", Skipped("one D3D12 adapter: the second device is the first")); + c.core->Cleanup(); + s.started = false; + return; + } + } +#endif + Json::Value r; + if (!left.Made() || !right.Made()) { + r["error"] = "the pattern textures couldn't be made"; + } else { + frames(left, right, r); + r["dump_join"] = RectJoin(576, 576); + } + r["quit"] = quit; + c.Record("new device", r); + // OpenLamina first, then the textures and the devices + c.core->Cleanup(); + s.started = false; + second->Flush(); +} + +// A D3D11 game whose eyes are on two devices (the left eye on its first one, the right on a second), 10 frames: the +// session follows the eye on the other device a few times (ending on the right eye's), and then the left is left out. No frame names a swapchain of a session +// that's gone ("no_invalid_layers"), and the game isn't told to quit. +void EyesOnTwoDevices(CaseContext& c) +{ + Scene s(c); + if (!s.Start(GfxKind::D3D11, "eyes on two devices")) + return; + vr::EVRInitError le = vr::VRInitError_None; + auto* sys = (vr::IVRSystem_022::IVRSystem*)c.core->GetGenericInterface("IVRSystem_022", &le); + std::string why; + std::unique_ptr second = GfxApi::Create(GfxKind::D3D11, &why); + if (!second) { + c.Record("eyes on two devices", Skipped(why)); + return; + } + GfxTexture left = s.gfx->Pattern(512, 512, kDxgiRGBA8Srgb, 0); + GfxTexture right = second->Pattern(512, 512, kDxgiRGBA8Srgb, 1); + s.gfx->Flush(); + second->Flush(); + Json::Value r; + bool quit = false; + for (int frame = 1; frame <= kFrames; frame++) { + s.Frames(1, left, right, kFull, kFull, r); + vr::VREvent_t ev{}; + while (sys && sys->PollNextEvent(&ev, sizeof(ev))) + quit = quit || ev.eventType == vr::VREvent_Quit; + } + r["quit"] = quit; + c.core->Cleanup(); + s.started = false; + second->Flush(); + Json::Value dump = ReadStandInDump(); + if (!dump.isNull()) { + bool clean = true; + for (const Json::Value& layer : dump["layers"]) { + clean = clean && layer["invalid"].empty(); + for (const Json::Value& view : layer["views"]) + clean = clean && view["invalid"].empty(); + } + r["no_invalid_layers"] = clean; + } + c.Record("eyes on two devices", r); +} + // The pose a frame was rendered with and its depth: each eye's texture goes with a head pose 0.5 m to the left of the // one WaitGetPoses gave, and a depth texture of the colour's size of 0.25 everywhere from a projection with near 0.1 and // far 100 (Submit_TextureWithPose | Submit_TextureWithDepth). "pose-depth": 512 x 512 per eye, full bounds; "halves": @@ -577,6 +851,8 @@ void Skybox(CaseContext& c, uint32_t count) l["eye_visibility"] = layer["eye_visibility"]; l["rect"] = layer["rect"]; l["tl"] = layer["samples"]["tl"]; + if (layer.isMember("grid")) + l["grid"] = layer["grid"]; l["invalid"] = layer["invalid"]; last.append(l); } @@ -688,8 +964,282 @@ void Mirror(CaseContext& c) r["hidden"] = !s.comp->IsMirrorWindowVisible(); c.Record("mirror", r); } + +// The D3D11 mirror texture of frames with bounds that run backwards (expect/compositor.json): 256 x 256 per eye, the +// mirror asked for once, then 3 frames with each bounds and the left eye's mirror read at its top-left. As the eye +// shows it: the pattern's top-left (red) for full bounds, its bottom-left (blue) turned upside down, its top-right +// (green) turned left to right, its bottom-right (white) turned both ways. +void MirrorFlipped(CaseContext& c) +{ + Scene s(c); + if (!s.Start(GfxKind::D3D11, "mirror flipped")) + return; + GfxTexture left = s.gfx->Pattern(256, 256, kDxgiRGBA8Srgb, 0); + GfxTexture right = s.gfx->Pattern(256, 256, kDxgiRGBA8Srgb, 1); + s.gfx->Flush(); + ID3D11Device* device = nullptr; + ((ID3D11Texture2D*)left.tex.handle)->GetDevice(&device); + struct Config { + const char* name; + vr::VRTextureBounds_t bounds; + }; + const Config configs[] = { + { "full", { 0, 0, 1, 1 } }, + { "flipped v", { 0, 1, 1, 0 } }, + { "flipped u", { 1, 0, 0, 1 } }, + { "flipped both", { 1, 1, 0, 0 } }, + }; + Json::Value r; + // Asked for once first: frames are copied into the mirror from then on + { + ID3D11ShaderResourceView* view = nullptr; + r["first_get"] = (int)s.comp->GetMirrorTextureD3D11(vr::Eye_Left, device, (void**)&view); + if (view) + s.comp->ReleaseMirrorTextureD3D11(view); + } + for (const Config& cfg : configs) { + Json::Value answers; + s.Frames(3, left, right, cfg.bounds, cfg.bounds, answers); + ID3D11ShaderResourceView* view = nullptr; + Json::Value one; + one["get"] = (int)s.comp->GetMirrorTextureD3D11(vr::Eye_Left, device, (void**)&view); + char hex[9] = ""; + if (view) { + snprintf(hex, sizeof(hex), "%08x", TopLeftOfView(view)); + s.comp->ReleaseMirrorTextureD3D11(view); + } + one["top_left"] = hex; + r[cfg.name] = one; + } + device->Release(); + c.Record("mirror flipped", r); +} #endif +// Odd OpenGL textures through the interop (a runtime with D3D11 alone; expect/gfx_interop.json), each its own size: +// slice 1 of two-slice array textures (SubmitWithArrayIndex: the other eye's pattern), one two-slice array of eye 0's +// pattern submitted with Submit_GlArrayTexture and no index (the left eye slice 0, the right slice 1: eye 1's pattern), +// a 4x multisampled texture, a renderbuffer (Submit_GlRenderBuffer), a 4x multisampled one, and a renderbuffer with +// flipped bounds (upside down). Every one shown the right way up, as a plain texture is, while another texture is +// bound in the context, as in most games. +void GlInteropOdd(CaseContext& c) +{ + Scene s(c); + if (!s.Start(GfxKind::OpenGL, "array slice 1")) + return; + s.gfx->LeaveTextureBound(); + enum class Make { Array, ArrayFlag, Multisampled, Renderbuffer }; + struct Odd { + const char* name; + uint32_t size; + Make make; + uint32_t samples; + vr::VRTextureBounds_t bounds; + }; + const Odd odds[] = { + { "array slice 1", 320, Make::Array, 1, kFull }, + { "array flag", 352, Make::ArrayFlag, 1, kFull }, + { "msaa", 384, Make::Multisampled, 4, kFull }, + { "renderbuffer", 416, Make::Renderbuffer, 1, kFull }, + { "msaa renderbuffer", 448, Make::Renderbuffer, 4, kFull }, + { "renderbuffer flipped", 480, Make::Renderbuffer, 1, { 0, 1, 1, 0 } }, + }; + bool first = true; + for (const Odd& o : odds) { + GfxTexture left, right; + vr::EVRSubmitFlags flags = vr::Submit_Default; + int slice = -1; + switch (o.make) { + case Make::Array: + left = s.gfx->Pattern(o.size, o.size, kGlSRGB8Alpha8, 0, 1, 2); + right = s.gfx->Pattern(o.size, o.size, kGlSRGB8Alpha8, 1, 1, 2); + slice = 1; + break; + case Make::ArrayFlag: + left = right = s.gfx->Pattern(o.size, o.size, kGlSRGB8Alpha8, 0, 1, 2); + flags = vr::Submit_GlArrayTexture; + break; + case Make::Multisampled: + left = s.gfx->Pattern(o.size, o.size, kGlSRGB8Alpha8, 0, o.samples); + right = s.gfx->Pattern(o.size, o.size, kGlSRGB8Alpha8, 1, o.samples); + break; + case Make::Renderbuffer: + left = s.gfx->Renderbuffer(o.size, o.size, kGlSRGB8Alpha8, 0, o.samples); + right = s.gfx->Renderbuffer(o.size, o.size, kGlSRGB8Alpha8, 1, o.samples); + flags = vr::Submit_GlRenderBuffer; + break; + } + s.gfx->Flush(); + Json::Value r; + if (!left.Made() || !right.Made()) { + r["error"] = "the pattern textures couldn't be made"; + } else { + s.Frames(first ? kFrames : 4, left, right, o.bounds, o.bounds, r, flags, slice); + r["dump_join"] = RectJoin(o.size, o.size); + } + c.Record(o.name, r); + first = false; + } +} + +// Vulkan array textures through the interop (a runtime with D3D11 alone; expect/gfx_interop.json): slice 1 of two-slice +// arrays through SubmitWithArrayIndex (320 x 320), and through Submit_VulkanTextureWithArrayData (352 x 352); each eye +// shows the other eye's pattern +void VkInteropOdd(CaseContext& c) +{ + Scene s(c); + if (!s.Start(GfxKind::Vulkan, "array slice 1")) + return; + { + GfxTexture left = s.gfx->Pattern(320, 320, kVkRGBA8Srgb, 0, 1, 2); + GfxTexture right = s.gfx->Pattern(320, 320, kVkRGBA8Srgb, 1, 1, 2); + s.gfx->Flush(); + Json::Value r; + if (!left.Made() || !right.Made()) { + r["error"] = "the pattern textures couldn't be made"; + } else { + s.Frames(kFrames, left, right, kFull, kFull, r, vr::Submit_Default, 1); + r["dump_join"] = RectJoin(320, 320); + } + c.Record("array slice 1", r); + } + GfxTexture left = s.gfx->Pattern(352, 352, kVkRGBA8Srgb, 0, 1, 2); + GfxTexture right = s.gfx->Pattern(352, 352, kVkRGBA8Srgb, 1, 1, 2); + s.gfx->Flush(); + Json::Value r; + if (!left.Made() || !right.Made()) { + r["error"] = "the pattern textures couldn't be made"; + c.Record("array data", r); + return; + } + vr::VRVulkanTextureArrayData_t data[2]; + GfxTexture* eyes[2] = { &left, &right }; + vr::Texture_t textures[2]; + for (int eye = 0; eye < 2; eye++) { + static_cast(data[eye]) = eyes[eye]->vk; + data[eye].m_unArrayIndex = 1; + data[eye].m_unArraySize = 2; + textures[eye] = *eyes[eye]->Texture(); + textures[eye].handle = &data[eye]; + } + for (int frame = 1; frame <= 4; frame++) { + vr::TrackedDevicePose_t poses[16]; + s.comp->WaitGetPoses(poses, 16, nullptr, 0); + r["left"] = (int)s.comp->Submit(vr::Eye_Left, &textures[0], &kFull, vr::Submit_VulkanTextureWithArrayData); + r["right"] = (int)s.comp->Submit(vr::Eye_Right, &textures[1], &kFull, vr::Submit_VulkanTextureWithArrayData); + } + r["dump_join"] = RectJoin(352, 352); + c.Record("array data", r); +} + +// A Vulkan game that makes its device with the extensions OpenVR asks for (GetOutputDevice, then +// GetVulkanDeviceExtensionsRequired for that GPU), under a runtime with D3D11 alone (expect/gfx_interop.json): its +// frames go through the interop, where the copies are waited for on the GPU (shared fences), and show as the basic +// case's. "semaphores_asked": the list has VK_KHR_external_semaphore_win32 (the GPU-side wait's). Then "painted": +// 960 x 960 textures cleared, each frame, to another colour on the game's queue while it's still busy (clearing a +// 4096 x 4096 image 20 times), and submitted at once: the last frame's colour (red) shows. Which wait was used is in +// the log. --case-arg plain=1 makes the device without them (the copies are then waited for on the CPU); --case-arg time= shows +// that many more frames and records the Submit calls' time per frame, in ms, as "submit_ms"; --case-arg busy= has +// the game's queue still clearing a 4096 x 4096 image n times when it submits. +void VkInteropGpuWait(CaseContext& c) +{ + const bool plain = c.IntArg("plain", 0) != 0; + const int timed = std::min(std::max(c.IntArg("time", 0), 0), 2000); + const int busy = std::min(std::max(c.IntArg("busy", 0), 0), 200); + if (c.core->Init(vr::VRApplication_Scene, nullptr) != vr::VRInitError_None) { + c.Record("Init failed"); + return; + } + vr::EVRInitError le = vr::VRInitError_None; + auto* comp = (vr::IVRCompositor_029::IVRCompositor*)c.core->GetGenericInterface("IVRCompositor_029", &le); + auto* sys = (vr::IVRSystem_022::IVRSystem*)c.core->GetGenericInterface("IVRSystem_022", &le); + if (!comp || !sys) { + c.Record("no compositor or system"); + c.core->Cleanup(); + return; + } + std::vector asked; + std::string why; + std::unique_ptr gfx = MakeVkGfxWith(&why, [&](void* instance, void* physical) { + if (plain) + return asked; + uint64_t output = 0; + sys->GetOutputDevice(&output, vr::TextureType_Vulkan, (VkInstance_T*)instance); + VkPhysicalDevice_T* device = output ? (VkPhysicalDevice_T*)(uintptr_t)output : (VkPhysicalDevice_T*)physical; + char names[4096] = ""; + comp->GetVulkanDeviceExtensionsRequired(device, names, sizeof(names)); + std::string all = names, one; + for (char ch : all + " ") { + if (ch == ' ') { + if (!one.empty()) + asked.push_back(one); + one.clear(); + } else { + one += ch; + } + } + return asked; + }); + if (!gfx) { + c.core->Cleanup(); + c.Record("frame", Skipped(why)); + return; + } + GfxTexture left = gfx->Pattern(1024, 1024, kVkRGBA8Srgb, 0); + GfxTexture right = gfx->Pattern(1024, 1024, kVkRGBA8Srgb, 1); + gfx->Flush(); + Json::Value r; + r["semaphores_asked"] = std::find(asked.begin(), asked.end(), "VK_KHR_external_semaphore_win32") != asked.end(); + if (!left.Made() || !right.Made()) { + r["error"] = "the pattern textures couldn't be made"; + } else { + for (int frame = 1; frame <= kFrames; frame++) { + vr::TrackedDevicePose_t poses[16]; + comp->WaitGetPoses(poses, 16, nullptr, 0); + r["left"] = (int)comp->Submit(vr::Eye_Left, left.Texture(), &kFull, vr::Submit_Default); + r["right"] = (int)comp->Submit(vr::Eye_Right, right.Texture(), &kFull, vr::Submit_Default); + } + r["dump_join"] = RectJoin(1024, 1024); + double submitting = 0; + for (int frame = 1; frame <= timed; frame++) { + vr::TrackedDevicePose_t poses[16]; + comp->WaitGetPoses(poses, 16, nullptr, 0); + gfx->Busy(busy); + const auto start = std::chrono::steady_clock::now(); + comp->Submit(vr::Eye_Left, left.Texture(), &kFull, vr::Submit_Default); + comp->Submit(vr::Eye_Right, right.Texture(), &kFull, vr::Submit_Default); + submitting += std::chrono::duration(std::chrono::steady_clock::now() - start).count(); + } + if (timed) + r["submit_ms"] = submitting / timed; + } + c.Record("frame", r); + + GfxTexture paintedLeft = gfx->Pattern(960, 960, kVkRGBA8Srgb, 0); + GfxTexture paintedRight = gfx->Pattern(960, 960, kVkRGBA8Srgb, 1); + gfx->Flush(); + Json::Value p; + if (!paintedLeft.Made() || !paintedRight.Made()) { + p["error"] = "the textures couldn't be made"; + } else { + const uint32_t colours[2] = { 0xff0000ff, 0x0000ffff }; + for (int frame = 1; frame <= kFrames; frame++) { + vr::TrackedDevicePose_t poses[16]; + comp->WaitGetPoses(poses, 16, nullptr, 0); + gfx->Busy(20); + gfx->Paint(paintedLeft, colours[frame % 2]); + gfx->Paint(paintedRight, colours[frame % 2]); + p["left"] = (int)comp->Submit(vr::Eye_Left, paintedLeft.Texture(), &kFull, vr::Submit_Default); + p["right"] = (int)comp->Submit(vr::Eye_Right, paintedRight.Texture(), &kFull, vr::Submit_Default); + } + p["dump_join"] = RectJoin(960, 960); + } + c.Record("painted", p); + // OpenLamina first, then the textures and the device + c.core->Cleanup(); + gfx->Flush(); +} + // Overlays from image files and the texture getters (D3D11, expect/gfx.json): a PNG of the pattern in a non-ASCII // folder shown on an overlay, a damaged file refused, and each overlay's texture and size answered void OverlayImages(CaseContext& c) @@ -788,15 +1338,27 @@ const std::map& conformance::GfxCases() { "skybox-6", [](CaseContext& c) { Skybox(c, 6); } }, #ifdef _WIN32 { "mirror", Mirror }, + { "mirror-flipped", MirrorFlipped }, #endif { "gfx-d3d12-basic", [](CaseContext& c) { Basic(c, GfxKind::D3D12, kDxgiRGBA8Srgb); } }, { "gfx-vk-basic", [](CaseContext& c) { Basic(c, GfxKind::Vulkan, kVkRGBA8Srgb); } }, { "gfx-gl-basic", [](CaseContext& c) { Basic(c, GfxKind::OpenGL, kGlSRGB8Alpha8); } }, + { "gfx-vk-dump-images", [](CaseContext& c) { Basic(c, GfxKind::Vulkan, kVkRGBA8Srgb, true); } }, + { "gfx-vk-wait-without-submit", [](CaseContext& c) { WaitWithoutSubmit(c, GfxKind::Vulkan, kVkRGBA8Srgb); } }, + { "gfx-gl-wait-without-submit", [](CaseContext& c) { WaitWithoutSubmit(c, GfxKind::OpenGL, kGlSRGB8Alpha8); } }, + { "gfx-gl-dump-images", [](CaseContext& c) { Basic(c, GfxKind::OpenGL, kGlSRGB8Alpha8, true); } }, { "gfx-d3d11-formats", [](CaseContext& c) { Formats(c, GfxKind::D3D11, { { "rgba16f", 10 }, { "r11g11b10f", 26 }, { "rgb10a2", 24 }, { "bgrx8", 88 } }); } }, { "gfx-d3d12-formats", [](CaseContext& c) { Formats(c, GfxKind::D3D12, { { "rgba16f", 10 }, { "r11g11b10f", 26 }, { "rgb10a2", 24 }, { "bgrx8", 88 } }); } }, { "gfx-vk-formats", [](CaseContext& c) { Formats(c, GfxKind::Vulkan, { { "rgba16f", 97 }, { "r11g11b10f", 122 }, { "rgb10a2", 64 }, { "bgra8", 44 } }); } }, { "gfx-gl-formats", [](CaseContext& c) { Formats(c, GfxKind::OpenGL, { { "rgba16f", 0x881A }, { "r11g11b10f", 0x8C3A }, { "rgb10a2", 0x8059 }, { "rgb8", 0x8051 } }); } }, { "gfx-d3d11-odd", D3D11Odd }, + { "gfx-vk-odd", VkOdd }, + { "gfx-vk-dynamic-resolution", VkDynamicResolution }, + { "gfx-vk-msaa-formats", [](CaseContext& c) { Formats(c, GfxKind::Vulkan, { { "msaa bgra8", 44 } }, 4); } }, + { "gfx-d3d11-new-device", [](CaseContext& c) { NewDevice(c, GfxKind::D3D11, kDxgiRGBA8Srgb); } }, + { "gfx-d3d12-new-device", [](CaseContext& c) { NewDevice(c, GfxKind::D3D12, kDxgiRGBA8Srgb); } }, + { "gfx-vk-new-device", [](CaseContext& c) { NewDevice(c, GfxKind::Vulkan, kVkRGBA8Srgb); } }, + { "gfx-d3d11-eyes-two-devices", EyesOnTwoDevices }, { "gfx-d3d11-pose-depth", [](CaseContext& c) { PoseDepth(c, GfxKind::D3D11, kDxgiRGBA8Srgb); } }, { "gfx-d3d12-pose-depth", [](CaseContext& c) { PoseDepth(c, GfxKind::D3D12, kDxgiRGBA8Srgb); } }, { "gfx-vk-pose-depth", [](CaseContext& c) { PoseDepth(c, GfxKind::Vulkan, kVkRGBA8Srgb); } }, @@ -819,6 +1381,13 @@ const std::map& conformance::GfxCases() { "gfx-gl-interop-bounds", [](CaseContext& c) { Bounds(c, GfxKind::OpenGL, kGlSRGB8Alpha8); } }, { "gfx-vk-interop-bounds", [](CaseContext& c) { Bounds(c, GfxKind::Vulkan, kVkRGBA8Srgb); } }, { "gfx-vk-interop", [](CaseContext& c) { Basic(c, GfxKind::Vulkan, kVkRGBA8Srgb); } }, + { "gfx-gl-interop-odd", GlInteropOdd }, + { "gfx-vk-interop-odd", VkInteropOdd }, + { "gfx-vk-interop-gpu-wait", VkInteropGpuWait }, + // As the formats ones, under a script whose runtime has D3D11 alone, with RGBA8 sRGB swapchains only + // (expect/gfx_interop_formats.json) + { "gfx-gl-interop-formats", [](CaseContext& c) { Formats(c, GfxKind::OpenGL, { { "rgb8", 0x8051 }, { "r11g11b10f", 0x8C3A }, { "rgba16f", 0x881A }, { "rgb10a2", 0x8059 } }); } }, + { "gfx-vk-interop-formats", [](CaseContext& c) { Formats(c, GfxKind::Vulkan, { { "b10g11r11", 122 }, { "rgba16f", 97 }, { "rgb10a2", 64 }, { "bgra8", 44 } }); } }, }; return cases; } diff --git a/tests/conformance/helper_cases.cpp b/tests/conformance/helper_cases.cpp index b8c22657..3c5714ec 100644 --- a/tests/conformance/helper_cases.cpp +++ b/tests/conformance/helper_cases.cpp @@ -4,8 +4,10 @@ #include "conformance.h" #include "IVRChaperoneSetup_006.h" +#include "IVRChaperone_004.h" #include "IVRCompositor_029.h" #include "IVRInput_011.h" +#include "IVROverlayView_003.h" #include "IVROverlay_028.h" #include "IVRSettings_003.h" #include "IVRSystem_022.h" @@ -444,12 +446,28 @@ void DashboardSceneCase(CaseContext& c) } else { r["helper_overlay_visible"] = Json::Value(); } + // The dashboard's panel itself, read through its key: shown, where the document has it + vr::VROverlayHandle_t systemUi = vr::k_ulOverlayHandleInvalid; + if (ov && ov->FindOverlay("system.systemui", &systemUi) == vr::VROverlayError_None) { + r["systemui_visible"] = ov->IsOverlayVisible(systemUi); + vr::HmdMatrix34_t centre{}; + Json::Value pose; + if (ov->GetTransformForOverlayCoordinates(systemUi, vr::TrackingUniverseStanding, { { 0.5f, 0.5f } }, ¢re) == vr::VROverlayError_None) + for (int i = 0; i < 3; i++) + pose["p"].append(centre.m[i][3]); + r["systemui_position"] = RoundedPosition(pose); + r["systemui_set_refused"] = ov->ShowOverlay(systemUi) != vr::VROverlayError_None; + } if (in && trigger != vr::k_ulInvalidActionHandle) { vr::IVRInput_011::InputAnalogActionData_t data{}; in->GetAnalogActionData(trigger, &data, sizeof(data), vr::k_ulInvalidInputValueHandle); r["action_active_while_open"] = data.bActive; } } + vr::VREvent_t posted{}; + while (ov && ownDashboard != vr::k_ulOverlayHandleInvalid && ov->PollNextOverlayEvent(ownDashboard, &posted, sizeof(posted))) + if (posted.eventType == vr::VREvent_ButtonPress && posted.data.controller.button == 7) + r["own_dashboard_posted_event"] = true; app.comp->Submit(vr::Eye_Left, tex.get(), nullptr, vr::Submit_Default); app.comp->Submit(vr::Eye_Right, tex.get(), nullptr, vr::Submit_Default); // At about the display's rate (the stand-in doesn't wait), so the overlay app has time to show the panel @@ -460,6 +478,10 @@ void DashboardSceneCase(CaseContext& c) r["deactivated"] = deactivated; r["open_at_end"] = StoreDocument("dashboard")["open"]; if (ov) { + // The width the overlay app set on it, applied here + float width = 0; + ov->GetOverlayWidthInMeters(ownDashboard, &width); + r["own_dashboard_width"] = width; ov->DestroyOverlay(ownPlain); ov->DestroyOverlay(ownDashboard); } @@ -525,8 +547,18 @@ void DashboardOverlayCase(CaseContext& c) vr::EVROverlayError keyError = vr::VROverlayError_None; ov->GetOverlayKey(games, key, sizeof(key), &keyError); gamesKey = key; - // Nothing of another program's overlay can be changed - r["game_overlay_set_refused"] = ov->SetOverlayWidthInMeters(games, 3) != vr::VROverlayError_None; + // Changed through the game, which applies it: read back from here at once + r["game_overlay_set"] = (int)ov->SetOverlayWidthInMeters(games, 0.75f); + float width = 0; + ov->GetOverlayWidthInMeters(games, &width); + r["game_overlay_width_read_back"] = width; + // An event for it, which the game polls on it + if (auto* view = Interface(c, "IVROverlayView_003")) { + vr::VREvent_t posted{}; + posted.eventType = vr::VREvent_ButtonPress; + posted.data.controller.button = 7; + view->PostOverlayEvent(games, &posted); + } } if (sawOpen && !open && closedAt == std::chrono::steady_clock::time_point::max()) closedAt = std::chrono::steady_clock::now() + std::chrono::milliseconds(200); @@ -676,9 +708,26 @@ void BoundsCase(CaseContext& c, bool commitRoom) callers::Texture tex(ArgSet::Valid, *c.call); for (int frame = 1; frame <= 30; frame++) SceneFrame(app, tex.get()); + // The play area the chaperone getters answer: the same one the walls are drawn for + Json::Value area; + { + vr::EVRInitError le = vr::VRInitError_None; + auto* chaperone = (vr::IVRChaperone_004::IVRChaperone*)c.core->GetGenericInterface("IVRChaperone_004", &le); + if (chaperone) { + float x = 0, z = 0; + area["ret"] = chaperone->GetPlayAreaSize(&x, &z); + area["size"] = Json::Value(Json::arrayValue); + area["size"].append(std::round(x * 1000) / 1000); + area["size"].append(std::round(z * 1000) / 1000); + area["calibration"] = (int)chaperone->GetCalibrationState(); + } + } c.core->Cleanup(); Json::Value r; Json::Value dump = ReadStandInDump(); + // Asked of the runtime once for the session, not every frame + area["bounds_rect_calls"] = dump["bounds_rect_calls"]; + c.Record("play area", area); const Json::Value& layers = dump["layers"]; const Json::Value lastFrame = layers.size() ? layers[layers.size() - 1]["frame"] : Json::Value(); int walls = 0; @@ -696,6 +745,63 @@ void BoundsCase(CaseContext& c, bool commitRoom) c.Record("walls", r); } +// A game that calls WaitGetPoses and never Submit, with an overlay shown: each frame it waited for is ended for it +// (with the overlay), not left to be discarded +void WaitWithoutSubmitCase(CaseContext& c) +{ + using namespace vr::IVROverlay_028; + SceneApp app; + if (!OpenSceneApp(c, app)) + return; + Json::Value r; + auto* ov = Interface(c, "IVROverlay_028"); + if (ov) { + vr::VROverlayHandle_t h = vr::k_ulOverlayHandleInvalid; + ov->CreateOverlay("oc.test.wait", "Wait", &h); + std::vector grey(64 * 64 * 4, 0x80); + ov->SetOverlayRaw(h, grey.data(), 64, 64, 4); + ov->SetOverlayWidthInMeters(h, 0.75f); + vr::HmdMatrix34_t m = At(0, 1.5f, -2); + ov->SetOverlayTransformAbsolute(h, vr::TrackingUniverseStanding, &m); + ov->ShowOverlay(h); + } + for (int frame = 1; frame <= 30; frame++) { + vr::TrackedDevicePose_t poses[16]; + app.comp->WaitGetPoses(poses, 16, nullptr, 0); + } + c.core->Cleanup(); + Json::Value dump = ReadStandInDump(); + r["frames_ended_at_least_25"] = dump["frames_ended"].asInt64() >= 25; + bool quad = false; + for (const Json::Value& layer : dump["layers"]) + quad = quad || (layer["type"].asString() == "quad" && layer["size"].size() == 2 && std::fabs(layer["size"][0].asDouble() - 0.75) < 1e-3); + r["overlay_quad"] = quad; + r["frame_order_errors"] = dump["frame_order_errors"]; + c.Record("frames", r); +} + +// A game with legacy input looking for its controllers in its first frames: the frame the right hand's controller +// is first connected on (scripts/controllers_early.json gives the profile) +void ControllersEarlyCase(CaseContext& c) +{ + SceneApp app; + if (!OpenSceneApp(c, app)) + return; + callers::Texture tex(ArgSet::Valid, *c.call); + Json::Value r; + r["first_frame"] = Json::Value(); + for (int frame = 1; frame <= 20; frame++) { + SceneFrame(app, tex.get()); + const vr::TrackedDeviceIndex_t right = app.sys->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_RightHand); + if (right != vr::k_unTrackedDeviceIndexInvalid && app.sys->IsTrackedDeviceConnected(right)) { + r["first_frame"] = frame; + break; + } + } + c.core->Cleanup(); + c.Record("connected", r); +} + // An overlay application with one overlay from memory and nothing else: no WaitGetPoses, so every frame is // OpenLamina's own. About 60 frames' time at 90 Hz. void OverlayAppCase(CaseContext& c) @@ -729,6 +835,57 @@ void OverlayAppCase(CaseContext& c) c.Record("frames", r); } +// An overlay application whose session (or instance) the runtime loses (xr_failures.py's lost_overlay scripts): its +// overlay from memory is shown for 2.5 s while it polls its events every 11 ms, and loads the manifest (--manifest) +// 0.5 s in, while its session is lost. The device events and quits it got, in order, the manifest's answer, and what +// the stand-in saw: the sessions made and lost, and the last session's frames. +void OverlayAppLossCase(CaseContext& c) +{ + using namespace vr::IVROverlay_028; + Json::Value r; + r["init"] = (int)c.core->Init(vr::VRApplication_Overlay, nullptr); + if (r["init"].asInt() != vr::VRInitError_None) { + c.Record("loss", r); + return; + } + auto* ov = Interface(c, "IVROverlay_028"); + auto* sys = Interface(c, "IVRSystem_022"); + Json::Value events(Json::arrayValue); + if (ov && sys) { + vr::VROverlayHandle_t h = vr::k_ulOverlayHandleInvalid; + ov->CreateOverlay("oc.helper.loss", "Helper", &h); + std::vector grey(64 * 64 * 4, 0x80); + ov->SetOverlayRaw(h, grey.data(), 64, 64, 4); + vr::HmdMatrix34_t m = At(0, 1.5f, -2); + ov->SetOverlayTransformAbsolute(h, vr::TrackingUniverseStanding, &m); + ov->ShowOverlay(h); + const auto start = std::chrono::steady_clock::now(); + const auto end = start + std::chrono::milliseconds(2500); + bool manifestLoaded = false; + while (std::chrono::steady_clock::now() < end) { + if (!manifestLoaded && !c.manifest.empty() && std::chrono::steady_clock::now() >= start + std::chrono::milliseconds(500)) { + manifestLoaded = true; + auto* in = Interface(c, "IVRInput_011"); + r["manifest"] = in ? (int)in->SetActionManifestPath(c.manifest.c_str()) : -1; + } + vr::VREvent_t ev{}; + while (sys->PollNextEvent(&ev, sizeof(ev))) { + if (ev.eventType == vr::VREvent_TrackedDeviceActivated || ev.eventType == vr::VREvent_TrackedDeviceDeactivated + || ev.eventType == vr::VREvent_Quit || ev.eventType == vr::VREvent_DriverRequestedQuit) + events.append((int)ev.eventType); + } + std::this_thread::sleep_for(std::chrono::milliseconds(11)); + } + ov->DestroyOverlay(h); + } + c.core->Cleanup(); + r["events"] = events; + Json::Value dump = ReadStandInDump(); + for (const char* key : { "sessions_created", "sessions_lost", "instances_created", "instances_lost", "frames_ended" }) + r[key] = dump[key]; + c.Record("loss", r); +} + // An overlay application's textures of each API, at once: each is copied onto OpenLamina's own D3D11 device (the // overlay session's), and its quad shows the test pattern. A kind whose device can't be made here skips the case. struct OverlayTextureKind { @@ -1045,6 +1202,9 @@ const std::map& conformance::HelperCases() { static const std::map cases = { { "overlay-app", OverlayAppCase }, + { "controllers-early", ControllersEarlyCase }, + { "wait-without-submit", WaitWithoutSubmitCase }, + { "overlay-app-loss", OverlayAppLossCase }, { "overlay-app-two-apis", [](CaseContext& c) { OverlayAppTexturesCase(c, "textures", { { GfxKind::D3D11, 29, "d3d11" }, { GfxKind::D3D12, 29, "d3d12" } }); } }, diff --git a/tests/conformance/how_real.txt b/tests/conformance/how_real.txt new file mode 100644 index 00000000..c5d359ab --- /dev/null +++ b/tests/conformance/how_real.txt @@ -0,0 +1,39 @@ +# How real each interface is: generated by scripts/openvr_inventory.py --write-how-real. Per OpenOVR/Reimpl/Base*.cpp, +# the methods defined there (not constructors or OpenLamina's own _ methods); those answering OC_UNSUPPORTED +# always, or in some cases; those that only log and return (logged no-ops); and the share that is neither. +# interface methods unsupported partly no-op real% +Applications 48 1 0 0 97 +Chaperone 14 0 0 1 92 +ChaperoneSetup 33 0 0 0 100 +ClientCore 11 0 0 0 100 +Compositor 77 0 5 0 100 +ControlPanel 19 2 1 0 89 +Debug 4 0 0 0 100 +DriverManager 5 0 0 0 100 +ExtendedDisplay 3 0 0 0 100 +HeadsetView 9 0 0 0 100 +IOBuffer 6 0 0 0 100 +Input 99 2 3 0 97 +Mailbox 4 0 0 1 75 +Notifications 7 0 0 0 100 +Overlay 136 0 16 0 100 +OverlayView 4 2 0 0 50 +Paths 2 0 0 0 100 +RenderModels 24 0 3 0 100 +Resources 2 0 0 0 100 +Screenshots 7 0 0 0 100 +Settings 19 0 0 0 100 +SpatialAnchors 5 0 0 0 100 +System 78 2 4 1 96 +TrackedCamera 11 0 0 0 100 +all 627 9 32 3 98 + +# Interface versions of OpenLamina's own (OpenVRHeaders/custom_interfaces), and why each is there +IVRClientCore_002 IVRClientCore's old versions, which openvr_api.dll asks vrclient for: Valve never published them +IVRClientCore_003 IVRClientCore's old versions, which openvr_api.dll asks vrclient for: Valve never published them +IVRCompositor_017 used by The Lab, never published by Valve: 018 without its grid fade methods +IVRControlPanel_006 used by Half-Life: Alyx, never published by Valve +IVRInputInternal_002 used by Half-Life: Alyx, never published by Valve +IVRMailbox_001 used by Half-Life: Alyx, never published by Valve +IVRPaths_001 SteamVR's path-keyed property store, offered by Valve only through the C API (SDK 1.12.5 to 2.12.14) +IVRPaths_002 SteamVR's path-keyed property store, offered by Valve only through the C API (SDK 2.15.6) diff --git a/tests/conformance/ini/hand_controller_touch.ini b/tests/conformance/ini/hand_controller_touch.ini new file mode 100644 index 00000000..209bf826 --- /dev/null +++ b/tests/conformance/ini/hand_controller_touch.ini @@ -0,0 +1,2 @@ +[default] +handController=oculus_touch diff --git a/tests/conformance/record-steamvr.ps1 b/tests/conformance/record-steamvr.ps1 index d63e5d8c..84119d93 100644 --- a/tests/conformance/record-steamvr.ps1 +++ b/tests/conformance/record-steamvr.ps1 @@ -9,7 +9,8 @@ 3. Copies, with their SHA-256s, the paths file (%LOCALAPPDATA%\openvr\openvrpaths.vrpath) and, from Steam's config folder, steamvr.vrsettings, chaperone_info.vrchap, appconfig.json and vrappconfig\. 4. Turns on the null driver in steamvr.vrsettings (driver_null.enable, steamvr.forcedDriver = null, - steamvr.activateMultipleDrivers = false, other keys kept) and puts SteamVR first in the paths file. + steamvr.activateMultipleDrivers = false, or true with -Controllers, other keys kept) and puts SteamVR first in + the paths file. 5. Runs run.py against SteamVR's vrclient_x64.dll (--real-runtime: unsafe_methods.txt isn't called). 6. Always, at the end: stops SteamVR's processes, puts every backed-up file back (and removes any of them that didn't exist before), and fails unless every SHA-256 matches its backup. @@ -24,7 +25,12 @@ param( # Only the init-matrix case, and no expected file: to check SteamVR starts with the null driver [switch]$Probe, # One at a time: a test program that ends SteamVR would otherwise take the others running beside it down too - [int]$Jobs = 1 + [int]$Jobs = 1, + # The null headset with SteamVR's other drivers too (Lighthouse: real controllers switched on), for the cases whose + # answers need controllers + [switch]$Controllers, + # Keep what an earlier run into the same -Out finished, and run only the rest (run.py --resume) + [switch]$Resume ) $ErrorActionPreference = 'Stop' $here = $PSScriptRoot @@ -70,7 +76,7 @@ $appconfigBefore = if (Test-Path $appconfigDir) { @(Get-ChildItem -LiteralPath $ if ($WhatIf) { $manifest | Format-Table Exists, Hash, Path -AutoSize | Out-String -Width 220 | Write-Host - Write-Host "Would set driver_null.enable, steamvr.forcedDriver = null, steamvr.activateMultipleDrivers = false in $(Join-Path $config 'steamvr.vrsettings')" + Write-Host "Would set driver_null.enable, steamvr.forcedDriver = null, steamvr.activateMultipleDrivers = $([bool]$Controllers) in $(Join-Path $config 'steamvr.vrsettings')" Write-Host "Would run run.py against $(Join-Path $steamvr 'bin\vrclient_x64.dll'), then put everything back" return } @@ -88,7 +94,7 @@ try { if (-not $settings.ContainsKey('steamvr')) { $settings['steamvr'] = @{} } $settings['driver_null']['enable'] = $true $settings['steamvr']['forcedDriver'] = 'null' - $settings['steamvr']['activateMultipleDrivers'] = $false + $settings['steamvr']['activateMultipleDrivers'] = [bool]$Controllers $settings | ConvertTo-Json -Depth 32 | Set-Content -LiteralPath $settingsPath -Encoding utf8 # SteamVR first in the paths file, as SteamVR puts itself when started from Steam: its own processes (vrmonitor @@ -107,7 +113,7 @@ try { $vrclient = Join-Path $steamvr 'bin\vrclient_x64.dll' & python -I (Join-Path $here 'run.py') --runtime $vrclient --conformance $Conformance --xr-runtime none ` --real-runtime --keep-running (Join-Path $steamvr 'bin\win64\vrstartup.exe') --allow-failures --jobs $Jobs ` - --out $Out @($Probe ? @('--cases', 'init-matrix') : @()) + --out $Out @($Probe ? @('--cases', 'init-matrix') : @()) @($Resume ? @('--resume') : @()) if ($LASTEXITCODE -ne 0) { throw "run.py failed ($LASTEXITCODE)" } } catch { diff --git a/tests/conformance/run.py b/tests/conformance/run.py index 47a709af..4d8b80e9 100644 --- a/tests/conformance/run.py +++ b/tests/conformance/run.py @@ -39,7 +39,10 @@ ARGSETS = ["valid", "edge", "null", "invalid"] APPTYPES_VALID_ONLY = [2, 3, 4, 0] # Overlay, Background, Utility, Other CASES = ["init-matrix", "init-repeat", "init-other-thread", "lookup-before-init", "unknown-interface", - "overlay-lifecycle", "input-manifest", "frame-loop", "submit-edges", "applications"] + "overlay-lifecycle", "input-manifest", "frame-loop", "submit-edges", "applications", "app-type-answers", + "device-properties", "init-again", "chaperone-colours", "submit-refusals", "skeletal-input", "legacy-controller", + "render-model-components", "overlay-defaults", "settings-defaults", "application-list", "io-buffer", + "helper-app-controllers"] TIMEOUT = 60 CASE_TIMEOUT = 600 # init-repeat starts OpenLamina 200 times MAX_REPEAT = 100 # --repeat's bound: each round is a child process @@ -59,7 +62,7 @@ CASE_ENV = {"render-models": STEAMVR_FIXTURE, "state-and-resources": STEAMVR_FIXTURE} # SteamVR's answers while vrserver was starting or stopping between children (Retry, AnotherAppLaunching, # ShuttingDown): a recording keeps them, a comparison skips them -STEAMVR_TRANSIENT = {115, 117, 119} +STEAMVR_TRANSIENT = {115, 117, 119, 310} # restarting, or its shared namespace gone (310) def load_versions(): @@ -97,15 +100,14 @@ def key_of(r): class Runner: def __init__(self, args): self.args = args - # Absolute: on Linux the children run in a folder of their own (self.work) self.out = Path(args.out).resolve() - # Where OpenLamina reads openlamina.ini from: next to the DLL on Windows; on Linux only the working directory, - # so there the children run in work/ under --out, which holds it - self.work = None if os.name == "nt" else self.out / "work" # OC_TEST_NO_STEAMVR: OpenLamina finds no SteamVR or Steam config (its settings, resources and legacy # binding files), so a run here answers as on CI's runner, which has none # Each child gets its own store (OC_STORE_DIR, see child), so one child's settings and events never reach another self.env = {"OC_NO_MESSAGE_BOX": "1", "OC_LOG_DIR": str(self.out / "logs"), "OC_TEST_NO_STEAMVR": "1"} + if os.name != "nt": + # An empty config folder, so the user's own openlamina.ini (~/.config/openlamina) isn't read + self.env["XDG_CONFIG_HOME"] = str(self.out / "xdg-config") # A store left by an earlier run into the same --out would carry its state into this one shutil.rmtree(self.out / "store", ignore_errors=True) self.monado = args.xr_runtime.startswith("monado:") @@ -139,7 +141,7 @@ def prepare(self): raise SystemExit(f"--xr-runtime monado: no manifest {self.manifest}") self.out.mkdir(parents=True, exist_ok=True) (self.out / "raw").mkdir(exist_ok=True) - # The openlamina.ini OpenLamina reads (next to the DLL, or in the children's working directory): + # The openlamina.ini OpenLamina reads next to the library (ini_path): # ini/features_off.ini (the features that are on by default turned off, so that a case shows one feature at a # time), then --ini's keys, which win. --shipped-defaults leaves the first out. Not for SteamVR itself, whose # folder that would be. @@ -149,9 +151,6 @@ def prepare(self): if self.args.ini: parts.append(Path(self.args.ini).read_text(encoding="utf-8")) self.wrote_ini = bool(parts) - if self.work: - shutil.rmtree(self.work, ignore_errors=True) - self.work.mkdir(parents=True) if parts: # Taken out again when the run ends (Runner.cleanup), with any file that was there put back target = self.ini_path() @@ -167,7 +166,12 @@ def prepare(self): "/d", self.manifest, "/f", view], check=True, capture_output=True) def ini_path(self): - return (self.work or Path(self.runtime).parent) / "openlamina.ini" + # Next to the DLL on Windows; on Linux in the install's bin/: the library's folder, or its parent when that is + # linux64 + folder = Path(self.runtime).parent + if os.name != "nt" and folder.name == "linux64": + folder = folder.parent + return folder / "openlamina.ini" def child(self, extra, raw, timeout=TIMEOUT, env_extra=None, store=None): """Runs oc_conformance with its store in store/ under --out: by default the child's own (named after its @@ -181,13 +185,21 @@ def child(self, extra, raw, timeout=TIMEOUT, env_extra=None, store=None): env.update(self.env) env["OC_STORE_DIR"] = str(self.out / "store" / (store or Path(raw).stem)) env.update(env_extra or {}) - cwd = str(self.work) if self.work else None + cwd = None if unelevated.integrity_above_medium() and not self.args.ci: - return unelevated.run_medium(cmd, env, cwd, timeout) - # In a memory-limited job (unelevated.py): a runaway child fails alone - return unelevated.run_limited(cmd, env, cwd, timeout, capture=True)[0] + code = unelevated.run_medium(cmd, env, cwd, timeout) + else: + # In a memory-limited job (unelevated.py): a runaway child fails alone + code = unelevated.run_limited(cmd, env, cwd, timeout, capture=True)[0] + with Runner.keep_lock: + Runner.timeouts_in_a_row = Runner.timeouts_in_a_row + 1 if code == 124 else 0 + return code keep_lock = threading.Lock() + # --keep-running: timeouts in a row (a SteamVR whose server hangs answers no child), and the restarts that made + timeouts_in_a_row = 0 + restarts = 0 + HUNG_AFTER = 2 def keep_running(self): """--keep-running: SteamVR quits all of its programs when the scene application it counts as its first exits @@ -201,6 +213,17 @@ def running(): return server.lower() in out.stdout.lower() with Runner.keep_lock: + if running() and Runner.timeouts_in_a_row >= Runner.HUNG_AFTER: + # Running but answering nobody: its processes ended, so it's started again below + print(f"run.py: {Runner.timeouts_in_a_row} timeouts in a row: restarting SteamVR", flush=True) + for name in ("vrserver.exe", "vrmonitor.exe", "vrcompositor.exe", "vrdashboard.exe", "vrwebhelper.exe"): + subprocess.run(["taskkill", "/f", "/im", name], capture_output=True) + for _ in range(30): + if not running(): + break + time.sleep(1) + Runner.timeouts_in_a_row = 0 + Runner.restarts += 1 if running(): return subprocess.run(["explorer.exe", exe]) @@ -208,6 +231,12 @@ def running(): if running(): break time.sleep(1) + # Its shared namespace up before the next child, which would otherwise start a SteamVR of its own (whose + # namespace goes with that child). Looked for in the pipe list: opening the pipe would count as a client. + for _ in range(60): + if any(p.lower() == "steamvr_namespace" for p in os.listdir("\\\\.\\pipe\\")): + break + time.sleep(1) time.sleep(8) @staticmethod @@ -226,7 +255,45 @@ def status_of(code): def run_interface(self, version, apptype, argset): raw = self.out / "raw" / f"{version}-{apptype}-{argset}.jsonl" - raw.unlink(missing_ok=True) + done = Path(str(raw) + ".result.json") + if self.args.resume: + kept = self.resumed(raw, done, {"interface": version, "apptype": apptype, "argset": argset}) + if kept is not None: + return kept + for attempt in range(2): + raw.unlink(missing_ok=True) + done.unlink(missing_ok=True) + results = self.interface_records(version, apptype, argset, raw) + # SteamVR's shared namespace gone: Init answered 310, or the program timed out before its first answer + # (waiting in Init for the namespace). SteamVR is started again, and the job run again once. + hung_in_init = any(r.get("index") == -1 and r.get("status") == "timeout" for r in results) + if not (self.args.keep_running and (hung_in_init or any(r.get("init_error") == 310 for r in results))): + break + print(f"run.py: {raw.name}: {'timed out in Init' if hung_in_init else 'init error 310'}: restarting SteamVR", flush=True) + with Runner.keep_lock: + Runner.timeouts_in_a_row = Runner.HUNG_AFTER + done.write_text(json.dumps(results), encoding="utf-8") + return results + + @staticmethod + def resumed(raw, done, what): + """--resume: a job's records from an earlier run into the same --out. Its saved result if it has one; else, for a + run from before results were saved, its answers file if it has any answers, each gap in their indices taken as + a call that ended the program (status "lost": whether it crashed, ended or timed out wasn't saved). None when the job is to run again.""" + if done.exists(): + return json.loads(done.read_text(encoding="utf-8")) + records = read_jsonl(raw) + if not records: + return None + for r in records: + r["status"] = "ok" + have = {r.get("index") for r in records} + for i in range(max([i for i in have if isinstance(i, int)] + [0])): + if i not in have: + records.append(dict(what, index=i, method=f"", status="lost", resumed=True)) + return records + + def interface_records(self, version, apptype, argset, raw): start, results, attempts = 0, [], 0 while attempts < 500: attempts += 1 @@ -265,7 +332,16 @@ def run_case(self, name, round_=None): # With --repeat, each round has its own files, and its records say which round they're from stem = f"case-{name}" if round_ is None else f"case-{name}-{round_}" raw = self.out / "raw" / f"{stem}.jsonl" + done = Path(str(raw) + ".result.json") + if self.args.resume and done.exists(): + return json.loads(done.read_text(encoding="utf-8")) raw.unlink(missing_ok=True) + done.unlink(missing_ok=True) + records = self.case_records(name, round_, stem, raw) + done.write_text(json.dumps(records), encoding="utf-8") + return records + + def case_records(self, name, round_, stem, raw): extra = ["--case", name] if self.args.manifest: extra += ["--manifest", str(Path(self.args.manifest).resolve())] @@ -518,15 +594,18 @@ def main(): ap.add_argument("--cases") ap.add_argument("--cases-only", action="store_true", help="only the cases of --cases, no interfaces") ap.add_argument("--manifest", help="the action manifest for the input-manifest case") - ap.add_argument("--ini", help="an openlamina.ini whose keys go where OpenLamina reads them (next to the DLL; on Linux the children's " - "working directory), after ini/features_off.ini's") + ap.add_argument("--ini", help="an openlamina.ini whose keys go where OpenLamina reads them (next to the DLL; on Linux the " + "install's bin/), after ini/features_off.ini's") ap.add_argument("--shipped-defaults", action="store_true", help="without ini/features_off.ini: OpenLamina's defaults as they ship, but for --ini's keys") ap.add_argument("--jobs", type=int, default=4) ap.add_argument("--ci", action="store_true") ap.add_argument("--allow-failures", action="store_true") ap.add_argument("--real-runtime", action="store_true") - ap.add_argument("--keep-running", metavar="EXE", help="with --real-runtime: start this (SteamVR's vrstartup.exe) before any child when its server isn't running") + ap.add_argument("--keep-running", metavar="EXE", help="with --real-runtime: start this (SteamVR's vrstartup.exe) before any child when its " + "server isn't running, and again when it hangs (two timeouts in a row, a timeout in Init, or an Init answering 310)") + ap.add_argument("--resume", action="store_true", help="keep the jobs an earlier run into the same --out finished (their " + ".result.json, or for an older run their answers), and run only the others") ap.add_argument("--repeat", type=int, default=1, help=f"run each case this many times (at most {MAX_REPEAT})") ap.add_argument("--case-arg", action="append", metavar="NAME=VALUE", help="passed to every case (repeatable)") ap.add_argument("--apptypes", help="the interfaces only under these app types (numbers, comma-separated), with valid arguments") @@ -547,7 +626,12 @@ def main(): finally: runner.cleanup() out = Path(args.out) - (out / "results.json").write_text(json.dumps({"runtime": args.runtime, "records": results}, indent=1), + meta = {"runtime": args.runtime} + if args.keep_running: + meta["runtime_restarts"] = Runner.restarts # a hung SteamVR started again (--keep-running) + if args.resume: + meta["resumed"] = True # some records are from an earlier run into the same --out + (out / "results.json").write_text(json.dumps(dict(meta, records=results), indent=1), encoding="utf-8") counts = {} for r in results: diff --git a/tests/conformance/scripts/controllers_early.json b/tests/conformance/scripts/controllers_early.json new file mode 100644 index 00000000..db5be723 --- /dev/null +++ b/tests/conformance/scripts/controllers_early.json @@ -0,0 +1 @@ +{ "#": "Touch controllers in both hands (the controllers-early case)", "interaction_profile": "/interaction_profiles/oculus/touch_controller" } diff --git a/tests/conformance/scripts/controllers_on.json b/tests/conformance/scripts/controllers_on.json new file mode 100644 index 00000000..20c4d7e6 --- /dev/null +++ b/tests/conformance/scripts/controllers_on.json @@ -0,0 +1,10 @@ +{ + "#": "Both controllers on (Index controllers), held in front at waist height: for app-type-answers", + "interaction_profile": "/interaction_profiles/valve/index_controller", + "poses": { + "/user/hand/left/input/grip/pose": { "p": [-0.2, 1.0, -0.3], "q": [0, 0, 0, 1] }, + "/user/hand/left/input/aim/pose": { "p": [-0.2, 1.0, -0.3], "q": [0, 0, 0, 1] }, + "/user/hand/right/input/grip/pose": { "p": [0.2, 1.0, -0.3], "q": [0, 0, 0, 1] }, + "/user/hand/right/input/aim/pose": { "p": [0.2, 1.0, -0.3], "q": [0, 0, 0, 1] } + } +} diff --git a/tests/conformance/scripts/gfx_interop_rgba8_only.json b/tests/conformance/scripts/gfx_interop_rgba8_only.json new file mode 100644 index 00000000..7cc3ddfc --- /dev/null +++ b/tests/conformance/scripts/gfx_interop_rgba8_only.json @@ -0,0 +1,5 @@ +{ + "#": "The interop formats cases (gfx-gl-interop-formats, gfx-vk-interop-formats): a runtime with D3D11 alone (OpenGL and Vulkan frames are copied into D3D11 textures) that offers one swapchain format, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB (29)", + "extensions": ["XR_KHR_D3D11_enable"], + "swapchain_formats": [29] +} diff --git a/tests/conformance/scripts/gfx_new_device_refused.json b/tests/conformance/scripts/gfx_new_device_refused.json new file mode 100644 index 00000000..ca88dee7 --- /dev/null +++ b/tests/conformance/scripts/gfx_new_device_refused.json @@ -0,0 +1,5 @@ +{ + "#": "The new-device cases (gfx-*-new-device) under a runtime that refuses the session for the game's new device (the third xrCreateSession, after OpenLamina's temporary one and the one for the game's first device)", + "extensions": ["XR_KHR_D3D11_enable", "XR_KHR_D3D12_enable", "XR_KHR_vulkan_enable", "XR_KHR_vulkan_enable2", "XR_KHR_opengl_enable"], + "fail": [{ "function": "xrCreateSession", "result": "XR_ERROR_GRAPHICS_DEVICE_INVALID", "after": 2, "count": 1 }] +} diff --git a/tests/conformance/scripts/gfx_vk_enable2.json b/tests/conformance/scripts/gfx_vk_enable2.json new file mode 100644 index 00000000..ddc6a55e --- /dev/null +++ b/tests/conformance/scripts/gfx_vk_enable2.json @@ -0,0 +1,4 @@ +{ + "#": "The Vulkan frame cases under a runtime that has XR_KHR_vulkan_enable2 alone (no XR_KHR_vulkan_enable): OpenLamina's temporary device is made through xrCreateVulkanInstanceKHR and xrCreateVulkanDeviceKHR, and the game's session through xrGetVulkanGraphicsDevice2KHR", + "extensions": ["XR_KHR_vulkan_enable2", "XR_KHR_convert_timespec_time"] +} diff --git a/tests/conformance/scripts/gfx_vk_odd.json b/tests/conformance/scripts/gfx_vk_odd.json new file mode 100644 index 00000000..8e6d3ec7 --- /dev/null +++ b/tests/conformance/scripts/gfx_vk_odd.json @@ -0,0 +1,6 @@ +{ + "#": "The odd Vulkan cases (gfx-vk-odd, gfx-vk-dynamic-resolution, gfx-vk-msaa-formats): every graphics API, single-sampled swapchains only (maxSwapchainSampleCount 1), so multisampled textures are resolved into them, and one swapchain format, RGBA8 sRGB, in each API's enum, so other formats are converted into it", + "extensions": ["XR_KHR_D3D11_enable", "XR_KHR_D3D12_enable", "XR_KHR_vulkan_enable", "XR_KHR_vulkan_enable2", "XR_KHR_opengl_enable"], + "max_swapchain_samples": 1, + "swapchain_formats": [29, 43, 35907] +} diff --git a/tests/conformance/scripts/hand_interaction.json b/tests/conformance/scripts/hand_interaction.json new file mode 100644 index 00000000..d727b2dc --- /dev/null +++ b/tests/conformance/scripts/hand_interaction.json @@ -0,0 +1,6 @@ +{ + "#": "The hands as controllers (XR_EXT_hand_interaction), the right hand pinching from frame 5 (hand-controllers)", + "extensions": ["XR_KHR_D3D11_enable", "XR_EXT_hand_interaction", "XR_EXT_hand_tracking"], + "interaction_profile": "/interaction_profiles/ext/hand_interaction_ext", + "inputs": [{ "frame": 5, "path": "/user/hand/right/input/pinch_ext/value", "value": 1.0 }] +} diff --git a/tests/conformance/scripts/hand_tracking_only.json b/tests/conformance/scripts/hand_tracking_only.json new file mode 100644 index 00000000..462a2710 --- /dev/null +++ b/tests/conformance/scripts/hand_tracking_only.json @@ -0,0 +1,4 @@ +{ + "#": "No controller, the hands tracked (hand-controllers)", + "extensions": ["XR_KHR_D3D11_enable", "XR_EXT_hand_tracking"] +} diff --git a/tests/conformance/scripts/helper_apps_controllers.json b/tests/conformance/scripts/helper_apps_controllers.json new file mode 100644 index 00000000..628c9007 --- /dev/null +++ b/tests/conformance/scripts/helper_apps_controllers.json @@ -0,0 +1,64 @@ +{ + "#": "Both controllers on, and overlay and headless sessions (XR_EXTX_overlay, XR_MND_headless): for helper-app-controllers", + "extensions": [ + "XR_KHR_D3D11_enable", + "XR_KHR_vulkan_enable", + "XR_EXTX_overlay", + "XR_MND_headless" + ], + "interaction_profile": "/interaction_profiles/valve/index_controller", + "poses": { + "/user/hand/left/input/grip/pose": { + "p": [ + -0.2, + 1.0, + -0.3 + ], + "q": [ + 0, + 0, + 0, + 1 + ] + }, + "/user/hand/left/input/aim/pose": { + "p": [ + -0.2, + 1.0, + -0.3 + ], + "q": [ + 0, + 0, + 0, + 1 + ] + }, + "/user/hand/right/input/grip/pose": { + "p": [ + 0.2, + 1.0, + -0.3 + ], + "q": [ + 0, + 0, + 0, + 1 + ] + }, + "/user/hand/right/input/aim/pose": { + "p": [ + 0.2, + 1.0, + -0.3 + ], + "q": [ + 0, + 0, + 0, + 1 + ] + } + } +} diff --git a/tests/conformance/scripts/instance_lost.json b/tests/conformance/scripts/instance_lost.json new file mode 100644 index 00000000..7d880a1f --- /dev/null +++ b/tests/conformance/scripts/instance_lost.json @@ -0,0 +1 @@ +{ "#": "The instance is lost at frame 10 (the runtime's service died), and the runtime is back after 300 ms: the devices deactivated, a new instance and session made about a second later with the game's actions on them, the devices activated again, and no VREvent_Quit", "events": [{ "frame": 10, "type": "instance_lost" }], "loss_unavailable_ms": 300 } diff --git a/tests/conformance/scripts/instance_lost_input.json b/tests/conformance/scripts/instance_lost_input.json new file mode 100644 index 00000000..9fdfc86e --- /dev/null +++ b/tests/conformance/scripts/instance_lost_input.json @@ -0,0 +1 @@ +{ "#": "The instance is lost at frame 5 and the runtime is back at once (case input-frames): the game's actions and bindings are made again on the new instance, whose paths differ from the old one's, and its input calls keep working", "events": [{ "frame": 5, "type": "instance_lost" }], "interaction_profile": "/interaction_profiles/valve/index_controller" } diff --git a/tests/conformance/scripts/instance_lost_overlay.json b/tests/conformance/scripts/instance_lost_overlay.json new file mode 100644 index 00000000..11bc9079 --- /dev/null +++ b/tests/conformance/scripts/instance_lost_overlay.json @@ -0,0 +1 @@ +{ "#": "An overlay application's instance is lost at its frame 30 (the runtime's service died), and the runtime is back after 300 ms: its own loop makes the instance and session again about a second later; the devices deactivated and activated again, and no VREvent_Quit", "extensions": ["XR_KHR_D3D11_enable", "XR_EXTX_overlay", "XR_MND_headless"], "events": [{ "frame": 30, "type": "instance_lost" }], "loss_unavailable_ms": 300 } diff --git a/tests/conformance/scripts/lost.json b/tests/conformance/scripts/lost.json index af8587bf..b7683ed2 100644 --- a/tests/conformance/scripts/lost.json +++ b/tests/conformance/scripts/lost.json @@ -1 +1 @@ -{ "#": "The session is being lost at frame 60: one VREvent_Quit, then everything fails softly", "events": [{ "frame": 60, "type": "session_state", "state": "LOSS_PENDING" }] } +{ "#": "The session is lost at frame 60, and the system is there again at once: the devices deactivated, a new session made, the devices activated again, and no VREvent_Quit", "events": [{ "frame": 60, "type": "session_state", "state": "LOSS_PENDING" }] } diff --git a/tests/conformance/scripts/lost_before_submit.json b/tests/conformance/scripts/lost_before_submit.json new file mode 100644 index 00000000..9a7229dd --- /dev/null +++ b/tests/conformance/scripts/lost_before_submit.json @@ -0,0 +1 @@ +{ "#": "The session is lost at its first frame, before the game's first Submit, and the headset is gone for 300 ms: the game's Submits answer an error until the session is made again, which then moves to the game's device; no VREvent_Quit", "events": [{ "frame": 1, "type": "session_state", "state": "LOSS_PENDING" }], "loss_unavailable_ms": 300 } diff --git a/tests/conformance/scripts/lost_input.json b/tests/conformance/scripts/lost_input.json new file mode 100644 index 00000000..38bdee62 --- /dev/null +++ b/tests/conformance/scripts/lost_input.json @@ -0,0 +1 @@ +{ "#": "The session is lost at frame 20 and the system is there again at once (case input-frames): the game's actions are attached to the session made again", "events": [{ "frame": 20, "type": "session_state", "state": "LOSS_PENDING" }], "interaction_profile": "/interaction_profiles/valve/index_controller" } diff --git a/tests/conformance/scripts/lost_overlay.json b/tests/conformance/scripts/lost_overlay.json new file mode 100644 index 00000000..a2f4150a --- /dev/null +++ b/tests/conformance/scripts/lost_overlay.json @@ -0,0 +1 @@ +{ "#": "An overlay application's session is lost at its frame 30, and the headset is gone for 300 ms: its own loop makes the session again about a second later; the devices deactivated and activated again, and no VREvent_Quit", "extensions": ["XR_KHR_D3D11_enable", "XR_EXTX_overlay", "XR_MND_headless"], "events": [{ "frame": 30, "type": "session_state", "state": "LOSS_PENDING" }], "loss_unavailable_ms": 300 } diff --git a/tests/conformance/scripts/lost_unavailable.json b/tests/conformance/scripts/lost_unavailable.json new file mode 100644 index 00000000..3dccca0e --- /dev/null +++ b/tests/conformance/scripts/lost_unavailable.json @@ -0,0 +1 @@ +{ "#": "The session is lost at frame 10, and the headset is gone for 300 ms: the first try to find it fails, the next (a second later) makes the session again; no VREvent_Quit", "events": [{ "frame": 10, "type": "session_state", "state": "LOSS_PENDING" }], "loss_unavailable_ms": 300 } diff --git a/tests/conformance/scripts/vive_trackers.json b/tests/conformance/scripts/vive_trackers.json new file mode 100644 index 00000000..019bbd14 --- /dev/null +++ b/tests/conformance/scripts/vive_trackers.json @@ -0,0 +1,13 @@ +{ + "#": "Vive trackers by their role (XR_HTCX_vive_tracker_interaction): one on the waist from the start, at (0.1, 0.9, 0.2), and one on the left foot from frame 20, and one without a role that is also the runtime's xdev (TEST-0001), so a generic tracker; an Index controller in each hand (vive-trackers)", + "extensions": ["XR_KHR_D3D11_enable", "XR_HTCX_vive_tracker_interaction", "XR_MNDX_xdev_space"], + "interaction_profile": "/interaction_profiles/valve/index_controller", + "vive_trackers": [ + { "persistent": "/devices/htc/vive_trackerlhr-waist", "role": "/user/vive_tracker_htcx/role/waist", "frame": 0 }, + { "persistent": "/devices/htc/vive_trackerlhr-foot", "role": "/user/vive_tracker_htcx/role/left_foot", "frame": 20 }, + { "persistent": "/devices/htc/vive_trackertest-0001", "role": "", "frame": 0 } + ], + "poses": { + "/user/vive_tracker_htcx/role/waist/input/grip/pose": { "p": [0.1, 0.9, 0.2], "q": [0, 0, 0, 1] } + } +} diff --git a/tests/conformance/steamvr_run_cases.cpp b/tests/conformance/steamvr_run_cases.cpp new file mode 100644 index 00000000..6f1ebc69 --- /dev/null +++ b/tests/conformance/steamvr_run_cases.cpp @@ -0,0 +1,625 @@ +// Cases whose answers wait on a SteamVR recording with a headset and controllers on: run them with controllers on +// (scripts/controllers_on.json on the stand-in; switched on with SteamVR). Each writes one record per answer, as +// cases.cpp's do, and needs nothing that isn't there to stay ok without a runtime. + +#include "conformance.h" +#include "gfx/GfxApi.h" + +#include "IVRApplications_007.h" +#include "IVRChaperoneSetup_006.h" +#include "IVRChaperone_004.h" +#include "IVRCompositor_029.h" +#include "IVRIOBuffer_002.h" +#include "IVRInput_010.h" +#include "IVROverlay_028.h" +#include "IVRRenderModels_006.h" +#include "IVRSettings_003.h" +#include "IVRSystem_022.h" + +#include +#include +#include +#include +#include +#include + +using namespace conformance; + +namespace { + +Json::Value Ret(int e) +{ + Json::Value v; + v["ret"] = e; + return v; +} + +double Milli(double v) +{ + double r = std::round(v * 1000) / 1000; + return r == 0 ? 0.0 : r; +} + +template +T* Get(CaseContext& c, const char* version) +{ + vr::EVRInitError e = vr::VRInitError_None; + auto* p = (T*)c.core->GetGenericInterface(version, &e); + if (!p) + c.Record(std::string("no ") + version, Ret(e)); + return p; +} + +bool InitScene(CaseContext& c) +{ + vr::EVRInitError e = c.core->Init(vr::VRApplication_Scene, nullptr); + if (e != vr::VRInitError_None) { + c.Record("Init", Ret(e)); + return false; + } + return true; +} + +// A few frames of a game's: poses, then both eyes submitted (the platform's own API: D3D11 on Windows, Vulkan +// elsewhere), and the events, so the session has started and the controllers are seen +void Frames(CaseContext& c, int n) +{ + static std::unique_ptr gfx; + static GfxTexture eyes[2]; + if (!gfx) { + std::string why; +#ifdef _WIN32 + gfx = GfxApi::Create(GfxKind::D3D11, &why); + const int64_t format = 29; // DXGI_FORMAT_R8G8B8A8_UNORM_SRGB +#else + gfx = GfxApi::Create(GfxKind::Vulkan, &why); + const int64_t format = 43; // VK_FORMAT_R8G8B8A8_SRGB +#endif + if (gfx) { + for (int eye = 0; eye < 2; eye++) + eyes[eye] = gfx->Pattern(256, 256, format, eye); + gfx->Flush(); + } + } + auto* comp = (vr::IVRCompositor_029::IVRCompositor*)c.core->GetGenericInterface("IVRCompositor_029", nullptr); + auto* sys = (vr::IVRSystem_022::IVRSystem*)c.core->GetGenericInterface("IVRSystem_022", nullptr); + for (int i = 0; i < n; i++) { + if (comp) { + vr::TrackedDevicePose_t poses[vr::k_unMaxTrackedDeviceCount]; + comp->WaitGetPoses(poses, vr::k_unMaxTrackedDeviceCount, nullptr, 0); + for (int eye = 0; gfx && eye < 2; eye++) { + if (eyes[eye].Made()) + comp->Submit((vr::EVREye)eye, eyes[eye].Texture()); + } + } else { + std::this_thread::sleep_for(std::chrono::milliseconds(11)); + } + vr::VREvent_t ev; + for (int k = 0; sys && k < 64 && sys->PollNextEvent(&ev, sizeof(ev)); k++) { + } + } +} + +// Every connected device's identity properties and role, trackers included +void DevicePropertiesCase(CaseContext& c) +{ + if (!InitScene(c)) + return; + auto* sys = Get(c, "IVRSystem_022"); + if (sys) { + Frames(c, 10); + for (vr::TrackedDeviceIndex_t i = 0; i < vr::k_unMaxTrackedDeviceCount; i++) { + if (!sys->IsTrackedDeviceConnected(i)) + continue; + Json::Value d; + d["class"] = (int)sys->GetTrackedDeviceClass(i); + d["role"] = (int)sys->GetControllerRoleForTrackedDeviceIndex(i); + d["ActivityLevel"] = (int)sys->GetTrackedDeviceActivityLevel(i); + auto str = [&](const char* name, vr::ETrackedDeviceProperty prop) { + char value[256] = {}; + vr::ETrackedPropertyError pe = vr::TrackedProp_Success; + sys->GetStringTrackedDeviceProperty(i, prop, value, sizeof(value), &pe); + d[name] = value; + d[std::string(name) + " error"] = (int)pe; + }; + str("InputProfilePath", vr::Prop_InputProfilePath_String); + str("RegisteredDeviceType", vr::Prop_RegisteredDeviceType_String); + str("ControllerType", vr::Prop_ControllerType_String); + str("RenderModelName", vr::Prop_RenderModelName_String); + vr::ETrackedPropertyError pe = vr::TrackedProp_Success; + d["HandSelectionPriority"] = sys->GetInt32TrackedDeviceProperty(i, vr::Prop_ControllerHandSelectionPriority_Int32, &pe); + d["HandSelectionPriority error"] = (int)pe; + if (i == vr::k_unTrackedDeviceIndex_Hmd) { + float depth = sys->GetFloatTrackedDeviceProperty(i, vr::Prop_UserHeadToEyeDepthMeters_Float, &pe); + d["HeadToEyeDepth"] = Milli(depth); + d["HeadToEyeDepth error"] = (int)pe; + } + c.Record("device " + std::to_string(i), d); + } + Json::Value roles; + for (int role = 0; role <= vr::TrackedControllerRole_Max; role++) { + vr::TrackedDeviceIndex_t i = sys->GetTrackedDeviceIndexForControllerRole((vr::ETrackedControllerRole)role); + roles[std::to_string(role)] = i == vr::k_unTrackedDeviceIndexInvalid ? -1 : (int)i; + } + c.Record("GetTrackedDeviceIndexForControllerRole", roles); + } + c.core->Cleanup(); +} + +// A second Init with another type while a scene app runs, and the Shutdowns that match them +void InitAgainCase(CaseContext& c) +{ + if (!InitScene(c)) + return; + for (auto type : { vr::VRApplication_Overlay, vr::VRApplication_Background, vr::VRApplication_Utility, vr::VRApplication_Other }) { + Json::Value r = Ret(c.core->Init(type, nullptr)); + r["IVRSystem after"] = c.core->GetGenericInterface("IVRSystem_022", nullptr) != nullptr; + c.Record("Init " + std::to_string((int)type) + " while a scene app", r); + if (r["ret"].asInt() == vr::VRInitError_None) + c.core->Cleanup(); + } + c.core->Cleanup(); +} + +void ChaperoneColoursCase(CaseContext& c) +{ + if (!InitScene(c)) + return; + auto* chap = Get(c, "IVRChaperone_004"); + auto* setup = Get(c, "IVRChaperoneSetup_006"); + auto quads = [&](const char* label, bool working) { + vr::HmdQuad_t q[64]; + uint32_t n = 64; + Json::Value r; + r["ret"] = working ? setup->GetWorkingCollisionBoundsInfo(q, &n) : setup->GetLiveCollisionBoundsInfo(q, &n); + r["count"] = n; + if (r["ret"].asBool() && n > 0 && n <= 64) { + for (int k = 0; k < 4; k++) { + Json::Value v; + for (int a = 0; a < 3; a++) + v.append(Milli(q[0].vCorners[k].v[a])); + r["first quad"].append(v); + } + } + c.Record(label, r); + }; + if (setup) { + Frames(c, 5); + quads("GetLiveCollisionBoundsInfo", false); + setup->RevertWorkingCopy(); + quads("GetWorkingCollisionBoundsInfo", true); + } + if (chap) { + vr::HmdColor_t colours[2] = {}, camera = {}; + chap->GetBoundsColor(colours, 2, 1.0f, &camera); + Json::Value r; + for (const vr::HmdColor_t& col : colours) + r["colours"].append(Json::Value(std::to_string(Milli(col.r)) + "," + std::to_string(Milli(col.g)) + "," + + std::to_string(Milli(col.b)) + "," + std::to_string(Milli(col.a)))); + r["camera a"] = Milli(camera.a); + r["AreBoundsVisible"] = chap->AreBoundsVisible(); + c.Record("GetBoundsColor", r); + chap->SetSceneColor(vr::HmdColor_t{ 1, 0, 0, 1 }); + chap->GetBoundsColor(colours, 2, 1.0f, &camera); + Json::Value r2; + r2["first r"] = Milli(colours[0].r); + r2["first g"] = Milli(colours[0].g); + c.Record("GetBoundsColor after SetSceneColor red", r2); + } + c.core->Cleanup(); +} + +// Submits the compositor refuses: bounds of no area, and an app without focus (an overlay app's) +void SubmitRefusalsCase(CaseContext& c) +{ + callers::Texture tex(ArgSet::Valid, *c.call); + if (InitScene(c)) { + auto* comp = Get(c, "IVRCompositor_029"); + if (comp) { + vr::TrackedDevicePose_t poses[16]; + comp->WaitGetPoses(poses, 16, nullptr, 0); + Json::Value r; + vr::VRTextureBounds_t zero{ 0.5f, 0.5f, 0.5f, 0.5f }; + r["zero-area bounds"] = (int)comp->Submit(vr::Eye_Left, tex.get(), &zero); + vr::VRTextureBounds_t flipped{ 1, 1, 0, 0 }; + r["flipped bounds"] = (int)comp->Submit(vr::Eye_Right, tex.get(), &flipped); + c.Record("Submit bounds", r); + } + c.core->Cleanup(); + } + vr::EVRInitError e = c.core->Init(vr::VRApplication_Overlay, nullptr); + Json::Value r = Ret(e); + if (e == vr::VRInitError_None) { + auto* comp = (vr::IVRCompositor_029::IVRCompositor*)c.core->GetGenericInterface("IVRCompositor_029", nullptr); + r["submit"] = comp ? (int)comp->Submit(vr::Eye_Left, tex.get()) : -1; + c.core->Cleanup(); + } + c.Record("Overlay app submit", r); +} + +// IVRInput with an action manifest naming skeletons, a pose and a button (manifest_skeleton.json), after some frames +void SkeletalInputCase(CaseContext& c) +{ + namespace in = vr::IVRInput_010; + if (!InitScene(c)) + return; + auto* input = Get(c, "IVRInput_010"); + if (!input) { + c.core->Cleanup(); + return; + } + std::string manifest = (c.call->dataDir / "manifest_skeleton.json").string(); + c.Record("SetActionManifestPath", Ret(input->SetActionManifestPath(manifest.c_str()))); + vr::VRActionSetHandle_t set = 0; + vr::VRActionHandle_t left = 0, right = 0, pose = 0, grab = 0; + input->GetActionSetHandle("/actions/main", &set); + input->GetActionHandle("/actions/main/in/skeleton_left", &left); + input->GetActionHandle("/actions/main/in/skeleton_right", &right); + input->GetActionHandle("/actions/main/in/pose", &pose); + input->GetActionHandle("/actions/main/in/grab", &grab); + in::VRActiveActionSet_t active{}; + active.ulActionSet = set; + for (int frame = 0; frame < 10; frame++) { + Frames(c, 1); + input->UpdateActionState(&active, sizeof(active), 1); + } + + for (auto [action, hand] : { std::pair{ left, "left" }, std::pair{ right, "right" } }) { + const std::string h = hand; + in::InputSkeletalActionData_t data{}; + Json::Value a = Ret(input->GetSkeletalActionData(action, &data, sizeof(data))); + a["bActive"] = data.bActive; + c.Record(h + " GetSkeletalActionData", a); + for (auto range : { vr::VRSkeletalMotionRange_WithController, vr::VRSkeletalMotionRange_WithoutController }) { + vr::VRBoneTransform_t bones[31] = {}; + Json::Value b = Ret(input->GetSkeletalBoneData(action, in::VRSkeletalTransformSpace_Parent, range, bones, 31)); + // The wrist, and a fingertip's position, which differ between the ranges + for (int bone : { 1, 9 }) { + Json::Value p; + for (int k = 0; k < 3; k++) + p.append(Milli(bones[bone].position.v[k])); + b["bone " + std::to_string(bone)] = p; + } + c.Record(h + " GetSkeletalBoneData " + (range == vr::VRSkeletalMotionRange_WithController ? "WithController" : "WithoutController"), b); + } + for (auto type : { in::VRSummaryType_FromAnimation, in::VRSummaryType_FromDevice }) { + in::VRSkeletalSummaryData_t s{}; + Json::Value r = Ret(input->GetSkeletalSummaryData(action, type, &s)); + for (float curl : s.flFingerCurl) + r["curl"].append(Milli(curl)); + for (float splay : s.flFingerSplay) + r["splay"].append(Milli(splay)); + c.Record(h + " GetSkeletalSummaryData " + (type == in::VRSummaryType_FromAnimation ? "FromAnimation" : "FromDevice"), r); + } + } + + in::InputPoseActionData_t pd{}; + Json::Value p = Ret(input->GetPoseActionDataForNextFrame(pose, vr::TrackingUniverseStanding, &pd, sizeof(pd), vr::k_ulInvalidInputValueHandle)); + p["bActive"] = pd.bActive; + p["bPoseIsValid"] = pd.pose.bPoseIsValid; + c.Record("GetPoseActionDataForNextFrame", p); + + vr::VRInputValueHandle_t origins[16] = {}; + Json::Value o = Ret(input->GetActionOrigins(set, grab, origins, 16)); + int count = 0; + for (vr::VRInputValueHandle_t h : origins) + count += h != vr::k_ulInvalidInputValueHandle; + o["count"] = count; + c.Record("GetActionOrigins", o); + for (int32_t sections : { (int32_t)in::VRInputString_Hand, (int32_t)in::VRInputString_ControllerType, + (int32_t)in::VRInputString_InputSource, (int32_t)in::VRInputString_All }) { + char name[256] = {}; + Json::Value n = Ret(count ? input->GetOriginLocalizedName(origins[0], name, sizeof(name), sections) : -1); + n["name"] = name; + c.Record("GetOriginLocalizedName " + std::to_string(sections), n); + } + + std::string other = (c.call->dataDir / "manifest_basic.json").string(); + Json::Value again = Ret(input->SetActionManifestPath(other.c_str())); + vr::VRActionHandle_t trigger = 0; + again["trigger handle"] = input->GetActionHandle("/actions/main/in/trigger", &trigger); + c.Record("SetActionManifestPath again, another file", again); + c.core->Cleanup(); +} + +// Legacy input: an Index controller's finger curls (axes 3 and 4) and haptic pulses of a few strengths +void LegacyControllerCase(CaseContext& c) +{ + if (!InitScene(c)) + return; + auto* sys = Get(c, "IVRSystem_022"); + if (sys) { + Frames(c, 10); + for (auto role : { vr::TrackedControllerRole_LeftHand, vr::TrackedControllerRole_RightHand }) { + const std::string hand = role == vr::TrackedControllerRole_LeftHand ? "left" : "right"; + vr::TrackedDeviceIndex_t i = sys->GetTrackedDeviceIndexForControllerRole(role); + if (i == vr::k_unTrackedDeviceIndexInvalid) { + c.Record(hand + " no controller"); + continue; + } + vr::VRControllerState_t s{}; + Json::Value r; + r["ret"] = sys->GetControllerState(i, &s, sizeof(s)); + for (int axis = 0; axis < (int)vr::k_unControllerStateAxisCount; axis++) + r["axis types"].append(sys->GetInt32TrackedDeviceProperty(i, (vr::ETrackedDeviceProperty)(vr::Prop_Axis0Type_Int32 + axis))); + r["axis 3 x"] = Milli(s.rAxis[3].x); + r["axis 4 x"] = Milli(s.rAxis[4].x); + c.Record(hand + " GetControllerState", r); + for (unsigned short us : { 0, 500, 3999, 4000, 65535 }) + sys->TriggerHapticPulse(i, 0, us); + c.Record(hand + " TriggerHapticPulse strengths"); + } + } + c.core->Cleanup(); +} + +// Each controller's render model: its name, and each component's state through the device path +void RenderModelComponentsCase(CaseContext& c) +{ + namespace rm = vr::IVRRenderModels_006; + if (!InitScene(c)) + return; + auto* sys = Get(c, "IVRSystem_022"); + auto* models = Get(c, "IVRRenderModels_006"); + auto* input = Get(c, "IVRInput_010"); + if (sys && models && input) { + Frames(c, 10); + for (const char* hand : { "left", "right" }) { + vr::TrackedDeviceIndex_t i = sys->GetTrackedDeviceIndexForControllerRole( + std::string(hand) == "left" ? vr::TrackedControllerRole_LeftHand : vr::TrackedControllerRole_RightHand); + Json::Value r; + char model[256] = {}; + if (i != vr::k_unTrackedDeviceIndexInvalid) + sys->GetStringTrackedDeviceProperty(i, vr::Prop_RenderModelName_String, model, sizeof(model)); + r["model"] = model; + vr::VRInputValueHandle_t path = 0; + input->GetInputSourceHandle((std::string("/user/hand/") + hand).c_str(), &path); + uint32_t n = model[0] ? models->GetComponentCount(model) : 0; + r["components"] = n; + for (uint32_t k = 0; k < n && k < 64; k++) { + char comp[128] = {}; + models->GetComponentName(model, k, comp, sizeof(comp)); + rm::RenderModel_ControllerMode_State_t mode{}; + for (bool scroll : { false, true }) { + mode.bScrollWheelVisible = scroll; + vr::RenderModel_ComponentState_t state{}; + bool ok = models->GetComponentStateForDevicePath(model, comp, path, &mode, &state); + r[std::string(comp) + (scroll ? " scroll" : "")] = ok ? (int)state.uProperties : -1; + } + } + c.Record(std::string(hand) + " render model components", r); + } + Json::Value names; + char name[256]; + for (uint32_t k = 0; k < 256 && models->GetRenderModelName(k, name, sizeof(name)); k++) + names["count"] = k + 1; + c.Record("GetRenderModelName", names); + } + c.core->Cleanup(); +} + +// A new overlay's defaults, its flags, and the events its changes send +void OverlayDefaultsCase(CaseContext& c) +{ + namespace ov = vr::IVROverlay_028; + if (!InitScene(c)) + return; + auto* overlay = Get(c, "IVROverlay_028"); + auto* sys = Get(c, "IVRSystem_022"); + if (overlay && sys) { + Frames(c, 2); + vr::VROverlayHandle_t h = vr::k_ulOverlayHandleInvalid; + c.Record("CreateOverlay", Ret(overlay->CreateOverlay("oc.defaults", "Defaults", &h))); + Json::Value d; + float f = -1; + overlay->GetOverlayCurvature(h, &f); + d["curvature"] = Milli(f); + overlay->GetOverlayWidthInMeters(h, &f); + d["width"] = Milli(f); + overlay->GetOverlayAlpha(h, &f); + d["alpha"] = Milli(f); + uint32_t order = 99; + overlay->GetOverlaySortOrder(h, &order); + d["sort order"] = order; + for (auto [flag, name] : { std::pair{ ov::VROverlayFlags_SideBySide_Parallel, "SideBySide_Parallel" }, + std::pair{ ov::VROverlayFlags_SideBySide_Crossed, "SideBySide_Crossed" }, + std::pair{ ov::VROverlayFlags_Panorama, "Panorama" }, std::pair{ ov::VROverlayFlags_StereoPanorama, "StereoPanorama" } }) { + bool on = true; + overlay->GetOverlayFlag(h, flag, &on); + d[name] = on; + Json::Value set = Ret(overlay->SetOverlayFlag(h, flag, true)); + overlay->GetOverlayFlag(h, flag, &on); + set["after"] = on; + overlay->SetOverlayFlag(h, flag, false); + d[std::string(name) + " set"] = set; + } + c.Record("new overlay defaults", d); + + // The events of a name change, a show and a hide, then the destroy (on the system's queue) + overlay->SetOverlayName(h, "Renamed"); + overlay->ShowOverlay(h); + Frames(c, 2); + overlay->HideOverlay(h); + Json::Value events; + vr::VREvent_t ev; + for (int k = 0; k < 64 && overlay->PollNextOverlayEvent(h, (vr::VREvent_t*)&ev, sizeof(ev)); k++) + events["overlay"].append((int)ev.eventType); + overlay->DestroyOverlay(h); + Frames(c, 2); + for (int k = 0; k < 64 && sys->PollNextEvent(&ev, sizeof(ev)); k++) + events["system"].append((int)ev.eventType); + c.Record("overlay events", events); + } + c.core->Cleanup(); +} + +// The defaults of keys games read, and the event a change of one sends +void SettingsDefaultsCase(CaseContext& c) +{ + namespace st = vr::IVRSettings_003; + if (!InitScene(c)) + return; + auto* settings = Get(c, "IVRSettings_003"); + auto* sys = Get(c, "IVRSystem_022"); + if (settings && sys) { + auto num = [&](const char* section, const char* key) { + st::EVRSettingsError e = st::VRSettingsError_None; + Json::Value r; + r["float"] = Milli(settings->GetFloat(section, key, &e)); + r["error"] = (int)e; + c.Record(std::string(section) + "/" + key, r); + }; + auto text = [&](const char* section, const char* key) { + st::EVRSettingsError e = st::VRSettingsError_None; + char value[256] = {}; + settings->GetString(section, key, value, sizeof(value), &e); + Json::Value r; + r["empty"] = value[0] == 0; + r["error"] = (int)e; + c.Record(std::string(section) + "/" + key, r); + }; + num("collisionBounds", "CollisionBoundsFadeDistance"); + num("collisionBounds", "CollisionBoundsColorGammaA"); + num("steamvr", "supersampleScale"); + num("steamvr", "ipd"); + text("audio", "playbackDevice"); + text("audio", "recordingDevice"); + text("steamvr", "background"); + + Frames(c, 2); + settings->SetFloat("collisionBounds", "CollisionBoundsFadeDistance", 0.5f); + Frames(c, 3); + Json::Value r; + vr::VREvent_t ev; + for (int k = 0; k < 64 && sys->PollNextEvent(&ev, sizeof(ev)); k++) { + if (ev.eventType >= vr::VREvent_BackgroundSettingHasChanged && ev.eventType < vr::VREvent_StatusUpdate) { + Json::Value e; + e["type"] = (int)ev.eventType; + e["device"] = ev.trackedDeviceIndex; + r["events"].append(e); + } + } + c.Record("SetFloat collisionBounds fade distance: events", r); + settings->RemoveKeyInSection("collisionBounds", "CollisionBoundsFadeDistance"); + } + c.core->Cleanup(); +} + +// Where the installed applications are listed from: their count, and the first one's source and binary +void ApplicationListCase(CaseContext& c) +{ + namespace ap = vr::IVRApplications_007; + if (!InitScene(c)) + return; + auto* apps = Get(c, "IVRApplications_007"); + if (apps) { + Json::Value r; + uint32_t n = apps->GetApplicationCount(); + r["count"] = n; + char key[256] = {}; + if (n) { + r["first key"] = (int)apps->GetApplicationKeyByIndex(0, key, sizeof(key)); + ap::EVRApplicationError e = ap::VRApplicationError_None; + char source[256] = {}, binary[1024] = {}; + apps->GetApplicationPropertyString(key, ap::VRApplicationProperty_Source_String, source, sizeof(source), &e); + r["source error"] = (int)e; + r["source"] = source; + apps->GetApplicationPropertyString(key, ap::VRApplicationProperty_BinaryPath_String, binary, sizeof(binary), &e); + r["binary path set"] = binary[0] != 0; + } + c.Record("GetApplicationCount", r); + } + c.core->Cleanup(); +} + +// IVRIOBuffer's modes: a buffer created, written, opened again for reading, read, and its property container +void IOBufferCase(CaseContext& c) +{ + namespace io = vr::IVRIOBuffer_002; + if (!InitScene(c)) + return; + auto* buffers = Get(c, "IVRIOBuffer_002"); + if (buffers) { + io::IOBufferHandle_t w = 0, r = 0; + const char* path = "/oc/conformance/buffer"; + c.Record("Open create write", Ret(buffers->Open(path, (io::EIOBufferMode)(io::IOBufferMode_Write | io::IOBufferMode_Create), 16, 4, &w))); + c.Record("Open read", Ret(buffers->Open(path, io::IOBufferMode_Read, 16, 4, &r))); + Json::Value h; + h["HasReaders"] = w ? buffers->HasReaders(w) : false; + h["PropertyContainer not 0"] = w ? buffers->PropertyContainer(w) != 0 : false; + c.Record("HasReaders", h); + char data[16] = "conformance"; + c.Record("Write", Ret(w ? buffers->Write(w, data, sizeof(data)) : -1)); + char back[16] = {}; + uint32_t read = 0; + Json::Value rd = Ret(r ? buffers->Read(r, back, sizeof(back), &read) : -1); + rd["read"] = read; + rd["same"] = memcmp(back, data, sizeof(data)) == 0; + c.Record("Read", rd); + c.Record("Open missing for reading", Ret(buffers->Open("/oc/conformance/none", io::IOBufferMode_Read, 16, 4, &r))); + if (w) + c.Record("Close write", Ret(buffers->Close(w))); + } + c.core->Cleanup(); +} + +// An overlay app and a background app that read the controllers through IVRSystem only and submit no frames, as +// overlay tools do: run with scripts/helper_apps_controllers.json on the stand-in +void HelperAppControllersCase(CaseContext& c) +{ + for (auto [type, name] : { std::pair{ vr::VRApplication_Overlay, "overlay" }, std::pair{ vr::VRApplication_Background, "background" } }) { + const std::string t = name; + vr::EVRInitError e = c.core->Init(type, nullptr); + if (e != vr::VRInitError_None) { + c.Record(t + " Init", Ret(e)); + continue; + } + auto* sys = Get(c, "IVRSystem_022"); + if (sys) { + bool connected[3] = {}; + vr::TrackedDevicePose_t poses[3] = {}; + vr::VRControllerState_t state{}; + bool stateRet = false; + for (int i = 0; i < 60 && !(connected[1] && connected[2] && poses[1].bPoseIsValid && poses[2].bPoseIsValid); i++) { + std::this_thread::sleep_for(std::chrono::milliseconds(11)); + for (vr::TrackedDeviceIndex_t d = 1; d <= 2; d++) + connected[d] = sys->IsTrackedDeviceConnected(d); + sys->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseStanding, 0, poses, 3); + vr::TrackedDeviceIndex_t left = sys->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_LeftHand); + stateRet = left != vr::k_unTrackedDeviceIndexInvalid && sys->GetControllerState(left, &state, sizeof(state)); + vr::VREvent_t ev; + for (int k = 0; k < 64 && sys->PollNextEvent(&ev, sizeof(ev)); k++) { + } + } + Json::Value r; + r["left connected"] = connected[1]; + r["right connected"] = connected[2]; + r["left pose valid"] = poses[1].bPoseIsValid; + r["right pose valid"] = poses[2].bPoseIsValid; + r["GetControllerState"] = stateRet; + c.Record(t + " controllers", r); + } + c.core->Cleanup(); + } +} + +} // namespace + +const std::map& conformance::SteamVRRunCases() +{ + static const std::map cases = { + { "device-properties", DevicePropertiesCase }, + { "init-again", InitAgainCase }, + { "chaperone-colours", ChaperoneColoursCase }, + { "submit-refusals", SubmitRefusalsCase }, + { "skeletal-input", SkeletalInputCase }, + { "legacy-controller", LegacyControllerCase }, + { "render-model-components", RenderModelComponentsCase }, + { "overlay-defaults", OverlayDefaultsCase }, + { "settings-defaults", SettingsDefaultsCase }, + { "application-list", ApplicationListCase }, + { "io-buffer", IOBufferCase }, + { "helper-app-controllers", HelperAppControllersCase }, + }; + return cases; +} diff --git a/tests/conformance/unsafe_methods.txt b/tests/conformance/unsafe_methods.txt index b74a7316..b7f16b06 100644 --- a/tests/conformance/unsafe_methods.txt +++ b/tests/conformance/unsafe_methods.txt @@ -8,3 +8,4 @@ IVRChaperoneSetup_.* (CommitWorkingCopy|ImportFromBufferToWorking) changes the r IVROverlay_.* ShowDashboard opens SteamVR's dashboard IVRCompositor_.* CompositorQuit quits SteamVR's compositor IVRSettings_.* (RemoveSection|RemoveKeyInSection) would remove the null-driver settings mid-run +IVROverlay_.* ShowMessageOverlay shows a modal message box and waits for a click in the headset (each call would wait out the timeout) diff --git a/tests/conformance/volatile.json b/tests/conformance/volatile.json index b9c879f7..ade11662 100644 --- a/tests/conformance/volatile.json +++ b/tests/conformance/volatile.json @@ -1,5 +1,8 @@ [ { "#": "Fields regress.py skips: values that change from run to run (or from machine to machine), so a baseline can't pin them. Each entry has interface, method and field regexes, as differences.json's, and its reason. Found by comparing three full stand-in runs on one PC; a field that differs on CI's runner gets its entry here too." }, + { "interface": "IVRCompositor_\\d+", "method": "GetLastPosePredictionIDs", "field": "out", "apptype": "3", "reason": "a background app's session runs OpenLamina's empty frames until the app runs one: how many have run when it asks" }, + { "interface": "IVRSystem_\\d+", "method": "IsInputAvailable", "field": "ret", "apptype": "3", "reason": "a background app's session runs OpenLamina's empty frames until the app runs one: whether input focus has come yet when it asks (true once on CI's Linux x86 runner, where it was false)" }, + { "interface": "IVROverlay_\\d+", "method": "WaitFrameSync", "field": "ret", "apptype": "3", "reason": "a background app's session runs OpenLamina's empty frames until the app runs one: whether one starts within the timeout" }, { "interface": "frame-loop", "method": "frame 1", "field": "events", "reason": "how many session state changes (each a SceneApplicationStateChanged) arrive before the first frame's poll: 4 to 6 on CI" }, { "interface": "IVRApplications_\\d+", "method": "GetCurrentSceneProcessId", "field": "ret", "reason": "the scene app's process id" }, { "interface": "IVRApplications_\\d+", "method": "GetApplicationProcessId", "field": "ret", "reason": "the process id IdentifyApplication recorded" }, diff --git a/tests/conformance/xr_failures.py b/tests/conformance/xr_failures.py index f33b67ed..e51a3301 100644 --- a/tests/conformance/xr_failures.py +++ b/tests/conformance/xr_failures.py @@ -64,6 +64,59 @@ def check(name, want, out): misses.append(f"frame-loop: {len(quits)} VREvent_Quit polled (frames {quits}), expected {want['quit_events']}") elif "quit_from_frame" in want and quits and quits[0] < want["quit_from_frame"]: misses.append(f"frame-loop: VREvent_Quit polled at frame {quits[0]}, expected from frame {want['quit_from_frame']}") + if "device_events" in want: + # A loss: the devices deactivated (101), then activated again (100) on the new session, in that order (after + # any activations at the start); the runtime asks for no quit (704) + seq = [e for r in frames for e in r.get("events", []) if e in (100, 101, 704)] + rest = iter(seq) + if not all(any(e == w for e in rest) for w in want["device_events"]): + misses.append(f"frame-loop: device events {seq}, expected {want['device_events']} in that order") + if 704 in seq: + misses.append("frame-loop: VREvent_DriverRequestedQuit polled after a loss") + for key, at_least in (("sessions_lost", False), ("sessions_created_min", True), ("instances_lost", False), ("instances_created_min", True)): + if key in want: + dump = json.loads(dump_path.read_text(encoding="utf-8")) if dump_path.exists() else {} + name = key.removesuffix("_min") + got = dump.get(name, 0) + if (got < want[key]) if at_least else (got != want[key]): + misses.append(f"frame-loop: the runtime saw {got} {name.replace('_', ' ')}, expected {'at least ' if at_least else ''}{want[key]}") + if "loss_record" in want: + # A helper program's loss (case overlay-app-loss): its device events in order, no quit, and a session made again + # that ran frames + r = by_method.get(("overlay-app-loss", "loss")) or {} + want_r = want["loss_record"] + events = r.get("events", []) + rest = iter(events) + if not all(any(e == w for e in rest) for w in want_r["device_events"]): + misses.append(f"overlay-app-loss: device events {events}, expected {want_r['device_events']} in that order") + if 700 in events or 704 in events: + misses.append(f"overlay-app-loss: a quit polled after a loss ({events})") + for key, value in want_r.items(): + if key.endswith("_min") and (r.get(key.removesuffix("_min")) or 0) < value: + misses.append(f"overlay-app-loss: {key.removesuffix('_min')} {r.get(key.removesuffix('_min'))}, expected at least {value}") + elif key in ("sessions_lost", "instances_lost", "manifest") and r.get(key) != value: + misses.append(f"overlay-app-loss: {key} {r.get(key)}, expected {value}") + if "rebuilt_actions" in want: + # Case input-frames through an instance loss: the last instance has the game's manifest's actions and their + # bindings + path = out / "raw" / "case-input-frames.dump.json" + dump = json.loads(path.read_text(encoding="utf-8")) if path.exists() else {} + if dump.get("instances_lost") != 1 or dump.get("instances_created", 0) < 2: + misses.append(f"input-frames: {dump.get('instances_lost')} instances lost and {dump.get('instances_created')} made, expected 1 and at least 2") + names = {a.get("name") for a in dump.get("actions", [])} + missing = [n for n in want["rebuilt_actions"] if n not in names] + if missing: + misses.append(f"input-frames: the new instance has no actions {missing}") + if not dump.get("suggested_bindings"): + misses.append("input-frames: the new instance had no bindings suggested") + if "action_attaches_min" in want: + # Case input-frames through a session or instance loss: the game's actions are attached to the session made + # again too + path = out / "raw" / "case-input-frames.dump.json" + dump = json.loads(path.read_text(encoding="utf-8")) if path.exists() else {} + lost = (dump.get("sessions_lost") or 0) + (dump.get("instances_lost") or 0) + if lost != 1 or dump.get("action_attaches", 0) < want["action_attaches_min"]: + misses.append(f"input-frames: {lost} sessions or instances lost and {dump.get('action_attaches')} action attaches, expected 1 and at least {want['action_attaches_min']}") if "old_event_quits" in want: # IVRSystem_009's events (case old-events): the quit arrives, and nothing is written past the 32-byte event olds = [r for r in records if r.get("case") == "old-events" and str(r.get("method", "")).startswith("frame ")] diff --git a/tests/runtime/CMakeLists.txt b/tests/runtime/CMakeLists.txt index 075a6197..572c5d65 100644 --- a/tests/runtime/CMakeLists.txt +++ b/tests/runtime/CMakeLists.txt @@ -24,11 +24,13 @@ if (WIN32) target_sources(oc_test_runtime PRIVATE swapchain_d3d11.cpp swapchain_d3d12.cpp oc_test_runtime.def) target_include_directories(oc_test_runtime PRIVATE ${CMAKE_SOURCE_DIR}/libs/vulkan/Include) target_compile_definitions(oc_test_runtime PRIVATE XR_USE_PLATFORM_WIN32 XR_USE_GRAPHICS_API_D3D11 XR_USE_GRAPHICS_API_D3D12) - target_link_libraries(oc_test_runtime PRIVATE jsoncpp d3d11 d3d12 dxgi opengl32) + target_link_libraries(oc_test_runtime PRIVATE ${jsoncppLib} d3d11 d3d12 dxgi opengl32) else () target_compile_definitions(oc_test_runtime PRIVATE XR_USE_PLATFORM_XLIB) # GL and GLX from libGL; X11 for the display the binding names; Vulkan's loader is opened at run time - target_link_libraries(oc_test_runtime PRIVATE jsoncpp GL X11 ${CMAKE_DL_LIBS} -Wl,--no-undefined) + # nodelete: the loader unloads a runtime whose last instance is destroyed, and the state of a scripted loss must + # outlive the lost instance + target_link_libraries(oc_test_runtime PRIVATE ${jsoncppLib} GL X11 ${CMAKE_DL_LIBS} -Wl,--no-undefined -Wl,-z,nodelete) endif () set_target_properties(oc_test_runtime PROPERTIES PREFIX "") @@ -44,9 +46,9 @@ target_include_directories(runtime_smoke PRIVATE ${CMAKE_SOURCE_DIR}/libs/doctes target_compile_definitions(runtime_smoke PRIVATE DOCTEST_CONFIG_USE_STD_HEADERS VK_NO_PROTOTYPES) if (WIN32) target_include_directories(runtime_smoke PRIVATE ${CMAKE_SOURCE_DIR}/libs/vulkan/Include) - target_link_libraries(runtime_smoke PRIVATE ${XrLib} jsoncpp d3d11 d3d12 dxgi opengl32) + target_link_libraries(runtime_smoke PRIVATE ${XrLib} ${jsoncppLib} d3d11 d3d12 dxgi opengl32) else () - target_link_libraries(runtime_smoke PRIVATE ${XrLib} jsoncpp GL X11 ${CMAKE_DL_LIBS}) + target_link_libraries(runtime_smoke PRIVATE ${XrLib} ${jsoncppLib} GL X11 ${CMAKE_DL_LIBS}) endif () add_dependencies(runtime_smoke oc_test_runtime) @@ -84,3 +86,18 @@ add_test(NAME runtime_input COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tes --env OC_TEST_RUNTIME_SCRIPT=${CMAKE_CURRENT_SOURCE_DIR}/scripts/input_smoke.json -- $ input) set_tests_properties(runtime_input_noext runtime_input PROPERTIES LABELS runtime) + +# Proton's use of vrclient.so: loaded, used, unloaded and loaded again in one process (reload.cpp) +if (NOT WIN32) + add_executable(runtime_reload reload.cpp) + target_link_libraries(runtime_reload PRIVATE ${CMAKE_DL_LIBS}) + add_dependencies(runtime_reload oc_test_runtime OCOVR) + add_test(NAME runtime_reload COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tests/unelevated.py + --env XR_RUNTIME_JSON=${OC_TEST_RUNTIME_MANIFEST} + --env OC_NO_MESSAGE_BOX=1 --env OC_TEST_NO_STEAMVR=1 + --env OC_LOG_DIR=${CMAKE_CURRENT_BINARY_DIR}/reload_logs + --env OC_STORE_DIR=${CMAKE_CURRENT_BINARY_DIR}/reload_store + --env XDG_CONFIG_HOME=${CMAKE_CURRENT_BINARY_DIR}/reload_config + -- $ $) + set_tests_properties(runtime_reload PROPERTIES LABELS runtime TIMEOUT 120) +endif () diff --git a/tests/runtime/actions.cpp b/tests/runtime/actions.cpp index 05ed2880..f6dcc75c 100644 --- a/tests/runtime/actions.cpp +++ b/tests/runtime/actions.cpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace { @@ -169,6 +170,11 @@ XrResult XRAPI_CALL AttachSessionActionSets(XrSession session, const XrSessionAc it->second->attached = true; } s->actionsAttached = true; + if (Dump::Enabled()) { + Dump& d = GetDump(); + std::lock_guard dg(d.lock); + d.root["action_attaches"] = d.root["action_attaches"].asUInt64() + 1; + } return XR_SUCCESS; } @@ -462,6 +468,34 @@ bool RtGazeSpace(const RtSpace* sp, XrPosef* poseInStage, XrSpaceLocationFlags* void RtActionsOnFrame(RtSession* s) { + // XR_HTCX_vive_tracker_interaction: a tracker connects at its frame. XrEventDataViveTrackerConnectedHTCX (not in + // the bundled 1.0.12 headers): type, next, then a pointer to the tracker's paths, which stay valid + if (RtExtensionEnabled("XR_HTCX_vive_tracker_interaction")) { + struct Paths { + XrStructureType type; + void* next; + XrPath persistentPath; + XrPath rolePath; + }; + struct Connected { + XrStructureType type; + const void* next; + Paths* paths; + }; + static std::deque announced; + for (const ScriptViveTracker& t : GetScript().viveTrackers) { + if (t.frame != s->framesWaited) + continue; + announced.push_back({ (XrStructureType)1000103000, nullptr, RtPath(t.persistent), t.role.empty() ? XR_NULL_PATH : RtPath(t.role) }); + XrEventDataBuffer buf{ XR_TYPE_EVENT_DATA_BUFFER }; + auto* ev = (Connected*)&buf; + ev->type = (XrStructureType)1000103001; // XR_TYPE_EVENT_DATA_VIVE_TRACKER_CONNECTED_HTCX + ev->next = nullptr; + ev->paths = &announced.back(); + QueueEvent(buf); + } + } + if (!RtExtensionEnabled("XR_EXT_user_presence")) return; for (const ScriptPresence& p : GetScript().presence) { diff --git a/tests/runtime/extensions.cpp b/tests/runtime/extensions.cpp index e1af5270..391f69b0 100644 --- a/tests/runtime/extensions.cpp +++ b/tests/runtime/extensions.cpp @@ -73,6 +73,41 @@ XrResult XRAPI_CALL LocateHandJoints(XrHandTrackerEXT tracker, const XrHandJoint return XR_SUCCESS; } +// --- XR_HTCX_vive_tracker_interaction: the script's trackers --- + +struct ViveTrackerPaths { + XrStructureType type; + void* next; + XrPath persistentPath; + XrPath rolePath; +}; + +uint64_t CurrentFrame() +{ + return St().session ? St().session->framesWaited : 0; +} + +XrResult XRAPI_CALL EnumerateViveTrackerPaths(XrInstance, uint32_t capacity, uint32_t* count, ViveTrackerPaths* paths) +{ + std::lock_guard g(St().lock); + if (!count) + return XR_ERROR_VALIDATION_FAILURE; + std::vector live; + for (const ScriptViveTracker& t : GetScript().viveTrackers) + if (t.frame <= CurrentFrame()) + live.push_back({ (XrStructureType)1000103000, nullptr, RtPath(t.persistent), t.role.empty() ? XR_NULL_PATH : RtPath(t.role) }); + *count = (uint32_t)live.size(); + if (capacity == 0) + return XR_SUCCESS; + if (capacity < live.size() || !paths) + return XR_ERROR_SIZE_INSUFFICIENT; + for (size_t i = 0; i < live.size(); i++) { + paths[i].persistentPath = live[i].persistentPath; + paths[i].rolePath = live[i].rolePath; + } + return XR_SUCCESS; +} + // --- XR_MNDX_xdev_space: one tracker --- const XrXDevIdMNDX kTrackerId = 1; @@ -310,6 +345,7 @@ PFN_xrVoidFunction RtExtensionsLookup(const char* name, const char** extension) { "xrCreateHandTrackerEXT", (PFN_xrVoidFunction)CreateHandTracker, "XR_EXT_hand_tracking" }, { "xrDestroyHandTrackerEXT", (PFN_xrVoidFunction)DestroyHandTracker, "XR_EXT_hand_tracking" }, { "xrLocateHandJointsEXT", (PFN_xrVoidFunction)LocateHandJoints, "XR_EXT_hand_tracking" }, + { "xrEnumerateViveTrackerPathsHTCX", (PFN_xrVoidFunction)EnumerateViveTrackerPaths, "XR_HTCX_vive_tracker_interaction" }, { "xrCreateXDevListMNDX", (PFN_xrVoidFunction)CreateXDevList, "XR_MNDX_xdev_space" }, { "xrGetXDevListGenerationNumberMNDX", (PFN_xrVoidFunction)GetXDevListGenerationNumber, "XR_MNDX_xdev_space" }, { "xrEnumerateXDevsMNDX", (PFN_xrVoidFunction)EnumerateXDevs, "XR_MNDX_xdev_space" }, diff --git a/tests/runtime/probe.cpp b/tests/runtime/probe.cpp index 44be0638..e22dee22 100644 --- a/tests/runtime/probe.cpp +++ b/tests/runtime/probe.cpp @@ -125,7 +125,8 @@ void RtNoteReadbackTimeout() d.root["readback_timeouts"] = d.root["readback_timeouts"].asInt() + 1; } -bool ProbeSamples(SwapchainImage& image, XrRect2Di rect, uint32_t arrayIndex, Samples& out, std::string* why) +bool ProbeSamples(SwapchainImage& image, XrRect2Di rect, uint32_t arrayIndex, Samples& out, std::string* why, + const std::vector>* extra, std::vector* extraOut) { std::string ignored; if (!why) @@ -172,13 +173,27 @@ bool ProbeSamples(SwapchainImage& image, XrRect2Di rect, uint32_t arrayIndex, Sa std::vector points = { { left, top }, { right, top }, { left, bottom }, { right, bottom }, { (x0 + x1) / 2, centreY }, }; + if (extra) { + for (const auto& [fx, fy] : *extra) { + int32_t x = std::min(x0 + (int32_t)(fx * (float)(x1 - x0)), x1 - 1); + int32_t y = std::min(y0 + (int32_t)(fy * (float)(y1 - y0)), y1 - 1); + if (gfx->bottomUp) + y = y1 - 1 - (y - y0); + points.push_back({ x, y }); + } + } std::vector texels; if (!gfx->read(image.session, sc, image.index, arrayIndex, points, bytes, texels, why)) return false; - if (texels.size() < 5 * bytes) { + if (texels.size() < points.size() * bytes) { *why = "the readback returned too little"; return false; } + if (extra && extraOut) { + extraOut->clear(); + for (size_t i = 5; i < points.size(); i++) + extraOut->push_back(ToRgba8(layout, &texels[i * bytes])); + } out.tl = ToRgba8(layout, &texels[0 * bytes]); out.tr = ToRgba8(layout, &texels[1 * bytes]); out.bl = ToRgba8(layout, &texels[2 * bytes]); diff --git a/tests/runtime/probe.h b/tests/runtime/probe.h index fdbb4efb..532cb82b 100644 --- a/tests/runtime/probe.h +++ b/tests/runtime/probe.h @@ -6,6 +6,8 @@ #include #include +#include +#include // RGBA8 values, 0xRRGGBBAA, of the rect as shown: tl is its top-left corner whatever the API's row order. They are // the bytes the image stores: an sRGB format's sRGB-encoded bytes, a UNORM one's linear bytes, with no conversion @@ -29,7 +31,10 @@ PixelLayout LayoutOfDxgi(int64_t format); // API's staging path, RtGfx::read; a 32-bit float depth image's value in every channel). False when it can't be read // (no such image, another depth format or an unknown one, an empty rect, a multisampled image on D3D12, Vulkan or // OpenGL). -bool ProbeSamples(SwapchainImage& image, XrRect2Di rect, uint32_t arrayIndex, Samples& out, std::string* why = nullptr); +// extra: more points to read in the same readback, as (x, y) fractions of the rect from its top-left as shown, their +// texels in extraOut. +bool ProbeSamples(SwapchainImage& image, XrRect2Di rect, uint32_t arrayIndex, Samples& out, std::string* why = nullptr, + const std::vector>* extra = nullptr, std::vector* extraOut = nullptr); // {"tl": "ff0000ff", "tr": ..., "bl": ..., "br": ..., "c": ...} Json::Value SamplesJson(const Samples& s); diff --git a/tests/runtime/reload.cpp b/tests/runtime/reload.cpp new file mode 100644 index 00000000..680f09fa --- /dev/null +++ b/tests/runtime/reload.cpp @@ -0,0 +1,110 @@ +// What Proton does with vrclient.so: load, use, shut down and dlclose it, several times in one process; then load it +// once more and exit without shutting down, as a game may. Arguments and environment: tests/runtime/CMakeLists.txt. +#include + +#include +#include +#include + +// IVRClientCore_003, IVRSystem's first method and IVRCompositor_027's first three: only what's called. Outside the +// anonymous namespace: there the compiler would know no class implements them, and take the calls for unreachable. +struct ClientCore { + virtual int Init(int appType, const char* startupInfo) = 0; + virtual void Cleanup() = 0; + virtual int IsInterfaceVersionValid(const char* version) = 0; + virtual void* GetGenericInterface(const char* nameAndVersion, int* error) = 0; +}; +struct System { + virtual void GetRecommendedRenderTargetSize(uint32_t* width, uint32_t* height) = 0; +}; +struct Compositor { + virtual void SetTrackingSpace(int origin) = 0; + virtual int GetTrackingSpace() = 0; + virtual int WaitGetPoses(void* render, uint32_t renderCount, void* game, uint32_t gameCount) = 0; +}; +using Factory = void* (*)(const char* interfaceName, int* returnCode); + +namespace { + +constexpr int Scene = 1, Background = 3; + +bool Round(const char* path, int round, int appType, bool shutdown = true) +{ + void* lib = dlopen(path, RTLD_NOW | RTLD_LOCAL); + if (!lib) { + printf("round %d: dlopen failed: %s\n", round, dlerror()); + return false; + } + auto factory = (Factory)dlsym(lib, "VRClientCoreFactory"); + int rc = -1; + auto* core = factory ? (ClientCore*)factory("IVRClientCore_003", &rc) : nullptr; + if (!core) { + printf("round %d: no IVRClientCore_003 (%d)\n", round, rc); + return false; + } + int error = core->Init(appType, nullptr); + if (error != 0) { + printf("round %d: Init answered %d\n", round, error); + return false; + } + bool ok = true; + auto* system = (System*)core->GetGenericInterface("IVRSystem_022", &error); + if (system && error == 0) { + uint32_t w = 0, h = 0; + system->GetRecommendedRenderTargetSize(&w, &h); + if (w == 0 || h == 0) { + printf("round %d: render target size %ux%u\n", round, w, h); + ok = false; + } + } else { + printf("round %d: no IVRSystem_022 (%d)\n", round, error); + ok = false; + } + if (appType == Scene) { + auto* compositor = (Compositor*)core->GetGenericInterface("IVRCompositor_027", &error); + if (compositor && error == 0) { + compositor->SetTrackingSpace(1); // standing + for (int frame = 0; frame < 3; frame++) + compositor->WaitGetPoses(nullptr, 0, nullptr, 0); + } else { + printf("round %d: no IVRCompositor_027 (%d)\n", round, error); + ok = false; + } + } + if (!shutdown) { + // The game exits without shutting OpenVR down + printf("round %d: exiting without Cleanup\n", round); + return ok; + } + core->Cleanup(); + if (dlclose(lib) != 0) { + printf("round %d: dlclose failed: %s\n", round, dlerror()); + return false; + } + void* still = dlopen(path, RTLD_NOW | RTLD_NOLOAD); + printf("round %d (%s): %s, %s on dlclose\n", round, appType == Scene ? "scene" : "background", ok ? "ok" : "failed", + still ? "stayed loaded" : "unloaded"); + if (still) + dlclose(still); + return ok; +} + +} // namespace + +int main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "usage: %s \n", argv[0]); + return 2; + } + setvbuf(stdout, nullptr, _IONBF, 0); + // A scene app twice, then a background app and a scene app again: each in a fresh load of the library + const int types[] = { Scene, Scene, Background, Scene }; + bool ok = true; + for (int i = 0; i < (int)(sizeof(types) / sizeof(types[0])); i++) + ok = Round(argv[1], i + 1, types[i]) && ok; + // Last, one more that the process exits in: exit's teardown is the test + ok = Round(argv[1], 5, Scene, false) && ok; + printf("%s\n", ok ? "all rounds worked" : "a round failed"); + return ok ? 0 : 1; +} diff --git a/tests/runtime/runtime.cpp b/tests/runtime/runtime.cpp index 4eb3cbae..3e949a79 100644 --- a/tests/runtime/runtime.cpp +++ b/tests/runtime/runtime.cpp @@ -10,8 +10,8 @@ // xrDestroyInstance xrDestroySession xrDestroySpace xrDestroySwapchain xrDestroyXDevListMNDX xrEndFrame // xrEndSession xrEnumerateApiLayerProperties xrEnumerateBoundSourcesForAction // xrEnumerateInstanceExtensionProperties xrEnumerateSwapchainFormats xrEnumerateSwapchainImages -// xrEnumerateViewConfigurationViews xrEnumerateXDevsMNDX xrGetActionStateBoolean xrGetActionStateFloat -// xrGetActionStateVector2f xrGetCurrentInteractionProfile xrGetD3D11GraphicsRequirementsKHR +// xrEnumerateViewConfigurationViews xrEnumerateViveTrackerPathsHTCX xrEnumerateXDevsMNDX xrGetActionStateBoolean +// xrGetActionStateFloat xrGetActionStateVector2f xrGetCurrentInteractionProfile xrGetD3D11GraphicsRequirementsKHR // xrGetD3D12GraphicsRequirementsKHR xrGetInstanceProcAddr xrGetOpenGLESGraphicsRequirementsKHR // xrGetOpenGLGraphicsRequirementsKHR xrGetReferenceSpaceBoundsRect xrGetSystem xrGetSystemProperties // xrGetVisibilityMaskKHR xrGetVulkanDeviceExtensionsKHR xrGetVulkanGraphicsDeviceKHR @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -280,6 +281,14 @@ XrResult XRAPI_CALL CreateInstance(const XrInstanceCreateInfo* info, XrInstance* std::lock_guard g(St().lock); if (St().instanceAlive) return XR_ERROR_LIMIT_REACHED; + if (std::chrono::steady_clock::now() < St().systemBackAt) + return XR_ERROR_RUNTIME_FAILURE; // the runtime is gone after a scripted loss +#ifdef _WIN32 + // Kept loaded once used: the loader unloads a runtime whose last instance is destroyed, and the state of a + // scripted loss must outlive the lost instance (on Linux, -z nodelete) + HMODULE self = nullptr; + GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN, (LPCSTR)&CreateInstance, &self); +#endif std::set enabled; for (uint32_t i = 0; i < info->enabledExtensionCount; i++) { std::string name = info->enabledExtensionNames[i]; @@ -289,11 +298,21 @@ XrResult XRAPI_CALL CreateInstance(const XrInstanceCreateInfo* info, XrInstance* } St().instanceAlive = true; St().requirementsQueried.clear(); + // Each instance's paths are its own, as a real runtime's: a later instance's atoms start further on, so a client + // that keeps a lost instance's paths gets wrong ones + St().pathIds.clear(); + St().paths.assign(1 + 1000 * St().instancesMade++, ""); St().enabledExtensions = enabled; { Dump& d = GetDump(); std::lock_guard dg(d.lock); - d.root = Json::Value(Json::objectValue); + // The counts of losses and sessions go on across instances + Json::Value kept(Json::objectValue); + for (const char* key : { "sessions_created", "sessions_lost", "instances_lost", "instances_created", "action_attaches" }) + if (d.root.isMember(key)) + kept[key] = d.root[key]; + d.root = kept; + d.root["instances_created"] = d.root["instances_created"].asUInt64() + 1; d.root["instance"]["extensions"] = Json::Value(Json::arrayValue); for (const std::string& e : enabled) d.root["instance"]["extensions"].append(e); @@ -302,6 +321,7 @@ XrResult XRAPI_CALL CreateInstance(const XrInstanceCreateInfo* info, XrInstance* d.root["layers"] = Json::Value(Json::arrayValue); d.root["frame_order_errors"] = 0; d.root["refresh_rate_requests"] = 0; + d.root["bounds_rect_calls"] = 0; } *instance = kInstance; return XR_SUCCESS; @@ -315,6 +335,7 @@ XrResult XRAPI_CALL DestroyInstance(XrInstance) St().session.reset(); St().events.clear(); St().instanceAlive = false; + St().instanceLost = false; Dump& d = GetDump(); std::lock_guard dg(d.lock); RtActionsDump(d.root); @@ -334,6 +355,8 @@ XrResult XRAPI_CALL GetInstanceProperties(XrInstance, XrInstanceProperties* prop XrResult XRAPI_CALL PollEvent(XrInstance, XrEventDataBuffer* out) { std::lock_guard g(St().lock); + if (St().instanceLost) + return XR_ERROR_INSTANCE_LOST; if (St().events.empty()) return XR_EVENT_UNAVAILABLE; *out = St().events.front(); @@ -382,7 +405,7 @@ XrResult XRAPI_CALL StringToPath(XrInstance, const char* str, XrPath* path) XrResult XRAPI_CALL PathToString(XrInstance, XrPath path, uint32_t capacity, uint32_t* count, char* buffer) { std::lock_guard g(St().lock); - if (path == XR_NULL_PATH || path >= St().paths.size()) + if (path == XR_NULL_PATH || path >= St().paths.size() || St().paths[(size_t)path].empty()) return XR_ERROR_PATH_INVALID; const std::string& s = St().paths[(size_t)path]; *count = (uint32_t)s.size() + 1; @@ -401,6 +424,13 @@ XrResult XRAPI_CALL GetSystem(XrInstance, const XrSystemGetInfo* info, XrSystemI FAIL_POINT("xrGetSystem"); if (info->formFactor != XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY) return XR_ERROR_FORM_FACTOR_UNSUPPORTED; + { + std::lock_guard g(St().lock); + if (St().instanceLost) + return XR_ERROR_INSTANCE_LOST; + if (std::chrono::steady_clock::now() < St().systemBackAt) + return XR_ERROR_FORM_FACTOR_UNAVAILABLE; // gone after a scripted loss + } *system = kSystem; return XR_SUCCESS; } @@ -453,7 +483,7 @@ XrResult XRAPI_CALL EnumerateViewConfigurationViews(XrInstance, XrSystemId, XrVi views[i].maxImageRectWidth = 8192; views[i].maxImageRectHeight = 8192; views[i].recommendedSwapchainSampleCount = 1; - views[i].maxSwapchainSampleCount = 4; + views[i].maxSwapchainSampleCount = GetScript().maxSwapchainSamples; } return XR_SUCCESS; } @@ -464,6 +494,8 @@ XrResult XRAPI_CALL CreateSession(XrInstance, const XrSessionCreateInfo* info, X { FAIL_POINT("xrCreateSession"); std::lock_guard g(St().lock); + if (St().instanceLost) + return XR_ERROR_INSTANCE_LOST; if (St().session) return XR_ERROR_LIMIT_REACHED; auto session = std::make_unique(); @@ -502,6 +534,11 @@ XrResult XRAPI_CALL CreateSession(XrInstance, const XrSessionCreateInfo* info, X d.root["session"]["binding"] = binding; d.root["session"]["overlay"] = session->overlay; } + if (Dump::Enabled()) { + Dump& d = GetDump(); + std::lock_guard dg(d.lock); + d.root["sessions_created"] = d.root["sessions_created"].asUInt64() + 1; + } RtSession* raw = session.get(); St().session = std::move(session); QueueState(raw, XR_SESSION_STATE_IDLE); @@ -528,6 +565,10 @@ XrResult XRAPI_CALL BeginSession(XrSession, const XrSessionBeginInfo* info) RtSession* s = St().session.get(); if (!s) return XR_ERROR_HANDLE_INVALID; + if (St().instanceLost) + return XR_ERROR_INSTANCE_LOST; + if (s->lost) + return XR_ERROR_SESSION_LOST; if (s->running) return XR_ERROR_SESSION_RUNNING; if (info->primaryViewConfigurationType != XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO) @@ -542,6 +583,10 @@ XrResult XRAPI_CALL EndSession(XrSession) RtSession* s = St().session.get(); if (!s) return XR_ERROR_HANDLE_INVALID; + if (St().instanceLost) + return XR_ERROR_INSTANCE_LOST; + if (s->lost) + return XR_ERROR_SESSION_LOST; if (!s->running) return XR_ERROR_SESSION_NOT_RUNNING; if (s->state != XR_SESSION_STATE_STOPPING) @@ -557,6 +602,8 @@ XrResult XRAPI_CALL RequestExitSession(XrSession) { std::lock_guard g(St().lock); RtSession* s = St().session.get(); + if (s && s->lost) + return XR_ERROR_SESSION_LOST; if (!s || !s->running) return XR_ERROR_SESSION_NOT_RUNNING; s->exitRequested = true; @@ -636,6 +683,11 @@ XrResult XRAPI_CALL LocateSpace(XrSpace space, XrSpace base, XrTime time, XrSpac XrResult XRAPI_CALL GetReferenceSpaceBoundsRect(XrSession, XrReferenceSpaceType type, XrExtent2Df* bounds) { + { + Dump& d = GetDump(); + std::lock_guard dg(d.lock); + d.root["bounds_rect_calls"] = d.root["bounds_rect_calls"].asInt() + 1; + } if (type != XR_REFERENCE_SPACE_TYPE_STAGE) { *bounds = { 0, 0 }; return XR_SPACE_BOUNDS_UNAVAILABLE; @@ -814,6 +866,10 @@ XrResult XRAPI_CALL WaitFrame(XrSession, const XrFrameWaitInfo*, XrFrameState* f RtSession* s = St().session.get(); if (!s) return XR_ERROR_HANDLE_INVALID; + if (St().instanceLost) + return XR_ERROR_INSTANCE_LOST; + if (s->lost) + return XR_ERROR_SESSION_LOST; if (!s->running) return XR_ERROR_SESSION_NOT_RUNNING; // A second wait before the first one's frame began @@ -826,7 +882,41 @@ XrResult XRAPI_CALL WaitFrame(XrSession, const XrFrameWaitInfo*, XrFrameState* f QueueState(s, XR_SESSION_STATE_VISIBLE); else if (s->framesWaited == 3) QueueState(s, XR_SESSION_STATE_FOCUSED); - for (const ScriptEvent& ev : GetScript().events) { + for (size_t i = 0; i < GetScript().events.size(); i++) { + const ScriptEvent& ev = GetScript().events[i]; + const bool loss = ev.type == "session_state" && ev.state == "LOSS_PENDING"; + // A loss is sent once: the session made after it runs on + if (loss && ev.frame == s->framesWaited && St().lossesSent.insert(i).second) { + QueueState(s, XR_SESSION_STATE_LOSS_PENDING); + s->lost = true; + St().systemBackAt = std::chrono::steady_clock::now() + std::chrono::milliseconds(GetScript().lossUnavailableMs); + if (Dump::Enabled()) { + Dump& d = GetDump(); + std::lock_guard dg(d.lock); + d.root["sessions_lost"] = d.root["sessions_lost"].asUInt64() + 1; + } + continue; + } + if (loss) + continue; + if (ev.type == "instance_lost") { + if (ev.frame == s->framesWaited && St().lossesSent.insert(i).second) { + St().instanceLost = true; + St().systemBackAt = std::chrono::steady_clock::now() + std::chrono::milliseconds(GetScript().lossUnavailableMs); + if (Dump::Enabled()) { + Dump& d = GetDump(); + std::lock_guard dg(d.lock); + d.root["instances_lost"] = d.root["instances_lost"].asUInt64() + 1; + } + } + continue; + } + // EXITING is the user quitting from the runtime: STOPPING first, EXITING once the session has ended + if (ev.frame == s->framesWaited && ev.type == "session_state" && ev.state == "EXITING" && s->running) { + s->exitRequested = true; + QueueState(s, XR_SESSION_STATE_STOPPING); + continue; + } if (ev.frame == s->framesWaited && ev.type == "session_state") QueueState(s, StateFromName(ev.state)); if (ev.frame == s->framesWaited && ev.type == "refresh_rate" && ev.rate > 0) @@ -848,6 +938,10 @@ XrResult XRAPI_CALL BeginFrame(XrSession, const XrFrameBeginInfo*) RtSession* s = St().session.get(); if (!s) return XR_ERROR_HANDLE_INVALID; + if (St().instanceLost) + return XR_ERROR_INSTANCE_LOST; + if (s->lost) + return XR_ERROR_SESSION_LOST; if (!s->running) return XR_ERROR_SESSION_NOT_RUNNING; // As Monado answers a headless session: it has no frames to begin @@ -946,7 +1040,7 @@ void RecordPlacement(Json::Value& entry, XrSpace space, const XrQuaternionf* q, // rect, array_index, format, image (the swapchain's width and height) and (when sample) samples of a sub-image, with the spec's checks of it; prefix names // the image in the checks ("depth " for a depth sub-image) void RecordSubImage(RtSession* s, Json::Value& entry, const XrSwapchainSubImage& sub, bool sample, - std::vector& invalid, const std::string& prefix = "") + std::vector& invalid, const std::string& prefix = "", bool grid = false) { const XrRect2Di& r = sub.imageRect; entry["rect"] = Json::Value(Json::arrayValue); @@ -982,9 +1076,25 @@ void RecordSubImage(RtSession* s, Json::Value& entry, const XrSwapchainSubImage& SwapchainImage image{ s, sc, (uint32_t)sc->lastReleased }; Samples samples; std::string why; - if (ProbeSamples(image, r, sub.imageArrayIndex, samples, &why)) + // grid: 8 x 4 more samples, at the cells' centres, rows from the top + std::vector> points; + if (grid) { + for (int row = 0; row < 4; row++) + for (int col = 0; col < 8; col++) + points.push_back({ (col + 0.5f) / 8, (row + 0.5f) / 4 }); + } + std::vector cells; + if (ProbeSamples(image, r, sub.imageArrayIndex, samples, &why, grid ? &points : nullptr, &cells)) { entry["samples"] = SamplesJson(samples); - else + if (grid) { + entry["grid"] = Json::Value(Json::arrayValue); + for (uint32_t cell : cells) { + char hex[9]; + std::snprintf(hex, sizeof(hex), "%08x", cell); + entry["grid"].append(hex); + } + } + } else entry["samples_error"] = why; // a frame that should have pixels says why it hasn't } @@ -1111,7 +1221,7 @@ Json::Value RecordLayer(RtSession* s, const XrCompositionLayerBaseHeader* layer, || eq->lowerVerticalAngle > eq->upperVerticalAngle) Invalid(invalid, "vertical angles out of range"); NeedExtension("XR_KHR_composition_layer_equirect2", "equirect2", invalid); - RecordSubImage(s, entry, eq->subImage, sample, invalid); + RecordSubImage(s, entry, eq->subImage, sample, invalid, "", true); break; } case XR_TYPE_COMPOSITION_LAYER_CUBE_KHR: { @@ -1187,6 +1297,10 @@ XrResult XRAPI_CALL EndFrame(XrSession, const XrFrameEndInfo* info) RtSession* s = St().session.get(); if (!s) return XR_ERROR_HANDLE_INVALID; + if (St().instanceLost) + return XR_ERROR_INSTANCE_LOST; + if (s->lost) + return XR_ERROR_SESSION_LOST; if (s->headless || !s->frameOpen) { CountFrameOrderError(); // an end without a begin return XR_ERROR_CALL_ORDER_INVALID; diff --git a/tests/runtime/runtime_internal.h b/tests/runtime/runtime_internal.h index 5614e16e..96172166 100644 --- a/tests/runtime/runtime_internal.h +++ b/tests/runtime/runtime_internal.h @@ -64,6 +64,7 @@ #include "script.h" +#include #include #include #include @@ -182,6 +183,7 @@ struct RtSession { bool overlay = false; bool running = false; bool exitRequested = false; // xrRequestExitSession: xrEndSession then goes on to EXITING, as the spec says + bool lost = false; // a scripted LOSS_PENDING: its calls answer XR_ERROR_SESSION_LOST XrSessionState state = XR_SESSION_STATE_UNKNOWN; uint64_t framesWaited = 0; uint64_t framesBegun = 0; @@ -214,6 +216,11 @@ struct RtState { std::vector paths{ "" }; XrTime time = 1000000000; bool presenceSent = false; + // A scripted loss: the system is gone (xrGetSystem fails) until then; the loss events already sent (by index) + std::chrono::steady_clock::time_point systemBackAt{}; + bool instanceLost = false; // a scripted instance loss, until xrDestroyInstance + uint32_t instancesMade = 0; + std::set lossesSent; }; RtState& St(); diff --git a/tests/runtime/script.cpp b/tests/runtime/script.cpp index 2150dc67..c5c86f94 100644 --- a/tests/runtime/script.cpp +++ b/tests/runtime/script.cpp @@ -51,6 +51,8 @@ static Script LoadScript() s.viewWidth = root["view_size"][0].asUInt(); s.viewHeight = root["view_size"][1].asUInt(); } + if (root.isMember("max_swapchain_samples")) + s.maxSwapchainSamples = root["max_swapchain_samples"].asUInt(); if (root.isMember("fov_deg")) s.fovDeg = root["fov_deg"].asFloat(); if (root.isMember("ipd")) @@ -91,6 +93,13 @@ static Script LoadScript() in2.value = i["value"].asFloat(); s.inputs.push_back(in2); } + for (const Json::Value& t : root["vive_trackers"]) { + ScriptViveTracker tracker; + tracker.frame = t["frame"].asUInt64(); + tracker.persistent = t["persistent"].asString(); + tracker.role = t["role"].asString(); + s.viveTrackers.push_back(tracker); + } for (const Json::Value& p : root["presence"]) { ScriptPresence pr; pr.frame = p["frame"].asUInt64(); @@ -139,6 +148,7 @@ static Script LoadScript() add(v); } } + s.lossUnavailableMs = root["loss_unavailable_ms"].asUInt(); for (const Json::Value& r : root["refresh_rates"]) s.refreshRates.push_back(r.asFloat()); auto addIpd = [&](const Json::Value& e) { diff --git a/tests/runtime/script.h b/tests/runtime/script.h index 1a50ec32..d7d69e1d 100644 --- a/tests/runtime/script.h +++ b/tests/runtime/script.h @@ -6,7 +6,14 @@ // (on Linux the D3D extensions are left out, a script left with no graphics API gets the default one, // and XR_KHR_win32_convert_performance_counter_time is XR_KHR_convert_timespec_time), // "ipd": 0.063, "display_hz": 90, "stage_bounds": [width, depth], +// "max_swapchain_samples": 4 (the views' maxSwapchainSampleCount), // "events": [{ "frame": 60, "type": "session_state", "state": "LOSS_PENDING" }] +// (LOSS_PENDING loses the session for real, once per process: its calls answer XR_ERROR_SESSION_LOST +// from then on, and xrGetSystem answers XR_ERROR_FORM_FACTOR_UNAVAILABLE for loss_unavailable_ms; +// EXITING on a running session is the user quitting: STOPPING, then EXITING after xrEndSession; +// { "frame": 60, "type": "instance_lost" } loses the instance, once per process, as a dead monado-service +// does: xrPollEvent and the frame, session and system calls answer XR_ERROR_INSTANCE_LOST until +// xrDestroyInstance, and xrCreateInstance fails for loss_unavailable_ms), // (or { "frame": 10, "type": "refresh_rate", "rate": 120 }: the display changes to that rate, announced // with XrEventDataDisplayRefreshRateChangedFB), // "fail": [{ "function": "xrEndFrame", "result": "XR_ERROR_RUNTIME_FAILURE", "after": 29, "count": 1 }] @@ -31,7 +38,11 @@ // the velocities are given as they are, always valid: not corrected for poseInActionSpace, nor for the // base space's own motion; "/user/head" places the HMD, at (0, 1.7, 0) without it), // "refresh_rates": [90] (XR_FB_display_refresh_rate's rates; without it, display_hz alone), -// "ipd_change": { "frame": 30, "ipd": 0.07 } (or a list: the IPD from that frame on) +// "ipd_change": { "frame": 30, "ipd": 0.07 } (or a list: the IPD from that frame on), +// "vive_trackers": [{ "persistent": "/devices/htc/vive_trackerLHR-1", "role": "/user/vive_tracker_htcx/role/waist", +// "frame": 0 }] (XR_HTCX_vive_tracker_interaction's trackers, listed from their frame on and announced +// with XrEventDataViveTrackerConnectedHTCX at it (from frame 1); an empty role is a tracker without one; +// a tracker's pose is the script's pose of /input/grip/pose) // // The dump (only when OC_TEST_RUNTIME_DUMP is set: without it nothing is recorded or read back) keeps whole layer // records for frames 1-64, every 32nd frame after, and the last frame ended, at most kDumpLayerCap records; the @@ -90,6 +101,11 @@ struct ScriptPose { XrVector3f angular{ 0, 0, 0 }; }; +struct ScriptViveTracker { + uint64_t frame = 0; + std::string persistent, role; +}; + struct ScriptIpd { uint64_t frame = 0; float ipd = 0.063f; @@ -104,6 +120,7 @@ struct Script { std::set extensions = { "XR_KHR_vulkan_enable" }; #endif uint32_t viewWidth = 1920, viewHeight = 1920; + uint32_t maxSwapchainSamples = 4; float fovDeg = 45; float ipd = 0.063f; float cantDeg = 0; @@ -122,6 +139,8 @@ struct Script { std::map> poses; std::vector refreshRates; // empty: displayHz alone std::vector ipdChanges; + std::vector viveTrackers; + uint32_t lossUnavailableMs = 0; // how long the system is gone after a scripted LOSS_PENDING }; // The scripted pose of a path at a frame (the last entry whose from_frame has been reached), nullptr if none diff --git a/tests/unit/ApplicationsTests.cpp b/tests/unit/ApplicationsTests.cpp index 6eafcab8..52ec3f05 100644 --- a/tests/unit/ApplicationsTests.cpp +++ b/tests/unit/ApplicationsTests.cpp @@ -358,6 +358,28 @@ TEST_CASE("Launch_unknown_key_errors") CHECK(apps.PerformApplicationPrelaunchCheck("oc.test.overlay") == VRApplicationError_None); } +#ifndef _WIN32 +// A Windows program can't be started on Linux: refused before it's tried, though the file is there and would run +TEST_CASE("Windows_binary_refused_on_Linux") +{ + TempDir dir; + SharedStore store(dir.path / "store"); + BaseApplications apps(store); + fs::path exe = dir.path / "Game.EXE"; + fs::path marker = dir.path / "started"; + std::ofstream(exe) << "#!/bin/sh\ntouch \"$1\"\n"; + fs::permissions(exe, fs::perms::owner_all); + std::ofstream(dir.path / "game.vrmanifest") << "{ \"applications\" : [ { \"app_key\" : \"oc.test.windows\", " + "\"binary_path\" : \"Game.EXE\", \"arguments\" : \"" + << PathToUtf8(marker) << "\" } ] }"; + REQUIRE(apps.AddApplicationManifest(PathToUtf8(dir.path / "game.vrmanifest").c_str(), true) == VRApplicationError_None); + CHECK(apps.LaunchApplication("oc.test.windows") == VRApplicationError_LaunchFailed); + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + CHECK_FALSE(fs::exists(marker)); + CHECK(apps.GetApplicationProcessId("oc.test.windows") == 0); +} +#endif + TEST_CASE("Command_line_split_as_CommandLineToArgvW") { using V = std::vector; @@ -1229,3 +1251,165 @@ TEST_CASE("A_quit_request_that_cannot_be_sent_is_undone") CHECK(apps.GetTransitionState() == VRApplicationTransition_None); BaseApplications::SetSceneProcess(store, false); } + +TEST_CASE("Overlay_command_crosses_between_programs") +{ + OcOverlayCommand flag; + flag.pid = 4321; + flag.handle = 0x1234567890ull; + flag.kind = OcOverlayCommand::Flag; + flag.flag = 15; + flag.enabled = true; + std::optional> packed = OcPackOverlayCommand(flag); + REQUIRE(packed); + uint64_t raw[4] = { (*packed)[0], (*packed)[1], (*packed)[2], (*packed)[3] }; + OcOverlayCommand back = OcUnpackOverlayCommand(raw); + CHECK(back.pid == 4321); + CHECK(back.handle == 0x1234567890ull); + CHECK(back.kind == OcOverlayCommand::Flag); + CHECK(back.flag == 15); + CHECK(back.enabled); + + OcOverlayCommand alpha; + alpha.kind = OcOverlayCommand::Alpha; + alpha.number = 0.25f; + packed = OcPackOverlayCommand(alpha); + REQUIRE(packed); + uint64_t rawAlpha[4] = { (*packed)[0], (*packed)[1], (*packed)[2], (*packed)[3] }; + CHECK(OcUnpackOverlayCommand(rawAlpha).number == 0.25f); + + // An event's type and the first 16 bytes of its data + OcOverlayCommand event; + event.kind = OcOverlayCommand::Event; + event.eventType = vr::VREvent_MouseButtonDown; + vr::VREvent_Data_t data{}; + data.mouse.x = 12.5f; + data.mouse.y = 7.0f; + data.mouse.button = vr::VRMouseButton_Left; + memcpy(event.data, &data, sizeof(event.data)); + packed = OcPackOverlayCommand(event); + REQUIRE(packed); + uint64_t rawEvent[4] = { (*packed)[0], (*packed)[1], (*packed)[2], (*packed)[3] }; + back = OcUnpackOverlayCommand(rawEvent); + CHECK(back.eventType == vr::VREvent_MouseButtonDown); + vr::VREvent_Data_t got{}; + memcpy(&got, back.data, sizeof(back.data)); + CHECK(got.mouse.x == 12.5f); + CHECK(got.mouse.y == 7.0f); + CHECK(got.mouse.button == vr::VRMouseButton_Left); + + // A type too big to cross isn't packed + event.eventType = 1u << 24; + CHECK_FALSE(OcPackOverlayCommand(event)); +} +#ifndef _WIN32 +namespace { +// A child process that sleeps until it's ended, and its start time once it's running +pid_t SleepingChild(uint64_t& start) +{ + const pid_t child = fork(); + if (child == 0) { + for (;;) + pause(); + } + start = 0; + for (int i = 0; i < 200 && !start; i++) { + start = SharedStore::ProcessStartTime((uint32_t)child); + if (!start) + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } + return child; +} + +bool EndedByKill(pid_t child) +{ + int status = 0; + for (int i = 0; i < 400; i++) { + if (waitpid(child, &status, WNOHANG) == child) + return WIFSIGNALED(status) && WTERMSIG(status) == SIGKILL; + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + } + kill(child, SIGKILL); + waitpid(child, &status, 0); + return false; +} +} // namespace + +TEST_CASE("Kill_ends_only_the_process_that_started_then") +{ + uint64_t start = 0; + const pid_t child = SleepingChild(start); + REQUIRE(start != 0); + // Another start time: a process that took the pid over, not ended + CHECK_FALSE(SharedStore::KillProcess((uint32_t)child, start + 1)); + CHECK_FALSE(SharedStore::KillProcess((uint32_t)child, 0)); + CHECK(SharedStore::IsSameProcessAlive((uint32_t)child, start)); + CHECK(SharedStore::KillProcess((uint32_t)child, start)); + CHECK(EndedByKill(child)); +} + +TEST_CASE("Old_scene_application_ignoring_the_quit_is_ended_after_a_while") +{ + TempDir dir; + SharedStore store(dir.path); + BaseApplications apps(store); + uint64_t start = 0; + const pid_t child = SleepingChild(start); + REQUIRE(start != 0); + // Asked to quit for a launch just now: left running + store.Update(StoreDoc::Scene, [&](Json::Value& doc) { + doc["pid"] = (uint32_t)child; + doc["start"] = (Json::UInt64)start; + doc["transition"]["state"] = VRApplicationTransition_OldAppQuitSent; + doc["transition"]["app_key"] = "oc.test.next"; + doc["transition"]["old_pid"] = (uint32_t)child; + doc["transition"]["old_start"] = (Json::UInt64)start; + doc["transition"]["launch"] = true; + doc["transition"]["since_ms"] = NowMs(); + }); + CHECK(apps.GetTransitionState() == VRApplicationTransition_OldAppQuitSent); + CHECK(SharedStore::IsSameProcessAlive((uint32_t)child, start)); + // Asked over ten seconds ago and still running: ended + store.Update(StoreDoc::Scene, [&](Json::Value& doc) { doc["transition"]["since_ms"] = NowMs() - 11000; }); + apps.GetTransitionState(); + CHECK(EndedByKill(child)); +} + +TEST_CASE("Only_programs_the_store_knows_are_known_processes") +{ + TempDir dir; + SharedStore store(dir.path); + uint64_t start = 0; + const pid_t child = SleepingChild(start); + REQUIRE(start != 0); + const std::string name = std::to_string(child); + // Not in the store + CHECK(store.KnownProcessStart((uint32_t)child) == 0); + // Listed with another start time: a process that took the pid over + store.Update(StoreDoc::Applications, [&](Json::Value& doc) { + doc["pids"][name] = "oc.test.echo"; + doc["pid_starts"][name] = (Json::UInt64)(start + 1); + }); + CHECK(store.KnownProcessStart((uint32_t)child) == 0); + // Listed without one: not known well enough to end + store.Update(StoreDoc::Applications, [&](Json::Value& doc) { doc["pid_starts"].removeMember(name); }); + CHECK(store.KnownProcessStart((uint32_t)child) == 0); + // The application's, the scene's or an overlay program's start time + store.Update(StoreDoc::Applications, [&](Json::Value& doc) { doc["pid_starts"][name] = (Json::UInt64)start; }); + CHECK(store.KnownProcessStart((uint32_t)child) == start); + store.Update(StoreDoc::Applications, [&](Json::Value& doc) { doc = Json::Value(Json::objectValue); }); + store.Update(StoreDoc::Scene, [&](Json::Value& doc) { + doc["pid"] = (uint32_t)child; + doc["start"] = (Json::UInt64)start; + }); + CHECK(store.KnownProcessStart((uint32_t)child) == start); + store.Update(StoreDoc::Scene, [&](Json::Value& doc) { doc = Json::Value(Json::objectValue); }); + store.Update(StoreDoc::Overlays, [&](Json::Value& doc) { doc[name]["start"] = (Json::UInt64)start; }); + CHECK(store.KnownProcessStart((uint32_t)child) == start); + kill(child, SIGKILL); + int status = 0; + waitpid(child, &status, 0); + // Gone: not known any more + CHECK(store.KnownProcessStart((uint32_t)child) == 0); +} +#endif diff --git a/tests/unit/BaseCompositorTests.cpp b/tests/unit/BaseCompositorTests.cpp index 657574b5..d301bcdc 100644 --- a/tests/unit/BaseCompositorTests.cpp +++ b/tests/unit/BaseCompositorTests.cpp @@ -98,13 +98,12 @@ TEST_CASE("A_frame_with_one_eye_shows_it_in_both") CHECK(source[1] == -1); } -TEST_CASE("Submit_ends_the_frame_unless_the_game_ends_it_with_PostPresentHandoff") +TEST_CASE("Submit_ends_the_frame_unless_the_timing_mode_says_PostPresentHandoff_does") { - CHECK(BaseCompositor::SubmitEndsFrame(VRCompositorTimingMode_Implicit, false)); - CHECK(BaseCompositor::SubmitEndsFrame(VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff, false)); - CHECK_FALSE(BaseCompositor::SubmitEndsFrame(VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff, false)); - // A game that calls it ends its frames there in any mode - CHECK_FALSE(BaseCompositor::SubmitEndsFrame(VRCompositorTimingMode_Implicit, true)); + // By the mode the game set alone, whether or not it has called PostPresentHandoff before + CHECK(BaseCompositor::SubmitEndsFrame(VRCompositorTimingMode_Implicit)); + CHECK(BaseCompositor::SubmitEndsFrame(VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff)); + CHECK_FALSE(BaseCompositor::SubmitEndsFrame(VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff)); } TEST_CASE("Submitted_bounds_with_a_NaN_are_not_bounds") @@ -171,6 +170,17 @@ TEST_CASE("A_Vulkan_loader_older_than_the_runtime_needs_is_refused") CHECK_FALSE(VulkanVersionMeetsXr(VK_MAKE_VERSION(1, 0, 65), XR_MAKE_VERSION(1, 1, 0))); CHECK(VulkanVersionMeetsXr(VK_MAKE_VERSION(2, 0, 0), XR_MAKE_VERSION(1, 3, 0))); } + +TEST_CASE("The_temporary_Vulkan_instance_is_1_1_where_the_loader_and_runtime_have_it") +{ + CHECK(TemporaryVkApiVersion(VK_API_VERSION_1_3, XR_MAKE_VERSION(1, 0, 0), XR_MAKE_VERSION(1, 3, 0)) == VK_API_VERSION_1_1); + // Not past a loader or a runtime that stops at 1.0 + CHECK(TemporaryVkApiVersion(VK_API_VERSION_1_0, XR_MAKE_VERSION(1, 0, 0), XR_MAKE_VERSION(1, 3, 0)) == VK_API_VERSION_1_0); + CHECK(TemporaryVkApiVersion(VK_API_VERSION_1_3, XR_MAKE_VERSION(1, 0, 0), XR_MAKE_VERSION(1, 0, 0)) == VK_API_VERSION_1_0); + CHECK(TemporaryVkApiVersion(VK_API_VERSION_1_3, XR_MAKE_VERSION(1, 0, 0), 0) == VK_API_VERSION_1_0); + // The runtime's lowest stays when it's higher + CHECK(TemporaryVkApiVersion(VK_API_VERSION_1_3, XR_MAKE_VERSION(1, 2, 0), XR_MAKE_VERSION(1, 3, 0)) == VK_API_VERSION_1_2); +} #endif TEST_CASE("The_interop_extension_list_fills_the_buffer_it_fits_in") @@ -353,3 +363,14 @@ TEST_CASE("The scene overlay is the part of its image the settings pick, ahead o REQUIRE(BaseCompositor::SceneOverlayFrom(image, settings, out)); CHECK(out.inHead.m[0][0] == doctest::Approx(1.0f)); } + +TEST_CASE("Extensions_among_available") +{ + const std::vector available = { "VK_KHR_external_memory", "VK_KHR_external_semaphore", "VK_KHR_swapchain" }; + CHECK(BaseCompositor::ExtensionsAmong("VK_KHR_external_memory VK_KHR_external_memory_fd VK_KHR_swapchain", available) + == "VK_KHR_external_memory VK_KHR_swapchain"); + CHECK(BaseCompositor::ExtensionsAmong("", available).empty()); + CHECK(BaseCompositor::ExtensionsAmong("VK_KHR_external_memory_fd", available).empty()); + // Doubled spaces don't make empty names + CHECK(BaseCompositor::ExtensionsAmong("VK_KHR_swapchain VK_KHR_external_semaphore", available) == "VK_KHR_swapchain VK_KHR_external_semaphore"); +} diff --git a/tests/unit/BindingInfoTests.cpp b/tests/unit/BindingInfoTests.cpp index 8e13f5dc..9290ff82 100644 --- a/tests/unit/BindingInfoTests.cpp +++ b/tests/unit/BindingInfoTests.cpp @@ -151,3 +151,37 @@ TEST_CASE("A_pose_is_bound_on_the_hands_the_file_names") CHECK(skeleton[0] == "/user/hand/left"); CHECK(PoseDevicesForAction(file, "/actions/main/in/none").empty()); } + +TEST_CASE("A_force_sensor_bound_by_its_click_binds_nothing") +{ + BindingFile index = ParseBindingFile(R"({ "controller_type": "knuckles", "bindings": { "/actions/main": { "sources": [ + { "path": "/user/hand/left/input/grip", "mode": "force_sensor", "inputs": { "click": { "output": "/actions/main/in/grab" } } }, + { "path": "/user/hand/right/input/grip", "mode": "force_sensor", "inputs": { "force": { "output": "/actions/main/in/squeeze" } } } ] } } })"); + CHECK(BindingsForAction(index, "/actions/main/in/grab").empty()); + REQUIRE(BindingsForAction(index, "/actions/main/in/squeeze").size() == 1); + CHECK(BindingsForAction(index, "/actions/main/in/squeeze")[0].slot == "force"); +} + +TEST_CASE("Poses_skeletons_and_vibrations_are_told") +{ + BindingFile index = ParseBindingFile(R"({ "controller_type": "knuckles", "bindings": { "/actions/main": { + "poses": [ { "output": "/actions/main/in/pose", "path": "/user/hand/left/pose/raw" }, + { "output": "/actions/main/in/pose", "path": "/user/hand/right/pose/raw" } ], + "skeleton": [ { "output": "/actions/main/in/skeleton_left", "path": "/user/hand/left/input/skeleton/left" } ], + "haptics": [ { "output": "/actions/main/out/haptic", "path": "/user/hand/right/output/haptic" } ] } } })"); + std::vector pose = BindingsForAction(index, "/actions/main/in/pose"); + REQUIRE(pose.size() == 2); + CHECK(pose[0].device == "/user/hand/left"); + CHECK(pose[0].input == "/pose/raw"); + CHECK(pose[0].mode.empty()); + CHECK(BindingsForAction(index, "/actions/main/in/pose", "/user/hand/right").size() == 1); + std::vector skeleton = BindingsForAction(index, "/actions/main/in/skeleton_left"); + REQUIRE(skeleton.size() == 1); + CHECK(skeleton[0].input == "/input/skeleton/left"); + // A vibration has no device or input path + std::vector haptic = BindingsForAction(index, "/actions/main/out/haptic"); + REQUIRE(haptic.size() == 1); + CHECK(haptic[0].device.empty()); + CHECK(haptic[0].input.empty()); + CHECK(BindingsForAction(index, "/actions/main/out/haptic", "/user/hand/left").empty()); +} diff --git a/tests/unit/DashboardTests.cpp b/tests/unit/DashboardTests.cpp index a0fb18b4..39bd5c8e 100644 --- a/tests/unit/DashboardTests.cpp +++ b/tests/unit/DashboardTests.cpp @@ -83,13 +83,11 @@ TEST_CASE("Press_toggles_on_release_and_hold_recentres") CHECK(d.OnInput(false, false, 1.2) == none); CHECK(!d.Open()); - // A hold: a recentre from that hand once it has been held long enough, once, and no dashboard when it's let go + // A hold: a recentre from that hand when it's let go after being held long enough, and no dashboard CHECK(d.OnInput(false, true, 2.0) == none); - CHECK(d.OnInput(false, true, 2.0 + Dashboard::kRecentreHold - 0.01) == none); - CHECK(d.OnInput(false, true, 2.0 + Dashboard::kRecentreHold) == 1); - CHECK(d.OnInput(false, true, 4.0) == none); - CHECK(d.OnInput(false, true, 6.0) == none); - CHECK(d.OnInput(false, false, 6.1) == none); + CHECK(d.OnInput(false, true, 2.0 + Dashboard::kRecentreHold) == none); + CHECK(d.OnInput(false, true, 3.5) == none); + CHECK(d.OnInput(false, false, 3.6) == 1); CHECK(!d.Open()); // The next press is a press again d.OnInput(true, false, 7.0); @@ -98,8 +96,29 @@ TEST_CASE("Press_toggles_on_release_and_hold_recentres") // A hold while it's open recentres and leaves it open CHECK(d.OnInput(true, false, 8.0) == none); - CHECK(d.OnInput(true, false, 9.5) == 0); - CHECK(d.OnInput(false, false, 9.6) == none); + CHECK(d.OnInput(true, false, 9.5) == none); + CHECK(d.OnInput(false, false, 9.6) == 0); + CHECK(d.Open()); +} + +TEST_CASE("Hold_to_turn_the_controller_off_doesnt_recentre") +{ + const int none = Dashboard::kNoHand; + Dashboard d(Dashboard::Button::PressOrHold); + // Held past kPowerOffHold: neither a recentre nor the dashboard, held or let go + CHECK(d.OnInput(false, true, 0.0) == none); + CHECK(d.OnInput(false, true, 1.5) == none); + CHECK(d.OnInput(false, true, Dashboard::kPowerOffHold) == none); + CHECK(d.OnInput(false, true, 5.0) == none); + CHECK(d.OnInput(false, false, 5.1) == none); + CHECK(!d.Open()); + // The controller gone while held (no button down from it): the same + CHECK(d.OnInput(true, false, 6.0) == none); + CHECK(d.OnInput(false, false, 6.0 + Dashboard::kPowerOffHold + 0.5) == none); + CHECK(!d.Open()); + // The next press is a press again + d.OnInput(true, false, 10.0); + d.OnInput(false, false, 10.1); CHECK(d.Open()); } @@ -110,11 +129,14 @@ TEST_CASE("Hold_with_both_hands") // Both buttons down are one press, from the hand that began it CHECK(d.OnInput(true, false, 0.0) == none); CHECK(d.OnInput(true, true, 0.5) == none); - CHECK(d.OnInput(true, true, 1.0) == 0); - // One let go, the other still down: the same press, already used - CHECK(d.OnInput(false, true, 1.2) == none); - CHECK(d.OnInput(false, true, 3.0) == none); - CHECK(d.OnInput(false, false, 3.1) == none); + CHECK(d.OnInput(true, true, 1.2) == none); + CHECK(d.OnInput(false, false, 1.5) == 0); + CHECK(!d.Open()); + // One let go, the other still down: the same press, the other hand's when it's let go + CHECK(d.OnInput(true, true, 2.0) == none); + CHECK(d.OnInput(false, true, 2.5) == none); + CHECK(d.OnInput(false, true, 3.2) == none); + CHECK(d.OnInput(false, false, 3.3) == 1); CHECK(!d.Open()); // Begun on the left, which is let go while the right holds on: the right hand's, timed from the start @@ -122,8 +144,8 @@ TEST_CASE("Hold_with_both_hands") CHECK(d.OnInput(true, true, 4.3) == none); CHECK(d.OnInput(false, true, 4.6) == none); CHECK(!d.Open()); - CHECK(d.OnInput(false, true, 5.0) == 1); - CHECK(d.OnInput(false, false, 5.1) == none); + CHECK(d.OnInput(false, true, 5.0) == none); + CHECK(d.OnInput(false, false, 5.1) == 1); CHECK(!d.Open()); // Both pressed and let go shortly: one press diff --git a/tests/unit/DeviceIdentityTests.cpp b/tests/unit/DeviceIdentityTests.cpp index 2e1baa1e..607d4c35 100644 --- a/tests/unit/DeviceIdentityTests.cpp +++ b/tests/unit/DeviceIdentityTests.cpp @@ -33,20 +33,29 @@ TEST_CASE("Hmd_default_row_matches_todays_answers") TEST_CASE("Unknown_system_reports_itself") { - DeviceIdentity hmd = HmdIdentity("A runtime nobody has heard of"); - CHECK(hmd.modelNumber == "A runtime nobody has heard of"); - CHECK(hmd.manufacturer == "A runtime nobody has heard of"); - CHECK(hmd.manufacturer != "Oculus"); - CHECK(hmd.serial == "A runtime nobody has heard of-head"); + DeviceIdentity hmd = HmdIdentity("A headset nobody has heard of", {}, 0x1234, "Some Runtime 1.0"); + CHECK(hmd.modelNumber == "A headset nobody has heard of"); + // The maker isn't the model's name: the vendor's, else the runtime's + CHECK(hmd.manufacturer == "Some"); + CHECK(HmdIdentity("Meta Quest 3", {}, 0x2833, "Oculus").manufacturer == "Oculus"); + CHECK(HmdIdentity("Valve Index", {}, 0x28de, "SteamVR/OpenXR").manufacturer == "Valve"); + CHECK(HmdIdentity("Vive", {}, 0x0bb4, "").manufacturer == "HTC"); + CHECK(HmdManufacturer(0x045e, "Windows Mixed Reality Runtime") == "WindowsMR"); + CHECK(HmdManufacturer(42, "Monado(XRT) by Collabora et al 'v21.0.0'") == "Monado"); + CHECK(HmdManufacturer(0, "").empty()); + CHECK(HmdManufacturer(1, "SteamVR/OpenXR") == "SteamVR"); + hmd = HmdIdentity("A headset nobody has heard of"); + CHECK(hmd.manufacturer == "Oculus"); // nothing to go by: the generic answer + CHECK(hmd.serial == "A headset nobody has heard of-head"); // What games branch on stays as it was CHECK(hmd.trackingSystem == "oculus"); CHECK(hmd.controllerType == "oculus"); // libmonado's device name and serial, where it gives them - DeviceIdentity monado = HmdIdentity("Monado: Fake", { "Fake HMD", "SN0" }); + DeviceIdentity monado = HmdIdentity("Monado: Fake", { "Fake HMD", "SN0" }, 42, "Monado(XRT) by Collabora et al"); CHECK(monado.modelNumber == "Fake HMD"); CHECK(monado.serial == "SN0"); - CHECK(monado.manufacturer == "Monado: Fake"); + CHECK(monado.manufacturer == "Monado"); } TEST_CASE("Controllers_and_headset_have_different_serials") diff --git a/tests/unit/FormatTableTests.cpp b/tests/unit/FormatTableTests.cpp index b9f12dd8..700cea6e 100644 --- a/tests/unit/FormatTableTests.cpp +++ b/tests/unit/FormatTableTests.cpp @@ -122,3 +122,33 @@ TEST_CASE("No_formats_known_keeps_todays_choice") CheckChoice(ChooseSwapchainFormat(GfxApiKind::D3D11, 27, vr::ColorSpace_Gamma, {}), 29, false); CheckChoice(ChooseSwapchainFormat(GfxApiKind::Vulkan, 97, vr::ColorSpace_Auto, {}), 97, false); } + +TEST_CASE("Same_texels_in_another_api") +{ + // Vulkan R8G8B8A8_SRGB and B8G8R8A8_UNORM into DXGI; GL_RGBA16F, GL_R11F_G11F_B10F and GL_RGBA (unsized) into DXGI + CHECK(SameTexelsIn(GfxApiKind::Vulkan, 43, GfxApiKind::D3D11) == std::optional(29)); + CHECK(SameTexelsIn(GfxApiKind::Vulkan, 44, GfxApiKind::D3D11) == std::optional(87)); + CHECK(SameTexelsIn(GfxApiKind::OpenGL, 0x881A, GfxApiKind::D3D11) == std::optional(10)); + CHECK(SameTexelsIn(GfxApiKind::OpenGL, 0x8C3A, GfxApiKind::D3D11) == std::optional(26)); + CHECK(SameTexelsIn(GfxApiKind::OpenGL, 0x1908, GfxApiKind::D3D11) == std::optional(28)); + // A DXGI typeless format as its linear member + CHECK(SameTexelsIn(GfxApiKind::D3D11, 27, GfxApiKind::Vulkan) == std::optional(37)); + // None in DXGI: Vulkan A2R10G10B10 (BGR order), GL_RGB8; none at all: compressed, integer, unknown + CHECK_FALSE(SameTexelsIn(GfxApiKind::Vulkan, 58, GfxApiKind::D3D11).has_value()); + CHECK_FALSE(SameTexelsIn(GfxApiKind::OpenGL, 0x8051, GfxApiKind::D3D11).has_value()); + CHECK_FALSE(SameTexelsIn(GfxApiKind::Vulkan, 133, GfxApiKind::D3D11).has_value()); + CHECK_FALSE(SameTexelsIn(GfxApiKind::Vulkan, 62, GfxApiKind::D3D11).has_value()); + CHECK_FALSE(SameTexelsIn(GfxApiKind::Vulkan, 4, GfxApiKind::D3D11).has_value()); +} + +TEST_CASE("Convertible_colour_in_another_api") +{ + // GL_SRGB8 and GL_RGB8 into 8-bit RGBA of the same sRGB-ness; GL_RGB16F and GL_RGB32F into 16-bit float RGBA + CHECK(ConvertibleColourIn(GfxApiKind::OpenGL, 0x8C41, GfxApiKind::D3D11) == std::optional(29)); + CHECK(ConvertibleColourIn(GfxApiKind::OpenGL, 0x8051, GfxApiKind::D3D11) == std::optional(28)); + CHECK(ConvertibleColourIn(GfxApiKind::OpenGL, 0x881B, GfxApiKind::D3D11) == std::optional(10)); + CHECK(ConvertibleColourIn(GfxApiKind::OpenGL, 0x8815, GfxApiKind::D3D11) == std::optional(10)); + // Compressed and unknown formats: none + CHECK_FALSE(ConvertibleColourIn(GfxApiKind::OpenGL, 0x83F1, GfxApiKind::D3D11).has_value()); + CHECK_FALSE(ConvertibleColourIn(GfxApiKind::OpenGL, 0x1234, GfxApiKind::D3D11).has_value()); +} diff --git a/tests/unit/OverlayMathsTests.cpp b/tests/unit/OverlayMathsTests.cpp index 771b1816..c54e8886 100644 --- a/tests/unit/OverlayMathsTests.cpp +++ b/tests/unit/OverlayMathsTests.cpp @@ -6,6 +6,7 @@ #include "Misc/OverlayMaths.h" #include +#include #include #include @@ -294,3 +295,32 @@ TEST_CASE("Image_rectangle_selects_the_area_of_a_copy_and_follows_its_mirroring" CHECK(r.extent.width == 100); CHECK(r.extent.height == 200); } + +TEST_CASE("BeamPlacement_along_and_facing_the_head") +{ + // A beam 2 m straight ahead (-Z) at hand height, the head above and behind its start + std::optional p = BeamPlacement({ 0, 1, 0 }, { 0, 1, -2 }, { 0, 1.5f, 0.2f }, 0.004f); + REQUIRE(p); + CHECK(p->width == doctest::Approx(0.004f)); + CHECK(p->height == doctest::Approx(2.0f)); + CHECK(p->pose.position.y == doctest::Approx(1.0f)); + CHECK(p->pose.position.z == doctest::Approx(-1.0f)); + const glm::quat q(p->pose.orientation.w, p->pose.orientation.x, p->pose.orientation.y, p->pose.orientation.z); + // Its height along the beam, its face towards the head and across the beam + const glm::vec3 up = q * glm::vec3(0, 1, 0), face = q * glm::vec3(0, 0, 1); + CHECK(up.z == doctest::Approx(-1.0f).epsilon(0.001)); + CHECK(std::fabs(glm::dot(face, up)) < 0.001f); + const glm::vec3 toHead = glm::vec3(0, 1.5f, 0.2f) - glm::vec3(0, 1, -1); + CHECK(glm::dot(face, toHead) > 0.0f); + CHECK(face.y > 0.9f); +} + +TEST_CASE("BeamPlacement_end_on_and_too_short") +{ + // The head on the beam's line: still a quad along the beam + std::optional p = BeamPlacement({ 0, 0, 0 }, { 0, 0, -1 }, { 0, 0, 1 }, 0.004f); + REQUIRE(p); + const glm::quat q(p->pose.orientation.w, p->pose.orientation.x, p->pose.orientation.y, p->pose.orientation.z); + CHECK((q * glm::vec3(0, 1, 0)).z == doctest::Approx(-1.0f).epsilon(0.001)); + CHECK_FALSE(BeamPlacement({ 0, 0, 0 }, { 0, 0, -0.0005f }, { 0, 1, 0 }, 0.004f)); +} diff --git a/tests/unit/OwnFrameLoopTests.cpp b/tests/unit/OwnFrameLoopTests.cpp index daaa3f3b..a724559f 100644 --- a/tests/unit/OwnFrameLoopTests.cpp +++ b/tests/unit/OwnFrameLoopTests.cpp @@ -110,3 +110,21 @@ TEST_CASE("OwnFrameLoop: WhenAppIdle runs no frames while there is nothing to sh std::this_thread::sleep_for(150ms); CHECK(fake.frames <= stopped + 1); } + +TEST_CASE("OwnFrameLoop: InCallsOnly runs frames only inside the game's calls, on its thread") +{ + FakeFrames fake; + OwnFrameLoop loop(OwnFrameLoop::Mode::InCallsOnly, nullptr, 10ms, fake.Runner()); + // The game frames and then goes idle: no thread runs any + loop.OnAppFrameStart(); + loop.OnAppFrameEnd(); + std::this_thread::sleep_for(100ms); + CHECK(fake.frames == 0); + // A blocking call runs them, here + int calls = 0; + loop.RunWhile([&] { return ++calls <= 3; }); + CHECK(fake.frames == 3); + CHECK(fake.lastThread.load() == std::this_thread::get_id()); + std::this_thread::sleep_for(50ms); + CHECK(fake.frames == 3); +} diff --git a/tests/unit/RenderModelTests.cpp b/tests/unit/RenderModelTests.cpp index 9aeea5f5..0e1d7fe4 100644 --- a/tests/unit/RenderModelTests.cpp +++ b/tests/unit/RenderModelTests.cpp @@ -8,16 +8,21 @@ #include "Reimpl/BaseRenderModels.h" #include "resources.h" +#include #include #include #include #include +#include #include #include #include #include #include +#include +#include + namespace fs = std::filesystem; namespace { @@ -616,3 +621,202 @@ TEST_CASE("Render_models_load_asynchronously") CHECK((int)rm.LoadRenderModel_Async("no_such_model_here", &model) == 301); CHECK(model == nullptr); } + +// OpenLamina's own controller models, as the build converts them (scripts/rendermodels.py) +namespace { +struct OwnModelsDirForTest { + explicit OwnModelsDirForTest(const fs::path& dir) + { +#ifdef _WIN32 + _wputenv_s(L"OC_TEST_RENDERMODELS_DIR", dir.wstring().c_str()); +#else + setenv("OC_TEST_RENDERMODELS_DIR", dir.c_str(), 1); +#endif + } + ~OwnModelsDirForTest() + { +#ifdef _WIN32 + _wputenv_s(L"OC_TEST_RENDERMODELS_DIR", L""); +#else + unsetenv("OC_TEST_RENDERMODELS_DIR"); +#endif + } +}; + +fs::path OwnModels() +{ + return fs::path(OC_TEST_RENDERMODELS); +} + +glm::vec3 Apply(const XrPosef& p, glm::vec3 v) +{ + glm::quat q(p.orientation.w, p.orientation.x, p.orientation.y, p.orientation.z); + return q * v + glm::vec3(p.position.x, p.position.y, p.position.z); +} + +glm::vec3 Pos(const RmVertex& v) +{ + return glm::vec3(v.vPosition.v[0], v.vPosition.v[1], v.vPosition.v[2]); +} +} // namespace + +TEST_CASE("Own_controller_models_are_in_SteamVR_layout") +{ + OwnModelsDirForTest dir(OwnModels()); + const std::vector& names = OwnRenderModelNames(); + // Twelve controllers, both hands + REQUIRE(names.size() == 24); + CHECK(std::is_sorted(names.begin(), names.end())); + for (const std::string& name : names) { + CAPTURE(name); + std::shared_ptr model = FindOwnRenderModel(name, XrPosef{ { 0, 0, 0, 1 }, { 0, 0, 0 } }); + REQUIRE(model); + CHECK(Find(*model, "body")); + CHECK(Find(*model, "trigger")); + // No tip, base or handgrip: those are the profile's, as for any controller (GetComponentState) + CHECK_FALSE(Find(*model, "tip")); + CHECK_FALSE(Find(*model, "base")); + CHECK_FALSE(Find(*model, "handgrip")); + for (const RmComponent& c : model->components) { + CAPTURE(c.name); + std::optional mesh = LoadRenderModelMesh(*model, c.name); + REQUIRE(mesh); + CHECK(!mesh->textures.empty()); + CHECK(LoadRenderModelTextures(mesh->textures)); + } + // The whole model: the components shown at rest + std::optional whole = LoadRenderModelMesh(*model, ""); + REQUIRE(whole); + CHECK(whole->indices.size() % 3 == 0); + } +} + +TEST_CASE("Own_controller_models_move_like_SteamVR_ones") +{ + OwnModelsDirForTest dir(OwnModels()); + std::shared_ptr index = FindOwnRenderModel("valve-index-left", XrPosef{ { 0, 0, 0, 1 }, { 0, 0, 0 } }); + REQUIRE(index); + + // The trigger turns on the trigger's axis, the grip with its button; the stick with axis 0 + const RmComponent* trigger = Find(*index, "trigger"); + REQUIRE(trigger); + CHECK(trigger->motionType == "rotate"); + CHECK(trigger->motion["controller_axis"].asInt() == 1); + const RmComponent* stick = Find(*index, "thumbstick"); + REQUIRE(stick); + CHECK(stick->motionType == "joystick"); + CHECK(stick->motion["controller_axis"].asInt() == 0); + + // The touch dot: hidden until the trackpad's touched + const RmComponent* dot = Find(*index, "trackpad_touch"); + REQUIRE(dot); + CHECK(dot->motionType == "trackpad"); + CHECK_FALSE(ComponentVisible(*dot, false, false)); + CHECK(ComponentVisible(*dot, true, false)); + // Touched at the pad's right, it's further right than at its left + XrPosef right = ComponentPose(*dot, 0, { { 1, 0 } }), left = ComponentPose(*dot, 0, { { -1, 0 } }); + glm::vec3 across(right.position.x - left.position.x, right.position.y - left.position.y, right.position.z - left.position.z); + CHECK(glm::length(across) > 0.005f); +} + +TEST_CASE("Own_controller_models_are_put_in_the_device_space") +{ + OwnModelsDirForTest dir(OwnModels()); + // A space of its own, so the moved model isn't the cached one at identity + TempDir copy("oc_own_models"); + fs::copy(OwnModels() / "valve-index", copy.path / "valve-index", fs::copy_options::recursive); + std::optional files = LoadRenderModelFolder(copy.path / "valve-index", "valve-index-left"); + REQUIRE(files); + RmModel moved = *files; + glm::quat q = glm::angleAxis(glm::radians(30.0f), glm::normalize(glm::vec3(1, 0.5f, 0))); + moved.space = XrPosef{ { q.x, q.y, q.z, q.w }, { 0.01f, -0.02f, 0.03f } }; + + // The vertices: each where the space puts it + std::optional a = LoadRenderModelMesh(*files, "trigger"), b = LoadRenderModelMesh(moved, "trigger"); + REQUIRE(a); + REQUIRE(b); + REQUIRE(a->vertices.size() == b->vertices.size()); + for (size_t i = 0; i < a->vertices.size(); i += 17) + CHECK(glm::length(Apply(moved.space, Pos(a->vertices[i])) - Pos(b->vertices[i])) < 1e-5f); + + // The motion with them: the pressed trigger's vertex in the device's space is the files' pressed one, moved + const RmComponent* trigger = Find(moved, "trigger"); + REQUIRE(trigger); + XrPosef inFiles = ComponentPose(*trigger, 1, { { 0, 0 } }); + XrPosef inDevice = ModelComponentPose(moved, *trigger, 1, { { 0, 0 } }); + for (size_t i = 0; i < a->vertices.size(); i += 17) { + glm::vec3 want = Apply(moved.space, Apply(inFiles, Pos(a->vertices[i]))); + glm::vec3 got = Apply(inDevice, Pos(b->vertices[i])); + CHECK(glm::length(want - got) < 1e-5f); + } + // At rest it doesn't move + XrPosef rest = ModelComponentPose(moved, *trigger, 0, { { 0, 0 } }); + CHECK(std::abs(rest.position.x) + std::abs(rest.position.y) + std::abs(rest.position.z) < 1e-5f); +} + +TEST_CASE("Own_controller_models_textures_can_be_JPEG") +{ + OwnModelsDirForTest dir(OwnModels()); + // The PICO Neo3's texture is a JPEG + std::shared_ptr pico = FindOwnRenderModel("pico-neo3-left", XrPosef{ { 0, 0, 0, 1 }, { 0, 0, 0 } }); + REQUIRE(pico); + std::optional mesh = LoadRenderModelMesh(*pico, "body"); + REQUIRE(mesh); + REQUIRE(mesh->textures.size() == 1); + CHECK(mesh->textures[0].extension() == ".jpg"); + std::optional image = LoadRenderModelTexture(mesh->textures[0]); + REQUIRE(image); + CHECK(image->width > 0); + CHECK(image->rgba.size() == (size_t)image->width * image->height * 4); + // Not all one colour + bool varied = false; + for (size_t i = 4; i < image->rgba.size() && !varied; i += 4) + varied = memcmp(&image->rgba[i], &image->rgba[0], 3) != 0; + CHECK(varied); + + // Bytes that start as a JPEG but aren't one are refused + TempDir tmp; + WriteFile(tmp.path / "broken.jpg", std::string("\xFF\xD8\xFF\xE0 not really", 15)); + CHECK_FALSE(LoadRenderModelTexture(tmp.path / "broken.jpg")); +} + +TEST_CASE("Own_controller_models_answer_through_IVRRenderModels") +{ + OwnModelsDirForTest dir(OwnModels()); + BaseRenderModels rm; + const char* vive = "htc-vive-right"; + CHECK(rm.GetComponentCount(vive) == 5); // body, grip, trackpad, trackpad_touch, trigger + CHECK(rm.RenderModelHasComponent(vive, "trackpad_touch")); + CHECK_FALSE(rm.RenderModelHasComponent(vive, "tip")); + char name[128]; + CHECK(rm.GetComponentRenderModelName(vive, "trigger", name, sizeof(name)) == strlen("htc-vive-right/trigger") + 1); + CHECK(std::string(name) == "htc-vive-right/trigger"); + CHECK(rm.GetComponentButtonMask(vive, "trigger") == vr::ButtonMaskFromId(vr::k_EButton_Axis1)); + CHECK(rm.GetComponentButtonMask(vive, "grip") == vr::ButtonMaskFromId(vr::k_EButton_Grip)); + + // The touch dot shows while the pad's touched + vr::VRControllerState_t state{}; + OOVR_RenderModel_ComponentState_t cs{}; + REQUIRE(rm.GetComponentState(vive, "trackpad_touch", &state, nullptr, &cs)); + CHECK((cs.uProperties & 2) == 0); // VRComponentProperty_IsVisible + state.ulButtonTouched = vr::ButtonMaskFromId(vr::k_EButton_Axis0); + REQUIRE(rm.GetComponentState(vive, "trackpad_touch", &state, nullptr, &cs)); + CHECK((cs.uProperties & 2) != 0); + // Its tip is answered without a controller: where the model is + CHECK(rm.GetComponentState(vive, "tip", &state, nullptr, &cs)); + + // The model and a component load, with a texture + vr::IVRRenderModels_001::RenderModel_t whole{}, part{}; + REQUIRE(rm.LoadRenderModelInline(vive, &whole)); + REQUIRE(rm.LoadRenderModelInline("htc-vive-right/trigger", &part)); + CHECK(whole.unTriangleCount > part.unTriangleCount); + CHECK(whole.diffuseTexture.unWidth == 2048); + rm.FreeRenderModelInline(&whole); + rm.FreeRenderModelInline(&part); + + // The Touch's name, with no controller in the hand: the Touch's model + CHECK(rm.GetComponentCount("oculus_quest2_controller_left") > 1); + CHECK(rm.RenderModelHasComponent("oculus_quest2_controller_left", "x_button")); + // A hand's own model with no controller in it stays the hand + CHECK(rm.GetComponentCount("renderLeftHand") == 1); +} diff --git a/tests/unit/SessionLifecycleTests.cpp b/tests/unit/SessionLifecycleTests.cpp new file mode 100644 index 00000000..44a49015 --- /dev/null +++ b/tests/unit/SessionLifecycleTests.cpp @@ -0,0 +1,36 @@ +#include "doctest.h" + +#include "stdafx.h" + +#include "XrBackend.h" + +#include + +using Outcome = XrBackend::StateOutcome; + +TEST_CASE("A lost session is made again, and only the user quitting quits") +{ + // LOSS_PENDING is a loss, whatever came before + CHECK(XrBackend::OutcomeOfState(XR_SESSION_STATE_LOSS_PENDING, false, false) == Outcome::Lost); + CHECK(XrBackend::OutcomeOfState(XR_SESSION_STATE_LOSS_PENDING, true, false) == Outcome::Lost); + // EXITING after STOPPING is the user quitting from the runtime; without STOPPING, the session went away + CHECK(XrBackend::OutcomeOfState(XR_SESSION_STATE_EXITING, true, false) == Outcome::Quit); + CHECK(XrBackend::OutcomeOfState(XR_SESSION_STATE_EXITING, false, false) == Outcome::Lost); + // OpenLamina ending the session itself (a restart) is neither + CHECK(XrBackend::OutcomeOfState(XR_SESSION_STATE_EXITING, true, true) == Outcome::Ignored); + CHECK(XrBackend::OutcomeOfState(XR_SESSION_STATE_LOSS_PENDING, false, true) == Outcome::Ignored); + // Other states mean nothing for the game here + CHECK(XrBackend::OutcomeOfState(XR_SESSION_STATE_STOPPING, false, false) == Outcome::Ignored); + CHECK(XrBackend::OutcomeOfState(XR_SESSION_STATE_IDLE, true, false) == Outcome::Ignored); +} + +TEST_CASE("The system is asked for at once after a loss, then about once a second") +{ + using clock = std::chrono::steady_clock; + const clock::time_point t = clock::now(); + CHECK(XrBackend::RecoveryDue({}, t)); + CHECK_FALSE(XrBackend::RecoveryDue(t, t)); + CHECK_FALSE(XrBackend::RecoveryDue(t, t + std::chrono::milliseconds(999))); + CHECK(XrBackend::RecoveryDue(t, t + XrBackend::kRecoveryInterval)); + CHECK(XrBackend::RecoveryDue(t, t + std::chrono::seconds(30))); +} diff --git a/tests/unit/SharedStoreTests.cpp b/tests/unit/SharedStoreTests.cpp index 3d18f5c3..91703782 100644 --- a/tests/unit/SharedStoreTests.cpp +++ b/tests/unit/SharedStoreTests.cpp @@ -343,3 +343,70 @@ TEST_CASE("Store_leaves_no_temporary_file_and_refuses_a_runaway_document") CHECK_FALSE(store.Read(StoreDoc::Settings).isMember("big")); CHECK_FALSE(fs::exists(dir.path / "settings.json.tmp")); } + +TEST_CASE("Frame_edits_are_written_later_and_read_at_once") +{ + TempDir dir; + SharedStore store(dir.path); + SharedStore other(dir.path); // another program's view of the same store + store.UpdateLater(StoreDoc::Dashboard, "open", [](Json::Value& doc) { doc["open"] = true; }); + // This process reads it straight away + CHECK(store.Read(StoreDoc::Dashboard)["open"].asBool()); + CHECK(store.ReadAt(StoreDoc::Dashboard, { "open" }).asBool()); + store.Flush(); + // Written for the others + CHECK(other.Read(StoreDoc::Dashboard)["open"].asBool()); +} + +TEST_CASE("Only_the_last_frame_edit_with_a_key_is_made") +{ + TempDir dir; + SharedStore store(dir.path); + // Held up: the writer can't have the store while this Update is in its edit + std::atomic inEdit{ false }, release{ false }; + std::thread holder([&] { + store.Update(StoreDoc::Overlays, [&](Json::Value&) { + inEdit = true; + while (!release) + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + }); + }); + while (!inEdit) + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + for (int i = 1; i <= 5; i++) { + store.UpdateLater(StoreDoc::Scene, "count", [i](Json::Value& doc) { doc["calls"] = doc["calls"].asInt() + 1, doc["last"] = i; }); + // Not keyed: each made + store.UpdateLater(StoreDoc::Scene, "", [](Json::Value& doc) { doc["unkeyed"] = doc["unkeyed"].asInt() + 1; }); + } + release = true; + holder.join(); + store.Flush(); + SharedStore other(dir.path); + const Json::Value doc = other.Read(StoreDoc::Scene); + CHECK(doc["last"].asInt() == 5); + CHECK(doc["calls"].asInt() == 1); + CHECK(doc["unkeyed"].asInt() == 5); +} + +TEST_CASE("An_update_makes_the_frame_edits_before_its_own") +{ + TempDir dir; + SharedStore store(dir.path); + store.UpdateLater(StoreDoc::Overlays, "overlays", [](Json::Value& doc) { doc["123"]["start"] = 1; }); + // The program's entry removed as it shuts down: not put back by the frame's edit after it + store.Update(StoreDoc::Overlays, [](Json::Value& doc) { doc.removeMember("123"); }); + store.Flush(); + SharedStore other(dir.path); + CHECK_FALSE(other.Read(StoreDoc::Overlays).isMember("123")); +} + +TEST_CASE("A_store_destroyed_writes_its_frame_edits") +{ + TempDir dir; + { + SharedStore store(dir.path); + store.UpdateLater(StoreDoc::Settings, "k", [](Json::Value& doc) { doc["written"] = true; }); + } + SharedStore other(dir.path); + CHECK(other.Read(StoreDoc::Settings)["written"].asBool()); +} diff --git a/tests/unit/SkeletonTests.cpp b/tests/unit/SkeletonTests.cpp index 8ad24971..604a126a 100644 --- a/tests/unit/SkeletonTests.cpp +++ b/tests/unit/SkeletonTests.cpp @@ -70,9 +70,10 @@ TEST_CASE("Compressed_round_trip") { std::vector hand = TestHand(); std::vector buffer(kCompressedBonesSize); - CHECK(kCompressedBonesSize == 1004); - CHECK(CompressBones(VRSkeletalTransformSpace_Model, vr::VRSkeletalMotionRange_WithController, hand.data(), buffer.data(), (uint32_t)buffer.size()) == 1004); - CHECK(std::string((const char*)buffer.data(), 4) == "OCSK"); + // Within the size the OpenVR header promises: a bone per transform and 2 bytes + CHECK(kCompressedBonesSize == 994); + CHECK(CompressBones(VRSkeletalTransformSpace_Model, vr::VRSkeletalMotionRange_WithController, hand.data(), buffer.data(), (uint32_t)buffer.size()) == 994); + CHECK(buffer[0] == 0xB1); vr::VRBoneTransform_t out[31]; OOVR_EVRSkeletalTransformSpace stored = VRSkeletalTransformSpace_Parent; @@ -113,12 +114,12 @@ TEST_CASE("Decompress_rejects_garbage") CompressBones(VRSkeletalTransformSpace_Model, vr::VRSkeletalMotionRange_WithController, hand.data(), buffer.data(), (uint32_t)buffer.size()); vr::VRBoneTransform_t out[31]; - std::vector wrongMagic = buffer; - wrongMagic[0] = 'X'; - CHECK(DecompressBones(wrongMagic.data(), (uint32_t)wrongMagic.size(), std::nullopt, out) == vr::VRInputError_InvalidCompressedData); - std::vector wrongVersion = buffer; - wrongVersion[4] = 2; - CHECK(DecompressBones(wrongVersion.data(), (uint32_t)wrongVersion.size(), std::nullopt, out) == vr::VRInputError_InvalidCompressedData); + std::vector wrongTag = buffer; + wrongTag[0] = 'X'; + CHECK(DecompressBones(wrongTag.data(), (uint32_t)wrongTag.size(), std::nullopt, out) == vr::VRInputError_InvalidCompressedData); + std::vector wrongSpace = buffer; + wrongSpace[1] = 7; + CHECK(DecompressBones(wrongSpace.data(), (uint32_t)wrongSpace.size(), std::nullopt, out) == vr::VRInputError_InvalidCompressedData); CHECK(DecompressBones(buffer.data(), (uint32_t)buffer.size() - 1, std::nullopt, out) == vr::VRInputError_InvalidCompressedData); std::vector garbage(kCompressedBonesSize, 0xAB); CHECK(DecompressBones(garbage.data(), (uint32_t)garbage.size(), std::nullopt, out) == vr::VRInputError_InvalidCompressedData); @@ -129,9 +130,9 @@ TEST_CASE("Compressed_buffer_too_small_reports_size") { std::vector hand = TestHand(); uint8_t tooSmall[100] = {}; - CHECK(CompressBones(VRSkeletalTransformSpace_Model, vr::VRSkeletalMotionRange_WithController, hand.data(), tooSmall, sizeof(tooSmall)) == 1004); + CHECK(CompressBones(VRSkeletalTransformSpace_Model, vr::VRSkeletalMotionRange_WithController, hand.data(), tooSmall, sizeof(tooSmall)) == 994); CHECK(tooSmall[0] == 0); // nothing written - CHECK(CompressBones(VRSkeletalTransformSpace_Model, vr::VRSkeletalMotionRange_WithController, hand.data(), nullptr, 0) == 1004); + CHECK(CompressBones(VRSkeletalTransformSpace_Model, vr::VRSkeletalMotionRange_WithController, hand.data(), nullptr, 0) == 994); } namespace { @@ -211,3 +212,20 @@ TEST_CASE("Default_reference_poses_exist_without_a_controller") } CHECK_FALSE(InteractionProfile::GetDefaultSkeletalReferencePose(ITrackedDevice::HAND_NONE, VRSkeletalReferencePose_Fist).has_value()); } + +TEST_CASE("Decompress_reads_the_older_layout") +{ + // { "OCSK", version 1, space, range, count 31 } then the bones: 1004 bytes + std::vector hand = TestHand(); + std::vector old(12 + 31 * sizeof(vr::VRBoneTransform_t)); + const uint8_t header[12] = { 'O', 'C', 'S', 'K', 1, 0, (uint8_t)VRSkeletalTransformSpace_Model, 0, 31, 0, 0, 0 }; + memcpy(old.data(), header, sizeof(header)); + memcpy(old.data() + 12, hand.data(), 31 * sizeof(vr::VRBoneTransform_t)); + vr::VRBoneTransform_t out[31]; + OOVR_EVRSkeletalTransformSpace stored = VRSkeletalTransformSpace_Parent; + CHECK(DecompressBones(old.data(), (uint32_t)old.size(), std::nullopt, out, &stored) == vr::VRInputError_None); + CHECK(stored == VRSkeletalTransformSpace_Model); + CheckSame(hand, out); + old[0] = 'X'; + CHECK(DecompressBones(old.data(), (uint32_t)old.size(), std::nullopt, out) == vr::VRInputError_InvalidCompressedData); +} diff --git a/tests/unit/SmokeTests.cpp b/tests/unit/SmokeTests.cpp index b28919c5..bc129d2e 100644 --- a/tests/unit/SmokeTests.cpp +++ b/tests/unit/SmokeTests.cpp @@ -8,6 +8,7 @@ #include "logging.h" #include +#include #include #include #include @@ -84,6 +85,34 @@ TEST_CASE("Config is read at the first question, not when it's made") CHECK(c.SupersampleRatio() == 1.5f); } +#ifndef _WIN32 +// On Linux the user's config folder ($XDG_CONFIG_HOME/openlamina) is read before the working directory, which overrides +// it key by key +TEST_CASE("Config user file overridden by the working directory's, key by key") +{ + oovr_log_set_test_sink(test_sink); + IniInDir ini("supersampleRatio=2\n"); + std::filesystem::path config = ini.dir / "xdg"; + std::filesystem::create_directories(config / "openlamina"); + std::ofstream(config / "openlamina" / "openlamina.ini") << "supersampleRatio=1.5\nlaserMouse=false\n"; + const char* oldXdg = getenv("XDG_CONFIG_HOME"); + std::string saved = oldXdg ? oldXdg : ""; + setenv("XDG_CONFIG_HOME", config.c_str(), 1); + { + Config c; + CHECK(c.SupersampleRatio() == 2.0f); + CHECK_FALSE(c.LaserMouse()); + CHECK(ini.Logged("Checking for user config file")); + CHECK(ini.Logged("2 config files read")); + } + if (oldXdg) + setenv("XDG_CONFIG_HOME", saved.c_str(), 1); + else + unsetenv("XDG_CONFIG_HOME"); + oovr_log_set_test_sink(nullptr); +} +#endif + TEST_CASE("Config scales must be numbers above 0") { oovr_log_set_test_sink(test_sink); diff --git a/tests/unit/data/bindings_skeleton_knuckles.json b/tests/unit/data/bindings_skeleton_knuckles.json new file mode 100644 index 00000000..a4fe884e --- /dev/null +++ b/tests/unit/data/bindings_skeleton_knuckles.json @@ -0,0 +1,16 @@ +{ + "controller_type": "knuckles", + "bindings": { + "/actions/main": { + "sources": [ + { "path": "/user/hand/left/input/grip", "mode": "button", "inputs": { "click": { "output": "/actions/main/in/grab" } } }, + { "path": "/user/hand/right/input/grip", "mode": "button", "inputs": { "click": { "output": "/actions/main/in/grab" } } } + ], + "poses": [{ "output": "/actions/main/in/pose", "path": "/user/hand/right/pose/raw" }], + "skeleton": [ + { "output": "/actions/main/in/skeleton_left", "path": "/user/hand/left/input/skeleton/left" }, + { "output": "/actions/main/in/skeleton_right", "path": "/user/hand/right/input/skeleton/right" } + ] + } + } +} diff --git a/tests/unit/data/bindings_tracker_waist.json b/tests/unit/data/bindings_tracker_waist.json new file mode 100644 index 00000000..129fe10d --- /dev/null +++ b/tests/unit/data/bindings_tracker_waist.json @@ -0,0 +1,8 @@ +{ + "controller_type": "vive_tracker_waist", + "bindings": { + "/actions/main": { + "poses": [{ "output": "/actions/main/in/waist", "path": "/user/waist/pose/raw" }] + } + } +} diff --git a/tests/unit/data/bindings_trackers_knuckles.json b/tests/unit/data/bindings_trackers_knuckles.json new file mode 100644 index 00000000..699cf5df --- /dev/null +++ b/tests/unit/data/bindings_trackers_knuckles.json @@ -0,0 +1,11 @@ +{ + "controller_type": "knuckles", + "bindings": { + "/actions/main": { + "sources": [ + { "path": "/user/hand/right/input/trigger", "mode": "trigger", "inputs": { "pull": { "output": "/actions/main/in/squeeze" } } } + ], + "poses": [{ "output": "/actions/main/in/hand", "path": "/user/hand/right/pose/raw" }] + } + } +} diff --git a/tests/unit/data/manifest_haptic_no_bindings.json b/tests/unit/data/manifest_haptic_no_bindings.json new file mode 100644 index 00000000..810c785d --- /dev/null +++ b/tests/unit/data/manifest_haptic_no_bindings.json @@ -0,0 +1,9 @@ +{ + "default_bindings": [], + "actions": [ + { "name": "/actions/main/in/toggle", "type": "boolean" }, + { "name": "/actions/main/in/pose", "type": "pose" }, + { "name": "/actions/main/out/haptic", "type": "vibration" } + ], + "action_sets": [{ "name": "/actions/main", "usage": "leftright" }] +} diff --git a/tests/unit/data/manifest_skeleton.json b/tests/unit/data/manifest_skeleton.json new file mode 100644 index 00000000..7783b5fd --- /dev/null +++ b/tests/unit/data/manifest_skeleton.json @@ -0,0 +1,11 @@ +{ + "default_bindings": [{ "controller_type": "knuckles", "binding_url": "bindings_skeleton_knuckles.json" }], + "actions": [ + { "name": "/actions/main/in/skeleton_left", "type": "skeleton", "skeleton": "/skeleton/hand/left" }, + { "name": "/actions/main/in/skeleton_right", "type": "skeleton", "skeleton": "/skeleton/hand/right" }, + { "name": "/actions/main/in/pose", "type": "pose" }, + { "name": "/actions/main/in/grab", "type": "boolean" } + ], + "action_sets": [{ "name": "/actions/main", "usage": "leftright" }], + "localization": [{ "language_tag": "en_US", "/actions/main": "Main" }] +} diff --git a/tests/unit/data/manifest_trackers.json b/tests/unit/data/manifest_trackers.json new file mode 100644 index 00000000..eb793dde --- /dev/null +++ b/tests/unit/data/manifest_trackers.json @@ -0,0 +1,12 @@ +{ + "default_bindings": [ + { "controller_type": "knuckles", "binding_url": "bindings_trackers_knuckles.json" }, + { "controller_type": "vive_tracker_waist", "binding_url": "bindings_tracker_waist.json" } + ], + "actions": [ + { "name": "/actions/main/in/waist", "type": "pose" }, + { "name": "/actions/main/in/hand", "type": "pose" }, + { "name": "/actions/main/in/squeeze", "type": "vector1" } + ], + "action_sets": [{ "name": "/actions/main", "usage": "leftright" }] +}