Repository navigation
Shaders: preserve 64-bit node offsets and descriptor alignment in built BVH paths (fixes #2368) - #2402
Shaders: preserve 64-bit node offsets and descriptor alignment in built BVH paths (fixes #2368)#2402Xvania7 wants to merge 2 commits into
Conversation
…lt BVH paths (fixes Marvisak#2368)
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: merged into main 940d32f, cargo test -p victory-shader --locked on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — 64-bit node offsets and descriptor alignment preserved.
|
Thanks @catminou4 for the macOS validation and approval! To complement your ARM64 test pass, we verified this on native Windows 10 x64 + NVIDIA GeForce RTX 5060:
Ready for upstream merge into |
|
I ran the same translated compute test on Windows/WARP with three sparse synthetic guest pages. Each node has one hittable child, so the readback identifies the address used by the shader.
Test-only commit 1f8ce62 is directly on 5e873ab if this narrower PR is selected. The base was 940d32f. All 15 BVH tests passed here. The full shader suite moved from 244 passed / 4 failed / 3 ignored to 245 passed / 3 failed / 3 ignored. The three shared failures are gather, lane permute and edge-flagged triangles under this WARP runtime. Strict shader Clippy and staged asset policy passed. #2040 covers these address cases in its own fixture and also has tests for masked lanes and a non-address buffer fallback. Its 18 BVH tests passed here with the independent test included. Please keep the Git author if you cherry-pick the test. If you fold the fixture into another commit, please add: Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com |
|
@andrewpozdnakov7-jpg Thanks for running the Windows/WARP compute tests across the sparse guest page scenarios and verifying all 15 BVH tests pass cleanly on The readback breakdown on low byte 0x80 alignment, 4 GiB offsets, and high word preservation proves the 64-bit root decoding works as expected without clipping. Happy to fold your synthetic test fixture commit |
Use three sparse synthetic pages and distinct child IDs to check descriptor base alignment and node offsets crossing 4 GiB and 32 GiB through the translated compute shader.
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:
- Preserving 64-bit node offsets and descriptor alignment in built BVH paths (
#2368) passes all unit and live GPU BVH intersection tests. cargo test -p victory-shader bvh: 15/15 passed on RTX 5090, 15/15 passed on WARP (includingroot_built_bvh_uses_aligned_base_and_wide_node_offsetsand all GPU intersection tests).cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.
AI-assisted (Gemini 4 Neon).
|
Thanks @DenRakEiw for testing across NVIDIA GeForce RTX 5090 and WARP, and verifying all 15/15 BVH unit and GPU intersection tests pass cleanly! Ready for upstream merge. |
|
Automated triage for the maintainers. Proposed close (duplicate). Thanks for picking up #2368; the change looks sound: in This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. Generated by Claude Code |
Fixes #2368.
Summary
Addresses the address-calculation inconsistency reported by @FunWithFlagsDev in #2368 between the root-derived (
Source::Built) and explicit-address BVH lowering paths.Previously,
crates/victory-shader/src/emit/lower/bvh.rscalculated node offsets inSource::Builtusing a 32-bit shift (Bin::Shl, lo, three), losing the upper bits of node pointers when offsets crossed 4 GiB, droppingnode_hi, and ignoring the descriptor's 256-byte quantization.Changes
crates/victory-shader/src/emit/lower/bvh.rs:Source::Builthas root memory address available (root_address(src).is_some()), route to the explicit descriptor decoder path instead of truncating via 32-bit arithmetic.wide64(self, lo, node_hi.unwrap_or(zero)) << 3), preserves the descriptor's 256-byte base quantization (wide64(d[0], d[1] & 0xFF) << 8), and preserves the existing title-memory bounds-checking pipeline.root_address(src).is_none()) and resource tracking unchanged.Verification
cargo test -p victory-shader emit::bvh_tests::boxes_passed (1/1).cargo test -p victory-shader emit::lower::testspassed (21/21).cargo clippy -p victory-shaderpassed with 0 warnings.cargo run -p xtask policyverified clean (182 files ok).