Changes

6,426 bytes added ,  15:19, 13 September 2015
Fragment lighting, part 1
Line 761: Line 761:  
|-
 
|-
 
| 008F
 
| 008F
| [[#GPUREG_008F|GPUREG_008F]]
+
| [[#GPUREG_GPUREG_LIGHTING_ENABLE0|GPUREG_LIGHTING_ENABLE0]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_EN0
 
|PICA_REG_FRAG_LIGHT_EN0
Line 1,664: Line 1,664:  
|-
 
|-
 
| 0140
 
| 0140
| [[#GPUREG_0140|GPUREG_LIGHT0_SPECULAR0]]
+
| [[#GPUREG_LIGHTx_SPECULARy|GPUREG_LIGHT0_SPECULAR0]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_SPECULAR0 / PICA_REG_FRAG_LIGHT_START
 
|PICA_REG_FRAG_LIGHT0_SPECULAR0 / PICA_REG_FRAG_LIGHT_START
 
|-
 
|-
 
| 0141
 
| 0141
| [[#GPUREG_0141|GPUREG_LIGHT0_SPECULAR1]]
+
| [[#GPUREG_LIGHTx_SPECULARy|GPUREG_LIGHT0_SPECULAR1]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_SPECULAR1
 
|PICA_REG_FRAG_LIGHT0_SPECULAR1
 
|-
 
|-
 
| 0142
 
| 0142
| [[#GPUREG_0142|GPUREG_LIGHT0_DIFFUSE]]
+
| [[#GPUREG_LIGHTx_DIFFUSE|GPUREG_LIGHT0_DIFFUSE]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_DIFFUSE
 
|PICA_REG_FRAG_LIGHT0_DIFFUSE
 
|-
 
|-
 
| 0143
 
| 0143
| [[#GPUREG_0143|GPUREG_LIGHT0_AMBIENT]]
+
| [[#GPUREG_LIGHTx_AMBIENT|GPUREG_LIGHT0_AMBIENT]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_AMBIENT
 
|PICA_REG_FRAG_LIGHT0_AMBIENT
 
|-
 
|-
 
| 0144
 
| 0144
| [[#GPUREG_0144|GPUREG_LIGHT0_XY]]
+
| [[#GPUREG_LIGHTx_XY|GPUREG_LIGHT0_XY]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_POSITION_XY
 
|PICA_REG_FRAG_LIGHT0_POSITION_XY
 
|-
 
|-
 
| 0145
 
| 0145
| [[#GPUREG_0145|GPUREG_LIGHT0_Z]]
+
| [[#GPUREG_LIGHTx_Z|GPUREG_LIGHT0_Z]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_POSITION_Z
 
|PICA_REG_FRAG_LIGHT0_POSITION_Z
 
|-
 
|-
 
| 0146
 
| 0146
| [[#GPUREG_0146|GPUREG_LIGHT0_SPOTDIR_XY]]
+
| [[#GPUREG_LIGHTx_SPOTDIR_XY|GPUREG_LIGHT0_SPOTDIR_XY]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_SPOT_XY
 
|PICA_REG_FRAG_LIGHT0_SPOT_XY
 
|-
 
|-
 
| 0147
 
| 0147
| [[#GPUREG_0147|GPUREG_LIGHT0_SPOTDIR_Z]]
+
| [[#GPUREG_LIGHTx_SPOTDIR_Z|GPUREG_LIGHT0_SPOTDIR_Z]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_SPOT_Z
 
|PICA_REG_FRAG_LIGHT0_SPOT_Z
Line 1,709: Line 1,709:  
|-
 
|-
 
| 0149
 
| 0149
| [[#GPUREG_0149|GPUREG_LIGHT0_CONFIG]]
+
| [[#GPUREG_LIGHTx_CONFIG|GPUREG_LIGHT0_CONFIG]]
 
|  
 
|  
 
|PICA_REG_FRAG_LIGHT0_TYPE
 
|PICA_REG_FRAG_LIGHT0_TYPE
 
|-
 
|-
 
| 014A
 
| 014A
| [[#GPUREG_014A|GPUREG_LIGHT0_ATTENUATION_BIAS]]
+
| [[#GPUREG_LIGHTx_ATTENUATION_BIAS|GPUREG_LIGHT0_ATTENUATION_BIAS]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_DIST_ATTN_BIAS
 
|PICA_REG_FRAG_LIGHT0_DIST_ATTN_BIAS
 
|-
 
|-
 
| 014B
 
| 014B
| [[#GPUREG_014B|GPUREG_LIGHT0_ATTENUATION_SCALE]]
+
| [[#GPUREG_LIGHTx_ATTENUATION_SCALE|GPUREG_LIGHT0_ATTENUATION_SCALE]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT0_DIST_ATTN_SCALE
 
|PICA_REG_FRAG_LIGHT0_DIST_ATTN_SCALE
Line 2,304: Line 2,304:  
|-
 
|-
 
| 01C0
 
| 01C0
| [[#GPUREG_01C0|GPUREG_LIGHTING_AMBIENT]]
+
| [[#GPUREG_LIGHTING_AMBIENT|GPUREG_LIGHTING_AMBIENT]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_AMBIENT
 
|PICA_REG_FRAG_LIGHT_AMBIENT
Line 2,314: Line 2,314:  
|-
 
|-
 
| 01C2
 
| 01C2
| [[#GPUREG_01C2|GPUREG_LIGHTING_NUM_LIGHTS]]
+
| [[#GPUREG_LIGHTING_NUM_LIGHTS|GPUREG_LIGHTING_NUM_LIGHTS]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_SRC_NUM
 
|PICA_REG_FRAG_LIGHT_SRC_NUM
 
|-
 
|-
 
| 01C3
 
| 01C3
| [[#GPUREG_01C3|GPUREG_LIGHTING_CONFIG0]]
+
| [[#GPUREG_LIGHTING_CONFIG0|GPUREG_LIGHTING_CONFIG0]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_FUNC_MODE0
 
|PICA_REG_FRAG_LIGHT_FUNC_MODE0
 
|-
 
|-
 
| 01C4
 
| 01C4
| [[#GPUREG_01C4|GPUREG_LIGHTING_CONFIG1]]
+
| [[#GPUREG_LIGHTING_CONFIG1|GPUREG_LIGHTING_CONFIG1]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_FUNC_MODE1
 
|PICA_REG_FRAG_LIGHT_FUNC_MODE1
 
|-
 
|-
 
| 01C5
 
| 01C5
| [[#GPUREG_01C5|GPUREG_LIGHTING_LUT_INDEX]]
+
| [[#GPUREG_LIGHTING_LUT_INDEX|GPUREG_LIGHTING_LUT_INDEX]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT
 
|PICA_REG_FRAG_LIGHT_LUT
 
|-
 
|-
 
| 01C6
 
| 01C6
| [[#GPUREG_01C6|GPUREG_LIGHTING_ENABLE1]]
+
| [[#GPUREG_LIGHTING_ENABLE1|GPUREG_LIGHTING_ENABLE1]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_EN1
 
|PICA_REG_FRAG_LIGHT_EN1
Line 2,344: Line 2,344:  
|-
 
|-
 
| 01C8
 
| 01C8
| [[#GPUREG_01C8|GPUREG_LIGHTING_LUT_DATA]]
+
| [[#GPUREG_LIGHTING_LUT_DATA|GPUREG_LIGHTING_LUT_DATA]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT_DATA0
 
|PICA_REG_FRAG_LIGHT_LUT_DATA0
 
|-
 
|-
 
| 01C9
 
| 01C9
| [[#GPUREG_01C9|GPUREG_LIGHTING_LUT_DATA]]
+
| [[#GPUREG_LIGHTING_LUT_DATA|GPUREG_LIGHTING_LUT_DATA]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT_DATA1
 
|PICA_REG_FRAG_LIGHT_LUT_DATA1
 
|-
 
|-
 
| 01CA
 
| 01CA
| [[#GPUREG_01CA|GPUREG_LIGHTING_LUT_DATA]]
+
| [[#GPUREG_LIGHTING_LUT_DATA|GPUREG_LIGHTING_LUT_DATA]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT_DATA2
 
|PICA_REG_FRAG_LIGHT_LUT_DATA2
 
|-
 
|-
 
| 01CB
 
| 01CB
| [[#GPUREG_01CB|GPUREG_LIGHTING_LUT_DATA]]
+
| [[#GPUREG_LIGHTING_LUT_DATA|GPUREG_LIGHTING_LUT_DATA]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT_DATA3
 
|PICA_REG_FRAG_LIGHT_LUT_DATA3
 
|-
 
|-
 
| 01CC
 
| 01CC
| [[#GPUREG_01CC|GPUREG_LIGHTING_LUT_DATA]]
+
| [[#GPUREG_LIGHTING_LUT_DATA|GPUREG_LIGHTING_LUT_DATA]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT_DATA4
 
|PICA_REG_FRAG_LIGHT_LUT_DATA4
 
|-
 
|-
 
| 01CD
 
| 01CD
| [[#GPUREG_01CD|GPUREG_LIGHTING_LUT_DATA]]
+
| [[#GPUREG_LIGHTING_LUT_DATA|GPUREG_LIGHTING_LUT_DATA]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT_DATA5
 
|PICA_REG_FRAG_LIGHT_LUT_DATA5
 
|-
 
|-
 
| 01CE
 
| 01CE
| [[#GPUREG_01CE|GPUREG_LIGHTING_LUT_DATA]]
+
| [[#GPUREG_LIGHTING_LUT_DATA|GPUREG_LIGHTING_LUT_DATA]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT_DATA6
 
|PICA_REG_FRAG_LIGHT_LUT_DATA6
 
|-
 
|-
 
| 01CF
 
| 01CF
| [[#GPUREG_01CF|GPUREG_LIGHTING_LUT_DATA]]
+
| [[#GPUREG_LIGHTING_LUT_DATA|GPUREG_LIGHTING_LUT_DATA]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUT_DATA7
 
|PICA_REG_FRAG_LIGHT_LUT_DATA7
 
|-
 
|-
 
| 01D0
 
| 01D0
| [[#GPUREG_01D0|GPUREG_LIGHTING_LUTINPUT_ABS]]
+
| [[#GPUREG_LIGHTING_LUTINPUT_ABS|GPUREG_LIGHTING_LUTINPUT_ABS]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_ABSLUTINPUT
 
|PICA_REG_FRAG_LIGHT_ABSLUTINPUT
 
|-
 
|-
 
| 01D1
 
| 01D1
| [[#GPUREG_01D1|GPUREG_LIGHTING_LUTINPUT_SELECT]]
+
| [[#GPUREG_LIGHTING_LUTINPUT_SELECT|GPUREG_LIGHTING_LUTINPUT_SELECT]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUTINPUT
 
|PICA_REG_FRAG_LIGHT_LUTINPUT
 
|-
 
|-
 
| 01D2
 
| 01D2
| [[#GPUREG_01D2|GPUREG_LIGHTING_LUTINPUT_SCALE]]
+
| [[#GPUREG_LIGHTING_LUTINPUT_SCALE|GPUREG_LIGHTING_LUTINPUT_SCALE]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_LUTSCALE
 
|PICA_REG_FRAG_LIGHT_LUTSCALE
Line 2,429: Line 2,429:  
|-
 
|-
 
| 01D9
 
| 01D9
| [[#GPUREG_01D9|GPUREG_LIGHTING_LIGHT_PERMUTATION]]
+
| [[#GPUREG_LIGHTING_LIGHT_PERMUTATION|GPUREG_LIGHTING_LIGHT_PERMUTATION]]
 
|?
 
|?
 
|PICA_REG_FRAG_LIGHT_SRC_EN_ID
 
|PICA_REG_FRAG_LIGHT_SRC_EN_ID
Line 4,001: Line 4,001:  
== Fragment lighting registers ==
 
== Fragment lighting registers ==
   −
=== GPUREG_01C4 ===
+
=== 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 ===
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 4,008: Line 4,016:  
|-
 
|-
 
| 0
 
| 0
| Disable bit for frag light source 0 shadows
+
| Shadow factor enable, usually set to bit16 OR bit18 OR bit19
 
|-
 
|-
 
| 1
 
| 1
| Disable bit for frag light source 1 shadows
+
| Unknown, set to 0
 
|-
 
|-
| 2
+
| 2-3
| Disable bit for frag light source 2 shadows
+
| "Fresnel selector" (see below)
 
|-
 
|-
| 3
+
| 4-7
| Disable bit for frag light source 3 shadows
+
| "Config", "Light env config" (see below)
 
|-
 
|-
| 4
+
| 8-15
| Disable bit for frag light source 4 shadows
+
| Unknown, set to 4
 
|-
 
|-
| 5
+
| 16
| Disable bit for frag light source 5 shadows
+
| "Shadow primary", 0=disabled, 1=enabled
 
|-
 
|-
| 6
+
| 17
| Disable bit for frag light source 6 shadows
+
| "Shadow secondary", 0=disabled, 1=enabled
 
|-
 
|-
| 7
+
| 18
| Disable bit for frag light source 7 shadows
+
| "Invert shadow", 0=disabled, 1=enabled
 
|-
 
|-
| 8
+
| 19
| Disable bit for frag light source 0 spot
+
| "Shadow alpha", 0=disabled, 1=enabled
 
|-
 
|-
| 9
+
| 20-21
| Disable bit for frag light source 1 spot
+
| Unknown, set to 0
 
|-
 
|-
| 10
+
| 22-23
| Disable bit for frag light source 2 spot
+
| "Bump selector"
 
|-
 
|-
| 11
+
| 24-25
| Disable bit for frag light source 3 spot
+
| "Shadow selector"
 
|-
 
|-
| 12
+
| 26
| Disable bit for frag light source 4 spot
+
| Unknown, set to 0
 
|-
 
|-
| 13
+
| 27
| Disable bit for frag light source 5 spot
+
| "Clamp highlights", 0=disabled, 1=enabled
 
|-
 
|-
| 14
+
| 28-29
| Disable bit for frag light source 6 spot
+
| "Bump mode", "Light env texy usage" (see below)
 
|-
 
|-
| 15
+
| 30
| Disable bit for frag light source 7 spot
+
| "Bump renorm", 0=enabled, 1=disabled
 
|-
 
|-
| 24
+
| 31
| Disable bit for frag light source 0 distance attenuation
+
| Unknown, set to 1
 +
|}
 +
 
 +
Fresnel selector constants:
 +
 
 +
{| class="wikitable" border="1"
 +
! Value
 +
! Description
 +
|-
 +
| 0
 +
| NO_FRESNEL
 +
|-
 +
| 1
 +
| PRI_ALPHA_FRESNEL
 
|-
 
|-
| 25
+
| 2
| Disable bit for frag light source 1 distance attenuation
+
| SEC_ALPHA_FRESNEL
 
|-
 
|-
| 26
+
| 3
| Disable bit for frag light source 2 distance attenuation
+
| PRI_SEC_ALPHA_FRESNEL
 +
|}
 +
 
 +
Light env config constants:
 +
 
 +
{| class="wikitable" border="1"
 +
! Value
 +
! Description
 
|-
 
|-
| 27
+
| 0
| Disable bit for frag light source 3 distance attenuation
+
| LIGHT_ENV_LAYER_CONFIG0
 
|-
 
|-
| 28
+
| 1
| Disable bit for frag light source 4 distance attenuation
+
| LIGHT_ENV_LAYER_CONFIG1
 
|-
 
|-
| 29
+
| 2
| Disable bit for frag light source 5 distance attenuation
+
| LIGHT_ENV_LAYER_CONFIG2
 
|-
 
|-
| 30
+
| 3
| Disable bit for frag light source 6 distance attenuation
+
| LIGHT_ENV_LAYER_CONFIG3
 
|-
 
|-
| 31
+
| 4
 +
| LIGHT_ENV_LAYER_CONFIG4
 +
|-
 +
| 5
 +
| LIGHT_ENV_LAYER_CONFIG5
 +
|-
 +
| 6
 +
| LIGHT_ENV_LAYER_CONFIG6
 +
|-
 +
| 8 (sic)
 +
| LIGHT_ENV_LAYER_CONFIG7
 +
|}
 +
 
 +
Bump mode constants:
 +
 
 +
{| class="wikitable" border="1"
 +
! 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 ===
 +
 
 +
{| class="wikitable" border="1"
 +
! 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
 
| Disable bit for frag light source 7 distance attenuation
 +
|}
 +
 +
=== GPUREG_LIGHTING_NUM_LIGHTS ===
 +
 +
The number of active lights (0..8) are written to this register.
 +
 +
=== GPUREG_LIGHTING_LIGHT_PERMUTATION ===
 +
 +
{| class="wikitable" border="1"
 +
! 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 ===
 +
 +
{| class="wikitable" border="1"
 +
! 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
 +
|-
 +
| 28-31
 +
| Input selector for lut_DA
 +
|}
 +
 +
Input selector values:
 +
 +
{| class="wikitable" border="1"
 +
! 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 ===
 +
 +
{| class="wikitable" border="1"
 +
! Bits
 +
! Description
 +
|-
 +
| 0
 +
| abs() flag for the input of lut_D0 (0=enabled, 1=disabled)
 +
|-
 +
| 1
 +
| abs() flag for the input of lut_D1 (0=enabled, 1=disabled)
 +
|-
 +
| 2
 +
| abs() flag for the input of lut_SP (0=enabled, 1=disabled)
 +
|-
 +
| 3
 +
| abs() flag for the input of lut_FR (0=enabled, 1=disabled)
 +
|-
 +
| 4
 +
| abs() flag for the input of lut_RB (0=enabled, 1=disabled)
 +
|-
 +
| 5
 +
| abs() flag for the input of lut_RG (0=enabled, 1=disabled)
 +
|-
 +
| 6
 +
| abs() flag for the input of lut_RR (0=enabled, 1=disabled)
 +
|-
 +
| 7
 +
| abs() flag for the input of lut_DA (0=enabled, 1=disabled)
 +
|}
 +
 +
This register controls whether the absolute value of the input is taken before using a LUT.
 +
 +
=== GPUREG_LIGHTING_LUTINPUT_SCALE ===
 +
 +
{| class="wikitable" border="1"
 +
! 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
 +
|-
 +
| 28-31
 +
| Scaler selector for lut_DA
 +
|}
 +
 +
Scaler selector values:
 +
 +
{| class="wikitable" border="1"
 +
! 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 (or maybe the input?) of a LUT.
 +
 +
=== GPUREG_LIGHTING_LUT_INDEX ===
 +
 +
{| class="wikitable" border="1"
 +
! 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:
 +
 +
{| class="wikitable" border="1"
 +
! Value
 +
! Description
 +
|-
 +
| 0
 +
| lut_D0
 +
|-
 +
| 1
 +
| lut_D1
 +
|-
 +
| 3
 +
| lut_FR
 +
|-
 +
| 4
 +
| lut_RB
 +
|-
 +
| 5
 +
| lut_RG
 +
|-
 +
| 6
 +
| lut_RR
 +
|}
 +
 +
Context ID values:
 +
 +
{| class="wikitable" border="1"
 +
! 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.
 +
 +
Format of an entry:
 +
 +
{| class="wikitable" border="1"
 +
! 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 (11bit fractional number; floatval = x / 2048; however 0x7FF is treated as 1.0)
 +
|-
 +
| 23
 +
| Sign bit of the difference (0=positive, 1=negative)
 
|}
 
|}