Skip to content

Commit

Permalink
Forgot to flush OpenGL buffer using glFinish
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed Nov 27, 2004
1 parent 1ad9aa2 commit 2b26bac
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 24 deletions.
41 changes: 29 additions & 12 deletions src/video/ataricommon/SDL_atarigl.c
Expand Up @@ -156,13 +156,24 @@ int SDL_AtariGL_LoadLibrary(_THIS, const char *path)
return -1;
}

this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");

if ( (this->gl_data->glGetIntegerv == NULL) ||
(this->gl_data->glFinish == NULL)) {
SDL_SetError("Could not retrieve OpenGL functions");
SDL_UnloadObject(handle);
/* Restore pointers to static library */
SDL_AtariGL_InitPointers(this);
return -1;
}

/* Load functions pointers (osmesa.ldg) */
this->gl_data->OSMesaCreateContextExt = SDL_LoadFunction(handle, "OSMesaCreateContextExt");
this->gl_data->OSMesaDestroyContext = SDL_LoadFunction(handle, "OSMesaDestroyContext");
this->gl_data->OSMesaMakeCurrent = SDL_LoadFunction(handle, "OSMesaMakeCurrent");
this->gl_data->OSMesaPixelStore = SDL_LoadFunction(handle, "OSMesaPixelStore");
this->gl_data->OSMesaGetProcAddress = SDL_LoadFunction(handle, "OSMesaGetProcAddress");
this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");

/* Load old functions pointers (mesa_gl.ldg, tiny_gl.ldg) */
this->gl_data->OSMesaCreateLDG = SDL_LoadFunction(handle, "OSMesaCreateLDG");
Expand All @@ -174,12 +185,14 @@ int SDL_AtariGL_LoadLibrary(_THIS, const char *path)
(this->gl_data->OSMesaDestroyContext == NULL) ||
(this->gl_data->OSMesaMakeCurrent == NULL) ||
(this->gl_data->OSMesaPixelStore == NULL) ||
(this->gl_data->glGetIntegerv == NULL) ||
(this->gl_data->OSMesaGetProcAddress == NULL)) {
/* Hum, maybe old library ? */
if ( (this->gl_data->OSMesaCreateLDG == NULL) ||
(this->gl_data->OSMesaDestroyLDG == NULL)) {
SDL_SetError("Could not retrieve OpenGL functions");
SDL_SetError("Could not retrieve OSMesa functions");
SDL_UnloadObject(handle);
/* Restore pointers to static library */
SDL_AtariGL_InitPointers(this);
return -1;
} else {
gl_oldmesa = 1;
Expand Down Expand Up @@ -328,6 +341,13 @@ void SDL_AtariGL_SwapBuffers(_THIS)
{
#ifdef HAVE_OPENGL
if (gl_active) {
if (this->gl_config.dll_handle) {
if (this->gl_data->glFinish) {
this->gl_data->glFinish();
}
} else {
this->gl_data->glFinish();
}
gl_copyshadow(this, this->screen);
gl_convert(this, this->screen);
}
Expand All @@ -342,7 +362,12 @@ void SDL_AtariGL_InitPointers(_THIS)
this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;

this->gl_data->glGetIntegerv = glGetIntegerv;
this->gl_data->glFinish = glFinish;

this->gl_data->OSMesaCreateLDG = NULL;
this->gl_data->OSMesaDestroyLDG = NULL;
#endif
}

Expand All @@ -356,15 +381,7 @@ static void SDL_AtariGL_UnloadLibrary(_THIS)
this->gl_config.dll_handle = NULL;

/* Restore pointers to static library */
this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt;
this->gl_data->OSMesaDestroyContext = OSMesaDestroyContext;
this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
this->gl_data->glGetIntegerv = glGetIntegerv;

this->gl_data->OSMesaCreateLDG = NULL;
this->gl_data->OSMesaDestroyLDG = NULL;
SDL_AtariGL_InitPointers(this);
}
#endif
}
Expand Down
5 changes: 4 additions & 1 deletion src/video/ataricommon/SDL_atarigl_c.h
Expand Up @@ -50,13 +50,16 @@ struct SDL_PrivateGLData {

OSMesaContext ctx;

/* OpenGL functions */
void (*glGetIntegerv)( GLenum pname, GLint *value );
void (*glFinish)(void);

/* osmesa.ldg */
OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);
void (*OSMesaDestroyContext)( OSMesaContext ctx );
GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height );
void (*OSMesaPixelStore)( GLint pname, GLint value );
void * (*OSMesaGetProcAddress)( const char *funcName );
void (*glGetIntegerv)( GLenum pname, GLint *value );

/* mesa_gl.ldg, tiny_gl.ldg */
void *(*OSMesaCreateLDG)( long format, long type, long width, long height );
Expand Down
7 changes: 2 additions & 5 deletions src/video/gem/SDL_gemvideo.c
Expand Up @@ -1276,11 +1276,8 @@ static void refresh_window(_THIS, int winhandle, short *rect)

static void GEM_GL_SwapBuffers(_THIS)
{
if (gl_active) {
gl_copyshadow(this, this->screen);
gl_convert(this, this->screen);
GEM_FlipHWSurface(this, this->screen);
}
SDL_AtariGL_SwapBuffers(this);
GEM_FlipHWSurface(this, this->screen);
}

#endif
9 changes: 3 additions & 6 deletions src/video/xbios/SDL_xbios.c
Expand Up @@ -883,12 +883,9 @@ static void XBIOS_VideoQuit(_THIS)

static void XBIOS_GL_SwapBuffers(_THIS)
{
if (gl_active) {
gl_copyshadow(this, this->screen);
gl_convert(this, this->screen);
XBIOS_FlipHWSurface(this, this->screen);
SDL_AtariGL_MakeCurrent(this);
}
SDL_AtariGL_SwapBuffers(this);
XBIOS_FlipHWSurface(this, this->screen);
SDL_AtariGL_MakeCurrent(this);
}

#endif

0 comments on commit 2b26bac

Please sign in to comment.