OLD-7640: restore old upstream PR 7640 - docs/bvh.md: the BVH4 parent table's start and extent (BUILD-1390) #748
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!748
Loading…
Reference in a new issue
No description provided.
Delete branch "build1390-bvh4-parent-table"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: OLD-7640 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7132777216
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 at 2d73c242fddfe26d57b52ee150704e6c3b23cff4. 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).
Audited and verified. Clean-room compliant.
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.
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).