GPU: resolve a multisampled PresentX color plane before display #3701

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/3701 into main
andrewpozdnakov7-jpg commented 2026-11-28 09:13:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T09:13:34Z.


PresentX now resolves a single multisampled 2D color plane directly into the swap chain when the source and output formats match. The swap chain has one sample per pixel, so the display path uses the resolve states for both resources and restores the source state afterward. Frame capture and black-frame detection read the resolved back buffer in this case. D3D12 resolve requirements

The regression presents generated 4× MSAA textures in RGBA8, BGRA8, RGB10A2 and RGBA16F. Signed app-local WARP with the debug layer exercised all four formats. Every pixel in each 16×16 back buffer matched the independently encoded clear color. The existing single-plane and compositor recovery test, both GPU Clippy configurations and the asset policy passed.

The change covers the display path. #2702 covers diagnostic readback from other multisampled color targets.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5538628635 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3701). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T09:13:34Z. --- PresentX now resolves a single multisampled 2D color plane directly into the swap chain when the source and output formats match. The swap chain has one sample per pixel, so the display path uses the resolve states for both resources and restores the source state afterward. Frame capture and black-frame detection read the resolved back buffer in this case. [D3D12 resolve requirements](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-resolvesubresource) The regression presents generated 4× MSAA textures in RGBA8, BGRA8, RGB10A2 and RGBA16F. Signed app-local WARP with the debug layer exercised all four formats. Every pixel in each 16×16 back buffer matched the independently encoded clear color. The existing single-plane and compositor recovery test, both GPU Clippy configurations and the asset policy passed. The change covers the display path. #2702 covers diagnostic readback from other multisampled color targets. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-28 09:16:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T09:16:42Z.


Windows CI passed on c13f937, including both Clippy configurations and the workspace tests. On app-local WARP with the debug layer, the 4× MSAA test resolved RGBA8, BGRA8, RGB10A2 and RGBA16F through PresentX. All 256 pixels matched per format. The existing single-plane and compositor recovery test also passed.

The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7237134466 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3701#issuecomment-7237134466). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T09:16:42Z. --- [Windows CI](https://github.com/Marvisak/VIctory/actions/runs/46129461412/job/140931225194) passed on `c13f937`, including both Clippy configurations and the workspace tests. On app-local WARP with the debug layer, the 4× MSAA test resolved RGBA8, BGRA8, RGB10A2 and RGBA16F through PresentX. All 256 pixels matched per format. The existing single-plane and compositor recovery test also passed. The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
passerbyyhx commented 2026-12-01 12:30:21 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-12-01T12:30:21Z.


Tested c13f937c on an RTX 4090 Laptop GPU and WARP with different colors in the four samples. I reused the same 4× texture, cleared it red each frame, then drew blue with sample masks 0x0, 0x3, 0xc, and 0xf. The capture callback copied the resolved swap-chain back buffer immediately before Present.

On both adapters, the two complementary middle masks each gave 50% red and 50% blue across all 256 pixels. The endpoints were solid red and solid blue. Across RGBA8, BGRA8, RGB10A2 and RGBA16F, all 4,096 pixels per adapter matched, within one quantization step for the integer formats and bit-exactly for FP16.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7311227139 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3701#issuecomment-7311227139). Originally posted by [passerbyyhx](https://github.com/passerbyyhx) on 2026-12-01T12:30:21Z. --- Tested `c13f937c` on an RTX 4090 Laptop GPU and WARP with different colors in the four samples. I reused the same 4× texture, cleared it red each frame, then drew blue with sample masks `0x0`, `0x3`, `0xc`, and `0xf`. The capture callback copied the resolved swap-chain back buffer immediately before `Present`. On both adapters, the two complementary middle masks each gave 50% red and 50% blue across all 256 pixels. The endpoints were solid red and solid blue. Across RGBA8, BGRA8, RGB10A2 and RGBA16F, all 4,096 pixels per adapter matched, within one quantization step for the integer formats and bit-exactly for FP16.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3701:upstream-pr/3701'
git switch 'upstream-pr/3701'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3701'
git switch 'upstream-pr/3701'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3701'
git switch 'upstream-pr/3701'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3701'
git switch 'main'
git merge --squash 'upstream-pr/3701'
git switch 'main'
git merge --ff-only 'upstream-pr/3701'
git switch 'main'
git merge 'upstream-pr/3701'
git push origin 'main'
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
Marvisak/VIctory!3701
No description provided.