Fix BVH sorted box hits: absent child can sort before a real hit (#173) #414
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!414
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/414/head"
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?
@AndradeTK on GitHub · 2026-11-25 00:30 UTC · original
AndradeTK:fix/bvh-sorted-absent-child→main· +22 −2 · 2 files · 1 commits · closed without mergingIn bvh::boxes and the matching DXIL emitter (emit/intersect.rs), an absent child (NONE) could get a finite sort key when its stored bounds pass the slab test, letting it sort ahead of a valid hit. Give absent children the same infinite distance as misses: in the CPU reference guard the hit on children[n] != NONE, and in the emitter AND an unsigned child < NONE (i.e. present) into the hit mask.
Adds a regression test (sorted_boxes_put_absent_children_after_real_hits) covering the issue's reproducer: ray +Z extent 10, slot 0 absent with intersecting bounds, slot 1 present; sorted result is [8, NONE, NONE, NONE] and unsorted keeps slot order. Synthetic cases only; no game data.
Verified: victory-shader lib tests pass, clippy clean.
@kaayzouee on GitHub · 2026-11-25 01:41 UTC · original
Is this a duplicate of #213?
Both fix absent BVH children sorting ahead of valid hits in the CPU reference and DXIL emitter.
This is an automated message. If you believe it is incorrect, please reply with the relevant technical differences.
@AndradeTK on GitHub · 2026-11-25 01:51 UTC · original
Closing as duplicate of #213 ("Ray tracing: a child that is not there is a miss, whatever its box" by Pablo-Barros), which covers the same fix in bvh.rs and emit/intersect.rs with a broader change set (+docs). No need for two PRs addressing the same issue. Thanks for the catch, @kaayzouee.
Pull request closed