Lua runs every vsync while the window has focus, even when idle

Ouverte
#131 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
cpp, lua
Domaine
desktop, performance

Piste de recherche

Start with the main loop in engine/system/win/sys_main.cpp, ui_main_c::Frame in ui_main.cpp, and frame elision in engine/render/r_main.cpp; then trace GLFW callbacks and texture worker handoffs in engine/system/win/sys_video.cpp and engine/render/r_texture.cpp. Check how #110's condition variable change works and how Lua-driven caret blinking, toasts, and jewel animations request regular frames. Done means idle focused windows avoid running Lua and swapping at every vsync while inputs, worker results, and animations still update.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

While PoB has focus, OnFrame runs every vsync even when nothing changes. The main loop only waits when minimized (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/system/win/sys_main.cpp#L697-L704), and ui_main_c::Frame only sleeps when the window is unfocused (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/ui_main.cpp#L389-L391 and https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/ui_main.cpp#L435-L437). Frame elision skips drawing the layers (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/render/r_main.cpp#L1209-L1240), but Lua, the blit and the swap still run every frame. On a 144 Hz screen that's 144 Lua frames a second for an idle window.

I know running Lua only when something happens is on your list. These are the places I think it would touch:

On the PoB side the caret blink, toasts and the rotating jewel rings need regular frames, so a timeout of a few hundred ms, or a way for Lua to ask for the next frame, would keep those working.

Langage dominant
C++
Étoiles
23
Forks
69
Merge moyen
2 h 50 min
PR mergées (30 j)
1

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic

Toutes les issues de PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.