Lua runs every vsync while the window has focus, even when idle
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- desktop, performance
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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:
- The elision hash could double as an idle detector. After a few identical frames with no input, no subscript, no running coroutine and no pending texture, the loop could switch from
glfwPollEventstoglfwWaitEventsTimeout. - The GLFW callbacks would set a dirty flag. The cursor callback already stores the position (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/system/win/sys_video.cpp#L487-L494).
- Workers would call
glfwPostEmptyEvent()when they hand something to the main thread: subscript messages, and texture uploads (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/render/r_texture.cpp#L184-L188). - The texture workers spin on
Sleep(1)while idle (https://github.com/PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic/blob/421d18871cccb2696b5a57e6d72a9fc22fa641ae/engine/render/r_texture.cpp#L229). The condvar change from #110 (6a74097) already fixes that.
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.
- Vorherrschende Sprache
- C++
- Sterne
- 23
- Forks
- 69
- Ø Merge
- 2 Std. 50 Min.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 38/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 42/100
-
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 48/100
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
Alle Issues in PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic
Ähnliche Issues
-
enhancement help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
-
difficulty:easy prio:normal type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
NatronGitHub/openfx-supportext#326 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
zucch1/android-auto-jetson#293 ·
Maintainer antworten meist innerhalb von 1 Tag
-
lfortran -E exits with status 0 after a C preprocessor error (#error, wrong macro argument count)Offenbug low priority preprocessor
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag
-
difficulty:easy enhancement prio:low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
NatronGitHub/openfx-misc#502 ·
Maintainer antworten meist innerhalb von 1 Tag