RT-BVH-BUILDER: serve XboxBvhBuilder.dll with the layer's XDXR builder #549

Open
github-bot wants to merge 1 commit from github-bot/gh-549 into main AGit
Owner

@⁠bobcatchris on GitHub · 2026-11-24 07:30 UTC · original
bobcatchris:rt-bvh-builder-throw → main · +776 −1 · 7 files · 1 commits · open

Claimed in the coordination issue as: RT-BVH-BUILDER-THROW

Depends on: none

What and why

After the slot-73 IID and XMem lease fixes, the title reaches XboxBvhBuilder.dll and ends in a C++ throw while the bundled DLL creates 52 console compute pipelines. Their translated compile time runs past the title's startup watchdog on a cold driver cache.

This restores the final state of three preserved commits whose content was dropped from main by later mirror merges. A shim serves the seven XboxBvhBuilder.dll imports the executable binds, so the DLL is never loaded and no 52 console programs are created. It builds the layer's own XDXR BVH4 structures in the format the translated traversal shaders read, skips the offline-statistics postbuild type instead of throwing, unwraps console command-list proxies, and holds the device reference across prebuild calls. LEONIDA_BVH_BUILDER=console preserves the bundled DLL path.

Original work by romainveurrier, preserved in the local full history as 242a5dbf1, 98c065ca2 and 65a2da200.

Tested

  • Built xbox_bvh_builder_test against current main with MSVC in a local out-of-tree build.
  • xbox_bvh_builder_test <out> — 13/13 checks pass, including proxy device handling, offline-statistics skip, E_NOTIMPL rehydration, destructor cleanup, and BLAS/TLAS/compacted-BLAS fixture output.
  • xbox_bvh_builder_test --console with LEONIDA_BVH_BUILDER=console — 1/1 check passes.
  • python -I tools/xdxr_bvh.py check-build <out> --rays 1000 — all cases match; 0 validation errors and 0/1000 ray differences for BLAS, compacted BLAS and TLAS.
  • python -I scripts/check_no_game_data.py on every changed file — clean.
  • git diff --check clean.
  • Patch, diff and direct-file security sweeps: 0 hits.
  • No game executable was run. No game files, keys or decryption are included.

A local MSVC 14.39 incompatibility in the unrelated src/crt_timed_wait.cpp was worked around only in the throwaway build directory; no repository source was changed for it.

GPUs tested: AMD Radeon RX 7900 XTX, driver 32.0.32029.2010, Windows 11

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly.
  • One topic: restore the XboxBvhBuilder shim and its tests.
  • No game data, keys or decryption.
  • Synthetic GPU/BVH fixtures and console-mode regression included.
**@⁠bobcatchris** on GitHub · 2026-11-24 07:30 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/549) `bobcatchris:rt-bvh-builder-throw` → `main` · +776 −1 · 7 files · 1 commits · open Claimed in the coordination issue as: RT-BVH-BUILDER-THROW Depends on: none ### What and why After the slot-73 IID and XMem lease fixes, the title reaches `XboxBvhBuilder.dll` and ends in a C++ throw while the bundled DLL creates 52 console compute pipelines. Their translated compile time runs past the title's startup watchdog on a cold driver cache. This restores the final state of three preserved commits whose content was dropped from `main` by later mirror merges. A shim serves the seven `XboxBvhBuilder.dll` imports the executable binds, so the DLL is never loaded and no 52 console programs are created. It builds the layer's own XDXR BVH4 structures in the format the translated traversal shaders read, skips the offline-statistics postbuild type instead of throwing, unwraps console command-list proxies, and holds the device reference across prebuild calls. `LEONIDA_BVH_BUILDER=console` preserves the bundled DLL path. Original work by romainveurrier, preserved in the local full history as `242a5dbf1`, `98c065ca2` and `65a2da200`. ### Tested - Built `xbox_bvh_builder_test` against current `main` with MSVC in a local out-of-tree build. - `xbox_bvh_builder_test <out>` — 13/13 checks pass, including proxy device handling, offline-statistics skip, E_NOTIMPL rehydration, destructor cleanup, and BLAS/TLAS/compacted-BLAS fixture output. - `xbox_bvh_builder_test --console` with `LEONIDA_BVH_BUILDER=console` — 1/1 check passes. - `python -I tools/xdxr_bvh.py check-build <out> --rays 1000` — all cases match; 0 validation errors and 0/1000 ray differences for BLAS, compacted BLAS and TLAS. - `python -I scripts/check_no_game_data.py` on every changed file — clean. - `git diff --check` clean. - Patch, diff and direct-file security sweeps: 0 hits. - No game executable was run. No game files, keys or decryption are included. A local MSVC 14.39 incompatibility in the unrelated `src/crt_timed_wait.cpp` was worked around only in the throwaway build directory; no repository source was changed for it. GPUs tested: AMD Radeon RX 7900 XTX, driver 32.0.32029.2010, Windows 11 AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic: restore the XboxBvhBuilder shim and its tests. - [x] No game data, keys or decryption. - [x] Synthetic GPU/BVH fixtures and console-mode regression included.
Restore the final content of the preserved 242a5dbf1, 98c065ca2 and 65a2da200 commits, whose files were dropped from main by later mirror merges. The shim serves the seven imports of XboxBvhBuilder.dll without loading the bundled DLL, avoiding its 52 console pipeline compiles and the cold-boot watchdog timeout. It builds layer BVHs, skips offline-statistics elements instead of throwing, unwraps console list proxies, and holds the device across prebuild calls. LEONIDA_BVH_BUILDER=console preserves the bundled DLL path.

Original work by romainveurrier, preserved in the local full history. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:07:50 +00:00
Author
Owner

@⁠bobcatchris on GitHub · 2026-11-24 07:40 UTC · original

Runtime verification (not a clean pass yet): I built this PR on current upstream main, locally stacked the already-open prerequisites #445 and #375, and ran against the 1.0.2.1 package with LEONIDA_D3D12=vulkan and a 26,503-entry translated corpus. All seven XboxBvhBuilder.dll imports bind to the shim. The run advanced to 1,655 D3D12 calls (the old report stopped around 1,619 with a C++ throw from the bundled DLL), and the old XboxBvhBuilder.dll throw is gone. It now asserts at game_scarlett_master.exe+0x19f4f58 after the call site at +0x19f4f4f returns false. No shim runtime log appeared before that assert, so I am not claiming the boot is fixed; the next step is to check whether the title reads state from the builder object that the shim intentionally does not write. No game data was committed.

**@⁠bobcatchris** on GitHub · 2026-11-24 07:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/549#issuecomment-7125249598) Runtime verification (not a clean pass yet): I built this PR on current upstream main, locally stacked the already-open prerequisites #445 and #375, and ran against the 1.0.2.1 package with LEONIDA_D3D12=vulkan and a 26,503-entry translated corpus. All seven XboxBvhBuilder.dll imports bind to the shim. The run advanced to 1,655 D3D12 calls (the old report stopped around 1,619 with a C++ throw from the bundled DLL), and the old XboxBvhBuilder.dll throw is gone. It now asserts at game_scarlett_master.exe+0x19f4f58 after the call site at +0x19f4f4f returns false. No shim runtime log appeared before that assert, so I am not claiming the boot is fixed; the next step is to check whether the title reads state from the builder object that the shim intentionally does not write. No game data was committed.
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 11:39 UTC · original

Independent run on Windows: passes, with and without validation.

Head 2e17d7208 built as it is (RelWithDebInfo, MSVC 19.50.35721.0), ctest -R "bvh_builder|xbox_bvh", both with LEONIDA_VK_VALIDATION unset and =1 (Vulkan SDK 1.4.363.0):

  • xbox_bvh_builder 13/13 checks, xbox_bvh_builder_console 1/1;
  • xbox_bvh_builder_check: shim_blas, shim_blas_compacted, shim_tlas each 0 validation errors, 0/1000 rays differing;
  • bvh_builder skips (no package), as expected.

Two notes from reading xbox_bvh_builder.cpp, neither blocking:

  1. RehydrateRaytracingAccelerationStructure*X answer E_NOTIMPL. docs/bvh.md §4/§4a (lines 454-457) records that the *_bvh4.rpf contents are dehydrated inputs for exactly that path and leaves open whether the runtime calls it. If it does, those BLAS stay empty under this shim, so it may be worth a log line that names the call (or a finding: for the follow-up) so a boot log shows it.
  2. Copy modes are passed through to the layer unchanged, so the XDXR SERIALIZE/DESERIALIZE modes in #626 would work through this shim with no change here.

GPU: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Vulkan 1.4.351, Windows 11 Pro 26300.

AI-assisted.

**@⁠kawaii-shakal** on GitHub · 2026-11-24 11:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/549#issuecomment-7130374373) Independent run on Windows: passes, with and without validation. Head 2e17d7208 built as it is (RelWithDebInfo, MSVC 19.50.35721.0), `ctest -R "bvh_builder|xbox_bvh"`, both with `LEONIDA_VK_VALIDATION` unset and `=1` (Vulkan SDK 1.4.363.0): - `xbox_bvh_builder` 13/13 checks, `xbox_bvh_builder_console` 1/1; - `xbox_bvh_builder_check`: `shim_blas`, `shim_blas_compacted`, `shim_tlas` each 0 validation errors, 0/1000 rays differing; - `bvh_builder` skips (no package), as expected. Two notes from reading `xbox_bvh_builder.cpp`, neither blocking: 1. `RehydrateRaytracingAccelerationStructure*X` answer `E_NOTIMPL`. `docs/bvh.md` §4/§4a (lines 454-457) records that the `*_bvh4.rpf` contents are dehydrated inputs for exactly that path and leaves open whether the runtime calls it. If it does, those BLAS stay empty under this shim, so it may be worth a log line that names the call (or a `finding:` for the follow-up) so a boot log shows it. 2. Copy modes are passed through to the layer unchanged, so the XDXR `SERIALIZE`/`DESERIALIZE` modes in #626 would work through this shim with no change here. GPU: NVIDIA GeForce RTX 5070 Ti, driver 617.42, Vulkan 1.4.351, Windows 11 Pro 26300. AI-assisted.
Author
Owner

@⁠bobcatchris on GitHub · 2026-11-24 23:42 UTC · original

Rebased on current main; resolved the fallback-build script conflict while retaining ws2_offline. Verified: xs_proxy_mock and xbox_bvh_builder pass; package-gated BVH shim 13/13 checks; BLAS/compacted BLAS/TLAS 0 validation errors and 0/3000 ray differences; no-game-data and security checks clean.

**@⁠bobcatchris** on GitHub · 2026-11-24 23:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/549#issuecomment-7147711560) Rebased on current main; resolved the fallback-build script conflict while retaining ws2_offline. Verified: xs_proxy_mock and xbox_bvh_builder pass; package-gated BVH shim 13/13 checks; BLAS/compacted BLAS/TLAS 0 validation errors and 0/3000 ray differences; no-game-data and security checks clean.
This pull request has changes conflicting with the target branch.
  • docs/xdxr.md
  • runtime/CMakeLists.txt
  • runtime/shims/d3d12_xs_device.cpp
  • runtime/shims/d3d12_xs_device.h
  • runtime/shims/xbox_bvh_builder.cpp
  • runtime/test/xbox_bvh_builder_test.cpp
  • scripts/build_runtime.ps1
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/549/head:github-bot/gh-549'
git switch 'github-bot/gh-549'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-549'
git switch 'github-bot/gh-549'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-549'
git switch 'github-bot/gh-549'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-549'
git switch 'main'
git merge --squash 'github-bot/gh-549'
git switch 'main'
git merge --ff-only 'github-bot/gh-549'
git switch 'main'
git merge 'github-bot/gh-549'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.