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

Abierto
#131 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp, lua

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
C++
Estrellas
23
Forks
69
Merge medio
2 h 50 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic

Todos los issues de PathOfBuildingCommunity/PathOfBuilding-SimpleGraphic

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.