This page describes the structure of the buffer for GX command 1 with the registers at 0x1EF018E0. This buffer is used for GPU commands including OpenGL commands, each 8-byte entry in the buffer is a command. Cmd+0 is the command parameter, and cmd+4 is the command header.
Invalid GPU command parameters including NaN floats can cause the GPU to hang, this then causes the GSP module to hang as well.
Command Header
Bit
|
Description
|
19-0
|
Command ID
|
30-20
|
Total words following the command, if any.
|
31
|
?
|
The first word in the parameter data structure is the command parameter value, the rest of the data structure is from the data following the command. The word after the last data structure word is padding when needed for 8-byte alignment, for the following command.
Commands
CommandID
|
Parameter
|
Description
|
0x000F0010
|
Value is 0x12345678
|
This command is always the last command in the buffer.
|
0x000F0110
|
Value 0x1
|
This command is immediately before CmdID 0x000F0010, this is also used elsewhere for beginning rendering of mesh(es) as well.
|
0x000F0111
|
Value 0x1
|
This command is immediately before CmdID 0x000F0110, however CmdID 0x000F0110 doesn't always follow this command.
|
0x000F0040
|
u32, valid values are 0x1 and 0x2, values 0x0 and 0x3 have the same effect as value 0x2. Only bits 1-0 are used.
|
Value 2 = GL_FRONT/GL_CW or GL_BACK/GL_CCW. Value 1 = GL_FRONT/GL_CCW or GL_BACK/GL_CW.
|
0x000F0041
|
float
|
See command set 0x000F0041.
|
0x000F0042
|
float
|
See command set 0x000F0041.
|
0x000F0043
|
float
|
See command set 0x000F0041.
|
0x000F0044
|
float
|
See command set 0x000F0041.
|
0x801F004D
|
First word in parameter structure
|
?
|
0x0002025E
|
u32, val<<8.
|
This sets the GL rendering mode.
|
0x000F0068
|
u32
|
See command set 0x000F0041.
|
0x000F006E
|
u32
|
See command set 0x000F0111.
|
0x809F0081
|
|
This is used to set the current texture info used for rendering, see command set 0x809F0081.
|
0x000F008E
|
u32 color type
|
This command sets the texture color type, see command set 0x809F0081.
|
0x805F0091
|
|
This sets current texture info, see command 0x805F0091.
|
0x805F0099
|
|
This sets current texture info, see command 0x805F0099.
|
0x80XF00C0
|
|
See command set 0x80XF00C0.
|
0x800F00C4
|
|
See command set 0x80XF00C0.
|
0x80XF00C8
|
|
See command set 0x80XF00C0.
|
0x800F00CC
|
|
See command set 0x80XF00C0.
|
0x80XF00D0
|
|
See command set 0x80XF00C0.
|
0x800F00D4
|
|
See command set 0x80XF00C0.
|
0x80XF00D8
|
|
See command set 0x80XF00C0.
|
0x800F00DC
|
|
See command set 0x80XF00C0.
|
0x80XF00F0
|
|
See command set 0x80XF00C0.
|
0x800F00F4
|
|
See command set 0x80XF00C0.
|
0x80XF00F8
|
|
See command set 0x80XF00C0.
|
0x800F00FC
|
|
See command set 0x80XF00C0.
|
0x00020100
|
u32, value is 0x00E40100
|
This command is used immediately before CmdID 0x000F0101.
|
0x000F00E6
|
Value zero
|
See command set 0x000F00E6.
|
0x000F00E8
|
|
See command set 0x000F00E6.
|
0x000F0101
|
u32
|
Color related?
|
0x000F0104
|
u32
|
glAlphaFunc()?
|
0x00010107
|
|
See command set CmdID 0x00010107.
|
0x00020107
|
|
See command set CmdID 0x00010107.
|
0x00030107
|
|
See command set CmdID 0x00030107.
|
0x000F0116
|
u32
|
See command set 0x000F0111.
|
0x000F0117
|
u32
|
See command set 0x000F0111.
|
0x000F011C
|
Physical address>>3
|
See command set 0x000F0111.
|
0x000F011D
|
Physical address>>3
|
See command set 0x000F0111.
|
0x000F011E
|
u32
|
See command set 0x000F0111.
|
0x826F0200
|
|
See command set 0x826F0200.
|
0x00080126
|
|
See command set CmdID 0x00030107.
|
0x000F0227
|
u32
|
This specifies the address of an array containing vertex array indices, and the data-type of the indices, used for rendering primitives. See command set glDrawElements().
|
0x000F0228
|
u32 total elements in the array to use for rendering.
|
See command set glDrawElements().
|
0x803F0232
|
|
See command set 0x826F0200.
|
0x000F02B0
|
u32, value is 0x7FFF0000 | val.
|
Texture related?
|
0x801F02BB
|
|
See command set 0x826F0200.
|
0x000F02C0
|
0x80000000 | Type
|
This is used immediately before CmdID 0xXXXF02C1. This type field controls the command parameter buffer type.
|
0xXXXF02C1
|
First word in the first entry
|
A list of entries follow this command.
|
Command Sets
glDrawElements()
See GPU GL Arrays.
glClear() / glClearColor()
The GPU does not have dedicated commands for clearing the color buffer, therefore applications implement color buffer clearing by rendering a quad. Applications normally store this vertex and color array in the GSP application heap.
CmdID 0x809F0081
This sets current texture info, see GPU textures.
CmdID 0x80XF00C0
Command Index
|
CommandID
|
Parameter
|
Description
|
0
|
0x802F0000 | SlotCmdID
|
|
|
1
|
0x800F0000 | SlotCmdID + 4
|
|
|
This is used to set various rendering parameters for the slot indicated by the CmdID. There's a total of 6 slots, where each slot corresponds to the following u16 CmdIDs: 0xC0, 0xC8, 0xD0, 0xD8, 0xF0, 0xF8.
CmdID 0x000F00E6
Command Index
|
CommandID
|
Parameter
|
Description
|
0
|
0x000F00E6
|
Value 0
|
?
|
1
|
0x000F00E8
|
|
|
This is the last command set used for rendering a mesh.
CmdID 0x000F0041
Command Index
|
CommandID
|
Parameter
|
Description
|
0
|
0x000F0041
|
float
|
This corresponds to the framebuffer width.
|
1
|
0x000F0043
|
float
|
This parameter value is calculated the same way as the CmdID 0x000F0041 parameter, except the framebuffer height is used instead.
|
2
|
0x000F0042
|
float
|
This corresponds to the framebuffer width.
|
3
|
0x000F0044
|
float
|
This parameter value value is calculated the same way as the CmdID 0x000F0042 parameter, except the framebuffer height is used instead.
|
4
|
0x000F0068
|
u32
|
This sets the X/Y coordinates used for glViewport().
|
This command set initializes the projection matrix. This command set is used twice when beginning rendering for each screen. The framebuffer width used here for the main screen is 240, however this is 480 with stereoscopy enabled for the second time this command set is used.
CmdID 0x000F0111
Command Index
|
CommandID
|
Parameter
|
Description
|
0
|
0x000F0111
|
Value 1
|
|
1
|
0x000F0110
|
Value 1
|
|
2
|
0x000F0117
|
Bits15-0 = unk, 31-16 = unk.
|
Unknown, normally the input parameter is value 0x2.
|
3
|
0x000F011D
|
Physical address>>3
|
This initializes the framebuffer address used for rendering, this framebuffer is used for the input framebuffer with GX command 3 and 4. This command is used immediately after CmdID 0x000F0117.
|
4
|
0x000F0116
|
|
?
|
5
|
0x000F011C
|
Physical address>>3
|
Unknown, normally this address is located in VRAM.
|
6
|
0x000F011E
|
u32
|
This sets the width and height for the framebuffer used for rendering. Therefore this is glViewport(), x/y are specified by CmdID 0x000F0068.
|
7
|
0x000F006E
|
Same input parameter value as CmdID 0x000F011E.
|
|
This command set is normally used after the two 0x000F0041 command sets.
CmdID 0x00030107
Command Index
|
CommandID
|
Parameter
|
Description
|
0
|
0x00030107
|
|
|
1
|
0x00080126
|
type<<24
|
|
This command set is used for disabling the alpha-testing info set by command set 0x00010107? The GL AlphaFunction used here is normally GL_ALWAYS.
CmdID 0x00010107
Command Index
|
CommandID
|
Parameter
|
Description
|
0
|
0x00010107
|
Same format as CmdID 0x00030107.
|
|
1
|
0x00080126
|
type<<24
|
|
0
|
0x00020107
|
Same value as CmdID 0x00030107.
|
|
Parameter format for CmdIDs 0x00030107, 0x00020107, and 0x00010107
Bit
|
Description
|
0
|
0 = disable GL_ALPHA_TEST, 1 = enable GL_ALPHA_TEST?
|
3-1
|
Unused?
|
7-4
|
Alpha function
|
11-8
|
Color to blend with?
|
12
|
?
|
31-13
|
Unused
|
Alpha function values
Value
|
GL AlphaFunction
|
0
|
GL_NEVER
|
1
|
GL_ALWAYS
|
2
|
GL_EQUAL
|
3
|
GL_NOTEQUAL
|
4
|
GL_LESS
|
5
|
GL_LEQUAL
|
6
|
GL_GREATER
|
7
|
GL_GEQUAL
|
Alpha types for CmdID 0x00080126
Type
|
GL AlphaFunction
|
0
|
GL_NEVER
|
1
|
GL_ALWAYS
|
2
|
GL_GREATER/GL_GEQUAL
|
3
|
The remaining GL alpha functions.
|
Parameter value format for CmdID 0x000F0104
Bit
|
Description
|
0
|
0 = disable GL_ALPHA_TEST, 1 = enable GL_ALPHA_TEST?
|
3-1
|
Unused?
|
7-4
|
Alpha function
|
15-8
|
u8 ref, range is 0-255?
|
31-16
|
Unused?
|
This is glAlphaFunc()?
Parameter value format for CmdID 0x000F011E
Bit
|
Description
|
11-0
|
Framebuffer/viewport width
|
23-12
|
Framebuffer/viewport height - 1
|
24
|
Must be set
|
31-25
|
Unused?
|
This specifies the width/height for glViewport(). Normally the framebuffer width and height is set to the same dimensions used with GX command 3 and 4.
Parameter value format for CmdID 0x000F0068
Bit
|
Description
|
15-0
|
X
|
31-16
|
Y
|
This specifies the X/Y coordinates for glViewport().
Parameter structure for CmdID 0x804F00C0
Index Word
|
Description
|
0
|
Value 0xFFF0FFF / 0x0
|
1
|
Value 0x0
|
2
|
Value 0x0
|
3
|
Value 0xFFFFFFFF
|
4
|
Value 0x0
|
This individual command is used instead of the 0x80XF00C0 command set when none of the associated rendering parameters for this slot are set.
Parameter structure for CmdID 0x802F00C0
Index Word
|
Description
|
0
|
Param0
|
1
|
Param1
|
2
|
Param2
|
See command set 0x80XF00C0.
Param0 format for CmdID 0x802F00C0
Bit
|
Description
|
3-0
|
See below values.(Field0 index0)
|
7-4
|
See below values.(Field0 index1)
|
11-8
|
See below values.(Field0 index2)
|
15-12
|
Unused
|
19-16
|
See below values.(Field1 index0)
|
23-20
|
See below values.(Field1 index1)
|
27-24
|
See below values.(Field1 index2)
|
31-28
|
Unused
|
Param0 values for CmdID 0x802F00C0
Value
|
GL type
|
0x0
|
GL_PRIMARY_COLOR
|
0x1
|
?
|
0x2
|
?
|
0x3
|
GL_TEXTURE0
|
0x4
|
GL_TEXTURE1
|
0x5
|
GL_TEXTURE2
|
0x6
|
GL_TEXTURE3
|
0xC-0x7
|
GL_PRIMARY_COLOR
|
0xD
|
?
|
0xE
|
GL_CONSTANT
|
0xF
|
GL_PREVIOUS
|
Param1 format for CmdID 0x802F00C0
Bit
|
Description
|
3-0
|
See below values for field0.(Index0)
|
7-4
|
See below values for field0.(Index1)
|
11-8
|
See below values for field0.(Index2)
|
15-12
|
See below values for field1.(Index0)
|
19-16
|
See below values for field1.(Index1)
|
23-20
|
See below values for field1.(Index2)
|
31-24
|
Unused
|
Param1 field0 values for CmdID 0x802F00C0
Value
|
GL type
|
0x0
|
GL_SRC_COLOR
|
0x1
|
GL_ONE_MINUS_SRC_COLOR
|
0x2
|
GL_SRC_ALPHA
|
0x3
|
GL_ONE_MINUS_SRC_ALPHA
|
0x4
|
GL_SRC0_RGB
|
0x5
|
?
|
0x6
|
GL_SRC_COLOR
|
0x7
|
GL_SRC_COLOR
|
0x8
|
GL_SRC1_RGB
|
0x9
|
?
|
0xA
|
GL_SRC_COLOR
|
0xB
|
GL_SRC_COLOR
|
0xC
|
GL_SRC2_RGB
|
0xD
|
?
|
Param1 field1 values for CmdID 0x802F00C0
Value
|
GL type
|
0x0
|
GL_SRC_ALPHA
|
0x1
|
GL_ONE_MINUS_SRC_ALPHA
|
0x2
|
GL_SRC0_RGB
|
0x3
|
?
|
0x4
|
GL_SRC1_RGB
|
0x5
|
?
|
0x6
|
GL_SRC2_RGB
|
0x7
|
?
|
Param2 format for CmdID 0x802F00C0
Bit
|
Description
|
15-0
|
See below field0 values.
|
31-16
|
See below field1 values.
|
Param2 field0 values for CmdID 0x802F00C0
Value
|
GL type
|
0x0
|
GL_REPLACE
|
0x1
|
GL_MODULATE
|
0x2
|
GL_ADD
|
0x3
|
GL_ADD_SIGNED
|
0x4
|
GL_INTERPOLATE
|
0x5
|
GL_SUBTRACT
|
0x6
|
GL_DOT3_RGB
|
0x7
|
GL_DOT3_RGBA
|
0x8
|
?
|
0x9
|
?
|
Param2 field1 values for CmdID 0x802F00C0
Value
|
GL type
|
0x0
|
GL_REPLACE
|
0x1
|
GL_MODULATE
|
0x2
|
GL_ADD
|
0x3
|
GL_ADD_SIGNED
|
0x4
|
GL_INTERPOLATE
|
0x5
|
GL_SUBTRACT
|
0x6
|
GL_REPLACE
|
0x7
|
GL_DOT3_RGB
|
0x8
|
?
|
0x9
|
?
|
Parameter value format for CmdID 0x800F00C4
Bit
|
Description
|
15-0
|
Valid values: 0=unknown, 1=unknown, 2=unknown.
|
31-16
|
Same format as bits15-0.
|
See command set 0x80XF00C0.
Parameter structure for CmdID 0x000F00E8
Index Word
|
Description
|
0x7f-0x00
|
?
|
Entries for CmdID 0xXXXF02C1
Index Word
|
Description
|
0
|
float
|
1
|
float
|
2
|
float
|
3
|
float
|
Color Entry
Index Word
|
Description
|
0
|
float Red component
|
1
|
float Blue component
|
2
|
float Green component
|
3
|
float Alpha
|
4
|
float
|
5
|
float
|
6
|
float
|
7
|
float
|
Types for CmdID 0x000F02C0
Value
|
Entries per chunk
|
Description
|
0x00
|
4
|
This specifies 16-floats for a 4x4 matrix, used for glLoadMatrix() for the projection matrix.
|
0x04
|
4
|
This specifies a 4x4 matrix, used for glLoadMatrix() for the model-view matrix. This is usually an identity matrix.
|
0x08
|
One color entry via two CmdID 0xXXXF02C1 entries.
|
Sets the color.
|
0x0A
|
4
|
Specifies a 4x4 matrix, used for glLoadMatrix() for the texture matrix.(Index0)
|
0x0E
|
3
|
Specifies a 4x3 texture matrix.(Index1)
|
0x11
|
3
|
Specifies a 4x3 texture matrix.(Index2)
|
0x14
|
<=30
|
Used to specify a 4xN matrix, where N is the total CmdID 0xXXXF02C1 entries. This is glMultMatrix() for the model-view matrix, except the input matrix is 4xN instead of 4x4.
|
0x4C
|
4
|
This specifies a 4x4 float matrix.
|
0x50, 0x53, and 0x56
|
1
|
?
|
0x51, 0x54, and 0x57
|
1
|
?
|
0x52, 0x55, and 0x58
|
1
|
?
|
0x59
|
1
|
Unknown, the entry data is floats converted from s32s.
|
0x5A
|
2
|
Color related?
|
0x5C
|
1
|
?
|
For matrices, the rows are flipped: the GPU handles the 4th row as the 1st row, 3rd row as the 2nd row, etc.