fix(agc): resolve indexed indirect draws on a queue that never set INDEX_BUFFER_SIZE #7679
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7679"
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 spiff637 on 2026-10-18T22:12:04Z.
What
An indexed indirect draw (
DRAW_INDEX_INDIRECT0x25,DRAW_INDEX_INDIRECT_MULTI0x38) on a queue that has not receivedINDEX_BUFFER_SIZE(0x13) orINDEX_ATTRIBUTES_INDIRECT(0x91) since its last reset threwINDEX_BUFFER_SIZE has not been set.Marvel's Spider-Man 2 (PPSA08338) never emits either packet. Probing every 0x13 and every suspend-point queue reset over a whole run found none, so no written size is being lost. Per draw it writes
VGT_INDEX_TYPE(uconfig 0x243 = 0x400, 16-bit indices) andINDEX_BASE, then issuesDRAW_INDEX_INDIRECT_MULTI. It stopped about 110–194 s in, on both a 2026-10-13 base (84b0d2f24) and currentmain.The change:
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 (new pathIndexLimitUnknown, profiler name "index limit unknown"). The mesh GPU-side case goes there too, so the GPU path's whole-range check and copy is never reached without a limit.firstIndex/indexCountrange skips the clamp against the declared limit. Instead it must not overflow, and it goes through #6606's per-record readability check. Reads stay bounded bymin(count at countAddress, packet count)records; nothing beyond a record's own range is read.docs/dev/debt/libSceAgcDriver.md. The console's initial INDEX_BUFFER_SIZE, and whether theDRAW_INDEX_2/DRAW_INDEX_OFFSET_2MAX_SIZE sets it, are not measured.The branch is #6606's head (
925f9a84b) merged withmain(0d1c299a9), plus one commit. Until #6606 is merged, the diff also shows its commits.Tested
tests/Pm4.cpp: 0x25 and 0x38 without 0x13 resolve with an unknown limit; an explicit 0x13 of 0 still throws; a written size keeps a known limit.SparseIndirectIndices: three new registrations.agc_driver_sparse_indirect_indices_no_sizesends 0x38 with no 0x13 and matches the reference triangle...._no_size_unreadableand..._no_size_unreadable_recordcheck that an unreadable active record still throws.resolveIndirectDrawmakesagc_driver_pm4and the threeno_sizetests fail. Disabling only theIndexLimitUnknownclassification makes the threeno_sizetests fail.ctest -R ^agc_: 732 of 733 pass, 3 skipped.agc_driver_bda_devicefails identically onmainon this machine (vkWaitForFences graphics: Vulkan result -4).tools/check_conventions.py --base origin/mainandtools/check_test_registration.py buildpass.mainwith #7505 and #6606 plus this change, the INDEX_BUFFER_SIZE abort is gone.GetImageResource dword 0 is not a valid runtime value(a record → pointer → V# → T# chain, #6191).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01HAtTu2pw6GTkMNwsjBDatU
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T22:12:22Z.
Thank you for your contribution! Authors with no pull requests merged into
maincan have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.Pull request closed