Backends: DirectX9: Workaround for windows not refreshing when main viewport has no draw call. (#2560)

This commit is contained in:
omar 2019-09-17 18:32:26 +02:00
parent 1ca6ff974c
commit cf98290873

View File

@ -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);