fix(agc): release a published native multisample depth owner whose plane a written storage view covers #15707
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15707"
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 hugodearaujo on 2026-11-04T08:36:08Z.
What
Assassin's Creed Mirage (PPSA13960) reuses the memory of its 4-sample D32S8 depth target (no HTILE) within the frame. It draws the depth target, then a compute pass writes an R11G11B10F storage image with 4 mips over the same memory, and it covers both planes. On the next frame it binds the depth target at those addresses again.
When the written storage view is bound,
cachedStorageTexturepublishes the owner (RequireNoMultisampleTarget) and thenRetireCoveredDepthSurfacesretires it. For a multisampled owner,retireonly setsretired. The owner staysactive, and its depth guards stay withhostEverWritten. That leaves two outcomes on the next frame:retired. Its host samples are from before the storage writes. The storage results are still pending over the planes, and they are older than the new draws. The next guest access publishes the owner, and the publication refuses:native multisample depth publication over pending storage image writes is not implemented.a native multisample depth attachment over the planes of a host-written owner of another identity is not implemented.Once the owner has been published, guest memory holds all its samples. A written storage view then covers one of its planes, so the host image no longer describes that memory. A retired owner is no longer sampled natively (
DepthSurfaceTextureand the plane lookups skip retired owners). So its guards only bring back stale samples or block another target.RetireCoveredDepthSurfacesnow also releases a multisampled owner that has guards and has not been written since its publication. The owner becomes inactive and its depth guards are removed, asRetireUnmappedDepth_nid_no_patchdoes for unmapped planes. The next bind of that memory creates a new owner. Its import (prepareUniformPlaneSampling) first stores the pending storage results over the planes (StorageTexture::FlushPending), so they end up under the new target's samples, as on the console. It then imports the planes if each holds one value, and otherwise records the usual import refusal.Unchanged:
The depth-surface debt entry, which said a retired surface bound again keeps its own depth, now names this exception. A released multisampled owner still keeps its host image until the existing teardown releases it. Freeing inactive multisampled owners earlier is #15300's topic, and this change does not depend on it.
Tested
Linux 7.2.11, AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Release with tests.
agc_driver_native_depth_covered_owner(--covered-owner), at 2, 4 and 8 samples. Setup: a 200x130 D32S8 owner without HTILE whose stencil plane follows its depth plane, drawn with per-sample depth and stencil. Then the sequence ofcachedStorageTexture's written path:RequireNoMultisampleTargetover the storage range (it publishes the owner),RetireCoveredDepthSurfaces, then an R32F storage image over the range with a recorded clear to 0x3c3c3c3c andMarkWholeWritten, left pending.native multisample depth publication over pending storage image writes is not implemented, and the second witha native multisample depth attachment over the planes of a host-written owner of another identity is not implemented. The third case passes on both.6cc534fb37) with only the test added and on this change (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1,ctest -V -R "native_depth|native_multisample|depth_storage|depth_surface|agc_storage_|multisample_guest|repeat_storage_guard|cached_image|storage_flush_ordering|storage_one_slice|storage_read_during|storage_write_back|msaa_address_on_plane", 53 tests). Base: 52 of 53, the new test failing as above. This change: 53 of 53. Neither log has aVUID-line or "was not found but was requested". Both have the same 20WARNING-VkImageSubresourceRange-layerCount-compatibilitylines.a7d499a328(which mergesmain5b1d381d5a): withDepthSurface.cppfrom that head and the new test, 20 of the 21agc_driver_native_multisample_depth/agc_driver_native_depth_*tests pass, the new one failing withnative multisample depth publication over pending storage image writes is not implemented; with this change, 21 of 21. NoVUID-line on either side.tools/check_conventions.py: passes.mainc2eafe4461+ #13963 (7d548223bd) + #15688 + #15690:compute shader 0x10b4c89700: AGC graphics: native multisample depth publication over pending storage image writes is not implemented, one on the identity refusal above, and one onnative multisample depth plane without HTILE does not hold one depth value in [0, 1], for a target at another address. That last one is a separate stop. A logging build (local only) shows the order of events for the owner on the publication stop: The pending units cover exactly the depth and stencil planes. They were recorded after the owner's publication and before its next draws.compute shader 0x10b4c8ad00: AGC graphics: native multisample depth plane without HTILE does not hold one depth value in [0, 1], the import refusal for a target whose planes do not hold one value each. One of the runs without this change also stopped there, for a target at another address. The third run is the same change in a logging build. It shows the owner released after the covered retirement (depth-released-covered 0x1246ac0000) and then three more frames at 1052x592. It stops at 466 s in the multisampled colour path:compute shader 0x10009d2700: AGC graphics: a storage image access of 0x10f4960000+0x800000 overlaps multisampled color target 0x10f4000000+0xaa0000 (4 samples), whose samples are only on the host. Both are separate stops.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)Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-04T17:09:54Z.
Review: APPROVED
Head
a8c5df4e69merged onto currentmainb11c7bf84f(clean merge, local only): code read, red/green check and a run on AMD's Windows driver, which no run of this stack has covered yet, with an NVIDIA Blackwell run alongside.Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (
x86_64-ucrt-posix-seh, r3), Release,BUILD_TESTING=ON.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ctest -R '^agc_driver_native_(depth|multisample_depth).*$',ANYPS5_GPUselecting the device (confirmed bySelected GPU). In each tree one test,agc_driver_native_depth_driver_queued_fill, skips on Windows as onmain:main10de:2c05)1002:164e)VUID-lines and no missing-layer line in any run.DepthSurface.cppchange reversed (git diffof #15690's head6c1c4ef23fagainst this head, applied in reverse) fails the newagc_driver_native_depth_covered_owneron both GPUs. It fails withnative multisample depth publication over pending storage image writes is not implemented, the stop the description names.check_conventions.py --base mainpasses on the merge.Read through the change:
retire,RetireCoveredDepthSurfacesalso releases an owner only when it is multisampled,samplingActiveand nothostWrittensince it was published.activeand erases the owner's guard range underdepthGuardMutex, then updatesanyDepthGuard. That mutex is taken aftersurfacesMutex, the order the existing code also uses.I found nothing to change.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T12:34:36Z.
Review: COMMENTED
Ran
9da6b3a934merged onmain302864d48con Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Khronos validation layer 1.4.368),ctest -R '^agc_driver_native_(multisample_depth|depth_)' -V.mainVUID-VUID-VUID-On Intel the new
agc_driver_native_depth_smaller_extentdispatches past the device limit. The test reports "Passed", but each run logs:Each run has it once with 104000 and once with 208000, logged right after the test's
samples=2andsamples=4cases. NVIDIA'smaxComputeWorkGroupCount[0]is far higher, so the layer stays quiet there. A dispatch over the limit is undefined behaviour, so this can't be counted as a pass on Intel. The dispatch needs to be split into chunks of at mostmaxComputeWorkGroupCount[0], or its X/Y shape changed.The new
agc_driver_native_depth_publication_without_htilefails on Intel in both runs: "a written D32S8 owner without HTILE did not publish its stencil samples and padding". The three other Intel failures (native_depth_stencil_view,uniform_planes,publication) are the same onmain(#16883).The layer was inserted in every test, and no log has
was not found but was requested by env var VK_INSTANCE_LAYERS. The newagc_driver_native_depth_covered_ownerpasses on both GPUs.AI-assisted: yes.