Files
XCEngine/docs/api/XCEngine/Editor/Platform/D3D12WindowRenderer/D3D12WindowRenderer.md

44 lines
1.4 KiB
Markdown
Raw Normal View History

2026-03-27 14:40:29 +08:00
# D3D12WindowRenderer
**命名空间**: `XCEngine::Editor::Platform`
**类型**: `class`
**源文件**: `editor/src/Platform/D3D12WindowRenderer.h`
**描述**: 编辑器专用的 D3D12 窗口渲染器负责交换链、RTV/SRV 堆、命令列表和 ImGui 绘制提交。
## 概述
`D3D12WindowRenderer` 解决的是“编辑器 UI 窗口本身怎么被呈现到屏幕”这个问题。
它当前自己管理:
- `ID3D12Device`
- `ID3D12CommandQueue`
- `ID3D12CommandAllocator`
- `ID3D12GraphicsCommandList`
- `IDXGISwapChain3`
- RTV / SRV descriptor heap
- back buffer render targets
- fence
## 当前实现说明
- `Initialize(hwnd, width, height)` 会创建设备与渲染目标。
- `Render(imguiBackend, clearColor)` 会完成 back buffer 状态切换、清屏、ImGui draw data 提交、present 和 fence signal。
- `Resize()` 会重建 back buffer RTV。
- `GetDevice()` / `GetSrvHeap()` 为 ImGui backend 提供初始化依赖。
## 当前实现边界
- 当前完全是编辑器宿主级 D3D12 代码,不走引擎自己的 RHI 抽象。
- 当前资源释放与错误处理都比较直接,没有更高层的资源状态对象。
- `SetEventOnCompletion()` 当前传的是 `nullptr` 事件句柄,这个等待路径仍然很原始。
## 相关文档
- [Platform](../Platform.md)
- [Application](../../Application/Application.md)
- [Win32EditorHost](../Win32EditorHost/Win32EditorHost.md)