Skip ray-box children whose title-memory pages are missing #1165

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

@⁠BradRoland on GitHub · 2026-11-25 22:17 UTC · original
BradRoland:codex/bvh-unmapped-nodes → main · +258 −59 · 4 files · 1 commits · open

A missing title-memory page is read through a null UAV, which returns zeros. For a ray through the origin those zeros describe a box the ray can hit. On 9c184b3, an absent Box32 returned four child pointers of zero. With its first page present and its second missing, the same instruction returned all four IDs even though only the first two children had bounds.

The shader now uses the missing-page bit already computed by the directory lookup when deciding which box children to return. The first 64 bytes hold all child pointers. For a 128-byte Box32, bounds for children 2 and 3 are in the second half, which can be on another page. Children 0 and 1 remain usable when only that second page is missing. The existing fault reporting still requests the absent pages.

The synthetic compute test uses the production directory lookup, a real D3D12 null UAV, and a ray aimed through the origin. It exercises both box formats, all four combinations of first/second-page residency, and a masked-off lane. A resident all-zero box still returns four zero child IDs. That control is important because a zero child ID is valid.

  • Baseline with the second page missing returned [0, 16, 32, 48]. With the patch it returned [0, 16, 0xffffffff, 0xffffffff].
  • Verified on the NVIDIA RTX 4080 and Microsoft WARP. Reproduce with cargo test --locked -p victory-shader --lib boxes_with_missing_title_pages_only_return_resident_children -- --nocapture. Set VICTORY_WARP=1 to run on the software adapter.
  • The full shader suite passed 217 tests (3 ignored). The shader crate passed Clippy with --all-targets -- -D warnings.

The renderer can retry the missing pages on a later frame. The impact on lighting and frame time still needs an in-game run.

For testers running the structure builder, the fix is also available on the current #994 stack at 1ffff57 with the builder-off lookup correction. All nine intersection tests passed there on hardware and WARP. Combined branch

For comparison with #1166, the two regressions exercise different behavior on a split Box32. When only the first 64 bytes are resident, this PR returns the two children with complete pointers and bounds. The test at 77cbca8 in #1166 expects four misses on that input. #1166 also avoids a second directory lookup for a box that fits on one page.

**@⁠BradRoland** on GitHub · 2026-11-25 22:17 UTC · [original](https://github.com/fxceless/victory-fork/pull/1165) `BradRoland:codex/bvh-unmapped-nodes` → `main` · +258 −59 · 4 files · 1 commits · open A missing title-memory page is read through a null UAV, which returns zeros. For a ray through the origin those zeros describe a box the ray can hit. On `9c184b3`, an absent Box32 returned four child pointers of zero. With its first page present and its second missing, the same instruction returned all four IDs even though only the first two children had bounds. The shader now uses the missing-page bit already computed by the directory lookup when deciding which box children to return. The first 64 bytes hold all child pointers. For a 128-byte Box32, bounds for children 2 and 3 are in the second half, which can be on another page. Children 0 and 1 remain usable when only that second page is missing. The existing fault reporting still requests the absent pages. The synthetic compute test uses the production directory lookup, a real D3D12 null UAV, and a ray aimed through the origin. It exercises both box formats, all four combinations of first/second-page residency, and a masked-off lane. A resident all-zero box still returns four zero child IDs. That control is important because a zero child ID is valid. - Baseline with the second page missing returned `[0, 16, 32, 48]`. With the patch it returned `[0, 16, 0xffffffff, 0xffffffff]`. - Verified on the NVIDIA RTX 4080 and Microsoft WARP. Reproduce with `cargo test --locked -p victory-shader --lib boxes_with_missing_title_pages_only_return_resident_children -- --nocapture`. Set `VICTORY_WARP=1` to run on the software adapter. - The full shader suite passed 217 tests (3 ignored). The shader crate passed Clippy with `--all-targets -- -D warnings`. The renderer can retry the missing pages on a later frame. The impact on lighting and frame time still needs an in-game run. For testers running the structure builder, the fix is also available on the current #994 stack at `1ffff57` with the builder-off lookup correction. All nine intersection tests passed there on hardware and WARP. [Combined branch](https://github.com/BradRoland/victory-fork/tree/codex/bvh-994-integration) For comparison with #1166, the two regressions exercise different behavior on a split Box32. When only the first 64 bytes are resident, this PR returns the two children with complete pointers and bounds. The test at `77cbca8` in #1166 expects four misses on that input. #1166 also avoids a second directory lookup for a box that fits on one page.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:58:45 +00:00
Author
Owner

@⁠HAL9000RELOADED on GitHub · 2026-11-25 23:25 UTC · original

First Radeon run of a3261ca: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045), Agility SDK 1.620 (#402). Base: 3151ccf (main d827419 + #402).

  • victory-shader: 217 passed, 0 failed. The new boxes_with_missing_title_pages_only_return_resident_children passes on the card.

Only the RTX 4080 and WARP were listed so far; RDNA3 agrees.

**@⁠HAL9000RELOADED** on GitHub · 2026-11-25 23:25 UTC · [original](https://github.com/fxceless/victory-fork/pull/1165#issuecomment-7177550396) First Radeon run of `a3261ca`: RX 7900 XTX (RDNA3), driver 32.0.32015.7029, Windows 10 22H2 (19045), Agility SDK 1.620 (#402). Base: `3151ccf` (main `d827419` + #402). - `victory-shader`: 217 passed, 0 failed. The new `boxes_with_missing_title_pages_only_return_resident_children` passes on the card. Only the RTX 4080 and WARP were listed so far; RDNA3 agrees.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/host.rs
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/1165/head:github-bot/gh-1165'
git switch 'github-bot/gh-1165'

Merge

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