fix(agc): preserve empty images in stencil feedback checks #5917
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5917"
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 fdfawef324 on 2026-10-14T15:35:24Z.
What
Keep supported empty typed-image elements out of stencil replay's attachment-feedback scan. A null element currently reaches texture decoding and throws before an otherwise valid draw. The existing empty-image predicate skips that element while non-null depth aliases still receive the feedback refusal.
This is the separate follow-up requested in #5466, which has merged. The diff against main is now only this change: one production line in
Draw.cppand its own native fixturetests/execution/StencilNullFeedback.cpp.Tested
341613ab6(137 commits pastab9a47684, several touchingDraw.cpp) with no conflicts; headda0d5b2be, same three commits. Conventions check passes.da0d5b2be:ctest -R 'stencil|masked_select|replay'passed 3/3 runs (agc_masked_select,agc_driver_sample_mask_depth_stencil,agc_driver_stencil_null_feedback,agc_driver_stencil_ref_export_unused,agc_driver_stencil_replay,agc_driver_stencil_replay_no_gpl,agc_driver_pm4_replay,agc_driver_pm4_replay_tool).agc_driver_stencil_ref_exportskips because this GPU lacksVK_EXT_shader_stencil_export.agc_driver_stencil_null_feedbackalso passed 3/3 runs withAPS5_NO_GPL=1.Draw.cppline reverted,agc_driver_stencil_null_feedbackfails withguest texture descriptor has a null base address; with it restored, the test passes.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryCo-Authored-By: Codex [email protected]
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-15T00:44:09Z.
Rebased onto main
ab9a47684now that #5466 has merged. Its commits dropped out with no conflicts, so the diff is only the one-lineDraw.cppchange andStencilNullFeedback.cpp(head20e14ab0a->5cfd7bf6f).On an RTX 3060 (driver 591.86, Windows Server 2025),
ctest -R 'stencil|masked_select|replay'passed 3/3 runs, andstencil_null_feedbackalso passed 3/3 withAPS5_NO_GPL=1.stencil_ref_exportskips because the GPU lacksVK_EXT_shader_stencil_export. With only the product line reverted, the fixture fails with the null-base-address error. Marked ready for review.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-15T11:55:06Z.
Rebased onto main
341613ab6(137 commits, several touchingDraw.cpp) with no conflicts: head5cfd7bf6f->da0d5b2be, same three commits.On the RTX 3060 (driver 591.86, Windows Server 2025),
ctest -R 'stencil|masked_select|replay'passed 3/3 runs at the new head, now also coveringagc_driver_sample_mask_depth_stencilandagc_driver_stencil_ref_export_unusedfrom main.stencil_null_feedbackpassed 3/3 withAPS5_NO_GPL=1, and still fails with the null-base-address error when only the product line is reverted. Body updated.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:11:38Z.
Some 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/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtImported from boykopovar/AnyPS5. Originally posted by nicolasfalesy on 2026-10-16T08:52:47Z.
Tested on Linux (Arch),
c++ (GCC) 16.2.1 20260810, Release,BUILD_TESTING=ON,mainat5d9dcc42d2ec5401aebd089028b8d4d7410a77b4. GPU tests ran on lavapipe (Mesa 26.2.2, llvmpipe with LLVM 22.1.8).agc_driver_stencil_null_feedback(this PR's test) fails onmainplus this PR (2 of 2):With
APS5_NO_GPL=1it still fails, at the plain pipeline creation (AGC graphics: vkCreateGraphicsPipelines: Vulkan result -13), so it is not only the pipeline library path. CONTRIBUTING says CI runs the Vulkan tests on lavapipe, so this test would be red there. The description reports RTX 3060 only.I did not find which part of the pipeline state lavapipe rejects. A skip on that device, or a different fixture state, is needed for the test to run on lavapipe.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T11:46:38Z.
Review: CHANGES_REQUESTED
The
Draw.cpp:2096change looks right, but the new fixture does not run outside your NVIDIA setup:agc_driver_stencil_null_feedbacksegfaults insidelibvulkan_radeonon RADV (Mesa), inLinkPipelineFromLibrarieson the first draw, and also withAPS5_NO_GPL=1. @nicolasfalesy confirmed it independently on lavapipe (vkCreateGraphicsPipelinesresult -13, with and without GPL). CI runs the Vulkan tests on lavapipe, so it would be red.AttachNullImages(StencilNullFeedback.cpp:92-139) splices a descriptor-array variable into the SPIR-V by hand and appends a binding toresult.bindings. NVIDIA seems to tolerate a module/layout mismatch; other drivers do not. Please make the module and the pipeline layout agree (e.g. take the image array from a real shader, or validate the module with spirv-val), and run the test on lavapipe or RADV before pushing.Once the fixture passes on a non-NVIDIA driver (and still fails with the
Draw.cppline reverted), this is ready.Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-16T19:53:49Z.
Thanks both for running the fixture on RADV and lavapipe. We only have an NVIDIA GPU, so we could not reproduce the crash. What we could do without a GPU: compile the fixture's two pixel shaders with the repo's recompiler, run the old splice on them, and check the result with spirv-val built from our 3rdparty/SPIRV-Tools submodule. That showed two real problems in
AttachNullImages.OpTypeVoid, but the recompiler declares its float, vector and pointer types and the Input/Output variables before that, so the decorations ended up between types. This is consistent with the lavapipe -13 and the RADV crash, but we cannot confirm that on those drivers.ShaderResourcespicks the set of a binding from its number (binding / 65), so the draw's set layout put binding 30 in set 0 while the module declared set 1.DescribeSetLayoutsuses the metadata's set and would have said 1. We read this from the code. We did not run the old fixture with the layout check; the fixed one passes withAPS5_VERIFY_SET_LAYOUTS=1on our RTX 3060, which compares those two layouts.What changed (commit
d707066f6, test and CMake only, the product line inDraw.cppis untouched):ANYPS5_ENABLE_SPIRV_TOOLS=ON(the Linux CI configuration) the fixture validates its module with SPIRV-Tools before drawing; CMake links SPIRV-Tools-static into this one test in that case.Check: with the same 8 combinations, spirv-val accepts the new modules, the aliasing variant used by the depth feedback case, and the unmodified recompiler output, in the vulkan1.1, vulkan1.1spv1.4, vulkan1.2 and vulkan1.3 environments (72 of 72 runs; the 8 old modules fail in all three of the environments they were checked in). We ran the validation function on the dumped modules in a separate small program; we have not built the whole tree with
ANYPS5_ENABLE_SPIRV_TOOLS=ONhere (the sameSPIRV-Tools-staticlink is already used by other tests in that configuration).The fixture still feeds the same descriptor words: element 0 is a valid image and element 1 is all zeros, and the product line in
Draw.cppis untouched. We ran it on our RTX 3060 (driver 591.86, Windows Server 2025):agc_driver_stencil_null_feedbackpasses with the default settings, withAPS5_NO_GPL=1, withAPS5_VERIFY_SET_LAYOUTS=1and with both (4 of 4), andagc_driver_stencil_replay,agc_driver_stencil_replay_no_gplandagc_driver_stencil_ref_export_unusedpass (agc_driver_stencil_ref_exportskips: the GPU lacksVK_EXT_shader_stencil_export). With theDraw.cppline removed (a build with exactly that line deleted), the fixture fails with "guest texture descriptor has a null base address", so it still fails without the fix.Could one of you rerun
agc_driver_stencil_null_feedbackon RADV and on lavapipe, with and withoutAPS5_NO_GPL=1? SettingAPS5_VERIFY_SET_LAYOUTS=1as well makes the driver compare the set layouts described from the shaders with the ones the draw built, which is the check for problem 2.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T20:03:37Z.
Review: APPROVED
Re-checked the new head: the
Draw.cpp:2096skip is unchanged and correct, andagc_driver_stencil_null_feedbacknow passes on RADV (Mesa) and on lavapipe, including withANYPS5_ENABLE_SPIRV_TOOLS=ONvalidating the spliced module. With theDraw.cppline reverted the test fails, so it covers the change. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T23:21:37Z.
Re-checked against current main: the PR still merges cleanly, the
Draw.cpp:2096skip is unchanged andagc_driver_stencil_null_feedbackpasses; with that line reverted it fails. Merging once the full Build is green.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T02:52:47Z.
Picking this up while @adriadam10 is away: we will merge it once full CI and an independent review pass on this head.