beyond-all-reason / beyond-all-reason/RecoilEngine

Game lags behind when minimized on wayland

Open
#798 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
679
Forks
290
Avg merge
3d 2h
Merged PRs (30d)
40

Description

The game slows down too much on **wayland** when minimized. When window is maximized the game needs to catch up again.
The reason for that is wayland lags out on `SDL_GL_SwapWindow(sdlWindow);` when the game is minimized. In one way that's great - the frames are not rendered when not used and the cpu usage is very low. Unfortunately in current state it is not in control and lags behind the current game events.
Native wayland does not send any window events like SDL_WINDOWEVENT_SHOWN or SDL_WINDOWEVENT_MINIMIZED so we can't rely on variable `globalRendering->active` ( see SpringApp.cpp).
Short read on the issue:
https://emersion.fr/blog/2018/wayland-rendering-loop/

The issue occurs only with **VSync on** (or adaptive). Otherwise the engine calls `SDL_GL_SetSwapInterval(0)` and forces swap to always return immedaitely.
Engine can be run on x11 (default on flatpak) as long as the desktop is on wayland.

Contributor guide

Open the contributing guide

Research direction

Start in SpringApp.cpp and inspect SDL_GL_SwapWindow(sdlWindow), globalRendering->active, and the VSync or adaptive swap-interval path. Reproduce the issue on Wayland with the game minimized, then restore the window and observe whether game events catch up. Done means minimized rendering remains efficient without the game falling behind when restored.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, game-dev, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.