Repository navigation
OLD-7640: restore old upstream PR 7640 - docs/bvh.md: the BVH4 parent table's start and extent (BUILD-1390) - #748
Merged
aslan2142 merged 1 commit intoNov 25, 2026
Conversation
offsetToParents = 0x40 - (((offsetToNodes - offsetToElements) / 16) & ~127), so the first box node's entry lands in [0x40, 0xc0); one entry per box unit follows, and offsetToElements is their end rounded up to 128. The bytes from 0x40 to offsetToElements are zero. Holds on all 272,874 streams of core_bvh4.rpf and shared_minigame000_bvh4.rpf (272,858 box roots for the extent); counts only. totalSizeIn64BNodes + 1 also counts the level table's units, which have no entry: that is why the header-only end missed on about 13,400 streams. tools/bvh_packing_check.py checks the three rules (parent_offset, parent_area_nonzero, parent_extent); the synthetic fixture moves to the console layout for its four leaves and three BOX16 units. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
abnalstlll-byte
approved these changes
Nov 24, 2026
abnalstlll-byte
left a comment
Contributor
There was a problem hiding this comment.
Audited and verified. Clean-room compliant.
- Measures and documents BVH parent table layout and zero-padded region before offsetToElements in docs/bvh.md.
- Implements parent_table and elements_after_parents in tools/bvh_packing_check.py with full test coverage in tests/test_bvh_packing_check.py.
abnalstlll-byte
approved these changes
Nov 24, 2026
abnalstlll-byte
left a comment
Contributor
There was a problem hiding this comment.
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.
Collaborator
Author
|
Merged:
AI-assisted (Claude Code, Claude Opus 5.5). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: OLD-7640 #14 (comment)
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 2d73c24. 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).