Line 209:
Line 209:
| u32
| u32
| glAlphaFunc()
| glAlphaFunc()
+
|-
+
| 0x0105
+
| u32
+
| Stencil test settings
+
|-
+
| 0x0106
+
| u32
+
| Stencil replacement operators
|-
|-
| 0x0107
| 0x0107
Line 1,212:
Line 1,220:
| GL_OR_INVERTED
| GL_OR_INVERTED
|}
|}
+
+
=== Parameter value format for command 0x0105 ===
+
This command controls stencil testing.
+
{| class="wikitable" border="1"
+
! Bit
+
! Description
+
|-
+
| 0
+
| Enable stencil test
+
|-
+
| 7-4
+
| Stencil test function (values same as for alpha and depth tests)
+
|-
+
| 15-8
+
| Replacement value, used as specified by command 0x0106
+
|-
+
| 23-16
+
| Reference value for the stencil test. Note that the test does "reference FUNC value".
+
|-
+
| 31-24
+
| Mask for the stencil test.
+
|}
+
+
=== Parameter value format for command 0x0106 ===
+
This command controls stencil buffer replacement.
+
{| class="wikitable" border="1"
+
! Bit
+
! Description
+
|-
+
| 2-0
+
| Action when the stencil test fails
+
|-
+
| 6-4
+
| Action when the stencil test passes but the depth test fails
+
|-
+
| 10-8
+
| Action when both stencil test and depth test pass
+
|}
+
+
Action values:
+
{| class="wikitable" border="1"
+
! Value
+
! Final stencil value
+
|-
+
| 0
+
| destination
+
|-
+
| 1
+
| destination & ~source
+
|-
+
| 2
+
| same as 1
+
|-
+
| 3
+
| same as 0
+
|-
+
| 4
+
| destination | source (although not quite. TODO: investigate this one)
+
|-
+
| 5
+
| destination ^ source
+
|-
+
| 6
+
| same as 0
+
|-
+
| 7
+
| same as 4
+
|}
+
'destination' is the value present in the stencil buffer, 'source' is the replacement value specified in command 0x0105.
=== Parameter structure for command 0x004D ===
=== Parameter structure for command 0x004D ===