> ## 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.

# OMSetDepthBounds

> 此方法使您能够动态更改深度边界。

此方法使您能够动态更改深度边界。

## 语法

```cpp theme={null}
void OMSetDepthBounds(
    FLOAT Min,
    FLOAT Max
)
```

### 参数

*Min \[in]*\
类型：FLOAT

[SAL](https://learn.microsoft.com/en-us/visualstudio/code-quality/annotating-function-parameters-and-return-values)：<code>*In*</code>

指定最小深度边界。默认值为 0。NaN 值将静默转换为 0。

*Max \[in]*\
类型：FLOAT

[SAL](https://learn.microsoft.com/en-us/visualstudio/code-quality/annotating-function-parameters-and-return-values)：<code>*In*</code>

指定最大深度边界。默认值为 1。NaN 值将静默转换为 0。

### 返回值

类型：void

无。

## 备注

深度边界测试允许在当前存储的深度值超出由 <i>Min</i> 和 <i>Max</i>（包括）指定的范围时丢弃像素和样本。如果像素或样本的当前存储深度值在此范围内，则深度边界测试通过并进行渲染；否则，深度边界测试失败，像素或样本被丢弃。请注意，深度边界测试考虑的是当前存储的深度值，而不是正在执行的像素着色器生成的深度值。

若要使用深度边界测试，应用程序必须使用新的 [CreatePipelineState](/reference/graphics/d3d12/interfaces/id3d12device2/methods/id3d12device2_createpipelinestate_public) 方法在 PSO 上启用深度边界测试，然后可以使用此命令列表方法动态更改深度边界。

OMSetDepthBounds 是一个可选功能。使用 [CheckFeatureSupport](/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_checkfeaturesupport_public) 方法来确定用户模式驱动程序是否支持此功能。此功能的支持通过 [D3D12\_FEATURE\_D3D12\_OPTIONS2](/reference/graphics/d3d12/enums/d3d12_feature_public) 结构报告。

## 要求

**头文件：** d3d12\_xs.h 或 d3d12\_x.h\
**库：** d3d12\_xs.lib 或 d3d12\_x.lib\
**支持的平台**：XBOX Series 主机和 XBOX One 系列

## 另请参阅

[ID3D12GraphicsCommandList1](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist1/id3d12graphicscommandlist1_public)


## Related topics

- [D3D12_DEPTH_STENCIL_DESC1](/zh-CN/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc1_public.md)
- [D3D12_FEATURE_DATA_D3D12_OPTIONS2](/zh-CN/reference/graphics/d3d12/structs/d3d12_feature_data_d3d12_options2_public.md)
- [CreateDepthStencilView](/zh-CN/reference/graphics/d3d12/interfaces/id3d12device/methods/id3d12device_createdepthstencilview_public.md)
- [D3D12_DEPTH_STENCIL_DESC](/zh-CN/reference/graphics/d3d12/structs/d3d12_depth_stencil_desc_public.md)
- [D3D12_DEPTH_WRITE_MASK](/zh-CN/reference/graphics/d3d12/enums/d3d12_depth_write_mask_public.md)
