changeset 993:2662da16d668

Forgot to flush OpenGL buffer using glFinish
author Patrice Mandin <patmandin@gmail.com>
date Sat, 27 Nov 2004 21:28:49 +0000
parents 0324ce32b2d9
children c4e5473672b6
files src/video/ataricommon/SDL_atarigl.c src/video/ataricommon/SDL_atarigl_c.h src/video/gem/SDL_gemvideo.c src/video/xbios/SDL_xbios.c
diffstat 4 files changed, 38 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_atarigl.c	Fri Nov 26 22:11:30 2004 +0000
+++ b/src/video/ataricommon/SDL_atarigl.c	Sat Nov 27 21:28:49 2004 +0000
@@ -156,13 +156,24 @@
 		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");
@@ -174,12 +185,14 @@
 	     (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;
@@ -328,6 +341,13 @@
 {
 #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);
 	}
@@ -342,7 +362,12 @@
 	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
 }
 
@@ -356,15 +381,7 @@
 		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
 }
--- a/src/video/ataricommon/SDL_atarigl_c.h	Fri Nov 26 22:11:30 2004 +0000
+++ b/src/video/ataricommon/SDL_atarigl_c.h	Sat Nov 27 21:28:49 2004 +0000
@@ -50,13 +50,16 @@
 
 	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 );
--- a/src/video/gem/SDL_gemvideo.c	Fri Nov 26 22:11:30 2004 +0000
+++ b/src/video/gem/SDL_gemvideo.c	Sat Nov 27 21:28:49 2004 +0000
@@ -1276,11 +1276,8 @@
 
 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
--- a/src/video/xbios/SDL_xbios.c	Fri Nov 26 22:11:30 2004 +0000
+++ b/src/video/xbios/SDL_xbios.c	Sat Nov 27 21:28:49 2004 +0000
@@ -883,12 +883,9 @@
 
 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