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

BACKENDS: Minimal render rate support (force-frame-update) redux #6092

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

bluegr
Copy link
Member

@bluegr bluegr commented Sep 3, 2024

Originally authored by @magicmyth in PR #1039

ScummVM is optimised to render frames when something changes on screen. As some host environments can perform poorly if the app does not reliably refresh its output regularly (notably Steam overlay) this new option ensures that Scummvm outputs a minimal amount of frames even if nothing is changing in the game renderer.

Currently this is only implemented in the SDL OpenGL renderer.

The new config option is called force-frame-update and it takes a integer value representing the desired minimum milliseconds Scummvm should wait before forcing a screen update/refresh. E.g: 50.

Note that the rendering system will not force a re-draw of a frame if the app has rendered a changed frame within the desired minimum refresh.

Thus if the app is outputting 30fps and force-frame-update is set to 100ms (~10fps) then no duplicate frame will be shown (in theory).

As this is implemented in OpenGLSdlGraphicsManager::updateScreen() OpenGLGraphicsManager::_forceRedraw has had its access changed to protected so that it can be access by it's descendant. The reason this has been done in OpenGLSdlGraphicsManager::updateScreen() is so SDL_GetTicks() can be used to track the elapsed time. If it is useful for other platforms using OpenGL to have this feature it could be implemented within OpenGLGraphicsManager::updateScreen() provided a suitable platform independent replacement for SDL_GetTicks() is used. This would potentially be better as OpenGLSdlGraphicsManager checks various other states when deciding if the screen should update.

Originally authored by @magicmyth in PR scummvm#1039

ScummVM is optimised to render frames when something changes on screen.
As some host environments can perform poorly if the app does not
reliably refresh its output regularly (notably Steam overlay) this new
option ensures that Scummvm outputs a minimal amount of frames even if
nothing is changing in the game renderer.

Currently this is only implemented in the SDL OpenGL renderer.

The new config option is called force-frame-update and it takes a
integer value representing the desired minimum milliseconds Scummvm
should wait before forcing a screen update/refresh. E.g: 50.

Note that the rendering system will not force a re-draw of a frame if
the app has rendered a changed frame within the desired minimum refresh.

Thus if the app is outputting 30fps and force-frame-update is set to
100ms (~10fps) then no duplicate frame will be shown (in theory).

As this is implemented in OpenGLSdlGraphicsManager::updateScreen()
OpenGLGraphicsManager::_forceRedraw has had its access changed to
*protected* so that it can be access by it's descendant. The reason this
has been done in OpenGLSdlGraphicsManager::updateScreen() is so
SDL_GetTicks() can be used to track the elapsed time. If it is useful
for other platforms using OpenGL to have this feature it could be
implemented within OpenGLGraphicsManager::updateScreen() provided a
suitable platform independent replacement for SDL_GetTicks() is used.
This would potentially be better as OpenGLSdlGraphicsManager checks
various other states when deciding if the screen should update.
@sev-
Copy link
Member

sev- commented Sep 3, 2024

Thanks, makes sense.

@sev- sev- merged commit 928f5bb into scummvm:master Sep 3, 2024
8 checks passed
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.

2 participants