OLD-7640: restore old upstream PR 7640 - docs/bvh.md: the BVH4 parent table's start and extent (BUILD-1390) #748
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/748"
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 ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T13:26:13Z.
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 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).
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T13:30:34Z.
Review: APPROVED
Audited and verified. Clean-room compliant.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T13:30:48Z.
Review: APPROVED
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.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T22:29:19Z.
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).