Skip to content
PS5PCEM
PartialGraphics

Scalar shader calls

S_SWAPPC_B64 and S_CALL_B64 save a full return address and run a bounded local subroutine, including a callee that sits after ENDPGM. A verified AGC fetch shader can be linked the same way.

Repository notes through October 10, 2026

Call and return

SOP1 opcode 0x21 is S_SWAPPC_B64. SOPK opcode 0x16 is S_CALL_B64, with the target at PC + 4 + sign_extend(SIMM16) * 4, which includes backward calls. Both write the address of the next instruction into the destination SGPR pair. A matching S_SETPC_B64 returns there. CALL leaves SCC and EXEC alone.

A SWAPPC whose destination is null remains the existing S_SETPC_B64 continuation. Local SWAPPC targets can be resolved from a GETPC plus a full-width immediate add or subtract. The target is captured even if the instruction also writes the link register. A callee that lives after ENDPGM is decoded through its matching return, inside the allocation and instruction bounds. An ordinary hardware continuation still stops before trailing metadata.

How the call is lowered

The control-flow graph gains explicit call and return edges. The callee shares the caller's register state and uses the bounded SPIR-V dispatcher. An unsupported call cannot fall through into the linear control-flow path. Host resource discovery follows the calls and the returns, so a descriptor initialized inside the callee is still visible.

Each supported call owns one distinct, even-aligned SGPR pair from s0:s1 through s104:s105, with exactly one matching return. Callees are nested or sequential in the ways the checker allows. General dynamic targets, where the destination is an arbitrary runtime value, stay unsupported.

Fetch shaders and the probe

An external fetch shader is linked when the call's unchanged user-data pair matches the address AGC registered. The fetch body is decoded to its returning SETPC, and that SETPC must read the caller's link pair. Analysis caching tells an ordinary program apart from a fetch body, so an older fetch insertion cannot overwrite a local subroutine's return.

A 42-dispatch GPU probe checks 21,504 words. The October 9 report does not claim a new game milestone or a new frame rate from the calls alone.

What is implemented

  • S_SWAPPC_B64 and S_CALL_B64 with a full return address and a matching S_SETPC_B64.
  • Nested callees and callees placed after ENDPGM, within the existing bounds.
  • Linking of a verified AGC fetch shader whose return reads the caller's link.
  • A 42-dispatch probe covering 21,504 words.

What is still missing

  • General dynamic call targets are unsupported.
  • A call needs one even-aligned link pair and one matching return.
  • The probe is not a frames-per-second result.

Related mechanisms

What these pages are

The text follows the architecture notes and the October 2026 reports in the PS5PCEM repository. A focused test passing is not a new frame rate and not a new playthrough.

All technologies