fix(agc): keep the guest's sample order where pixel (0,0)'s locations stand in for a 2x2 grid #6683
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6683"
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 EagleBearerYS on 2026-10-16T04:39:28Z.
What
#6451 lets a draw whose MSAA sample locations vary between the pixels of the guest's 2x2 pattern run on a device without a 2x2 sample location grid: it draws pixel (0,0)'s locations in every pixel. Resident Evil Village's (PPSA01556) 2x checkerboard holds the same two positions in every pixel (x = +4/16 and -4/16) and swaps them on odd rows. So the stand-in draws every position exactly, and only the samples' order differs on odd rows. A pass that reads samples by index, as checkerboard reconstruction does, then exchanged the two half-pixels of those rows.
This keeps the guest's sample order where the stand-in holds the same set of positions:
SampleID, applies sample masks and exports coverage through each pixel's order.FragDepthpass;VK_EXT_shader_stencil_export, or one pass per bit.shaderStorageImageMultisample(with a storage view of the colour format),sampleRateShading, or a depth formatFragDepthwrites back exactly, and for patterns whose pixels hold different positions.VkSampleLocationsInfoEXT):212c35f08a).VK_EXT_sample_locations leaves such depth undefined after a transition that omits them. The RTX 3070 then read it back at the standard 2x locations, which put odd rows' depth on the other sample.
uvec4and swapped pixel (0,0), whose order is kept. A planning check now refuses any sample-order shader that indexes a vector or array through a non-constant value.vkGetPhysicalDeviceMultisamplePropertiesEXT) and no longer takes a 0x0 grid for a 2x2 one.583cca0993, from jotitadev's review) take the stand-in alone for every pass, depth-only passes included, as #6451 alone does. Every pass with a multisampled colour target is refused there, so a depth-only pass that reordered would leave a shared depth target in a different order from the colour passes that test against it. On a device that has them, a colour format without a storage view at its sample count still refuses only its own passes; the debt entry says so.mainwrites 41): this PR's sample order is written aftermain's stencil operation value export flag and read atversion >= 42. Shader cacheFormatVersion44 (mainis at 43 since #8295). #7223 and #7395 (ours) move the format too, so whichever of them lands later takes the next free number.mainnow gives a multisampled colour target storage usage only at its first storage binding. On a device where this PR may reorder its samples, the target still gets storage usage and a mutable format when it is made, as before, and #5881's recorder checks expect that there. Moving the swap's storage usage to its first reorder too is a possible follow-up; it needs the target swapped before the draw's framebuffer takes its view.745f199d5a): both sides' pixel-request fields, serialization and SPIR-V helpers are kept.SampleID.EmitSampleOffsetreadsSampleIdthroughEmitBuiltinU32, which returnsGuestSampleIndex, so host sample i reads guest sample order(i)'s location.#6451 is merged, and this branch merges current
main. The change is its six commits after #6451's, a review follow-up (a932bcc7d6) and three review test commits (9b7f8cd2e3,44e8786ba0,ef6ec1e242).Cost
Two passes over each multisampled attachment per render pass that draws with the stand-in. On the RTX 3070 at 1920x2160, 2x, the median of 100 frames is 2.142 ms of GPU time per frame with one depth-only and one colour+depth pass swapped in and out; naming the sample locations at the depth copy's transitions makes it 2.132 ms.
Tested
Resident Evil Village (PPSA01556), Windows 11, RTX 3070 Laptop GPU (driver 617.42):
[gpu] driver failure: AGC graphics: sample locations varying between pixels require a 2x2 sample location grid for the draw's sample count.Windows 11, RTX 3070 Laptop GPU and AMD Radeon (integrated), Vulkan:
57ceb9e370): "the exact path differs from the reference in 10 color and 3005 depth samples". All 3005 are the sloped depth samples, read back at the standard 2x locations;agc_driver_sample_orderfailed with "the 2x color format 9 put in the host's order: sample 0 of pixel (0, 0) holds 0x000000b1 0x00000000, expected 0x00000000 0x00000000 (sample 0)". 0xb1 is sample 1's fill. The grid reference failed with "the exact path: sample 0 of pixel (0, 0) does not hold its own sample index in color";agc_driver_sample_orderpasses (39 swap round trips, 6 shader remap checks, 3 scene checks) and the exact path holds the guest's depth at the guest's sample locations in 3005 of 3005 sloped samples. The composite reference reads its depth back at the standard locations on this device too (0 of 3005), so the bit-for-bit comparison skips with the counts.--repeat until-fail:5:agc_driver_sample_orderandagc_driver_sample_location_grid_fallbackpass every run;agc_driver_sample_order_planningpasses every run on the AMD iGPU. On the RTX 3070 machine it failed once in its first three runs with "sample order pipeline tests leaked Vulkan objects": nothing leaked, but each linked pipeline queued an optimized link on the pipeline-library worker, whose calls into the test's mock counters raced with the test thread's. The last commit turns link-time optimization off in that test (ThreadSanitizer on Linux: races in 11 of 11 runs before, none in 20 after; under load 13 of 40,000 runs failed before, none of 60,000 after). GitHub's Windows runner passes it 200 runs in a row.maxSampleLocationGridSize1x1 for every count); AMD Radeon, 2x2 at every count. With the per-count grid read, the RTX 3070 hosts a real grid at 2 samples, so Resident Evil Village draws its checkerboard there natively and does not take the stand-in; the stand-in and this PR's exact path serve devices without one.Linux, lavapipe (Mesa 25.2.8), CI's Linux configure:
agc_driver_sample_order_planning(mocks): orders and refusals on capable, gridded and refusing devices; plans per attachment and load/store op; render-pass and library pipelines; the cache key and serializer round trip.agc_driver_sample_order:SampleIDand exported coverage reach the guest's samples;agc_driver_sample_order_grid_referenceskips on lavapipe, which has no 2x colour and depth targets.212c35f08a,c3f947ef47,ee406d6179,3d2d8e5305), from an after-the-fact completeness review:agc_driver_sample_order_recipe_depth_locations(GPU) checks that a depth-only pass opened by a recipe hit still names its locations; a mock test pins the sample-mask throw and its message; the debt entry gives the per-count grids and the throw. On GitHub's runners (run) the sample-order tests andagc_driver_graphicspass 10 runs in a row on Linux, and the GPU tests skip on both runners. On the RTX 3070 and the AMD iGPU here the recipe test skipped, with the change and without it: both devices read depth drawn at custom sample locations back at the standard 2x locations even in a recorded draw with the named transitions ("of 3005 sloped depth samples, 1 hold the slope's depth at the guest's sample locations and 3004 at the standard 2x locations"), although the depth images carryVK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT. So no device we have can show this change's before and after; it follows VK_EXT_sample_locations, which leaves such depth undefined after a transition that omits the locations. The other sample-order tests pass on the RTX 3070 at this head.f90ffa8795splits each render's guest-location counts by even and odd rows. On the RTX 3070 the exact path's 1499 are all 1,499 even-row samples. None of the 1,506 odd-row ones, the pixels whose sample order changes and which the swap rewrites, match the guest's locations or the standard 2x ones. The AMD iGPU holds 1,499 of 1,499 and 1,506 of 1,506.0700f72070: where the recorded draw's depth doesn't read back at the guest's locations,agc_driver_sample_order_recipe_depth_locationscompares the recipe's replay with the recorded draw bit for bit instead of skipping.aaffe035ac: a draw builds a recipe only when its pipeline doesn't reorder samples (!pipeline->ReordersSamples()inDraw.cpp), so the test checks that the checkerboard through the exact path builds no recipe, and that pixel (0,0)'s locations, through the device's grid and without one, build a recipe whose replay matches the recorded draw.7f03326540: the grid reference compares the device grid's depth with the composite only where the grid reads it back at the guest's locations, and otherwise compares its color alone.7f03326540, on the RTX 3070 and the AMD iGPU, the recipe test passes 3 of 3 (0 of 4,096 differences in each replay, and no recipe through the exact path). The grid reference skips on both, as before: the composite holds the guest's depth in 0 of 3,005 sloped samples. On GitHub's runners the sample-order tests and those tied to the changed files pass on Linux (68, 4 skipped) and Windows (71, 46 skipped) (run).9b7f8cd2e3,44e8786ba0,ef6ec1e242), Linux, CI's configuration. Each fails with its fix line reverted:SampleIdreturning the host index instead ofGuestSampleIndex:agc_driver_pixel_sample_iterationfails with "2x: an iterated PERSP_SAMPLE on a reordered pattern varying across the 2x2 grid: the table index's low bits are not the order word's nibble at the shader's SampleId";|| pixel->ReordersSamples():agc_driver_pixel_sample_iterationfails with "2x: a pixel shader that only reorders its samples was not given the position input";ReorderedSampleBits:agc_driver_sample_orderfails with "4x a quad sample mask reached the pixel shader in the guest's order: guest sample 0 of pixel (3, 0) ran, expected guest mask 2".a932bcc7d6and the merges after it:agc_driver_sample_order_grid_referenceskips with "skipped, the device does not keep depth drawn at custom sample locations …", whichtools/check_skips.py'sDEVICE_LIMITATIONaccepts.main7ce3b1df3e(8c9c8eb5b5, the head;6d09797d6bbefore it mergedmain1ff5c8ac5c), on GitHub's runners (run):agc_driver_pixel_sample_iteration,agc_driver_graphics,agc_shader_memory,request_serializer,agc_shader_replay_requestsandagc_shader_disk_cache. On Windows, 67 of the 116 skip without Vulkan, the GPU tests among them, and the rest pass.guest_raise_in_system_call. This PR doesn't reach it, and it timed out on an unrelated branch the same night (run).6d09797d6b, on a cloud worker, the^(agc|shader)tests pass: 859 tests, 0 failed, 59 skipped.ctest -R '^agc':e6068b79a6, 604 of 605. The one failure isagc_driver_preparation_scope_settle, a load flake that also fails onmainunder the same parallel load; alone it passes 20 of 20;main03c4cb5e78, 609 of 610 withrequest_serializer. The one failure is #5791'sagc_driver_mesh_index_cache, which crashes llvmpipe's LLVM onmaintoo.mainf474fb7768(through #6451's merge), on GitHub's runners (run): the sample-order tests,request_serializer,agc_shader_memory,agc_driver_graphicsand #5881's multisample tests pass 3 of 3 on Linux (64 tests) and Windows (67, of which 45 skip without Vulkan). The run shows as failed only because its Windows job listsguest_kqueue, a failure that runner has onmaintoo, without amaincomparison.main9b6837704f(71de590bd4, the head, with #6012's overlay shaders), on GitHub's runners (run): the^agctests pass on Linux (717, 0 failed, 51 skipped), and the suites' only failure is libc'sprecise_waittiming test. On Windows, where 539 of the 717 skip without Vulkan, the only failures areagc_driver_pm4_replay_toolandagc_shader_replay_tool(exit code 0xc0000139), which fail the same way on that runner for an unrelated branch (run).--repeat until-fail:10.583cca0993(devices without multisampled storage images), on GitHub's runners (run): without the change,agc_driver_sample_order_planningfails on Linux and Windows with "a depth-only pass on a device without multisampled storage images was reordered"; with it, it passes 5 of 5 on both.3d42f6097, which the current head only mergesmaininto, merged ontomain12a71f3f5(review): the 12 sample-order, sample-mask, serializer andagc_driver_graphicstests pass 3/3 on both, andagc_driver_sample_order_grid_referenceandagc_driver_sample_order_recipe_depth_locationsskip on both. With only 583cca0993's new line inSampleOrderRefusalremoved,agc_driver_graphicsfails witha depth-only pass on a device without multisampled storage images was reordered.Checklist
main7ce3b1df3e, merged in (#6451 is merged). Overlaps, checked withgit merge-treeagainstmain5d9dcc42d2, each an adjacent edit where both sides are kept:Recompiler.hpp,ShaderStageInputInfo.hpp,DrawLookup.cpp,DrawRegisterKey.cpp), their serialization and tests, and SPIR-V helpers inSpirvModuleEmitter.cpp. See "With #6470" above.FormatVersionline inShaderDiskCache.hpp: #6243, #6280, #6412, #6454, #6486, #6488 and #6296/#6032 (offline shader tools). The version takes the next free number.DrawRegisterKey.cpp: #6530 (line and polygon smoothing through SAMPLE_COVERAGE) adds to the same pixel-request comparison. Where both apply, coverage this PR maps through the pixel's sample order would include #6530's.MultisampleTargetandDraw.cppnext to the swap's hooks, as does #6636 (ours, reused address-based draw builds) inDraw.cpp.Pipeline.hpp/.cpp.VulkanDevice.cpp,Pipeline.cppand the debt entry, and #5915 and #6571 (CB resolve sample counts) in the same debt entry. #5907 keeps the one-sample case this PR leaves to it.CMakeLists.txt: #2434, and #6012 (merged): this branch's merge ofmain9b6837704f(71de590bd4) keeps #6012's overlay shader loop after this PR's sample-order loop.NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file (none added).mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T05:32:18Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hppL5core/shader/recompiler/tests/RequestSerializerTests.cppL217, L257, L283, L413, L432, L455, L462core/libs/prx/libSceAgcDriver/CMakeLists.txtL2909, L2913core/shader/recompiler/tests/RequestSerializerTests.cppL217, L257, L283, L413, L432, L455, L462core/shader/recompiler/ShaderDiskCache.hppL16core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppL206-207core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppL66core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppL101, L287, L313, L465-466core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppL66core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppL101, L155-157, L287, L313, L465-466core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppL66core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppL101, L155-157, L287, L313, L465-466core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppL66core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppL101, L155-157, L287, L313, L465-466core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppL66core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppL101, L155-157, L287, L313, L465-466core/libs/prx/libSceAgcDriver/tests/Graphics.cppL10479core/libs/prx/libSceAgcDriver/CMakeLists.txtL174core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL4852, L4970, L5126-5127, L5146-5147, L5149-5150, L5161-5162, L5170-5171, L5179-5180core/shader/recompiler/tests/RequestSerializerTests.cppL217, L257, L283, L413, L432, L455, L462core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL4852, L4970, L5126-5127, L5146-5147, L5150, L5161-5162, L5170-5171, L5179-5180core/shader/recompiler/tests/RequestSerializerTests.cppL217, L257, L283, L413, L432, L455-456, L462core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppL265-266docs/dev/debt/libSceAgcDriver.mdL157-158core/libs/prx/libSceAgcDriver/tests/execution/MultisampleRetirement.cppL489-490core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL4852, L4970, L5126-5127, L5146-5147, L5149-5150, L5161-5162, L5170-5171, L5179-5180core/shader/recompiler/tests/RequestSerializerTests.cppL217, L257, L283, L413, L432, L455, L462core/shader/recompiler/CacheKey.hppL219core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppL466core/libs/prx/libSceAgcDriver/tests/execution/MultisampleRetirement.cppL489-490core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppL2481core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppL265-266core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL4852, L4970, L5110-5111, L5147-5148core/shader/recompiler/CacheKey.hppL219core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL357, L425, L830, L870core/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppL197core/shader/recompiler/Recompiler.hppL192core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppL169core/shader/recompiler/tests/RequestSerializerTests.cppL57, L217, L257, L283, L413, L432, L455, L462, L507-508Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppcore/shader/recompiler/tests/RequestSerializerTests.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/ShaderDiskCache.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/shader/recompiler/Optimization/src/ShaderInfoCollector.cppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/include/MultisampleTarget.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/tests/RequestSerializerTests.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/DepthSurface.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DepthSurface.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Context.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Optimization/src/ShaderInfoCollector.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Execution/include/VulkanDevice.hppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/include/Texture.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Pipeline.hppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppcore/shader/recompiler/Optimization/src/ShaderInfoCollector.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppcore/shader/recompiler/tests/RequestSerializerTests.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T18:00:38Z.
Review: COMMENTED
A question about passes that share a depth target but take different paths, with a mock check, and a Linux run of the tests.
Machine: Linux, NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3, LLVM 21.1.8). Ubuntu 26.04, i7-8700, GCC 15.2, Release. Head
418d5abb8merged intomain66e290f1c(clean).^agc_driver_sample_,agc_driver_graphics,request_serializer,agc_shader_memory(12 tests): pass 3/3 on the RTX 3070 and on lavapipe.agc_driver_sample_order_grid_referenceandagc_driver_sample_order_recipe_depth_locationsskip on both. On the RTX 3070 under Linux the recipe test gives the same counts as your Windows laptop:1 hold the slope's depth at the guest's sample locations and 3004 at the standard 2x locations, and the device logs2 samples 2x4, 4 samples 2x2, 8 samples 1x2.Mixed passes on one depth target.
SampleOrderRefusalis decided per render pass state, and nothing records which order a surface's samples are in between passes. On a device withoutshaderStorageImageMultisample(MoltenVK on Apple GPUs reports it as false, with a 1x1 grid at 2 and 4 samples), a depth-only pass and a colour+depth pass on the same target take different paths. A temporary print inagc_driver_sample_order_planning, using the test'svillagepattern and itsnoStoragecontext:So a depth prepass stores the target in the guest's order (
toGuest), and the colour pass that follows tests against it with no swap, in the stand-in's order. On odd rows each sample is then compared with the depth written at the other half-pixel's position. With #6451 alone both passes kept the stand-in's order and agreed. If that is intended, a note in the debt entry would help; otherwise refusing the whole surface once one pass is refused, or keeping the order per surface, would avoid it. I have not drawn this case on a GPU: the RTX 3070 and lavapipe both have multisampled storage images, so neither takes the refused path.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3, LLVM 21.1.8), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-16T18:51:18Z.
@jotitadev thank you for the review, the Linux runs on the RTX 3070 and lavapipe, and the mock check. You're right: the refusal is decided per pass, and on a device without
shaderStorageImageMultisamplea depth-only pass reordered the target while a colour+depth pass on it was refused, so the colour pass tested against samples in the other order.583cca0993makes such a device refuse the exact order for every pass, depth-only passes included, so its depth targets keep the stand-in's order throughout, as with #6451 alone.agc_driver_sample_order_planningnow checks your pair on thenoStoragecontext: without the change it fails with "a depth-only pass on a device without multisampled storage images was reordered", and with it it passes on GitHub's Linux and Windows runners.A device that has multisampled storage images can still refuse a single colour format without a storage view at its sample count. A depth target shared by such a pass and a depth-only pass would then change order between them. The debt entry now says so; a full fix would decide the order per target rather than per pass, which also touches the shader's sample remap, so I've left it for a follow-up.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T22:31:02Z.
I have a focused candidate for issue #6957: sample a multisampled target in
SHADER_READ_ONLY_OPTIMALafter storage writes, then restoreGENERALbefore attachment or storage use. It is separate from sample-order correction, but both modifyMultisampleTarget::Sampledand the borrowedTextureconstructor. The combined path needs to keep this PR’s restricted sampled-view usage while setting the read-only layout. No urgency; could you advise whether #6683 should land first, or whether you would prefer the layout fix to go first so this PR can rebase on it? I have not opened the follow-up yet.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-16T22:36:53Z.
@MarcZX100 Thanks for checking first. Either order works for us. #6683 is mergeable on current
main, so please open yours when it's ready rather than waiting. Whichever lands second rebases onto the other, and if the layout fix lands first, I'll rebase #6683 onto it.On the combined path, as far as I can see:
Sampledkeeps passingVK_IMAGE_USAGE_SAMPLED_BITas the view usage when the target has an order format, so the sampled view doesn't take the image'sSTORAGEusage, which the target's own format may not support. It then takes your read-only layout, andSAMPLEDusage is valid inSHADER_READ_ONLY_OPTIMAL.GENERAL(SampleOrders::StorageinSampleOrder.cpp). On the UHD 770, the reordered samples would likely meet the same fetch behaviour as in #6957. Whichever PR lands second should count that pass as a storage write for your transition, so that the next sampled read also goes throughSHADER_READ_ONLY_OPTIMAL.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T22:57:47Z.
Thanks for confirming either integration order. #6635’s author has since asked that their already-approved PR land first to avoid parallel conflicts, so I marked #6971 as draft and will rebase it after #6635 merges. The combined preview compiled the sample-order storage path with the layout transition; I’ll rerun the checks after rebasing.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-17T13:35:53Z.
Review: COMMENTED
@EagleBearerYS, re-ran
3d42f6097for the depth-only point.583cca099closes it, and the new check catches it.Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02) and lavapipe (Mesa 26.0.3). PR merged ontomain12a71f3f5(clean).ANYPS5_NO_SHADER_CACHE=1,-j1 --timeout 30.agc_driver_graphicstests: pass 3/3 on the 3070 and on lavapipe.grid_referenceandrecipe_depth_locationsskip on both, as before.SampleOrderRefusalremoved (if (!context.storageImageMultisample) ...),agc_driver_graphicsfails witha depth-only pass on a device without multisampled storage images was reordered.The current head
7246963c9only mergesmainon top of3d42f6097; the PR's commits are unchanged.Not run: Windows, AMD, any title.
GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02) and lavapipe (Mesa 26.0.3), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-17T13:44:39Z.
Thanks for re-running it on the 3070 and lavapipe, and for the check with that line removed. I've added your runs to Tested and the GPU list.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T09:22:59Z.
On an RTX 4090 (main + this PR),
agc_driver_sample_orderpasses, butgrid_referenceandrecipe_depth_locationsboth skip because the composite reference holds 0/3005. The same log shows the exact path at 1499/3005 at the guest's locations, while the recorded draw and the recipe's replay are at 1/3005. Couldrecipe_depth_locationscompare the recipe path with the exact path (or assert it is no worse than it) when the composite reference is unusable, instead of skipping? As it stands it executes on none of the four devices tried (3070, AMD iGPU, lavapipe, 4090). Also: is 1499/3005 for the exact path on NVIDIA expected? AMD reports 3005/3005.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-18T13:28:36Z.
@oneandonlydean thanks for running them on the 4090. Four test-only commits are now on this branch (head
7f03326540):f90ffa8795splits each render's guest-location counts by even and odd rows.0700f72070: when the recorded draw's depth doesn't read back at the guest's locations,recipe_depth_locationsno longer skips. It compares the recipe's replay with the recorded draw bit for bit, as the device reads both back.aaffe035ac, on comparing the recipe path with the exact path: the two never meet. A draw builds a recipe only when its pipeline doesn't reorder samples (the!pipeline->ReordersSamples()condition inDraw.cpp), so a pass through the exact path is always built in full, with its swaps. The test now checks that: Resident Evil Village's (PPSA01556) checkerboard through the exact path builds no recipe, while pixel (0,0)'s locations, through the device's grid and without one, still build a recipe whose replay matches the recorded draw. A "no worse than the exact path" check would compare two different scenes, which is why your counts differ (1 against 1,499).7f03326540:grid_referencecompares the device grid's depth with the composite only where the grid reads it back at the guest's locations, and otherwise compares its color alone.At
7f03326540, Windows 11, MinGW Release, on our NVIDIA GeForce RTX 3070 Laptop GPU (driver 617.42) and the integrated AMD Radeon Graphics (Ryzen 9 5900HS):recipe_depth_locationspasses 3 of 3 on both: pixel (0,0)'s replays, with the grid and without it, differ from the recorded draws in 0 of 4,096 samples, and the checkerboard through the exact path builds no recipe.grid_referenceskips on both, as on your 4090: the composite of uniform renders holds the guest's depth in 0 of 3,005 sloped samples, so no path can be compared with it bit for bit. That skip comes before commit 4's comparison.On the 1,499 of 3,005: it's one row parity. On the RTX 3070 the exact path holds the guest's depth in all 1,499 even-row samples and in none of the 1,506 odd-row ones, which match neither the guest's locations nor the standard 2x ones; the AMD iGPU holds 3,005 of 3,005. The odd rows are the pixels whose sample order changes, the only ones the swap rewrites, through a copy of the depth and a per-sample
FragDepthpass (SampleOrder.fragleaves identity-order pixels alone). We haven't found why that rewrite reads back differently on the 3070.What that means for Resident Evil Village: both GPUs host a sample location grid at 2 samples (the RTX 3070 2x4, the AMD iGPU 2x2), so the title draws its checkerboard natively on them and never takes the exact path; this PR leaves devices with a grid unchanged. In this test, though, depth drawn at custom locations doesn't read back at the guest's locations on either GPU outside the exact path: the device's grid, the composite and pixel (0,0)'s render all read 0 of 3,005 there and 3,005 at the standard 2x locations. Whether that's in our driver or in the test's model of the guest's locations isn't settled yet. It's separate from this PR.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T21:20:43Z.
Quick status update: #6971 remains in draft, and its commits are already included in #6973’s published composition with #6635. I’m not opening a separate copy of the layout change. #6973 is still open and conflicts with current
main, so that composed stack needs to be rebased before the layout fix can move forward. Your sample-order PR remains separate.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-19T00:21:45Z.
@EagleBearerYS this now conflicts with main after #6215 (multisampled target lifetime) in
Graphics/src/Draw.cppandGraphics/src/MultisampleTarget.cpp. It isn't a simple keep-both, because #6215 changed who keeps a multisampled target's images alive and the sample-order pass uses the same objects:AcquireFramebuffernow takes owners only (thepersistentvector is gone); a multisampled binding passesbinding.multisampleOwner.Sampled()now returns a lease overtextures[key], and the target keepsretiredTexturesuntilrelease().Could you rebase onto main and keep both behaviours? Three points to settle while doing it:
OrderView(). Can the target be retired (and its image freed) while recorded reorder work still uses it? Should they hold the same owner the framebuffer now holds?Sampled()go throughtextures[key]and the lease like main does, and where does its lifetime sit relative toretiredTextures?orderViewdestroy inrelease()should follow the same retirement rule as the storage view, so it can't be destroyed while a lease is outstanding.A test covering a retire during a reordered draw (extending #6215's lifetime test is fine) would settle 1 and 3.
Version note: this PR uses FormatVersion 40 and request 33 (main is 38/32); #7689 claims 39, so there is no clash today.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-19T00:45:39Z.
@oneandonlydean thank you for spelling out what #6215 changed and the three points. The branch now merges
maininstead of rebasing, as for its earlier updates, and the head isadc46f3ea0.adc46f3ea0gives it the same owner the framebuffer holds since #6215 (shared_from_this()), as the depth surface's order target already does.RecordSampleOrderkeeps it with the batch.Sampled()takes main'stextures[key]lease and only adds the sampled-only usage when the target has an order view. An order-format target is created with storage usage, somakeStorablereturns before it moves anything toretiredTextures. Its sampled textures follow main's lifetime unchanged.release()runs only from the destructor, soorderViewis destroyed withstorageViewonce the last owner, lease or kept batch is gone. With point 1's owner, recorded reorder work holds it too.For 1 and 3,
agc_driver_multisample_retirementhas a newOrderRemapcase next to #6215'sSampledRemap. It takes a sample-order target, remaps the guest block so the target retires, and requires the retired image to stay alive while the order target or its batch holds it. On GitHub's Linux runner (run) it fails all 3 runs without the fix ("a held sample-order target lost its image when its MSAA target retired") and passes all 3 with it. It skips on the Windows runner, which has no Vulkan device. The merge itself passes the^agctests on Linux (run). On Windows the only failures are the two replay tools (0xc0000139), which fail the same way on unrelated branches.Thanks for the version check too: 40 and 33 here, and #7689's 39 doesn't clash.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-19T01:51:49Z.
@EagleBearerYS thanks for the ownership fix in
adc46f3ea0, which checks out. Since then #6470 has merged, and #6683 now conflicts with it in 12 files. Both PRs add per-sample information to the same pixel-stage structures (ShaderPixelStageInfo, its input copy,ShaderInputInfoBuilder,DrawLookup,DrawRegisterKey,ShaderInfoCollector,SpirvModuleEmitter). This one needs a real merge rather than keep-both, so could you rebase onto current main? These are the points the merge has to settle:EmitSampleOffsetreadsSampleIdthroughEmitBuiltinU32, which #6683 remaps to the guest index (GuestSampleIndex). Please confirm that the mergedEmitSampleOffsetindexes the table by the guest sample together with the quad pixel (locations[quad*8 + guest]), not by the raw hostSampleId. The patterns #6683 reorders (same positions in another order, e.g. the rowSwap 0x76543201 case) are the ones whereSampleLocationsVary()is true, so the 32-entry table is the case that matters. A test with a reordered pattern that varies per pixel would cover it: an off-center barycentric read should land on the guest's location.ShaderInfoCollectorneeds position/FragCoord whenReordersSamples()(#6683) orSampleLocationsVary()(#6470) holds. Presumably these OR together. CanReordersSamples()be true withoutSampleLocationsVary()?SampleMaskIncarries one bit per invocation, soReorderedSampleBitshas to move that bit to the guest index, and the output mask has to go back to host order. Is there a test for a shader that iterates samples?ShaderMemory.cpp/RequestSerializerTests.cpp.RecompileCacheKey(CacheKey.hpp) andDrawRegisterKey.cppmust hash and compare bothsampleOrderanditeratesSamples/positionLocation/sampleLocations, so that shaders differing in only one group never share an entry.sizeof/field-count asserts forShaderPixelInputInfo/ShaderPixelStageInfowith both groups added. They only fire on Linux, so Windows CI would stay green while Linux fails to compile.agc_driver_sample_orderon Linux llvmpipe and skips the grid-reference and recipe tests there.Thanks!
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-19T03:07:05Z.
@oneandonlydean thank you for the list. The branch merges
mainover #6470 (745f199d5a), plusd2658d4d2b, and the head isd2658d4d2b.d2658d4d2bsets the sample-order test's pixel stage asDrawDecodenow does (iteratesSamplesfrom per-sample shading andsampleLocations): without it, the test's per-sample passes ran once per pixel. On GitHub's runners (run) the^agc,^shaderand^recompilertests pass on Linux, 758 of 758,agc_driver_sample_orderamong them. On Windows the only failures are the two replay tools (0xc0000139), which fail the same way on unrelated branches.EmitSampleOffsetreadsSampleIdthroughEmitBuiltinU32, which returnsGuestSampleIndex(host). WhenSampleLocationsVary()is true, it ORs in the quad pixel shifted by 3, so it readslocations[quad * 8 + guest], not the host index.HasPositionInput() || psDitheredAlphaToCoverage || QuadMasked() || SampleLocationsVary() || ReordersSamples(). A pattern this PR reorders puts the same positions in a different order across pixels, so its locations vary andSampleLocationsVary()holds too.ReordersSamples()stays in the condition so the order doesn't depend on that.ReorderedSampleBits(…, false)) before the shader sees it, andStoreCoveragereorders the output back to host order. When the stage iterates samples, the one host bit maps to the guest index of that invocation. There's no test for an iterated shader yet (see 8).ShaderMemory.cppandRequestSerializerTests.cppcover both groups: older versions drop both, and a version 34 request reads no sample order. If the other approved PR takes 35 first, the second to merge moves to the next number.CacheKey.hppappendsiteratesSamples,positionLocation,sampleLocationsandsampleOrder.DrawRegisterKey.cppcompares all four, andDrawLookup.cpphashes them.ShaderDiskCache.cpphas nosizeofor field-count assert onShaderPixelInputInfoorShaderPixelStageInfo. The Linux build above compiles with both groups.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-19T03:52:51Z.
@EagleBearerYS thanks, the merge over #6470 checks out, and so do your answers. A few small things before CI:
docs/dev/debt/libSceAgcDriver.mdnames title ids (PPSA01556, PPSA27836). New doc lines here don't name titles, so please describe the case without the ids. #6451's line has the same ids, so please drop them there too. The two lines will still touch the same spot; whichever PR merges second keeps this PR's longer line.SampleOrder.cpp(skipped, the device reads depth drawn at custom sample locations back at other locations...) doesn't matchDEVICE_LIMITATIONintools/check_skips.py, so if that test ever skips on Linux CI, the job fails. Wording it as e.g.skipped, the device does not keep depth drawn at custom sample locations...fixes that.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-19T04:21:53Z.
@EagleBearerYS heads-up for the same push: #4650 merged an hour ago and now conflicts with this branch in
DrawRegisterKey.cppandtests/ShaderMemory.cpp. #4650 took request format 35 and pipeline journal 4, so please mergemainand give this PR the next free numbers there, along with FormatVersion 41.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T07:18:20Z.
@oneandonlydean, thanks. All three points are in, and the branch merges current
main(7ce3b1df3e); the head is8c9c8eb5b5.mainwrites 41, after #4650 and the bumps since), with this PR's sample order aftermain's stencil operation value export flag, read atversion >= 42. The shader cacheFormatVersionis 44, since #8295 has just movedmainto 43. The pipeline journal isn't changed here.agc_driver_sample_order_grid_referencenow skips with "skipped, the device does not keep depth drawn at custom sample locations …", whichcheck_skips.py'sDEVICE_LIMITATIONaccepts.The three answers in my earlier comment now have a test each (
9b7f8cd2e3,44e8786ba0,ef6ec1e242), and each fails with its fix line reverted:On GitHub's runners (run) they and the sample-order, serializer and shader cache tests pass 5 runs in a row on Linux. On Windows the serializer and shader cache tests pass, and the GPU tests skip without a Vulkan device. At the merge before it (
6d09797d6b,main1ff5c8ac5c), the^(agc|shader)tests pass on Linux, 0 of 859 failed. The description has the details.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T07:24:42Z.
@EagleBearerYS thanks, checked on
8c9c8eb5b5. The serializer writes 42 and the shader cacheFormatVersionis 44, one abovemain's 41 and 43, and the branch mergesmaincleanly.HostSampleLocationsForkeepsmain's fallback (pixel (0,0)'s locations on a 1x1 grid with the one-time warning) and adds the same-set sample order. The pipeline keys now include the device's sample-location caps. Next is a full CI run on this head.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T11:09:31Z.
@EagleBearerYS a heads-up after the merge. On an RTX 4070 Ti with the 595.99.02 Linux driver,
agc_driver_sample_order,agc_driver_sample_order_grid_referenceandagc_driver_sample_order_recipe_depth_locationsfail onmain: they read back depth other than what was drawn.The tests read the depth surface by binding its own view as a sampled image. A multisampled depth surface sampled through #7318's shadow image has no
SAMPLEDusage, so the layer reportsVUID-VkWriteDescriptorSet-descriptorType-00337, and this driver returns other depth. The reorder pass itself samples a copy, so the driver code is fine.#9056 makes the tests read the same kind of copy, and then all 4 pass here. #9057 fixes a separate
VUID-VkImageMemoryBarrier-image-03320in the depth reorder's copy barrier for D32S8. Your review on either would be welcome.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T11:50:37Z.
@milescoviello, thank you for running these on the RTX 4070 Ti, and for both fixes. Both are right, and both fix code #6683 added:
SampleOrders::Depthnamed only the depth aspect of a D32S8 copy image. WithoutseparateDepthStencilLayouts, which the driver doesn't enable, VUID-VkImageMemoryBarrier-image-03320 requires both. #9057 fixes it.SAMPLEDusage. #9056 fixes the tests' reads.I've left a review comment on each.
Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-21T12:00:22Z.
@EagleBearerYS @milescoviello: an AMD data point for
agc_driver_sample_order_grid_reference. On the Radeon 680M it loses the device in the exact path's depth pass, and still does with #9056 and #9057.Setup: Windows 11 Pro 26200, AMD Radeon 680M (RDNA 2 iGPU;
shaderStorageImageMultisampletrue; largest sample location grid 2x2 at every count), AMD driver 32.0.21030.2001,main27fabb6b7, alone and with #9056 + #9057 merged.Failure: in
RenderCheckerboard(device, emulated, ...)(the exact path, withsampleLocationGridSampleCountsforced to 0):The
VUID-VkSubmitInfo-pSignalSemaphores-03242that follows (a timeline atUINT64_MAX) is the aftermath of the lost device. The reference composite before it renders fine.Narrowed down with local early returns in
SampleOrders(not pushed):Storage()(the compute pass over the colour alias): still faultsDepth(): no faultvkCmdCopyImage, or aftervkUpdateDescriptorSets: no faultvkCmdBeginRenderPass: still faultsdraw(pass.depth, 0u, 0xffu, 0u): no faultSo it's the
pass.depthdraw itself: the embedded fragment shader sampling the 2x depth copy, withsampleShadingEnableandminSampleShading1.0. The copy image looks right (DEPTH_STENCIL_ATTACHMENT|TRANSFER_DST|SAMPLED, device-local, bound at offset 0). My suspect is atexelFetchsample index taken fromDepthPush.mapthat is out of range at 2 samples: AMD's driver faults on that, while other drivers may clamp it. I haven't checked the shader source.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T12:02:08Z.
@DavidSamir, thank you for the Radeon 680M data point and for bisecting it down to the
pass.depthdraw, with and without #9056 and #9057. We're checking the depth pass's sample indices at 2 samples, starting with the map it reads fromDepthPush, and will follow up here with a fix if the fault is in our code.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T12:21:46Z.
Thanks @EagleBearerYS and @DavidSamir. If a fix for the 680M device loss comes out of this, I can run it on the RTX 4070 Ti under the layer, with #9056 and #9057, to check it changes nothing there.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-21T13:06:05Z.
@DavidSamir, we've checked what we can here. We haven't found the cause of the Radeon 680M device loss, and there's a branch to try.
What we checked (lavapipe, Mesa 25.2.8, validation layers 1.3.275):
VK_EXT_sample_locations, so it can't reach your located 2xD32_SFLOATpath. Over what it does reach (4x, unlocated), it found one error: the 03320 barrier that @milescoviello's #9057 fixes. Your format has no stencil, so that doesn't explain your device loss. Nothing else came up.The branch:
EagleBearerYS/AnyPS5fix/agc-sample-order-copy-sampled-only(4bdf36e05e),maind099bc6cd8plus three commits:TRANSFER_DST | SAMPLEDonly, withoutDEPTH_STENCIL_ATTACHMENT. Where a device refuses that usage, it keeps the old usage and is sampled inDEPTH_STENCIL_READ_ONLY_OPTIMAL.Could you run both trees and post the six logs? Use
maind099bc6cd8rather than27fabb6b7, so the trees differ only by those three commits. In Git Bash with CI's WinLibs GCC 15.2.0, CMake, Ninja, Python and the LunarG Vulkan SDK (drop the two*_LAUNCHERflags without ccache):Two layer settings files.
C:/anyps5-vvl/sync/vk_layer_settings.txt:and
C:/anyps5-vvl/gpuav/vk_layer_settings.txt, the same withVK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXTon the last line.Then, in each tree:
That last line prints one count per log; if any of them isn't 0, the layer didn't load. A device loss shows as
Vulkan result -4. AVulkan result 2isCommandBatch::Wait's fixed 5 s fence wait, which GPU-assisted validation outlasted on lavapipe. If you hit it, raise5'000'000'000ULLincore/libs/prx/libSceAgcDriver/Graphics/src/Resources.cppand rebuild.@milescoviello, thanks for the offer. Could you run the branch on the RTX 4070 Ti under the layer, with #9056 on top, to check that it changes nothing there? It already carries #9057's change, and merging #9057 into it would conflict on that line.