Shaders: support BVH a16 ray directions and unsorted box nodes #1794
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1794
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1794"
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?
@ESAT586 on GitHub · 2026-11-24 22:42 UTC · original
ESAT586:shader/bvh-a16-and-unsorted-boxes→main· +383 −75 · 3 files · 1 commits · openSummary
Extends image_bvh_intersect_ray and image_bvh64_intersect_ray emulation on top of
70564aeto support two previously refused RDNA2 ray-tracing forms:ay_extent and
ay_origin.xyz in 32.
esource::bvh_descriptor to accept descriptor dword 1 with bit 31 either set or clear — including descriptors whose dword 1 comes straight from s_lshr_b64 with no s_or_b32, as well as chained set_bits — while continuing to refuse unemulated flags (non-zero ox_growth, node-count bounds, riangle_return_mode == 0).
@upipibi on GitHub · 2026-11-24 22:50 UTC · original
NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug,
72ebd96(onmain70564ae).cargo test -p victory-shader --locked -- bvh: 18 passed, 0 failed. That includes the GPU ones:intersections_with_a16_on_the_gpu_equal_the_reference,unsorted_box_intersections_on_the_gpu_equal_the_reference,intersections_on_the_gpu_equal_the_reference, the 64-bit pointer form and the title-memory nodes.AI-assisted (Claude Code). Synthetic tests only.
@Marvisak on GitHub · 2026-11-25 06:25 UTC · original
Automated triage for the maintainers.
Merge candidate.
image_bvh{,64}_intersect_ray(crates/victory-shader/src/emit/lower/bvh.rs) now acceptsa16and box nodes with sorting disabled;resource.rsaccepts descriptors with bit 63 clear. I checked the a16 operand layout (three dwordsdir.x|dir.y,dir.z|inv.x,inv.y|inv.z, low half first, extent and origin kept f32) against the RDNA2 ISA's ray-tracing operand description, which the commit cites;legacyF16ToF32is DXIL op 131 as used. With sorting off, children come back in slot order with misses left as the invalid pointer in place; the sort network is skipped statically for built descriptors and selected at run time from dword 1 bit 31 for raw ones. Still-unemulated flags (box growth, node bound, return mode 0) andd16results stay refused.One caveat for the reviewer: the reference the tests compare against is the PR's own, so they check consistency, not hardware; a run of a title shader that uses a16 would be the stronger check. An RTX 3070 run in this thread passed all 18 BVH tests.
CI: no check runs on the head commit.
Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 01:02 UTC · original
Code review and RTX 5090 + WARP + DXIL verification at head
72ebd96862cdmerged cleanly ontomain(63bcca43c6a0; adds 0 bytes toemit/lower.rs, staying at520,563B):crates/victory-shader/src/emit/lower/bvh.rs:593-687, 734-752,resource.rs:1384-1415):a16unpacking keepsd16rejected, extracts low/high 16-bit halves from the 3 packed ray-direction/inverse-direction dwords (w & 0xFFFF/ logicalw >> 16), and widens via DXIL op 131legacyF16ToF32(preserving±0/±Inf/NaN/subnormals).resource.rspeels nesteds_or_b32/s_bitset1_b32constant flag bits viaset_bits, accepts bit 63 (box_sort_en) as either0or1, and continues rejecting any other unmodeled flag bits (flags & !0x8000_0000 != 0) or non-1 triangle return mode;Source::Builtskips the 5-stage sorting network statically whenfalse, whileNodes::Rawdynamically selects sorted vs child-slot order fromd[1] & 0x8000_0000.dxil.dll10.0.26100.0, Rust 1.98.1):cargo xtask policy:191 files ok;cargo clippy --locked -p victory-shader --tests -- -D warnings: 0 warningsbvh_tests emit::lower::tests: 51/51 passed across RTX 5090 and WARP (bvh_testsexplicitVICTORY_WARP=1: 18/18 passed), including the newa16and unsorted box GPU reference tests.Clean and stays completely out of
lower.rs's 512 KiB budget; 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.