• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. _depth-stencil-alpha:
2
3Depth, Stencil, & Alpha
4=======================
5
6These three states control the depth, stencil, and alpha tests, used to
7discard fragments that have passed through the fragment shader.
8
9Traditionally, these three tests have been clumped together in hardware, so
10they are all stored in one structure.
11
12During actual execution, the order of operations done on fragments is always:
13
14* Alpha
15* Stencil
16* Depth
17
18Depth Members
19-------------
20
21enabled
22    Whether the depth test is enabled.
23writemask
24    Whether the depth buffer receives depth writes.
25func
26    The depth test function. One of PIPE_FUNC.
27
28Stencil Members
29---------------
30
31enabled
32    Whether the stencil test is enabled. For the second stencil, whether the
33    two-sided stencil is enabled. If two-sided stencil is disabled, the other
34    fields for the second array member are not valid.
35func
36    The stencil test function. One of PIPE_FUNC.
37valuemask
38    Stencil test value mask; this is ANDed with the value in the stencil
39    buffer and the reference value before doing the stencil comparison test.
40writemask
41    Stencil test writemask; this controls which bits of the stencil buffer
42    are written.
43fail_op
44    The operation to carry out if the stencil test fails. One of
45    PIPE_STENCIL_OP.
46zfail_op
47    The operation to carry out if the stencil test passes but the depth test
48    fails. One of PIPE_STENCIL_OP.
49zpass_op
50    The operation to carry out if the stencil test and depth test both pass.
51    One of PIPE_STENCIL_OP.
52
53Alpha Members
54-------------
55
56enabled
57    Whether the alpha test is enabled.
58func
59    The alpha test function. One of PIPE_FUNC.
60ref_value
61    Alpha test reference value; used for certain functions.
62