Update README with RenderDocCapture API documentation

- Add detailed RenderDocCapture API reference in Debug section
- Note OpenGL requires HGLRC (not HDC) as device pointer
- Update RenderDoc example description to mention both D3D12 and OpenGL support
- Add note about renderdoc.dll location
This commit is contained in:
2026-03-23 18:47:25 +08:00
parent fb01beb959
commit 1f84b3bc3b

View File

@@ -319,6 +319,44 @@ build/tests/threading/Debug/xcengine_threading_tests.exe
- **Profiler**: 性能分析工具
- **RenderDocCapture**: RenderDoc 帧捕获集成,支持动态加载 renderdoc.dll 进行 GPU 帧调试
#### RenderDocCapture API
支持 D3D12 和 OpenGL 的帧捕获调试:
```cpp
// 初始化(设备创建之前调用)
RenderDocCapture::Get().Initialize(nullptr, hwnd);
RenderDocCapture::Get().SetDevice(device); // D3D12: ID3D12Device*, OpenGL: HGLRC
// 捕获配置
RenderDocCapture::Get().SetCaptureFilePath(".\\capture");
RenderDocCapture::Get().SetCaptureComments("Comment");
RenderDocCapture::Get().SetCaptureOptionU32(option, value);
// 帧捕获
bool BeginCapture(const char* title = nullptr); // 返回 bool
bool EndCapture(); // 返回 bool
void TriggerCapture(); // 捕获下一帧
bool IsCapturing() const;
uint32_t GetNumCaptures() const;
// 获取捕获信息
struct RenderDocCaptureInfo {
char filename[256];
uint32_t length;
uint64_t timestamp;
};
bool GetCapture(uint32_t index, RenderDocCaptureInfo* info);
// 打开 RenderDoc replay UI
bool LaunchReplayUI(uint32_t connect = 1, const char* cmdline = nullptr);
```
> **注意**:
> - OpenGL 后端需要传递 `HGLRC`OpenGL 上下文)作为 device不是 `HDC`
> - `renderdoc.dll` 需放置于 `engine/third_party/renderdoc/renderdoc.dll`
> - D3D12 和 OpenGL 均已验证可正常捕获
### Memory内存管理
- **IAllocator**: 内存分配器接口
@@ -421,10 +459,11 @@ mvsMultiple Version Samples展示游戏引擎的各类功能。所有示
### RenderDoc
D3D12 + RenderDoc 集成示例,展示如何使用 RenderDoc API 进行 GPU 帧捕获和调试:
D3D12 / OpenGL + RenderDoc 集成示例,展示如何使用 RenderDoc API 进行 GPU 帧捕获和调试:
- 动态加载 renderdoc.dll
- 帧捕获 APIStartFrameCapture/EndFrameCapture/TriggerCapture
- 帧捕获 APIBeginCapture/EndCapture/TriggerCapture
- 捕获文件路径和注释设置
- 支持 D3D12 和 OpenGL 双后端
> 注意renderdoc.dll 需单独放置于 `engine/third_party/renderdoc/renderdoc.dll`