fix(agc): invalidate primary draw state after secondary execution #27875
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27875"
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 IvanFogel on 2026-11-27T17:43:04Z.
What
With
APS5_PARALLEL_ATLAS=1, a draw can execute a secondary Vulkan command buffer and then return to recording on the primary. The primary recorder still remembers the pipeline and dynamic state from its previous draw. If the next draw requests the same values, the recorder skips commands that Vulkan requires it to emit again. In the existing single-sample depth replay test this leaves zero covered texels during capture. Vulkan command-buffer stateInvalidate the primary recorder’s cached pipeline and dynamic state immediately after
vkCmdExecuteCommands. The host regression checks the command log for an initial draw, an identical draw that can safely suppress repeated state, and the same draw after secondary execution, where the recorder must emit the state again.The failure also arose while qualifying #19557. The existing depth replay fixture exercises it on upstream
mainindependently of that PR.When this PR opened, the overlap scan left 79 branches to inspect manually. #27979 opened later and includes the same primary-state invalidation among five pooled-recording fixes. Its test registrations at
f1281ce9f466cover other cases. This PR now registers the single-sample depth capture and replay with pooled recording enabled. Merge order with #27979 is still open. #24327 changes the adjacent depth-bias method.Tested
December 4, Linux Release on NVIDIA RTX 3070 Ti (620.73.04). Added
agc_driver_frame_replay_single_sample_depth_parallel_atlasin response to the Vulkan execution review. It runs the existing capture and replay fixture in its own directory with pooled recording enabled. A debugger trace on the isolated fix confirmed that the fixture draws on the primary, executes a secondary recorded on a worker, and draws again on the same primary. The fixture checks captured depth coverage and replayed output.I ran the four focused CTests with pooled recording disabled in the outer environment, so the new registration had to enable it. On main
c1e5709defebwith only the test registration added, three controls passed and the new case failed with zero covered texels and eight distinct Vulkan draw validation errors. On this PR at163fed3808db, all four passed with zero skips and zero validation errors. The Vulkan loader confirmed that the Khronos validation layer was active.Plyxen independently tested the previous head in a combined Windows 11 build. All 60 graphics tests passed on an RTX 5080 and a Radeon iGPU. Removing this PR’s source change from that build made two tests fail. The new registration has been run locally on Linux. Windows review
Original Linux qualification. Compared upstream
13bf980d9659and this commit478dec33c359in Release on the same NVIDIA GeForce RTX 3070 Ti, driver 620.73.04, CachyOS Linux 7.3.5-2, GCC 16.2.1. These are host and synthetic renderer fixtures. Native Windows and retail titles were not tested.On main,
agc_driver_frame_replay_single_sample_depthreported zero covered texels and eight distinctVUID-vkCmdDrawerrors with the pool on. The fixed build passed its depth coverage and replay assertions in both modes. Three depth-sampling controls each used eight pooled secondary buffers when enabled and zero when disabled.Ran verbose CTest with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer. Both logs confirmed 54 layer insertions, using validation 1.4.363 with headers 1.4.335. The fixed build had zero skips and zero Vulkan validation errors across all 61 executions.Ran the new
agc_command_stateassertion against the unchanged recorder first. It observed zero commands after secondary execution where the test expected a pipeline bind and 19 dynamic-state calls. The same assertion passed with the fix.Checklist
mainat rebase. No other open PR implemented the same functions when this PR opened on November 27. #27979 opened November 28 and now overlaps the production fix.NotImplemented_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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T17:46:28Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the targeted source review supports the described state-cache invalidation behavior.
What I ran
Reviewed head
478dec33c3594fc3eb059597d79b696d441a6759from the prepared diff and reader. No test commands were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Tests and runtime behavior were not independently verified. Read
core/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cpp,core/libs/prx/libSceAgcDriver/tests/CommandStateLog.hpp, and the changed region ofcore/libs/prx/libSceAgcDriver/tests/Graphics.cpp. The fullGraphics.cppwas excluded from the prepared review folder, but its changed region was read through the pinned reader. No other changed files were excluded.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T10:40:30Z.
Review: APPROVED
I read the diff at
478dec33c3. Windows 11, GCC 15.2, merged intomainatb97867d3ce6together with other open PRs (so not an isolated build), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1andVK_LAYER_KHRONOS_validationon an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).agc_driver_graphics_tests: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.agc_command_stateandagc_driver_graphicsfail: "the primary draw state after secondary execution" is recorded as empty.The red rollup is only cancelled runs; no check failed.
Not checked: a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:20:50Z.
Review: COMMENTED
The mock fixture verifies that an identical draw re-emits tracked graphics state after a secondary buffer. Could a Vulkan execution case also record a primary draw after secondary work and verify its output under validation? That would cover the production transition alongside the existing state-call assertions. The tracked pipeline bind in
CommandStateis graphics-only.Source review at
478dec33c3. Paired Vulkan execution is pending.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T09:26:33Z.
Review: APPROVED
Reviewed — looks good
The change invalidates cached primary draw state after secondary execution, and the added assertions cover state emission afterward.
What I ran
Reviewed head
163fed3808db626b55954095675aea5c9617fd8eusingrepo_read.pyto inspect the changed code and relevant call site. No tests or builds were run. The reader returned the requested source ranges, but its audit-log append failed because the run directory is read-only.Reader commands
Results
Negative control
Not run by the reviewer. The description reports that the assertion failed against the unchanged recorder; that result was not independently verified.
Findings
Blocking
None.
Non-blocking
None.
Sources
vkCmdExecuteCommands; invalidation clears the known-state bits and cached pipeline state. Recorder.cpp at the reviewed head · execution methodNot verified
The reported CTest, Vulkan validation, Windows, and hardware runs were not independently reproduced.
files.jsonlists four reviewed files and no excluded files;Graphics.cppwas read throughrepo_read.pybecause its full text was not packaged infiles/.To get this to a good state
Nothing is required.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.