VkCompareOp(3)

# VkCompareOp(3) Manual Page

## Name

VkCompareOp - Comparison operator for depth, stencil, and sampler operations

Loading… please wait.

## C Specification

Comparison operators compare a reference and a test value, and return a true (“passed”) or false (“failed”) value depending on the comparison operator chosen. The supported operators are:

    // Provided by VK_VERSION_1_0
    typedef enum VkCompareOp {
        VK_COMPARE_OP_NEVER = 0,
        VK_COMPARE_OP_LESS = 1,
        VK_COMPARE_OP_EQUAL = 2,
        VK_COMPARE_OP_LESS_OR_EQUAL = 3,
        VK_COMPARE_OP_GREATER = 4,
        VK_COMPARE_OP_NOT_EQUAL = 5,
        VK_COMPARE_OP_GREATER_OR_EQUAL = 6,
        VK_COMPARE_OP_ALWAYS = 7,
    } VkCompareOp;

## Description

- `VK_COMPARE_OP_NEVER` specifies that the comparison always evaluates false.

- `VK_COMPARE_OP_LESS` specifies that the comparison evaluates reference < test.

- `VK_COMPARE_OP_EQUAL` specifies that the comparison evaluates reference = test.

- `VK_COMPARE_OP_LESS_OR_EQUAL` specifies that the comparison evaluates reference ≤ test.

- `VK_COMPARE_OP_GREATER` specifies that the comparison evaluates reference > test.

- `VK_COMPARE_OP_NOT_EQUAL` specifies that the comparison evaluates reference ≠ test.

- `VK_COMPARE_OP_GREATER_OR_EQUAL` specifies that the comparison evaluates reference ≥ test.

- `VK_COMPARE_OP_ALWAYS` specifies that the comparison always evaluates true.

Comparison operators are used for:

- The Depth Compare Operation operator for a sampler, specified by VkSamplerCreateInfo::`compareOp`.

- The stencil comparison operator for the stencil test, specified by vkCmdSetStencilOp::`compareOp` or VkStencilOpState::`compareOp`.

- The Depth Comparison operator for the depth test, specified by vkCmdSetDepthCompareOp::`depthCompareOp` or VkPipelineDepthStencilStateCreateInfo::`depthCompareOp`.

Each such use describes how the reference and test values for that comparison are determined.

## See Also

VK_VERSION_1_0, VkPipelineDepthStencilStateCreateInfo, VkSamplerCreateInfo, VkStencilOpState, vkCmdSetDepthCompareOp, vkCmdSetDepthCompareOpEXT, vkCmdSetStencilOp, vkCmdSetStencilOpEXT

## Document Notes

For more information, see the Vulkan Specification

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

## Copyright

Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0