VKSTENCILOP(3)

NAME
VkStencilOp - stencil comparison function

C SPECIFICATION

As described earlier, the failOp, passOp, and depthFailOp members of VkStencilOpState indicate what happens to the stored stencil value if this or certain subsequent tests fail or pass. Each enum is of type VkStencilOp, which is defined as:

    typedef enum VkStencilOp {
        VK_STENCIL_OP_KEEP = 0,
        VK_STENCIL_OP_ZERO = 1,
        VK_STENCIL_OP_REPLACE = 2,
        VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3,
        VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4,
        VK_STENCIL_OP_INVERT = 5,
        VK_STENCIL_OP_INCREMENT_AND_WRAP = 6,
        VK_STENCIL_OP_DECREMENT_AND_WRAP = 7,
    } VkStencilOp;

DESCRIPTION

The possible values are:

    • VK_STENCIL_OP_KEEP keeps the current value.

    • VK_STENCIL_OP_ZERO sets the value to 0.

    • VK_STENCIL_OP_REPLACE sets the value to reference.

    • VK_STENCIL_OP_INCREMENT_AND_CLAMP increments the current value and clamps to the maximum representable unsigned value.

    • VK_STENCIL_OP_DECREMENT_AND_CLAMP decrements the current value and clamps to 0.

    • VK_STENCIL_OP_INVERT bitwise-inverts the current value.

    • VK_STENCIL_OP_INCREMENT_AND_WRAP increments the current value and wraps to 0 when the maximum value would have been exceeded.

    • VK_STENCIL_OP_DECREMENT_AND_WRAP decrements the current value and wraps to the maximum possible value when the value would go below 0.

For purposes of increment and decrement, the stencil bits are considered as an unsigned integer.

If the stencil test fails, the sample’s coverage bit is cleared in the fragment. If there is no stencil framebuffer attachment, stencil modification cannot occur, and it is as if the stencil tests always pass.

If the stencil test passes, the writeMask member of the VkStencilOpState structures controls how the updated stencil value is written to the stencil framebuffer attachment.

The least significant [ $s$ ] bits of writeMask, where [ $s$ ] is the number of bits in the stencil framebuffer attachment, specify an integer mask. Where a [ $1$ ] appears in this mask, the corresponding bit in the stencil value in the depth/stencil attachment is written; where a [ $0$ ] appears, the bit is not written. The writeMask value uses either the front-facing or back-facing state based on the facing-ness of the fragment. Fragments generated by front-facing primitives use the front mask and fragments generated by back-facing primitives use the back mask.

SEE ALSO

VkStencilOpState

DOCUMENT NOTES

For more information, see the Vulkan Specification at URL

https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#VkStencilOp

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification,not directly.

COPYRIGHT

Copyright (c) 2014-2016 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.

AUTHOR

Khronos Group
    Author.