Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Apparently glXSwapIntervalEXT() _does_ return a value.
Browse files Browse the repository at this point in the history
Revision 6 of the GLX_EXT_swap_control spec has a typo; the function
signature they list is void, but the docs talk about a return value, and the
glxext.h headers list "int".
  • Loading branch information
icculus committed Aug 22, 2011
1 parent c9fb39e commit b0c8def
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/video/x11/SDL_x11opengl.c
Expand Up @@ -265,7 +265,7 @@ X11_GL_InitExtensions(_THIS)
/* Check for GLX_EXT_swap_control */
if (HasExtension("GLX_EXT_swap_control", extensions)) {
_this->gl_data->glXSwapIntervalEXT =
(void (*)(Display*,GLXDrawable,int))
(int (*)(Display*,GLXDrawable,int))
X11_GL_GetProcAddress(_this, "glXSwapIntervalEXT");
}

Expand Down Expand Up @@ -538,9 +538,13 @@ X11_GL_SetSwapInterval(_THIS, int interval)
const SDL_WindowData *windowdata = (SDL_WindowData *)
_this->current_glwin->driverdata;
Window drawable = windowdata->xwindow;
_this->gl_data->glXSwapIntervalEXT(display, drawable, interval);
status = 0; /* always succeeds, apparently. */
swapinterval = interval;
status = _this->gl_data->glXSwapIntervalEXT(display,drawable,interval);
if (status != 0) {
SDL_SetError("glxSwapIntervalEXT failed");
status = -1;
} else {
swapinterval = interval;
}
} else if (_this->gl_data->glXSwapIntervalMESA) {
status = _this->gl_data->glXSwapIntervalMESA(interval);
if (status != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/video/x11/SDL_x11opengl.h
Expand Up @@ -38,7 +38,7 @@ struct SDL_GLDriverData
Bool(*glXMakeCurrent) (Display*,GLXDrawable,GLXContext);
void (*glXSwapBuffers) (Display*, GLXDrawable);
void (*glXQueryDrawable) (Display*,GLXDrawable,int,unsigned int*);
void (*glXSwapIntervalEXT) (Display*,GLXDrawable,int);
int (*glXSwapIntervalEXT) (Display*,GLXDrawable,int);
int (*glXSwapIntervalSGI) (int);
int (*glXSwapIntervalMESA) (int);
int (*glXGetSwapIntervalMESA) (void);
Expand Down

0 comments on commit b0c8def

Please sign in to comment.