Changes

Jump to navigation Jump to search
774 bytes added ,  07:54, 4 December 2015
== Fragment lighting registers ==
=== GPUREG_LIGHTING_ENABLE0 GPUREG_LIGHT''i''_SPECULAR0 ===
This register is {| class="wikitable" border="1"! Bits! Description|-| 0-7| unsigned, Blue|-| 10-17| unsigned, Green|-| 20-27| unsigned, Red|} These registers contain the specular0 color of the corresponding light. Usually set to material_specular0*lightX_specular0. === GPUREG_LIGHT''i''_SPECULAR1 ===  {| class="wikitable" border="1"! Bits! Description|-| 0 when fragment lighting is disabled-7| unsigned, Blue|-| 10-17| unsigned, Green|-| 20-27| unsigned, and Red|} These registers contain the specular1 color of the corresponding light. Usually set to material_specular1*lightX_specular1. === GPUREG_LIGHT''i''_DIFFUSE === {| class="wikitable" border="1 when it is enabled"! Bits! Description|-| 0-7| unsigned, Blue|-| 10-17| unsigned, Green|-| 20-27| unsigned, Red|} These registers contain the diffuse color of the corresponding light. Usually set to material_diffuse*lightX_diffuse=== GPUREG_LIGHT''i''_AMBIENT ===
{| class="wikitable" border="1"! Bits! Description|-| 0-7| unsigned, Blue|-| 10-17| unsigned, Green|-| 20-27| unsigned, Red|} These registers contain the ambient color of the corresponding light. Usually set to material_ambient*lightX_ambient. = GPUREG_LIGHTING_ENABLE1 ==GPUREG_LIGHT''i''_XY === {| class="wikitable" border="1"! Bits! Description|-| 0-15| float1.5.10, X coordinate|-| 16-31| float1.5.10, Y coordinate|} 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_LIGHT''i''_Z === {| class="wikitable" border="1"! Bits! Description|-| 0-15| float1.5.10, Z coordinate|} 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_LIGHT''i''_SPOTDIR_XY === {| class="wikitable" border="1"! Bits! Description|-| 0-12| fixed1.1.11, X coordinate (Usually the input value is negated)|-| 16-28| fixed1.1.11, Y coordinate (Usually the input value is negated)|} These registers (along with _Z) represent the spot direction (unitary) vector of the corresponding light. === GPUREG_LIGHT''i''_SPOTDIR_Z === {| class="wikitable" border="1"! Bits! Description|-| 0-12| fixed1.1.11, Z coordinate (Usually the input value is negated)|}
This register is set to 1 when fragment lighting is disabled, and to 0 when it is enabledThese registers (along with _XY) represent the spot direction (unitary) vector of the corresponding light.
=== GPUREG_LIGHTING_CONFIG0 GPUREG_LIGHT''i''_CONFIG ===
{| class="wikitable" border="1"
|-
| 0
| unsigned, Shadow factor enableLight type (0 = positional light, usually set to bit16 OR bit18 OR bit191 = directional light)
|-
| 1
| Unknownunsigned, Two side diffuse (0 = one side, 1 = both sides)|-| 2| unsigned, Use geometric factor 0 (0 = don't use, 1 = use)|-| 3| unsigned, Use geometric factor 1 (0 = don't use, 1 = use)|} === GPUREG_LIGHT''i''_ATTENUATION_BIAS === {| class="wikitable" border="1"! Bits! Description|-| 0-19| float1.7.12, Distance attenuation bias|} 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)). === GPUREG_LIGHT''i''_ATTENUATION_SCALE === {| class="wikitable" border="1"! Bits! Description|-| 0-19| float1.7.12, Distance attenuation scale|} 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)). === GPUREG_LIGHTING_AMBIENT === {| class="wikitable" border="1"! Bits! Description|-| 0-7| unsigned, Blue|-| 10-17| unsigned, Green|-| 20-27| unsigned, Red|} 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_LIGHTING_NUM_LIGHTS === {| class="wikitable" border="1"! Bits! Description|-| 0-2| unsigned, Number of active lights - 1|} === GPUREG_LIGHTING_CONFIG0 === {| class="wikitable" border="1"! Bits! Description|-| 0| unsigned, Shadow factor enabled (0= disabled, 1 = enabled) (usually accompanied by bit 16, 17, or 18)
|-
| 2-3
| unsigned, "Fresnel selector" (see below)
|-
| 4-7
| unsigned, "Config", "Light env config" (see below)environment configuration
|-
| 8-1511| Unknown, set to 40x4
|-
| 16
| unsigned, "Shadow Apply shadow attenuation to primary", color (0=disableddon't apply, 1=enabledapply)
|-
| 17
| unsigned, "Shadow Apply shadow attenuation to secondary", color (0=disableddon't apply, 1=enabledapply)
|-
| 18
| unsigned, "Invert shadow", attenuation (0=disableddon't invert, 1=enabledinvert)
|-
| 19
| unsigned, "Shadow Apply shadow attenuation to alpha", component (0=disableddon't apply, 1=enabled|-| 20-21| Unknown, set to 0apply)
|-
| 22-23
| unsigned, "Bump selector", map texture unit for bumpmapping
|-
| 24-25
| unsigned, "Shadow selector", map texture unit for shadow mapping|-| 26| Unknown, set to 0
|-
| 27
| unsigned, "Clamp highlights", (0=disabled, 1=enabled)
|-
| 28-29
| unsigned, "Bump mode", "Light env texy usage" (see below)
|-
| 30
| unsigned, "Bump renorm", Recalculate bump vectors (0=enabled, 1=disabled) (usually set to 1 when bump mode is not 0)
|-
| 31
| Unknown, set to 10x1
|}
Fresnel selector constantsvalues:
{| class="wikitable" border="1"
|-
| 0
| NO_FRESNELNone
|-
| 1
| PRI_ALPHA_FRESNELPrimary alpha
|-
| 2
| SEC_ALPHA_FRESNELSecondary alpha
|-
| 3
| PRI_SEC_ALPHA_FRESNELPrimary and secondary alpha
|}
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 RR is enabled but not lut_RG RG or lut_RBRB, the output of lut_RR RR is used for the three components; Red, Green and Blue.
Light env config constantsenvironment configuration values:
{| class="wikitable" border="1"
|-
| 0
| LIGHT_ENV_LAYER_CONFIG0Configuration 0| lut_D0D0, lut_RRRR, lut_SPSP, lut_DADA
|-
| 1
| LIGHT_ENV_LAYER_CONFIG1Configuration 1| lut_FRFR, lut_RRRR, lut_SPSP, lut_DADA
|-
| 2
| LIGHT_ENV_LAYER_CONFIG2Configuration 2| lut_D0D0, lut_D1D1, lut_RRRR, lut_DADA
|-
| 3
| LIGHT_ENV_LAYER_CONFIG3Configuration 3| lut_D0D0, lut_D1D1, lut_FRFR, lut_DADA
|-
| 4
| LIGHT_ENV_LAYER_CONFIG4Configuration 4| All except for lut_FRFR
|-
| 5
| LIGHT_ENV_LAYER_CONFIG5Configuration 5| All except for lut_D1D1
|-
| 6
| LIGHT_ENV_LAYER_CONFIG6Configuration 6| All except for lut_RB RB and lut_RGRG
|-
| 8 (sic)| LIGHT_ENV_LAYER_CONFIG7Configuration 7
| All
|}
Bump mode constantsvalues:
{| class="wikitable" border="1"
|-
| 0
| BUMP_NOT_USEDNot used
|-
| 1
| BUMP_AS_BUMPUse as bump map
|-
| 2
| BUMP_AS_TANGUse as tangent map
|}
 
Bit 30 is set when bump mode is not zero.
=== GPUREG_LIGHTING_CONFIG1 ===
|-
| 0
| unsigned, Disable bit for frag Fragment light source 0 shadowsdisabled (0 = enabled, 1 = disabled)
|-
| 1
| unsigned, Disable bit for frag Fragment light source 1 shadowsdisabled (0 = enabled, 1 = disabled)
|-
| 2
| unsigned, Disable bit for frag Fragment light source 2 shadowsdisabled (0 = enabled, 1 = disabled)
|-
| 3
| unsigned, Disable bit for frag Fragment light source 3 shadowsdisabled (0 = enabled, 1 = disabled)
|-
| 4
| unsigned, Disable bit for frag Fragment light source 4 shadowsdisabled (0 = enabled, 1 = disabled)
|-
| 5
| unsigned, Disable bit for frag Fragment light source 5 shadowsdisabled (0 = enabled, 1 = disabled)
|-
| 6
| unsigned, Disable bit for frag Fragment light source 6 shadowsdisabled (0 = enabled, 1 = disabled)
|-
| 7
| unsigned, Disable bit for frag Fragment light source 7 shadowsdisabled (0 = enabled, 1 = disabled)
|-
| 8
| unsigned, Disable bit for frag Fragment light source 0 spotlight disabled (0 = enabled, 1 = disabled)
|-
| 9
| unsigned, Disable bit for frag Fragment light source 1 spotlight disabled (0 = enabled, 1 = disabled)
|-
| 10
| unsigned, Disable bit for frag Fragment light source 2 spotlight disabled (0 = enabled, 1 = disabled)
|-
| 11
| unsigned, Disable bit for frag Fragment light source 3 spotlight disabled (0 = enabled, 1 = disabled)
|-
| 12
| unsigned, Disable bit for frag Fragment light source 4 spotlight disabled (0 = enabled, 1 = disabled)
|-
| 13
| unsigned, Disable bit for frag Fragment light source 5 spotlight disabled (0 = enabled, 1 = disabled)
|-
| 14
| unsigned, Disable bit for frag Fragment light source 6 spotlight disabled (0 = enabled, 1 = disabled)
|-
| 15
| unsigned, Disable bit for frag Fragment light source 7 spotlight disabled (0 = enabled, 1 = disabled)
|-
| 16
| unsigned, Disable bit for lut_D0Term 0 distribution component D0 LUT disabled (0 = enabled, 1 = disabled)
|-
| 17
| unsigned, Disable bit for lut_D1Term 1 distribution component D1 LUT disabled (0 = enabled, 1 = disabled)
|-
| 18
| Unknown, set to 10x1
|-
| 19
| unsigned, Disable bit for lut_FRFresnel FR LUT disabled (0 = enabled, 1 = disabled)
|-
| 20-22| unsigned, Disable bit for lut_RBTerm 1 reflection component RB LUT disabled (0 = enabled, 7 = disabled)
|-
| 21
| unsigned, Disable bit for lut_RGTerm 1 reflection component RG LUT disabled (0 = enabled, 7 = disabled)
|-
| 22
| unsigned, Disable bit for lut_RR|-| 23| UnknownTerm 1 reflection component RR LUT disabled (0 = enabled, set to 17 = disabled)
|-
| 24
| unsigned, Disable bit for frag Fragment light source 0 distance attenuationdisabled (0 = enabled, 1 = disabled)
|-
| 25
| unsigned, Disable bit for frag Fragment light source 1 distance attenuationdisabled (0 = enabled, 1 = disabled)
|-
| 26
| unsigned, Disable bit for frag Fragment light source 2 distance attenuationdisabled (0 = enabled, 1 = disabled)
|-
| 27
| unsigned, Disable bit for frag Fragment light source 3 distance attenuationdisabled (0 = enabled, 1 = disabled)
|-
| 28
| unsigned, Disable bit for frag Fragment light source 4 distance attenuationdisabled (0 = enabled, 1 = disabled)
|-
| 29
| unsigned, Disable bit for frag Fragment light source 5 distance attenuationdisabled (0 = enabled, 1 = disabled)
|-
| 30
| unsigned, Disable bit for frag Fragment light source 6 distance attenuationdisabled (0 = enabled, 1 = disabled)
|-
| 31
| unsigned, Disable bit for frag Fragment light source 7 distance attenuationdisabled (0 = enabled, 1 = disabled)
|}
=== GPUREG_LIGHTING_NUM_LIGHTS GPUREG_LIGHTING_LUT_INDEX === {| class="wikitable" border="1"! Bits! Description|-| 0-7| unsigned, Starting index|-| 8-12| unsigned, Look-up table|}
The number of active lights minus one (0..7) is written This register controls which LUT and what offset into it the LUT_DATA register writes to this register.
=== GPUREG_LIGHTING_LIGHT_PERMUTATION ===Lookup table values:
{| class="wikitable" border="1"
! BitsValue
! Description
|-
| 0-2| unsigned, ID of the 1st enabled light (0..7)D0
|-
| 4-61| unsigned, ID of the 2nd enabled light (0..7)D1
|-
| 8-103| unsigned, ID of the 3rd enabled light (0..7)FR
|-
| 12-144| unsigned, ID of the 4th enabled light (0..7)RB
|-
| 16-185| unsigned, ID of the 5th enabled light (0..7)RG
|-
| 20-226| unsigned, ID of the 6th enabled light (0..7)RR
|-
| 248-2615| unsigned, ID of the 7th enabled light (0..SP0-7)
|-
| 2816-3023| unsigned, ID of the 8th enabled light (0..DA0-7)
|}
=== GPUREG_LIGHTING_LUTINPUT_SELECT GPUREG_LIGHTING_ENABLE1 ===
{| class="wikitable" border="1"
! Description
|-
| 0-3| unsigned, Input selector for lut_D0Disabled (0 = enabled, 1 = disabled)|-}| 4-7| unsignedThis register is set to 1 when fragment lighting is disabled, Input selector for lut_D1and to 0 when it is enabled. === GPUREG_LIGHTING_LUT_DATA''i'' === {|-class="wikitable" border="1"| 8-11! Bits| unsigned, Input selector for lut_SP! Description
|-
| 12-15| unsigned, Input selector for lut_FR|-| 16-19| unsigned, Input selector for lut_RB|-| 200-23| unsigned, Input selector for lut_RG|-| 24-27| unsigned, Input selector for lut_RRLUT data
|}
Input selector valuesLighting 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. 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:
{| class="wikitable" border="1"
! ValueBits
! Description
|-
| 0-11| N·Hfixed0.0.12, Entry value
|-
| 1| V·H|-| 2| N·V|-| 3| L·N|-| 4| 12-L·P (aka Spotlight aka SP)|-| 523| cos φ (aka CP)fixed1.0.11, Absolute value of the difference between the next entry and this entry, used to implement linear interpolation
|}
|-
| 1
| unsigned, abs() flag for the input of lut_D0 D0 (0=enabled, 1=disabled)
|-
| 5
| unsigned, abs() flag for the input of lut_D1 D1 (0=enabled, 1=disabled)
|-
| 9
| unsigned, abs() flag for the input of lut_SP SP (0=enabled, 1=disabled)
|-
| 13
| unsigned, abs() flag for the input of lut_FR FR (0=enabled, 1=disabled)
|-
| 17
| unsigned, abs() flag for the input of lut_RB RB (0=enabled, 1=disabled)
|-
| 21
| unsigned, abs() flag for the input of lut_RG RG (0=enabled, 1=disabled)
|-
| 25
| unsigned, abs() flag for the input of lut_RR 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 GPUREG_LIGHTING_LUTINPUT_SELECT ===
{| class="wikitable" border="1"
! Description
|-
| 0-32| unsigned, Scaler Input selector for lut_D0D0
|-
| 4-76| unsigned, Scaler Input selector for lut_D1D1
|-
| 8-1110| unsigned, Scaler Input selector for lut_SPSP
|-
| 12-1514| unsigned, Scaler Input selector for lut_FRFR
|-
| 16-1918| unsigned, Scaler Input selector for lut_RBRB
|-
| 20-2322| unsigned, Scaler Input selector for lut_RGRG
|-
| 24-2726| unsigned, Scaler Input selector for lut_RRRR
|}
Scaler Input selector values:
{| class="wikitable" border="1"
|-
| 0
| 1xN·H
|-
| 1
| 2xV·H
|-
| 2
| 4xN·V
|-
| 3
| 8xL·N
|-
| 64| 0.25x-L·P (aka Spotlight aka SP)
|-
| 75| 0.5xcos φ (aka CP)
|}
This register controls the scaling that is applied to the output of a LUT. === GPUREG_LIGHTING_LUT_INDEX GPUREG_LIGHTING_LUTINPUT_SCALE === This register controls which LUT and what offset into it the LUT_DATA register writes to.
{| class="wikitable" border="1"
! Description
|-
| 0-72| unsigned, Starting entry offset (0...255)Scaler selector for D0|-| 4-6| unsigned, Scaler selector for D1
|-
| 8-10
| unsigned, LUT ID (context=0) or Light ID (context=1,2)Scaler selector for SP
|-
| 1112-1214| unsigned, Context ID|} LUT ID values: {| class="wikitable" border="1"! Value! DescriptionScaler selector for FR
|-
| 016-18| lut_D0unsigned, Scaler selector for RB
|-
| 120-22| lut_D1unsigned, Scaler selector for RG
|-
| 3| lut_FR|-| 4| lut_RB|-| 5| lut_RG|24-26| 6| lut_RRunsigned, Scaler selector for RR
|}
Context ID This register controls the scaling that is applied to the output of a LUT. Scaler selector values:
{| class="wikitable" border="1"
|-
| 0
| unsigned, LUTs common to all lights - writes to the LUT selected by the ID1x
|-
| 1
| unsigned, lut_SP - writes to the LUT specific to the selected light2x
|-
| 2
| unsigned, 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: {| class="wikitable" border="1"! Bits! Description4x
|-
| 0-113| fixed0.0.12, Entry value (12bit fractional number; floatval = x / 4096; however 0xFFF is treated as 1.0)8x
|-
| 12-236| fixed1.0.11, Absolute value of the difference between the next entry and this entry, used to implement linear interpolation|} === GPUREG_LIGHTING_AMBIENT === {| class="wikitable" border="1"! Bits! Description25x
|-
| 0-7| unsigned, Blue component (0..255)|-| 10-17| unsigned, Green component (0..255)|-| 20-27| unsigned, Red component (0..255)5x
|}
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 GPUREG_LIGHTING_LIGHT_PERMUTATION ===
{| class="wikitable" border="1"
! Description
|-
| 0-2| unsigned, Light type (0 = positional ID of the 1st enabled light, 1 = directional light)
|-
| 14-6| unsigned, Two side diffuse (0=disable, 1=enable)ID of the 2nd enabled light
|-
| 28-10| unsigned, Geometric factor 0 (0=disable, 1=enable)ID of the 3rd enabled light
|-
| 312-14| unsigned, Geometric factor 1 (0=disable, 1=enable)|} === GPUREG_LIGHTx_XY === {| class="wikitable" border="1"! Bits! DescriptionID of the 4th enabled light
|-
| 016-1518| float1.5.10unsigned, X coordinateID of the 5th enabled light
|-
| 1620-3122| float1.5.10unsigned, Y coordinate|} These registers (along with _Z) represent the light position (for a positional light) or the light direction vector (for a directional light) ID of the corresponding 6th enabled light. === GPUREG_LIGHTx_Z === {| class="wikitable" border="1"! Bits! Description
|-
| 024-1526| float1.5.10unsigned, Z coordinate|} These registers (along with _XY) represent the light position (for a positional light) or the light direction vector (for a directional light) ID of the corresponding 7th enabled light. === GPUREG_LIGHTx_SPOTDIR_XY === {| class="wikitable" border="1"! Bits! Description
|-
| 0-12| fixed1.1.11, X coordinate (Usually the input value is negated)|-| 1628-2830| fixed1.1.11unsigned, Y coordinate (Usually ID of the input value is negated)8th enabled light
|}
 
These registers (along with _Z) represent the spot direction (unitary) vector of the corresponding light.
 
=== GPUREG_LIGHTx_SPOTDIR_Z ===
 
{| class="wikitable" border="1"
! Bits
! Description
|-
| 0-12
| fixed1.1.11, Z coordinate (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 ==
1,291

edits

Navigation menu