fix(agc): stop chaining sample locations into render pass begin #19943
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19943"
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 chitters2004 on 2026-11-14T08:57:49Z.
What
Render-pass pipelines chained
VkRenderPassSampleLocationsBeginInfoEXTintovkCmdBeginRenderPasswhenever custom sample locations were enabled. The chain held initial locations for the depth attachment and post-subpass locations for subpass 0. The depth attachment's initial, reference and final layouts are allGENERAL, so the pass performs no layout transition that would consume either set. The pipeline's ownVkPipelineSampleLocationsStateCreateInfoEXTstill governs rasterization and is unchanged. This PR drops the begin chain and theboundColorAttachmentsmember that only fed it.With the chain, render-pass output differs from dynamic-rendering output for a 2x multisampled draw at custom sample locations. In the new test on an RTX 3080, 25 color and 3005 depth samples of a 64x32 2x target differ in every run; without the chain, none do.
Affected: devices without dynamic rendering, and any device with graphics pipeline libraries off, for draws with custom sample locations. The dynamic-rendering path is untouched. The depth-copy pass in
SampleOrder.cppalso chains begin locations; it is a separate pass, was not part of the measurement, and is left as is.Tested
VK_EXT_sample_locations, so the mock is the local check):agc_driver_sample_location_grid_fallbacknow requires that render pass begin carries no sample locations while the pipeline still takes its locations once per library. It fails without this change ("the pipeline did not take its sample locations once per library, or the render pass begin carried sample locations") and passes with it.agc_driver_sample_orderandagc_driver_sample_order_planningpass (control).agc_driver_sample_order_render_pass_depth_locations(new) draws the sample-order scene (depth clear, two depth slopes, per-sample color) at 2x with custom locations once through dynamic rendering and four times through render passes, and requires every render-pass run to match in every color and depth sample. It runs withAPS5_NO_PIPELINE_CACHE=1andAPS5_NO_DRAW_RECIPE=1because neither key includes the rendering mode. The test compiles the render-pass runs' shaders for the render-pass push layout (b2231d1697). On the RTX 3080 with that test, main07743404d7with only the test files fails 5/5, each render-pass run reporting the same 25 color and 3005 depth samples different, and this PR passes 5/5 with 0 different. It skips on lavapipe (no custom sample locations).ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer, sync validation on), same tests on main and on this PR from the same machine and GPU: every log shows the loader inserting the layer and none reports it missing, and there are 0 sync hazards.VUID-vkCmdEndRendering-None-06161dropped from 16 per run to 0 on the RTX 3080 (3 of 3 runs on each head, layer 1.4.363.1).VUID-VkGraphicsPipelineCreateInfo-layout-10069came from the test compiling its render-pass runs' shaders with fixed push slots. With the test fix, no log on either tree reports any VUID (RTX 3080, layer 1.4.335.0, 14 runs).74900e8b0f(run 43569387998):linux-gate(main vs change, Khronos validation layer),windowsandasanpass, with no new VUIDs.APS5_NO_GPL=1, every draw on the render-pass path), this change also fixes the existing testagc_driver_sample_order_recipe_depth_locations, which fails onmainthere. On an RTX 3070 (NVIDIA 610.57.04, Linux, validation layer 1.4.335) it fails 3 of 3 runs on the base, where the recipe's replay leaves a different depth in 1533 of 4096 samples, and passes 3 of 3 with this change, with 0 of 4096 different. No log has aVUID-line. Thanks to @Doorriiaann (comment). That failure is not the RADV one in #9759.agc_driver_sample_order_render_pass_depth_locationsdoes not run in that configuration. It compares render passes with a dynamic-rendering reference, and with graphics pipeline libraries off the device draws only through render passes, so it skips by design. It passes with them on (3 of 3 in the same run, and on the RTX 3080 above).python3 tools/check_conventions.py --base origin/mainpasses.Overlap: #5609 rewrites
Pipeline::Beginaround the same lines, so whichever lands second needs a sync. No open PR changes how render pass begin chains sample locations.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
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-11-14T13:03:01Z.
Review: COMMENTED
Reviewed the change (read-only correctness analysis against current
mainf0c9b11f91; I did not run a build).Correct, and the two load-bearing claims check out in the code:
boundColorAttachmentsonly fed the removed chain. Its sole uses are the assignment atPipeline.cpp:618andVkAttachmentSampleLocationsEXT initial{boundColorAttachments, info}at:984— both removed here — plus the member declaration. Nothing else reads it, so dropping it is safe.initialLayout/finalLayout=VK_IMAGE_LAYOUT_GENERAL(Pipeline.cpp:632-633) and the subpass reference is alsoGENERAL(:623). With no layout transition,VkRenderPassSampleLocationsBeginInfoEXT::pAttachmentInitialSampleLocationsis never consumed — it only supplies locations for an automatic depth/stencil layout transition — so it was dead.The post-subpass entry is the meaningful part: with the chain, the render-pass path carried a second source of sample locations on top of the pipeline's
VkPipelineSampleLocationsStateCreateInfoEXT, while the dynamic-rendering path (vkCmdBeginRendering) only ever uses the pipeline state. Dropping the chain makes both paths derive sample locations solely from the (unchanged) pipeline state, which is exactly why it reconciles the 2× multisample output difference. Consistent with the AMD/Intelagc_driver_sample_orderruns above.LGTM.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by kurexw on 2026-11-16T23:35:47Z.
Review: COMMENTED
Tested on macOS 27.2 / Apple M4 with MoltenVK 1.4.2 (LunarG Vulkan SDK 1.4.363.1, validation layer 1.4.363), x86-64 build under Rosetta. This is the only GPU I tested. On this device the driver draws only through render passes, so the path this PR changes is the one that runs here.
Environment:
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer;ctest --test-dir build -R '^agc_driver_(sample_order.*|sample_location.*)$' -V, three runs per side. Every Vulkan test loggedInsert instance layer "VK_LAYER_KHRONOS_validation"and none loggedwas not found but was requested by env var VK_INSTANCE_LAYERS.agc_driver_sample_orderdoesn't run on main on this Mac. MoltenVK fails to compile its fragment shader (cast from pointer to smaller type 'int' loses information), and #19986 fixes that. Both sides therefore include #19986: main3b17977ba6+ #19986 against main + #19986 + this PR (headb0e8cb3edb).agc_driver_sample_orderagc_driver_sample_order_recipe_depth_locationsagc_driver_sample_order_planning(CPU)agc_driver_sample_location_grid_fallback(mock)agc_driver_sample_order_grid_referenceshaderStorageImageMultisample)agc_driver_sample_order_render_pass_depth_locations(new)0
VUID-lines on either side.So on a render-pass-only device, nothing regresses and the existing sample-order checks still pass. I can't confirm the fix itself on this GPU, because the new test needs dynamic rendering for its reference.
Separately, on main alone (without #19986) this PR leaves
agc_driver_sample_orderfailing with the same MSL compile error, so it doesn't overlap with #19986.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T23:45:13Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the hardware results are author reported, and the available code review supports the stated render pass fix.
What I ran
Reviewed head
b0e8cb3edb7daaa353556808437209f4b23aa7d7. I did not run tests or a build. I read the prepared description, commits, manifest, and diff; inspected the changed pipeline code and relevantSampleOrder.cppsections. Full text read:Pipeline.hpp,Pipeline.cpp,agc_driver_sample_order_tests.cmake, andSampleOrder.cpp. Excluded by the review folder:Graphics.cpp(too large); its changed assertion was visible in the diff.Results
Graphics.cppnot readFindings
Blocking
None found in the code inspected.
Non-blocking
None.
Not verified
I did not read the full
Graphics.cpp, run tests or a build, or independently verify the reported GPU behavior and CI results. The other four changed files listed above were read.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T21:41:11Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the provided device and CI runs support the fix, and the code reviewed is consistent with the stated behavior.
What I ran
Reviewed head
a76edd54fecbebbbe4eb553d29149f1ace63f034. No test commands were run; this session provides the prepared diff and a reader for source inspection.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full changed file
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas read at the changed hunk only; its remaining contents were not reviewed. The full text for that file was excluded from the review folder because it was too large. The changed source files read werePipeline.hpp,Pipeline.cpp,Graphics.cpp(changed hunk),agc_driver_sample_order_tests.cmake, andSampleOrder.cpp.description.md,commits.md,manifest.json, anddiff.patchwere also read. Automated tests and hardware behavior were not independently verified; the PR description reports those results.To get this to a good state
Nothing is required.