- audio: 更新 audio-mixer, equalizer, fft-filter, hrtf, reverbation 方法文档 - resources: 更新资源管理文档 - debug: 新增 renderdoc-capture 文档
87 lines
2.4 KiB
Markdown
87 lines
2.4 KiB
Markdown
# RenderDocCapture
|
||
|
||
**命名空间**: `XCEngine::Debug`
|
||
|
||
**类型**: `class (singleton)`
|
||
|
||
**头文件**: `XCEngine/Debug/RenderDocCapture.h`
|
||
|
||
**描述**: RenderDoc 帧捕获工具集成,用于图形调试和帧分析。
|
||
|
||
## 概述
|
||
|
||
RenderDocCapture 是 RenderDoc 图形调试器的集成类,提供程序化帧捕获功能。通过 LoadRenderDoc API,可以触发帧捕获、获取捕获信息、设置捕获选项等。
|
||
|
||
该类为单例模式,通过 `Get()` 获取实例。支持设置捕获文件路径、捕获注释、捕获选项等。
|
||
|
||
## 公共方法
|
||
|
||
| 方法 | 描述 |
|
||
|------|------|
|
||
| `Get` | 获取单例实例 |
|
||
| `Initialize` | 初始化 RenderDoc 集成,可选指定设备和窗口句柄 |
|
||
| `Shutdown` | 关闭 RenderDoc 集成 |
|
||
| `SetDevice` | 设置图形设备指针(GPU 相关) |
|
||
| `SetWindow` | 设置窗口句柄 |
|
||
| `IsLoaded` | 检查 RenderDoc API 是否已加载 |
|
||
| `IsCapturing` | 检查是否正在捕获 |
|
||
| `GetNumCaptures` | 获取已捕获的帧数量 |
|
||
| `GetCapture` | 获取指定捕获的信息 |
|
||
| `BeginCapture` | 开始帧捕获 |
|
||
| `EndCapture` | 结束帧捕获 |
|
||
| `TriggerCapture` | 触发单帧捕获(等同于按 F12) |
|
||
| `SetCaptureFilePath` | 设置捕获文件保存路径 |
|
||
| `SetCaptureComments` | 设置捕获文件注释 |
|
||
| `SetCaptureOptionU32` | 设置32位捕获选项 |
|
||
| `LaunchReplayUI` | 启动 RenderDoc 回放界面 |
|
||
|
||
## 结构体
|
||
|
||
### RenderDocCaptureInfo
|
||
|
||
| 成员 | 类型 | 描述 |
|
||
|------|------|------|
|
||
| `filename` | `char[256]` | 捕获文件名 |
|
||
| `length` | `uint32_t` | 文件大小(字节) |
|
||
| `timestamp` | `uint64_t` | 捕获时间戳 |
|
||
|
||
## 使用示例
|
||
|
||
```cpp
|
||
#include <XCEngine/Debug/RenderDocCapture.h>
|
||
|
||
using namespace XCEngine::Debug;
|
||
|
||
// 获取单例实例
|
||
RenderDocCapture& renderDoc = RenderDocCapture::Get();
|
||
|
||
// 初始化(传入设备和窗口)
|
||
renderDoc.Initialize(devicePtr, windowHandle);
|
||
|
||
// 设置捕获文件路径
|
||
renderDoc.SetCaptureFilePath("captures/frame_%04i.cap");
|
||
renderDoc.SetCaptureComments("Test capture - stress scene");
|
||
|
||
// 开始捕获
|
||
renderDoc.BeginCapture("Main Window");
|
||
|
||
// ... 渲染代码 ...
|
||
|
||
// 结束捕获
|
||
renderDoc.EndCapture();
|
||
|
||
// 或触发单帧捕获
|
||
renderDoc.TriggerCapture();
|
||
|
||
// 检查捕获数量
|
||
uint32_t numCaptures = renderDoc.GetNumCaptures();
|
||
|
||
// 启动回放界面
|
||
renderDoc.LaunchReplayUI();
|
||
```
|
||
|
||
## 相关文档
|
||
|
||
- [Debug 模块总览](../debug.md) - Debug 模块总览
|
||
- [Profiler](../profiler/profiler.md) - 性能分析器
|