[PR #991] [CLOSED] RT-BCPACK-DECODER: BC6H, so the runtime decoder covers all six BCPack modes #1029

Closed
opened 2026-11-26 20:19:51 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/991
Author: @iFeyz
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: feat/bcpack-bc6h


📝 Commits (4)

  • a371a73 RT-BCPACK-DECODER: a runtime BCPack decoder, BC1/BC3/BC4/BC5, checked against tools/bcpack.py
  • eba0442 RT-BCPACK-DECODER: BC7, and a lenient policy for the request path
  • 182b8c1 RT-BCPACK-DECODER: BC6H, so the runtime decoder covers all six BCPack modes
  • 3a5f520 RT-BCPACK-DECODER: review of #991 - say that lenient decoding never applies Python's loose limit, and reuse bytes in decode()

📊 Changes

10 files changed (+4176 additions, -1 deletions)

View changed files

📝 docs/directstorage.md (+10 -1)
📝 runtime/CMakeLists.txt (+15 -0)
➕ runtime/src/bcpack.cpp (+956 -0)
➕ runtime/src/bcpack.h (+91 -0)
➕ runtime/src/bcpack_tables.h (+1173 -0)
➕ runtime/test/bcpack_test.cpp (+116 -0)
➕ runtime/test/bcpack_vectors.h (+1178 -0)
➕ runtime/test/bcpack_vectors.py (+355 -0)
➕ tests/test_bcpack_header.py (+48 -0)
➕ tools/bcpack_header.py (+234 -0)

📄 Description

Claimed in the coordination issue as: RT-BCPACK-DECODER (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136759575)

Depends on: #976, #982 (this branch is built on both; its last commit is this pull request)

What and why

The last BCPack mode for the runtime decoder: with BC6H, gta6rt_bcpack covers all six (BC1, BC3, BC4, BC5, BC6H,
BC7), so the DirectStorage request path can decode whatever BCPack request a title makes once it is wired.

  • BC6H (runtime/src/bcpack.cpp): _bc6h_blocks of tools/bcpack.py, refusing in its order: a mode symbol past
    13 at once (Status::bad_block), then a reference into the built-in history (unconfirmed_history;
    tools/bcpack_tables_bptc.py knows none of it), then anchor indices that do not fit their bit (bad_block).
    Lenient decoding (#982) reads the unknown history as zeros, as Python's provisional mode does, and counts those
    blocks and every block that predicts from one in Result::guessed.
  • Tables: tools/bcpack_header.py writes the 14 BC6H modes (code, transform, base and delta bits, regions,
    header size) and their header bit plans as _bc6h_plan computes them from the D3D11 layouts, so the layout strings
    are not parsed a second time in C++. It stops if the built-in BC6H history ever gains known entries.
  • Vectors: 80 BC6H chunks from tests/test_bcpack.py's encoder (mode symbols 0..13 and now and then one past 13,
    partitions, endpoint and index distances within the chunk or into the built-in history, random endpoint deltas,
    index deltas that keep the anchors representable, a few corrupted streams), with the strict and, where it
    succeeds, the provisional Python answers.
  • Docs: docs/directstorage.md, bcpack.h.

Not in this PR: the user's calibrated BC6H/BC7 history (strict refuses, lenient takes zeros) and the request-path
wiring, which goes on top of RT-DSTORAGE-DEST-PAGES.

Tested

  • bcpack_test: 120 lane cases and 250 chunk cases (90 BC1/BC3/BC4/BC5, 80 BC7, 80 BC6H) all agree with the strict
    Python decoder: 140 decoded to the same bytes, the others refused with the same class of error. Lenient decoding
    gives Python's provisional blocks on the 98 chunks where that succeeds and agrees with strict wherever strict
    decodes. MSVC /W4, no warning.
  • tests/test_bcpack_header.py, tests/test_docs_links.py, tests/test_text_write_line_endings.py,
    tests/test_tool_startup.py, scripts/check_no_game_data.py on every changed file.
  • Runtime (Windows 11, MSVC 2022 Build Tools, RelWithDebInfo, full build): ctest 302 of 306 pass, bcpack
    included. The 4 failures are the same as on main here (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

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of 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.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/991 **Author:** [@iFeyz](https://github.com/iFeyz) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/bcpack-bc6h` --- ### 📝 Commits (4) - [`a371a73`](https://github.com/ubiquitarianism/leonida/commit/a371a739c3aeda38642429d4fed01eb9605689fb) RT-BCPACK-DECODER: a runtime BCPack decoder, BC1/BC3/BC4/BC5, checked against tools/bcpack.py - [`eba0442`](https://github.com/ubiquitarianism/leonida/commit/eba0442ae36307e93e738f47841dad804ceeae9b) RT-BCPACK-DECODER: BC7, and a lenient policy for the request path - [`182b8c1`](https://github.com/ubiquitarianism/leonida/commit/182b8c1f0c12a47523141aa8b138ccd2f66ef1d7) RT-BCPACK-DECODER: BC6H, so the runtime decoder covers all six BCPack modes - [`3a5f520`](https://github.com/ubiquitarianism/leonida/commit/3a5f5207ae69b1554f9590158175de26d0dd4f78) RT-BCPACK-DECODER: review of #991 - say that lenient decoding never applies Python's loose limit, and reuse bytes in decode() ### 📊 Changes **10 files changed** (+4176 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/directstorage.md` (+10 -1) 📝 `runtime/CMakeLists.txt` (+15 -0) ➕ `runtime/src/bcpack.cpp` (+956 -0) ➕ `runtime/src/bcpack.h` (+91 -0) ➕ `runtime/src/bcpack_tables.h` (+1173 -0) ➕ `runtime/test/bcpack_test.cpp` (+116 -0) ➕ `runtime/test/bcpack_vectors.h` (+1178 -0) ➕ `runtime/test/bcpack_vectors.py` (+355 -0) ➕ `tests/test_bcpack_header.py` (+48 -0) ➕ `tools/bcpack_header.py` (+234 -0) </details> ### 📄 Description Claimed in the coordination issue as: RT-BCPACK-DECODER (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136759575) Depends on: #976, #982 (this branch is built on both; its last commit is this pull request) ### What and why The last BCPack mode for the runtime decoder: with BC6H, `gta6rt_bcpack` covers all six (BC1, BC3, BC4, BC5, BC6H, BC7), so the DirectStorage request path can decode whatever BCPack request a title makes once it is wired. - **BC6H** (`runtime/src/bcpack.cpp`): `_bc6h_blocks` of `tools/bcpack.py`, refusing in its order: a mode symbol past 13 at once (`Status::bad_block`), then a reference into the built-in history (`unconfirmed_history`; `tools/bcpack_tables_bptc.py` knows none of it), then anchor indices that do not fit their bit (`bad_block`). Lenient decoding (#982) reads the unknown history as zeros, as Python's provisional mode does, and counts those blocks and every block that predicts from one in `Result::guessed`. - **Tables**: `tools/bcpack_header.py` writes the 14 BC6H modes (code, transform, base and delta bits, regions, header size) and their header bit plans as `_bc6h_plan` computes them from the D3D11 layouts, so the layout strings are not parsed a second time in C++. It stops if the built-in BC6H history ever gains known entries. - **Vectors**: 80 BC6H chunks from `tests/test_bcpack.py`'s encoder (mode symbols 0..13 and now and then one past 13, partitions, endpoint and index distances within the chunk or into the built-in history, random endpoint deltas, index deltas that keep the anchors representable, a few corrupted streams), with the strict and, where it succeeds, the provisional Python answers. - **Docs**: `docs/directstorage.md`, `bcpack.h`. Not in this PR: the user's calibrated BC6H/BC7 history (strict refuses, lenient takes zeros) and the request-path wiring, which goes on top of RT-DSTORAGE-DEST-PAGES. ### Tested - `bcpack_test`: 120 lane cases and 250 chunk cases (90 BC1/BC3/BC4/BC5, 80 BC7, 80 BC6H) all agree with the strict Python decoder: 140 decoded to the same bytes, the others refused with the same class of error. Lenient decoding gives Python's provisional blocks on the 98 chunks where that succeeds and agrees with strict wherever strict decodes. MSVC `/W4`, no warning. - `tests/test_bcpack_header.py`, `tests/test_docs_links.py`, `tests/test_text_write_line_endings.py`, `tests/test_tool_startup.py`, `scripts/check_no_game_data.py` on every changed file. - Runtime (Windows 11, MSVC 2022 Build Tools, RelWithDebInfo, full build): `ctest` 302 of 306 pass, `bcpack` included. The 4 failures are the same as on `main` here (`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 - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:19:51 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1029
No description provided.