Skip to content

fix(libSceAgc): encode SET_PREDICATION arguments as the console does - #19338

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
angrysandhill:fix/agc-predication-console-args
Nov 16, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
angrysandhill:fix/agc-predication-console-args

Conversation

@angrysandhill

Copy link
Copy Markdown
Contributor

What

sceAgcDcbSetPredication throws for argument values that the console encodes. In prosper's console measurements (agcbuild_DcbSetPredication_a/b/c), the console:

  • keeps bit 0 of the condition (written at bit 8), bit 0 of the wait operation (bit 12) and the low three bits of the operation (bits 16–18):
    • arguments 0x11, 0x22, 0x33 and 1, 2, 3 both wrote 0x00021100;
    • 0x22, 0x44, 0 wrote 0x00040000;
  • accepts an address that is not 8-byte aligned (4 was written as 0);
  • accepts a null address with a non-zero operation (operation 4).

WritePredication now masks those three fields instead of refusing them. It no longer refuses a null or misaligned address when the operation is non-zero. The address keeps its existing low-four-bit clearing (0x44444444 → 0x44444440).

The count argument is still ignored, as on the console (0x55555555 and 5 changed nothing). Valid arguments still produce the same packets. The three rows now match the console and are removed from known.tsv.

This changes only the libSceAgc builder. How the driver runs SET_PREDICATION is the separate open #19120.

Sources: the rows above, from prosper's pinned console measurements, SHA-256 aa6cc7b818a1016c20732e4547cea8c12b0472aec681bcf11f8f9a3c897f7de3, checked by library_oracle.py.

testConsoleArguments in tests/Predication.cpp checks the three cases word for word. It adds the missing <algorithm> for std::equal.

Tested

Windows 10 22H2, AMD Radeon RX 6750 XT (gfx1031), Adrenalin 26.10.1 (driver 32.0.21045.16010), WinLibs GCC 15.2, Release. Main b00dc5a6b7, change 55ec65483c.

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: AMD Radeon RX 6750 XT (gfx1031), Adrenalin 26.10.1, Windows 10 22H2. The GPU tests ran as a regression check under the validation layer; the packet tests are CPU-only.
  • AI-assisted: yes

🤖 Generated with Claude Code

The condition, wait operation and operation keep their low bits, and a
null or misaligned address is accepted with a non-zero operation, as
prosper's console measurements show. Three oracle rows now match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 19194 tools/library-oracle/known.tsv L112-121

@JJenkx

JJenkx commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

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

agc_predication_tests passed in 3 of 3 runs in both setups:

  • GPU, through the shared Windows GPU FIFO with ANYPS5_REQUIRE_VULKAN=1, merged onto main caa62ccafa (merge c620416e6b). The binary matched the hash recorded at preparation, and the receipt shows exit 0 and app_count=0.
  • CPU, Vulkan hidden, merged onto main a59652b5af (merge 1d9449ace5).

AI-assisted: yes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

3 participants