fix(agc): decode DrawIndexIndirect modifier bit-1 fields #27807
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27807"
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 MauriceSirius on 2026-11-27T12:57:10Z.
What
sceAgcDcbDrawIndexIndirectreads a start-index register from the modifier's bit 1: the console putssgprBase + ((modifier >> 14) & 0x1f)in the second packet word's bits 31:16 and sets bit 28 of the third word when the bit is set, and clears both fields when it is clear;sceAgcDcbDrawIndirectclears them even with the bit set. The measurements never set the bit for the multi and auto forms, so those packets keep the bit-1-clear encoding.Agc::Command::DrawPatchOffsetstakes anindexedflag and adds the start-index register and the bit-60 enable for the indexed indirect form only.0x24/0x25PM4 validation:0x25accepts the start-index register in word two's high half and the bit-28 enable and rejects the unmeasured control bits; the decoder exposesstartIndexLocation/startIndexEnabled, and the indirect draw execution path patches the record'sfirstIndexinto the named SGPR pair like the other patched registers.agcbuild_DcbDrawIndexIndirect_a,agcbuild_DcbDrawIndexIndirect_b) are removed fromtools/library-oracle/known.tsv; a debt fragment records the measured semantics and the unmeasured multi/auto behaviour.Tested
Windows 11, homebrew.
python3 tools/library-oracle/library_oracle.py agcbuild --build build: main reports73 known findings, 0 new, 0 now matching; this branch reportscompared 185 mismatched 48 skipped 24,71 known findings, 0 new, 0 now matching— bothagcbuild_DcbDrawIndexIndirect_aand_bnow match the console words word for word, no new diffs, no staleknown.tsventries.agc:compared 77 mismatched 0 skipped 0.ctest -R 'agc_commands|agc_initialization|agc_driver_pm4'passes (new assertions cover modifier bit 1 set, clear and register-zero in the builder, non-indexed draws not writing the fields, and the driver's validation and decode of the start-index register). The draw-indirect execution tests (agc_driver_indirect_draw_pending_producer*, 4/4) pass withVK_LAYER_KHRONOS_validationandANYPS5_NO_SHADER_CACHE=1on both main and this branch: the loader reports 8 instance-layer insertions on each side and neither run prints a singleVUID-message.check_conventions.py --base origin/mainpasses.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-27T13:55:58Z.
Review: COMMENTED
Linux validation on the exact head
fb7e568a65with an RX 6650 XT, RADV, and Vulkan validation 1.4.363. The three CPU tests passed (agc_initialization,agc_commands, andagc_driver_pm4)). All five GPU CTests passed, including the four pending-producer configurations andagc_driver_indirect_patched_stage`. No Vulkan validation errors or skips.I also ran a separate render fixture to exercise the new shader write. It submits indexed indirect draws with
firstIndex0 and 3. The two index ranges hold the same triangle, and the shader uses the destination SGPR to compute clip depth. With the start-index write enabled, 0 draws the same 512 changed bytes as the direct reference and 3 clips the triangle. With the write disabled, both draws preserve the initially assigned shader depth and invert those outcomes. The trace shows the two enabled draws using the CPU start-index path and the two disabled controls using the GPU indirect path. Both default and pipelined draw-plan verification produced the same results.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T14:02:51Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the targeted code review supports the indexed indirect start-index decode and patching behavior.
What I ran
fb7e568a656f09818bed60a7d1e96937dd0d8949using the prepared diff andrepo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T14:13:30Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
6a2f8927190cbe3f2e0f14ef361adb6576e8cb41usingrepo_read.pyto inspect the prepared diff and source context. No tests or builds were run; the test results in the PR description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests, build, console behavior, or independent reproduction of the reported measurements were verified.
files.jsonwas unavailable through the reader, so excluded-file details could not be checked; the manifest lists all 13 changed files as included. Read: all 13 changed files, plus targeted context inDrawDecode.cpp. Excluded: not verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-12-03T19:22:29Z.
Review: COMMENTED
Actionable comments
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cpp, lines1428· 🎯 Functional Correctness · 🏗️ Heavy liftstartIndexEnabled, a nonzerofirstIndex, and a shader that exposes the selected SGPR value. Check that the enabled case observesfirstIndexand that the disabled case preserves the original value. This will detect a missing patch or an incorrect execution-path decision.ce76e6cc-8dfb-4fc3-ae63-07f1673d33b0Reviewing files that changed from the base of the PR and between
6a2f892719and43146b74a2.tools/library-oracle/known.tsvis excluded by!**/*.tsvcore/libs/prx/libSceAgc/tests/Commands.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/IndirectDraw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Pm4.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/tests/Pm4.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:02:27Z.
Review: COMMENTED
The packet tests verify the new bit and register field. Could a draw fixture also observe
firstIndexin a shader SGPR and verify the indexed draw starts at that same record index? The patch routes this case through CPU-side argument patching, so decoding alone cannot catch a missed patch or a register overwritten by another argument. The indexed multi export still silently drops modifier bit 1 even though the console encoding for that case is unmeasured. Could that form report the gap when the bit is set?Source review at
43146b74a2. The head trial-merges onto6ef4f2f73b. Focused Linux checks are queued.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T21:13:12Z.
Review: APPROVED
Reviewed — looks good
The change correctly encodes and decodes the indexed indirect start-index fields and patches the record’s first index when required.
What I ran
Reviewed head
43146b74a2c976b7b134a18343d29e3b08b56d70using the prepared diff and included file snapshots. No build or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
The packet builder adds the start-index register and enable for indexed indirect draws, and the execution path patches the record’s first index into that register when enabled: Draw.cpp and driver Draw.cpp.
Not verified
Build and test results were not independently verified. All 14 changed files listed in
files.jsonwere included in the prepared review materials; none were excluded.To get this to a good state
Nothing is required.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.