Reuse the pipeline and resident texture across BC7 mip-tail draws #119

Manually merged
github merged 1 commit from gh-pr/119/head into gh-pr/119/base 2026-11-26 21:28:16 +00:00
Owner

@⁠PrivacyOnion on GitHub · 2026-11-21 16:33 UTC · original
PrivacyOnion:bc7-tail-pipeline-reuse → main · +111 −83 · 2 files · 1 commits · merged 2026-11-21 17:55 UTC

Change

check_bc7_tail exercises the translated copy shader's implicit LOD clamping across all requested mip viewports (0 .. firstResident + levels.size() - 1) against the same resident SRV range (MostDetailedMip = firstResident, MipLevels = residentCount). Previously, it called draw_verified once per requested mip level, recreating the root signature, graphics PSO, constant buffer, descriptor heaps, multi-mip default-heap BC7 texture and staging upload buffer on each iteration.

draw_verified now builds the root signature, pipeline state, constant buffer, descriptor heaps and resident multi-mip texture once per invocation, uploads the resident mip chain on the first command list, and loops over the requested viewport draws and readbacks. tools/bc7_tiles.py also precomputes the 16-entry X and Y block swizzle bit tables used by linearize_4k_s. Refs #15.

Verification

Built and verified at d355fc3 on Windows 11 with VS Build Tools 2022 17.14 (MSVC 19.44.35228.0), Windows SDK 10.0.26100.0, Python 3.12, on both NVIDIA GeForce RTX 5070 (vendor=10de device=2f04, driver 32.0.16.1664, debug_layer=enabled) and Microsoft Basic Render Driver (WARP, vendor=1414 device=008c, driver 10.0.26100.9818, debug_layer=enabled):

ctest --preset dev -R '^(bc7_draw_|pixel_aot_|bcpack_)' --no-tests=error -V
  • bcpack_prefix_and_mip_tail: passed (3 tests in 0.022s).
  • pixel_aot_hardware & pixel_aot_warp: passed (pixels=4096 channels=16384 max_absolute_error=0, debug_errors=0 debug_warnings=0, negative channel-swap and constant-buffer mismatch controls rejected).
  • bc7_draw_hardware & bc7_draw_warp: passed all 8 requested mip viewports (requested_mip=0..7, sampled_mip=3..7, max_absolute_error=0, debug_errors=0 debug_warnings=0, and middle-mip corruption rejected).

Evidence and follow-up

No new fixture files were added; existing synthetic BC7 Mode 6 and pixel shader fixtures verify identical pixel readback and negative-control rejection before and after the change.

**@⁠PrivacyOnion** on GitHub · 2026-11-21 16:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/119) `PrivacyOnion:bc7-tail-pipeline-reuse` → `main` · +111 −83 · 2 files · 1 commits · merged 2026-11-21 17:55 UTC ## Change `check_bc7_tail` exercises the translated copy shader's implicit LOD clamping across all requested mip viewports (`0 .. firstResident + levels.size() - 1`) against the same resident SRV range (`MostDetailedMip = firstResident`, `MipLevels = residentCount`). Previously, it called `draw_verified` once per requested mip level, recreating the root signature, graphics PSO, constant buffer, descriptor heaps, multi-mip default-heap BC7 texture and staging upload buffer on each iteration. `draw_verified` now builds the root signature, pipeline state, constant buffer, descriptor heaps and resident multi-mip texture once per invocation, uploads the resident mip chain on the first command list, and loops over the requested viewport draws and readbacks. `tools/bc7_tiles.py` also precomputes the 16-entry `X` and `Y` block swizzle bit tables used by `linearize_4k_s`. Refs #15. ## Verification Built and verified at `d355fc3` on Windows 11 with VS Build Tools 2022 17.14 (`MSVC 19.44.35228.0`), Windows SDK `10.0.26100.0`, Python `3.12`, on both `NVIDIA GeForce RTX 5070` (`vendor=10de device=2f04`, driver `32.0.16.1664`, `debug_layer=enabled`) and `Microsoft Basic Render Driver` (`WARP`, `vendor=1414 device=008c`, driver `10.0.26100.9818`, `debug_layer=enabled`): ```powershell ctest --preset dev -R '^(bc7_draw_|pixel_aot_|bcpack_)' --no-tests=error -V ``` - `bcpack_prefix_and_mip_tail`: passed (`3 tests in 0.022s`). - `pixel_aot_hardware` & `pixel_aot_warp`: passed (`pixels=4096 channels=16384 max_absolute_error=0`, `debug_errors=0 debug_warnings=0`, negative channel-swap and constant-buffer mismatch controls rejected). - `bc7_draw_hardware` & `bc7_draw_warp`: passed all 8 requested mip viewports (`requested_mip=0..7`, `sampled_mip=3..7`, `max_absolute_error=0`, `debug_errors=0 debug_warnings=0`, and middle-mip corruption rejected). ## Evidence and follow-up No new fixture files were added; existing synthetic BC7 Mode 6 and pixel shader fixtures verify identical pixel readback and negative-control rejection before and after the change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:28:15 +00:00
github manually merged commit 891e196251 into gh-pr/119/base 2026-11-26 21:28:16 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 17:16 UTC · original

Please rebase the renderer changes on the merged dual-texture path from #100 and show that its positive and swapped-binding controls still pass alongside the mip-tail corruption control.

**@⁠R0Y00** on GitHub · 2026-11-21 17:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/119#issuecomment-7066345648) Please rebase the renderer changes on the merged dual-texture path from #100 and show that its positive and swapped-binding controls still pass alongside the mip-tail corruption control.
Author
Owner

@⁠PrivacyOnion on GitHub · 2026-11-21 17:35 UTC · original

Rebased onto main (retaining secondRows, secondTexture/secondStaging, the 2-descriptor SRV heap, and check_dual_pixel from #100) and verified that the positive dual-texture cases (forward, reverse, reuse), the --dual-pixel-swapped binding control, the swapped-weight control, and the BC7 mip-tail middle-mip corruption control all pass on hardware (RTX 5070) and WARP:

1/4 Test #72: pixel_aot_hardware ...............   Passed    7.73 sec
2/4 Test #73: bc7_draw_hardware ................   Passed    2.75 sec
3/4 Test #74: pixel_aot_warp ...................   Passed    1.22 sec
4/4 Test #75: bc7_draw_warp ....................   Passed    0.47 sec
**@⁠PrivacyOnion** on GitHub · 2026-11-21 17:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/119#issuecomment-7066591859) Rebased onto `main` (retaining `secondRows`, `secondTexture`/`secondStaging`, the 2-descriptor SRV heap, and `check_dual_pixel` from #100) and verified that the positive dual-texture cases (`forward`, `reverse`, `reuse`), the `--dual-pixel-swapped` binding control, the swapped-weight control, and the BC7 mip-tail middle-mip corruption control all pass on hardware (`RTX 5070`) and `WARP`: ```text 1/4 Test #72: pixel_aot_hardware ............... Passed 7.73 sec 2/4 Test #73: bc7_draw_hardware ................ Passed 2.75 sec 3/4 Test #74: pixel_aot_warp ................... Passed 1.22 sec 4/4 Test #75: bc7_draw_warp .................... Passed 0.47 sec ```
This discussion has been locked. Commenting is limited to contributors.
No description provided.