You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My trading application runs on multiple monitors, and I have enabled multiple viewports so that I can drag/tile relatively small windows all over the place. I have about 90 open in my test, but we aim to have over 200.
I have collapsed the windows so only the title bars are showing (no content is rendered or added to the draw lists)
This all works fine when these windows are merged to my main application viewport, but I when I tile them outside (still on the same monitor, but separate from my main application), the internal ImGui render loop goes from 1ms to about 100ms, tanking my FPS and other processes in the main loop.
The main culprit being these calls (obviously):
#ifdef IMGUI_HAS_VIEWPORT
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
ImGui::UpdatePlatformWindows();
...
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
ImGui::RenderPlatformWindowsDefault();
#endif
When I expand these windows and view their content, it slows down only a slight bit more both inside and outside the merged main viewport.
It seems directly related to the number of viewports, slowing down linearly with the number of windows not merged.
I've also set all my displays to 100% DPI in case this changes anything, but it did not.
(We have another developer running on Linux with a different backend having the same issue, I'm sure they are related)
Screenshots/Video:
Unmerged: (20FPS)
merged: (60FPS)
Minimal, Complete and Verifiable Example code:
// create 90 collapsed dummy windows under each other:
ImVec2 p = {10.f, 10.f};
for (int i = 0; i < 90; ++i)
{
ImGui::SetNextWindowPos(p);
ImGui::SetNextWindowSize({200.f, 200.f});
ImGui::SetNextWindowCollapsed(true);
ImGui::Begin(std::to_string(i).c_str());
p.y += ImGui::GetWindowSize().y;
ImGui::End();
}
The text was updated successfully, but these errors were encountered:
I believe the call to ImGui_ImplDX11_SwapBuffers() may be forcefully waiting for vsync in spite of the explicit vd->SwapChain->Present(0, 0); // Present without vsync. It may depends on swap chain and drivers configuration.
To clarify, on my laptop if I run your code I get about 20 ms per frame (which is very slow, but quite faster than yours) and it's all swapchain or driver overhead. I don't have resources to investigate this for you, you will need to look into DX11 related swap-chain and drivers settings for high numbers of swap chains.
@ocornut as per your advice I looked at the swap chains and started trying out various other suggestions I found on the web. I was able to get my FPS from 20 to over 200. Can comfortably maintain 60FPS with a reasonable amount of data visible now.
I've attempted my first PR on github, hope it's usable: #7286
Version/Branch of Dear ImGui:
1.90 docking
Back-ends:
imgui_impl_dx11.cpp
Compiler, OS:
VS 2017, Windows 11
Full config/build information:
Details:
My trading application runs on multiple monitors, and I have enabled multiple viewports so that I can drag/tile relatively small windows all over the place. I have about 90 open in my test, but we aim to have over 200.
I have collapsed the windows so only the title bars are showing (no content is rendered or added to the draw lists)
This all works fine when these windows are merged to my main application viewport, but I when I tile them outside (still on the same monitor, but separate from my main application), the internal ImGui render loop goes from 1ms to about 100ms, tanking my FPS and other processes in the main loop.
The main culprit being these calls (obviously):
When I expand these windows and view their content, it slows down only a slight bit more both inside and outside the merged main viewport.
It seems directly related to the number of viewports, slowing down linearly with the number of windows not merged.
I've also set all my displays to 100% DPI in case this changes anything, but it did not.
(We have another developer running on Linux with a different backend having the same issue, I'm sure they are related)
Screenshots/Video:
Unmerged: (20FPS)


merged: (60FPS)
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: