fix(agc): start a new native multisample depth owner when an overwriting draw binds a published owner under pending storage units #17890
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17890"
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-09T20:56:03Z.
What
Assassin's Creed Mirage (PPSA13960) stops before its title screen, at 73-81 s:
The target is a 4-sample D32S8 depth target without HTILE (960x540 in our logs). #16363's overwrite proof imports it, and its samples are then published to guest memory. After that the host doesn't write it. A compute pass then writes an R11G11B10F storage image at the same base, so storage units stay pending over the depth plane. The next frame binds the target again with a draw that writes every sample (depth ALWAYS with writes, stencil ALWAYS/REPLACE, mask 0xff). That bind finds the published owner and reuses it. Once the draw writes the owner, its next publication meets the pending units and throws the message above.
On the console the target and the storage image are the same memory, and that draw overwrites every sample. So no sample of the old owner survives, and the storage results are just the memory under the new draw.
The change.
DepthSurfaceViewWithStencilWriteIntentnow starts a new owner when all three of these hold:overwrittenStencil);GuestHoldsSamples);StorageTexture::AnyPendingUnitsOverlap).The old owner is marked inactive and its depth guards are removed. It isn't host-written, so
releaseRetired(#15300) frees it when the new owner is created. The new owner imports guest memory as any new owner does, and its import stores the pending results first. Its planes are then uneven, so #16363's proof decides after the draw, as for any other overwriting first draw.Nothing else changes:
The depth surface debt entry, which lists when a published owner is released and a new one imported, now names this case too.
Cost: one new owner per such bind, so one overwrite proof (#16363: a recorder sync and a stencil readback). The released owner is freed at once (#15300). In Mirage (two 300 s runs of a local logging build), this path starts a new owner in two bursts, for 960x540 x4 targets, and never between them:
0x10db960000) at 50-70 s, around where the build without this change stops;0x10dfd20000). That is about one new owner per presented frame (12 new owners against 12 presents in each of two 10 s windows).The title screen and the menu (70-255 s) start none, and they run at 0.6-2 presents per second either way. The opening scene runs at 1.1-2.6 presents per second. The build without this change stops before that point, so this cost cannot be compared directly. Device VRAM in use stays at 12.4-12.7 GB from 75 s to the end of every run with this change, with no growth.
Tested
Linux 7.2.14, AMD Radeon RX 9070 XT, RADV (Mesa 26.2.6), Release with tests.
agc_driver_native_depth_overwritten_published(--overwritten-published), at 2, 4 and 8 samples, on a 200x130 D32S8 target without HTILE over uniform planes. The owner is imported, drawn and published by a guest read. Then a linear storage image is cleared over its depth plane from 64 KiB in, and its results are left pending. Then one of:native multisample depth publication over pending storage image writes is not implemented;main6719b01bf3+ #16363 + #16364 + #16365, test only) fails at each sample count withAGC graphics: an overwriting draw over a published owner under storage results did not start a new owner. The first case is the unchanged behaviour, so it passes there too. It runs first in each sample count, so the log shows the base behaviour before the failure.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"):main6719b01bf3+ #16363 + #16364 + #16365): 66 tests, 64 pass, 2 skip;agc_storage_pending_key_refreshandagc_storage_clear_hand_over. The loader inserted the layer in both runs. Neither log has aVUID-line, a validation warning, or "was not found but was requested".tools/check_conventions.py --base 6719b01bf3: passes (exit 0, no findings).main. The head,3b3fefa541, is this change withmainf439f7f3a0merged in (a clean merge, with this PR's lines unchanged). It builds, and the same validation command, run withoutagc_storage_write_back_scratch, gives 66 tests: 64 pass, the same 2 skip, and the new test is among the passes. No log has aVUID-line, andcheck_conventionspasses.ctest -V -Rpattern above, 3 runs on each side.mainf439f7f3a0: 63 tests, all pass 3 of 3.3b3fefa541: 67 tests, all pass 3 of 3. That includesagc_storage_pending_key_refreshandagc_storage_clear_hand_over, which skip on the RX 9070 XT, andagc_storage_write_back_scratch. The new test runs at 2, 4 and 8 samples.VUID-line, and the layer was found.57f21b13b8: fails 3 of 3 withan overwriting draw over a published owner under storage results did not start a new owner.3b3fefa541merged ontomaine7c3bfd130, a clean merge. Windows 11 Enterprise 22621, AMD Radeon RX 6700 XT (driver 32.0.21045.16010), WinLibs GCC 15.2 UCRT, Release.agc_driver_native_multisample_depth,agc_driver_native_depth_pending_units,agc_driver_native_depth_overwritten_planes,agc_driver_native_depth_overwritten_publishedandagc_driver_native_depth_single_sample_viewpass 3 of 3 each, none skipped.08ba519102merged ontomain1ee5cd7cc3, CachyOS (Linux 7.3.1), GCC 16.2.1, Release, compared withmainon the same machine,ctest -R '^(agc|video_out|shader)'. On an RTX 3070 Ti (NVIDIA 615.78.08) and an Intel UHD Graphics 630 (Mesa 26.2.6, ANV): no difference frommain, andagc_driver_native_depth_overwritten_publishedpasses 3 of 3 alone. No validation layer there.d4583e9ccd) merged on top: the new test and the same 67 tests pass (65 pass, 2 skip, noVUID-line). That still holds when the test's storage access passesDepthReadCause::Reuse, as #15941'scachedStorageTexturedoes. With thatReuseaccess, #15941 without this change (the test only) fails as the base does:AGC graphics: an overwriting draw over a published owner under storage results did not start a new owner.9452ca6e35, #15941 retires an owner at aReuseaccess only when that access's publication took a guest byte. A published owner has nothing left to publish there, so it is kept, and the bind reaches this change as it does without #15941. When aReusepublication does take a guest byte, #15941 retires the owner, and the next bind already creates a new owner without this change.PublishToGuest's declaration andRequireNoResidentDepthRead_nid_no_patch's signature) and in the publication debt entry. Those are the same conflicts as merging #15941 onto those PRs alone.main6719b01bf3+ #13963 (97f05cbd72) + #16363 + #16364 + #16365:main6b58dfa474+ #13963 + #16364 + #16363 + #16365 + #15941 (d4583e9ccd) + #16974 (since merged), 720 s each, recomputed from their logs:a native multisample depth attachment over the planes of a host-written owner of another identity is not implementedat 448 s and 573 s;initial multisample color contents overlap resident native depthat 515 s and 454 s;a storage image access ... overlaps multisampled color target ... whose samples are only on the hostat 455 s;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)