GPU/Internal Registers: Difference between revisions
Steveice10 (talk | contribs) |
No edit summary |
||
(43 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
[[Category: | [[Category:GPU]] | ||
== 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 : [[# | * 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 | 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_DATAi|GPUREG_FIXEDATTRIB_DATA0]] | ||
|? | |? | ||
|PICA_REG_VS_FIXED_ATTR_DATA0 | |PICA_REG_VS_FIXED_ATTR_DATA0 | ||
|- | |- | ||
| 0234 | | 0234 | ||
| [[# | | [[#GPUREG_FIXEDATTRIB_DATAi|GPUREG_FIXEDATTRIB_DATA1]] | ||
|? | |? | ||
|PICA_REG_VS_FIXED_ATTR_DATA1 | |PICA_REG_VS_FIXED_ATTR_DATA1 | ||
|- | |- | ||
| 0235 | | 0235 | ||
| [[# | | [[#GPUREG_FIXEDATTRIB_DATAi|GPUREG_FIXEDATTRIB_DATA2]] | ||
|? | |? | ||
|PICA_REG_VS_FIXED_ATTR_DATA2 | |PICA_REG_VS_FIXED_ATTR_DATA2 | ||
Line 4,127: | Line 4,161: | ||
These registers map components of the corresponding vertex shader output register to specific fixed-function semantics. | These registers map components of the corresponding vertex shader output register to specific fixed-function semantics. | ||
Semantics that have not been mapped to a component of an output register have a value of 1 | |||
Semantic values: | Semantic values: | ||
Line 4,333: | Line 4,369: | ||
|- | |- | ||
| 0-9 | | 0-9 | ||
| | | signed, X | ||
|- | |- | ||
| 16-25 | | 16-25 | ||
| | | signed, Y | ||
|} | |} | ||
Line 4,532: | Line 4,568: | ||
|- | |- | ||
| 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,650: | Line 4,686: | ||
|} | |} | ||
This register is used to set a texture unit's physical address(es) in memory. | 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,686: | Line 4,722: | ||
|- | |- | ||
| 0 | | 0 | ||
| unsigned, Perspective (0 = | | unsigned, Perspective (0 = perspective, 1 = not perspective) | ||
|- | |- | ||
| 1-23 | | 1-23 | ||
Line 4,701: | Line 4,737: | ||
|- | |- | ||
| 0-3 | | 0-3 | ||
| unsigned, | | unsigned, Format | ||
|} | |} | ||
This register is used to set a texture unit's data format. | This register is used to set a texture unit's data format. | ||
Format values: | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
! GL Format | |||
! GL Data Type | |||
|- | |||
| 0x0 | |||
| RGBA8888 | |||
| GL_RGBA | |||
| GL_UNSIGNED_BYTE | |||
|- | |||
| 0x1 | |||
| RGB888 | |||
| GL_RGB | |||
| GL_UNSIGNED_BYTE | |||
|- | |||
| 0x2 | |||
| RGBA5551 | |||
| GL_RGBA | |||
| GL_UNSIGNED_SHORT_5_5_5_1 | |||
|- | |||
| 0x3 | |||
| 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 === | === GPUREG_LIGHTING_ENABLE0 === | ||
Line 4,786: | Line 4,901: | ||
|- | |- | ||
| 1 | | 1 | ||
| | | U² | ||
|- | |- | ||
| 2 | | 2 | ||
Line 4,792: | Line 4,907: | ||
|- | |- | ||
| 3 | | 3 | ||
| | | V² | ||
|- | |- | ||
| 4 | | 4 | ||
| U + V | | (U + V) / 2 | ||
|- | |- | ||
| 5 | | 5 | ||
| | | (U² + V²) / 2 | ||
|- | |- | ||
| 6 | | 6 | ||
| sqrt( | | sqrt(U² + V²) | ||
|- | |- | ||
| 7 | | 7 | ||
Line 4,883: | Line 4,998: | ||
| unsigned, Minification filter | | unsigned, Minification filter | ||
|- | |- | ||
| 3-10 | | 3-6 | ||
| | | Min LOD (usually 0) | ||
|- | |||
| 7-10 | |||
| Max LOD (usually 6) | |||
|- | |- | ||
| 11-18 | | 11-18 | ||
Line 4,927: | Line 5,045: | ||
|- | |- | ||
| 0-7 | | 0-7 | ||
| unsigned, Texture offset | | unsigned, Texture offset (Mipmap level 0 / base level) | ||
|- | |- | ||
| 8-31 | | 8-15 | ||
| | | 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. | 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,995: | Line 5,119: | ||
|- | |- | ||
| 12-23 | | 12-23 | ||
| | | fixed0.0.12 with two's complement ( [0.5,1.0) mapped to [-1.0,0) ), Difference from next element | ||
|} | |} | ||
Line 5,009: | Line 5,133: | ||
|- | |- | ||
| 12-23 | | 12-23 | ||
| | | fixed0.0.12 with two's complement, Difference from next element | ||
|} | |} | ||
Line 5,023: | Line 5,147: | ||
|- | |- | ||
| 12-23 | | 12-23 | ||
| | | fixed0.0.12 with two's complement, Difference from next element | ||
|} | |} | ||
Line 5,054: | Line 5,178: | ||
|- | |- | ||
| 0-7 | | 0-7 | ||
| | | signed, Half of red difference between current and next color table elements | ||
|- | |- | ||
| 8-15 | | 8-15 | ||
| | | signed, Half of green difference between current and next color table elements | ||
|- | |- | ||
| 16-23 | | 16-23 | ||
| | | signed, Half of blue difference between current and next color table elements | ||
|- | |- | ||
| 24-31 | | 24-31 | ||
| | | signed, Half of alpha difference between current and next color table elements | ||
|} | |} | ||
Line 5,129: | Line 5,253: | ||
| Previous | | Previous | ||
|} | |} | ||
Using Previous (15) as a source in the first TEV stage returns the value of source 3. If source 3 has Previous it returns zero. Previous buffer (13) always returns zero. | |||
=== GPUREG_TEXENV''i''_OPERAND === | === GPUREG_TEXENV''i''_OPERAND === | ||
Line 5,593: | Line 5,719: | ||
This register is used to configure the blending function. | This register is used to configure the blending function. | ||
Equation values: | '''Equation values:''' | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 5,615: | Line 5,741: | ||
|} | |} | ||
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,937: | Line 6,065: | ||
This register is used to depth testing and framebuffer write masking. | 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 6,202: | Line 6,332: | ||
|- | |- | ||
| 24 | | 24 | ||
| | | unsigned, Vertical flip? (0 = enable, 1 = disable) | ||
|} | |} | ||
Line 6,251: | Line 6,381: | ||
| 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. | 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 | |||
|} | |||
=== GPUREG_GAS_LUT_INDEX === | === GPUREG_GAS_LUT_INDEX === | ||
Line 6,321: | Line 6,467: | ||
| 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. | 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 | |||
|} | |||
=== GPUREG_FRAGOP_SHADOW === | === GPUREG_FRAGOP_SHADOW === | ||
Line 6,738: | Line 6,906: | ||
| unsigned, Fresnel FR LUT disabled (0 = enabled, 1 = disabled) | | unsigned, Fresnel FR LUT disabled (0 = enabled, 1 = disabled) | ||
|- | |- | ||
| 20 | | 20 | ||
| unsigned, Term 1 reflection component RB LUT disabled (0 = enabled, | | unsigned, Term 1 reflection component RB LUT disabled (0 = enabled, 1 = disabled) | ||
|- | |- | ||
| 21 | | 21 | ||
| unsigned, Term 1 reflection component RG LUT disabled (0 = enabled, | | unsigned, Term 1 reflection component RG LUT disabled (0 = enabled, 1 = disabled) | ||
|- | |- | ||
| 22 | | 22 | ||
| unsigned, Term 1 reflection component RR LUT disabled (0 = enabled, | | unsigned, Term 1 reflection component RR LUT disabled (0 = enabled, 1 = disabled) | ||
|- | |- | ||
| 24 | | 24 | ||
Line 7,045: | Line 7,213: | ||
| 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 7,100: | Line 7,270: | ||
| 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,175: | Line 7,347: | ||
| 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,187: | Line 7,361: | ||
| 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,218: | Line 7,394: | ||
| unsigned, Component 8 | | unsigned, Component 8 | ||
|} | |} | ||
This register configures the first 8 component types of a vertex array. | |||
Component values: | Component values: | ||
Line 7,298: | Line 7,476: | ||
| 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,313: | Line 7,493: | ||
| 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,323: | Line 7,505: | ||
| 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,337: | Line 7,521: | ||
|- | |- | ||
| 9 | | 9 | ||
| 0x0 | | 0x0 | ||
|- | |- | ||
Line 7,347: | Line 7,528: | ||
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,357: | Line 7,540: | ||
| 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,367: | Line 7,552: | ||
| 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,377: | Line 7,564: | ||
| 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,387: | Line 7,576: | ||
| 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,397: | Line 7,588: | ||
| 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,408: | Line 7,601: | ||
|} | |} | ||
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_DATA''i'' === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 7,416: | Line 7,609: | ||
! Description | ! Description | ||
|- | |- | ||
| 0-23 | | colspan="2" | '''DATA0:''' | ||
| float1.7.16, Vertex attribute element | |- | ||
| 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:''' | |||
|- | |- | ||
| | | 0-15 | ||
| float1.7.16, Vertex attribute element 2 ( | | float1.7.16, Vertex attribute element 2 (Y) (bits 8-23) | ||
|- | |- | ||
| | | 16-31 | ||
| float1.7.16, Vertex attribute element | | float1.7.16, Vertex attribute element 3 (Z) (bits 0-15) | ||
|- | |- | ||
| | | colspan="2" | '''DATA2:''' | ||
|- | |- | ||
| 0-23 | | 0-23 | ||
| float1.7.16, Vertex attribute element | | float1.7.16, Vertex attribute element 1 (X) | ||
|- | |- | ||
| 24-31 | | 24-31 | ||
| float1.7.16, Vertex attribute element | | float1.7.16, Vertex attribute element 2 (Y) (bits 0-7) | ||
|} | |} | ||
Accepts | 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,465: | Line 7,645: | ||
| 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,475: | Line 7,657: | ||
| 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,485: | Line 7,669: | ||
| 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,495: | Line 7,681: | ||
| 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,505: | Line 7,693: | ||
| 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,515: | Line 7,705: | ||
| 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,525: | Line 7,717: | ||
| 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,534: | Line 7,728: | ||
| 0 | | 0 | ||
| unsigned, Geometry shader configuration enabled (0 = disabled, 1 = enabled) | | unsigned, Geometry shader configuration enabled (0 = disabled, 1 = enabled) | ||
|} | |} | ||
This register sets whether to use the geometry shader configuration or reuse the vertex shader configuration for the geometry shader shading unit. | |||
When disabled and the geometry unit is not in use, as configured by GPUREG_GEOSTAGE_CONFIG, uniforms, outmap mask, program code and swizzle data are propagated to the geometry shader unit. | |||
=== GPUREG_START_DRAW_FUNC0 === | === GPUREG_START_DRAW_FUNC0 === | ||
Line 7,548: | Line 7,742: | ||
| unsigned, Mode (0 = drawing, 1 = configuration) | | unsigned, Mode (0 = drawing, 1 = configuration) | ||
|- | |- | ||
| 1- | | 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,563: | Line 7,757: | ||
| 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,573: | Line 7,769: | ||
| 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,583: | Line 7,781: | ||
| 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,591: | Line 7,791: | ||
|- | |- | ||
| 0 | | 0 | ||
| unsigned, | | 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) | ||
|} | |} | ||
This register is set to 1 before | 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,615: | Line 7,812: | ||
| 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,627: | Line 7,826: | ||
| 8-9 | | 8-9 | ||
| unsigned, Primitive mode | | unsigned, Primitive mode | ||
|} | |} | ||
This register configures primitive drawing. | |||
Primitive mode value: | Primitive mode value: | ||
Line 7,663: | Line 7,861: | ||
| 0x0 | | 0x0 | ||
|} | |} | ||
This register triggers resetting primitive drawing. | |||
== Shader registers == | == Shader registers == |