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

Merged
PrivacyOnion merged 1 commit from upstream-pr/119 into main 2026-11-21 17:55:18 +00:00
PrivacyOnion commented 2026-11-21 16:33:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by PrivacyOnion on 2026-11-21T16:33:53Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6531482190 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/119). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T16:33:53Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:41:24 +00:00
R0Y00 commented 2026-11-24 06:47:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T17:16:12Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7066345648 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/119#issuecomment-7066345648). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T17:16:12Z. --- 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.
PrivacyOnion commented 2026-11-24 06:47:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by PrivacyOnion on 2026-11-21T17:35:04Z.


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
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7066591859 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/119#issuecomment-7066591859). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-21T17:35:04Z. --- 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 ```
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!118
No description provided.