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

Open
BradRoland wants to merge 1 commit from upstream-pr/1165 into main
BradRoland commented 2026-11-25 22:17:19 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by BradRoland on 2026-11-25T22:17:19Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6614885666 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1165). Originally posted by [BradRoland](https://github.com/BradRoland) on 2026-11-25T22:17:19Z. --- 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.
HAL9000RELOADED commented 2026-11-26 00:06:08 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by HAL9000RELOADED on 2026-11-25T23:25:54Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7177550396 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1165#issuecomment-7177550396). Originally posted by [HAL9000RELOADED](https://github.com/HAL9000RELOADED) on 2026-11-25T23:25:54Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1165:upstream-pr/1165'
git switch 'upstream-pr/1165'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1165'
git switch 'upstream-pr/1165'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1165'
git switch 'upstream-pr/1165'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1165'
git switch 'main'
git merge --squash 'upstream-pr/1165'
git switch 'main'
git merge --ff-only 'upstream-pr/1165'
git switch 'main'
git merge 'upstream-pr/1165'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1162
No description provided.