textures: verify the published mode-6 BCPack vector through GPU readback #447

Merged
descent81 merged 1 commit from upstream-pr/453 into main 2026-11-22 04:36:50 +00:00
descent81 commented 2026-11-22 04:30:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by descent81 on 2026-11-22T04:30:47Z.


Fixes #442.

Motivation

Issue #442 supplies a 104-byte synthetic BCPack stream and the exact 16 bytes it should produce when decoded as BC7. This PR keeps timelery’s original input and expected block together and checks a second boundary: when that block is uploaded as a 4×4 BC7 texture, do the CPU decoder and the GPU agree on the color and alpha of every texel?

Coverage

Stage Expected result
Strict BCPack decode Codec 7 produces 40317204a56819be023456789abcdef0 with an empty provisional set.
CPU BC7 decode All 64 RGBA8 bytes match the fixed reference in raster order.
D3D12 sampling The translated copy shader returns the same 16 texels on hardware and WARP.
Selector control Changing the final selector from 15 to 0 changes only the last texel.

The two endpoint colors are (197, 71, 41, 25) and (144, 160, 180, 124). Clearing the high nibble of the final byte selects the first endpoint for the last texel. The CPU control checks that the first 60 bytes stay identical and the final four become c5 47 29 19.

Reproduction

After a Windows dev build:

python -B tests/bc7_blocks_check.py -v
ctest --preset dev --no-tests=error -R '^bc7_draw_(hardware|warp)$' -V

The normal CPU and GPU checks use repository data. To repeat the compressed-byte comparison, point BCPACK_REFERENCE_TOOLS at the local tools directory from Leonida revision 03d1e118a676d73aba66b1793cf033f6ad23b2b2, then rerun the Python command. The check calls decode_with_info with allow_provisional=False and verifies both the block and the provisional set.

Observed results

With the pinned Leonida decoder, nine Python tests passed. The existing optional texture2ddecoder comparison was skipped because that package was absent. Both bc7_draw_hardware on GeForce RTX 4060 and bc7_draw_warp passed.

This is one synthetic zero-history block. Reconstruction with preset history and comparison with Xbox hardware remain open.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6538453939 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/453). Originally posted by [descent81](https://github.com/descent81) on 2026-11-22T04:30:47Z. --- Fixes #442. ## Motivation Issue #442 supplies a 104-byte synthetic BCPack stream and the exact 16 bytes it should produce when decoded as BC7. This PR keeps timelery’s original input and expected block together and checks a second boundary: when that block is uploaded as a 4×4 BC7 texture, do the CPU decoder and the GPU agree on the color and alpha of every texel? ## Coverage | Stage | Expected result | | --- | --- | | Strict BCPack decode | Codec 7 produces `40317204a56819be023456789abcdef0` with an empty provisional set. | | CPU BC7 decode | All 64 RGBA8 bytes match the fixed reference in raster order. | | D3D12 sampling | The translated copy shader returns the same 16 texels on hardware and WARP. | | Selector control | Changing the final selector from 15 to 0 changes only the last texel. | The two endpoint colors are `(197, 71, 41, 25)` and `(144, 160, 180, 124)`. Clearing the high nibble of the final byte selects the first endpoint for the last texel. The CPU control checks that the first 60 bytes stay identical and the final four become `c5 47 29 19`. ## Reproduction After a Windows dev build: ```powershell python -B tests/bc7_blocks_check.py -v ctest --preset dev --no-tests=error -R '^bc7_draw_(hardware|warp)$' -V ``` The normal CPU and GPU checks use repository data. To repeat the compressed-byte comparison, point `BCPACK_REFERENCE_TOOLS` at the local `tools` directory from Leonida revision `03d1e118a676d73aba66b1793cf033f6ad23b2b2`, then rerun the Python command. The check calls `decode_with_info` with `allow_provisional=False` and verifies both the block and the provisional set. ## Observed results With the pinned Leonida decoder, nine Python tests passed. The existing optional `texture2ddecoder` comparison was skipped because that package was absent. Both `bc7_draw_hardware` on GeForce RTX 4060 and `bc7_draw_warp` passed. This is one synthetic zero-history block. Reconstruction with preset history and comparison with Xbox hardware remain open.
upstream-sync closed this pull request 2026-11-24 06:43:06 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
R0Y00/Xbox2Windows!447
No description provided.