GPU: use selected mip extents for MSAA resolves #652

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

@⁠fuzeofficlal on GitHub · 2026-11-24 06:14 UTC · original
fuzeofficlal:fix/resolve-selected-mip → main · +323 −22 · 1 files · 1 commits · open

Problem

MSAA resolve compares the full dimensions of the source and destination textures. A 4×4 source and a destination with a 4×4 base mip take the full-resolve path even when the selected destination mip is 2×2. On the RTX 5090 the larger source was averaged into the smaller mip, changing the expected top-left pixel from [0, 0, 32, 255] to [32, 32, 42, 255]. The D3D12 debug layer reported no error.

Change

Use the dimensions of the selected subresources both to choose between full and region resolve and to size the existing top-left crop. The mip is the low-order component of an array or plane subresource index.

Verification

  • On d2a4bae the patterned readback passed 2/5 cases on RTX 5090 and 5/5 on WARP. With the patch both passed 5/5, with zero D3D12 debug errors and the unselected base mip unchanged.
  • The cases cover equal selected extents, clipped extents, a nonzero array slice, and a destination whose mip count is chosen by D3D12.
  • The Windows diagnostics GPU suite passed on both adapters (45 passed, one existing benchmark ignored). The staged asset policy check passed.

All readback inputs were synthetic.

**@⁠fuzeofficlal** on GitHub · 2026-11-24 06:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/652) `fuzeofficlal:fix/resolve-selected-mip` → `main` · +323 −22 · 1 files · 1 commits · open ## Problem MSAA resolve compares the full dimensions of the source and destination textures. A 4×4 source and a destination with a 4×4 base mip take the full-resolve path even when the selected destination mip is 2×2. On the RTX 5090 the larger source was averaged into the smaller mip, changing the expected top-left pixel from `[0, 0, 32, 255]` to `[32, 32, 42, 255]`. The D3D12 debug layer reported no error. ## Change Use the dimensions of the selected subresources both to choose between full and region resolve and to size the existing top-left crop. The mip is the low-order component of an array or plane subresource index. ## Verification - On `d2a4bae` the patterned readback passed 2/5 cases on RTX 5090 and 5/5 on WARP. With the patch both passed 5/5, with zero D3D12 debug errors and the unselected base mip unchanged. - The cases cover equal selected extents, clipped extents, a nonzero array slice, and a destination whose mip count is chosen by D3D12. - The Windows diagnostics GPU suite passed on both adapters (45 passed, one existing benchmark ignored). The staged asset policy check passed. All readback inputs were synthetic.
Compute source and destination subresource mip dimensions for full and
region MSAA resolves, and cover selected-mip region selection and pixel
readback across array slices and expanded mip chains.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:11:37 +00:00
Author
Owner

@⁠justr4mzi on GitHub · 2026-11-24 09:27 UTC · original

Tested PR #652 (ea09cb04) merged cleanly onto main (8e79c80) on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2) and Rust 1.98.1 (x86_64-pc-windows-msvc).

  • Clean merge onto 8e79c80 (crates/victory-gpu/src/list.rs, +11/-5).
  • cargo test -p victory-gpu -- --test-threads=1: 50 passed, 0 failed, 1 ignored (same on main 8e79c80 baseline; PR adds no new unit test).
  • cargo test -p victory-gpu --features diagnostics -- --test-threads=1: 53 passed, 0 failed, 1 ignored (same on main 8e79c80).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 153 files ok.
  • Not run: runtime MSAA resolve test with the title (no game data included; the title itself was not launched).

AI-assisted verification (reviewed locally).

**@⁠justr4mzi** on GitHub · 2026-11-24 09:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/652#issuecomment-7127440638) Tested PR #652 (`ea09cb04`) merged cleanly onto `main` (`8e79c80`) on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2) and Rust 1.98.1 (`x86_64-pc-windows-msvc`). - Clean merge onto `8e79c80` (`crates/victory-gpu/src/list.rs`, +11/-5). - `cargo test -p victory-gpu -- --test-threads=1`: **50 passed, 0 failed, 1 ignored** (same on `main` `8e79c80` baseline; PR adds no new unit test). - `cargo test -p victory-gpu --features diagnostics -- --test-threads=1`: **53 passed, 0 failed, 1 ignored** (same on `main` `8e79c80`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: `153 files ok`. - Not run: runtime MSAA resolve test with the title (no game data included; the title itself was not launched). *AI-assisted verification (reviewed locally).*
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 10:47 UTC · original

I ran the patterned selected-mip readback on ea09cb04 using AMD Radeon(TM) Graphics (DXGI 1002:13c0, verified against the native device LUID). All five synthetic cases passed, including the nonzero destination mip at three sizes, array slice 1, and an automatically sized mip chain. Every selected mip matched the expected texels and each untouched base mip stayed cyan.

The D3D12 callback reported zero errors or corruption during recording and execution. This run covers the patched revision on this AMD adapter.

**@⁠fuzeofficlal** on GitHub · 2026-11-24 10:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/652#issuecomment-7129257252) I ran the patterned selected-mip readback on `ea09cb04` using AMD Radeon(TM) Graphics (DXGI `1002:13c0`, verified against the native device LUID). All five synthetic cases passed, including the nonzero destination mip at three sizes, array slice 1, and an automatically sized mip chain. Every selected mip matched the expected texels and each untouched base mip stayed cyan. The D3D12 callback reported zero errors or corruption during recording and execution. This run covers the patched revision on this AMD adapter.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 16:39 UTC · original

Rebased onto ffe310e and folded in resolve_uses_the_selected_mip_dimensions covering selected-mip and array-slice MSAA resolve readbacks (including 4x4 source -> 4x4 destination mip 1 and expanded mip chains) across hardware and WARP.

**@⁠fuzeofficlal** on GitHub · 2026-11-24 16:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/652#issuecomment-7138003245) Rebased onto `ffe310e` and folded in `resolve_uses_the_selected_mip_dimensions` covering selected-mip and array-slice MSAA resolve readbacks (including 4x4 source -> 4x4 destination mip 1 and expanded mip chains) across hardware and WARP.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:32 UTC · original · edited 2026-11-26 00:21 UTC

Automated triage for the maintainers.

Merge candidate. list::resolve (crates/victory-gpu/src/list.rs) now picks between a full ResolveSubresource and a cropped ResolveSubresourceRegion in the new resolve_region. It uses the extents of the selected mips (subresource % MipLevels, matching D3D12's subresource numbering) rather than the base dimensions, and the crop uses the same extents.

On your reply: the second-look points are done. The test compiles against the owned host_resource and drains the debug queue before asserting. It now asserts resolve_region's decision for every case: 4x4 into mip 1 of a 4x4 texture gives a 2x2 crop, and 4x4 into mip 1 of 8x8 takes the full path. So it fails against main's base-dimension logic on every host, not only on adapters that show the corruption. The branch merges cleanly.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/652#issuecomment-7148617772) · edited 2026-11-26 00:21 UTC <!-- victory-triage v1 head=292789d91dd14ce21402678d58ce24872cb39615 verdict=merge-candidate at=2026-11-26T00:21:42Z --> Automated triage for the maintainers. **Merge candidate.** `list::resolve` (`crates/victory-gpu/src/list.rs`) now picks between a full `ResolveSubresource` and a cropped `ResolveSubresourceRegion` in the new `resolve_region`. It uses the extents of the selected mips (`subresource % MipLevels`, matching D3D12's subresource numbering) rather than the base dimensions, and the crop uses the same extents. On your reply: the second-look points are done. The test compiles against the owned `host_resource` and drains the debug queue before asserting. It now asserts `resolve_region`'s decision for every case: 4x4 into mip 1 of a 4x4 texture gives a 2x2 crop, and 4x4 into mip 1 of 8x8 takes the full path. So it fails against `main`'s base-dimension logic on every host, not only on adapters that show the corruption. The branch merges cleanly. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:01 UTC · original

Automated triage for the maintainers, second look (a review against main, with the PR built and tested).

The fix is right (a resolve uses the selected mips' extents), and this can be merged after a change to its test. The test no longer compiles on current main, where host_resource returns an owned resource: in crates/victory-gpu/src/list.rs, resolve_uses_the_selected_mip_dimensions needs host.rtv(&src_tex, None), host.rtv(&dst_tex, Some(&desc)) and read_resolve_test_mip(device, &recorded.list, &dst_tex, sub). Please also drain the debug queue before the first assert (let _ = host.log_messages(); once the textures are made), so the test does not fail under VICTORY_D3D12_DEBUG=1 on a list-setup message. For what it is worth: with those borrows fixed, the test passes with and without the fix on an RX 6700 XT and on WARP, so a case that fails on main would make it stronger.

Push the change and it will be reviewed again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 22:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/652#issuecomment-7175834961) Automated triage for the maintainers, second look (a review against `main`, with the PR built and tested). The fix is right (a resolve uses the selected mips' extents), and this can be merged after a change to its test. The test no longer compiles on current `main`, where `host_resource` returns an owned resource: in `crates/victory-gpu/src/list.rs`, `resolve_uses_the_selected_mip_dimensions` needs `host.rtv(&src_tex, None)`, `host.rtv(&dst_tex, Some(&desc))` and `read_resolve_test_mip(device, &recorded.list, &dst_tex, sub)`. Please also drain the debug queue before the first assert (`let _ = host.log_messages();` once the textures are made), so the test does not fail under `VICTORY_D3D12_DEBUG=1` on a list-setup message. For what it is worth: with those borrows fixed, the test passes with and without the fix on an RX 6700 XT and on WARP, so a case that fails on `main` would make it stronger. Push the change and it will be reviewed again. Thank you for the contribution.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 22:39 UTC · original

Updated and rebased onto main (f3578e3) in 292789d per second-look feedback:

  • Fixed the owned host_resource borrows in resolve_uses_the_selected_mip_dimensions (host.rtv(&src_tex, None), host.rtv(&dst_tex, Some(&desc)), and read_resolve_test_mip(..., &dst_tex, sub)).
  • Drained the debug queue (let _ = host.log_messages();) right after creating the test textures so list-setup messages don't trip under VICTORY_D3D12_DEBUG=1.
  • Extracted resolve_region and asserted its exact decision for every test case (e.g., 4x4 MSAA -> 4x4 mip 1 (2x2) requires Some(RECT 0..2, 0..2) rather than full ResolveSubresource, 4x4 MSAA -> 8x8 mip 2 (2x2) requires 0..2 rather than 0..4, and 4x4 MSAA -> 8x8 mip 1 (4x4) takes None for full ResolveSubresource), so the test fails against main's base-dimension logic on every host in addition to catching D3D12 debug-layer validation errors.
  • Re-verified list::tests::resolve_uses_the_selected_mip_dimensions on RTX 5090, RTX 5090 + VICTORY_D3D12_DEBUG=1, and WARP + VICTORY_D3D12_DEBUG=1 (0 debug messages), plus cargo clippy -p victory-gpu --all-targets (default & --features diagnostics, 0 warnings) and cargo xtask policy (190 files ok).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 22:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/652#issuecomment-7176638598) Updated and rebased onto `main` (`f3578e3`) in `292789d` per second-look feedback: - Fixed the owned `host_resource` borrows in `resolve_uses_the_selected_mip_dimensions` (`host.rtv(&src_tex, None)`, `host.rtv(&dst_tex, Some(&desc))`, and `read_resolve_test_mip(..., &dst_tex, sub)`). - Drained the debug queue (`let _ = host.log_messages();`) right after creating the test textures so list-setup messages don't trip under `VICTORY_D3D12_DEBUG=1`. - Extracted `resolve_region` and asserted its exact decision for every test case (e.g., `4x4` MSAA -> `4x4` mip 1 (`2x2`) requires `Some(RECT 0..2, 0..2)` rather than full `ResolveSubresource`, `4x4` MSAA -> `8x8` mip 2 (`2x2`) requires `0..2` rather than `0..4`, and `4x4` MSAA -> `8x8` mip 1 (`4x4`) takes `None` for full `ResolveSubresource`), so the test fails against `main`'s base-dimension logic on every host in addition to catching D3D12 debug-layer validation errors. - Re-verified `list::tests::resolve_uses_the_selected_mip_dimensions` on RTX 5090, RTX 5090 + `VICTORY_D3D12_DEBUG=1`, and WARP + `VICTORY_D3D12_DEBUG=1` (0 debug messages), plus `cargo clippy -p victory-gpu --all-targets` (default & `--features diagnostics`, 0 warnings) and `cargo xtask policy` (190 files ok).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/652/head:github-bot/gh-652'
git switch 'github-bot/gh-652'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-652'
git switch 'github-bot/gh-652'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-652'
git switch 'github-bot/gh-652'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-652'
git switch 'main'
git merge --squash 'github-bot/gh-652'
git switch 'main'
git merge --ff-only 'github-bot/gh-652'
git switch 'main'
git merge 'github-bot/gh-652'
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!652
No description provided.