GPU: use selected mip extents for MSAA resolves #652
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/652"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T06:14:53Z.
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
d2a4baethe 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.All readback inputs were synthetic.
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T06:21:07Z.
Review: APPROVED
Tested on Windows 11 with Rust 1.98.1 (x86_64-pc-windows-msvc).
esolve() for both full and region MSAA resolve paths.
Imported from Marvisak/VIctory. Originally posted by justr4mzi on 2026-11-24T09:27:33Z.
Tested PR #652 (
ea09cb04) merged cleanly ontomain(8e79c80) on Windows 11 with an AMD Radeon RX 6700 XT (RDNA2) and Rust 1.98.1 (x86_64-pc-windows-msvc).8e79c80(crates/victory-gpu/src/list.rs, +11/-5).cargo test -p victory-gpu -- --test-threads=1: 50 passed, 0 failed, 1 ignored (same onmain8e79c80baseline; PR adds no new unit test).cargo test -p victory-gpu --features diagnostics -- --test-threads=1: 53 passed, 0 failed, 1 ignored (same onmain8e79c80).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy:153 files ok.AI-assisted verification (reviewed locally).
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T10:56:50Z.
Review: APPROVED
Tested
ea09cb0on Windows 11, RTX 5070, MSVC:cargo test -p victory-gpu -- --test-threads=143 passed, and with--features diagnostics45 passed. Clippy's 1 warning is the existingundocumented_unsafe_blocksin host.rs.subresource % MipLevels, then>> mip, clamped to 1) is the correct test for full versus region resolve. The crop now also uses the mip extents, so a larger source no longer averages into a smaller destination mip.GetDescreports the realMipLevelsafter creation (never 0), so the modulo is safe even for resources created with "all mips".AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T10:47:51Z.
I ran the patterned selected-mip readback on
ea09cb04using AMD Radeon(TM) Graphics (DXGI1002: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.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T16:39:20Z.
Rebased onto
ffe310eand folded inresolve_uses_the_selected_mip_dimensionscovering selected-mip and array-slice MSAA resolve readbacks (including 4x4 source -> 4x4 destination mip 1 and expanded mip chains) across hardware and WARP.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:32:41Z.
Automated triage for the maintainers.
Merge candidate.
list::resolve(crates/victory-gpu/src/list.rs) now picks between a fullResolveSubresourceand a croppedResolveSubresourceRegionin the newresolve_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_resourceand drains the debug queue before asserting. It now assertsresolve_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 againstmain'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
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:01:18Z.
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, wherehost_resourcereturns an owned resource: incrates/victory-gpu/src/list.rs,resolve_uses_the_selected_mip_dimensionsneedshost.rtv(&src_tex, None),host.rtv(&dst_tex, Some(&desc))andread_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 underVICTORY_D3D12_DEBUG=1on 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 onmainwould make it stronger.Push the change and it will be reviewed again. Thank you for the contribution.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T22:39:45Z.
Updated and rebased onto
main(f3578e3) in292789dper second-look feedback:host_resourceborrows inresolve_uses_the_selected_mip_dimensions(host.rtv(&src_tex, None),host.rtv(&dst_tex, Some(&desc)), andread_resolve_test_mip(..., &dst_tex, sub)).let _ = host.log_messages();) right after creating the test textures so list-setup messages don't trip underVICTORY_D3D12_DEBUG=1.resolve_regionand asserted its exact decision for every test case (e.g.,4x4MSAA ->4x4mip 1 (2x2) requiresSome(RECT 0..2, 0..2)rather than fullResolveSubresource,4x4MSAA ->8x8mip 2 (2x2) requires0..2rather than0..4, and4x4MSAA ->8x8mip 1 (4x4) takesNonefor fullResolveSubresource), so the test fails againstmain's base-dimension logic on every host in addition to catching D3D12 debug-layer validation errors.list::tests::resolve_uses_the_selected_mip_dimensionson RTX 5090, RTX 5090 +VICTORY_D3D12_DEBUG=1, and WARP +VICTORY_D3D12_DEBUG=1(0 debug messages), pluscargo clippy -p victory-gpu --all-targets(default &--features diagnostics, 0 warnings) andcargo xtask policy(190 files ok).Imported from Marvisak/VIctory. Originally posted by pes7 on 2026-11-27T16:37:53Z.
A heads-up from the tested merge set in #3409. This PR still merges cleanly onto
main(63bcca4), so there is nothing to rebase now. It does conflict with #2014 incrates/victory-gpu/src/list.rs.Whichever of the two lands second will need a rebase onto the other. #2014 is in #3409's set, so this PR is left out of it for now. If you push a version on top of #2014 (or say which order you'd prefer), I'll run it through the same build, test and title checks there.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T17:06:54Z.
The combined head keeps current main
63bcca4, #2014 at10be798, and #652 at292789d. The conflict was where both PRs added tests inlist.rs. The resolution keeps both tests. Combined commit87d60e0The branch is ready for pes7's merge-set verification. Maintainers can decide the upstream merge order. Please retain the original Git authors on cherry-pick or rebase. If folding my integration work into another commit, please use
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with OpenAI Codex. Synthetic Windows/WARP verification.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.