Added SDL_SetWindowSurfaceVSync() and SDL_GetWindowSurfaceVSync()

Fixes https://github.com/libsdl-org/SDL/issues/9347
This commit is contained in:
Sam Lantinga 2024-05-27 10:27:17 -07:00
parent 7c75801571
commit dfe4445214
9 changed files with 106 additions and 21 deletions

View file

@ -4727,10 +4727,13 @@ int SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync)
renderer->wanted_vsync = vsync ? SDL_TRUE : SDL_FALSE;
/* for the software renderer, forward eventually the call to the WindowTexture renderer */
/* for the software renderer, forward the call to the WindowTexture renderer */
#if SDL_VIDEO_RENDER_SW
if (renderer->software) {
if (SDL_SetWindowTextureVSync(renderer->window, vsync) == 0) {
if (!renderer->window) {
return SDL_Unsupported();
}
if (SDL_SetWindowTextureVSync(NULL, renderer->window, vsync) == 0) {
renderer->simulate_vsync = SDL_FALSE;
return 0;
}