Added support for simulated vsync in the renderer

This kicks in if the platform doesn't support vsync directly, or if the present fails for some reason (e.g. minimized on some platforms)

Fixes https://github.com/libsdl-org/SDL/issues/5134
This commit is contained in:
Sam Lantinga 2022-09-15 01:00:12 -07:00
parent 339f7a2f6b
commit d744aafb05
15 changed files with 115 additions and 37 deletions

View file

@ -983,14 +983,15 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
format, pixels, pitch);
}
static void
static int
SW_RenderPresent(SDL_Renderer * renderer)
{
SDL_Window *window = renderer->window;
if (window) {
SDL_UpdateWindowSurface(window);
if (!window) {
return -1;
}
return SDL_UpdateWindowSurface(window);
}
static void