mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #2236] build_dstorage_history: fit missing BPTC history slots across multi-level sibling mips (DSTORAGE-MULTILEVEL-MIP-FIT) #2240
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2240
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2236
Author: @zmasi
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/dstorage-multilevel-bcpack-fit📝 Commits (1)
16a9550tools/dstorage: fit missing BPTC history slots across multi-level sibling mips📊 Changes
3 files changed (+351 additions, -4 deletions)
View changed files
📝
docs/directstorage.md(+6 -4)➕
tests/test_dstorage_multilevel_fit.py(+154 -0)📝
tools/build_dstorage_history.py(+191 -0)📄 Description
Claimed in the coordination issue as:
DSTORAGE-MULTILEVEL-MIP-FIT(https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7188273837)What and why
calibrate_from_poolsandfit_slicesintools/build_dstorage_history.pyonly pair BC6H and BC7 chunks with immediatelevel ± 1raw or zlib neighbor mips. When a mixed-codec texture stores lossless raw/zlib atmip[0](<= 1 MiB) and BCPack acrossmips[1..N], packed tail and mid-chain BC7/BC6H mips at|level - ref_level| >= 2are never visited, leaving initial-history slots (eslot = 256 + i - de,islot = 256 + i - di) at0bits and causingruntime/src/bcpack.cpp(missing-endpointat:387) to reject the stream with0x89240030(E_DSTORAGE_DECOMPRESSION_ERROR) when transitive descendants exceedmax(2, blocks / 1024).fit_distant_mipsruns aftercalibrate_from_poolsandfit_slices(preserving full precedence of existing adjacent-mip, array, and cubemap fits viaextend_missing) and scans only BC6H/BC7 chunks whose 256-block prefix still references an unfitted slot (77 / 5,167BC7 chunks across the 57 retail pools), pairing those mips with the closest raw or zlib mip on the same layer across multi-level mip distances (child upsample fordelta_level < 0, parent box average fordelta_level > 0) ahead of the nativebcpack_history_trainfull-stream constraint pass.Across all 57 v1.0.2.1 pools (
5,435BPTC streams evaluated at strictdivisor = 1024, counts only):4,228 / 6,144->4,336 / 6,144(+108); index fields8,160 / 8,192.210 / 256->226 / 256(+16); indices249 / 256->251 / 256(+2).0 / 268(100%pass).60 / 5,167->18 / 5,167(-70%), resolving25 / 25mixed-codec BC7 streams (including both world-load0x89240030missing-endpointrequests, each decoding with0unknown blocks and0consistency violations atdivisor = 1024). The remaining 18 streams belong to pure-BCPack textures with no raw or zlib mips.Tested
python -m compileall -q make_game.py tools tests(exit 0)python -I tests/test_dstorage_multilevel_fit.py -v(3/3synthetic multi-level BC7 downsample, BC7 upsample, and BC6H + slot-precedence tests pass; fails withoutfit_distant_mips)python -I -m unittest discover -s tests -p "test_dstorage_*.py" -v(7/7pass, includingbcpack_history_trainintegration)python -I tests/test_bcpack_history_calib.py -v(19/19pass)python -I tests/test_text_write_line_endings.py&python -I -m unittest discover -s tests -p "test_docs_*.py"(55/55pass)python -I scripts/check_no_game_data.py tools/build_dstorage_history.py docs/directstorage.md tests/test_dstorage_multilevel_fit.py(exit 0)bcpack_history_trainrefinement on Windows 11 (fit_distant_mipspass: ~88 s)GPUs tested: n/a (CPU calibration tool and unit tests; verified on Windows 11 x64, Ryzen 9 5950X / RTX 3090 host)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.