Changes

581 bytes added ,  19:00, 10 October 2014
Added overview section, rewrote description on how commands are specified
Line 1: Line 1: −
This page describes the structure of the buffer for [[GSP_Shared_Memory|GX command]] 1 with the registers at [[GPU|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.
+
This page describes the structure of the buffer submitted via the registers at [[GPU|0x1EF018E0]] (or equivalently via [[GSP_Shared_Memory|GX command]] 1). This buffer is used for GPU commands including functionality equivalent to OpenGL commands.
   −
Invalid GPU command parameters including NaN floats can cause the GPU to hang, this then causes the GSP module to hang as well.
+
=== Overview ===
 +
Each command is at least 8 bytes wide. The first word is the command parameter and the second word constitutes the command header. Optionally, more parameter words may follow (potentially including a padding word to align commands to multiples of 8 bytes).
 +
 
 +
In the simplest case, a command is exactly 8 bytes wide. You can think of such a command as writing the parameter word to an internal register (the index of which is given in the command header). The more general case where more than one parameter word is given is equivalent to multiple simple commands (one for each parameter word). If consecutive writing mode is enabled in the command header, the current command index will be incremented after each parameter write. Otherwise, the parameters will be consecutively written to the same register.
 +
 
 +
For example, the sequence "0xAAAAAAAA 0x802F011C 0xBBBBBBBB 0xCCCCCCCC" is equivalent to a call to commands 0xF011C with parameter 0xAAAAAAAA, 0xF011D with parameter 0xBBBBBBBB and 0xF011E with parameter 0xCCCCCCCC. If consecutive writing mode were disabled, the command would be equivalent to three consecutive calls to 0xF011C (once with parameter 0xAAAAAAAA, once with 0xBBBBBBBB, and finally with 0xCCCCCCCC).
 +
 
 +
Invalid GPU command parameters including NaN floats can cause the GPU to hang, which then causes the GSP module to hang as well.
    
=== Command Header ===
 
=== Command Header ===
Line 15: Line 22:  
|-
 
|-
 
| 30-20
 
| 30-20
| Total words following the command, if any.
+
| Number of extra parameters (may be zero)
 
|-
 
|-
 
| 31
 
| 31
| Command grouping bit
+
| Consecutive writing mode
 
|}
 
|}
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.
      
=== Parameter masking ===
 
=== Parameter masking ===
   −
Bits 16-19 in the command header are not part of the command ID but in fact a parameter mask : bit 16 indicates that the LSB of the parameter will be written, bit17 that the parameter's second LSB will be written etc. This means that for instance commands 0x00020107 and 0x00010107 refer to the same thing but write different parts of the parameter.
+
Using a value other than 0xF, parts of a word in internal GPU memory can be updated without touching the other bits of it. For example, setting bit 16 to zero indicates that the least significant byte of the parameter will not be overwritten, setting bit 17 to zero indicates that the parameter's second LSB will not be overwritten, etc. This means that for instance commands 0x00020107 and 0x00010107 refer to the same thing but write different parts of the parameter.
 
  −
=== Command grouping ===
  −
 
  −
In certain circumstances it is possible to group multiple command calls into a single one, given that those commands' IDs are contiguous. For example, a call with command header 0x802F011C (3 parameters total) is equivalent to a call to commands 0xF011C with parameter 0, 0xF011D with parameter 1 and 0xF011E with parameter 2.
  −
It is unknown how this feature behaves when used with commands that have a variable number of parameters.
      
=== Commands ===
 
=== Commands ===
549

edits