benilla-re systems structs docs

CM2Shared::GetVertexShaderId

function · models · primitive

Address
0x71de50 · 210 bytes, up to 0x71df21
Meaning
Computes a batch's vertex shader id from its flags, bone weights, pixel shader grant and stage digits
Confidence
verified, proof two
Finding
models/shared#vertex-shader-id
Test
models::vertex_shader_id_difftest

Finding: Vertex shader id in models: the shared model

A batch's vertex shader id is 5·(3·(3·Z + t0) + t1) with Z = G + 2·L + 4·B + 20·P: G is 1 when material flag 2 is clear, L 1 when flag 1 is clear, B the submesh's word +0x10 and P 1 when the cache grants pixel shaders (bit 0x10). The digit t_k of stage k is 0 from the batch's texture count +0xe on; else 2 when the coordinate lookup entry (header +0xa0, unit +0x12 + k) is above 2; else 1 when the transform lookup entry (header +0xb0, unit +0x16 + k) is below the transform count +0x74; else 0. The scene adds the nearest-light count to a lit element's id and may rewrite B.

The derivation is in the doc.

Callers 2

Callees 0

None by a direct call or jump.

Calls and jumps by a bare address, from tables/calls.tsv.