mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:30:53 +01:00
[PR #1044] RT-BCPACK-DECODER: the user's calibrated BC6H/BC7 history in the runtime decoder and the request path #1082
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#1082
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/1044
Author: @iFeyz
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:feat/bcpack-history📝 Commits (6)
a371a73RT-BCPACK-DECODER: a runtime BCPack decoder, BC1/BC3/BC4/BC5, checked against tools/bcpack.pyeba0442RT-BCPACK-DECODER: BC7, and a lenient policy for the request path182b8c1RT-BCPACK-DECODER: BC6H, so the runtime decoder covers all six BCPack modes3a5f520RT-BCPACK-DECODER: review of #991 - say that lenient decoding never applies Python's loose limit, and reuse bytes in decode()e006370RT-BCPACK-DECODER: DirectStorage BCPack requests decode through the runtime decoderf7a18eeRT-BCPACK-DECODER: the user's calibrated BC6H/BC7 history in the runtime decoder and the request path📊 Changes
14 files changed (+5320 additions, -47 deletions)
View changed files
📝
docs/directstorage.md(+43 -13)📝
runtime/CMakeLists.txt(+19 -2)📝
runtime/shims/dstorage.cpp(+135 -24)➕
runtime/src/bcpack.cpp(+1082 -0)➕
runtime/src/bcpack.h(+111 -0)➕
runtime/src/bcpack_tables.h(+1173 -0)➕
runtime/test/bcpack_test.cpp(+157 -0)➕
runtime/test/bcpack_vectors.h(+1584 -0)➕
runtime/test/bcpack_vectors.py(+417 -0)📝
runtime/test/dstorage_test.cpp(+137 -8)➕
tests/test_bcpack_header.py(+48 -0)➕
tests/test_bcpack_history_sidecar.py(+97 -0)➕
tools/bcpack_header.py(+234 -0)➕
tools/bcpack_history_sidecar.py(+83 -0)📄 Description
Claimed in the coordination issue as: RT-BCPACK-DECODER (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136759575)
Depends on: #976, #982, #991, #1020 (this branch is built on them; its last commit is this pull request)
What and why
The repository carries no built-in BC6H or BC7 BCPack history (
tools/bcpack_tables_bptc.pyknows none of it), so theruntime decoder refuses (strict) or zeroes (lenient) every block that reads it, and the retail title's BC7 textures
come out with wrong blocks wherever they do. A user who has calibrated that history from their own copy
(
tools/bcpack_history_calib.py, the--historyJSON oftools/bcpack.py) can now hand it to the runtime.tools/bcpack_history_sidecar.py: the history JSON (a file, a folder withbc6h.json/bc7.json, or a dict),read by
load_bc6h/load_bc7themselves, so the same merging and mid-range fill astools/bcpack.py, written asa 60,936-byte
BCPHIST1sidecar. The layout is the profile of @Moriz82's integration branch in #984(
tools/gen_bcpack_runtime_tables.py --profile), field for field as far as reading that code shows (I did not runit), so one file can serve both.
runtime/src/bcpack.{h,cpp}:Historygains the BC6H and BC7 tables andread_history_sidecar._bc7_checkchecks it, every bit the block's mode readsknown, then confirmed. Per read instead of the per-entry maximum Python takes, which refuses exactly the same
chunks: a slot short for one reader is short for the maximum. The rebuild starts from the calibrated endpoints and
indices.
_bc6h_blocksdoes.as Python's provisional mode counts them.
runtime/shims/dstorage.cpp: the request path reads the sidecar once, fromLEONIDA_BCPACK_HISTORYor elsebcpack_history.binnext to the executable, and decodes with it. A file that is not a sidecar is ignored with alog line. The sidecar comes from the user's own data and stays on their machine.
docs/directstorage.md.Not in this PR: calibrated BC1/BC3/BC4/BC5 history in the request path (
History::valuestakes it, the sidecar doesnot carry it).
Tested
bcpack_test: a synthetic history (BC7 entries known and confirmed, known only, partly known or absent; BC6Hentries confirmed with every bit, short of bits, fitted, last resort or unknown), its sidecar written by the tool,
and 120 BC6H/BC7 chunks that read it often, each with
tools/bcpack.py's strict and provisional answers for thatsame history. All agree: 28 strict decodes (8 of them decode only with the history) and 66 provisional ones. A
sidecar with the wrong magic or size is refused. The earlier 370 cases without history are unchanged. MSVC
/W4,no warning.
dstorage_test: 354 checks, 0 failures; a chunk decodes to Python's blocks through the queue with the sidecar namedby
LEONIDA_BCPACK_HISTORY, and would not without it.tests/test_bcpack_history_sidecar.py: known values at their offsets, the empty history (all zero), the commandline (writes, refuses its own input, a missing file is an error and not a traceback).
ctest302 of 306 pass,dstorageandbcpackincluded. The 4 failures are the same as onmainhere (d3d12_clear,d3d12_execute_indirect_validation,d3d12_texture_tiles,d3d12_pipeline_library_host, all already reported in#14).
tests/test_bcpack_header.py,tests/test_docs_links.py,tests/test_tool_startup.py,tests/test_text_write_line_endings.py,scripts/check_no_game_data.pyon every changed file.tests/test_tool_stdout_encoding.pylists onlytools/native_pso_hashes.py, red onmaintoo.GPUs tested: n/a (CPU only)
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.