On the Wii U, GX2 is the system library that provides an interface to the GPU, similar to OpenGL or Vulkan.

This page describes the various data structures and enums that are exposed by the GX2 library that may be seen in file formats.

Some structures contain pointers. These are usually replaced by offsets, but the details depend on the file format.

Structures:

Enums:

GX2Surface

OffsetSizeDescription
0x04Dimension
0x44Width
0x84Height
0xC4Depth
0x104Mip levels
0x144Format
0x184AA mode
0x1C4Surface use
0x204Image size
0x244Image data (pointer)
0x284Mipmap size
0x2C4Mipmap data (pointer)
0x304Tile mode
0x344Swizzle value
0x384Alignment
0x3C4Pitch
0x404 * 13Mip level offsets

GX2Texture

OffsetSizeDescription
0x0116Surface
0x744View first mip
0x784View num mips
0x7C4View first slice
0x804View num slices
0x844Comp map
0x884 * 5Registers

GX2VertexShader

OffsetSizeDescription
0x04 * 52Registers
0xD04Program size
0xD44Program pointer
0xD84Shader mode
0xDC4Number of uniform blocks
0xE04Pointer to uniform blocks
0xE44Number of uniform vars
0xE84Pointer to uniform vars
0xEC4Number of initial values
0xF04Pointer to initial values
0xF44Number of loop vars
0xF84Pointer to loop vars
0xFC4Number of sampler vars
0x1004Pointer to sampler vars
0x1044Number of attrib vars
0x1084Pointer to attrib vars
0x10C4Ring item size
0x1104Has stream out
0x1144 * 4Stream out stride
0x12416R buffer

GX2PixelShader

OffsetSizeDescription
0x04 * 41Registers
0xA44Program size
0xA84Program pointer
0xAC4Shader mode
0xB04Number of uniform blocks
0xB44Pointer to uniform blocks
0xB84Number of uniform vars
0xBC4Pointer to uniform vars
0xC04Number of initial values
0xC44Pointer to initial values
0xC84Number of loop vars
0xCC4Pointer to loop vars
0xD04Number of sampler vars
0xD44Pointer to sampler vars
0xD816R buffer

GX2GeometryShader

OffsetSizeDescription
0x04 * 19Registers
0x4C4Program size
0x504Program pointer
0x544Vertex program size
0x584Vertex program pointer
0x5C4Shader mode
0x604Number of uniform blocks
0x644Pointer to uniform blocks
0x684Number of uniform vars
0x6C4Pointer to uniform vars
0x704Number of initial values
0x744Pointer to initial values
0x784Number of loop vars
0x7C4Pointer to loop vars
0x804Number of sampler vars
0x844Pointer to sampler vars
0x884Ring item size
0x8C4Has stream out
0x904 * 4Stream out stride
0xA016R buffer

GX2UniformBlock

OffsetSizeDescription
0x04Name pointer
0x44Offset
0x84Size

GX2UniformVar

OffsetSizeDescription
0x04Name pointer
0x44Type
0x84Count
0xC4Offset
0x104Block

GX2UniformInitialValue

OffsetSizeDescription
0x04 * 4Value (floats)
0x104Offset

GX2LoopVar

OffsetSizeDescription
0x04Offset
0x44Value

GX2SamplerVar

OffsetSizeDescription
0x04Name pointer
0x44Type
0x84Location

GX2AttribVar

OffsetSizeDescription
0x04Name pointer
0x44Type
0x84Count
0xC4Location

GX2RBuffer

This structure is only used internally and always cleared in files.

OffsetSizeDescription
0x04Resource flags
0x44Element size
0x84Element count
0xC4Buffer pointer

GX2SurfaceDim

ValueDescription
0GX2_SURFACE_DIM_TEXTURE_1D
1GX2_SURFACE_DIM_TEXTURE_2D
2GX2_SURFACE_DIM_TEXTURE_3D
3GX2_SURFACE_DIM_TEXTURE_CUBE
4GX2_SURFACE_DIM_TEXTURE_1D_ARRAY
5GX2_SURFACE_DIM_TEXTURE_2D_ARRAY
6GX2_SURFACE_DIM_TEXTURE_2D_MSAA
7GX2_SURFACE_DIM_TEXTURE_2D_MSAA_ARRAY

GX2SurfaceFormat

ValueDescription
0x0GX2_SURFACE_FORMAT_INVALID
0x1GX2_SURFACE_FORMAT_UNORM_R8
0x2GX2_SURFACE_FORMAT_UNORM_R4_G4
0x5GX2_SURFACE_FORMAT_UNORM_R16
0x7GX2_SURFACE_FORMAT_UNORM_R8_G8
0x8GX2_SURFACE_FORMAT_UNORM_R5_G6_B5
0xAGX2_SURFACE_FORMAT_UNORM_R5_G5_B5_A1
0xBGX2_SURFACE_FORMAT_UNORM_R4_G4_B4_A4
0xCGX2_SURFACE_FORMAT_UNORM_A1_B5_G5_R5
0xFGX2_SURFACE_FORMAT_UNORM_R16_G16
0x11GX2_SURFACE_FORMAT_UNORM_R24_X8
0x19GX2_SURFACE_FORMAT_UNORM_R10_G10_B10_A2
0x1AGX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8
0x1BGX2_SURFACE_FORMAT_UNORM_A2_B10_G10_R10
0x1FGX2_SURFACE_FORMAT_UNORM_R16_G16_B16_A16
0x31GX2_SURFACE_FORMAT_UNORM_BC1
0x32GX2_SURFACE_FORMAT_UNORM_BC2
0x33GX2_SURFACE_FORMAT_UNORM_BC3
0x34GX2_SURFACE_FORMAT_UNORM_BC4
0x35GX2_SURFACE_FORMAT_UNORM_BC5
0x81GX2_SURFACE_FORMAT_UNORM_NV12
0x101GX2_SURFACE_FORMAT_UINT_R8
0x105GX2_SURFACE_FORMAT_UINT_R16
0x107GX2_SURFACE_FORMAT_UINT_R8_G8
0x10DGX2_SURFACE_FORMAT_UINT_R32
0x10FGX2_SURFACE_FORMAT_UINT_R16_G16
0x111GX2_SURFACE_FORMAT_UINT_X24_G8
0x119GX2_SURFACE_FORMAT_UINT_R10_G10_B10_A2
0x11AGX2_SURFACE_FORMAT_UINT_R8_G8_B8_A8
0x11BGX2_SURFACE_FORMAT_UINT_A2_B10_G10_R10
0x11CGX2_SURFACE_FORMAT_UINT_G8_X24
0x11DGX2_SURFACE_FORMAT_UINT_R32_G32
0x11FGX2_SURFACE_FORMAT_UINT_R16_G16_B16_A16
0x122GX2_SURFACE_FORMAT_UINT_R32_G32_B32_A32
0x201GX2_SURFACE_FORMAT_SNORM_R8
0x205GX2_SURFACE_FORMAT_SNORM_R16
0x207GX2_SURFACE_FORMAT_SNORM_R8_G8
0x20FGX2_SURFACE_FORMAT_SNORM_R16_G16
0x219GX2_SURFACE_FORMAT_SNORM_R10_G10_B10_A2
0x21AGX2_SURFACE_FORMAT_SNORM_R8_G8_B8_A8
0x21FGX2_SURFACE_FORMAT_SNORM_R16_G16_B16_A16
0x234GX2_SURFACE_FORMAT_SNORM_BC4
0x235GX2_SURFACE_FORMAT_SNORM_BC5
0x301GX2_SURFACE_FORMAT_SINT_R8
0x305GX2_SURFACE_FORMAT_SINT_R16
0x307GX2_SURFACE_FORMAT_SINT_R8_G8
0x30DGX2_SURFACE_FORMAT_SINT_R32
0x30FGX2_SURFACE_FORMAT_SINT_R16_G16
0x319GX2_SURFACE_FORMAT_SINT_R10_G10_B10_A2
0x31AGX2_SURFACE_FORMAT_SINT_R8_G8_B8_A8
0x31DGX2_SURFACE_FORMAT_SINT_R32_G32
0x31FGX2_SURFACE_FORMAT_SINT_R16_G16_B16_A16
0x322GX2_SURFACE_FORMAT_SINT_R32_G32_B32_A32
0x41AGX2_SURFACE_FORMAT_SRGB_R8_G8_B8_A8
0x431GX2_SURFACE_FORMAT_SRGB_BC1
0x432GX2_SURFACE_FORMAT_SRGB_BC2
0x433GX2_SURFACE_FORMAT_SRGB_BC3
0x806GX2_SURFACE_FORMAT_FLOAT_R16
0x80EGX2_SURFACE_FORMAT_FLOAT_R32
0x810GX2_SURFACE_FORMAT_FLOAT_R16_G16
0x811GX2_SURFACE_FORMAT_FLOAT_D24_S8
0x816GX2_SURFACE_FORMAT_FLOAT_R11_G11_B10
0x81CGX2_SURFACE_FORMAT_FLOAT_X8_X24
0x81EGX2_SURFACE_FORMAT_FLOAT_R32_G32
0x820GX2_SURFACE_FORMAT_FLOAT_R16_G16_B16_A16
0x823GX2_SURFACE_FORMAT_FLOAT_R32_G32_B32_A32

GX2AAMode

ValueDescription
0GX2_AA_MODE_1X
1GX2_AA_MODE_2X
2GX2_AA_MODE_4X
3GX2_AA_MODE_8X

GX2SurfaceUse

This is a bitfield.

MaskDescription
0x0GX2_SURFACE_USE_NONE
0x1GX2_SURFACE_USE_TEXTURE
0x2GX2_SURFACE_USE_COLOR_BUFFER
0x4GX2_SURFACE_USE_DEPTH_BUFFER
0x8GX2_SURFACE_USE_SCAN_BUFFER
0x80000000GX2_SURFACE_USE_TV

GX2TileMode

ValueDescription
0GX2_TILE_MODE_DEFAULT
1GX2_TILE_MODE_LINEAR_ALIGNED
2GX2_TILE_MODE_TILED_1D_THIN1
3GX2_TILE_MODE_TILED_1D_THICK
4GX2_TILE_MODE_TILED_2D_THIN1
5GX2_TILE_MODE_TILED_2D_THIN2
6GX2_TILE_MODE_TILED_2D_THIN4
7GX2_TILE_MODE_TILED_2D_THICK
8GX2_TILE_MODE_TILED_2B_THIN1
9GX2_TILE_MODE_TILED_2B_THIN2
10GX2_TILE_MODE_TILED_2B_THIN4
11GX2_TILE_MODE_TILED_2B_THICK
12GX2_TILE_MODE_TILED_3D_THIN1
13GX2_TILE_MODE_TILED_3D_THICK
14GX2_TILE_MODE_TILED_3B_THIN1
15GX2_TILE_MODE_TILED_3B_THICK
16GX2_TILE_MODE_LINEAR_SPECIAL

GX2ShaderMode

ValueDescription
0GX2_SHADER_MODE_UNIFORM_REGISTER
1GX2_SHADER_MODE_UNIFORM_BLOCK
2GX2_SHADER_MODE_GEOMETRY_SHADER
3GX2_SHADER_MODE_COMPUTE_SHADER

GX2ShaderVarType

ValueDescription
0GX2_SHADER_VAR_TYPE_VOID
1GX2_SHADER_VAR_TYPE_BOOL
2GX2_SHADER_VAR_TYPE_INT
3GX2_SHADER_VAR_TYPE_UINT
4GX2_SHADER_VAR_TYPE_FLOAT
5GX2_SHADER_VAR_TYPE_DOUBLE
6GX2_SHADER_VAR_TYPE_DOUBLE2
7GX2_SHADER_VAR_TYPE_DOUBLE3
8GX2_SHADER_VAR_TYPE_DOUBLE4
9GX2_SHADER_VAR_TYPE_FLOAT2
10GX2_SHADER_VAR_TYPE_FLOAT3
11GX2_SHADER_VAR_TYPE_FLOAT4
12GX2_SHADER_VAR_TYPE_BOOL2
13GX2_SHADER_VAR_TYPE_BOOL3
14GX2_SHADER_VAR_TYPE_BOOL4
15GX2_SHADER_VAR_TYPE_INT2
16GX2_SHADER_VAR_TYPE_INT3
17GX2_SHADER_VAR_TYPE_INT4
18GX2_SHADER_VAR_TYPE_UINT2
19GX2_SHADER_VAR_TYPE_UINT3
20GX2_SHADER_VAR_TYPE_UINT4
21GX2_SHADER_VAR_TYPE_FLOAT2X2
22GX2_SHADER_VAR_TYPE_FLOAT2X3
23GX2_SHADER_VAR_TYPE_FLOAT2X4
24GX2_SHADER_VAR_TYPE_FLOAT3X2
25GX2_SHADER_VAR_TYPE_FLOAT3X3
26GX2_SHADER_VAR_TYPE_FLOAT3X4
27GX2_SHADER_VAR_TYPE_FLOAT4X2
28GX2_SHADER_VAR_TYPE_FLOAT4X3
29GX2_SHADER_VAR_TYPE_FLOAT4X4
30GX2_SHADER_VAR_TYPE_DOUBLE2X2
31GX2_SHADER_VAR_TYPE_DOUBLE2X3
32GX2_SHADER_VAR_TYPE_DOUBLE2X4
33GX2_SHADER_VAR_TYPE_DOUBLE3X2
34GX2_SHADER_VAR_TYPE_DOUBLE3X3
35GX2_SHADER_VAR_TYPE_DOUBLE3X4
36GX2_SHADER_VAR_TYPE_DOUBLE4X2
37GX2_SHADER_VAR_TYPE_DOUBLE4X3
38GX2_SHADER_VAR_TYPE_DOUBLE4X4

GX2SamplerVarType

ValueDescription
0GX2_SAMPLER_VAR_TYPE_SAMPLER_1D
1GX2_SAMPLER_VAR_TYPE_SAMPLER_2D
3GX2_SAMPLER_VAR_TYPE_SAMPLER_3D
4GX2_SAMPLER_VAR_TYPE_SAMPLER_CUBE

GX2ResourceFlags

This is a bitfield.

MaskDescription
0x0GX2R_RESOURCE_BIND_NONE
0x1GX2R_RESOURCE_BIND_TEXTURE
0x2GX2R_RESOURCE_BIND_COLOR_BUFFER
0x4GX2R_RESOURCE_BIND_DEPTH_BUFFER
0x8GX2R_RESOURCE_BIND_SCAN_BUFFER
0x10GX2R_RESOURCE_BIND_VERTEX_BUFFER
0x20GX2R_RESOURCE_BIND_INDEX_BUFFER
0x40GX2R_RESOURCE_BIND_UNIFORM_BLOCK
0x80GX2R_RESOURCE_BIND_SHADER_PROGRAM
0x100GX2R_RESOURCE_BIND_STREAM_OUTPUT
0x200GX2R_RESOURCE_BIND_DISPLAY_LIST
0x400GX2R_RESOURCE_BIND_GS_RING_BUFFER
0x800GX2R_RESOURCE_USAGE_CPU_READ
0x1000GX2R_RESOURCE_USAGE_CPU_WRITE
0x2000GX2R_RESOURCE_USAGE_GPU_READ
0x4000GX2R_RESOURCE_USAGE_GPU_WRITE
0x8000GX2R_RESOURCE_USAGE_DMA_READ
0x10000GX2R_RESOURCE_USAGE_DMA_WRITE
0x20000GX2R_RESOURCE_USAGE_FORCE_MEM1
0x40000GX2R_RESOURCE_USAGE_FORCE_MEM2
0x100000GX2R_RESOURCE_DISABLE_CPU_INVALIDATE
0x200000GX2R_RESOURCE_DISABLE_GPU_INVALIDATE
0x400000GX2R_RESOURCE_LOCKED_READ_ONLY
0x20000000GX2R_RESOURCE_GX2R_ALLOCATED
0x40000000GX2R_RESOURCE_LOCKED