Skip to content

fix(libSceAgc): encode index buffer state for the arguments the console encodes - #19194

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
visheshreddy-web:fix/agc-index-state-console-encoding
Nov 21, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
visheshreddy-web:fix/agc-index-state-console-encoding

Conversation

@visheshreddy-web

@visheshreddy-web visheshreddy-web commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

sceAgcDcbSetIndexBuffer, sceAgcDcbSetIndexSize and sceAgcDcbSetIndexIndirectArgs threw for arguments that prosper's console oracle measures as encoded. They now write the measured packets, and the seven closed known.tsv entries are removed.

Function main Now Measured rows
sceAgcDcbSetIndexBuffer throws for an odd address clears bit 0 of the address 0x11111111 → 0x11111110, 1 → 0
sceAgcDcbSetIndexSize throws for an index size above 2 or a cache policy above 3 keeps the low two bits of each (0x11, 0x22) → 0x481, (0x22, 0x44) → 0x402
sceAgcDcbSetIndexIndirectArgs throws for an address that is not 16-byte aligned or an index above 0xffff clears the low four address bits, keeps the low 16 bits of the index (0x11111111, 0x22222222) → 0x11111110, 0, 0x2222; (1, 2) → 0, 0, 2; (0x1111111122222222, 0x44444444) → 0x22222220, 0x11111111, 0x4444

Not settled by the rows, recorded in docs/dev/debt/libSceAgc.md:

  • An index size whose low two bits are 3 still throws: its packet is not measured.
  • Bits 2, 3, 6 and 7 of the index size and bits 3, 4 and 7 of the cache policy are dropped as parts of two-bit fields. OpenAGC keeps two bits of the index size and one of the second argument; the console rows keep two of the cache policy.
  • Address bits 2 and 3 of sceAgcDcbSetIndexIndirectArgs are cleared as OpenAGC clears them; the rows set only bits 0 and 1.

Tested

Windows 11, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r7), CMake 4.4.4, Ninja, Release, BUILD_TESTING=ON. No title or homebrew.

  • ctest -R '^(agc_initialization|agc_commands|agc_draw_setup|agc_predication_tests|guest_indexed_draw|library_oracle)$': 6 of 6 pass on main c9e6aeb3a9 and on this change.
  • python tools/library-oracle/library_oracle.py agcbuild --build build-full: main reports 156 known findings, 0 new, 0 now matching; this change reports 149 known findings, 0 new, 0 now matching, and with main's known.tsv it reports the seven cases as NOW MATCHES.
  • python tools/check_conventions.py --base origin/main: 0 errors.

The tests ran on commit 6c976c948c; the pushed commit differs from it only in the wording of one debt entry. Not run: the rest of the test suite, Linux, the wider agc_* driver tests on a GPU, and tools/pr_overlap.py to completion; searches for the three function names found no open pull request.

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: none
  • GPUs tested: n/a
  • AI-assisted: yes

…le encodes

sceAgcDcbSetIndexBuffer, sceAgcDcbSetIndexSize and
sceAgcDcbSetIndexIndirectArgs threw for arguments that the console
oracle in prosper measures as encoded: an odd index buffer address, bits
above the two-bit index size and cache policy fields, an attribute
address that is not 16-byte aligned and an attribute index above 0xffff.
They now write the measured packets.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

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

Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head 6d5410a5eb130d030d1b2a8f67abe8867467335d, base main. Repository files read through the reader pinned to this head.
  • Reader command:
python3 repo_read.py search sceAgcDcbSetIndexSize docs/dev/debt
  • No build and no tests were run in this review. The checks below are my reading of the code and of the test changes.

Results

Check Result Note
Code matches the description's table passed IndexBuffer.cpp read in full
New test expectations passed Packet values checked by hand
Build and ctest not run Author-reported, on another commit
Library oracle run not run Author-reported
No new code comments passed The diff adds none

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgc/DcbDraw/src/IndexBuffer.cpp:28: sceAgcDcbSetIndexSize now masks indexSize and cachePolicy to their low bits, so an index size of 4 or a cache policy of 0x44 is accepted without an error. The measured rows and the debt entry at docs/dev/debt/libSceAgc.md:41 describe this behaviour, so this is a note, not a defect.

Not verified

  • Build, ctest and the library oracle run were not run here. The description reports them on commit 6c976c948c, which it says differs from the head only in one debt entry. I did not confirm that.
  • The console measurements and OpenAGC behaviour behind the links in docs/dev/debt/libSceAgc.md were not opened.
  • Files read: core/libs/prx/libSceAgc/DcbDraw/src/IndexBuffer.cpp in full; core/libs/prx/libSceAgc/tests/DrawSetup.cpp lines 44 to 59; core/libs/prx/libSceAgc/tests/Commands.cpp only in its changed hunks, since the file is 1305 lines; docs/dev/debt/libSceAgc.md and tools/library-oracle/known.tsv through the diff. Nothing was excluded.
  • The rest of the test suite was not read.

To get this to a good state

Nothing is required.

Optional: decide whether an out-of-range index size or cache policy should keep failing. The current masking matches the measured rows.

@github-actions github-actions Bot added docs agc libSceAgc* labels Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 19357 tools/library-oracle/known.tsv L98-106
PR 20294 tools/library-oracle/known.tsv L95-104

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 17742 docs/dev/debt/libSceAgc.md

@JJenkx

JJenkx commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 6d5410a5eb. Setup: Windows 11 Enterprise 22621, AMD RX 6700 XT, AMD driver 26.10.1, MinGW-w64 GCC 15.2 UCRT, Release.

agc_commands, agc_draw_setup and agc_initialization passed in 3 of 3 runs in both setups:

  • GPU, through the shared Windows GPU FIFO with ANYPS5_REQUIRE_VULKAN=1, merged onto main 1d1fb4f1e1 (merge 34eeee6427): 9 of 9 outcomes. The binaries matched the hashes recorded at preparation, and the receipt shows exit 0 and app_count=0.
  • CPU, Vulkan hidden, merged onto main fb16b510c4 (merge b181113890).

AI-assisted: yes.

@visheshreddy-web

Copy link
Copy Markdown
Contributor Author

Re-ran the focused tests on the pushed head 6d5410a5eb (Windows 11, WinLibs GCC 15.2.0, RTX 5060 Laptop): agc_initialization, agc_commands, agc_draw_setup, agc_predication_tests, guest_indexed_draw and library_oracle pass, and library_oracle.py agcbuild reports 149 known findings, 0 new, 0 now matching.

The overlap with #19338 is only adjacent removals in tools/library-oracle/known.tsv: it fixes sceAgcDcbSetPredication, a different function, so neither depends on the other. Whichever merges second needs a rebase that keeps both removals; I'll do it if this one is second.

AI-assisted: yes.

# Conflicts:
#	tools/library-oracle/known.tsv
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 17, 2026
@oneandonlydean
oneandonlydean merged commit 612e6da into boykopovar:main Nov 21, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants