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

53 lines
1.3 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
DirectX 12 深度模板视图的 D3D12 实现。
## 头文件
```cpp
#include <XCEngine/RHI/D3D12/D3D12DepthStencilView.h>
```
## 公共成员函数
### 构造函数与析构函数
#### `D3D12DepthStencilView()`
默认构造函数。
#### `~D3D12DepthStencilView()`
析构函数,确保调用 `Shutdown()`
### 初始化
#### `void Initialize(ID3D12Device* device, ID3D12Resource* resource, const D3D12_DEPTH_STENCIL_VIEW_DESC* desc = nullptr)`
创建 DSV。
#### `void InitializeAt(ID3D12Device* device, ID3D12Resource* resource, D3D12_CPU_DESCRIPTOR_HANDLE handle, const D3D12_DEPTH_STENCIL_VIEW_DESC* desc = nullptr)`
在指定位置创建 DSV。
#### `void Shutdown()`
释放 DSV。
### 属性
#### `D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandle() const`
获取 CPU 描述符句柄。
### 静态辅助函数
#### `static D3D12_DEPTH_STENCIL_VIEW_DESC CreateDesc(Format format, D3D12_DSV_DIMENSION dimension = D3D12_DSV_DIMENSION_TEXTURE2D)`
创建 DSV 描述。
## 内部成员
| 成员 | 类型 | 描述 |
|------|------|------|
| `m_handle` | `D3D12_CPU_DESCRIPTOR_HANDLE` | CPU 描述符句柄 |
| `m_resource` | `ID3D12Resource*` | 关联的资源 |
## 备注
- DSV 必须在 DSV 类型描述符堆中分配
- 支持只读 DSV通过描述符标志区分