(this page is hugely WIP)
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.
Types
There are three main types of registers :
- configuration registers, which directly map to various rendering properties (for example : 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)
- action triggering registers, which tell the GPU to do something, like draw a primitive (for example : GPUREG_DRAWARRAYS)
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 so that a consecutively writing command based at 02C0 will write its first parameter to GPUREG_VSH_FLOATUNIFORM_CONFIG and ever subsequent ones to GPUREG_VSH_FLOATUNIFORM_DATA
Register list
Miscellaneous registers (0x000-0x03F)
Rasterizer registers (0x040-0x07F)
Texturing registers (0x080-0x0FF)
Framebuffer registers (0x100-0x13F)
Fragment lighting registers (0x140-0x1FF)
Geometry pipeline registers (0x200-0x27F)
Shader registers (0x280-0x2DF)
Unknown registers (0x2E0-0x2FF)
Miscellaneous registers
GPUREG_FINALIZE
Writing to this register seems to signal the GPU to stop processing GPU commands from the current buffer; any command following a write to this register will be ignored. The value written to this register does not appear to matter, although 0x12345678 is the value typically written by commercial software.
Failure to write to this register in any command buffer will result in the GPU hanging.
Rasterizer registers
GPUREG_FACECULLING_CONFIG
Bits
|
Description
|
0-1
|
Culling mode
|
Culling mode values:
Value
|
Description
|
0
|
None
|
1
|
Front Face (Counter Clockwise)
|
2
|
Back Face (Counter Clockwise)
|
GPUREG_VIEWPORT_WIDTH
Bits
|
Description
|
0-23
|
float24, width / 2
|
GPUREG_VIEWPORT_INVW
Bits
|
Description
|
1-31
|
float31, 2 / width
|
GPUREG_VIEWPORT_HEIGHT
Bits
|
Description
|
0-23
|
float24, height / 2
|
GPUREG_VIEWPORT_INVH
Bits
|
Description
|
1-31
|
float31, 2 / height
|
GPUREG_FRAGOP_CLIP
Bits
|
Description
|
0-1
|
Enabled (0 = disabled, 1 = enabled)
|
GPUREG_FRAGOP_CLIP_DATAi
Bits
|
Description
|
0-23
|
float24, Clipping plane coefficient
|
GPUREG_DEPTHMAP_SCALE
Bits
|
Description
|
0-23
|
float24, Near - Far
|
GPUREG_DEPTHMAP_OFFSET
Bits
|
Description
|
0-23
|
float24, Near
|
GPUREG_SH_OUTMAP_TOTAL
Bits
|
Description
|
0-31
|
Number of following attributes
|
GPUREG_SH_OUTMAP_Oi
These registers map components of the corresponding vertex shader output register to specific fixed-function semantics.
Bits
|
Description
|
0-7
|
Semantic for the x component of the register.
|
8-15
|
Semantic for the y component of the register.
|
16-23
|
Semantic for the z component of the register.
|
24-31
|
Semantic for the w component of the register.
|
The semantic ids are:
Value
|
Semantic
|
Description
|
0x00
|
position.x
|
Vertex Position
|
0x01
|
position.y
|
0x02
|
position.z
|
0x03
|
position.w
|
0x04
|
normquat.x
|
Quaternion specifying the normal/tangent frame (for fragment lighting)
|
0x05
|
normquat.y
|
0x06
|
normquat.z
|
0x07
|
normquat.w
|
0x08
|
color.r
|
Vertex color
|
0x09
|
color.g
|
0x0A
|
color.b
|
0x0B
|
color.a
|
0x0C
|
texcoord0.u
|
Texture coordinates for texture 0
|
0x0D
|
texcoord0.v
|
0x0E
|
texcoord1.u
|
Texture coordinates for texture 1
|
0x0F
|
texcoord1.v
|
0x10
|
texcoord0.w
|
|
0x12
|
view.x
|
View vector (for fragment lighting)
|
0x13
|
view.y
|
0x14
|
view.z
|
0x16
|
texcoord2.u
|
Texture coordinates for texture 2
|
0x17
|
texcoord2.v
|
0x1F
|
Unused component
|
Should be set for unused components of the output register
|
GPUREG_EARLYDEPTH_FUNC
Bits
|
Description
|
0-1
|
Early depth function
|
Early depth function values:
Value
|
Description
|
0
|
>=
|
1
|
>
|
2
|
<=
|
3
|
<
|
GPUREG_EARLYDEPTH_TEST1
Bits
|
Description
|
0-1
|
Enabled (0 = disabled, 1 = enabled)
|
GPUREG_EARLYDEPTH_CLEAR
Bits
|
Description
|
0-1
|
Trigger (0 = idle, 1 = clear)
|
GPUREG_SH_OUTATTR_MODE
Bits
|
Description
|
0-1
|
Use texture coordinates (0 = don't use, 1 = use)
|
GPUREG_SCISSORTEST_MODE
Bits
|
Description
|
0-1
|
Enabled (0 = disabled, 1 = enabled)
|
GPUREG_SCISSORTEST_POS
Bits
|
Description
|
0-15
|
X1
|
16-31
|
Y1
|
GPUREG_SCISSORTEST_DIM
Bits
|
Description
|
0-15
|
X2
|
16-31
|
Y2
|
GPUREG_VIEWPORT_XY
Bits
|
Description
|
0-15
|
X
|
16-31
|
Y
|
GPUREG_EARLYDEPTH_DATA
Bits
|
Description
|
0-31
|
Clear value
|
GPUREG_DEPTHMAP_ENABLE
Bits
|
Description
|
0-1
|
Enabled (0 = disabled, 1 = enabled)
|
GPUREG_RENDER_BUF_RESOLUTION1
Bits
|
Description
|
0-11
|
Width
|
12-23
|
Height
|
24
|
0x1
|
GPUREG_SH_OUTATTR_CLOCK
Bits
|
Description
|
0
|
'position.z' present
|
1
|
'color' component present
|
8
|
'texcoord0' component present
|
9
|
'texcoord1' component present
|
10
|
'texcoord2' component present
|
16
|
'texcoord0.w' present
|
24
|
'normquat' or 'view' component present
|
Texturing registers
GPUREG_TEXUNIT_CONFIG
Bits
|
Description
|
0
|
Texture 0 enabled
|
1
|
Texture 1 enabled
|
2
|
Texture 2 enabled
|
3
|
0x0
|
8-9
|
Texture 3 coordinates (0 = texture 0, 1 = texture 1, 2 = texture 2)
|
10
|
Texture 3 enabled
|
12
|
0x1
|
13
|
Texture 2 coordinates (0 = texture 2, 1 = texture 1)
|
16
|
Clear texture cache (0 = don't clear, 1 = clear)
|
GPUREG_TEXUNITi_BORDER_COLOR
Bits
|
Description
|
0-7
|
Red
|
8-15
|
Green
|
16-23
|
Blue
|
24-31
|
Alpha
|
GPUREG_TEXUNITi_DIM
Bits
|
Description
|
0-15
|
Height
|
16-31
|
Width
|
GPUREG_TEXUNITi_PARAM
Bits
|
Description
|
1
|
Magnification filter
|
2
|
Minification filter
|
4-5
|
ETC1 (0 = not ETC1, 2 = ETC1)
|
8-10
|
Wrap T
|
12-14
|
Wrap S
|
20
|
Shadow (Texture 0 only, 0 = not shadow, 1 = shadow)
|
24
|
Mipmap filter
|
28-30
|
Type (Texture 0 only)
|
Filter values:
Value
|
Description
|
0
|
Nearest
|
1
|
Linear
|
Wrap values:
Value
|
Description
|
0
|
Clamp to edge
|
1
|
Clamp to border
|
2
|
Repeat
|
3
|
Mirrored repeat
|
Type values:
Value
|
Description
|
0
|
2D
|
1
|
Cube map
|
2
|
Shadow 2D
|
3
|
Projection
|
4
|
Shadow cube
|
5
|
Disabled
|
GPUREG_TEXUNITi_LOD
Bits
|
Description
|
0-15
|
fixed13 (8 fractional bits), Bias
|
16-23
|
Max Level
|
24-31
|
Min Level
|
GPUREG_TEXUNITi_ADDRi
Bits
|
Description
|
0-31
|
Physical Address >> 3
|
If the texture is a cube:
Register
|
Description
|
ADDR1
|
Positive X
|
ADDR2
|
Negative X
|
ADDR3
|
Positive Y
|
ADDR4
|
Negative Y
|
ADDR5
|
Positive Z
|
ADDR6
|
Negative Z
|
Otherwise, ADDR(1) points to a 2D texture, and the rest are empty.
GPUREG_TEXUNITi_SHADOW
Bits
|
Description
|
0
|
Perspective (0 = not perspective, 1 = perspective)
|
1-23
|
upper 23 bits of unsigned fixed24, Z bias
|
24-31
|
Z scale
|
GPUREG_TEXUNITi_TYPE
GPUREG_LIGHTING_ENABLE0
Bits
|
Description
|
0-1
|
Enabled (0 = disabled, 1 = enabled)
|
Framebuffer registers
GPUREG_FRAMEBUFFER_INVALIDATE
Writing 1 to this register invalidates the framebuffer cache. This should be done when changing the framebuffer or when it is cleared before rendering. Note that it does not flush the cache, so it should always be preceded by a write to GPUREG_FRAMEBUFFER_FLUSH.
GPUREG_FRAMEBUFFER_FLUSH
Writing 1 to this register flushes the framebuffer cache to memory. This should be done after rendering before changing the framebuffer or using rendering results.
GPUREG_DEPTHBUFFER_FORMAT
The format the current depth buffer should be written into. Following values are possible:
Value
|
Description
|
0
|
16-bit depth
|
1
|
?? seems to freeze the GPU
|
2
|
24-bit depth
|
3
|
24-bit depth + 8-bit stencil (stencil is within bit 24-31)
|
GPUREG_COLORBUFFER_FORMAT
Describes the format of the current color buffer used for 3D rendering.
Bits
|
Description
|
0-7
|
Pixel size (0=16-bit, 1=24-bit, 2=32-bit, 3=64-bit?)
|
16-23
|
Framebuffer Format (0=GL_RGBA8, 1=GL_RGB8, 2=GL_RGB5_A1, 3=GL_R5_G6_B5, 4=GL_RGBA4).
Note that these values are slightly different from those in GPU#Framebuffer_color_formats.
Color components are laid out in reverse byte order, with the most significant bits used first.
|
GPUREG_FRAMEBUFFER_BLOCK32
When set to 0, use regular 8x8 tiling format for the framebuffer, compatible with textures. When set to 1, use a 32x32 tiling format. To untile the color buffer when using this format, use bit 16 of the display transfer flags. It is unknown if there are any advantages to using the 32x32 format.
Fragment lighting registers
GPUREG_LIGHTING_ENABLE0
This register is set to 0 when fragment lighting is disabled, and to 1 when it is enabled.
GPUREG_LIGHTING_ENABLE1
This register is set to 1 when fragment lighting is disabled, and to 0 when it is enabled.
GPUREG_LIGHTING_CONFIG0
Bits
|
Description
|
0
|
Shadow factor enable, usually set to bit16 OR bit18 OR bit19
|
1
|
Unknown, set to 0
|
2-3
|
"Fresnel selector" (see below)
|
4-7
|
"Config", "Light env config" (see below)
|
8-15
|
Unknown, set to 4
|
16
|
"Shadow primary", 0=disabled, 1=enabled
|
17
|
"Shadow secondary", 0=disabled, 1=enabled
|
18
|
"Invert shadow", 0=disabled, 1=enabled
|
19
|
"Shadow alpha", 0=disabled, 1=enabled
|
20-21
|
Unknown, set to 0
|
22-23
|
"Bump selector", texture unit for bumpmapping
|
24-25
|
"Shadow selector", texture unit for shadow mapping
|
26
|
Unknown, set to 0
|
27
|
"Clamp highlights", 0=disabled, 1=enabled
|
28-29
|
"Bump mode", "Light env texy usage" (see below)
|
30
|
"Bump renorm", 0=enabled, 1=disabled
|
31
|
Unknown, set to 1
|
Fresnel selector constants:
Value
|
Description
|
0
|
NO_FRESNEL
|
1
|
PRI_ALPHA_FRESNEL
|
2
|
SEC_ALPHA_FRESNEL
|
3
|
PRI_SEC_ALPHA_FRESNEL
|
The light environment configuration controls which LUTs are available for use. If a LUT is not available in the selected configuration, its value will always read a constant 1.0 regardless of the enable state in GPUREG_LIGHTING_CONFIG1. If lut_RR is enabled but not lut_RG or lut_RB, the output of lut_RR is used for the three components; Red, Green and Blue.
Light env config constants:
Value
|
Description
|
Available LUTs
|
0
|
LIGHT_ENV_LAYER_CONFIG0
|
lut_D0, lut_RR, lut_SP, lut_DA
|
1
|
LIGHT_ENV_LAYER_CONFIG1
|
lut_FR, lut_RR, lut_SP, lut_DA
|
2
|
LIGHT_ENV_LAYER_CONFIG2
|
lut_D0, lut_D1, lut_RR, lut_DA
|
3
|
LIGHT_ENV_LAYER_CONFIG3
|
lut_D0, lut_D1, lut_FR, lut_DA
|
4
|
LIGHT_ENV_LAYER_CONFIG4
|
All except for lut_FR
|
5
|
LIGHT_ENV_LAYER_CONFIG5
|
All except for lut_D1
|
6
|
LIGHT_ENV_LAYER_CONFIG6
|
All except for lut_RB and lut_RG
|
8 (sic)
|
LIGHT_ENV_LAYER_CONFIG7
|
All
|
Bump mode constants:
Value
|
Description
|
0
|
BUMP_NOT_USED
|
1
|
BUMP_AS_BUMP
|
2
|
BUMP_AS_TANG
|
Bit 30 is set when bump mode is not zero.
GPUREG_LIGHTING_CONFIG1
Bits
|
Description
|
0
|
Disable bit for frag light source 0 shadows
|
1
|
Disable bit for frag light source 1 shadows
|
2
|
Disable bit for frag light source 2 shadows
|
3
|
Disable bit for frag light source 3 shadows
|
4
|
Disable bit for frag light source 4 shadows
|
5
|
Disable bit for frag light source 5 shadows
|
6
|
Disable bit for frag light source 6 shadows
|
7
|
Disable bit for frag light source 7 shadows
|
8
|
Disable bit for frag light source 0 spot
|
9
|
Disable bit for frag light source 1 spot
|
10
|
Disable bit for frag light source 2 spot
|
11
|
Disable bit for frag light source 3 spot
|
12
|
Disable bit for frag light source 4 spot
|
13
|
Disable bit for frag light source 5 spot
|
14
|
Disable bit for frag light source 6 spot
|
15
|
Disable bit for frag light source 7 spot
|
16
|
Disable bit for lut_D0
|
17
|
Disable bit for lut_D1
|
18
|
Unknown, set to 1
|
19
|
Disable bit for lut_FR
|
20
|
Disable bit for lut_RB
|
21
|
Disable bit for lut_RG
|
22
|
Disable bit for lut_RR
|
23
|
Unknown, set to 1
|
24
|
Disable bit for frag light source 0 distance attenuation
|
25
|
Disable bit for frag light source 1 distance attenuation
|
26
|
Disable bit for frag light source 2 distance attenuation
|
27
|
Disable bit for frag light source 3 distance attenuation
|
28
|
Disable bit for frag light source 4 distance attenuation
|
29
|
Disable bit for frag light source 5 distance attenuation
|
30
|
Disable bit for frag light source 6 distance attenuation
|
31
|
Disable bit for frag light source 7 distance attenuation
|
GPUREG_LIGHTING_NUM_LIGHTS
The number of active lights minus one (0..7) is written to this register.
GPUREG_LIGHTING_LIGHT_PERMUTATION
Bits
|
Description
|
0-2
|
ID of the 1st enabled light (0..7)
|
4-6
|
ID of the 2nd enabled light (0..7)
|
8-10
|
ID of the 3rd enabled light (0..7)
|
12-14
|
ID of the 4th enabled light (0..7)
|
16-18
|
ID of the 5th enabled light (0..7)
|
20-22
|
ID of the 6th enabled light (0..7)
|
24-26
|
ID of the 7th enabled light (0..7)
|
28-30
|
ID of the 8th enabled light (0..7)
|
GPUREG_LIGHTING_LUTINPUT_SELECT
Bits
|
Description
|
0-3
|
Input selector for lut_D0
|
4-7
|
Input selector for lut_D1
|
8-11
|
Input selector for lut_SP
|
12-15
|
Input selector for lut_FR
|
16-19
|
Input selector for lut_RB
|
20-23
|
Input selector for lut_RG
|
24-27
|
Input selector for lut_RR
|
Input selector values:
Value
|
Description
|
0
|
N·H
|
1
|
V·H
|
2
|
N·V
|
3
|
L·N
|
4
|
-L·P (aka Spotlight aka SP)
|
5
|
cos φ (aka CP)
|
GPUREG_LIGHTING_LUTINPUT_ABS
Bits
|
Description
|
1
|
abs() flag for the input of lut_D0 (0=enabled, 1=disabled)
|
5
|
abs() flag for the input of lut_D1 (0=enabled, 1=disabled)
|
9
|
abs() flag for the input of lut_SP (0=enabled, 1=disabled)
|
13
|
abs() flag for the input of lut_FR (0=enabled, 1=disabled)
|
17
|
abs() flag for the input of lut_RB (0=enabled, 1=disabled)
|
21
|
abs() flag for the input of lut_RG (0=enabled, 1=disabled)
|
25
|
abs() flag for the input of lut_RR (0=enabled, 1=disabled)
|
This register controls whether the absolute value of the input is taken before using a LUT.
GPUREG_LIGHTING_LUTINPUT_SCALE
Bits
|
Description
|
0-3
|
Scaler selector for lut_D0
|
4-7
|
Scaler selector for lut_D1
|
8-11
|
Scaler selector for lut_SP
|
12-15
|
Scaler selector for lut_FR
|
16-19
|
Scaler selector for lut_RB
|
20-23
|
Scaler selector for lut_RG
|
24-27
|
Scaler selector for lut_RR
|
Scaler selector values:
Value
|
Description
|
0
|
1x
|
1
|
2x
|
2
|
4x
|
3
|
8x
|
6
|
0.25x
|
7
|
0.5x
|
This register controls the scaling that is applied to the output of a LUT.
GPUREG_LIGHTING_LUT_INDEX
This register controls which LUT and what offset into it the LUT_DATA register writes to.
Bits
|
Description
|
0-7
|
Starting entry offset (0...255)
|
8-10
|
LUT ID (context=0) or Light ID (context=1,2)
|
11-12
|
Context ID
|
LUT ID values:
Value
|
Description
|
0
|
lut_D0
|
1
|
lut_D1
|
3
|
lut_FR
|
4
|
lut_RB
|
5
|
lut_RG
|
6
|
lut_RR
|
Context ID values:
Value
|
Description
|
0
|
LUTs common to all lights - writes to the LUT selected by the ID
|
1
|
lut_SP - writes to the LUT specific to the selected light
|
2
|
lut_DA - writes to the LUT specific to the selected light
|
GPUREG_LIGHTING_LUT_DATA
Lighting LUT data is written here.
A LUT contains data for the input domain [-1.0, 1.0], which is indexed using a signed 8-bit number [-128, 127]. Therefore a LUT contains 256 entries. The index of a value is (int)(x/127.0f) & 0xFF.
lut_DA: The input domain is [0.0, 1.0], and the index is an unsigned 8-bit number [0, 255] instead.
Format of an entry:
Bits
|
Description
|
0-11
|
Entry value (12bit fractional number; floatval = x / 4096; however 0xFFF is treated as 1.0)
|
12-22
|
Absolute value of the difference between the next entry and this entry, used to implement linear interpolation (11bit fractional number; floatval = x / 2048; however 0x7FF is treated as 1.0)
|
23
|
Sign bit of the difference (0=positive, 1=negative)
|
GPUREG_LIGHTING_AMBIENT
Bits
|
Description
|
0-7
|
Blue component (0..255)
|
10-17
|
Green component (0..255)
|
20-27
|
Red component (0..255)
|
This register contains the initial value of the fragment primary color before the partial colors that correspond to each enabled light are added. Usually set to material_emission + material_ambient*scene_ambient.
GPUREG_LIGHTx_CONFIG
Bits
|
Description
|
0
|
Light type (0 = positional light, 1 = directional light)
|
1
|
Two side diffuse (0=disable, 1=enable)
|
2
|
Geometric factor 0 (0=disable, 1=enable)
|
3
|
Geometric factor 1 (0=disable, 1=enable)
|
GPUREG_LIGHTx_XY
Bits
|
Description
|
0-15
|
X coordinate (float16 = 1.5.10)
|
16-31
|
Y coordinate (float16 = 1.5.10)
|
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.
GPUREG_LIGHTx_Z
Bits
|
Description
|
0-15
|
Z coordinate (float16 = 1.5.10)
|
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.
GPUREG_LIGHTx_SPOTDIR_XY
Bits
|
Description
|
0-12
|
X coordinate (2.11 signed fixed point) (Usually the input value is negated)
|
16-28
|
Y coordinate (2.11 signed fixed point) (Usually the input value is negated)
|
These registers (along with _Z) represent the spot direction (unitary) vector of the corresponding light.
GPUREG_LIGHTx_SPOTDIR_Z
Bits
|
Description
|
0-12
|
Z coordinate (2.11 signed fixed point) (Usually the input value is negated)
|
These registers (along with _XY) represent the spot direction (unitary) vector of the corresponding light.
GPUREG_LIGHTx_ATTENUATION_BIAS
These registers contain the distance attenuation bias value (float20 = 1.7.12) of the corresponding light. The attenuation factor is lut_DA(clip(bias + scale*distance, 0.0, 1.0)).
GPUREG_LIGHTx_ATTENUATION_SCALE
These registers contain the distance attenuation scale value (float20 = 1.7.12) of the corresponding light. The attenuation factor is lut_DA(clip(bias + scale*distance, 0.0, 1.0)).
GPUREG_LIGHTx_AMBIENT
These registers contain the ambient color (same format as GPUREG_LIGHTING_AMBIENT) of the corresponding light. Usually set to material_ambient*lightX_ambient.
GPUREG_LIGHTx_DIFFUSE
These registers contain the diffuse color (same format as GPUREG_LIGHTING_AMBIENT) of the corresponding light. Usually set to material_diffuse*lightX_diffuse.
GPUREG_LIGHTx_SPECULAR0
These registers contain the specular0 color (same format as GPUREG_LIGHTING_AMBIENT) of the corresponding light. Usually set to material_specular0*lightX_specular0.
GPUREG_LIGHTx_SPECULAR1
These registers contain the specular1 color (same format as GPUREG_LIGHTING_AMBIENT) of the corresponding light. Usually set to material_specular1*lightX_specular1.
Geometry pipeline registers
GPUREG_GEOSTAGE_CONFIG
Bits
|
Description
|
0-7
|
Geometry stage mode. (0=Vertex shader only, 2=Vertex shader + geometry shader)
|
8
|
Unknown. Seems to skip every other triangle when used with indexed rendering and without geoshaders. Has no effect with non-indexed rendering without geoshaders. If this is 0, you don't need to use GPU_UNKPRIM with DrawElements.
|
9-15
|
No effect.
|
16-23
|
Unknown.
|
24-31
|
Unknown. Often set to 0.
|
This register configures the geometry stage of the GPU pipeline.
GPUREG_FIXEDATTRIB_INDEX
See GPU/Fixed Vertex Attributes and GPU/Immediate-Mode Vertex Submission for usage info.
Bits
|
Description
|
0-31
|
Sets the active fixed attribute index. This is the fixed attribute which will be set when writing to GPUREG_FIXEDATTRIB_DATA. Valid values are 0-11. If the special value 0xF is written here, this sets up immediate-mode vertex submission instead, and writes to the data register will input vertex data directly into the pipeline.
|
GPUREG_FIXEDATTRIB_DATA
Accepts a packed 4-tuple of float24 values (in the same format used for specifying shader uniforms). This is stored as the fixed attribute value for the attribute currently specified in the index register. Attributes are always specified as a 4-tuple of floats, regardless of the format configured in GPUREG_ATTRIBBUFFERS_FORMAT_HIGH.
If immediate-mode vertex submission is enabled (by writing 0xF to the index register) then vertex data is input here directly. The index register does not need to be re-set after each write.
GPUREG_RESTART_PRIMITIVE
Bits
|
Description
|
0-7
|
Writing 0x01 to this field ends the current triangle strip or fan. This is necessary before using these kinds of primitives with immediate-mode, but most games seem to write to it before every draw call.
|
Geometry shader registers
GPUREG_GSH_BOOLUNIFORM
Bits
|
Description
|
0
|
Value of geometry shader unit's b0 boolean register. (0=true, 1=false)
|
1
|
Value of geometry shader unit's b1 boolean register. (0=true, 1=false)
|
2
|
Value of geometry shader unit's b2 boolean register. (0=true, 1=false)
|
3
|
Value of geometry shader unit's b3 boolean register. (0=true, 1=false)
|
4
|
Value of geometry shader unit's b4 boolean register. (0=true, 1=false)
|
5
|
Value of geometry shader unit's b5 boolean register. (0=true, 1=false)
|
6
|
Value of geometry shader unit's b6 boolean register. (0=true, 1=false)
|
7
|
Value of geometry shader unit's b7 boolean register. (0=true, 1=false)
|
8
|
Value of geometry shader unit's b8 boolean register. (0=true, 1=false)
|
9
|
Value of geometry shader unit's b9 boolean register. (0=true, 1=false)
|
10
|
Value of geometry shader unit's b10 boolean register. (0=true, 1=false)
|
11
|
Value of geometry shader unit's b11 boolean register. (0=true, 1=false)
|
12
|
Value of geometry shader unit's b12 boolean register. (0=true, 1=false)
|
13
|
Value of geometry shader unit's b13 boolean register. (0=true, 1=false)
|
14
|
Value of geometry shader unit's b14 boolean register. (0=true, 1=false)
|
15
|
Value of geometry shader unit's b15 boolean register. (0=true, 1=false)
|
16-31
|
Unknown. This seems to always be set to 0x7FFF, and other values may cause the GPU to hang
|
This register is used to set the geometry shader unit's boolean registers.
GPUREG_GSH_INTUNIFORM_I0
Bits
|
Description
|
0-7
|
Value for geometry shader's i0.x (u8, 0-255)
|
8-15
|
Value for geometry shader's i0.y (u8, 0-255)
|
16-23
|
Value for geometry shader's i0.z (u8, 0-255)
|
24-31
|
Value for geometry shader's i0.w (u8, 0-255)
|
This register is used to set the geometry shader's i0 integer register.
GPUREG_GSH_INTUNIFORM_I1
Bits
|
Description
|
0-7
|
Value for geometry shader's i1.x (u8, 0-255)
|
8-15
|
Value for geometry shader's i1.y (u8, 0-255)
|
16-23
|
Value for geometry shader's i1.z (u8, 0-255)
|
24-31
|
Value for geometry shader's i1.w (u8, 0-255)
|
This register is used to set the geometry shader's i1 integer register.
GPUREG_GSH_INTUNIFORM_I2
Bits
|
Description
|
0-7
|
Value for geometry shader's i2.x (u8, 0-255)
|
8-15
|
Value for geometry shader's i2.y (u8, 0-255)
|
16-23
|
Value for geometry shader's i2.z (u8, 0-255)
|
24-31
|
Value for geometry shader's i2.w (u8, 0-255)
|
This register is used to set the geometry shader's i2 integer register.
GPUREG_GSH_INTUNIFORM_I3
Bits
|
Description
|
0-7
|
Value for geometry shader's i3.x (u8, 0-255)
|
8-15
|
Value for geometry shader's i3.y (u8, 0-255)
|
16-23
|
Value for geometry shader's i3.z (u8, 0-255)
|
24-31
|
Value for geometry shader's i3.w (u8, 0-255)
|
This register is used to set the geometry shader's i3 integer register.
GPUREG_GSH_INPUTBUFFER_CONFIG
Bits
|
Description
|
0-7
|
Input buffer stride minus 1, in float vec4 registers. (value 0 means a stride of 1 float vec4 register)
|
8-23
|
Unknown. These bits typically aren't updated by games.
|
24-31
|
Unknown. This is typically set to 8 for geometry shaders.
|
This register is used to configure the geometry shader's input buffer. In the context of a geometry shader, the stride parameter can be interpreted as the input primitive size in registers, though it is not a limit on the number of input registers which can be accessed from the geometry shader.
GPUREG_GSH_ENTRYPOINT
Bits
|
Description
|
0-15
|
Geometry shader unit entrypoint, in words.
|
16-31
|
Unknown. This seems to always be set to 0x7FFF, and other values may cause the GPU to hang
|
This sets the entrypoint for the program running on the single shader unit which can be dedicated to running geometry shaders, regardless of the current geometry stage mode. This is means that while this register is normally used to set the geometry shader entrypoint, it can also be used to set this single shader unit to run from a different entrypoint than the other three even when running a vertex shader.
GPUREG_GSH_ATTRIBUTES_PERMUTATION_LOW
Bits
|
Description
|
0-3
|
Index of geometry shader input register which the 1st attribute will be stored in.
|
4-7
|
Index of geometry shader input register which the 2nd attribute will be stored in.
|
8-11
|
Index of geometry shader input register which the 3rd attribute will be stored in.
|
12-15
|
Index of geometry shader input register which the 4th attribute will be stored in.
|
16-19
|
Index of geometry shader input register which the 5th attribute will be stored in.
|
20-23
|
Index of geometry shader input register which the 6th attribute will be stored in.
|
24-27
|
Index of geometry shader input register which the 7th attribute will be stored in.
|
28-31
|
Index of geometry shader input register which the 8th attribute will be stored in.
|
This register sets the geometry shader input register index which will correspond to each attribute contained by the input buffer (which in the case of geometry shaders is the vertex shader output buffer) for the first 8 attributes.
For example, having bits 0-3 set to 5 means that, in the geometry shader program, v5 will contain the input buffer's 1st attribute.
GPUREG_GSH_ATTRIBUTES_PERMUTATION_HIGH
Bits
|
Description
|
0-3
|
Index of geometry shader input register which the 9th attribute will be stored in.
|
4-7
|
Index of geometry shader input register which the 10th attribute will be stored in.
|
8-11
|
Index of geometry shader input register which the 11th attribute will be stored in.
|
12-15
|
Index of geometry shader input register which the 12th attribute will be stored in.
|
16-19
|
Index of geometry shader input register which the 13th attribute will be stored in.
|
20-23
|
Index of geometry shader input register which the 14th attribute will be stored in.
|
24-27
|
Index of geometry shader input register which the 15th attribute will be stored in.
|
28-31
|
Index of geometry shader input register which the 16th attribute will be stored in.
|
This register sets the geometry shader input register index which will correspond to each attribute contained by the input buffer (which in the case of geometry shaders is the vertex shader output buffer) for attributes 8 through 15.
For example, having bits 0-3 set to 5 means that, in the geometry shader program, v5 will contain the input buffer's 9th attribute.
GPUREG_GSH_OUTMAP_MASK
Bits
|
Description
|
0
|
Enable bit for geometry shader's o0 output register. (1 = o0 enabled, 0 = o0 disabled)
|
1
|
Enable bit for geometry shader's o1 output register. (1 = o1 enabled, 0 = o1 disabled)
|
2
|
Enable bit for geometry shader's o2 output register. (1 = o2 enabled, 0 = o2 disabled)
|
3
|
Enable bit for geometry shader's o3 output register. (1 = o3 enabled, 0 = o3 disabled)
|
4
|
Enable bit for geometry shader's o4 output register. (1 = o4 enabled, 0 = o4 disabled)
|
5
|
Enable bit for geometry shader's o5 output register. (1 = o5 enabled, 0 = o5 disabled)
|
6
|
Enable bit for geometry shader's o6 output register. (1 = o6 enabled, 0 = o6 disabled)
|
This register toggles the geometry shader unit's output registers.
GPUREG_GSH_CODETRANSFER_END
Bits
|
Description
|
0
|
Code data transfer end signal bit.
|
This register's value should be set to 1 in order to finalize the transfer of geometry shader code. It is unknown whether this register is used for other functions.
GPUREG_GSH_FLOATUNIFORM_CONFIG
Bits
|
Description
|
0-6
|
Target float vec4 geometry shader uniform ID for transfer. (range 0-95, where 0 = c0 and 95 = c95)
|
31
|
Float vec4 geometry shader uniform data transfer mode. (0 = float24, 1 = float32)
|
This register sets the target float vec4 geometry shader uniform ID and transfer mode for the data transfer system. As such it is typically used right before GPUREG_GSH_FLOATUNIFORM_DATA, though writing to one register does not make writing to the other mandatory.
GPUREG_GSH_FLOATUNIFORM_DATA
Bits
|
Description
|
0-31
|
Float vec4 geometry shader uniform data. (format depends on transfer mode, see below for details)
|
This register is used to set the value of float vec4 geometry shader uniform registers. The data format which should be written to it depends on the transfer mode set with GPUREG_GSH_FLOATUNIFORM_CONFIG. This register functions as a FIFO queue : after each time a uniform register is successfully set, the target uniform ID value is incremented, meaning that groups of uniforms with contiguous register IDs can be set with only one initial write to GPUREG_GSH_FLOATUNIFORM_CONFIG.
- In the case of float24 transfer mode, data should be sent by writing three words which are the concatenation of the float24 value of the uniform register's 4 components, in the reverse order. Assuming each letter corresponds to 4 bits, the format becomes :
- first word : ZZWWWWWW
- second word : YYYYZZZZ
- third word : XXXXXXYY
- In the case of float32 transfer mode, data should be sent by writing four words which are each the float32 value of the uniform register's 4 components, in the reverse order.
GPUREG_GSH_CODETRANSFER_CONFIG
Bits
|
Description
|
0-11
|
Target geometry shader code offset for data transfer.
|
This register is used to set the offset at which upcoming geometry shader code data transferred through GPUREG_GSH_CODETRANSFER_DATA should be written.
NOTE : as we do not yet know what a shader program's maximum size is yet, we also do not know how many bits the code offset parameter holds. The biggest shader binary observed so far was 2422 instructions long. The shader control flow instructions only have room to address 12 bits though, so it's likely that the maximum is 4095.
GPUREG_GSH_CODETRANSFER_DATA
Bits
|
Description
|
0-31
|
Geometry shader instruction data.
|
This register is used to transfer geometry shader code data. This register behaves as a FIFO queue : each write to this register writes the provided value to the GPU geometry shader code memory bank at the offset initially set by GPUREG_GSH_CODETRANSFER_CONFIG. The offset in question is incremented after each write to this register.
GPUREG_GSH_OPDESCS_CONFIG
Bits
|
Description
|
0-6
|
Target geometry shader operand descriptor offset for data transfer.
|
This register is used to set the offset at which upcoming geometry shader operand descriptor data transferred through GPUREG_GSH_OPDESCS_DATA should be written.
GPUREG_GSH_OPDESCS_DATA
Bits
|
Description
|
0-31
|
Geometry shader operand descriptor data.
|
This register is used to transfer geometry shader operand descriptor data. This register behaves as a FIFO queue : each write to this register writes the provided value to the GPU geometry shader operand descriptor memory bank at the offset initially set by GPUREG_GSH_OPDESCS_CONFIG. The offset in question is incremented after each write to this register.
Vertex shader registers
GPUREG_VSH_BOOLUNIFORM
Bits
|
Description
|
0
|
Value of vertex shader unit's b0 boolean register. (0=true, 1=false)
|
1
|
Value of vertex shader unit's b1 boolean register. (0=true, 1=false)
|
2
|
Value of vertex shader unit's b2 boolean register. (0=true, 1=false)
|
3
|
Value of vertex shader unit's b3 boolean register. (0=true, 1=false)
|
4
|
Value of vertex shader unit's b4 boolean register. (0=true, 1=false)
|
5
|
Value of vertex shader unit's b5 boolean register. (0=true, 1=false)
|
6
|
Value of vertex shader unit's b6 boolean register. (0=true, 1=false)
|
7
|
Value of vertex shader unit's b7 boolean register. (0=true, 1=false)
|
8
|
Value of vertex shader unit's b8 boolean register. (0=true, 1=false)
|
9
|
Value of vertex shader unit's b9 boolean register. (0=true, 1=false)
|
10
|
Value of vertex shader unit's b10 boolean register. (0=true, 1=false)
|
11
|
Value of vertex shader unit's b11 boolean register. (0=true, 1=false)
|
12
|
Value of vertex shader unit's b12 boolean register. (0=true, 1=false)
|
13
|
Value of vertex shader unit's b13 boolean register. (0=true, 1=false)
|
14
|
Value of vertex shader unit's b14 boolean register. (0=true, 1=false)
|
15
|
Value of vertex shader unit's b15 boolean register. (0=true, 1=false)
|
16-31
|
Unknown. This seems to always be set to 0x7FFF, and other values may cause the GPU to hang
|
This register is used to set the vertex shader unit's boolean registers.
GPUREG_VSH_INTUNIFORM_I0
Bits
|
Description
|
0-7
|
Value for vertex shader's i0.x (u8, 0-255)
|
8-15
|
Value for vertex shader's i0.y (u8, 0-255)
|
16-23
|
Value for vertex shader's i0.z (u8, 0-255)
|
24-31
|
Value for vertex shader's i0.w (u8, 0-255)
|
This register is used to set the vertex shader's i0 integer register.
GPUREG_VSH_INTUNIFORM_I1
Bits
|
Description
|
0-7
|
Value for vertex shader's i1.x (u8, 0-255)
|
8-15
|
Value for vertex shader's i1.y (u8, 0-255)
|
16-23
|
Value for vertex shader's i1.z (u8, 0-255)
|
24-31
|
Value for vertex shader's i1.w (u8, 0-255)
|
This register is used to set the vertex shader's i1 integer register.
GPUREG_VSH_INTUNIFORM_I2
Bits
|
Description
|
0-7
|
Value for vertex shader's i2.x (u8, 0-255)
|
8-15
|
Value for vertex shader's i2.y (u8, 0-255)
|
16-23
|
Value for vertex shader's i2.z (u8, 0-255)
|
24-31
|
Value for vertex shader's i2.w (u8, 0-255)
|
This register is used to set the vertex shader's i2 integer register.
GPUREG_VSH_INTUNIFORM_I3
Bits
|
Description
|
0-7
|
Value for vertex shader's i3.x (u8, 0-255)
|
8-15
|
Value for vertex shader's i3.y (u8, 0-255)
|
16-23
|
Value for vertex shader's i3.z (u8, 0-255)
|
24-31
|
Value for vertex shader's i3.w (u8, 0-255)
|
This register is used to set the vertex shader's i3 integer register.
GPUREG_VSH_INPUTBUFFER_CONFIG
Bits
|
Description
|
0-7
|
Input buffer stride minus 1, in float vec4 registers. (value 0 means a stride of 1 float vec4 register)
|
8-23
|
Unknown. These bits typically aren't updated by games.
|
24-31
|
Unknown. This is typically set to 0xA for vertex shaders.
|
This register is used to configure the vertex shader's input buffer. In the context of a geometry shader, the stride parameter can be interpreted as the number of attributes per vertex.
GPUREG_VSH_ENTRYPOINT
Bits
|
Description
|
0-15
|
Vertex shader entrypoint, in words.
|
16-31
|
Unknown. This seems to always be set to 0x7FFF, and other values may cause the GPU to hang
|
This sets the entrypoint for the program running on shader units set to vertex shader mode. Depending on the current geometry stage mode this can include either all 4 shader units or just 3 of them.
GPUREG_VSH_ATTRIBUTES_PERMUTATION_LOW
Bits
|
Description
|
0-3
|
Index of vertex shader input register which the 1st attribute will be stored in.
|
4-7
|
Index of vertex shader input register which the 2nd attribute will be stored in.
|
8-11
|
Index of vertex shader input register which the 3rd attribute will be stored in.
|
12-15
|
Index of vertex shader input register which the 4th attribute will be stored in.
|
16-19
|
Index of vertex shader input register which the 5th attribute will be stored in.
|
20-23
|
Index of vertex shader input register which the 6th attribute will be stored in.
|
24-27
|
Index of vertex shader input register which the 7th attribute will be stored in.
|
28-31
|
Index of vertex shader input register which the 8th attribute will be stored in.
|
This register sets the vertex shader input register index which will correspond to each attribute contained by the input buffer for the first 8 attributes.
For example, having bits 0-3 set to 5 means that, in the vertex shader program, v5 will contain the input buffer's 1st attribute.
GPUREG_VSH_ATTRIBUTES_PERMUTATION_HIGH
Bits
|
Description
|
0-3
|
Index of vertex shader input register which the 9th attribute will be stored in.
|
4-7
|
Index of vertex shader input register which the 10th attribute will be stored in.
|
8-11
|
Index of vertex shader input register which the 11th attribute will be stored in.
|
12-15
|
Index of vertex shader input register which the 12th attribute will be stored in.
|
16-19
|
Index of vertex shader input register which the 13th attribute will be stored in.
|
20-23
|
Index of vertex shader input register which the 14th attribute will be stored in.
|
24-27
|
Index of vertex shader input register which the 15th attribute will be stored in.
|
28-31
|
Index of vertex shader input register which the 16th attribute will be stored in.
|
This register sets the vertex shader input register index which will correspond to each attribute contained by the input buffer for attributes 8 through 15.
For example, having bits 0-3 set to 5 means that, in the vertex shader program, v5 will contain the input buffer's 9th attribute.
GPUREG_VSH_OUTMAP_MASK
Bits
|
Description
|
0
|
Enable bit for vertex shader's o0 output register. (1 = o0 enabled, 0 = o0 disabled)
|
1
|
Enable bit for vertex shader's o1 output register. (1 = o1 enabled, 0 = o1 disabled)
|
2
|
Enable bit for vertex shader's o2 output register. (1 = o2 enabled, 0 = o2 disabled)
|
3
|
Enable bit for vertex shader's o3 output register. (1 = o3 enabled, 0 = o3 disabled)
|
4
|
Enable bit for vertex shader's o4 output register. (1 = o4 enabled, 0 = o4 disabled)
|
5
|
Enable bit for vertex shader's o5 output register. (1 = o5 enabled, 0 = o5 disabled)
|
6
|
Enable bit for vertex shader's o6 output register. (1 = o6 enabled, 0 = o6 disabled)
|
7
|
Enable bit for vertex shader's o7 output register. (1 = o7 enabled, 0 = o7 disabled)
|
8
|
Enable bit for vertex shader's o8 output register. (1 = o8 enabled, 0 = o8 disabled)
|
9
|
Enable bit for vertex shader's o9 output register. (1 = o9 enabled, 0 = o9 disabled)
|
10
|
Enable bit for vertex shader's o10 output register. (1 = o10 enabled, 0 = o10 disabled)
|
11
|
Enable bit for vertex shader's o11 output register. (1 = o11 enabled, 0 = o11 disabled)
|
12
|
Enable bit for vertex shader's o12 output register. (1 = o12 enabled, 0 = o12 disabled)
|
13
|
Enable bit for vertex shader's o13 output register. (1 = o13 enabled, 0 = o13 disabled)
|
14
|
Enable bit for vertex shader's o14 output register. (1 = o14 enabled, 0 = o14 disabled)
|
15
|
Enable bit for vertex shader's o15 output register. (1 = o15 enabled, 0 = o15 disabled)
|
This register toggles the vertex shader units' output registers.
GPUREG_VSH_CODETRANSFER_END
Bits
|
Description
|
0
|
Code data transfer end signal bit.
|
This register's value should be set to 1 in order to finalize the transfer of vertex shader code. It is unknown whether this register is used for other functions.
GPUREG_VSH_FLOATUNIFORM_CONFIG
Bits
|
Description
|
0-6
|
Target float vec4 vertex shader uniform ID for transfer. (range 0-95, where 0 = c0 and 95 = c95)
|
31
|
Float vec4 vertex shader uniform data transfer mode. (0 = float24, 1 = float32)
|
This register sets the target float vec4 vertex shader uniform ID and transfer mode for the data transfer system. As such it is typically used right before GPUREG_VSH_FLOATUNIFORM_DATA, though writing to one register does not make writing to the other mandatory.
GPUREG_VSH_FLOATUNIFORM_DATA
Bits
|
Description
|
0-31
|
Float vec4 vertex shader uniform data. (format depends on transfer mode, see below for details)
|
This register is used to set the value of float vec4 vertex shader uniform registers. The data format which should be written to it depends on the transfer mode set with GPUREG_VSH_FLOATUNIFORM_CONFIG. This register functions as a FIFO queue : after each time a uniform register is successfully set, the target uniform ID value is incremented, meaning that groups of uniforms with contiguous register IDs can be set with only one initial write to GPUREG_VSH_FLOATUNIFORM_CONFIG.
- In the case of float24 transfer mode, data should be sent by writing three words which are the concatenation of the float24 value of the uniform register's 4 components, in the reverse order. Assuming each letter corresponds to 4 bits, the format becomes :
- first word : ZZWWWWWW
- second word : YYYYZZZZ
- third word : XXXXXXYY
- In the case of float32 transfer mode, data should be sent by writing four words which are each the float32 value of the uniform register's 4 components, in the reverse order.
GPUREG_VSH_CODETRANSFER_CONFIG
Bits
|
Description
|
0-11
|
Target vertex shader code offset for data transfer.
|
This register is used to set the offset at which upcoming vertex shader code data transferred through GPUREG_VSH_CODETRANSFER_DATA should be written.
NOTE : as we do not yet know what a shader program's maximum size is yet, we also do not know how many bits the code offset parameter holds. The biggest shader binary observed so far was 2422 instructions long. The shader control flow instructions only have room to address 12 bits though, so it's likely that the maximum is 4095.
GPUREG_VSH_CODETRANSFER_DATA
Bits
|
Description
|
0-31
|
Vertex shader instruction data.
|
This register is used to transfer vertex shader code data. This register behaves as a FIFO queue : each write to this register writes the provided value to the GPU vertex shader code memory bank at the offset initially set by GPUREG_VSH_CODETRANSFER_CONFIG. The offset in question is incremented after each write to this register.
GPUREG_VSH_OPDESCS_CONFIG
Bits
|
Description
|
0-6
|
Target vertex shader operand descriptor offset for data transfer.
|
This register is used to set the offset at which upcoming vertex shader operand descriptor data transferred through GPUREG_VSH_OPDESCS_DATA should be written.
GPUREG_VSH_OPDESCS_DATA
Bits
|
Description
|
0-31
|
Vertex shader operand descriptor data.
|
This register is used to transfer vertex shader operand descriptor data. This register behaves as a FIFO queue : each write to this register writes the provided value to the GPU vertex shader operand descriptor memory bank at the offset initially set by GPUREG_VSH_OPDESCS_CONFIG. The offset in question is incremented after each write to this register.