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
Back-ends: imgui_impl_dx12.cpp + imgui_impl_win32.cpp
Compiler: Visual Studio 2022
Operating System: Windows
My Issue/Question:
I am working on using ImGui for a desktop application. Since it redraws at 60fps, it uses a lot of GPU %, and I was wondering if it is possible to make it so that it only redraws when something actually changes.
I have done this in previous applications I have built which were built based on OpenGL. Basically, I constructed a list of render commands each frame, and diff'd it against the commands from the prior frame. If they were the same, then I skipped the render. While this does use a little bit of CPU, it is well worth it to save the GPU the work of redrawing the whole frame.
Would it be feasible to do something like this with ImGui? If so, maybe I might take a stab at it if I get time. In theory, since ImGui just comes up with lists of things to draw, I'd imagine it is possible, but just curious if you might know any reason it couldn't be done.
Before posting this I tried to research if someone had asked the same thing, but I didn't see an exact version of my question (apologies if I missed it). I saw some different posts mentioning different ideas for power saving modes, but I didn't see my idea of diffing the draw lists.
Some of the suggestions I saw:
Render only on input, or if there is an animation - Another Power Saving Mode #5116. This seems like the best solution so far, but it requires the code notifying when animations are happening.
Another one which renders only on inputs and has some provision for animations - Added power saving mode #2749. To me it seems like it has the same issue that it requires components to specify when animations are happening.
These solutions are a little more efficient than what I'm looking to do, because they don't require diffing the draw lists each frame. However, I'd like something which is foolproof - from the perspective of the coder, I'd rather not have to worry about whether I remembered to trigger a render or not. I've worked on apps in the past where there would be tricky bugs due to forgetting to re-render, so I like the idea of just attempting a render 60 times a second, and then only sending to the GPU when it actually changed.
The text was updated successfully, but these errors were encountered:
but just curious if you might know any reason it couldn't be done.
Of course it could be done, you would simply need to deep-hash ImDrawData and skip rendering if it is the same.
You can include an early-out optimization for the case where things changed, by first hashing the ImDrawCmd without the vertices, since this is more likely to change, and then only if the same you can hash the vertex and index buffers.
We're probably going to finish and merge #4076 / #2749 at some point (or other equivalent PR).
Version/Branch of Dear ImGui:
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_dx12.cpp + imgui_impl_win32.cpp
Compiler: Visual Studio 2022
Operating System: Windows
My Issue/Question:
I am working on using ImGui for a desktop application. Since it redraws at 60fps, it uses a lot of GPU %, and I was wondering if it is possible to make it so that it only redraws when something actually changes.
I have done this in previous applications I have built which were built based on OpenGL. Basically, I constructed a list of render commands each frame, and diff'd it against the commands from the prior frame. If they were the same, then I skipped the render. While this does use a little bit of CPU, it is well worth it to save the GPU the work of redrawing the whole frame.
Would it be feasible to do something like this with ImGui? If so, maybe I might take a stab at it if I get time. In theory, since ImGui just comes up with lists of things to draw, I'd imagine it is possible, but just curious if you might know any reason it couldn't be done.
Before posting this I tried to research if someone had asked the same thing, but I didn't see an exact version of my question (apologies if I missed it). I saw some different posts mentioning different ideas for power saving modes, but I didn't see my idea of diffing the draw lists.
Some of the suggestions I saw:
These solutions are a little more efficient than what I'm looking to do, because they don't require diffing the draw lists each frame. However, I'd like something which is foolproof - from the perspective of the coder, I'd rather not have to worry about whether I remembered to trigger a render or not. I've worked on apps in the past where there would be tricky bugs due to forgetting to re-render, so I like the idea of just attempting a render 60 times a second, and then only sending to the GPU when it actually changed.
The text was updated successfully, but these errors were encountered: