fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE #9424
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9424"
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 hugodearaujo on 2026-10-21T21:34:28Z.
What
This carries @spiff637's #7679, which the open-PR limit closed on 2026-10-18, before any review. The commit keeps spiff637 as its author. It is rebased on current
main, where #6606 is merged, and its debt line now sits next to main's newer INDEX_ATTRIBUTES_INDIRECT entry. If spiff637 reopens #7679, I'll close this one.An indexed indirect draw (
DRAW_INDEX_INDIRECT0x25,DRAW_INDEX_INDIRECT_MULTI0x38) on a queue that has received neitherINDEX_BUFFER_SIZE(0x13) norINDEX_ATTRIBUTES_INDIRECT(0x91) since its last reset threwINDEX_BUFFER_SIZE has not been set. Marvel's Spider-Man 2 issuesDRAW_INDEX_INDIRECT_MULTIthat way and never emits either packet: spiff637 probed every 0x13 and every suspend-point reset over a whole run.The change, as in #7679:
QueueState::indexBufferSizebecomesstd::optional<std::uint32_t>. A size written by 0x13 or by a 0x91 record behaves as before. An explicit 0 still throws, now asINDEX_BUFFER_SIZE is zero.resolveIndirectDrawmarks the drawindexLimitKnown = falseand keeps the base and alignment checks.ClassifyIndirectDrawsends such a draw to the CPU record path (IndexLimitUnknown, "index limit unknown" in the profiler). Each record'sfirstIndex/indexCountrange is read as written. It must not overflow, and it goes through #6606's per-record readability check.INDEX_BUFFER_SIZEis not measured, and neither is whetherDRAW_INDEX_2/DRAW_INDEX_OFFSET_2MAX_SIZE sets it. The debt entry says so.The second commit is mine, from @adriadam10's review. Since the earlier head,
maingained an empty-indirect skip for programs known to take the CPU path. That skip (recordDraws) and the last-drawable search (drawable) inDraw.cppkept only records withfirstVertexOrIndex < indexCount, andindexCountis 0 when the limit is unknown. So the second submission of the same unknown-limit draw was skipped as empty. Both now count such a record as drawable, as the record loop already does.Tested
3dbab5725c, rebased onmain11e8ad2934):ctest -R agc -j16: 953 tests, 938 pass, 10 skip and 5 fail. Four of them also fail onmain11e8ad2934on this machine:agc_driver_bda_reads_shadowed_results,agc_driver_bda_reads_shadowed_results_per_build,agc_unit_shadow_completion_storeandagc_driver_tessellation.agc_driver_sgpr_pattern_fill_keysfailed under-j16and passed alone 4 times out of 4.agc_driver_sparse_indirect_indices_no_sizepasses its firstRunand fails the second withthe sparse indexed indirect draw differs from the reference triangle. With only therecordDrawschange, it passes.main0c6a5bd593aborts at 151 s withINDEX_BUFFER_SIZE has not been set.APS5_PROFILE_DRAW=1, there is noINDEX_BUFFER_SIZEerror. The[draws]profile counts 567 draws on the "index limit unknown" path in one 10 s window.0x11e2b44c00; the address changes between runs), as spiff637 saw on PPSA08338. That stop is in #8939's thread.main, in its first 40 s, onsceSystemServiceParamGetInt: parameter 100, then 208 and 210 (seen withmaincc0078595d). This PR doesn't touch that.agc_driver_pm4and the threeno_sizetests fail.main0c6a5bd593and on this branch, same machine and GPU. The pattern coversagc_driver_pm4*,agc_driver_draw_offset_indices,agc_driver_sparse_indirect_indices*,agc_driver_pipelined_indirect_draw,agc_driver_rect_list_indirect,agc_driver_prepared_shaders_indirectandagc_driver_*indirect_arguments*. The runs usedctest -VwithANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(layer 1.4.363).main: 26 of 26 pass.agc_driver_sparse_indirect_indices_no_size*.was not found but was requested by env var VK_INSTANCE_LAYERS. Neither log has aVUID-line.main8b3a6ba88dand on this branch merged onto it (a clean merge), with the same environment and validation layer:main8b3a6ba88d: 26 of 26 pass.no_sizetests.VUID-line.ctest -R ^agc_ -j8on this branch: 869 tests, 858 pass, 8 skip and 3 fail. The three also fail onmain0c6a5bd593on this machine:agc_idle_publish_wait,agc_driver_image_array_window_past_layer_limitandagc_driver_tessellation(#5444).tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pyfinds no PR on the same lines. Of the PRs it couldn't compare, none touches the index-size, record-range or indirect-path lines.maina6dcea9279(comment): the 19 tests thatagc_driver_pm4_testsandagc_driver_sparse_indirect_indices_testsregister on Windows pass on both repeats ofctest --repeat until-fail:2, withANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1.maina6dcea927(comment), on an RTX 5070 Ti (NVIDIA 617.42) and an AMD Radeon RDNA2 iGPU1002:13c0(AMD 32.0.21042.62):no_sizetests pass on both GPUs.main. The only failures also fail onmainthere:agc_driver_image_array_window_past_layer_limitdoesn't compile under MinGW, andagc_driver_tessellationfails on AMD.main'sExecutionandGraphics, the threeno_sizetests fail withINDEX_BUFFER_SIZE has not been set.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)Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T22:41:50Z.
Windows run of fed7f1970d merged onto
maina6dcea9279(6b664c633c, clean), the platform the description lists as not tested. Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release,BUILD_TESTING=ON. RTX 4070 SUPER, NVIDIA 616.92 (ANYPS5_GPU=4070), withANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1.Built
libSceAgcDriver,agc_driver_pm4_testsandagc_driver_sparse_indirect_indices_testswith no errors. The build prints twomemcmpbound warnings, whichmainprints the same way fromGraphics/src/PipelineLibrary.cpp, a file this PR does not change.ctest --repeat until-fail:2on the 19 tests these executables register on Windows: all pass on both repeats. Not run: a title.Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-21T22:59:21Z.
Windows check of head
fed7f19merged onto maina6dcea927(clean merge), on the two GPUs this PR has not been run on so far: AMD's proprietary Windows driver and an RTX 50-series card.Host: Windows 11 (10.0.26300), Ryzen 5 9600X, WinLibs GCC 15.2.0, Release, Ninja. GPUs: NVIDIA GeForce RTX 5070 Ti (driver 617.42) and AMD Radeon RDNA2 iGPU
1002:13c0(proprietary driver 32.0.21042.62, selected withANYPS5_GPU=AMD).ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1. The validation layer was not used.agc_driver_sparse_indirect_indices_no_size,_no_size_unreadableand_no_size_unreadable_record._no_sizeprints all 8 "sparse indices … no index size passed" lines (2- and 4-byte indices, single and counted multi, before and after the gap).agc_driver_pm4*,sparse_indirect*,*indirect_arguments*,pipelined_indirect_draw,rect_list_indirect,prepared_shaders_indirect,draw_offset_indices,graphics*,mesh*,tessellation, pipeline journal and others): the results match main on both GPUs. The only failures are ones main also has on this machine:agc_driver_image_array_window_past_layer_limit, which does not compile under MinGW on main (alignas(65536)), andagc_driver_tessellation, which fails on AMD only.libSceAgcDriver/ExecutionandGraphicsto main. All threeno_sizetests then fail on both GPUs withINDEX_BUFFER_SIZE has not been set. The two existingsparse_indirect_indicestests still pass.tools/check_conventions.py --base a6dcea927passes.I have no PPSA03016/PPSA08338 here, so no title run.
AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:54:04Z.
Review: DISMISSED
The new branch documents and tests the no-size draw path thoroughly, including paired Vulkan validation. There are two repository issues to resolve before this change can proceed:
The PR says it carries the patch from #7679, which was closed by the repository's automatic open-PR limit before review. The user's operating constraint for this review is not to reuse work from intake-paused/limit-closed PRs through a different author's branch. Please stop this transfer and let the original author reopen #7679 when eligible, preserving the original patch and authorship there. The commit's author field is preserved, which is good, but does not resolve the intake constraint.
The body reports a title-specific stop for Marvel's Spider-Man 2 (PPSA03016), but the checklist says
Unblocks: none. The repository checklist requires a title ID and Game bring-up discussion for a stop seen on a title. Please add the verified discussion reference, or explain that no qualifying bring-up discussion exists and update the claim accordingly.The paired focused tests and validation-layer report are author-provided and use
0c6a5bd593; currentmainis 417 commits ahead of that comparison base. If this work is reopened as its original PR, it will still need a current-main update and focused rerun. Hosted eligibility, conventions, intake, labels, and report checks pass; product/relinker jobs are skipped. I did not run the tests locally because no matching checkout/build is available here.Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-22T11:56:54Z.
@MarcZX10 thanks for the review.
Unblocks: PPSA03016, PPSA08338 (no Game bring-up discussion yet), notnone. No Game bring-up discussion exists for either release: I listed the category's threads and searched for both IDs and the title's name.main. I'll rerun the focused set with the validation layer on this branch merged onto currentmainand update the Tested section.@ycbuzi @wachi35676 thank you both for the Windows runs, on three GPUs this PR hadn't seen. Both are now in the Tested section.
Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-22T12:11:48Z.
@MarcZX10 the focused set is rerun on current
main8b3a6ba88dand on this branch merged onto it (a clean merge), withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationon the RX 9070 XT.mainpasses 26 of 26 and the merge 29 of 29, the same 26 plus the threeno_sizetests. The loader added the layer in both runs, and neither log has aVUID-line.check_conventions.pypasses on the merge. It's in the Tested section now.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-23T21:04:45Z.
Review: CHANGES_REQUESTED
Thanks for carrying this. One logic problem on the unknown-limit path, both places in
Execution/src/Driver/Draw/Draw.cpp:resolveIndirectDrawsetsindexCount = 0, but two record filters still testarguments.firstVertexOrIndex < drawParameters.indexCount, so no record counts as drawable:Draw.cpp:404(recordDraws), used at:413by the empty-indirect skip. For a program already known to take the CPU path,anystays false and the whole draw is skipped as empty (empty_indirect_skipped). That is a silent drop of the exact draws this PR is meant to enable.Draw.cpp:940(drawable) feedslastDrawable. It never matches, sorecord == lastDrawableat:999is never true for these draws and the pipelined commit of the last record doesn't happen.!indirect.indexLimitKnown, as the:966branch already does.CpuIndirectPrograms(second submission of the same draw), checking that the triangle is drawn. The currentno_sizetests submit it once, so they don't reach:413.On the carry: the author stays credited, and which PRs may be carried is a maintainer call, not something this review decides.