mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-01 09:27:39 +00:00
Handle error return value for SDL_GetSwapInterval
This commit is contained in:
parent
a515f51ac0
commit
8a13533949
7 changed files with 68 additions and 17 deletions
|
@ -1962,6 +1962,7 @@ static int GLES2_RenderPresent(SDL_Renderer *renderer)
|
|||
static int GLES2_SetVSync(SDL_Renderer *renderer, const int vsync)
|
||||
{
|
||||
int retval;
|
||||
int interval = 0;
|
||||
if (vsync) {
|
||||
retval = SDL_GL_SetSwapInterval(1);
|
||||
} else {
|
||||
|
@ -1970,7 +1971,13 @@ static int GLES2_SetVSync(SDL_Renderer *renderer, const int vsync)
|
|||
if (retval != 0) {
|
||||
return retval;
|
||||
}
|
||||
if (SDL_GL_GetSwapInterval() > 0) {
|
||||
|
||||
retval = SDL_GL_GetSwapInterval(&interval);
|
||||
if (retval < 0) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (interval > 0) {
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
} else {
|
||||
renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC;
|
||||
|
@ -2131,8 +2138,16 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
|
|||
} else {
|
||||
SDL_GL_SetSwapInterval(0);
|
||||
}
|
||||
if (SDL_GL_GetSwapInterval() > 0) {
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
|
||||
{
|
||||
int interval = 0;
|
||||
if (SDL_GL_GetSwapInterval(&interval) < 0) {
|
||||
/* Error */
|
||||
} else {
|
||||
if (interval > 0) {
|
||||
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for debug output support */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue