Rockstar PS2 pipelines
In GTA San Andreas for PS2 Rockstar used RenderWare's Pipeline Delivery System (RpPDS) that was introduced with RW 3.5 to create custom pipelines. However not all custom pipelines are created with RpPDS, the grass, water and seven sprite piplines are not (TODO: describe them here as well). This page is about Rockstar's custom pipelines specifically, PS2 pipelines in general are described here: PS2All.
All of these pipelines are initialized in init.pm/nm (see PS2 Code Overlay) so the addresses below are only valid if the init code has been loaded into memory. Addresses refer to SLES_525.41 and init.pm.
All object pipelines have even IDs, material pipelines have odd IDs. None of the object pipelines have grouped material pipelines (a forced pipeline for all materials of an atomic) even though it looks like Rockstar tried to set them up that way; their code has no effect.
PDS Templates
Building Pipelines
CVBuildingPipe
53F20080 (template @ 8A3000)
53F20081 (template @ 8A2F70) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6E00400D (R* rgba) stride: 3 vertexCount: 0x51 primCount: 0x1B vifOffset: 0xF3
VU code binary, disassembly
CVBuildingDNPipe
53F20082 (template @ 8A30B0)
53F20083 (template @ 8A3020) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6D00400D (R* rgba2) stride: 3 vertexCount: 0x51 primCount: 0x1B vifOffset: 0xF3
VU code binary, disassembly
CVBuildingEnvMapPipe
53F2008C (unused by DFFs, template @ 8A3160)
53F2008D (used with 53F20080, template @ 8A30D0) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6E00400D (R* rgba) 9 6E00000D (R* normal) stride: 4 vertexCount: 0x38 primCount: 0x12 vifOffset: 0xE0
VU code binary, disassembly
CVBuildingDNEnvMapPipe
53F2008E (unused by DFFs, template @ 8A3210)
53F2008F (used with 53F20082, template @ 8A3180) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6D00400D (R* rgba2) 9 6E00000D (R* normal) stride: 4 vertexCount: 0x38 primCount: 0x12 vifOffset: 0xE0
VU code binary, disassembly
CVBuildingUVAPipe
53F20090 (unused by DFFs, template @ 8A32C0)
53F20091 (unused by DFFs, template @ 8A3230) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6E00400D (R* rgba) stride: 3 vertexCount: 0x50 primCount: 0x1A vifOffset: 0xF0
VU code binary, disassembly
CVBuildingDNUVAPipe
53F20092 (unused by DFFs, template @ 8A3370)
53F20093 (unused by DFFs, template @ 8A32E0) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6D00400D (R* rgba2) stride: 3 vertexCount: 0x50 primCount: 0x1A vifOffset: 0xF0
VU code binary, disassembly
Vehicle Pipelines
CVCarPipe
53F20084 (template @ 8A2F50)
This pipeline does not render any reflection effects:
53F20085 (template @ 8A2EC0) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6E00401C (not instanced) 9 6E00000D (R* normal) stride: 4 vertexCount: 0x45 primCount: 0x17 vifOffset: 0x114
VU code binary, disassembly
CVCarEnvMapPipe
53F20086 (unused by DFFs, template @ 8A2E00)
This pipeline renders environment maps (and specular maps):
53F20087 (use with 53F20084, template @ 8A2CE0) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6E00401C (not instanced) 9 6E00000D (R* normal) stride: 4 vertexCount: 0x38 primCount: 0x12 vifOffset: 0xE0
VU code binary, disassembly
This pipeline renders x-environment maps (and specular maps):
CVCarEnvMapUV2Pipe
53F2008B (use with 53F20084, template @ 8A2D70) clusters: 6 6D00000D (R* xyzw) 7 6D00000D (R* uv2) 8 6E00401C (not instanced) 9 6E00000D (R* normal) stride: 4 vertexCount: 0x38 primCount: 0x12 vifOffset: 0xE0
VU code same as above.
Skin Pipelines
CVSkinPedPipe
53F20088 (template @ 6275A0)
53F20089 (template @ 627510) clusters: 6 6D00000D (R* xyzw) 7 6500000D (R* uv) 8 6E00000D (R* normal) 9 6C00000D (skin data) stride: 4 vertexCount: 0x2e primCount: 0x10 vifOffset: 0xC0
VU code binary, disassembly
Data format and VU1 code
Normals are scaled by 128, UV coordinates by 4096.
Vertices are scaled by 128 in the building code, otherwise by 1024.
The W field of the xyzw cluster is 0x0000 or 0x8000 and written to the ADC field of the XYZF register. 0x8000 inhibits the draw kick for this vertex.
For each vertex skin value the lower 10 bits are the bone matrix offset, the upper 22 bits are the upper part of an IEEE-float.
The bone matrix offset can be converted to a bone index like this: i = off == 0 ? 0 : off/4 - 1
(Actually all 32 bits are interpreted as IEEE floats, bone transformation isn't sensitive to little changes in the lower bits. Also all lower 16 bits are used as the bone offset but since the VU1 memory has only 16kb and the memory is qword-addressed, an address is only 10 bits long and the upper bits are ignored. The offsets are added to the start of the bone matrix array (which starts at 0x2d0) -4: so they're added to 0x2cc)