Commit 75df506b authored by Patrice Mandin's avatar Patrice Mandin

Forgot to flush OpenGL buffer using glFinish

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40994
parent 064aa656
...@@ -156,13 +156,24 @@ int SDL_AtariGL_LoadLibrary(_THIS, const char *path) ...@@ -156,13 +156,24 @@ int SDL_AtariGL_LoadLibrary(_THIS, const char *path)
return -1; 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) */ /* Load functions pointers (osmesa.ldg) */
this->gl_data->OSMesaCreateContextExt = SDL_LoadFunction(handle, "OSMesaCreateContextExt"); this->gl_data->OSMesaCreateContextExt = SDL_LoadFunction(handle, "OSMesaCreateContextExt");
this->gl_data->OSMesaDestroyContext = SDL_LoadFunction(handle, "OSMesaDestroyContext"); this->gl_data->OSMesaDestroyContext = SDL_LoadFunction(handle, "OSMesaDestroyContext");
this->gl_data->OSMesaMakeCurrent = SDL_LoadFunction(handle, "OSMesaMakeCurrent"); this->gl_data->OSMesaMakeCurrent = SDL_LoadFunction(handle, "OSMesaMakeCurrent");
this->gl_data->OSMesaPixelStore = SDL_LoadFunction(handle, "OSMesaPixelStore"); this->gl_data->OSMesaPixelStore = SDL_LoadFunction(handle, "OSMesaPixelStore");
this->gl_data->OSMesaGetProcAddress = SDL_LoadFunction(handle, "OSMesaGetProcAddress"); 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) */ /* Load old functions pointers (mesa_gl.ldg, tiny_gl.ldg) */
this->gl_data->OSMesaCreateLDG = SDL_LoadFunction(handle, "OSMesaCreateLDG"); this->gl_data->OSMesaCreateLDG = SDL_LoadFunction(handle, "OSMesaCreateLDG");
...@@ -174,12 +185,14 @@ int SDL_AtariGL_LoadLibrary(_THIS, const char *path) ...@@ -174,12 +185,14 @@ int SDL_AtariGL_LoadLibrary(_THIS, const char *path)
(this->gl_data->OSMesaDestroyContext == NULL) || (this->gl_data->OSMesaDestroyContext == NULL) ||
(this->gl_data->OSMesaMakeCurrent == NULL) || (this->gl_data->OSMesaMakeCurrent == NULL) ||
(this->gl_data->OSMesaPixelStore == NULL) || (this->gl_data->OSMesaPixelStore == NULL) ||
(this->gl_data->glGetIntegerv == NULL) ||
(this->gl_data->OSMesaGetProcAddress == NULL)) { (this->gl_data->OSMesaGetProcAddress == NULL)) {
/* Hum, maybe old library ? */ /* Hum, maybe old library ? */
if ( (this->gl_data->OSMesaCreateLDG == NULL) || if ( (this->gl_data->OSMesaCreateLDG == NULL) ||
(this->gl_data->OSMesaDestroyLDG == 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; return -1;
} else { } else {
gl_oldmesa = 1; gl_oldmesa = 1;
...@@ -328,6 +341,13 @@ void SDL_AtariGL_SwapBuffers(_THIS) ...@@ -328,6 +341,13 @@ void SDL_AtariGL_SwapBuffers(_THIS)
{ {
#ifdef HAVE_OPENGL #ifdef HAVE_OPENGL
if (gl_active) { 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_copyshadow(this, this->screen);
gl_convert(this, this->screen); gl_convert(this, this->screen);
} }
...@@ -342,7 +362,12 @@ void SDL_AtariGL_InitPointers(_THIS) ...@@ -342,7 +362,12 @@ void SDL_AtariGL_InitPointers(_THIS)
this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent; this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
this->gl_data->OSMesaPixelStore = OSMesaPixelStore; this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress; this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
this->gl_data->glGetIntegerv = glGetIntegerv; this->gl_data->glGetIntegerv = glGetIntegerv;
this->gl_data->glFinish = glFinish;
this->gl_data->OSMesaCreateLDG = NULL;
this->gl_data->OSMesaDestroyLDG = NULL;
#endif #endif
} }
...@@ -356,15 +381,7 @@ static void SDL_AtariGL_UnloadLibrary(_THIS) ...@@ -356,15 +381,7 @@ static void SDL_AtariGL_UnloadLibrary(_THIS)
this->gl_config.dll_handle = NULL; this->gl_config.dll_handle = NULL;
/* Restore pointers to static library */ /* Restore pointers to static library */
this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt; SDL_AtariGL_InitPointers(this);
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;
} }
#endif #endif
} }
......
...@@ -50,13 +50,16 @@ struct SDL_PrivateGLData { ...@@ -50,13 +50,16 @@ struct SDL_PrivateGLData {
OSMesaContext ctx; OSMesaContext ctx;
/* OpenGL functions */
void (*glGetIntegerv)( GLenum pname, GLint *value );
void (*glFinish)(void);
/* osmesa.ldg */ /* osmesa.ldg */
OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist); OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);
void (*OSMesaDestroyContext)( OSMesaContext ctx ); void (*OSMesaDestroyContext)( OSMesaContext ctx );
GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height ); GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height );
void (*OSMesaPixelStore)( GLint pname, GLint value ); void (*OSMesaPixelStore)( GLint pname, GLint value );
void * (*OSMesaGetProcAddress)( const char *funcName ); void * (*OSMesaGetProcAddress)( const char *funcName );
void (*glGetIntegerv)( GLenum pname, GLint *value );
/* mesa_gl.ldg, tiny_gl.ldg */ /* mesa_gl.ldg, tiny_gl.ldg */
void *(*OSMesaCreateLDG)( long format, long type, long width, long height ); void *(*OSMesaCreateLDG)( long format, long type, long width, long height );
......
...@@ -1276,11 +1276,8 @@ static void refresh_window(_THIS, int winhandle, short *rect) ...@@ -1276,11 +1276,8 @@ static void refresh_window(_THIS, int winhandle, short *rect)
static void GEM_GL_SwapBuffers(_THIS) static void GEM_GL_SwapBuffers(_THIS)
{ {
if (gl_active) { SDL_AtariGL_SwapBuffers(this);
gl_copyshadow(this, this->screen); GEM_FlipHWSurface(this, this->screen);
gl_convert(this, this->screen);
GEM_FlipHWSurface(this, this->screen);
}
} }
#endif #endif
...@@ -883,12 +883,9 @@ static void XBIOS_VideoQuit(_THIS) ...@@ -883,12 +883,9 @@ static void XBIOS_VideoQuit(_THIS)
static void XBIOS_GL_SwapBuffers(_THIS) static void XBIOS_GL_SwapBuffers(_THIS)
{ {
if (gl_active) { SDL_AtariGL_SwapBuffers(this);
gl_copyshadow(this, this->screen); XBIOS_FlipHWSurface(this, this->screen);
gl_convert(this, this->screen); SDL_AtariGL_MakeCurrent(this);
XBIOS_FlipHWSurface(this, this->screen);
SDL_AtariGL_MakeCurrent(this);
}
} }
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment