mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1020] [CLOSED] RT-BCPACK-DECODER: DirectStorage BCPack requests decode through the runtime decoder #1057
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#1057
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/1020
Author: @iFeyz
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:feat/dstorage-bcpack📝 Commits (5)
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 decoder📊 Changes
12 files changed (+4398 additions, -47 deletions)
View changed files
📝
docs/directstorage.md(+32 -13)📝
runtime/CMakeLists.txt(+19 -2)📝
runtime/shims/dstorage.cpp(+96 -24)➕
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)📝
runtime/test/dstorage_test.cpp(+100 -8)➕
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; the request-path wiring, which @DadaCap handed to this claim in comment 7136979744)
Depends on: #976, #982, #991 (the decoder; this branch is built on them, its last commit is this pull request)
What and why
The DirectStorage shim refuses every BCPack request with
E_NOTIMPL, and the retail title asks for BCPack modes 1,5 and 7 (@DesertGamer's counts, #14 comment 7135719755). This serves them through the runtime decoder of #976/#982/#991.
execute_request: swizzle staysE_NOTIMPL(no retail request measured asks for it), and so does BCPack mode 2(BC2 has no BCPack form).
IntermediateSizemust be set exactly on a zlib + BCPack request and is held to the32 MiB limit of a staging buffer; a BCPack
DestinationSizeonly has to be non-zero (a chunk's size against itsblocks depends on the texture).
unpack_request: the source goes into a staging buffer, is inflated to exactlyIntermediateSizebytes firstwhen the request is zlib too (the zlib failure codes are now shared with
inflate_requestthroughinflate_exact),then decoded by
leonida::bcpack::decode, lenient: a block on built-in history nobody has measured decodes fromthe zero state and is logged once, so a texture has a few wrong blocks instead of missing (the choice of DadaCap's
prototype). A chunk the decoder refuses is
E_DSTORAGE_DECOMPRESSION_ERRORand leaves the destination as it was.BCPack requests count in the decompression statistics as zlib ones do.
gta6rtanddstorage_testlinkgta6rt_bcpack.docs/directstorage.mddescribes the path.With destination pages: every BCPack request measured on the retail title also has the destination-pages bit, so
it reaches this path once RT-DSTORAGE-DEST-PAGES (#969) is in: its
paged_requestruns the plain request into astaging buffer, which is this code, then writes the pages. The two pull requests touch different parts of
execute_request; whichever lands second takes a small rebase.Tested
dstorage_test: 351 checks, 0 failures. New: BC1 and BC7 chunks frombcpack_vectors.hdecode through the queue tothe Python decoder's blocks, a BC7 chunk on unknown history to Python's provisional blocks, a BC1 chunk inside a
stored zlib stream to the same blocks; a corrupt chunk, a destination that is not whole blocks, a zlib + BCPack
request without
IntermediateSize, one whose stream is longer than it and one with no destination size each gettheir code, and a failed request leaves its destination untouched. The old "BCPack is not implemented yet" cases
now expect mode 2's refusal and the zlib + BCPack size error, and the statistics counts follow.
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).
scripts/check_no_game_data.pyon every changed file,tests/test_docs_links.py.boot-prototype,
test/ab-prototypeon https://github.com/iFeyz/leonida, can decode every request with both decodersand count where they agree (
LEONIDA_BCPACK_CROSSCHECK=1), for anyone who can run it.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.