more mesa debugging

This commit is contained in:
David Rose 2008-02-26 21:36:27 +00:00
parent b70b3d7102
commit 21651167f1

View File

@ -63,7 +63,7 @@ OSMesaGraphicsStateGuardian::
// not defined. // not defined.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void *OSMesaGraphicsStateGuardian:: void *OSMesaGraphicsStateGuardian::
get_extension_func(const char *, const char *name) { get_extension_func(const char *prefix, const char *name) {
#if (OSMESA_MAJOR_VERSION == 4 && OSMESA_MINOR_VERSION >= 1) || OSMESA_MAJOR_VERSION > 4 #if (OSMESA_MAJOR_VERSION == 4 && OSMESA_MINOR_VERSION >= 1) || OSMESA_MAJOR_VERSION > 4
// If we've got at least OSMesa version 4.1, then we can use // If we've got at least OSMesa version 4.1, then we can use
// OSMesaGetProcAddress. // OSMesaGetProcAddress.
@ -73,9 +73,30 @@ get_extension_func(const char *, const char *name) {
// Mesa functions to "mgl", they're still stored as "gl" in the // Mesa functions to "mgl", they're still stored as "gl" in the
// OSMesaGetProcAddress() lookup table. // OSMesaGetProcAddress() lookup table.
string fullname = string("gl") + string(name); string fullname = string("gl") + string(name);
return (void *)OSMesaGetProcAddress(fullname.c_str()); void *ptr = (void *)OSMesaGetProcAddress(fullname.c_str());
if (mesadisplay_cat.is_debug()) {
mesadisplay_cat.debug()
<< "Looking for function " << fullname << ": " << ptr << "\n";
}
if (ptr == (void *)NULL) {
// Well, try for the more accurate name.
fullname = string(prefix) + name;
ptr = (void *)OSMesaGetProcAddress(fullname.c_str());
if (mesadisplay_cat.is_debug()) {
mesadisplay_cat.debug()
<< "Looking for function " << fullname << ": " << ptr << "\n";
}
}
return ptr;
#else #else
if (mesadisplay_cat.is_debug()) {
mesadisplay_cat.debug()
<< "Couldn't look up extension function: compied with Mesa version "
<< OSMESA_MAJOR_VERSION << "." << OSMESA_MINOR_VERSION << "\n";
}
// Otherwise, too bad. No extension functions for you. We could // Otherwise, too bad. No extension functions for you. We could
// try to write code that would dig around in the system interface // try to write code that would dig around in the system interface
// (using dlopen(), for instance) to find the extension functions, // (using dlopen(), for instance) to find the extension functions,