Skip to content
PS5PCEM
PartialGraphics

NGG vertex shaders

Merged NGG vertex programs, including a fetch shader that continues with S_SETPC_B64, translate as one graphics stage. The export program keeps its own user-data window.

Repository notes through October 10, 2026

Fetch and export are different programs

A PlayStation 5 draw often splits vertex work into a fetch shader and an export shader. The fetch shader ends its attribute prolog by jumping to the export code with S_SETPC_B64. PS5PCEM treats that continuation as part of the same vertex program and translates the merged result.

The NGG export program does not borrow the geometry-shader user-data bank. Its scalar registers are initialized from its own user-data snapshot, at s8 for the export program. Assuming the resource table lives in s0:s1 is a bug the translator specifically avoids. The table pointer comes from the ShaderResourceTable user-SGPR pair the metadata declared.

Vertex attributes

The fetch shader and the extended user data are resolved together with the embedded vertex-buffer and vertex-attribute tables. Up to 32 input semantics keep their semantic index, the hardware VGPR they land in, the AGC attribute format, the byte offset, the instance rate and the 128-bit buffer descriptor.

Attribute lookup uses the semantic byte, not the hardware-mapping byte. An incomplete table pair or an index outside the supported domain is rejected before any guest read. PARAM exports from the vertex stage become the fragment interpolation inputs, which is how a later pixel shader sees the varyings.

Calls into a fetch shader

A verified external fetch shader can also be linked from S_SWAPPC_B64 or S_CALL_B64 when the call's user-data pair still holds the address AGC registered. The fetch body is decoded through its returning S_SETPC_B64, and that return must read the caller's link pair. The details of which calls are legal live on the scalar-calls page.

Merged NGG translation is what lets three-dimensional scenes get past a fetch prolog that used to stop the decoder. It does not by itself supply a missing pixel shader or a missing render target.

What is implemented

  • Merged NGG vertex programs, including fetch prologs that end in S_SETPC_B64.
  • A separate user-data window for the export program.
  • Up to 32 vertex semantics with formats, offsets, instance rates and buffer descriptors.
  • PARAM exports connected to fragment interpolation inputs.

What is still missing

  • A fetch shader whose return does not match the caller's link pair is not linked.
  • General dynamic calls remain unsupported. See scalar calls.
  • Geometry that depends on an unsupported export or interpolant still fails that draw.

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