-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Brian Paul wrote: > Corbin Simpson wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> - From 1f80772f964bd2253a2d569eea4d93fe7a1baa1f Mon Sep 17 00:00:00 2001 >> From: Corbin Simpson <[EMAIL PROTECTED]> >> Date: Sat, 16 Aug 2008 08:22:53 -0700 >> Subject: [PATCH] Fix GLSL detection >> Look for extensions instead of OGL 2.0, this lets non-2.0 drivers do >> GLSL. >> >> - --- >> progs/util/shaderutil.c | 12 +++++------- >> 1 files changed, 5 insertions(+), 7 deletions(-) >> >> diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c >> index 477209a..bd000a6 100644 >> - --- a/progs/util/shaderutil.c >> +++ b/progs/util/shaderutil.c >> @@ -27,14 +27,12 @@ Init(void) >> GLboolean >> ShadersSupported(void) >> { >> - - const char *version; >> - - >> - - version = (const char *) glGetString(GL_VERSION); >> - - if (version[0] != '2' || version[1] != '.') { >> - - printf("GL_RENDERER = %s\n",(const char *) >> glGetString(GL_RENDERER)); >> - - return GL_FALSE; >> + if (glutExtensionSupported("GL_ARB_vertex_shader") >> + && glutExtensionSupported("GL_ARB_fragment_shader") >> + && glutExtensionSupported("GL_ARB_shader_objects")) { >> + return GL_TRUE; >> } >> - - return GL_TRUE; >> + return GL_FALSE; >> } > > Actually, that isn't exactly correct. The demos that use the > shaderutil.c code are based on the OpenGL 2.x API, not the ARB GLSL > extensions. > > The above might work for Mesa, but it could break with other OpenGL > implementations. > > If you want to re-spin that patch, you should keep the test for GL > "2.x". If that fails, check for the ARB extensions and print a warning > message that the program might crash (because of unresolved symbols).
Respun. This is pretty much just a patch to let me test GLSL stuff without actually advertising OGL 2.0, since r300 is still missing fog coords and occlusion queries. I figured that it might be useful to the Mesa core. Thanks, ~ C. - From 301b976fd4dbf22a222bc6711379c7d6f937d72b Mon Sep 17 00:00:00 2001 From: Corbin Simpson <[EMAIL PROTECTED]> Date: Sat, 16 Aug 2008 09:34:11 -0700 Subject: [PATCH] Fix GLSL detection If 2.x isn't present, try ARB GLSL instead. - --- progs/util/shaderutil.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c index 477209a..2532490 100644 - --- a/progs/util/shaderutil.c +++ b/progs/util/shaderutil.c @@ -30,11 +30,15 @@ ShadersSupported(void) const char *version; version = (const char *) glGetString(GL_VERSION); - - if (version[0] != '2' || version[1] != '.') { - - printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); - - return GL_FALSE; + if (version[0] == '2' && version[1] == '.') + return GL_TRUE; + else if (glutExtensionSupported("GL_ARB_vertex_shader") + && glutExtensionSupported("GL_ARB_fragment_shader") + && glutExtensionSupported("GL_ARB_shader_objects")) { + printf("Warning: Using ARB GLSL instead of OpenGL 2.x.\n"); + return GL_TRUE; } - - return GL_TRUE; + return GL_FALSE; } - -- 1.5.6.4 - -- ~ Corbin Simpson <[EMAIL PROTECTED]> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkinAfwACgkQeCCY8PC5utAZrQCfXlGdunbUlpVlXVkx0KvRn9Vr RkoAn18eGxUZex21ZOWPgyDIB7aq8YQz =25Xb -----END PGP SIGNATURE----- ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev