Verify a multi-block mode-6 BCPack texture through BC7 GPU readback #763

Closed
opened 2026-11-23 01:55:52 +00:00 by R0Y00 · 4 comments
R0Y00 commented 2026-11-23 01:55:52 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T01:55:52Z.


Why this advances the port

#453 proves strict decode of a known mode-6 BCPack vector to one BC7 block and checks all 16 texels through the translated sampling path. #613 adds bounded multi-lane entropy decoding. A multi-block fixture can check the boundary between the decoded symbols, block reconstruction and the Windows texture upload, including the order of blocks in a row.

Scope

Use a generated or publicly licensed, revision-pinned source vector with two distinguishable mode-6 blocks in one stream. Give the two blocks different endpoint or selector patterns so a lane or block-position error is observable. Reuse the strict decode, the independent BC7 block reference and the existing --check-bc7/translated copy-shader path. This is one bounded texture fixture. The broader archive-to-DDS workflow remains tracked in #458.

Acceptance

  • The strict path produces the two expected 16-byte blocks in the expected order. Derive the RGBA reference independently from known BC7 fields and compare every texel of the resulting 8×4 or 4×8 surface on WARP and one capable physical adapter.
  • Swapping the two decoded blocks or changing one known selector causes a predictable readback mismatch. A truncated stream fails strict decoding before upload.
  • Add a repeatable source-built check. Record the fixture generation method or provenance, exact commands, tested SHA and any hardware skips. The one-block fixture still passes.

To claim, comment with the proposed public vector or encoder source and expected block layout. Refs #453, #613 and #458.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6550680030 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/769). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T01:55:52Z. --- ## Why this advances the port #453 proves strict decode of a known mode-6 BCPack vector to one BC7 block and checks all 16 texels through the translated sampling path. #613 adds bounded multi-lane entropy decoding. A multi-block fixture can check the boundary between the decoded symbols, block reconstruction and the Windows texture upload, including the order of blocks in a row. ## Scope Use a generated or publicly licensed, revision-pinned source vector with two distinguishable mode-6 blocks in one stream. Give the two blocks different endpoint or selector patterns so a lane or block-position error is observable. Reuse the strict decode, the independent BC7 block reference and the existing `--check-bc7`/translated copy-shader path. This is one bounded texture fixture. The broader archive-to-DDS workflow remains tracked in #458. ## Acceptance - The strict path produces the two expected 16-byte blocks in the expected order. Derive the RGBA reference independently from known BC7 fields and compare every texel of the resulting 8×4 or 4×8 surface on WARP and one capable physical adapter. - Swapping the two decoded blocks or changing one known selector causes a predictable readback mismatch. A truncated stream fails strict decoding before upload. - Add a repeatable source-built check. Record the fixture generation method or provenance, exact commands, tested SHA and any hardware skips. The one-block fixture still passes. To claim, comment with the proposed public vector or encoder source and expected block layout. Refs #453, #613 and #458.
stan495 commented 2026-11-24 06:48:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-23T03:36:11Z.


I'd like to take this issue.

Proposed Vector & Encoder Source

  • Fixture: A two-block synthetic mode-6 BCPack stream in strict mode with zero history, pinned as fixed byte constants in tests/bcpack_mode6_multiblock_vector.py (analogous to the single-block fixture in #453).
  • Encoder / Decoder Provenance: Generated and verified through the clean-room reference decoder/encoder from the pinned Leonida tools revision (b0befb4b88d6640354940117448ea19d52507584) and bcpack-rs (MIT/Apache-2.0, preserving third-party notices as in tests/bcpack_symbols_check.py). The CI regression will consume the pinned byte vector directly so it requires no external encoder at test time.

Expected Block Layout & Surface Geometry

  • Surface dimensions: 8 × 4 pixels (2 horizontal blocks in row-major order, 32 bytes of BC7 data).
  • Block 0 (x: 0..3, y: 0..3): Mode 6 block using the established endpoint pair (197, 71, 41, 25) and (144, 160, 180, 124) with the standard selector ramp.
  • Block 1 (x: 4..7, y: 0..3): Distinct Mode 6 block with distinguishable cold/neutral endpoints and an inverted selector gradient.
  • Distinguishability: The distinct endpoint and selector patterns ensure that any block order swap (Block 0 ↔ Block 1) or lane-bleeding produces a deterministic mismatch across both 4×4 regions.

Verification & Negative Controls

  1. Strict decode: The strict path decodes the stream into two 16-byte BC7 blocks in (Block 0, Block 1) order.
  2. CPU Reference: Derive the 32 texels (128 bytes of RGBA8) independently via tools/bc7_blocks.py:decode(), arranged in row-major 8×4 raster order.
  3. GPU Readback: Pack the 32-byte BC7 surface into offscreen_check.exe using --check-bc7 with the translated copy-shader. Compare every texel against the CPU reference on both WARP and physical hardware.
  4. Negative Controls:
    • Swapping Block 0 and Block 1 in the decoded buffer fails GPU readback.
    • Mutating a single selector in Block 1 produces an isolated mismatch at that specific texel (x=7, y=3).
    • Truncating the compressed stream fails strict decoding before D3D12 resource creation.
    • The existing one-block fixture in bcpack_mode6_vector.py and bc7_draw_check.py remains untouched and passing.

Environment

  • OS: Windows 11 (build 26300)
  • Hardware: Intel(R) Arc(TM) B390 GPU (driver 32.0.101.8509) + Microsoft WARP
  • Toolchain: MSVC / Desktop C++ / Python 3.11+ / dev preset

Refs #453, #613, #458.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7090875975 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/769#issuecomment-7090875975). Originally posted by [stan495](https://github.com/stan495) on 2026-11-23T03:36:11Z. --- I'd like to take this issue. ### Proposed Vector & Encoder Source - **Fixture:** A two-block synthetic mode-6 BCPack stream in strict mode with zero history, pinned as fixed byte constants in `tests/bcpack_mode6_multiblock_vector.py` (analogous to the single-block fixture in #453). - **Encoder / Decoder Provenance:** Generated and verified through the clean-room reference decoder/encoder from the pinned Leonida tools revision (`b0befb4b88d6640354940117448ea19d52507584`) and `bcpack-rs` (MIT/Apache-2.0, preserving third-party notices as in `tests/bcpack_symbols_check.py`). The CI regression will consume the pinned byte vector directly so it requires no external encoder at test time. ### Expected Block Layout & Surface Geometry - **Surface dimensions:** 8 × 4 pixels (2 horizontal blocks in row-major order, 32 bytes of BC7 data). - **Block 0 (x: 0..3, y: 0..3):** Mode 6 block using the established endpoint pair `(197, 71, 41, 25)` and `(144, 160, 180, 124)` with the standard selector ramp. - **Block 1 (x: 4..7, y: 0..3):** Distinct Mode 6 block with distinguishable cold/neutral endpoints and an inverted selector gradient. - **Distinguishability:** The distinct endpoint and selector patterns ensure that any block order swap (Block 0 ↔ Block 1) or lane-bleeding produces a deterministic mismatch across both 4×4 regions. ### Verification & Negative Controls 1. **Strict decode:** The strict path decodes the stream into two 16-byte BC7 blocks in `(Block 0, Block 1)` order. 2. **CPU Reference:** Derive the 32 texels (128 bytes of RGBA8) independently via `tools/bc7_blocks.py:decode()`, arranged in row-major 8×4 raster order. 3. **GPU Readback:** Pack the 32-byte BC7 surface into `offscreen_check.exe` using `--check-bc7` with the translated copy-shader. Compare every texel against the CPU reference on both WARP and physical hardware. 4. **Negative Controls:** - Swapping Block 0 and Block 1 in the decoded buffer fails GPU readback. - Mutating a single selector in Block 1 produces an isolated mismatch at that specific texel (x=7, y=3). - Truncating the compressed stream fails strict decoding before D3D12 resource creation. - The existing one-block fixture in `bcpack_mode6_vector.py` and `bc7_draw_check.py` remains untouched and passing. ### Environment - OS: Windows 11 (build 26300) - Hardware: Intel(R) Arc(TM) B390 GPU (driver 32.0.101.8509) + Microsoft WARP - Toolchain: MSVC / Desktop C++ / Python 3.11+ / dev preset Refs #453, #613, #458.
stan495 commented 2026-11-24 06:48:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-23T03:36:32Z.


"I have verified the two-block mode-6 fixture with 8×4 surface readback on WARP and Intel Arc B390 GPU (driver 32.0.101.8509), along with block swap, selector mutation and truncation negative controls. Ready to open PR."

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7090880671 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/769#issuecomment-7090880671). Originally posted by [stan495](https://github.com/stan495) on 2026-11-23T03:36:32Z. --- "I have verified the two-block mode-6 fixture with 8×4 surface readback on WARP and Intel Arc B390 GPU (driver 32.0.101.8509), along with block swap, selector mutation and truncation negative controls. Ready to open PR."
rasptum commented 2026-11-24 06:49:13 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T15:26:00Z.


@stan495 I noticed your textures/mode6-multiblock branch (5e1af169) has the two-block mode-6 work but no PR yet. Could you rebase it onto current main and open it? A separate CTest entry for the WARP readback (for example bc7_mode6_multiblock_warp) would match how the other draw suites are registered.

I was about to pick this up and stopped when I found the branch, so it's all yours. If you'd rather hand it off, say so and I'll carry it forward with your commit and credit.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7105557931 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/769#issuecomment-7105557931). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-23T15:26:00Z. --- @stan495 I noticed your `textures/mode6-multiblock` branch (5e1af169) has the two-block mode-6 work but no PR yet. Could you rebase it onto current `main` and open it? A separate CTest entry for the WARP readback (for example `bc7_mode6_multiblock_warp`) would match how the other draw suites are registered. I was about to pick this up and stopped when I found the branch, so it's all yours. If you'd rather hand it off, say so and I'll carry it forward with your commit and credit.
stan495 commented 2026-11-24 06:49:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-23T15:51:16Z.


@rasptum Thanks for checking and for suggesting a separate WARP test. I rewrote the test on top of upstream main, kept the original synthetic vector, and opened #886. The PR registers bc7_mode6_multiblock_warp and bc7_mode6_multiblock_hardware separately. Both passed locally. The strict decode output is what the GPU samples, and the block-swap, selector-change, and truncation controls all behaved as expected.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7106213151 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/769#issuecomment-7106213151). Originally posted by [stan495](https://github.com/stan495) on 2026-11-23T15:51:16Z. --- @rasptum Thanks for checking and for suggesting a separate WARP test. I rewrote the test on top of upstream `main`, kept the original synthetic vector, and opened #886. The PR registers `bc7_mode6_multiblock_warp` and `bc7_mode6_multiblock_hardware` separately. Both passed locally. The strict decode output is what the GPU samples, and the block-swap, selector-change, and truncation controls all behaved as expected.
Sign in to join this conversation.
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#763
No description provided.