Ray tracing: a child that is not there is a miss, whatever its box #213
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/213"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from fxceless/victory-fork. Originally posted by Pablo-Barros on 2026-11-24T22:35:46Z.
What and why
The node test took a child whose pointer is
0xffff_fffffor a hit whenever the ray entered its box, in the CPU reference (bvh.rs) and in the emitted DXIL (emit/intersect.rs). Its result dword was0xffff_ffffeither way, but sorted it came with a finite distance, so it could stand before a child that is there. A traversal that stops at the first "none" would then miss that child.Both now test the pointer too: a child that is not there is a miss, as the reference's description of the result already said. Unsorted output does not change.
What it moves in the emitted code: two integer instructions per child (a compare and an and). The parity tests' program (the 64-bit form) goes from 519 to 527 instructions by
dxc -dumpbin; apart from block numbering, the rest of it is the same.Validation
Machine: RTX 3070 8 GB (32-lane waves), driver 610.88, Windows 11 Pro 26300 with the in-box D3D12 runtime, Rust 1.98.1. Based on
2119b0e.[ffffffff, ffffffff, ffffffff, 8].got [ffffffff, ffffffff, ffffffff, 8],want [8, ffffffff, ffffffff, ffffffff]). With both corrected, they pass on the hardware adapter and on WARP (noskippedline).cargo test -p victory-shader --lib -- bvh:: intersect_tests: 22 passed, 0 failed.cargo clippy --workspace --all-targets --locked -- -D warnings, and again with--all-features: no warnings.cargo test --workspace --locked: 497 passed, 0 failed, 7 ignored (main's 496 and the new test).cargo xtask policy: 169 files ok.Not known
docs/fork-ray-tracing.mdlists it with the other assumptions.Reproducer and first patch: @Bennet0k in #173. AI-assisted patch (the emitter change, the tests and the validation).
Fixes #173
Imported from fxceless/victory-fork. Originally posted by Flyander on 2026-11-24T22:49:53Z.
Review: COMMENTED
Cross-validation on Windows D3D12 with an RTX 5070 Ti:
cargo test --locked -p victory-shader --libpasses (211 passed, 2 ignored). The four emitted-DXIL intersection parity tests for both node widths and both title-buffer addressing forms pass in this run, along with the new missing-child reference test. This adds NVIDIA coverage to the RTX 3070 and WARP results in the PR.Imported from fxceless/victory-fork. Originally posted by pr0vId3nce on 2026-11-25T13:56:17Z.
Hardware result for this fixture: an RDNA2 GPU returns
[8, ffffffff, ffffffff, ffffffff]I ran this PR's
MISSING_FIRSTnode and ray (children[ffffffff, 8, ffffffff, ffffffff], the boxes of the test, ray from the origin along +z, extent 10) through the real instruction:image_bvh64_intersect_rayandimage_bvh_intersect_ray, run natively from raw words on a Ryzen 9 7900X's iGPU (gfx1036, RDNA2 with the ray accelerators, driver 32.0.21042.62) through the AMD driver's own amd_comgr/HIP DLLs.00000008 ffffffff ffffffff ffffffffffffffff 00000008 ffffffff ffffffff4e17478b9:bvh.rs, and its DXIL on an RTX 4080, the AMD iGPU and WARPffffffff ffffffff ffffffff 00000008ffffffff 00000008 ffffffff ffffffff4e17478b9with this PR's condition inbvh.rs00000008 ffffffff ffffffff ffffffffffffffff 00000008 ffffffff ffffffffA second node, children
[8, ffffffff, 18, 1ffffffc]with boxes entered at 10, 5, 20 and 15 along +x: the GPU returns00000008 1ffffffc 00000018 ffffffff,4e17478b9returnsffffffff 00000008 1ffffffc 00000018. Onlyffffffffis special: with children8, fffffffe, 7fffffff, fffffff8the GPU returns all four, in entry order.So the expected value here (and in #173) is what the hardware does.
Scope: desktop RDNA2, not the console. Synthetic nodes, no game data. I did not build this branch; the third row is its
bvh.rscondition applied to4e17478b9on the CPU.AI-assisted (Claude Code); the runs are from my machine.
Imported from fxceless/victory-fork. Originally posted by UncommonDLL on 2026-11-27T03:55:06Z.
I tested this PR (
1625a129) on top of main67429060with an RTX 5070 Ti, driver32.0.16.2140. I used the same synthetic inputs and expected results for both runs.With the original shader code, all four tests put the empty slots ahead of child
8:[NONE, NONE, NONE, 8]. With the fix, all four passed and put child8first:[8, NONE, NONE, NONE]. No tests were skipped, and the order stayed the same with sorting turned off.cargo xtask policyreported the same two file size violations on clean main and with the PR applied.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.