fix(agc): record a multisampled target's commands on its own device #6522
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6522"
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 meh7an on 2026-10-15T18:39:07Z.
What
Fixes #6512.
recordCommandsinGraphics/src/MultisampleTarget.cpprecords intoRecorder::Active()whenever one exists, whatever device the target was made on. The target's layout barrier and clear, at creation and for a fast clear, then go into the active recorder's command buffer even when the target's image belongs to anotherVkDevice. A command buffer of one device naming an image of another is undefined behaviour. The Khronos validation layer reports it whenagc_driver_multisample_fill_host_onlyruns (VUID-vkCmdClearColorImage-commonparent,UNASSIGNED-vkCmdPipelineBarrier-commandBuffer-commonparent).That test makes its multisampled targets on its own device (
OpenVulkanTestDevice), while the fills it submits run on the driver's. The foreign clear goes out in the batch of the absorbed fill, and the next batch's sentinel fill (the secondSettle()) is lost now and then: that batch's fence signals, no completion action runs, and the guest page keeps round 1's value, still 100 ms later. These are the failures #6512 describes.recordCommandsnow uses the active recorder only when it is on the target's device. Otherwise it records on the target's own device in a one-shot batch, as it already does when no recorder is active. With one device, as in a running game, nothing changes.Tested
Windows 11 (10.0.26300), WinLibs GCC 15.2.0 (UCRT), Release, NVIDIA GeForce RTX 2080 Ti, driver 617.14.
b7cedd900with this change, the full ctest suite passes: 1297 of 1298. The one not run isagc_driver_gpu_indirect_arguments_misaligned_writer_ahead, which main itself does not compile with MinGW (alignas(65536)exceeds the object file's 8192 limit).agc_driver_multisample_fill_host_only, run directly with the ctest environment, several copies at a time. Same tree, the same evening, with and without this line:APS5_PIPELINED_DRAWSb7cedd9000VUID-vkDestroyDevice-device-05137, objects still alive when the test destroys its device.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 fma-rc on 2026-10-16T00:16:24Z.
I checked this on Linux at
09f574989against main5d9dcc42d, on an RTX 5080, RADV (Radeon 610M) and lavapipe.The random failure from issue 6512 did not show up here: 0 failures in 200 ctest runs per device, on main and with the PR alike. Under the Khronos validation layer (1.4.363), one run of
agc_driver_multisample_fill_host_onlyon main reports 4VUID-vkCmdClearColorImage-commonparent, 2UNASSIGNED-vkCmdPipelineBarrier-commandBuffer-commonparentand 4UNASSIGNED-Threading-Infoon each of the three devices. With the PR the same run reports none of them, and the test passes on all three.Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-16T21:34:24Z.
Independent validation, including Windows AMD: your exact head
09f574989e8cf1f84709c7bfff4d87b2fb276477merges cleanly with main0dc15620d2a649779dedebae6169d1975c5c3265at e8c6d2c23. The resulting main diff is exactly your one-line recorder-device check. The original two-device fill fixture is byte-identical to main; no test isolation patch or other pending PR was included.relinker,libsandagc_driver_multisample_fill_host_only_testsbuild on Windows GCC 15.2r7 and Ubuntu 24.04 WSL2 GCC 13.3. The fill test passes 200 fresh processes per device, 600 total, with no skips:Physical-device selection is verified in each log. Serial CTest,
--repeat until-fail:200 --timeout 30 -V,ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1; driver caches uncontrolled.I independently reached the same ownership diagnosis during native-color initialization work, then found this PR during the duplicate search. The deterministic CPU ownership check and separate fixture-isolation experiment are recorded in #6512. That experiment stays on the fork; retaining the original two-device fixture here preserves regression coverage. I will use your actual commit in our integration.
This adds runtime evidence on these configurations, not a new validation-layer run or proof about every historical sentinel failure. No game startup or FPS claim. AI-assisted: Codex; tests performed locally.