From cf982908732ee4c7e3faa3db47feab2eec7da00d Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 17 Sep 2019 18:32:26 +0200 Subject: [PATCH] Backends: DirectX9: Workaround for windows not refreshing when main viewport has no draw call. (#2560) --- examples/imgui_impl_dx9.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp index 2c22885e..a9df2e8a 100644 --- a/examples/imgui_impl_dx9.cpp +++ b/examples/imgui_impl_dx9.cpp @@ -214,6 +214,11 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data) global_vtx_offset += cmd_list->VtxBuffer.Size; } + // When using multi-viewports, it appears that there's an odd logic in DirectX9 which prevent subsequent windows + // from rendering until the first window submits at least one draw call, even once. That's our workaround. (see #2560) + if (global_vtx_offset == 0) + g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 0, 0, 0); + // Restore the DX9 transform g_pd3dDevice->SetTransform(D3DTS_WORLD, &last_world); g_pd3dDevice->SetTransform(D3DTS_VIEW, &last_view);