Forgot to flush OpenGL buffer using glFinish
authorPatrice Mandin <patmandin@gmail.com>
Sat, 27 Nov 2004 21:28:49 +0000
changeset 9932662da16d668
parent 992 0324ce32b2d9
child 994 c4e5473672b6
Forgot to flush OpenGL buffer using glFinish
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
     1.1 --- a/src/video/ataricommon/SDL_atarigl.c	Fri Nov 26 22:11:30 2004 +0000
     1.2 +++ b/src/video/ataricommon/SDL_atarigl.c	Sat Nov 27 21:28:49 2004 +0000
     1.3 @@ -156,13 +156,24 @@
     1.4  		return -1;
     1.5  	}
     1.6  
     1.7 +	this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
     1.8 +	this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
     1.9 +
    1.10 +	if ( (this->gl_data->glGetIntegerv == NULL) || 
    1.11 +	     (this->gl_data->glFinish == NULL)) {
    1.12 +		SDL_SetError("Could not retrieve OpenGL functions");
    1.13 +		SDL_UnloadObject(handle);
    1.14 +		/* Restore pointers to static library */
    1.15 +		SDL_AtariGL_InitPointers(this);
    1.16 +		return -1;
    1.17 +	}
    1.18 +
    1.19  	/* Load functions pointers (osmesa.ldg) */
    1.20  	this->gl_data->OSMesaCreateContextExt = SDL_LoadFunction(handle, "OSMesaCreateContextExt");
    1.21  	this->gl_data->OSMesaDestroyContext = SDL_LoadFunction(handle, "OSMesaDestroyContext");
    1.22  	this->gl_data->OSMesaMakeCurrent = SDL_LoadFunction(handle, "OSMesaMakeCurrent");
    1.23  	this->gl_data->OSMesaPixelStore = SDL_LoadFunction(handle, "OSMesaPixelStore");
    1.24  	this->gl_data->OSMesaGetProcAddress = SDL_LoadFunction(handle, "OSMesaGetProcAddress");
    1.25 -	this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
    1.26  
    1.27  	/* Load old functions pointers (mesa_gl.ldg, tiny_gl.ldg) */
    1.28  	this->gl_data->OSMesaCreateLDG = SDL_LoadFunction(handle, "OSMesaCreateLDG");
    1.29 @@ -174,12 +185,14 @@
    1.30  	     (this->gl_data->OSMesaDestroyContext == NULL) ||
    1.31  	     (this->gl_data->OSMesaMakeCurrent == NULL) ||
    1.32  	     (this->gl_data->OSMesaPixelStore == NULL) ||
    1.33 -	     (this->gl_data->glGetIntegerv == NULL) ||
    1.34  	     (this->gl_data->OSMesaGetProcAddress == NULL)) {
    1.35  		/* Hum, maybe old library ? */
    1.36  		if ( (this->gl_data->OSMesaCreateLDG == NULL) || 
    1.37  		     (this->gl_data->OSMesaDestroyLDG == NULL)) {
    1.38 -			SDL_SetError("Could not retrieve OpenGL functions");
    1.39 +			SDL_SetError("Could not retrieve OSMesa functions");
    1.40 +			SDL_UnloadObject(handle);
    1.41 +			/* Restore pointers to static library */
    1.42 +			SDL_AtariGL_InitPointers(this);
    1.43  			return -1;
    1.44  		} else {
    1.45  			gl_oldmesa = 1;
    1.46 @@ -328,6 +341,13 @@
    1.47  {
    1.48  #ifdef HAVE_OPENGL
    1.49  	if (gl_active) {
    1.50 +		if (this->gl_config.dll_handle) {
    1.51 +			if (this->gl_data->glFinish) {
    1.52 +				this->gl_data->glFinish();
    1.53 +			}
    1.54 +		} else {
    1.55 +			this->gl_data->glFinish();
    1.56 +		}
    1.57  		gl_copyshadow(this, this->screen);
    1.58  		gl_convert(this, this->screen);
    1.59  	}
    1.60 @@ -342,7 +362,12 @@
    1.61  	this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
    1.62  	this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
    1.63  	this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
    1.64 +
    1.65  	this->gl_data->glGetIntegerv = glGetIntegerv;
    1.66 +	this->gl_data->glFinish = glFinish;
    1.67 +
    1.68 +	this->gl_data->OSMesaCreateLDG = NULL;
    1.69 +	this->gl_data->OSMesaDestroyLDG = NULL;
    1.70  #endif
    1.71  }
    1.72  
    1.73 @@ -356,15 +381,7 @@
    1.74  		this->gl_config.dll_handle = NULL;
    1.75  
    1.76  		/* Restore pointers to static library */
    1.77 -		this->gl_data->OSMesaCreateContextExt = OSMesaCreateContextExt;
    1.78 -		this->gl_data->OSMesaDestroyContext = OSMesaDestroyContext;
    1.79 -		this->gl_data->OSMesaMakeCurrent = OSMesaMakeCurrent;
    1.80 -		this->gl_data->OSMesaPixelStore = OSMesaPixelStore;
    1.81 -		this->gl_data->OSMesaGetProcAddress = OSMesaGetProcAddress;
    1.82 -		this->gl_data->glGetIntegerv = glGetIntegerv;
    1.83 -
    1.84 -		this->gl_data->OSMesaCreateLDG = NULL;
    1.85 -		this->gl_data->OSMesaDestroyLDG = NULL;
    1.86 +		SDL_AtariGL_InitPointers(this);
    1.87  	}
    1.88  #endif
    1.89  }
     2.1 --- a/src/video/ataricommon/SDL_atarigl_c.h	Fri Nov 26 22:11:30 2004 +0000
     2.2 +++ b/src/video/ataricommon/SDL_atarigl_c.h	Sat Nov 27 21:28:49 2004 +0000
     2.3 @@ -50,13 +50,16 @@
     2.4  
     2.5  	OSMesaContext	ctx;
     2.6  
     2.7 +	/* OpenGL functions */
     2.8 +	void (*glGetIntegerv)( GLenum pname, GLint *value );
     2.9 +	void (*glFinish)(void);
    2.10 +
    2.11  	/* osmesa.ldg */
    2.12  	OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);
    2.13  	void (*OSMesaDestroyContext)( OSMesaContext ctx );
    2.14  	GLboolean (*OSMesaMakeCurrent)( OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height );
    2.15  	void (*OSMesaPixelStore)( GLint pname, GLint value );
    2.16  	void * (*OSMesaGetProcAddress)( const char *funcName );
    2.17 -	void (*glGetIntegerv)( GLenum pname, GLint *value );
    2.18  
    2.19  	/* mesa_gl.ldg, tiny_gl.ldg */
    2.20  	void *(*OSMesaCreateLDG)( long format, long type, long width, long height );
     3.1 --- a/src/video/gem/SDL_gemvideo.c	Fri Nov 26 22:11:30 2004 +0000
     3.2 +++ b/src/video/gem/SDL_gemvideo.c	Sat Nov 27 21:28:49 2004 +0000
     3.3 @@ -1276,11 +1276,8 @@
     3.4  
     3.5  static void GEM_GL_SwapBuffers(_THIS)
     3.6  {
     3.7 -	if (gl_active) {
     3.8 -		gl_copyshadow(this, this->screen);
     3.9 -		gl_convert(this, this->screen);
    3.10 -		GEM_FlipHWSurface(this, this->screen);
    3.11 -	}
    3.12 +	SDL_AtariGL_SwapBuffers(this);
    3.13 +	GEM_FlipHWSurface(this, this->screen);
    3.14  }
    3.15  
    3.16  #endif
     4.1 --- a/src/video/xbios/SDL_xbios.c	Fri Nov 26 22:11:30 2004 +0000
     4.2 +++ b/src/video/xbios/SDL_xbios.c	Sat Nov 27 21:28:49 2004 +0000
     4.3 @@ -883,12 +883,9 @@
     4.4  
     4.5  static void XBIOS_GL_SwapBuffers(_THIS)
     4.6  {
     4.7 -	if (gl_active) {
     4.8 -		gl_copyshadow(this, this->screen);
     4.9 -		gl_convert(this, this->screen);
    4.10 -		XBIOS_FlipHWSurface(this, this->screen);
    4.11 -		SDL_AtariGL_MakeCurrent(this);
    4.12 -	}
    4.13 +	SDL_AtariGL_SwapBuffers(this);
    4.14 +	XBIOS_FlipHWSurface(this, this->screen);
    4.15 +	SDL_AtariGL_MakeCurrent(this);
    4.16  }
    4.17  
    4.18  #endif