graphics: resolve multisampled color targets into another format #2371
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2371
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2371/head"
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?
@Nawid3333 on GitHub · 2026-11-18 05:50 UTC · original
Nawid3333:fix/resolve-format-conversion→main· +112 −3 · 3 files · 1 commits · closed without mergingProblem
A CB resolve (color mode 3) writes the averaged samples of render target 0 in the format of render target 1.
Image::ResolveusedvkCmdResolveImage, which needs both images in the same format (VUID-vkCmdResolveImage-srcImage-01386), so a resolve between two formats stopped at its format check (image.cpp:421 at2638b1b07):Beat Saber (PPSA15035, #2337) stops there once its first frames are presented (main stops earlier, in the presenter's layer-count check; a separate PR fixes that). A diagnostic build printed the two images (@Crispy81):
Change
vkCmdBlitImage(nearest filter, same extent), which converts the format: an sRGB source is decoded to linear and written in the destination's encoding.eBlitSrcon the source andeBlitDston the destination (optimal tiling), and both are integer formats of the same signedness or both are not integer (VUID-vkCmdBlitImage-srcImage-00229/00230). Other pairs still reach theEXIT_IF.DeferOperation, after the GPU work that uses it.Tests
shader_recompiler_compute_tests, check "MSAA resolve into another color format" (next to the existingImage::Resolvechecks): a 2-sample 4x4R8G8B8A8Srgbimage cleared to (0.5, 0, 1, 1) is resolved into anA2B10G10R10UnormPack32image and read back. Every texel must have red 500..525 (linear 0.5; a resolve that skips the sRGB decode gives about 754), green 0, blue 1023 and alpha 3.RX 9070 XT (Windows 11, clang-cl, with the harness change of #2038), Vulkan validation layer on: with the change the check passes with 0 validation errors. On main's sources the same test stops at the game's exact
image.cpp:421condition. With the change, the test function then stops after this check at its 2-sampleD24UnormS8Uintimage (format=129 ... samples=2, image.cpp:771), which this GPU does not support; main's own tests stop at the same image.Fork build of this head (run 44242028720): Windows, Linux and macOS build.
In a game
With this commit and that presenter change (fork build 23237f3, run 44195030260), @Crispy81's Beat Saber reaches its language selection menu at 30 fps (screenshot in #2337). Going further needs the PS VR2 Sense controllers.
Written with Claude Code (AI): Claude Code wrote the change and the test from the diagnostic build's output and ran them; Claude Opus reviewed the change and asked for the mid-value sRGB check; GLM fact-checked this text.
@coderabbitai[bot] on GitHub · 2026-11-18 05:58 UTC · original
No actionable comments were generated in the recent review.
Walkthrough
Multisample resolves can now convert between formats when their numeric classes match and the required blit features are supported. The resolve uses a source-format scratch image, then nearest-blits to the destination. Same-format multisample resolves retain the direct path, and single-sample copies retain the format-compatibility check. A compute test checks the resolved texel values.
Suggested reviewers:
nmzik,senaxxChange: Bug fix
Merge Risk:
Minimal · up to
3b8acThis change lets multisample color resolves convert between formats when the GPU supports the required blits. Previously these resolves failed at the format check. No merge-blocking risk is identified.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the main change: multisampled color resolves between two different formats. The changeset adds a scratch-image resolve followed by a blit for differing formats, which matches the title's subject and intent.
Full details: Description check
Explanation
The description explains the problem (a CB resolve between render target formats hits the format check in Image::Resolve), the change (scratch image resolve, then vkCmdBlitImage with format conversion, and scratch lifetime handling), and the added test. It is closely related to the changeset.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
f8c597c5-ed21-4a02-a6f0-ff85fcf33a62Reviewing files that changed from the base of the PR and between
2638b1b076and3b8ac623dc.src/graphics/host_gpu/renderer/image/image.cppsrc/graphics/host_gpu/renderer/image/image.htests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Pull request closed