|
|
@ -193,7 +193,8 @@ int main(int, char**) |
|
|
|
g_pd3dCommandList->ResourceBarrier(1, &barrier); |
|
|
|
|
|
|
|
// Render Dear ImGui graphics
|
|
|
|
g_pd3dCommandList->ClearRenderTargetView(g_mainRenderTargetDescriptor[backBufferIdx], (float*)&clear_color, 0, NULL); |
|
|
|
const float clear_color_with_alpha[4] = { clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w }; |
|
|
|
g_pd3dCommandList->ClearRenderTargetView(g_mainRenderTargetDescriptor[backBufferIdx], clear_color_with_alpha, 0, NULL); |
|
|
|
g_pd3dCommandList->OMSetRenderTargets(1, &g_mainRenderTargetDescriptor[backBufferIdx], FALSE, NULL); |
|
|
|
g_pd3dCommandList->SetDescriptorHeaps(1, &g_pd3dSrvDescHeap); |
|
|
|
ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData(), g_pd3dCommandList); |
|
|
@ -329,9 +330,11 @@ bool CreateDeviceD3D(HWND hWnd) |
|
|
|
{ |
|
|
|
IDXGIFactory4* dxgiFactory = NULL; |
|
|
|
IDXGISwapChain1* swapChain1 = NULL; |
|
|
|
if (CreateDXGIFactory1(IID_PPV_ARGS(&dxgiFactory)) != S_OK || |
|
|
|
dxgiFactory->CreateSwapChainForHwnd(g_pd3dCommandQueue, hWnd, &sd, NULL, NULL, &swapChain1) != S_OK || |
|
|
|
swapChain1->QueryInterface(IID_PPV_ARGS(&g_pSwapChain)) != S_OK) |
|
|
|
if (CreateDXGIFactory1(IID_PPV_ARGS(&dxgiFactory)) != S_OK) |
|
|
|
return false; |
|
|
|
if (dxgiFactory->CreateSwapChainForHwnd(g_pd3dCommandQueue, hWnd, &sd, NULL, NULL, &swapChain1) != S_OK) |
|
|
|
return false; |
|
|
|
if (swapChain1->QueryInterface(IID_PPV_ARGS(&g_pSwapChain)) != S_OK) |
|
|
|
return false; |
|
|
|
swapChain1->Release(); |
|
|
|
dxgiFactory->Release(); |
|
|
|