TextureChooseFormat
function · gx · primitive
- Address
0x44a790· 321 bytes, up to0x44a8d0- Signature
void __fastcall (uint32_t *typeCode, uint32_t *format, uint32_t alphaType, uint32_t alphaDepth)- Meaning
- Chooses the pixel type code and GxTex format of a BLP from its alpha type byte, alpha depth and the device DXT flags
- Confidence
- verified, proof one
- Finding
- gx/texturesize#blp-format-chooser
- Test
gx::texture_format_choice_difftest
Finding: BLP format chooser in gx: texture sizes and formats
0x44a790(alphaType, alphaDepth) chooses a pixel type code and a GxTex format for the BLP callback 0x44a560. It reads the header byte at reader +0x0e (0 to 8) and the alpha depth, never the compression byte, and the device flags +0x40 (DXT1), +0x44 (DXT3) and +0x48 (DXT5) as non-zero words. A byte of 6 or above 8 stores nothing. The code goes to the first output (ecx) and the format to the second (edx). Bytes 0, 1 and 7 depend on the device:
| byte | device flag | type code | format |
|---|---|---|---|
| 0 | +0x40 set | 0 | Dxt1 |
| 0 | clear, depth 0 | 5 | Rgb565 |
| 0 | clear, depth above 0 | 3 | Argb1555 |
| 1 | +0x44 set | 1 | Dxt3 |
| 1 | clear | 4 | Argb4444 |
| 7 | +0x48 set | 7 | Dxt5 |
| 7 | clear | 4 | Argb4444 |
The derivation is in the doc.
Callers 1
Callees 1
- GxDeviceCaps gx
Calls and jumps by a bare address, from tables/calls.tsv.