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

Closed
opened 2026-11-26 22:16:59 +00:00 by github-bot · 4 comments
Owner

@⁠R0Y00 on GitHub · 2026-11-23 01:55 UTC · original

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.

**@⁠R0Y00** on GitHub · 2026-11-23 01:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/769) ## 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.
github-bot 2026-11-26 22:16:59 +00:00
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:16:59 +00:00
Author
Owner

@⁠stan495 on GitHub · 2026-11-23 03:36 UTC · original

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** on GitHub · 2026-11-23 03:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/769#issuecomment-7090875975) 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.
Author
Owner

@⁠stan495 on GitHub · 2026-11-23 03:36 UTC · original

"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."

**@⁠stan495** on GitHub · 2026-11-23 03:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/769#issuecomment-7090880671) "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."
Author
Owner

@⁠rasptum on GitHub · 2026-11-23 15:26 UTC · original

@⁠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.

**@⁠rasptum** on GitHub · 2026-11-23 15:26 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/769#issuecomment-7105557931) @⁠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.
Author
Owner

@⁠stan495 on GitHub · 2026-11-23 15:51 UTC · original

@⁠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.

**@⁠stan495** on GitHub · 2026-11-23 15:51 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/769#issuecomment-7106213151) @⁠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.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#769
No description provided.