@@ -137,19 +137,16 @@ void D3D12::Init(HWND hwnd) {
137137 this ->m_screenQuad ->Init ();
138138 this ->InitGBufferShader ();
139139
140- RECT rect;
141- GetClientRect (this ->m_hwnd , &rect);
142-
143140 ZeroMemory (&this ->m_viewport , sizeof (D3D12_VIEWPORT));
144- this ->m_viewport .Width = rect. right ;
145- this ->m_viewport .Height = rect. bottom ;
141+ this ->m_viewport .Width = this -> m_nWidth ;
142+ this ->m_viewport .Height = this -> m_nHeight ;
146143 this ->m_viewport .MaxDepth = 1 .f ;
147144
148145 ZeroMemory (&this ->m_scissor , sizeof (D3D12_RECT));
149146 this ->m_scissor .left = 0 ;
150147 this ->m_scissor .top = 0 ;
151- this ->m_scissor .right = rect. right ;
152- this ->m_scissor .bottom = rect. bottom ;
148+ this ->m_scissor .right = this -> m_nWidth ;
149+ this ->m_scissor .bottom = this -> m_nHeight ;
153150
154151
155152 ThrowIfFailed (this ->m_list ->Close ());
@@ -286,8 +283,17 @@ void D3D12::Update() {
286283 this ->m_list ->ResolveSubresource (this ->m_backBuffers [this ->m_nActualBackBuffer ].Get (), 0 , sqRes.Get (), 0 , DXGI_FORMAT_B8G8R8A8_UNORM);
287284
288285 this ->ResourceBarrier (sqRes, D3D12_RESOURCE_STATE_RESOLVE_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
289- this ->ResourceBarrier (this ->m_backBuffers [this ->m_nActualBackBuffer ], D3D12_RESOURCE_STATE_RESOLVE_DEST, D3D12_RESOURCE_STATE_PRESENT);
286+ this ->ResourceBarrier (this ->m_backBuffers [this ->m_nActualBackBuffer ], D3D12_RESOURCE_STATE_RESOLVE_DEST, D3D12_RESOURCE_STATE_RENDER_TARGET);
287+ this ->m_list ->OMSetRenderTargets (1 , &rtv.cpuHandle , FALSE , nullptr );
288+
289+ ImGui_ImplWin32_NewFrame ();
290+ ImGui_ImplDX12_NewFrame ();
291+ ImGui::NewFrame ();
292+
293+ ImGui::Render ();
294+ ImGui_ImplDX12_RenderDrawData (ImGui::GetDrawData (), this ->m_list .Get ());
290295
296+ this ->ResourceBarrier (this ->m_backBuffers [this ->m_nActualBackBuffer ], D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT);
291297 ThrowIfFailed (this ->m_list ->Close ());
292298
293299 ID3D12CommandList* commandLists[] = {
0 commit comments