Shaders: emulate image_bvh intersect instructions as miss to enable lighting compute shaders #2189
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2191"
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 Xvania7 on 2026-11-25T07:21:25Z.
Closes #1533 (related to #876, #71, #274).
Summary
Emulates RDNA2 MIMG BVH traversal instructions image_bvh_intersect_ray (x0e6) and image_bvh64_intersect_ray (x0e7) as a clean miss so lighting/RTGI/shadow compute shaders (CS_RaytracingResolve,
tdirectionalshadows) translate and execute instead of failing with ShaderError::Unsupported:
Verification
Imported from Marvisak/VIctory. Originally posted by r4tedx on 2026-11-25T07:42:40Z.
A note for the triage, from reading this PR against
main940d32f:mainalready lowers both instructions for real, so this would replace a working lowering with a miss.crates/victory-shader/src/emit/lower.rs:7661:if name.starts_with("image_bvh") { return self.bvh(inst, b, i); }crates/victory-shader/src/emit/lower/bvh.rs: the ray against one box or triangle node, with the result in the hardware's encoding, so the program's own traversal runs (it came in with0b35b7f, and #1198 was closed for it).A miss for every ray was a reasonable way to get the lighting programs to translate while nothing lowered these instructions. On current
mainit would turn the real result into "nothing hit" for every program that traces. The PR also conflicts withmainin the same function.What still stops ray-tracing programs on
mainis elsewhere: in an offline count of940d32f, the 40 compute programs that useimage_bvh_intersect_rayare refused fora register joining a lane mask and data, read as data, which #1883 addresses (all 40 emit with it; with #2027 as well, all 40 validate). So my suggestion is to close this one in favour of what is inmain, and if #1533 is still open, to point it at #1883.Local title data was used for the count only (offline, CPU only, counts and reasons). Nothing was run for this comment beyond reading the code.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T07:44:52Z.
Thanks @r4tedx for checking against \
940d32f! Confirmed \main\ now includes full BVH intersection lowering (\�b35b7f\ / \lower/bvh.rs), so this miss fallback is superseded. Closing in favor of \main\ (and #1883 / #2027 for the remaining register-join validation on the 40 RT programs).Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T08:10:13Z.
Review: COMMENTED
Conflicts with current main (
940d32f69b) — verified locally:git merge origin/mainfails. image_bvh intersect emulation needs a rebase; I'll re-test after. The approach (emulate as miss) is sound for unsupported BVH-intersect instructions.Pull request closed