Files
XCEngine/docs/api/rhi/d3d12/depth-stencil-view/depth-stencil-view.md

46 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# D3D12DepthStencilView
**命名空间**: `XCEngine::RHI`
**类型**: `class`
**头文件**: `XCEngine/RHI/D3D12/D3D12DepthStencilView.h`
**描述**: DirectX 12 深度模板视图的 D3D12 实现,用于渲染管线中的深度/模板测试。
## 概述
`D3D12DepthStencilView` 是 RHI 深度模板视图接口的 D3D12 特定实现。该类封装了 D3D12 深度模板视图DSV的创建和管理提供两种初始化方式自动分配描述符句柄或使用预分配的描述符句柄。深度模板视图是渲染管线中用于深度测试和模板测试的关键资源。
## 公共方法
| 方法 | 描述 |
|------|------|
| [`D3D12DepthStencilView()`](constructor.md) | 构造函数 |
| [`~D3D12DepthStencilView()`](destructor.md) | 析构函数 |
| [`Initialize`](initialize.md) | 初始化深度模板视图 |
| [`InitializeAt`](initialize-at.md) | 在指定位置初始化深度模板视图 |
| [`Shutdown`](shutdown.md) | 关闭深度模板视图 |
| [`GetCPUDescriptorHandle`](get-cpu-descriptor-handle.md) | 获取 CPU 描述符句柄 |
| [`CreateDesc`](create-desc.md) | 创建描述符(静态方法) |
## 使用示例
```cpp
ID3D12Device* device; // 已初始化的 D3D12 设备
ID3D12Resource* depthBuffer; // 深度缓冲资源
D3D12DepthStencilView dsv;
dsv.Initialize(device, depthBuffer, nullptr);
D3D12_CPU_DESCRIPTOR_HANDLE handle = dsv.GetCPUDescriptorHandle();
// 使用 handle 进行渲染操作
dsv.Shutdown();
```
## 相关文档
- [D3D12 后端概览](../d3d12.md) - D3D12 后端模块总览
- [D3D12DescriptorHeap](../descriptor-heap/descriptor-heap.md) - 描述符堆管理
- [D3D12RenderTargetView](../render-target-view/render-target-view.md) - 渲染目标视图