mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #982] [CLOSED] RT-BCPACK-DECODER: BC7 in the runtime BCPack decoder, and a lenient policy for the request path #1019
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#1019
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/982
Author: @iFeyz
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:feat/bcpack-bc7📝 Commits (2)
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 path📊 Changes
10 files changed (+3493 additions, -1 deletions)
View changed files
📝
docs/directstorage.md(+11 -1)📝
runtime/CMakeLists.txt(+15 -0)➕
runtime/src/bcpack.cpp(+818 -0)➕
runtime/src/bcpack.h(+89 -0)➕
runtime/src/bcpack_tables.h(+970 -0)➕
runtime/test/bcpack_test.cpp(+117 -0)➕
runtime/test/bcpack_vectors.h(+921 -0)➕
runtime/test/bcpack_vectors.py(+312 -0)➕
tests/test_bcpack_header.py(+48 -0)➕
tools/bcpack_header.py(+192 -0)📄 Description
Claimed in the coordination issue as: RT-BCPACK-DECODER (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136759575)
Depends on: #976 (this branch is built on it; its first commit is #976's, the second is this pull request)
What and why
BC7 is the mode the retail title asks for most among the BCPack requests the DirectStorage shim refuses today
(@DesertGamer's counts, #14 comment 7135719755). This adds it to the runtime decoder of #976, and a second policy the
request path will need.
runtime/src/bcpack.cpp):_bc7_checkthen_bc7_rebuildoftools/bcpack.py, in that order, so a chunkis refused for the same reason as in Python: a signature outside the table (
Status::bad_block), an inferredsignature or a reference into the built-in history (
unconfirmed_history;tools/bcpack_tables_bptc.pyknows nobit of the BC7 built-in history), then the anchor / p-bit consistency check (
bad_block). The rebuild follows thestructure of @DadaCap's prototype port, which they offered in #14 (comment 7136979744); credited as co-author.
Options/Result): strict stays the default and is what the vectors hold to Python. Lenient,for the request path, decodes what strict refuses for its history, an inferred signature or a consistency check,
from the zero state where the history is unknown (exactly what Python's provisional mode rebuilds for BC7), and
counts in
Result::guessedevery such block and every block that predicts from one. A texture then has a few wrongblocks instead of missing, which is DadaCap's choice for the prototype. A signature outside the table is refused
under both.
tools/bcpack_header.pyalso writes the BC7 signature configurations, the rank of every lane-15 symbolpair, the D3D11 partitions and anchors, and the inferred ranks. It stops if the built-in BC7 history ever gains
known bits, so they cannot be left out silently.
tests/test_bcpack.py's encoder (one signature per block, now and then an inferredone; endpoint and index distances within the chunk or into the built-in history; random endpoints; indices that
mostly keep the anchor bit representable; a few corrupted streams), each with the strict Python answer and, where
Python's provisional decode succeeds, its blocks.
docs/directstorage.md.Not in this PR: BC6H (still
unsupported_codec), the user's calibrated BC7 history (strict refuses, lenient takesthe zero state), and the request-path wiring, which DadaCap handed to this claim and which goes on top of
RT-DSTORAGE-DEST-PAGES.
Tested
bcpack_test: 120 lane cases and 170 chunk cases (90 BC1/BC3/BC4/BC5, 80 BC7) all agree with the strict Pythondecoder: 95 decoded to the same bytes, the others refused with the same class of error. Lenient decoding gives
Python's provisional blocks on the 36 chunks where that succeeds, agrees with strict wherever strict decodes (no
guessed block there), and takes 67 chunks with guessed blocks. MSVC
/W4, no warning.tests/test_bcpack_header.py(both generated headers current),tests/test_docs_links.py,tests/test_text_write_line_endings.py,tests/test_tool_startup.py,scripts/check_no_game_data.pyon everychanged file.
tests/test_tool_stdout_encoding.pylists onlytools/native_pso_hashes.py, red onmaintoo.ctest302 of 306 pass,bcpackincluded. The 4 failures are the same as on
mainhere (d3d12_clear,d3d12_execute_indirect_validation,d3d12_texture_tiles,d3d12_pipeline_library_host, all already reported in #14).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.