SDL_RenderSetVSync(): Restrict vsync to 0 or 1

In the future, we might want to support special swap intervals. To
prevent applications from expecting nonzero values of vsync to be the
same as "on", fail with SDL_Unsupported() if the value passed is neither
0 nor 1.
This commit is contained in:
Misa authored and Sam Lantinga committed 2021-09-14 16:18:02 -07:00
1 parent 4549769d7d
commit 4a9947336c
2 files changed
+5 -1

No files matched your search

+4
View File
@@ -4129,6 +4129,10 @@ SDL_RenderSetVSync(SDL_Renderer * renderer, int vsync)
{
CHECK_RENDERER_MAGIC(renderer, -1);
if (vsync != 0 && vsync != 1) {
return SDL_Unsupported();
}
if (renderer->SetVSync) {
return renderer->SetVSync(renderer, vsync);
}