Re: [Warzone-dev] Trunk's GLee hack, revert?

2009-06-05 Thread Christian Ohm
On Thursday,  4 June 2009 at 22:28, bugs buggy wrote:
 If that works, then I am all for it.   Though, isn't  debug(LOG_ERROR,
 Using Mesa hack)  a bit terse?

Well, the patch still needs a bit of work, yes. But before doing that, I wanted
to hear opinions on my approach.


___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


[Warzone-dev] Trunk's GLee hack, revert?

2009-06-04 Thread bugs buggy
The problem with this hack is, that if we keep this in, then this hack
is enabled for *all* people on linux, if they need it or not.

AFAIK, we can't detect what drivers people are using, so the below
error message is spit out for everyone on linux.

If people don't report about the problem to the driver guys, then it
don't get fixed.

This is bad.


I am thinking we should revert the hack altogether.

Opinions?





Index: lib/ivis_opengl/GLee.c
===
--- lib/ivis_opengl/GLee.c  (revision 7656)
+++ lib/ivis_opengl/GLee.c  (working copy)
@@ -12002,7 +12002,8 @@

// NOTE: this hack causes issues with MAC OS
// HACK: work around for drivers that report VBO, but don't have
full openGL 1.5 implementation.
-   #if defined(WZ_OS_UNIX)  !defined(WZ_OS_MAC)
+   #if !defined (_WIN32) || !defined (__APPLE__) || !defined (__APPLE_CC__)
+   fprintf(stderr, GLee hack is enabled. Work around for video drivers
that report VBO, but don't have full openGL 1.5 implementation--please
report the issue to the driver maker.);
GLeeFuncPtr_glBindBuffer = GLeeFuncPtr_glBindBufferARB;
GLeeFuncPtr_glDeleteBuffers = GLeeFuncPtr_glDeleteBuffersARB;
GLeeFuncPtr_glGenBuffers = GLeeFuncPtr_glGenBuffersARB;

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] Trunk's GLee hack, revert?

2009-06-04 Thread Christian Ohm
On Thursday,  4 June 2009 at 15:42, bugs buggy wrote:
 The problem with this hack is, that if we keep this in, then this hack
 is enabled for *all* people on linux, if they need it or not.
 
 AFAIK, we can't detect what drivers people are using, so the below
 error message is spit out for everyone on linux.
 
 If people don't report about the problem to the driver guys, then it
 don't get fixed.

Afaik this only affects Mesa, not any other drivers. And the Mesa guys are
currently busy with Gallium, so I don't think they will do full OpenGL 1.5 for
the old Mesa.

 This is bad.
 I am thinking we should revert the hack altogether.
 Opinions?

Actually there is no need to do the hack in GLee.c, so we can move it somewhere
we can check the GL_RENDERER string. See patch.
diff --git a/lib/ivis_opengl/GLee.c b/lib/ivis_opengl/GLee.c
index 499fcbd..9cc4613 100644
--- a/lib/ivis_opengl/GLee.c
+++ b/lib/ivis_opengl/GLee.c
@@ -12000,21 +12000,6 @@ GLuint __GLeeLink_GL_ARB_vertex_buffer_object(void)
 if ((GLeeFuncPtr_glGetBufferParameterivARB = (GLEEPFNGLGETBUFFERPARAMETERIVARBPROC) __GLeeGetProcAddress(glGetBufferParameterivARB))!=0) nLinked++;
 if ((GLeeFuncPtr_glGetBufferPointervARB = (GLEEPFNGLGETBUFFERPOINTERVARBPROC) __GLeeGetProcAddress(glGetBufferPointervARB))!=0) nLinked++;
 
-	// NOTE: this hack causes issues with MAC OS
-	// HACK: work around for drivers that report VBO, but don't have full openGL 1.5 implementation.
-	#if defined(WZ_OS_UNIX)  !defined(WZ_OS_MAC)
-	GLeeFuncPtr_glBindBuffer = GLeeFuncPtr_glBindBufferARB;
-	GLeeFuncPtr_glDeleteBuffers = GLeeFuncPtr_glDeleteBuffersARB;
-	GLeeFuncPtr_glGenBuffers = GLeeFuncPtr_glGenBuffersARB;
-	GLeeFuncPtr_glIsBuffer = GLeeFuncPtr_glIsBufferARB;
-	GLeeFuncPtr_glBufferData = GLeeFuncPtr_glBufferDataARB;
-	GLeeFuncPtr_glBufferSubData = GLeeFuncPtr_glBufferSubDataARB;
-	GLeeFuncPtr_glGetBufferSubData = GLeeFuncPtr_glGetBufferSubDataARB;
-	GLeeFuncPtr_glMapBuffer = GLeeFuncPtr_glMapBufferARB;
-	GLeeFuncPtr_glUnmapBuffer = GLeeFuncPtr_glUnmapBufferARB;
-	GLeeFuncPtr_glGetBufferParameteriv = GLeeFuncPtr_glGetBufferParameterivARB;
-	GLeeFuncPtr_glGetBufferPointerv = GLeeFuncPtr_glGetBufferPointervARB;
-	#endif
 #endif
 if (nLinked==11) return GLEE_LINK_COMPLETE;
 if (nLinked==0) return GLEE_LINK_FAIL;
diff --git a/lib/ivis_opengl/screen.c b/lib/ivis_opengl/screen.c
index 05b6f88..031e7dd 100644
--- a/lib/ivis_opengl/screen.c
+++ b/lib/ivis_opengl/screen.c
@@ -171,7 +171,6 @@ BOOL screenInitialise(
 	{
 		debug( LOG_ERROR, OpenGL initialization did not give double buffering! );
 	}
-	// Note that no initialisation of GLee is required, since this is handled automatically.
 
 	/* Dump information about OpenGL implementation to the console */
 	debug(LOG_3D, OpenGL Vendor : %s, glGetString(GL_VENDOR));
@@ -193,6 +192,27 @@ BOOL screenInitialise(
 	debug(LOG_3D,   * Rectangular texture %s supported., GLEE_ARB_texture_rectangle ? is : is NOT);
 	debug(LOG_3D,   * FrameBuffer Object (FBO) %s supported., GLEE_EXT_framebuffer_object  ? is : is NOT);
 
+	// Some drivers, namely Mesa, don't support VBOs, but not full OpenGL
+	// 1.5, so work around that.
+	if (!strncmp((const char *)glGetString(GL_RENDERER), Mesa, 4))
+	{
+		debug(LOG_ERROR, Using Mesa hack);
+		// Usually GLee is initialized automatically when needed, but
+		// for this hack to work it has to be done here.
+		GLeeInit();
+		GLeeFuncPtr_glBindBuffer = GLeeFuncPtr_glBindBufferARB;
+		GLeeFuncPtr_glDeleteBuffers = GLeeFuncPtr_glDeleteBuffersARB;
+		GLeeFuncPtr_glGenBuffers = GLeeFuncPtr_glGenBuffersARB;
+		GLeeFuncPtr_glIsBuffer = GLeeFuncPtr_glIsBufferARB;
+		GLeeFuncPtr_glBufferData = GLeeFuncPtr_glBufferDataARB;
+		GLeeFuncPtr_glBufferSubData = GLeeFuncPtr_glBufferSubDataARB;
+		GLeeFuncPtr_glGetBufferSubData = GLeeFuncPtr_glGetBufferSubDataARB;
+		GLeeFuncPtr_glMapBuffer = GLeeFuncPtr_glMapBufferARB;
+		GLeeFuncPtr_glUnmapBuffer = GLeeFuncPtr_glUnmapBufferARB;
+		GLeeFuncPtr_glGetBufferParameteriv = GLeeFuncPtr_glGetBufferParameterivARB;
+		GLeeFuncPtr_glGetBufferPointerv = GLeeFuncPtr_glGetBufferPointervARB;
+	}
+
 	glViewport(0, 0, width, height);
 	glMatrixMode(GL_PROJECTION);
 	glPushMatrix();
___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] Trunk's GLee hack, revert?

2009-06-04 Thread Dennis Schridde
Am Freitag, 5. Juni 2009 00:21:24 schrieb Christian Ohm:
  This is bad.
  I am thinking we should revert the hack altogether.
  Opinions?

 Actually there is no need to do the hack in GLee.c, so we can move it
 somewhere we can check the GL_RENDERER string. See patch.
I think checking for specific drivers and applying hacks in that case is a bad 
behaviour. Can we not run a behavioural check instead? I.e. supports VBOs, 
but not GL 1.5 - likely to be broken? If you think that could cause havok on 
the wrong drivers, you could still check for renderer=mesa as a precondition 
to that, if it really need be.

--DevU


signature.asc
Description: This is a digitally signed message part.
___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [Warzone-dev] Trunk's GLee hack, revert?

2009-06-04 Thread Christian Ohm
On Friday,  5 June 2009 at  0:47, Dennis Schridde wrote:
 I think checking for specific drivers and applying hacks in that case is a 
 bad 
 behaviour. Can we not run a behavioural check instead? I.e. supports VBOs, 
 but not GL 1.5 - likely to be broken? If you think that could cause havok 
 on 
 the wrong drivers, you could still check for renderer=mesa as a 
 precondition 
 to that, if it really need be.

Mesa supports VBOs as extensions, in OpenGL 1.5 they are in the core. Mesa
needs the xxxARB function names, while Warzone uses the core names without ARB.
All this hack does is to make it possible to use the core names even if VBOs
are just extensions. I don't think there is any brokenness involved (despite
this somewhat unlucky hack label).

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev