feat(agc): read sample 0 of a native multisampled depth surface through a 2D image #12612
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12612"
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 milescoviello on 2026-10-28T22:58:00Z.
What
A DIM 2D image read of a two-dimensional multisampled T# reads the image's sample 0. thuanquang's
0a3ea213e1serves that read for a multisampled color target by drawing sample 0 into a one-sample image (FirstSampleCopy). Over a native multisampled depth surface it refused:Ghost of Tsushima Director's Cut (PPSA02225 02.024.000) reads its two-sample 1920x2160 checkerboard depth this way. With #12561 it gets to this read, and three runs stopped on this error 396 to 539 s in.
How
DepthSurfaceFirstSampletakes the surface's multisampled sampled depth view throughDepthSurfaceTexture(the checks and barrier of a multisampled depth read). It then draws that view's sample 0 into a one-sampleVK_FORMAT_R32_SFLOATimage (VK_FORMAT_R16_UNORMfor D16) withFirstSampleCopy, the same fragment pass the color targets use. The surface keeps the copy and its textures, one per component mapping, and the returned texture holds them, asMultisampleTarget::FirstSampledoes.ShaderResourcessends the read there when a depth surface is at the T#'s address. A read with a depth comparison still throws, and so does one whose address is the surface's stencil plane.Tested
Linux (Ubuntu 26.04.1, GCC 15.2), RTX 4070 Ti (NVIDIA 615.71.09), on
main319621ba2e:agc_driver_native_multisample_depth:(s + 1) / 16plus an offset),DepthSurfaceFirstSampleover the target must read sample 0 (1/16plus the offset) at every pixel, through a one-sample 2D fetch.3df8b006a1), the case fails:a 2D read of the native depth target did not return its sample 0 at pixel 0: 0.000000, expected 0.062500.DepthSurfaceFirstSampledirectly. TheShaderResourcesrouting to it is covered by the Ghost of Tsushima runs below.^agc_driver_native_multisample_depth$|^agc_driver_depth|^agc_driver_sample_multisample_target$|^agc_driver_native_fmask$(32 tests) pass 3 of 3.VK_LAYER_KHRONOS_validation1.4.363, LunarG SDK), onmain319621ba2eand at this head:VK_LAYER_PATH=<sdk>/layers VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest -R '^agc_driver_native_multisample_depth$|^agc_driver_sample_multisample_target$' -Vwas not found but was requested by env var VK_INSTANCE_LAYERS.VUID-messages on either.APS5_TEXTURE_CACHE_MIB=4096):Windows 11 VM (GeForce GT 1030, WinLibs GCC 15.2, Release):
agc_driver_native_multisample_depthandagc_driver_sample_multisample_targetpass 3 of 3 at this head and onmain319621ba2e.AMD RDNA 4, run by @bunbeans2-arch (comment): Windows 11 Pro, Radeon RX 9070 XT (driver 32.0.32015.7029), MSYS2 UCRT64 g++ 16.1.0, Release,
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1with the Khronos validation layer loaded. The 32-test area passes 3 of 3 onmain673fa865f4and on this headd948d3052dmerged onto it, with noVUID-line on either side.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code