fix(gpu): add integer RT blend bypass and merged readback run handling #3469

Open
github-bot wants to merge 1 commit from github-bot/gh-3469 into main AGit
Owner

@⁠legayclightning22 on GitHub · 2026-11-27 04:22 UTC · original
legayclightning22:fix/integer-rt-blend-and-merged-readbacks → main · +263 −3 · 5 files · 1 commits · open

Summary

Adds integer (UINT/SINT) render-target blend bypass preserving RenderTargetWriteMask alongside merged readback/shadow run detection and relay packing (414f893, +263/-3).

Changes

  • Bypass blending for integer render-target formats while retaining declared write masks in pipeline state setup.
  • Add merged readback/shadow run scanning and relay packing while avoiding full shadow-twin bloat on low-memory systems.
  • Add unit tests covering integer RT blend bypass and merged readback runs.

Verification

  • cargo test --locked -p victory-gpu --lib (231 passed, 1 ignored, only the 3 known baseline hardware failures)
  • cargo clippy --locked -p victory-gpu --all-targets --all-features -- -D warnings
  • cargo xtask policy
**@⁠legayclightning22** on GitHub · 2026-11-27 04:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/3469) `legayclightning22:fix/integer-rt-blend-and-merged-readbacks` → `main` · +263 −3 · 5 files · 1 commits · open ## Summary Adds integer (UINT/SINT) render-target blend bypass preserving `RenderTargetWriteMask` alongside merged readback/shadow run detection and relay packing (`414f893`, `+263/-3`). ## Changes - Bypass blending for integer render-target formats while retaining declared write masks in pipeline state setup. - Add merged readback/shadow run scanning and relay packing while avoiding full shadow-twin bloat on low-memory systems. - Add unit tests covering integer RT blend bypass and merged readback runs. ## Verification - `cargo test --locked -p victory-gpu --lib` (231 passed, 1 ignored, only the 3 known baseline hardware failures) - `cargo clippy --locked -p victory-gpu --all-targets --all-features -- -D warnings` - `cargo xtask policy` ```[cite: 44]
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 04:25:46 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-27 04:46 UTC · original

WARP test report (victory-gpu, --features diagnostics --lib --locked --no-fail-fast -- --test-threads=1)

OS: Windows 11 Pro 10.0.26200 (build 26200.9974), x64
Host adapter: WARP only (VICTORY_WARP=1 and VICTORY_D3D12_WARP=1; d3d10warp.dll 10.0.26100.9818); no physical GPU used. victory-gpu only honours VICTORY_D3D12_WARP with the diagnostics feature, so the run uses it; a test that prints its adapter reported "Microsoft Basic Render Driver".
dxil.dll: Windows SDK 10.0.26100.0, version 1.8.2502.11 (via VICTORY_DXIL)
rustc/cargo: 1.98.1 (48a229cea 2026-09-01)
Base: main 63bcca43c6
Head: 414f893d69 (fast-forwards onto main, no conflicts, 5 files)

pass fail ignored
main 246 0 1
main + PR 249 0 1
  • 3 new tests, all run and pass (none ignored or skipped): host::relay_tests::readback_packs_dirty_ranges_without_reordering_their_landings, pipeline::host::tests::integer_target_bypasses_blending_and_preserves_mixed_target_masks, shadow::changed_runs_are_exactly_the_bytes_that_differ. No other test changed result. The one ignored test is the same on both.
  • These are synthetic tests; the integer blend bypass and the merged readback runs are not exercised on a real draw here.

Review note (diff read, not a full audit):

  • apply_integer_blend_bypass is not behind a switch. That is fine for a validity fix: it returns early unless the blend state is enabled and a bound target is an integer format, so draws without an integer target are untouched. The shared-blend case (IndependentBlendEnable off) expands slot 0 to every target before clearing the integer ones, which the second half of the new test checks.
  • The merged readback in read_indirect goes through pack_relay_fetch/copy_fetch_runs. The arguments and the count are given different ids, so they are never merged and the readback layout is unchanged from before (arguments at 0, count at len).
  • merge_writeback_runs is on by default, not opt-in: on a host with at least 8 GiB of VRAM budget and 16 GiB of free RAM (wide_back), or with VICTORY_WIDE_BACK=1, only the changed runs are merged. VICTORY_WIDE_BACK=0 or VICTORY_CARD_REHASH_RUNS=0 gives back the whole-range path. The output bytes should be the same either way (the title bytes are synced into the copy in both), but the merged-run path differs by machine, so the machine used for a test run decides which path it covers. This WARP run does not tell which side of that threshold a given PC lands on.
  • No bugs found in the lines I read.

AI-assisted (Claude). Aggregate counts only; no game files used.

**@⁠oni-swr** on GitHub · 2026-11-27 04:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/3469#issuecomment-7210083911) **WARP test report** (`victory-gpu`, `--features diagnostics --lib --locked --no-fail-fast -- --test-threads=1`) OS: Windows 11 Pro 10.0.26200 (build 26200.9974), x64 Host adapter: WARP only (VICTORY_WARP=1 and VICTORY_D3D12_WARP=1; d3d10warp.dll 10.0.26100.9818); no physical GPU used. `victory-gpu` only honours `VICTORY_D3D12_WARP` with the `diagnostics` feature, so the run uses it; a test that prints its adapter reported "Microsoft Basic Render Driver". dxil.dll: Windows SDK 10.0.26100.0, version 1.8.2502.11 (via VICTORY_DXIL) rustc/cargo: 1.98.1 (48a229cea 2026-09-01) Base: main 63bcca43c6a0 Head: 414f893d69ee (fast-forwards onto main, no conflicts, 5 files) | | pass | fail | ignored | |---|---|---|---| | main | 246 | 0 | 1 | | main + PR | 249 | 0 | 1 | - 3 new tests, all run and pass (none ignored or skipped): `host::relay_tests::readback_packs_dirty_ranges_without_reordering_their_landings`, `pipeline::host::tests::integer_target_bypasses_blending_and_preserves_mixed_target_masks`, `shadow::changed_runs_are_exactly_the_bytes_that_differ`. No other test changed result. The one ignored test is the same on both. - These are synthetic tests; the integer blend bypass and the merged readback runs are not exercised on a real draw here. Review note (diff read, not a full audit): - `apply_integer_blend_bypass` is not behind a switch. That is fine for a validity fix: it returns early unless the blend state is enabled and a bound target is an integer format, so draws without an integer target are untouched. The shared-blend case (`IndependentBlendEnable` off) expands slot 0 to every target before clearing the integer ones, which the second half of the new test checks. - The merged readback in `read_indirect` goes through `pack_relay_fetch`/`copy_fetch_runs`. The arguments and the count are given different ids, so they are never merged and the readback layout is unchanged from before (arguments at 0, count at `len`). - `merge_writeback_runs` is on by default, not opt-in: on a host with at least 8 GiB of VRAM budget and 16 GiB of free RAM (`wide_back`), or with `VICTORY_WIDE_BACK=1`, only the changed runs are merged. `VICTORY_WIDE_BACK=0` or `VICTORY_CARD_REHASH_RUNS=0` gives back the whole-range path. The output bytes should be the same either way (the title bytes are synced into the copy in both), but the merged-run path differs by machine, so the machine used for a test run decides which path it covers. This WARP run does not tell which side of that threshold a given PC lands on. - No bugs found in the lines I read. AI-assisted (Claude). Aggregate counts only; no game files used.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-27 09:56 UTC · original

Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 414f893 (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 869 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: readback_packs_dirty_ranges_without_reordering_their_landings, integer_target_bypasses_blending_and_preserves_mixed_target_masks, changed_runs_are_exactly_the_bytes_that_differ.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-27 09:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/3469#issuecomment-7215283587) Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `414f893` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **869 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `readback_packs_dirty_ranges_without_reordering_their_landings`, `integer_target_bypasses_blending_and_preserves_mixed_target_masks`, `changed_runs_are_exactly_the_bytes_that_differ`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠legayclightning22 on GitHub · 2026-11-27 13:42 UTC · original · edited 2026-11-27 16:48 UTC

Thanks @⁠oni-swr and @⁠futurepro62 for running the WARP and RTX 5070 Ti verification passes! Both CI and hardware/WARP runs are green with all 3 new tests passing, so 414f893 is ready for review/merge.

**@⁠legayclightning22** on GitHub · 2026-11-27 13:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/3469#issuecomment-7219842565) · edited 2026-11-27 16:48 UTC Thanks @⁠oni-swr and @⁠futurepro62 for running the WARP and RTX 5070 Ti verification passes! Both CI and hardware/WARP runs are green with all 3 new tests passing, so `414f893` is ready for review/merge.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-27 19:01 UTC · original

Windows pixel readback at 414f893d69ee2a7654c88675f7b0bbab542a2270 and parent 63bcca43c6a00a758510398fa43096ce7e4f7df0, on RTX 4090 Laptop (621.14) and Microsoft WARP. A synthetic MRT draw writes UINT, SINT and UNORM targets over distinct nonzero background channels. The shared write mask was 0x5; the independent masks were 0x5/0xA/0x6. Integer channels selected by the effective mask were replaced, other channels retained their background values, and the UNORM target distinguished additive blending from the blend-disabled control. The scissored-out pixels stayed unchanged. No errors during the measured draw/readback.

Both revisions produced the expected pixels on both adapters. On parent the parsed state still carried the original blend enable/masks and the existing host-side preparation normalized them. Head canonicalizes earlier. This verifies no observed change in these rendered pixels; it does not attribute a pixel regression to the parent.

Synthetic MRT fixture. GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-27 19:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/3469#issuecomment-7226105923) Windows pixel readback at `414f893d69ee2a7654c88675f7b0bbab542a2270` and parent `63bcca43c6a00a758510398fa43096ce7e4f7df0`, on RTX 4090 Laptop (621.14) and Microsoft WARP. A synthetic MRT draw writes UINT, SINT and UNORM targets over distinct nonzero background channels. The shared write mask was 0x5; the independent masks were 0x5/0xA/0x6. Integer channels selected by the effective mask were replaced, other channels retained their background values, and the UNORM target distinguished additive blending from the blend-disabled control. The scissored-out pixels stayed unchanged. No errors during the measured draw/readback. Both revisions produced the expected pixels on both adapters. On parent the parsed state still carried the original blend enable/masks and the existing host-side preparation normalized them. Head canonicalizes earlier. This verifies no observed change in these rendered pixels; it does not attribute a pixel regression to the parent. [Synthetic MRT fixture](https://github.com/passerbyyhx/VIctory/commit/0b01d7aa8d503495c8fc5bee619b239746994ba3). GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3469/head:github-bot/gh-3469'
git switch 'github-bot/gh-3469'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3469'
git switch 'github-bot/gh-3469'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3469'
git switch 'github-bot/gh-3469'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3469'
git switch 'main'
git merge --squash 'github-bot/gh-3469'
git switch 'main'
git merge --ff-only 'github-bot/gh-3469'
git switch 'main'
git merge 'github-bot/gh-3469'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!3469
No description provided.