Shaders: opt-in VICTORY_BVH_MISS to miss BVH nodes at the root #3398
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3398"
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 Marvisak/VIctory. Originally posted by danielibabet on 2026-11-26T22:08:16Z.
Summary
Adds an opt-in
VICTORY_BVH_MISS=1switch (off by default) incrates/victory-shader/src/emit/lower/bvh.rsto return a node miss at the root without reading BVH memory or running box/triangle tests, plus includes it in theshader_cachebuild key.Why
When the title's BVH structure builder is inactive (e.g., on 32-lane hosts where 64-lane compute shaders are refused), BVH memory holds stale nodes. Skipping BVH traversal at the root avoids stalls/hangs and saves ~10 ms/frame while keeping default behaviour unchanged unless
VICTORY_BVH_MISS=1is set.Credits
Adapted from
trustno1-coder/VIctory-NVIDIA(VICTORY_BVH_MISS=1).Verification
cargo test -p victory-gpu --lib shader_cache:: -- --test-threads=1(4/4 passed)cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings(clean)cargo xtask policy(191 files ok)Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T22:29:12Z.
Review: APPROVED
LGTM — verified on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).VICTORY_BVH_MISSis cleanly isolated, included in the shader cache key, and leaves default BVH traversal untouched.cargo test -p victory-shader --lib emit::bvh_tests:: -- --test-threads=1: 14 passed, 0 failed.cargo test -p victory-gpu --lib shader_cache:: -- --test-threads=1: 4 passed, 0 failed.cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:36:59Z.
Windows 11,
63bcca4+ this PR:cargo test -p victory-shader --lib --features host bvh: 14 passed (1.29 s).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.No test is added: the switch gates a translation path (
VICTORY_BVH_MISS) and the existing BVH tests pass unchanged. I did not exercise the switch itself — that needs a shader that reads BVH nodes, which is title-side. Synthetic only. AI-assisted.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T23:15:12Z.
Review: APPROVED
Reviewed
846362d0merged ontomain(63bcca43) — clean opt-in BVH miss switch with proper shader-cache isolation.Verification
cargo xtask policy: 191 files ok;cargo clippy --locked -p victory-shader -p victory-gpu --all-targets -- -D warnings(both default and--features diagnostics): 0 warnings.victory_shader::emit::bvh_miss()(emit/mod.rs:270) is off by default and included in the shader-cache key (shader_cache.rs:71, 79-85) with unit-test coverage (shader_cache.rs:492), preventingVICTORY_BVH_MISS=1translations from polluting normal cache entries.victory-shaderBVH tests (14/14) andvictory-gpushader_cache::tests::(4/4) passed with default settings on RTX 5090 and WARP.dxil.dllprobe withVICTORY_BVH_MISS=1: ran all 4 combinations (image_bvh_intersect_rayandimage_bvh64_intersect_ray× root SRV and title-memory pointers) over 256 lanes with node memory poisoned (0xDEAD_BEEF) on both RTX 5090 and WARP — every shader passeddxil.dllvalidation, read no node memory, and returned exact[+Inf, 1.0, 0, 0]for triangle nodes (ty < 4) and[0xFFFF_FFFF; 4]for non-triangle nodes (ty >= 4), matchingbvh_triangle/bvh_boxmiss sentinels (bvh.rs:192-209).LGTM.
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.