fix: 修复 D3D12SwapChain 重复创建 swapchain 问题

- 添加 Initialize(IDXGISwapChain*, width, height) 重载方法
- 接受已存在的 swapchain 而不是重复创建
- 测试通过,日志显示正常渲染
This commit is contained in:
2026-03-15 18:30:14 +08:00
parent 80a11d1836
commit 88cd65d082
3 changed files with 14 additions and 1 deletions

View File

@@ -606,7 +606,7 @@ bool InitD3D12(HWND inHWND, int inWidth, int inHeight) {
IDXGISwapChain* swapChain = nullptr;
dxgiFactory->CreateSwapChain(gCommandQueue.GetCommandQueue(), &swapChainDesc, &swapChain);
gSwapChain.Initialize(dxgiFactory, gCommandQueue.GetCommandQueue(), inHWND, inWidth, inHeight, 2);
gSwapChain.Initialize(swapChain, inWidth, inHeight);
D3D12_HEAP_PROPERTIES d3dHeapProperties = {};
d3dHeapProperties.Type = D3D12_HEAP_TYPE_DEFAULT;