Bvh: a TLAS takes an instance only from a built BLAS header #72
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/ThatRecompDev--five-star-recomp!72
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-72"
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?
@almostxxx27 on GitHub · 2026-11-28 19:50 UTC · original
almostxxx27:issues/34_HeaderCheckInInstancesDescs→main· +162 −5 · 4 files · 1 commits · merged 2026-11-28 21:29 UTCInstanceDescs read the root and bounds of every readable BLAS header, so a zeroed header (version 0, root 0) entered the TLAS as an instance with root node pointer 0 and empty bounds. InstanceDescs.IsBuilt now requires dword 0 low 16 bits = 6, bit 24 (serialized) clear and a box root (type 4 or 5) in dword 12; an instance that fails keeps InvalidNode, so XdxrTlas leaves it out like a null or unreadable BLAS.
AmdBvhLayout gains Box16Type and NodeTypeMask. InstanceDescsTests cover a built BLAS, a zeroed header, a still-serialized header, a triangle root and a box16 root. docs/raytracing.md TLAS row updated.
Refs #34
@ThatRecompDev on GitHub · 2026-11-28 20:56 UTC · original
thanks, this is a good catch. a zeroed or still-serialized header turning into a TLAS instance with root 0 is exactly the kind of thing that sends traversal somewhere it shouldn't go.
I checked the rule against what we have written down: version 6 in the low 16 bits, bit 24 as the serialized flag that rehydration clears, and the root pointer in dword 12 with its type in the low 3 bits all match docs/raytracing.md and what XdxrBlas.Build writes (0x80000006). the tests cover the cases I'd want, and CI is green on both.
one small thing to know: AmdBvhLayout lives in FiveStar.Shaders, and the program cache is keyed on that assembly's hash, so any change there means everyone re-translates once. that's fine this time, because a bigger translator change is about to land on main anyway, so this can ride along with it.
looks good to me.
@ThatRecompDev on GitHub · 2026-11-28 21:29 UTC · original
merged, thanks!
it went in right after today's big translator change, so the re-translation it causes is folded into the one everyone does anyway.
same note as on #71: we keep commit messages on main free of AI trailers, so the squash dropped the Co-authored-by line.