Skip to content

fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE - #9424

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
hugodearaujo:fix/agc-unset-index-limit
Oct 24, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
hugodearaujo:fix/agc-unset-index-limit

Conversation

@hugodearaujo

@hugodearaujo hugodearaujo commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

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_INDIRECT 0x25, DRAW_INDEX_INDIRECT_MULTI 0x38) on a queue that has received neither INDEX_BUFFER_SIZE (0x13) nor INDEX_ATTRIBUTES_INDIRECT (0x91) since its last reset threw INDEX_BUFFER_SIZE has not been set. Marvel's Spider-Man 2 issues DRAW_INDEX_INDIRECT_MULTI that 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::indexBufferSize becomes std::optional<std::uint32_t>. A size written by 0x13 or by a 0x91 record behaves as before. An explicit 0 still throws, now as INDEX_BUFFER_SIZE is zero.
  • When the size was never written, resolveIndirectDraw marks the draw indexLimitKnown = false and keeps the base and alignment checks.
  • ClassifyIndirectDraw sends such a draw to the CPU record path (IndexLimitUnknown, "index limit unknown" in the profiler). Each record's firstIndex/indexCount range is read as written. It must not overflow, and it goes through fix(agc): resolve sparse indirect index ranges per record #6606's per-record readability check.
  • The console's initial INDEX_BUFFER_SIZE is not measured, and neither is whether DRAW_INDEX_2/DRAW_INDEX_OFFSET_2 MAX_SIZE sets it. The debt entry says so.

The second commit is mine, from @adriadam10's review. Since the earlier head, main gained an empty-indirect skip for programs known to take the CPU path. That skip (recordDraws) and the last-drawable search (drawable) in Draw.cpp kept only records with firstVertexOrIndex < indexCount, and indexCount is 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

  • Linux 7.2.11 (Arch), GCC 16.2.1, Release, AMD Radeon RX 9070 XT, RADV Mesa 26.2.5.
  • This head (3dbab57, rebased on main 11e8ad2):
    • ctest -R agc -j16: 953 tests, 938 pass, 10 skip and 5 fail. Four of them also fail on main 11e8ad2 on this machine: agc_driver_bda_reads_shadowed_results, agc_driver_bda_reads_shadowed_results_per_build, agc_unit_shadow_completion_store and agc_driver_tessellation. agc_driver_sgpr_pattern_fill_keys failed under -j16 and passed alone 4 times out of 4.
    • Negative control: without the second commit, agc_driver_sparse_indirect_indices_no_size passes its first Run and fails the second with the sparse indexed indirect draw differs from the reference triangle. With only the recordDraws change, it passes.
    • Everything below was run on the earlier head, fed7f19.
  • Marvel's Spider-Man 2 (PPSA03016 01.004.003, the US release):
  • spiff637's run of the same change on PPSA08338 (the EU release, 01.005.001) is in fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE #7679: Windows 11, RTX 3080, driver 617.42. So is the negative control, where the old throw makes agc_driver_pm4 and the three no_size tests fail.
  • Focused tests on main 0c6a5bd and on this branch, same machine and GPU. The pattern covers agc_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_indirect and agc_driver_*indirect_arguments*. The runs used ctest -V with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (layer 1.4.363).
    • main: 26 of 26 pass.
    • This branch: 29 of 29 pass, the same 26 plus the three agc_driver_sparse_indirect_indices_no_size*.
    • The loader logged the layer being added in both runs, and neither log has was not found but was requested by env var VK_INSTANCE_LAYERS. Neither log has a VUID- line.
  • The same focused set on current main 8b3a6ba and on this branch merged onto it (a clean merge), with the same environment and validation layer:
    • main 8b3a6ba: 26 of 26 pass.
    • Merged: 29 of 29 pass, the same 26 plus the three no_size tests.
    • The loader added the layer in both runs, and neither log has a VUID- line.
  • ctest -R ^agc_ -j8 on this branch: 869 tests, 858 pass, 8 skip and 3 fail. The three also fail on main 0c6a5bd on this machine: agc_idle_publish_wait, agc_driver_image_array_window_past_layer_limit and agc_driver_tessellation (agc_driver_tessellation segfaults on RADV with Mesa 26.2+: nir_opt_varyings corrupts the TCS input offset's use list (Mesa bug) #5444).
  • tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py finds no PR on the same lines. Of the PRs it couldn't compare, none touches the index-size, record-range or indirect-path lines.
  • Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0, Release, RTX 4070 SUPER (NVIDIA 616.92), run by @ycbuzi on fed7f19 merged onto main a6dcea9 (comment): the 19 tests that agc_driver_pm4_tests and agc_driver_sparse_indirect_indices_tests register on Windows pass on both repeats of ctest --repeat until-fail:2, with ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1.
  • Windows 11 (10.0.26300), WinLibs GCC 15.2.0, Release, run by @wachi35676 on fed7f19 merged onto main a6dcea9 (comment), on an RTX 5070 Ti (NVIDIA 617.42) and an AMD Radeon RDNA2 iGPU 1002:13c0 (AMD 32.0.21042.62):
    • The three no_size tests pass on both GPUs.
    • An 81-test related set matches main. The only failures also fail on main there: agc_driver_image_array_window_past_layer_limit doesn't compile under MinGW, and agc_driver_tessellation fails on AMD.
    • Negative control: with the PR's tests and main's Execution and Graphics, the three no_size tests fail with INDEX_BUFFER_SIZE has not been set.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA03016 Marvel's Spider-Man 2 (PPSA03016) #10195 (also PPSA08338, the EU release)
  • GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.5, Linux 7.2.11; NVIDIA GeForce RTX 3080, driver 617.42, Windows 11 (spiff637, fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE #7679); NVIDIA GeForce RTX 4070 SUPER, driver 616.92, Windows 11 (ycbuzi); NVIDIA GeForce RTX 5070 Ti, driver 617.42, and AMD Radeon RDNA2 iGPU, AMD 32.0.21042.62, Windows 11 (wachi35676)
  • AI-assisted: yes

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1368 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1395 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1896 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 2434 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 4072 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5021 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5371 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5441 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5925 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6186 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6187 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6188 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/include/Pm4.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6192 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6194 docs/dev/debt/libSceAgcDriver.md
PR 6202 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6209 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6300 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6412 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6539 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 core/libs/prx/libSceAgcDriver/Execution/include/Pm4.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 6804 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6808 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6959 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6977 docs/dev/debt/libSceAgcDriver.md
PR 7048 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7201 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
PR 7223 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7275 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7369 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7457 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7464 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7604 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7668 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7677 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 8014 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 8223 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8246 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 8319 docs/dev/debt/libSceAgcDriver.md
PR 8484 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 8520 docs/dev/debt/libSceAgcDriver.md
PR 8592 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 9335 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9356 core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9387 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9393 docs/dev/debt/libSceAgcDriver.md
PR 9401 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 9431 docs/dev/debt/libSceAgcDriver.md
PR 9432 docs/dev/debt/libSceAgcDriver.md
PR 9489 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9592 docs/dev/debt/libSceAgcDriver.md
PR 9672 docs/dev/debt/libSceAgcDriver.md
PR 9673 docs/dev/debt/libSceAgcDriver.md
PR 9674 docs/dev/debt/libSceAgcDriver.md
PR 9675 docs/dev/debt/libSceAgcDriver.md
PR 9676 docs/dev/debt/libSceAgcDriver.md
PR 9700 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 9842 docs/dev/debt/libSceAgcDriver.md
PR 9852 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9875 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9891 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9892 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 9893 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9895 docs/dev/debt/libSceAgcDriver.md
PR 9897 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9898 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9904 docs/dev/debt/libSceAgcDriver.md
PR 9905 docs/dev/debt/libSceAgcDriver.md
PR 9906 docs/dev/debt/libSceAgcDriver.md
PR 10046 core/libs/prx/libSceAgcDriver/CMakeLists.txt
PR 10049 docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10233 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 10249 core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
PR 10420 core/libs/prx/libSceAgcDriver/Execution/include/QueueState.hpp
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp
core/libs/prx/libSceAgcDriver/Execution/src/Pm4.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/Pm4.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10442 core/libs/prx/libSceAgcDriver/CMakeLists.txt
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10515 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md
PR 10581 core/libs/prx/libSceAgcDriver/CMakeLists.txt
docs/dev/debt/libSceAgcDriver.md

@ycbuzi

ycbuzi commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Windows run of fed7f19 merged onto main a6dcea9 (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), with ANYPS5_REQUIRE_VULKAN=1 and ANYPS5_NO_SHADER_CACHE=1.

Built libSceAgcDriver, agc_driver_pm4_tests and agc_driver_sparse_indirect_indices_tests with no errors. The build prints two memcmp bound warnings, which main prints the same way from Graphics/src/PipelineLibrary.cpp, a file this PR does not change. ctest --repeat until-fail:2 on the 19 tests these executables register on Windows: all pass on both repeats. Not run: a title.

@wachi35676

Copy link
Copy Markdown
Contributor

Windows check of head fed7f19 merged onto main a6dcea927 (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 with ANYPS5_GPU=AMD). ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1. The validation layer was not used.

  • The 3 new tests pass on both GPUs: agc_driver_sparse_indirect_indices_no_size, _no_size_unreadable and _no_size_unreadable_record. _no_size prints all 8 "sparse indices … no index size passed" lines (2- and 4-byte indices, single and counted multi, before and after the gap).
  • 81-test related set (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)), and agc_driver_tessellation, which fails on AMD only.
  • Negative control: I kept the PR's tests and reverted libSceAgcDriver/Execution and Graphics to main. All three no_size tests then fail on both GPUs with INDEX_BUFFER_SIZE has not been set. The two existing sparse_indirect_indices tests still pass.
  • tools/check_conventions.py --base a6dcea927 passes.

I have no PPSA03016/PPSA08338 here, so no title run.

AI-assisted: yes (Claude Code); results above were run on this machine.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.

  2. 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; current main is 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.

@hugodearaujo

Copy link
Copy Markdown
Contributor Author

@MarcZX10 thanks for the review.

  1. Carrying fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE #7679. CONTRIBUTING doesn't rule out carrying a closed PR, and the commit keeps spiff637 as its author. spiff637 can't reopen fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE #7679 yet: with no PR merged they can have one open, and feat(agc): trace ranges that leave the write watch #7604 is that one. As the description says, I'll close this PR if spiff637 reopens fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE #7679. @spiff637, if you'd rather carry it yourself once you can, say so and I'll close this one then. Whether a carry like this can go ahead is the maintainers' call.
  2. Bring-up discussion. The checklist line reads Unblocks: PPSA03016, PPSA08338 (no Game bring-up discussion yet), not none. 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.
  3. Current main. I'll rerun the focused set with the validation layer on this branch merged onto current main and 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.

@hugodearaujo

Copy link
Copy Markdown
Contributor Author

@MarcZX10 the focused set is rerun on current main 8b3a6ba and on this branch merged onto it (a clean merge), with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation on the RX 9070 XT. main passes 26 of 26 and the merge 29 of 29, the same 26 plus the three no_size tests. The loader added the layer in both runs, and neither log has a VUID- line. check_conventions.py passes on the merge. It's in the Tested section now.

@hugodearaujo

Copy link
Copy Markdown
Contributor Author

@MarcZX10 on your second point: the title's Game bring-up discussion now exists, #10195, and the Unblocks line points to it. It lists the stops on PPSA03016 in order, this PR's INDEX_BUFFER_SIZE one first.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for carrying this. One logic problem on the unknown-limit path, both places in Execution/src/Driver/Draw/Draw.cpp:

  • When the limit is unknown resolveIndirectDraw sets indexCount = 0, but two record filters still test arguments.firstVertexOrIndex < drawParameters.indexCount, so no record counts as drawable:
    • Draw.cpp:404 (recordDraws), used at :413 by the empty-indirect skip. For a program already known to take the CPU path, any stays 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) feeds lastDrawable. It never matches, so record == lastDrawable at :999 is never true for these draws and the pipelined commit of the last record doesn't happen.
  • Fix: in both lambdas, treat the index range as drawable when !indirect.indexLimitKnown, as the :966 branch already does.
  • Please add a test that fails without it: an unknown-limit indexed indirect draw where the program is already in CpuIndirectPrograms (second submission of the same draw), checking that the triangle is drawn. The current no_size tests 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.

spiff637 and others added 2 commits October 23, 2026 18:13
…DEX_BUFFER_SIZE

A queue that has received neither INDEX_BUFFER_SIZE nor
INDEX_ATTRIBUTES_INDIRECT since its last reset has no index limit.
Such a draw takes the CPU record path and reads each record's index
range as written, refusing a range that overflows or is not readable.
An explicit INDEX_BUFFER_SIZE of 0 still throws.
…unknown

The empty-indirect skip and the last-drawable search filtered records by
firstVertexOrIndex < indexCount, which is 0 when the queue never set an
index limit, so a second submission of the same draw was skipped as empty.
@hugodearaujo
hugodearaujo force-pushed the fix/agc-unset-index-limit branch from fed7f19 to 3dbab57 Compare October 23, 2026 21:26
@hugodearaujo

Copy link
Copy Markdown
Contributor Author

@adriadam10 thanks, you're right. The earlier head was based on main from before the empty-indirect skip, and the merge I tested (onto 8b3a6ba) predates it too, so nothing hit it. I rebased on main 11e8ad2 and fixed it in 3dbab57: recordDraws and drawable now count a record as drawable when !indexLimitKnown, as the record loop does.

On the test: --no-size already submits the same draw again. It calls Run eight times in one process with the same vertex shader (2- and 4-byte indices, single and counted multi, before and after the gap). From the second run on, the program is in CpuIndirectPrograms and the draw reaches :413.

  • Without 3dbab57, agc_driver_sparse_indirect_indices_no_size passes its first run and fails the second with the sparse indexed indirect draw differs from the reference triangle.
  • With only the recordDraws change, it passes. So it covers :404/:413.
  • The drawable change at :940 only decides whether the last record commits through the draw pipeline. The image is the same either way, so this test can't tell, and I haven't found an observable result to test it on.

ctest -R agc -j16 on the new head: 953 tests, 5 fail. Four also fail on main 11e8ad2 on this machine. The fifth, agc_driver_sgpr_pattern_fill_keys, passes alone. Details are in the description.

@hugodearaujo

Copy link
Copy Markdown
Contributor Author

An in-game check of 3dbab57 on Spider-Man 2 (PPSA03016 01.004.003), with APS5_PROFILE_DRAW=1. Both runs use the build from my earlier runs today, main 342ac2e with #9969 and this PR's earlier head fed7f19. The second run adds only 3dbab57, cherry-picked:

  • Without it, the [draws] profile counts 6 and then 3 draws on the "index limit unknown" path in two 10 s windows, and 183 and then 558 indirect draws "empty skipped before their stages".
  • With it, one window counts 323 draws on that path and 0 skipped.
  • For comparison, main 0c6a5bd, from before the skip, counted 567 in one window.

Both runs stay on the black loading screen and later run out of VRAM. In the run with the fix that came at 281 s, while about 7,000 sampled textures were created within 20 s. That's a separate problem, and I'm looking at it in #10195.

@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 24, 2026 11:36

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@adriadam10
adriadam10 merged commit c035bd5 into boykopovar:main Oct 24, 2026
12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Re-checked 3dbab57: @MarcZX10's only review is dismissed (2026-10-22, on an older head) and both of its points are met (Unblocks points to #10195; CONTRIBUTING doesn't forbid a carry). recordDraws and drawable count a record as drawable when !indexLimitKnown, the no_size tests fail on main and pass here, and the debt line is in place. The Windows runs by @ycbuzi and @wachi35676 plus spiff637's PPSA08338 run cover NVIDIA and AMD; merged.

akkadbakkad89 pushed a commit to akkadbakkad89/AnyPS5 that referenced this pull request Oct 26, 2026
boykopovar#9424 made QueueState::indexBufferSize a std::optional, so the
unset-state comparison against 0 compiled but never held. Check the
optional directly instead.
akkadbakkad89 pushed a commit to akkadbakkad89/AnyPS5 that referenced this pull request Oct 26, 2026
boykopovar#9424 made QueueState::indexBufferSize a std::optional, so the
unset-state comparison against 0 compiled but never held. Check the
optional directly instead.
akkadbakkad89 pushed a commit to akkadbakkad89/AnyPS5 that referenced this pull request Oct 26, 2026
boykopovar#9424 made QueueState::indexBufferSize a std::optional, so the
unset-state comparison against 0 compiled but never held. Check the
optional directly instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build docs unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants