Skip to content

fix(agc): encode a one-dword NOP as the header-only form - #2991

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
CnRJay:fix/agc-nop-one-dword
Oct 10, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
CnRJay:fix/agc-nop-one-dword

Conversation

@CnRJay

@CnRJay CnRJay commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

What

PPSA28416 (STAR WARS: Galactic Racer, UE5) stops on main while building a command buffer:

Header: invalid packet header

It asks for a one-dword NOP. WriteNop built every NOP through Header, which needs at least two dwords (a type-3 header stores the count as dwords - 2), so a one-dword NOP threw.

A one-dword NOP is the header alone, with the count field 0x3fff: 0xffff1000 (PKT3_NOP_PAD in Mesa's src/amd/common/sid.h). The rest of the tree already reads it that way: sceAgcGetPacketSize returns 1 for it (tests/PacketInfo.cpp), and the PM4 executor skips it as a filler (FillerPacket in libSceAgcDriver/Execution/include/Pm4.hpp).

Changes:

  • WriteNop writes 0xffff1000 for a one-dword NOP (sceAgcCbNop, sceAgcSetNop). Two or more dwords are unchanged; zero dwords still throws.

Tested

Windows 11, WinLibs GCC 15.2.0 r7, Release, RTX 4080.

  • agc_commands: new testNop. sceAgcSetNop with 1, 2 and 3 dwords writes 0xffff1000, 0xc0001000 0, 0xc0011000 0 0 and advances the cursor by 6. 0 and 0x4002 dwords throw and leave the cursor alone. Fails on main with Header: invalid packet header; passes with the fix.
  • ctest -R agc: 322/322 pass.
  • PPSA28416: no longer stops at the error above.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 10, 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
#1060 core/libs/prx/libSceAgc/tests/Commands.cpp L36
#2848 core/libs/prx/libSceAgc/tests/Commands.cpp L36

@github-actions github-actions Bot added the agc libSceAgc* label Oct 10, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked: 0xffff1000 matches PKT3_NOP_PAD and the existing readers (FillerPacket/PacketWords in Pm4.hpp, PacketInfo.cpp); 0 dwords still throws. agc_commands passes on the merged tree and fails when Packet.cpp is reverted; libSceAgc ctest 20/20 green. Merging.

@adriadam10
adriadam10 merged commit f336979 into boykopovar:main Oct 10, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants