SGD2 shader databases
Enhanced stores compiled programs in common/shaders/fxdb/sga_win32_60_final.awc inside update/update2.rpf, with an
_init sibling. Despite the .awc suffix, these files begin with SGD2 and contain DXIL program containers and
effect records. Proven
Both inspected databases parse to their final byte: eight program groups followed by a count and that many effect records, with no unexplained trailing bytes. This establishes the outer framing, not the meaning of every byte inside a retained table. Proven · both complete databases
| Group index | Stage | Programs in sga_win32_60_final.awc |
Confidence |
|---|---|---|---|
| 0 | Vertex | 3,707 | Proven |
| 1 | Pixel | 7,594 | Proven |
| 2 | Geometry | 0 | Proven |
| 3 | Domain | 458 | Proven |
| 4 | Hull | 406 | Proven |
| 5 | Compute | 240 | Proven |
| 6–7 | Empty in both inspected files; stage meaning unknown | 0 | Unknown |
The main database therefore holds 12,405 programs, followed by 388 effect records. Proven · complete main database
Each group begins with a little-endian u32 program count. Programs have length-prefixed NUL-terminated names,
a tag byte, a sized DXIL container with DXBC magic, a fixed 152-byte table and another sized table.
Proven
A program’s name does not identify it: programs of different effects share a name, such as
PS_DeferredTextured_0174add1_Wrapped; the programs drawn around one downtown street area are 36 programs under 10 names.
The bytecode, not the name, tells programs apart. Observed · programs drawn in one street area, compared by bytecode hash
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 1 | u8 | name byte length | Proven | |
| 0x1 | name byte length | string | name including NUL | Proven | |
| after name | 1 | u8 | unknown tag | Unknown | 0x32, 0x41 or 0x42 |
| after tag | 4 | u32 | container length | Proven | |
| after container length | container length | bytes | DXIL container | Proven | |
| after container | 152 | bytes | unknown fixed table | Unknown | |
| after fixed table | 4 | u32 | binding table length | Proven | |
| after binding table length | binding table length | bytes | binding table | Proven |
What the programs use
Section titled “What the programs use”A census of the main database’s programs finds the following. Observed · census of the main database’s programs
- 1,275 programs belong to tessellation pipelines, named
VS_…,HS_…andDS_…_PNTri_*_Wrapped: the 406 hull and 458 domain programs, and 411 vertex programs, none of which writesSV_Position. - 5,697 pixel programs index an unbounded sampler array (register
s0, space 2) with a dynamic index. - 30 programs use ray queries; three use quad operations.
- 35 programs read the wave lane index (
WaveGetLaneIndex) in a thread group of more than one dimension.
The game’s effect list common/shaders/preload.list, also in update/update2.rpf, names every effect that the
install’s drawables use. Observed
Effect framing
Section titled “Effect framing”An effect record starts with a length-prefixed NUL-terminated name, then a u32 word and six lists of program indices, in vertex/pixel/geometry/domain/hull/compute order. Each list is a u32 count followed by u32 indices into that stage’s database group. Proven
The word after the name is not the record’s byte size; its complete purpose is unresolved. The record ends
structurally: proplst\0, a u32 section count, sized sections, then a u32-sized NUL-terminated name block.
Proven The root-signature interpretation of the proplst sections is not fully decoded here. Unknown
Program bindings
Section titled “Program bindings”Every program’s binding table in the main database parses with complete resource/constant ownership counts and name-hash resolution. This proves the stored table structure across all programs. The interface comparison below has narrower scope because an interface can be unavailable and unbounded arrays are treated separately. Proven · every main-database program table
The per-program binding table begins with u16 resource count, u32 constant count and an unnamed u16. Resource records are followed by constant records and NUL-terminated ASCII names. Proven
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 2 | u16 | tag | Unknown | |
| 0x2 | 2 | u16 | register | Proven | |
| 0x4 | 1 | u8 | owned constant count | Proven | |
| 0x5 | 1 | u8 | class byte | Unknown | |
| 0x6 | 2 | u16 | register space | Proven | |
| 0x8 | 6 | bytes | unknown | Unknown | |
| 0xE | 4 | u32 | buffer size | Proven | |
| 0x12 | 2 | u16 | unknown | Unknown | |
| 0x14 | 4 | u32 | program name hash | Proven | |
| 0x18 | 4 | u32 | current material name hash | Proven |
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 4 | u32 | flags and type | Proven | low byte identifies the value type; remaining bits are not fully named |
| 0x4 | 2 | u16 | byte offset in buffer | Proven | |
| 0x6 | 2 | u16 | ID | Unknown | |
| 0x8 | 8 | bytes | unknown words | Unknown | |
| 0x10 | 4 | u32 | program name hash | Proven | |
| 0x14 | 4 | u32 | current material name hash | Proven |
The first name hash resolves to a name in the table, with exact-case or lowercase joaat. The second links an older
program identifier, such as specularFresnel, to a material identifier such as Fresnel; engine constants can use
zero or repeat the first hash instead. Proven
The whole-database interface comparison checks each declared constant buffer, texture and sampler against a record at the same class/register/space. Buffer sizes are rounded up to 16 bytes; root-constant records can state size zero, and unbounded resource arrays need separate handling. Constant ownership counts sum to the constant-table count. Observed · program-interface comparison
Techniques and state
Section titled “Techniques and state”Every technique-bearing effect in the main database decodes with valid program and state-table references and no unread technique table. Effects without this structure, including post-processing and lighting effects, are counted separately rather than forced into the layout. The proven pass and state fields below apply to all technique-bearing effects; the outer framing proof also covers records without techniques. Proven · all technique-bearing effects
Effects with a technique table have name-offset/pass-count entries and a count-prefixed list of 24-byte passes. Post-processing and lighting effects can lack this table. Proven
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 6 | u8[6] | programs by stage | Proven | 1-based position in the effect's stage list; 0 means absent |
| 0x6 | 2 | bytes | unknown zero bytes | Unknown | zero in inspected records |
| 0x8 | 1 | u8 | rasterizer state index | Proven | |
| 0x9 | 1 | u8 | depth-stencil state index | Proven | |
| 0xA | 1 | u8 | blend state index | Proven | |
| 0xB | 13 | bytes | unknown tail | Unknown |
State tables use Direct3D 12 enumeration values. Their record sizes are rasterizer 16, depth-stencil 24, blend 68 and sampler 36 bytes. The blend record holds four leading bytes followed by eight 8-byte render-target descriptions. Proven
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 1 | u8 | fill mode | Proven | 2 wireframe, 3 solid |
| 0x1 | 1 | u8 | cull mode | Proven | 1 none, 2 front, 3 back |
| 0x2 | 1 | u8 | front counterclockwise | Proven | |
| 0x3 | 5 | bytes | unknown | Unknown | |
| 0x8 | 4 | f32 | polygon offset | Proven | nonzero in the two inspected foam effects |
| 0xC | 4 | bytes | unknown tail | Unknown |
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 1 | u8 | depth enable | Proven | |
| 0x1 | 1 | u8 | depth write mask | Proven | |
| 0x2 | 1 | u8 | depth comparison | Proven | |
| 0x3 | 1 | u8 | stencil enable | Proven | |
| 0x4 | 1 | u8 | stencil read mask | Proven | |
| 0x5 | 1 | u8 | stencil write mask | Proven | |
| 0x6 | 4 | u8[4] | front stencil operations and comparison | Proven | fail, depth-fail, pass, comparison |
| 0xA | 4 | u8[4] | back stencil operations and comparison | Proven | |
| 0xE | 10 | bytes | unknown tail | Unknown |
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 4 | bytes | unknown prefix | Unknown | |
| 0x4 | 64 | RenderTargetBlend[8] | target blend descriptions | Proven |
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 1 | u8 | blend enable | Proven | |
| 0x1 | 1 | u8 | source factor | Proven | |
| 0x2 | 1 | u8 | destination factor | Proven | |
| 0x3 | 1 | u8 | operation | Proven | |
| 0x4 | 1 | u8 | alpha source factor | Proven | |
| 0x5 | 1 | u8 | alpha destination factor | Proven | |
| 0x6 | 1 | u8 | alpha operation | Proven | |
| 0x7 | 1 | u8 | write mask | Proven |
| Offset | Size | Type | Field | Confidence | Notes |
|---|---|---|---|---|---|
| 0x0 | 1 | u8 | filter | Proven | |
| 0x1 | 3 | u8[3] | U-V-W address modes | Proven | 1 wrap, 2 mirror, 3 clamp |
| 0x4 | 4 | f32 | mip LOD bias | Proven | |
| 0x8 | 1 | u8 | maximum anisotropy | Proven | |
| 0x9 | 1 | u8 | comparison function | Proven | |
| 0xA | 22 | bytes | retained fields | Unknown | includes border colour and minimum LOD; not individually decoded |
| 0x20 | 4 | f32 | maximum LOD | Proven |
Known-effect controls support the interpretation: default includes depth comparison GREATER (reversed Z);
decal includes source-alpha/inverse-source-alpha blending; emissive_additive_alpha includes
source-alpha/destination-one blending. These checks establish concrete states, rather than deriving state only
from effect names. Observed
Outer framing and named fields are decoded, but the three program-tag values and unnamed table fields have no established semantic meaning. Unknown
Read as raw words, the effect bytes after the program lists hold seven u32 words at offset 0x18 with the values
6, 6, 2, 0, 2, 3, 2. A flags word follows them: 0x1002 in default, emissive and cloth, 0x10 in glass and
decal effects, and 0x2 in cutout_fence. A further word varies by effect (0x11000011, 0x11000111 with the
0x100 bit in glass, 0x13000011). The values are observed on those effects; how these words relate to the decoded
state tables and to the flag-8 classification of cloth_* effects on
deferred decals is not established. Unknown