Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental: Save CPU When Losing Focus #402

Open
wants to merge 2 commits into
base: v0_8
Choose a base branch
from

Conversation

r888800009
Copy link
Contributor

TL;DR: Refactor event handling and add performance option

This update saves power without requiring changes to animation and physics animations.

  • Refactored the event handling in the incBeginLoop function to use a state machine for managing poll and wait modes, reducing CPU usage when the application is not focused.
  • Added a new performance option in the settings window called Render Only When Window Focused. Enabling this option stops rendering when the window loses focus, further reducing CPU usage.
  • This feature is enabled by default

Related issue: nijigenerate/nijigenerate#21

TL;DR: Refactor event handling and add performance option

This update saves power without requiring changes to animation and physics animations.

Related issue: nijigenerate/nijigenerate#21

* Refactored the event handling in the `incBeginLoop` function to use a state machine for managing poll and wait modes, reducing CPU usage when the application is not focused.
* Added a new performance option in the settings window called `Render Only When Window Focused`.  Enabling this option stops rendering when the window loses focus, further reducing CPU usage.
* This feature is enabled by default
we can see the source code for this in imgui_impl_sdl2.cpp:ImGui_ImplSDL2_ProcessEvent()
https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_sdl2.cpp
imgui will handle SDL_WINDOWEVENT, so we need to pass it to imgui
incGLBackendProcessEvent() would invoke ImGui_ImplSDL2_ProcessEvent()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant