Files
XCEngine/docs/api/rhi/d3d12/shader-resource-view/shader-resource-view.md
ssdfasd 1358bb0a5a docs: 修复 D3D12 后端 API 文档问题
- 修复 texture/dtor.md 和 enums/enums.md 的错误链接
- 重命名 texture/ctor.md → constructor.md, texture/dtor.md → destructor.md
- 创建 command-list, fence, device, query-heap, sampler 的 constructor/destructor 文档
- 创建 D3D12Texture 缺失的 16 个方法文档
- 创建 D3D12CommandList 缺失的 12 个 internal 方法文档
- 补充 shader-resource-view 缺少的头文件和类型字段
2026-03-22 02:08:51 +08:00

53 lines
1.5 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.
# D3D12ShaderResourceView
**命名空间**: `XCEngine::RHI`
**类型**: `class`
**头文件**: `XCEngine/RHI/D3D12/D3D12ShaderResourceView.h`
**描述**: DirectX 12 着色器资源视图Shader Resource View, SRV的 D3D12 实现。SRV 允许着色器访问纹理、缓冲区等资源。
## 概述
`D3D12ShaderResourceView` 封装了 D3D12 的 `CreateShaderResourceView` 操作,提供两种初始化方式:
- `Initialize`: 自动分配描述符句柄
- `InitializeAt`: 在预分配的描述符位置创建视图
## 公共方法
| 方法 | 描述 |
|------|------|
| [`D3D12ShaderResourceView()`](constructor.md) | 构造函数 |
| [`~D3D12ShaderResourceView()`](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;
ID3D12Resource* texture;
// ... 初始化设备资源 ...
// 创建 SRV
D3D12ShaderResourceView* srv = new D3D12ShaderResourceView();
srv->Initialize(device, texture, nullptr);
// 获取描述符句柄用于绑定
D3D12_CPU_DESCRIPTOR_HANDLE handle = srv->GetCPUDescriptorHandle();
// 清理
srv->Shutdown();
delete srv;
```
## 相关文档
- [D3D12 后端概览](../d3d12.md)
- [OpenGL 后端](../../opengl/opengl.md)