fix(agc): give a depth stencil copy's layout barrier both aspects #9057
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9057"
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 milescoviello on 2026-10-21T11:09:19Z.
What
The depth sample reorder (
SampleOrder.cpp,Depth) copies the depth plane into an image of the surface's own format before redrawing it in the guest's order. For aD32_SFLOAT_S8_UINTsurface that only reorders depth (SampleOrderMethod::Depth), the copy image is still D32S8. But its first transition toGENERALnamed the depth aspect alone. WithoutseparateDepthStencilLayouts, Vulkan requires a depth/stencil format's barrier to name both aspects. The Khronos layer reports this asVUID-VkImageMemoryBarrier-image-03320, 6 times over the sample order tests, from the 2x and 4x "depth format 130 through a depth pass" cases.The barrier now takes its aspects from the format (
HasStencil(target.format)), astransitionLocatedin the same file already does. The copy region still moves depth only when only depth is reordered.Tested
maind2e42c334das7333de6aee(commit unchanged,git range-diff). RTX 4070 Ti (615.71.09, Ubuntu 26.04.1, GCC 15.2, Release), 3 runs each: with #9056 (53949c0775) the 4sample_ordertests pass; alone, 3 of the 4 still fail there, as onmain, which #9056 fixes.Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti, driver 595.99.02, on
main275e896797.Khronos validation layer 1.4.363 over the 4 tests matching
sample_order:main:VUID-VkImageMemoryBarrier-image-03320×6 andVUID-VkWriteDescriptorSet-descriptorType-00337×18.03320is gone, and nothing is new.Pass and fail counts are unchanged by this change, under the layer and without it (3 of 3, and under lavapipe).
agc_driver_sample_order_planningpasses. The other three fail on this device onmainand with this change alike: the remaining00337reads are a test issue, which #9056 fixes. That PR passes all 4 here.AMD, Windows: @DavidSamir ran it with #9056 on a Radeon 680M (driver 32.0.21030.2001) under the 1.4.363 layer. The 6
03320errors onmain27fabb6b7are gone.NVIDIA, Windows: @MaxLikesCode ran it on an RTX 4090 (driver 617.42, Windows 11) on
main2c4b116da, under the 1.4.363 layer, 3 runs each.main+ #9056 still has 603320per run; with this PR added there is no VUID, and the pass and skip counts are unchanged.@EagleBearerYS (#6683's author) reviewed it. They confirmed this was the only barrier in
SampleOrder.cppnaming fewer aspects than its image's format has, and ran it with #9056 on GitHub's runners (lavapipe: the sample order tests pass 3 runs in a row).Older layer, lavapipe: @xXPBSXx ran all 483 built
agc_driver_*_testsunder the Ubuntu 24.04 layer package (1.3.275) onmain950388bfd.mainreports03320only fromagc_driver_sample_order; with this change that test passes with no03320, and only #9056's00337remains. One run.NVIDIA and AMD, Windows: @wachi35676 ran it with #9056 on an RTX 5070 Ti (driver 617.42) and an AMD Radeon iGPU (gfx1036, driver 32.0.21042.62), Windows 11, 3 runs each: with both PRs
sample_orderand_recipe_depth_locationspass 3 of 3 on both GPUs (they fail onmain). No validation layer on that machine.lavapipe on the current host (Mesa 26.0.8-1ubuntu0.3, LLVM 21.1.8, Ubuntu 26.04.1), this PR alone merged onto
maina6dcea9279: the 4sample_ordertests pass 3 of 3. On the RTX 4070 Ti (615.71.09) in the same build, 3 of the 4 still fail, as described above: #9056 fixes those.Not tested: Intel.
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 DavidSamir on 2026-10-21T11:49:00Z.
AMD Radeon 680M (AMD 32.0.21030.2001, Windows) result for this PR together with #9056, under the validation layer: https://github.com/boykopovar/AnyPS5/pull/9056#issuecomment-6315166760. The
VUID-VkImageMemoryBarrier-image-03320errors (6 onmain27fabb6b7) are gone with both PRs.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T11:50:39Z.
Read against
SampleOrder.cpponmain: this is right, and it fixes a bug in our #6683's code (57ceb9e370). Thanks for finding it.SampleOrderMethod::Depth, as when it has no stencil address) still gets a D32S8 copy fromcopyFor. That copy's firstUNDEFINEDtoGENERALbarrier named the depth aspect alone. Nothing in the driver enablesseparateDepthStencilLayouts, so VUID-VkImageMemoryBarrier-image-03320 applies and the barrier must name both.layoutAspectsfollows the copy's format, astransitionLocateddoes for the surface. The copy region and the descriptor stay depth-only, so only the layout barrier changes.SampleOrder.cppthat named fewer aspects than its image's format has. The tests' ownToGeneralcalls already take both.main275e896797(run):agc_driver_sample_order,agc_driver_sample_order_planning,agc_driver_pixel_sample_iterationandagc_driver_sample_location_grid_fallbackpass 3 runs in a row, and the grid-reference and recipe tests skip.03320count isn't reproduced here.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T11:56:13Z.
Thanks @EagleBearerYS for the review, and for checking that no other barrier in
SampleOrder.cppnames fewer aspects than its image's format. Thanks @DavidSamir for the 680M run under the layer. Both are in the Tested section now.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T19:52:12Z.
Validation-layer data point for this PR (data only).
Setup: Linux (WSL2 Ubuntu 24.04, GCC 13.3, Release), llvmpipe,
vulkan-validationlayers1.3.275.0-1 from the Ubuntu archive (older than the SDK a driver ships with),VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.main950388bfd; this PR's change (taken asgit diff upstream/main...refs/pr/9057) applied on top of it.Before (
main): across all 483 builtagc_driver_*_teststhe layer reportsVUID-VkImageMemoryBarrier-image-03320once, fromagc_driver_sample_order: barrier on a depth/stencil image (D32_SFLOAT_S8_UINT) with only the DEPTH aspect and no separateDepthStencilLayouts.After (this PR):
agc_driver_sample_orderrun again with the layer: 0 reports of that VUID, test passes. VUID-VkWriteDescriptorSet-descriptorType-00337 (a depth view without SAMPLED usage used as a sampled image) is still reported 3 times in that run's log; #9056 is about that one.One run each, on llvmpipe only.
Not run: other GPUs for the layer run, other platforms, the other tests with the change under the layer.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T19:53:16Z.
Thanks @xXPBSXx. So
03320also comes only fromagc_driver_sample_orderacross the 483 tests, and this PR clears it there. I added it to the Tested section.AI-assisted: yes (Claude Code)