Line 192:
Line 192:
| 0x0100
| 0x0100
| <nowiki>0x00E40000 | val</nowiki>.
| <nowiki>0x00E40000 | val</nowiki>.
−
| Val0 = unknown, val1 = unknown, val3 = unknown. The default val used here is 0.
+
| See command set 0x0100.
|-
|-
| 0x0101
| 0x0101
+
| u32
+
| See command set 0x0100.
+
|-
+
| 0x0102
| u32
| u32
| See command set 0x0100.
| See command set 0x0100.
Line 415:
Line 419:
| 0x0100
| 0x0100
| Value 0x00E40100
| Value 0x00E40100
−
| ?
+
| Controls color compositing
|-
|-
| 1
| 1
| 0x0101
| 0x0101
−
| 0x01010000 when disabled?
+
| 0x01010000 when disabled
−
| ?
+
| Alphablending equations and factors
|-
|-
| 2
| 2
| 0x0103
| 0x0103
| This is set to zero when the command 0x0101 parameter is value 0x01010000.
| This is set to zero when the command 0x0101 parameter is value 0x01010000.
−
| ?
+
| Constant color for alphablending
|}
|}
Line 1,015:
Line 1,019:
| Unused
| Unused
|}
|}
+
+
=== Parameter value format for command 0x0100 ===
+
This command controls color compositing. It is typically used right after commands 0x0101 or 0x0102 to select the appropriate blending mode.
+
+
Alphablending and color logic op can't be used together. Attempting to issue commands 0x0101 and 0x0102 at the same time can freeze the GPU.
+
+
For blending to work correctly, color buffer reading needs to be enabled (see command set 0x0112). Otherwise zero values will be used as destination color/alpha.
+
+
{| class="wikitable" border="1"
+
! Bit
+
! Description
+
|-
+
| 0
+
| Weird mode (see below)
+
|-
+
| 1
+
| When set, nothing is drawn to the color buffer. It is unknown if this also affects the depth and stencil buffers. This bit can cause a noisy picture when used with bit 0.
+
|-
+
| 8
+
| Selects blending mode. 0 = color logic op, 1 = alphablending
+
|-
+
| 23-20
+
| Unknown, typically set to 0xE4. No observed effect when changing this.
+
|-
+
| 25-24
+
| 0 = normal, 1-3 = apply dithering (3 = 0% source)
+
|}
+
+
When "weird mode" is enabled, the source color/alpha values are ignored. Instead, each 16-bit value in the destination color buffer is converted according to its bits 14-8, as follows:
+
* if bits 14-8 are between 0x00 and 0x03, the value is replaced with 0x0000
+
* if bits 14-8 are between 0x7D and 0x7F, the value is replaced with 0x7FFF
+
* in all other cases, the value is left unchanged
=== Parameter value format for command 0x0101 ===
=== Parameter value format for command 0x0101 ===
Line 1,111:
Line 1,147:
| 14
| 14
| GL_SRC_ALPHA_SATURATE
| GL_SRC_ALPHA_SATURATE
+
|}
+
+
=== Parameter value format for command 0x0102 ===
+
This command controls color logic op.
+
{| class="wikitable" border="1"
+
! Bit
+
! Description
+
|-
+
| 3-0
+
| Logic operation
+
|}
+
+
Source/destination factor values:
+
{| class="wikitable" border="1"
+
! Value
+
! Description
+
|-
+
| 0
+
| GL_CLEAR
+
|-
+
| 1
+
| GL_AND
+
|-
+
| 2
+
| GL_AND_REVERSE
+
|-
+
| 3
+
| GL_COPY
+
|-
+
| 4
+
| GL_SET
+
|-
+
| 5
+
| GL_COPY_INVERTED
+
|-
+
| 6
+
| GL_NOOP
+
|-
+
| 7
+
| GL_INVERT
+
|-
+
| 8
+
| GL_NAND
+
|-
+
| 9
+
| GL_OR
+
|-
+
| 10
+
| GL_NOR
+
|-
+
| 11
+
| GL_XOR
+
|-
+
| 12
+
| GL_EQUIV
+
|-
+
| 13
+
| GL_AND_INVERTED
+
|-
+
| 14
+
| GL_OR_REVERSE
+
|-
+
| 15
+
| GL_OR_INVERTED
|}
|}
Line 1,148:
Line 1,248:
|-
|-
| 0
| 0
−
| 0x0 = unknown, 0xF = unknown. Only bits 3-0 are used.(Values 0x1-0xF all have the same effect)
+
| Setting bits 3-0 to a nonzero value allows the GPU to read from the color buffer.
|-
|-
| 1
| 1