Files
XCEngine/docs/api/rhi/d3d12/render-target-view/create-desc.md
2026-03-20 02:35:45 +08:00

39 lines
1.1 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.
# D3D12RenderTargetView::CreateDesc
## 函数签名
```cpp
static D3D12_RENDER_TARGET_VIEW_DESC CreateDesc(Format format, D3D12_RTV_DIMENSION dimension = D3D12_RTV_DIMENSION_TEXTURE2D)
```
## 描述
创建渲染目标视图描述符的便捷静态方法。将引擎格式枚举转换为 D3D12 格式,并设置视图维度。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `format` | `Format` | 资源格式(参见 `RHIEnums.h` 中的 Format 枚举) |
| `dimension` | `D3D12_RTV_DIMENSION` | 视图维度(默认 `D3D12_RTV_DIMENSION_TEXTURE2D` |
## 返回值
`D3D12_RENDER_TARGET_VIEW_DESC` - 渲染目标视图描述符结构体
## 复杂度
O(1)
## 示例
```cpp
// 创建典型纹理2D渲染目标描述符
D3D12_RENDER_TARGET_VIEW_DESC desc = D3D12RenderTargetView::CreateDesc(Format::R8G8B8A8_UNorm);
```
## 相关文档
- [D3D12RenderTargetView](render-target-view.md) - 类总览
- [D3D12_RENDER_TARGET_VIEW_DESC](https://docs.microsoft.com/en-us/windows/win32/api/d3d12/ns-d3d12-d3d12_render_target_view_desc)
- [Format 枚举](../enums.md#Format)