> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# D3D12_COMPARISON_FUNC

> Specifies comparison options.

Specifies comparison options.

## Syntax

```cpp theme={null}
typedef enum D3D12_COMPARISON_FUNC
{
    D3D12_COMPARISON_FUNC_NEVER = 1,
    D3D12_COMPARISON_FUNC_LESS = 2,
    D3D12_COMPARISON_FUNC_EQUAL = 3,
    D3D12_COMPARISON_FUNC_LESS_EQUAL = 4,
    D3D12_COMPARISON_FUNC_GREATER = 5,
    D3D12_COMPARISON_FUNC_NOT_EQUAL = 6,
    D3D12_COMPARISON_FUNC_GREATER_EQUAL = 7,
    D3D12_COMPARISON_FUNC_ALWAYS = 8
} D3D12_COMPARISON_FUNC
```

## Constants

| Constant                                | Description                                                                                 |
| --------------------------------------- | ------------------------------------------------------------------------------------------- |
| D3D12\_COMPARISON\_FUNC\_NEVER          | Never pass the comparison.                                                                  |
| D3D12\_COMPARISON\_FUNC\_LESS           | If the source data is less than the destination data, the comparison passes.                |
| D3D12\_COMPARISON\_FUNC\_EQUAL          | If the source data is equal to the destination data, the comparison passes.                 |
| D3D12\_COMPARISON\_FUNC\_LESS\_EQUAL    | If the source data is less than or equal to the destination data, the comparison passes.    |
| D3D12\_COMPARISON\_FUNC\_GREATER        | If the source data is greater than the destination data, the comparison passes.             |
| D3D12\_COMPARISON\_FUNC\_NOT\_EQUAL     | If the source data is not equal to the destination data, the comparison passes.             |
| D3D12\_COMPARISON\_FUNC\_GREATER\_EQUAL | If the source data is greater than or equal to the destination data, the comparison passes. |
| D3D12\_COMPARISON\_FUNC\_ALWAYS         | Always pass the comparison.                                                                 |

## Remarks

A comparison option determines how the runtime compares source (new) data against destination (existing) data before storing the new data. The comparison option is declared in a description before an object is created. The API allows you to set a comparison option for

* a depth-stencil buffer ([D3D12\_DEPTH\_STENCIL\_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc_public))
* depth-stencil operations ([D3D12\_DEPTH\_STENCILOP\_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencilop_desc_public))
* sampler state ([D3D12\_SAMPLER\_DESC](/reference/graphics/d3d12/structs/d3d12_sampler_desc_public))

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[CD3DX12\_DEPTH\_STENCIL\_DESC](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/cd3dx12-depth-stencil-desc)

[Core Enumerations](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-enumerations)


## Related topics

- [D3D12_DEPTH_STENCILOP_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencilop_desc_public.md)
- [D3D12_SAMPLER_DESC](/reference/graphics/d3d12/structs/d3d12_sampler_desc_public.md)
- [D3D12_DEPTH_STENCIL_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc_public.md)
- [D3D12_DEPTH_STENCIL_DESC1](/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc1_public.md)
- [D3D12_STATIC_SAMPLER_DESC](/reference/graphics/d3d12/structs/d3d12_static_sampler_desc_public.md)
