fix(agc): bind a multisampled sRGB target as a storage image in its UNORM twin #9260
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9260"
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 boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-21T16:50:23Z.
What
MultisampleTargetStorageViewmatched a rendered multisampled target only when itsVkFormatequalled the requested one. A 4xR8G8B8A8_SRGBtarget asked for as guest format 56 (R8G8B8A8_UNORM) therefore threw, although both are the same bytes and the target already creates a UNORM storage view for exactly this access. The lookup now matches when both formats resolve to the same host storage format, which holds only for identical formats or an sRGB format and its UNORM twin. An unrelated format of the same size is still refused.A second commit removes a spec violation the first one makes reachable: after promotion to storage the target's own color view in the sRGB format inherited
VK_IMAGE_USAGE_STORAGE_BIT, which sRGB formats do not support (VUID-VkImageViewCreateInfo-usage-02275). The view now excludes the storage usage whenever the image has it, as it already did for targets created with a sample-order storage form.Cyberpunk 2077 (PPSA03974) stops with this on a 128x64, 4 sample target in character creation, about 21 minutes into a session:
AGC graphics: storage image access to multisampled color target 0x1cca530000 (128x64, 4 samples, vk format 43) as a 128x64 texture of 4 samples and guest format 56 (vk 37) is not implementedRelated, not the same: #8847 matches sRGB twins for resolve and render and says storage-image access in the twin format "still throws as before"; this PR is that case. #9186 rewrites the same
ifinMultisampleTargetStorageViewinto a block, so the second of the two to merge needs a trivial rebase.Tested
Windows 11 (10.0.26200), NVIDIA GeForce RTX 5090, driver 617.42, Vulkan validation layer 1.4.363.0 (
VK_LAYER_KHRONOS_validation, inserted for the instance and the device in every test).New case
StorageSrgbTwininagc_driver_multisample_retirement: renders a 4xR8G8B8A8_SRGBtarget, asks for a guest format 56 storage view, checks the view is stable on a repeated lookup, and checks guest format 60 is still refused.maincecb540a6plus the test only: fails with the message above (vk format 43 / guest 56 / vk 37).Focused set,
ctest -R 'multisample|multisampled|msaa|^agc_recorder|agc_driver_recorder|sampled_cache_budget'withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:main: 25/29 pass, 0VUID-.VUID-VkImageViewCreateInfo-usage-02275(in the new case).VUID-.agc_driver_msaa_dcc_state(exit 0xc0000139) andagc_driver_msaa_dcc_clear_2/4/8(not run). They fail identically onmainand have no executable in my build directory.tools/check_conventions.py --base origin/main: passed.Cyberpunk 2077 (PPSA03974), same machine, a build of this branch merged with #6218 and #7048 (both still open): the session passed character creation and ran past 29 minutes (1767 s in the summary file when this was written) with no driver stop; the
storage image access to multisampled color targetmessage did not appear in the log. Onmainplus #6218, an earlier session with the same kind of play stopped with it at +1253 s. I have not traced whether the new lookup ran in that session, so the unit test above is the direct evidence for the change itself; the game run only shows that this scene no longer stops with it.Checklist
main; no other open PR implements the same functions (#9186 and #8847 touch nearby lines, neither implements this).mdfiles or images added to the repositoryAI-assisted: yes. Written with AI assistance and reviewed by me.
Imported from boykopovar/AnyPS5. Originally posted by klosixgaming-arch on 2026-10-21T17:24:35Z.
Real-title result for PPSA03974 (Cyberpunk 2077 v02.120.000), added after the PR body, and one correction to it.
Setup. Windows 11 (10.0.26200), NVIDIA GeForce RTX 5090, driver 617.42, Ryzen 9 9950X3D. Build: a local merge of
main(f90a3f729; this PR's branch is oncecb540a6), #6218 (head 4adf40588), this PR (head 1397502db (same tree as the 23e24862a that I built and ran; the commits were re-authored afterwards to fix the author email)) and #7048 (head2dd51172f, see my comment there for the one conflict). The game renders at 3200x1800.Before this PR. On
mainplus #6218, a session that went through new game, difficulty and life path into character creation stopped about 1253 s after launch with:AGC graphics: storage image access to multisampled color target 0x1cca530000 (128x64, 4 samples, vk format 43) as a 128x64 texture of 4 samples and guest format 56 (vk 37) is not implementedWith this PR. The same kind of session (same inputs, same scenes) went through character design and on into the first scenes after it, and ran 1878 s (31 minutes) before it stopped. The message above appears 0 times in that log, and the session passed the scene and the time at which the earlier session stopped. I did not trace the lookup in that session, so I cannot show the new code path being taken; the unit test in this PR (fails on
mainwith exactly that message, passes here) is the direct evidence for the change, and the game session is evidence that this stop no longer ends the run.Correction to the PR body. The body says the session "ran past 29 minutes with no driver stop". That was written while the session was still running. It later stopped at 1878 s with a different message that this PR does not touch:
AGC graphics: only normal color rendering with copy ROP is supported (CB_COLOR_CONTROL 0x005a0010, mode normal)(ROP3 0x5a is XOR, the driver accepts only the copy ROP 0xcc; I am looking at that separately and will open its own PR if nothing covers it.) So this PR moves the title from the storage-twin stop to the next one; it does not make the title run to gameplay.
Validation layer. Khronos validation 1.4.363 was loaded in every test run (VK_LOADER_DEBUG=layer shows it inserted for the instance and the device). Focused multisample and recorder set, 29 ctest entries:
main0VUID-, first commit alone 1 (VUID-VkImageViewCreateInfo-usage-02275, the reason for the second commit), this PR 0. The 4 non-passing entries (agc_driver_msaa_dcc_state,agc_driver_msaa_dcc_clear_2/4/8) fail the same way onmainand have no executable in my build.Logs are available if useful: the session summary lines (
APS5_TRACE_SUMMARY_EVERY=10) for the session before and after, and the two log excerpts.AI-assisted: yes. Written with AI assistance and reviewed by me.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-21T22:53:14Z.
Review: COMMENTED
Confirmed
red→greenon NVIDIA on Linux (the PR's run is an RTX 5090 on Windows).Tested
Ubuntu 26.04, i7-8700, GCC 15.2.0, Release,
BUILD_TESTING=ON,ANYPS5_NO_SHADER_CACHE=1, device selected withVK_ICD_FILENAMES, run as./agc_driver_multisample_retirement_tests, onmaina6dcea927(this PR applies cleanly on it).agc_driver_multisample_retirementmaina6dcea927+ the test only (MultisampleTarget.cppreverted)With
MultisampleTarget.cppreverted and the PR's test kept, the run fails with:vk format 43 is
R8G8B8A8_SRGBand vk 37 is itsR8G8B8A8_UNORMtwin — the sRGB→UNORM storage binding this PR adds. With the full PR it passes.lavapipe (Mesa, LLVM 21.1.8): not a clean signal here.
agc_driver_multisample_retirementalready fails onmaina6dcea927on lavapipe, with and without this PR, atMSAA storage promotion did not retain its source image— a separate, pre-existing born-storable (sample-order, grid 1x1) issue inStorageRemap, unrelated to this change.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux), Ubuntu 26.04.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.