OLD-7640: restore old upstream PR 7640 - docs/bvh.md: the BVH4 parent table's start and extent (BUILD-1390) #748
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!748
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/748/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?
@aslan2142 on GitHub · 2026-11-24 13:26 UTC · original
aslan2142:build1390-bvh4-parent-table→main· +117 −12 · 3 files · 1 commits · merged 2026-11-25 22:29 UTCClaimed in the coordination issue as: OLD-7640 #14
Restoration of my original pull request, old upstream PR 7640 in
ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at2d73c242fd. The cherry-pick applied cleanly. Changes in the rebase:#690 and #626 also touch
docs/bvh.md, but both merge cleanly with this branch.What and why
docs/bvh.md§3.1 replaced the console BVH4 parent table's start and size with an "Open:" line. This pull request puts the rules there instead:offsetToParents = 0x40 - (((offsetToNodes - offsetToElements) / 16) & ~127). The leaf entries' whole 128-byte blocks fall below the header end, so the first box node's entry lands in[0x40, 0xc0).offsetToElementsis the end of the last entry, rounded up to 128.offsetToElementsare all zero.totalSizeIn64BNodes + 1also counts the level table's units, which have no entry. That is why an end computed from the header alone missed on about 13,400 streams.bvh4packs. Each rule holds on every stream it applies to. The doc's table has counts only.tools/bvh_packing_check.pychecks three new rules:parent_offset,parent_area_nonzeroandparent_extent. It also gets two helpers,parent_tableandelements_after_parents.tests/test_bvh_packing_check.py:Tested
python -I tests/test_bvh_packing_check.py:tests/test_docs_*.py(12 files): all pass.python -m compileall -q tools tests: ok.git diff --check: clean.python -I scripts/check_no_game_data.pyon the three changed files: clean.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)AI-assisted (Claude Code, Claude Opus 5.5).
@abnalstlll-byte on GitHub · 2026-11-24 13:30 UTC · original · approved these changes
Audited and verified. Clean-room compliant.
@abnalstlll-byte on GitHub · 2026-11-24 13:30 UTC · original · approved these changes
LGTM. Thoroughly verified reverse-engineering of the BVH4 parent table layout (offsetToParents and offsetToElements calculations) across 272,874 streams in docs/bvh.md, validated in ools/bvh_packing_check.py with synthetic tests in ests/test_bvh_packing_check.py.
@aslan2142 on GitHub · 2026-11-25 22:29 UTC · original
Merged:
docs/bvh.md: the BVH4 parent table's start and extent.main, and no review point is open.tests/test_bvh_packing_check.pypasses onmain+ this head (Linux, CPython 3.14).main45129e6bc+2e4ef18d8: the semantic suite passes (492 files, 6,315 tests, 0 files failed);test_bvh_packing_checkpass; the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 3 changed files.AI-assisted (Claude Code, Claude Opus 5.5).