Changes

Jump to navigation Jump to search
10,396 bytes added ,  05:11, 18 January 2019
→‎Command Header: Size field is 8-bit, not 11-bit (tested on hardware)
Line 1: Line 1: −
[[Category:GFX]]
+
[[Category:GPU]]
(this page is hugely WIP)
      
== Overview ==
 
== Overview ==
    
GPU internal registers are written to through GPU commands. They are used to control the GPU's behavior, that is to say tell it to draw stuff and how we want it drawn.
 
GPU internal registers are written to through GPU commands. They are used to control the GPU's behavior, that is to say tell it to draw stuff and how we want it drawn.
 +
 +
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.
 +
 +
The size of GPU command buffers must be 0x10-byte aligned; the lower 3 bits of the size are cleared. A common pitfall is having the finalization command (write to register 0x0010) not executed because it was the last 8 bytes of a non-0x10 byte aligned command buffer, and having the GPU hang as a result.
 +
 +
=== Command Header ===
 +
{| class="wikitable" border="1"
 +
!  Bit
 +
!  Description
 +
|-
 +
| 0-15
 +
| Command ID
 +
|-
 +
| 16-19
 +
| Parameter mask
 +
|-
 +
| 20-27
 +
| Number of extra parameters (may be zero)
 +
|-
 +
| 28-30
 +
| Unused
 +
|-
 +
| 31
 +
| Consecutive writing mode
 +
|}
 +
 +
=== Parameter masking ===
 +
 +
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 0x00010107 and 0x00020107 refer to the same thing but write different parts of the parameter.
    
=== Types ===
 
=== Types ===
    
There are three main types of registers :
 
There are three main types of registers :
* configuration registers, which directly map to various rendering properties (for example : [[#GPUREG_FACECULLING_CONFIG|GPUREG_FACECULLING_CONFIG]])
+
* configuration registers, which directly map to various rendering properties (for example: [[#GPUREG_FACECULLING_CONFIG|GPUREG_FACECULLING_CONFIG]])
* data transfer registers, which can be seen as FIFOs that let us send sequential chunks of data to the GPU, such as shader code or 1D samplers (for example : [[#GPUREG_GSH_CODETRANSFER_DATA|GPUREG_GSH_CODETRANSFER_DATA]])
+
* data transfer registers, which can be seen as FIFOs that let us send sequential chunks of data to the GPU, such as shader code or 1D samplers (for example: [[#GPUREG_SH_CODETRANSFER_DATA|GPUREG_GSH_CODETRANSFER_DATA]])
* action triggering registers, which tell the GPU to do something, like draw a primitive (for example : [[#GPUREG_DRAWARRAYS|GPUREG_DRAWARRAYS]])
+
* action triggering registers, which tell the GPU to do something, like draw a primitive (for example: [[#GPUREG_DRAWARRAYS|GPUREG_DRAWARRAYS]])
    
=== Aliases ===
 
=== Aliases ===
   −
It is possible for multiple register (sequential) IDs to correspond to the same register. This is done to leverage the consecutive writing mode for [[GPU Commands]], which makes it possible for a single command to write data to multiple sequential register IDs. For example, register IDs 02C1 through 02C8 all correspond to [[#GPUREG_VSH_FLOATUNIFORM_DATA|GPUREG_VSH_FLOATUNIFORM_DATA]] so that a consecutively writing command based at 02C0 will write its first parameter to [[#GPUREG_VSH_FLOATUNIFORM_CONFIG|GPUREG_VSH_FLOATUNIFORM_CONFIG]] and ever subsequent ones to [[#GPUREG_VSH_FLOATUNIFORM_DATA|GPUREG_VSH_FLOATUNIFORM_DATA]]
+
It is possible for multiple register (sequential) IDs to correspond to the same register. This is done to leverage the consecutive writing mode for GPU commands, which makes it possible for a single command to write data to multiple sequential register IDs. For example, register IDs 02C1 through 02C8 all correspond to [[#GPUREG_VSH_FLOATUNIFORM_DATAi|GPUREG_VSH_FLOATUNIFORM_DATA''i'']] so that a consecutively writing command based at 02C0 will write its first parameter to [[#GPUREG_VSH_FLOATUNIFORM_INDEX|GPUREG_VSH_FLOATUNIFORM_INDEX]] and ever subsequent ones to [[#GPUREG_VSH_FLOATUNIFORM_DATAi|GPUREG_VSH_FLOATUNIFORM_DATA''i'']]
    
=== Data Types ===
 
=== Data Types ===
Line 2,907: Line 2,941:  
|-
 
|-
 
| 0233
 
| 0233
| [[#GPUREG_FIXEDATTRIB_DATA0|GPUREG_FIXEDATTRIB_DATA0]]
+
| [[#GPUREG_FIXEDATTRIB_DATAi|GPUREG_FIXEDATTRIB_DATA0]]
 
|?
 
|?
 
|PICA_REG_VS_FIXED_ATTR_DATA0
 
|PICA_REG_VS_FIXED_ATTR_DATA0
 
|-
 
|-
 
| 0234
 
| 0234
| [[#GPUREG_FIXEDATTRIB_DATA1|GPUREG_FIXEDATTRIB_DATA1]]
+
| [[#GPUREG_FIXEDATTRIB_DATAi|GPUREG_FIXEDATTRIB_DATA1]]
 
|?
 
|?
 
|PICA_REG_VS_FIXED_ATTR_DATA1
 
|PICA_REG_VS_FIXED_ATTR_DATA1
 
|-
 
|-
 
| 0235
 
| 0235
| [[#GPUREG_FIXEDATTRIB_DATA2|GPUREG_FIXEDATTRIB_DATA2]]
+
| [[#GPUREG_FIXEDATTRIB_DATAi|GPUREG_FIXEDATTRIB_DATA2]]
 
|?
 
|?
 
|PICA_REG_VS_FIXED_ATTR_DATA2
 
|PICA_REG_VS_FIXED_ATTR_DATA2
Line 4,333: Line 4,367:  
|-
 
|-
 
| 0-9
 
| 0-9
| unsigned, X
+
| signed, X
 
|-
 
|-
 
| 16-25
 
| 16-25
| unsigned, Y
+
| signed, Y
 
|}
 
|}
   Line 4,448: Line 4,482:  
| unsigned, Clear texture cache (0 = don't clear, 1 = clear)
 
| unsigned, Clear texture cache (0 = don't clear, 1 = clear)
 
|-
 
|-
| 17
+
| 17-31
 
| 0x0
 
| 0x0
 
|}
 
|}
 +
 +
This register is used to enable texture units.
    
Texture 3 coordinates values:
 
Texture 3 coordinates values:
Line 4,499: Line 4,535:  
| unsigned, Alpha
 
| unsigned, Alpha
 
|}
 
|}
 +
 +
This register is used to set a texture unit's border color.
    
=== GPUREG_TEXUNIT''i''_DIM ===
 
=== GPUREG_TEXUNIT''i''_DIM ===
Line 4,512: Line 4,550:  
| unsigned, Width
 
| unsigned, Width
 
|}
 
|}
 +
 +
This register is used to set a texture unit's dimensions.
    
=== GPUREG_TEXUNIT''i''_PARAM ===
 
=== GPUREG_TEXUNIT''i''_PARAM ===
Line 4,526: Line 4,566:  
|-
 
|-
 
| 4-5
 
| 4-5
| unsigned, ETC1 (0 = not ETC1, 2 = ETC1)
+
| unsigned, ETC1 (0 = not ETC1, 2 = ETC1) note: still 0 for ETC1A4
 
|-
 
|-
 
| 8-10
 
| 8-10
Line 4,534: Line 4,574:  
| unsigned, Wrap S
 
| unsigned, Wrap S
 
|-
 
|-
| 16
+
| 16-17
 
| 0x0
 
| 0x0
 
|-
 
|-
Line 4,546: Line 4,586:  
| unsigned, Type (Texture 0 only)
 
| unsigned, Type (Texture 0 only)
 
|}
 
|}
 +
 +
This register is used to set a texture unit's extra parameters.
    
Filter values:
 
Filter values:
Line 4,619: Line 4,661:  
| unsigned, Min Level
 
| unsigned, Min Level
 
|}
 
|}
 +
 +
This register is used to configure a texture unit's level of detail.
    
=== GPUREG_TEXUNIT''i''_ADDR''i'' ===
 
=== GPUREG_TEXUNIT''i''_ADDR''i'' ===
Line 4,639: Line 4,683:  
| unsigned, Texture physical address >> 3 (upper 6 bits reused from first ADDR register)
 
| unsigned, Texture physical address >> 3 (upper 6 bits reused from first ADDR register)
 
|}
 
|}
 +
 +
This register is used to set a texture unit's physical address(es) in memory. Individual texels in a texture are laid out in memory as a [http://en.wikipedia.org/wiki/Z-order_curve Z-order curve]. Mipmap data is stored directly following the main texture data.
    
If the texture is a cube:
 
If the texture is a cube:
Line 4,674: Line 4,720:  
|-
 
|-
 
| 0
 
| 0
| unsigned, Perspective (0 = not perspective, 1 = perspective)
+
| unsigned, Perspective (0 = perspective, 1 = not perspective)
 
|-
 
|-
 
| 1-23
 
| 1-23
 
| fixed0.0.24, Z bias (upper 23 bits)
 
| fixed0.0.24, Z bias (upper 23 bits)
 
|}
 
|}
 +
 +
This register is used to set a texture unit's shadow texture properties.
    
=== GPUREG_TEXUNIT''i''_TYPE ===
 
=== GPUREG_TEXUNIT''i''_TYPE ===
Line 4,687: Line 4,735:  
|-
 
|-
 
| 0-3
 
| 0-3
| unsigned, [[GPU_Textures#Texture_color_types|Format]]
+
| unsigned, Format
 
|}
 
|}
   −
=== GPUREG_LIGHTING_ENABLE0 ===
+
This register is used to set a texture unit's data format.
   −
{| class="wikitable" border="1"
+
Format values:
! Bits
  −
! Description
  −
|-
  −
| 0
  −
| unsigned, Enabled (0 = disabled, 1 = enabled)
  −
|}
  −
 
  −
=== GPUREG_TEXUNIT3_PROCTEX0 ===
      
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
! Bits
+
! Value
! Description
+
! Description
 +
!  GL Format
 +
!  GL Data Type
 
|-
 
|-
| 0-2
+
| 0x0
| unsigned, U-direction clamp
+
| RGBA8888
 +
| GL_RGBA
 +
| GL_UNSIGNED_BYTE
 
|-
 
|-
| 3-5
+
| 0x1
| unsigned, V-direction clamp
+
| RGB888
 +
| GL_RGB
 +
| GL_UNSIGNED_BYTE
 
|-
 
|-
| 6-9
+
| 0x2
| unsigned, RGB mapping function
+
| RGBA5551
 +
| GL_RGBA
 +
| GL_UNSIGNED_SHORT_5_5_5_1
 
|-
 
|-
| 10-13
+
| 0x3
| unsigned, Alpha mapping function
+
| RGB565
 +
| GL_RGB
 +
| GL_UNSIGNED_SHORT_5_6_5
 +
|-
 +
| 0x4
 +
| RGBA4444
 +
| GL_RGBA
 +
| GL_UNSIGNED_SHORT_4_4_4_4
 +
|-
 +
| 0x5
 +
| IA8
 +
| GL_LUMINANCE_ALPHA
 +
| GL_UNSIGNED_BYTE
 +
|-
 +
| 0x6
 +
| HILO8
 +
|
 +
|
 +
|-
 +
| 0x7
 +
| I8
 +
| GL_LUMINANCE
 +
| GL_UNSIGNED_BYTE
 +
|-
 +
| 0x8
 +
| A8
 +
| GL_ALPHA
 +
| GL_UNSIGNED_BYTE
 +
|-
 +
| 0x9
 +
| IA44
 +
| GL_LUMINANCE_ALPHA
 +
| GL_UNSIGNED_BYTE_4_4_EXT
 +
|-
 +
| 0xA
 +
| I4
 +
|
 +
|
 +
|-
 +
| 0xB
 +
| A4
 +
| GL_ALPHA
 +
| GL_UNSIGNED_NIBBLE_EXT
 +
|-
 +
| 0xC
 +
| ETC1
 +
| GL_ETC1_RGB8_OES
 +
|
 +
|-
 +
| 0xD
 +
| ETC1A4
 +
|
 +
|
 +
|}
 +
 
 +
=== GPUREG_LIGHTING_ENABLE0 ===
 +
 
 +
{| class="wikitable" border="1"
 +
! Bits
 +
! Description
 +
|-
 +
| 0
 +
| unsigned, Enabled (0 = disabled, 1 = enabled)
 +
|}
 +
 
 +
This register is used to enable lighting.
 +
 
 +
=== GPUREG_TEXUNIT3_PROCTEX0 ===
 +
 
 +
{| class="wikitable" border="1"
 +
! Bits
 +
! Description
 +
|-
 +
| 0-2
 +
| unsigned, U-direction clamp
 +
|-
 +
| 3-5
 +
| unsigned, V-direction clamp
 +
|-
 +
| 6-9
 +
| unsigned, RGB mapping function
 +
|-
 +
| 10-13
 +
| unsigned, Alpha mapping function
 
|-
 
|-
 
| 14
 
| 14
Line 4,733: Line 4,864:  
| float1.5.10, Texture bias (lower 8 bits)
 
| float1.5.10, Texture bias (lower 8 bits)
 
|}
 
|}
 +
 +
This register is used to configure the procedural texture unit.
    
Clamp values:
 
Clamp values:
Line 4,766: Line 4,899:  
|-
 
|-
 
| 1
 
| 1
| U2
+
|
 
|-
 
|-
 
| 2
 
| 2
Line 4,772: Line 4,905:  
|-
 
|-
 
| 3
 
| 3
| V2
+
|
 
|-
 
|-
 
| 4
 
| 4
| U + V
+
| (U + V) / 2
 
|-
 
|-
 
| 5
 
| 5
| U2 + V2
+
| (U² + V²) / 2
 
|-
 
|-
 
| 6
 
| 6
| sqrt(U2 + V2)
+
| sqrt(+ )
 
|-
 
|-
 
| 7
 
| 7
Line 4,821: Line 4,954:  
| float1.5.10, U-direction noise phase
 
| float1.5.10, U-direction noise phase
 
|}
 
|}
 +
 +
This register is used to configure the procedural texture unit's U-direction noise amplitude/phase.
    
=== GPUREG_TEXUNIT3_PROCTEX2 ===
 
=== GPUREG_TEXUNIT3_PROCTEX2 ===
Line 4,834: Line 4,969:  
| float1.5.10, V-direction noise phase
 
| float1.5.10, V-direction noise phase
 
|}
 
|}
 +
 +
This register is used to configure the procedural texture unit's V-direction noise amplitude/phase.
    
=== GPUREG_TEXUNIT3_PROCTEX3 ===
 
=== GPUREG_TEXUNIT3_PROCTEX3 ===
Line 4,847: Line 4,984:  
| float1.5.10, V-direction noise frequency
 
| float1.5.10, V-direction noise frequency
 
|}
 
|}
 +
 +
This register is used to configure the procedural texture unit's U-direction and V-direction noise frequency.
    
=== GPUREG_TEXUNIT3_PROCTEX4 ===
 
=== GPUREG_TEXUNIT3_PROCTEX4 ===
Line 4,857: Line 4,996:  
| unsigned, Minification filter
 
| unsigned, Minification filter
 
|-
 
|-
| 3-10
+
| 3-6
| 0x60
+
| Min LOD (usually 0)
 +
|-
 +
| 7-10
 +
| Max LOD (usually 6)
 
|-
 
|-
 
| 11-18
 
| 11-18
Line 4,866: Line 5,008:  
| float1.5.10, Texture bias (upper 8 bits)
 
| float1.5.10, Texture bias (upper 8 bits)
 
|}
 
|}
 +
 +
This register is used to configure the procedural texture unit.
    
Minification filter values:
 
Minification filter values:
Line 4,899: Line 5,043:  
|-
 
|-
 
| 0-7
 
| 0-7
| unsigned, Texture offset
+
| unsigned, Texture offset (Mipmap level 0 / base level)
 
|-
 
|-
| 8-31
+
| 8-15
| 0xE0C080
+
| unsigned, mipmap level 1 offset (usually 0x80)
 +
|-
 +
| 16-23
 +
| unsigned, mipmap level 2 offset (usually 0xC0)
 +
|-
 +
| 24-31
 +
| unsigned, mipmap level 3 offset (usually 0xE0)
 
|}
 
|}
 +
 +
This register is used to set the procedural texture unit's offset. Mipmap level 4-7 seems to be hardcoded at offset 0xF0, 0xF8, 0xFC and 0xFE .
    
=== GPUREG_PROCTEX_LUT ===
 
=== GPUREG_PROCTEX_LUT ===
Line 4,917: Line 5,069:  
| unsigned, Reference table
 
| unsigned, Reference table
 
|}
 
|}
 +
 +
This register is used to set which look-up table to write to, with GPUREG_PROCTEX_LUT_DATA''i'', at what index.
    
Reference table values:
 
Reference table values:
Line 4,963: Line 5,117:  
|-
 
|-
 
| 12-23
 
| 12-23
| fixed1.0.11, Difference from next element
+
| fixed0.0.12 with two's complement ( [0.5,1.0) mapped to [-1.0,0) ), Difference from next element
 
|}
 
|}
   Line 4,977: Line 5,131:  
|-
 
|-
 
| 12-23
 
| 12-23
| fixed1.0.11, Difference from next element
+
| fixed0.0.12 with two's complement, Difference from next element
 
|}
 
|}
   Line 4,991: Line 5,145:  
|-
 
|-
 
| 12-23
 
| 12-23
| fixed1.0.11, Difference from next element
+
| fixed0.0.12 with two's complement, Difference from next element
 
|}
 
|}
   Line 5,022: Line 5,176:  
|-
 
|-
 
| 0-7
 
| 0-7
| fixed1.0.7, Red difference between current and next color table elements
+
| signed, Half of red difference between current and next color table elements
 
|-
 
|-
 
| 8-15
 
| 8-15
| fixed1.0.7, Green difference between current and next color table elements
+
| signed, Half of green difference between current and next color table elements
 
|-
 
|-
 
| 16-23
 
| 16-23
| fixed1.0.7, Blue difference between current and next color table elements
+
| signed, Half of blue difference between current and next color table elements
 
|-
 
|-
 
| 24-31
 
| 24-31
| fixed1.0.7, Alpha difference between current and next color table elements
+
| signed, Half of alpha difference between current and next color table elements
 
|}
 
|}
   Line 5,058: Line 5,212:  
| unsigned, Alpha source 2
 
| unsigned, Alpha source 2
 
|}
 
|}
 +
 +
This register configures a texture combiner's sources.
    
Source values:
 
Source values:
Line 5,120: Line 5,276:  
| unsigned, Alpha operand 2
 
| unsigned, Alpha operand 2
 
|}
 
|}
 +
 +
This register configures a texture combiner's operands.
    
RGB operand values:
 
RGB operand values:
Line 5,201: Line 5,359:  
| unsigned, Alpha combine
 
| unsigned, Alpha combine
 
|}
 
|}
 +
 +
This register configures a texture combiner's combine mode.
    
Combine values:
 
Combine values:
Line 5,257: Line 5,417:  
| unsigned, Alpha
 
| unsigned, Alpha
 
|}
 
|}
 +
 +
This register configures a texture combiner's constant color.
    
=== GPUREG_TEXENV''i''_SCALE ===
 
=== GPUREG_TEXENV''i''_SCALE ===
Line 5,270: Line 5,432:  
| unsigned, Alpha scale
 
| unsigned, Alpha scale
 
|}
 
|}
 +
 +
This register configures a texture combiner's scale value.
    
Scale values:
 
Scale values:
Line 5,330: Line 5,494:  
|}
 
|}
   −
This register is shared between the gas/fog mode configuration and TexEnv buffer inputs. TexEnv buffer inputs are typically written with a mask of 0x2, and the gas/fog mode configuration is typically written with a mask of 0x5.
+
This register is shared between the gas/fog mode configuration and texture combiner buffer inputs. Texture combiner buffer inputs are typically written with a mask of 0x2, and the gas/fog mode configuration is typically written with a mask of 0x5.
    
Fog mode values:
 
Fog mode values:
Line 5,389: Line 5,553:  
| unsigned, Blue
 
| unsigned, Blue
 
|}
 
|}
 +
 +
This register is used to configure the color of fog.
    
=== GPUREG_GAS_ATTENUATION ===
 
=== GPUREG_GAS_ATTENUATION ===
Line 5,399: Line 5,565:  
| float1.5.10, Gas density attenuation
 
| float1.5.10, Gas density attenuation
 
|}
 
|}
 +
 +
This register is used to configure the gas density attenuation.
    
=== GPUREG_GAS_ACCMAX ===
 
=== GPUREG_GAS_ACCMAX ===
Line 5,409: Line 5,577:  
| float1.5.10, Gas maximum density accumulation
 
| float1.5.10, Gas maximum density accumulation
 
|}
 
|}
 +
 +
This register is used to configure the gas maximum density accumulation.
    
=== GPUREG_FOG_LUT_INDEX ===
 
=== GPUREG_FOG_LUT_INDEX ===
Line 5,419: Line 5,589:  
| unsigned, Index
 
| unsigned, Index
 
|}
 
|}
 +
 +
This register is used to set what index to write to with GPUREG_FOG_LUT_DATA''i''.
    
=== GPUREG_FOG_LUT_DATA''i'' ===
 
=== GPUREG_FOG_LUT_DATA''i'' ===
Line 5,464: Line 5,636:  
| unsigned, Alpha
 
| unsigned, Alpha
 
|}
 
|}
 +
 +
This register is used to configure the texture combiner buffer color.
    
== Framebuffer registers ==
 
== Framebuffer registers ==
Line 5,482: Line 5,656:  
| 0x0E4
 
| 0x0E4
 
|}
 
|}
 +
 +
This register is used to configure the fragment operation mode and whether to use logic ops or blending.
    
Fragment operation mode values:
 
Fragment operation mode values:
Line 5,537: Line 5,713:  
|}
 
|}
   −
Equation values:
+
This register is used to configure the blending function.
 +
 
 +
'''Equation values:'''
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 5,559: Line 5,737:  
|}
 
|}
   −
Function values:
+
Blend equations 5, 6, 7 appear to behave the same as blend equation 0 (Add)
 +
 
 +
'''Function values:'''
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 5,620: Line 5,800:  
| unsigned, Logic op
 
| unsigned, Logic op
 
|}
 
|}
 +
 +
This register is used to configure the logic op.
    
Logic op values:
 
Logic op values:
Line 5,694: Line 5,876:  
| unsigned, Alpha
 
| unsigned, Alpha
 
|}
 
|}
 +
 +
This register is used to configure the blending color.
    
=== GPUREG_FRAGOP_ALPHA_TEST ===
 
=== GPUREG_FRAGOP_ALPHA_TEST ===
Line 5,710: Line 5,894:  
| unsigned, Reference value
 
| unsigned, Reference value
 
|}
 
|}
 +
 +
This register is used to configure alpha testing.
    
Function values:
 
Function values:
Line 5,763: Line 5,949:  
| unsigned, Mask
 
| unsigned, Mask
 
|}
 
|}
 +
 +
This register is used to configure stencil testing.
    
Function values:
 
Function values:
Line 5,810: Line 5,998:  
| unsigned, Z-pass operation
 
| unsigned, Z-pass operation
 
|}
 
|}
 +
 +
This register is used to configure stencil result operations.
    
Operation values:
 
Operation values:
Line 5,869: Line 6,059:  
| unsigned, Depth write enabled (0 = disabled, 1 = enabled)
 
| unsigned, Depth write enabled (0 = disabled, 1 = enabled)
 
|}
 
|}
 +
 +
This register is used to depth testing and framebuffer write masking.
 +
 +
Note that setting the "Depth test enabled" bit to 0 will ''not'' also disable depth writes. It will instead behave as if the depth function were set to "Always". To completely disable depth-related operations both the depth test and depth write bits must be disabled.
    
Depth function values:
 
Depth function values:
Line 5,940: Line 6,134:  
| unsigned, Allow read (0 = disable, 0xF = enable)
 
| unsigned, Allow read (0 = disable, 0xF = enable)
 
|}
 
|}
 +
 +
This register configures read access from the color buffer.
    
=== GPUREG_COLORBUFFER_WRITE ===
 
=== GPUREG_COLORBUFFER_WRITE ===
Line 5,950: Line 6,146:  
| unsigned, Allow write (0 = disable, 0xF = enable)
 
| unsigned, Allow write (0 = disable, 0xF = enable)
 
|}
 
|}
 +
 +
This register configures write access to the color buffer.
    
=== GPUREG_DEPTHBUFFER_READ ===
 
=== GPUREG_DEPTHBUFFER_READ ===
Line 5,963: Line 6,161:  
| unsigned, Allow depth read (0 = disable, 1 = enable)
 
| unsigned, Allow depth read (0 = disable, 1 = enable)
 
|}
 
|}
 +
 +
This register configures read access from the depth and stencil buffers.
    
=== GPUREG_DEPTHBUFFER_WRITE ===
 
=== GPUREG_DEPTHBUFFER_WRITE ===
Line 5,976: Line 6,176:  
| unsigned, Allow depth write (0 = disable, 1 = enable)
 
| unsigned, Allow depth write (0 = disable, 1 = enable)
 
|}
 
|}
 +
 +
This register configures write access to the depth and stencil buffers.
    
=== GPUREG_DEPTHBUFFER_FORMAT ===
 
=== GPUREG_DEPTHBUFFER_FORMAT ===
Line 5,986: Line 6,188:  
| unsigned, Format
 
| unsigned, Format
 
|}
 
|}
 +
 +
This register configures the depth buffer data format.
    
Format values:
 
Format values:
Line 6,015: Line 6,219:  
| unsigned, Format
 
| unsigned, Format
 
|}
 
|}
 +
 +
This register configures the color buffer data format. Color components are laid out in reverse byte order in memory, with the most significant bits used first.
    
Pixel size values:
 
Pixel size values:
Line 6,047: Line 6,253:  
| RGBA4
 
| RGBA4
 
|}
 
|}
Color components are laid out in reverse byte order in memory, with the most significant bits used first.
      
=== GPUREG_EARLYDEPTH_TEST2 ===
 
=== GPUREG_EARLYDEPTH_TEST2 ===
Line 6,058: Line 6,263:  
| unsigned, Enabled (0 = disabled, 1 = enabled)
 
| unsigned, Enabled (0 = disabled, 1 = enabled)
 
|}
 
|}
 +
 +
This register enables the early depth test.
    
=== GPUREG_FRAMEBUFFER_BLOCK32 ===
 
=== GPUREG_FRAMEBUFFER_BLOCK32 ===
Line 6,069: Line 6,276:  
|}
 
|}
   −
To untile the color buffer when using the 32x32 block format, use bit 16 of the [[GPU/External_Registers#Transfer_Engine|display transfer flags]]. It is unknown if there are any advantages to using the 32x32 format.
+
This register configures the framebuffer block mode. To untile the color buffer when using the 32x32 block format, use bit 16 of the [[GPU/External_Registers#Transfer_Engine|display transfer flags]]. It is unknown if there are any advantages to using the 32x32 format.
    
Render block mode values:
 
Render block mode values:
Line 6,093: Line 6,300:  
| unsigned, Depth buffer physical address >> 3
 
| unsigned, Depth buffer physical address >> 3
 
|}
 
|}
 +
 +
This register configures the depth buffer physical address.
    
=== GPUREG_COLORBUFFER_LOC ===
 
=== GPUREG_COLORBUFFER_LOC ===
Line 6,103: Line 6,312:  
| unsigned, Color buffer physical address >> 3
 
| unsigned, Color buffer physical address >> 3
 
|}
 
|}
 +
 +
This register configures the color buffer physical address.
    
=== GPUREG_FRAMEBUFFER_DIM ===
 
=== GPUREG_FRAMEBUFFER_DIM ===
Line 6,119: Line 6,330:  
| 0x1
 
| 0x1
 
|}
 
|}
 +
 +
This register configures the framebuffer dimensions.
    
=== GPUREG_GAS_LIGHT_XY ===
 
=== GPUREG_GAS_LIGHT_XY ===
Line 6,135: Line 6,348:  
| unsigned, Planar shading density attenuation
 
| unsigned, Planar shading density attenuation
 
|}
 
|}
 +
 +
This register configures gas light planar shading.
    
=== GPUREG_GAS_LIGHT_Z ===
 
=== GPUREG_GAS_LIGHT_Z ===
Line 6,151: Line 6,366:  
| unsigned, View shading density attenuation
 
| unsigned, View shading density attenuation
 
|}
 
|}
 +
 +
This register configures gas light view shading.
    
=== GPUREG_GAS_LIGHT_Z_COLOR ===
 
=== GPUREG_GAS_LIGHT_Z_COLOR ===
Line 6,160: Line 6,377:  
| 0-7
 
| 0-7
 
| unsigned, View shading effect in line-of-sight direction
 
| unsigned, View shading effect in line-of-sight direction
 +
|-
 +
| 8
 +
| Gas color LUT input
 +
|}
 +
 +
This register configures gas light shading in the line-of-sight direction, and the input to the gas color LUT.
 +
 +
Color LUT input values:
 +
 +
{| class="wikitable" border="1"
 +
! Value
 +
! Description
 +
|-
 +
| 0
 +
| Gas density
 +
|-
 +
| 1
 +
| Light factor
 
|}
 
|}
   Line 6,171: Line 6,406:  
| unsigned, Index
 
| unsigned, Index
 
|}
 
|}
 +
 +
This register is used to set what index to write to with GPUREG_GAS_LUT_DATA''i''.
    
=== GPUREG_GAS_LUT_DATA ===
 
=== GPUREG_GAS_LUT_DATA ===
Line 6,182: Line 6,419:  
|}
 
|}
   −
These registers behave as a FIFO queue. Each write to these registers writes the provided value to the gas look-up table, starting at the index selected with GPUREG_GAAS_LUT_INDEX.
+
These registers behave as a FIFO queue. Each write to these registers writes the provided value to the gas look-up table, starting at the index selected with GPUREG_GAS_LUT_INDEX.
    
==== Gas Look-Up Table ====
 
==== Gas Look-Up Table ====
Line 6,226: Line 6,463:  
| 0-23
 
| 0-23
 
| fixed0.16.8, Depth direction attenuation proportion
 
| fixed0.16.8, Depth direction attenuation proportion
 +
|-
 +
| 24-25
 +
| unsigned, Depth function
 +
|}
 +
 +
This register is used to configure the gas depth direction attenuation proportion, as well as the gas depth function.
 +
 +
Gas depth function values:
 +
 +
{| class="wikitable" border="1"
 +
! Value
 +
! Description
 +
|-
 +
| 0
 +
| Never
 +
|-
 +
| 1
 +
| Always
 +
|-
 +
| 2
 +
| Greater than/Greater than or equal
 +
|-
 +
| 3
 +
| Less than/Less than or equal/Equal/Not equal
 
|}
 
|}
   Line 6,240: Line 6,501:  
| float1.5.10, Penumbra scale with reversed sign
 
| float1.5.10, Penumbra scale with reversed sign
 
|}
 
|}
 +
 +
This register is used to configure shadow properties.
    
== Fragment lighting registers ==
 
== Fragment lighting registers ==
Line 6,329: Line 6,592:  
|}
 
|}
   −
These registers (along with _Z) represent the light position (for a positional light) or the light direction vector (for a directional light) of the corresponding light.
+
These registers (along with GPUREG_LIGHT''i''_Z) represent the light position (for a positional light) or the light direction vector (for a directional light) of the corresponding light.
    
=== GPUREG_LIGHT''i''_Z ===
 
=== GPUREG_LIGHT''i''_Z ===
Line 6,341: Line 6,604:  
|}
 
|}
   −
These registers (along with _XY) represent the light position (for a positional light) or the light direction vector (for a directional light) of the corresponding light.
+
These registers (along with GPUREG_LIGHT''i''_XY) represent the light position (for a positional light) or the light direction vector (for a directional light) of the corresponding light.
    
=== GPUREG_LIGHT''i''_SPOTDIR_XY ===
 
=== GPUREG_LIGHT''i''_SPOTDIR_XY ===
Line 6,350: Line 6,613:  
|-
 
|-
 
| 0-12
 
| 0-12
| fixed1.1.11, X coordinate (Usually the input value is negated)
+
| fixed1.1.11, X coordinate (negated)
 
|-
 
|-
 
| 16-28
 
| 16-28
| fixed1.1.11, Y coordinate (Usually the input value is negated)
+
| fixed1.1.11, Y coordinate (negated)
 
|}
 
|}
   −
These registers (along with _Z) represent the spot direction (unitary) vector of the corresponding light.
+
These registers (along with GPUREG_LIGHT''i''_SPOTDIR_Z) represent the spot direction (unitary) vector of the corresponding light.
    
=== GPUREG_LIGHT''i''_SPOTDIR_Z ===
 
=== GPUREG_LIGHT''i''_SPOTDIR_Z ===
Line 6,365: Line 6,628:  
|-
 
|-
 
| 0-12
 
| 0-12
| fixed1.1.11, Z coordinate (Usually the input value is negated)
+
| fixed1.1.11, Z coordinate (negated)
 
|}
 
|}
   −
These registers (along with _XY) represent the spot direction (unitary) vector of the corresponding light.
+
These registers (along with GPUREG_LIGHT''i''_SPOTDIR_XY) represent the spot direction (unitary) vector of the corresponding light.
    
=== GPUREG_LIGHT''i''_CONFIG ===
 
=== GPUREG_LIGHT''i''_CONFIG ===
Line 6,388: Line 6,651:  
| unsigned, Use geometric factor 1 (0 = don't use, 1 = use)
 
| unsigned, Use geometric factor 1 (0 = don't use, 1 = use)
 
|}
 
|}
 +
 +
This register configures a light's properties.
    
=== GPUREG_LIGHT''i''_ATTENUATION_BIAS ===
 
=== GPUREG_LIGHT''i''_ATTENUATION_BIAS ===
Line 6,399: Line 6,664:  
|}
 
|}
   −
These registers contain the distance attenuation bias value of the corresponding light. The attenuation factor is lut_DA(clip(bias + scale*distance, 0.0, 1.0)).
+
These registers contain the distance attenuation bias value of the corresponding light. The attenuation factor is DA(clip(bias + scale*distance, 0.0, 1.0)).
    
=== GPUREG_LIGHT''i''_ATTENUATION_SCALE ===
 
=== GPUREG_LIGHT''i''_ATTENUATION_SCALE ===
Line 6,411: Line 6,676:  
|}
 
|}
   −
These registers contain the distance attenuation scale value of the corresponding light. The attenuation factor is lut_DA(clip(bias + scale*distance, 0.0, 1.0)).
+
These registers contain the distance attenuation scale value of the corresponding light. The attenuation factor is DA(clip(bias + scale*distance, 0.0, 1.0)).
    
=== GPUREG_LIGHTING_AMBIENT ===
 
=== GPUREG_LIGHTING_AMBIENT ===
Line 6,440: Line 6,705:  
| unsigned, Number of active lights - 1
 
| unsigned, Number of active lights - 1
 
|}
 
|}
 +
 +
This register configures the number of active lights.
    
=== GPUREG_LIGHTING_CONFIG0 ===
 
=== GPUREG_LIGHTING_CONFIG0 ===
Line 6,489: Line 6,756:  
| 0x1
 
| 0x1
 
|}
 
|}
 +
 +
This register configures the light environment.
    
Fresnel selector values:
 
Fresnel selector values:
Line 6,666: Line 6,935:  
| unsigned, Fragment light source 7 distance attenuation disabled (0 = enabled, 1 = disabled)
 
| unsigned, Fragment light source 7 distance attenuation disabled (0 = enabled, 1 = disabled)
 
|}
 
|}
 +
 +
This register is used to disable various aspects of the light environment.
    
=== GPUREG_LIGHTING_LUT_INDEX ===
 
=== GPUREG_LIGHTING_LUT_INDEX ===
Line 6,680: Line 6,951:  
|}
 
|}
   −
This register controls which LUT and what offset into it the LUT_DATA register writes to.
+
This register controls which LUT and what offset into it the GPUREG_LIGHTING_LUT_DATA''i'' register writes to.
    
Lookup table values:
 
Lookup table values:
Line 6,811: Line 7,082:  
| unsigned, Input selector for RR
 
| unsigned, Input selector for RR
 
|}
 
|}
 +
 +
This register selects the input from LUTs.
    
Input selector values:
 
Input selector values:
Line 6,922: Line 7,195:  
| unsigned, ID of the 8th enabled light
 
| unsigned, ID of the 8th enabled light
 
|}
 
|}
 +
 +
This register sets the IDs of enabled light sources.
    
== Geometry pipeline registers ==
 
== Geometry pipeline registers ==
Line 6,934: Line 7,209:  
| unsigned, Vertex arrays base address
 
| unsigned, Vertex arrays base address
 
|}
 
|}
 +
 +
This register sets the base address of all vertex arrays.
    
=== GPUREG_ATTRIBBUFFERS_FORMAT_LOW ===
 
=== GPUREG_ATTRIBBUFFERS_FORMAT_LOW ===
Line 6,989: Line 7,266:  
| unsigned, Vertex attribute 7 size
 
| unsigned, Vertex attribute 7 size
 
|}
 
|}
 +
 +
This register configures the types and sizes of the first 8 vertex attributes.
    
Vertex attribute type values:
 
Vertex attribute type values:
Line 7,064: Line 7,343:  
| unsigned, Total vertex attribute count - 1
 
| unsigned, Total vertex attribute count - 1
 
|}
 
|}
 +
 +
This register configures the types and sizes of the last 4 vertex attributes, along with the attribute mask and the total attribute count.
    
See GPUREG_ATTRIBBUFFERS_FORMAT_LOW for vertex attribute type and size values.
 
See GPUREG_ATTRIBBUFFERS_FORMAT_LOW for vertex attribute type and size values.
Line 7,076: Line 7,357:  
| unsigned, Offset from base vertex arrays address
 
| unsigned, Offset from base vertex arrays address
 
|}
 
|}
 +
 +
This register configures the offset of a vertex array from the base vertex arrays address.
    
=== GPUREG_ATTRIBBUFFER''i''_CONFIG1 ===
 
=== GPUREG_ATTRIBBUFFER''i''_CONFIG1 ===
Line 7,107: Line 7,390:  
| unsigned, Component 8
 
| unsigned, Component 8
 
|}
 
|}
 +
 +
This register configures the first 8 component types of a vertex array.
    
Component values:
 
Component values:
Line 7,187: Line 7,472:  
| unsigned, Total number of components
 
| unsigned, Total number of components
 
|}
 
|}
 +
 +
This register configures the last 4 component types of a vertex array, along with the bytes per vertex and the total number of components.
    
See GPUREG_ATTRIBBUFFER''i''_CONFIG1 for component values.
 
See GPUREG_ATTRIBBUFFER''i''_CONFIG1 for component values.
Line 7,202: Line 7,489:  
| Index type (0 = unsigned byte, 1 = unsigned short or drawing arrays)
 
| Index type (0 = unsigned byte, 1 = unsigned short or drawing arrays)
 
|}
 
|}
 +
 +
This register configures the index array used when drawing elements.
    
=== GPUREG_NUMVERTICES ===
 
=== GPUREG_NUMVERTICES ===
Line 7,212: Line 7,501:  
| unsigned, Number of vertices to render
 
| unsigned, Number of vertices to render
 
|}
 
|}
 +
 +
This register sets the number of vertices to render.
    
=== GPUREG_GEOSTAGE_CONFIG ===
 
=== GPUREG_GEOSTAGE_CONFIG ===
Line 7,226: Line 7,517:  
|-
 
|-
 
| 9
 
| 9
| 0x0
  −
|-
  −
| 16-23
   
| 0x0
 
| 0x0
 
|-
 
|-
Line 7,236: Line 7,524:     
This register configures the geometry stage of the GPU pipeline.
 
This register configures the geometry stage of the GPU pipeline.
 +
 +
When using vertex buffers and drawing elements in triangles mode, bit 8 is set to 1, else it is set to 0.
    
=== GPUREG_VERTEX_OFFSET ===
 
=== GPUREG_VERTEX_OFFSET ===
Line 7,246: Line 7,536:  
| unsigned, Starting vertex offset
 
| unsigned, Starting vertex offset
 
|}
 
|}
 +
 +
This register sets the offset of the first vertex in an array to render.
    
=== GPUREG_POST_VERTEX_CACHE_NUM ===
 
=== GPUREG_POST_VERTEX_CACHE_NUM ===
Line 7,256: Line 7,548:  
| unsigned, Number of entries in the post-vertex cache (usually 0x4 or 0x84)
 
| unsigned, Number of entries in the post-vertex cache (usually 0x4 or 0x84)
 
|}
 
|}
 +
 +
This register configures the post-vertex cache.
    
=== GPUREG_DRAWARRAYS ===
 
=== GPUREG_DRAWARRAYS ===
Line 7,266: Line 7,560:  
| unsigned, Trigger (0 = idle, non-zero = draw arrays)
 
| unsigned, Trigger (0 = idle, non-zero = draw arrays)
 
|}
 
|}
 +
 +
This register triggers drawing vertex arrays.
    
=== GPUREG_DRAWELEMENTS ===
 
=== GPUREG_DRAWELEMENTS ===
Line 7,276: Line 7,572:  
| unsigned, Trigger (0 = idle, non-zero = draw elements)
 
| unsigned, Trigger (0 = idle, non-zero = draw elements)
 
|}
 
|}
 +
 +
This register triggers drawing vertex array elements.
    
=== GPUREG_VTX_FUNC ===
 
=== GPUREG_VTX_FUNC ===
Line 7,286: Line 7,584:  
| unsigned, Trigger (0 = idle, non-zero = clear post-vertex cache)
 
| unsigned, Trigger (0 = idle, non-zero = clear post-vertex cache)
 
|}
 
|}
 +
 +
This register triggers clearing the post-vertex cache.
    
=== GPUREG_FIXEDATTRIB_INDEX ===
 
=== GPUREG_FIXEDATTRIB_INDEX ===
Line 7,297: Line 7,597:  
|}
 
|}
   −
See [[GPU/Fixed Vertex Attributes]] and [[GPU/Immediate-Mode Vertex Submission]] for usage info.
+
This register selects the index of the fixed attribute to be input with GPUREG_FIXEDATTRIB_DATA''i''. See [[GPU/Fixed Vertex Attributes]] and [[GPU/Immediate-Mode Vertex Submission]] for usage info.
   −
=== GPUREG_FIXEDATTRIB_DATA0 ===
+
=== GPUREG_FIXEDATTRIB_DATA''i'' ===
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 7,305: Line 7,605:  
! Description
 
! Description
 
|-
 
|-
| 0-23
+
| colspan="2" | '''DATA0:'''
| float1.7.16, Vertex attribute element 1
+
|-
 +
| 0-7
 +
| float1.7.16, Vertex attribute element 3 (Z) (bits 16-23)
 +
|-
 +
| 8-31
 +
| float1.7.16, Vertex attribute element 4 (W)
 +
|-
 +
| colspan="2" | '''DATA1:'''
 
|-
 
|-
| 24-31
+
| 0-15
| float1.7.16, Vertex attribute element 2 (lower 8 bits)
+
| float1.7.16, Vertex attribute element 2 (Y) (bits 8-23)
|}
  −
 
  −
Accepts the first part of the four 24-bit floating-point values that make up a vertex attribute. Stored in the fixed attribute currently specified with GPUREG_FIXEDATTRIB_INDEX. If immediate-mode vertex submission is enabled (by writing 0xF to the index register) then vertex data is input here directly.
  −
 
  −
=== GPUREG_FIXEDATTRIB_DATA1 ===
  −
 
  −
{| class="wikitable" border="1"
  −
! Bits
  −
! Description
   
|-
 
|-
| 0-23
+
| 16-31
| float1.7.16, Vertex attribute element 2 (upper 16 bits)
+
| float1.7.16, Vertex attribute element 3 (Z) (bits 0-15)
 
|-
 
|-
| 24-31
+
| colspan="2" | '''DATA2:'''
| float1.7.16, Vertex attribute element 3 (lower 16 bits)
  −
|}
  −
 
  −
 
  −
Accepts the second part of the four 24-bit floating-point values that make up a vertex attribute. Stored in the fixed attribute currently specified with GPUREG_FIXEDATTRIB_INDEX. If immediate-mode vertex submission is enabled (by writing 0xF to the index register) then vertex data is input here directly.
  −
 
  −
=== GPUREG_FIXEDATTRIB_DATA2 ===
  −
 
  −
{| class="wikitable" border="1"
  −
! Bits
  −
! Description
   
|-
 
|-
 
| 0-23
 
| 0-23
| float1.7.16, Vertex attribute element 3 (upper 8 bits)
+
| float1.7.16, Vertex attribute element 1 (X)
 
|-
 
|-
 
| 24-31
 
| 24-31
| float1.7.16, Vertex attribute element 4
+
| float1.7.16, Vertex attribute element 2 (Y) (bits 0-7)
 
|}
 
|}
   −
Accepts the third part of the four 24-bit floating-point values that make up a vertex attribute. Stored in the fixed attribute currently specified with GPUREG_FIXEDATTRIB_INDEX. If immediate-mode vertex submission is enabled (by writing 0xF to the index register) then vertex data is input here directly.
+
Accepts four 24-bit floating-point values that make up a vertex attribute. Stored in the fixed attribute currently specified with GPUREG_FIXEDATTRIB_INDEX. If immediate-mode vertex submission is enabled (by writing 0xF to the index register) then vertex data is input here directly.
    
=== GPUREG_CMDBUF_SIZE0 ===
 
=== GPUREG_CMDBUF_SIZE0 ===
Line 7,354: Line 7,641:  
| unsigned, Size of command buffer 0 >> 3
 
| unsigned, Size of command buffer 0 >> 3
 
|}
 
|}
 +
 +
This register sets the size of the first command buffer.
    
=== GPUREG_CMDBUF_SIZE1 ===
 
=== GPUREG_CMDBUF_SIZE1 ===
Line 7,364: Line 7,653:  
| unsigned, Size of command buffer 1 >> 3
 
| unsigned, Size of command buffer 1 >> 3
 
|}
 
|}
 +
 +
This register sets the size of the second command buffer.
    
=== GPUREG_CMDBUF_ADDR0 ===
 
=== GPUREG_CMDBUF_ADDR0 ===
Line 7,374: Line 7,665:  
| unsigned, Physical address of command buffer 0 >> 3
 
| unsigned, Physical address of command buffer 0 >> 3
 
|}
 
|}
 +
 +
This register sets the physical address of the first command buffer.
    
=== GPUREG_CMDBUF_ADDR1 ===
 
=== GPUREG_CMDBUF_ADDR1 ===
Line 7,384: Line 7,677:  
| unsigned, Physical address of command buffer 1 >> 3
 
| unsigned, Physical address of command buffer 1 >> 3
 
|}
 
|}
 +
 +
This register sets the physical address of the second command buffer.
    
=== GPUREG_CMDBUF_JUMP0 ===
 
=== GPUREG_CMDBUF_JUMP0 ===
Line 7,394: Line 7,689:  
| unsigned, Trigger (0 = idle, non-zero = execute command buffer 0)
 
| unsigned, Trigger (0 = idle, non-zero = execute command buffer 0)
 
|}
 
|}
 +
 +
This register triggers a jump to the first command buffer.
    
=== GPUREG_CMDBUF_JUMP1 ===
 
=== GPUREG_CMDBUF_JUMP1 ===
Line 7,404: Line 7,701:  
| unsigned, Trigger (0 = idle, non-zero = execute command buffer 1)
 
| unsigned, Trigger (0 = idle, non-zero = execute command buffer 1)
 
|}
 
|}
 +
 +
This register triggers a jump to the second command buffer.
    
=== GPUREG_VSH_NUM_ATTR ===
 
=== GPUREG_VSH_NUM_ATTR ===
Line 7,414: Line 7,713:  
| unsigned, Number of vertex shader input attributes - 1
 
| unsigned, Number of vertex shader input attributes - 1
 
|}
 
|}
 +
 +
This register sets the number of vertex shader input attributes.
    
=== GPUREG_VSH_COM_MODE ===
 
=== GPUREG_VSH_COM_MODE ===
Line 7,423: Line 7,724:  
| 0
 
| 0
 
| unsigned, Geometry shader configuration enabled (0 = disabled, 1 = enabled)
 
| unsigned, Geometry shader configuration enabled (0 = disabled, 1 = enabled)
|-
  −
| 8-31
  −
| 0x0
   
|}
 
|}
 +
 +
This register sets whether to use the geometry shader configuration or reuse the vertex shader configuration for the geometry shader shading unit.
    
=== GPUREG_START_DRAW_FUNC0 ===
 
=== GPUREG_START_DRAW_FUNC0 ===
Line 7,437: Line 7,737:  
| unsigned, Mode (0 = drawing, 1 = configuration)
 
| unsigned, Mode (0 = drawing, 1 = configuration)
 
|-
 
|-
| 1-31
+
| 1-7
 
| 0x0
 
| 0x0
 
|}
 
|}
   −
When the mode value is set to 1, rendering is not performed properly. When set to 0, changes to the vertex shader configuration registers are not applied correctly.
+
This register is related to drawing. When the mode value is set to 1, rendering is not performed properly. When set to 0, changes to the vertex shader configuration registers are not applied correctly. Because of this, it is usually initialized to 1, set to 0 immediately before triggering a draw, and set back to 1 immediately after triggering a draw.
    
=== GPUREG_VSH_OUTMAP_TOTAL1 ===
 
=== GPUREG_VSH_OUTMAP_TOTAL1 ===
Line 7,452: Line 7,752:  
| unsigned, Number of vertex shader output map registers - 1
 
| unsigned, Number of vertex shader output map registers - 1
 
|}
 
|}
 +
 +
This register sets the number of vertex shader output map registers.
    
=== GPUREG_VSH_OUTMAP_TOTAL2 ===
 
=== GPUREG_VSH_OUTMAP_TOTAL2 ===
Line 7,462: Line 7,764:  
| unsigned, Number of vertex shader output map registers - 1
 
| unsigned, Number of vertex shader output map registers - 1
 
|}
 
|}
 +
 +
This register sets the number of vertex shader output map registers.
    
=== GPUREG_GSH_MISC0 ===
 
=== GPUREG_GSH_MISC0 ===
Line 7,472: Line 7,776:  
| unsigned, Misc data (0x00000001 = Reserved geometry shader subdivision in use, 0x01004302 = Particle system in use, 0 otherwise)
 
| unsigned, Misc data (0x00000001 = Reserved geometry shader subdivision in use, 0x01004302 = Particle system in use, 0 otherwise)
 
|}
 
|}
 +
 +
This register configures miscellaneous geometry shader properties.
    
=== GPUREG_GEOSTAGE_CONFIG2 ===
 
=== GPUREG_GEOSTAGE_CONFIG2 ===
Line 7,480: Line 7,786:  
|-
 
|-
 
| 0
 
| 0
| unsigned, Draw command active (0 = not active, 1 = active)
+
| unsigned, Function indicator (with vertex buffers: 0 = draw elements, 1 = draw arrays, without: 0 = not inputting, 1 = inputting vertex attribute data)
 
|-
 
|-
 
| 8
 
| 8
 
| unsigned, Drawing triangle elements (0 = not, 1 = drawing triangle elements)
 
| unsigned, Drawing triangle elements (0 = not, 1 = drawing triangle elements)
|-
  −
| 9
  −
| 0x0
  −
|-
  −
| 16-31
  −
| 0x0
   
|}
 
|}
   −
This register is set to 1 before draw arrays/elements calls and cleared immediately after. While set to 1, some register writes out side of the 0x200-0x254 and  
+
This register configures the geometry stage of the GPU pipeline.
0x280-0x2DF ranges may be processed incorrectly.
+
 
 +
When using vertex buffers, bit 0 is set to 1 before drawing arrays, and cleared to 0 immediately after. When using immediate mode to directly input vertex attribute data, bit 0 is set to 1 before inputting vertex attribute data, and cleared to 0 immediately after. While bit 0 is set to 1, some register writes outside of the 0x200-0x254 and 0x280-0x2DF ranges may be processed incorrectly.
 +
 
 +
When using vertex buffers and drawing elements in triangles mode, bit 8 is set to 1, else it is set to 0.
    
=== GPUREG_GSH_MISC1 ===
 
=== GPUREG_GSH_MISC1 ===
Line 7,504: Line 7,807:  
| unsigned, Reserved geometry shader subdivision type (2 = Loop, 3 = Catmull-Clark)
 
| unsigned, Reserved geometry shader subdivision type (2 = Loop, 3 = Catmull-Clark)
 
|}
 
|}
 +
 +
This register configures the type of reserved geometry shader subdivision in use. The value is ignored when a subdivision is not in use.
    
=== GPUREG_PRIMITIVE_CONFIG ===
 
=== GPUREG_PRIMITIVE_CONFIG ===
Line 7,516: Line 7,821:  
| 8-9
 
| 8-9
 
| unsigned, Primitive mode
 
| unsigned, Primitive mode
|-
  −
| 16
  −
| 0x0
   
|}
 
|}
 +
 +
This register configures primitive drawing.
    
Primitive mode value:
 
Primitive mode value:
Line 7,552: Line 7,856:  
| 0x0
 
| 0x0
 
|}
 
|}
 +
 +
This register triggers resetting primitive drawing.
    
== Shader registers ==
 
== Shader registers ==

Navigation menu