changeset 995:22fc5f45bbb7

TinyGL does not have glFinish, only glFlush
author Patrice Mandin <patmandin@gmail.com>
date Sun, 28 Nov 2004 21:52:29 +0000
parents c4e5473672b6
children 54bb19455081
files src/video/ataricommon/SDL_atarigl.c src/video/ataricommon/SDL_atarigl_c.h
diffstat 2 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_atarigl.c	Sat Nov 27 23:11:20 2004 +0000
+++ b/src/video/ataricommon/SDL_atarigl.c	Sun Nov 28 21:52:29 2004 +0000
@@ -116,6 +116,7 @@
 
 #ifdef ENABLE_OSMESA_SHARED
 	void *handle;
+	SDL_bool cancel_load;
 
 	if (gl_active) {
 		SDL_SetError("OpenGL context already created");
@@ -158,9 +159,19 @@
 
 	this->gl_data->glGetIntegerv = SDL_LoadFunction(handle, "glGetIntegerv");
 	this->gl_data->glFinish = SDL_LoadFunction(handle, "glFinish");
+	this->gl_data->glFlush = SDL_LoadFunction(handle, "glFlush");
 
-	if ( (this->gl_data->glGetIntegerv == NULL) || 
-	     (this->gl_data->glFinish == NULL)) {
+	cancel_load = SDL_FALSE;
+	if (this->gl_data->glGetIntegerv == NULL) {
+		cancel_load = SDL_TRUE;
+	} else {
+		/* We need either glFinish (OSMesa) or glFlush (TinyGL) */
+		if ((this->gl_data->glFinish == NULL) &&
+			(this->gl_data->glFlush == NULL)) {
+				cancel_load = SDL_TRUE;
+		}
+	}
+	if (cancel_load) {
 		SDL_SetError("Could not retrieve OpenGL functions");
 		SDL_UnloadObject(handle);
 		/* Restore pointers to static library */
@@ -237,12 +248,6 @@
 	GLenum mesa_attrib;
 	SDL_Surface *surface;
 
-	if (this->gl_config.dll_handle) {
-		if (this->gl_data->glGetIntegerv == NULL) {
-			return -1;
-		}
-	}
-
 	if (!gl_active) {
 		return -1;
 	}
@@ -344,6 +349,8 @@
 		if (this->gl_config.dll_handle) {
 			if (this->gl_data->glFinish) {
 				this->gl_data->glFinish();
+			} else if (this->gl_data->glFlush) {
+				this->gl_data->glFlush();
 			}
 		} else {
 			this->gl_data->glFinish();
@@ -365,6 +372,7 @@
 
 	this->gl_data->glGetIntegerv = glGetIntegerv;
 	this->gl_data->glFinish = glFinish;
+	this->gl_data->glFlush = glFlush;
 
 	this->gl_data->OSMesaCreateLDG = NULL;
 	this->gl_data->OSMesaDestroyLDG = NULL;
--- a/src/video/ataricommon/SDL_atarigl_c.h	Sat Nov 27 23:11:20 2004 +0000
+++ b/src/video/ataricommon/SDL_atarigl_c.h	Sun Nov 28 21:52:29 2004 +0000
@@ -53,6 +53,7 @@
 	/* OpenGL functions */
 	void (*glGetIntegerv)( GLenum pname, GLint *value );
 	void (*glFinish)(void);
+	void (*glFlush)(void);
 
 	/* osmesa.ldg */
 	OSMesaContext (*OSMesaCreateContextExt)( GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist);