Files
XCEngine/docs/api/rhi/d3d12/query-heap/initialize.md
2026-03-20 02:35:45 +08:00

43 lines
949 B
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.
# D3D12QueryHeap::Initialize
## 函数签名
```cpp
bool Initialize(ID3D12Device* device, QueryType type, uint32_t count)
```
## 中文描述
创建 D3D12 查询堆资源。根据指定的查询类型分配相应类型的 GPU 查询堆。
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `device` | `ID3D12Device*` | D3D12 设备指针 |
| `type` | `QueryType` | 查询类型Timestamp时间戳、Occlusion遮挡、PipelineStatistics管线统计 |
| `count` | `uint32_t` | 查询数量 |
## 返回值
`bool` - 初始化是否成功
## 示例
```cpp
D3D12QueryHeap timestampHeap;
if (timestampHeap.Initialize(device, QueryType::Timestamp, 1024)) {
// 时间戳查询堆创建成功
}
D3D12QueryHeap occlusionHeap;
if (occlusionHeap.Initialize(device, QueryType::Occlusion, 256)) {
// 遮挡查询堆创建成功
}
```
## 相关文档
- [D3D12QueryHeap](query-heap.md)
- [Shutdown](shutdown.md)