Created attachment 123027 [details]
OSMesaGetProcAdress on mangled OSMesa checks that the first three characters are "mgl", but the functions in the table are stored without the leading "m", thus OSMesaGetProcAddress always returns a dummy function.
The proposed solution is similar to https://lists.freedesktop.org/archives/mesa-dev/2015-September/095251.html :
If we are on mangled osmesa and the first character is "m", skip it and proceed.
Thus OSMesaGetProcAddress("mglCreateShader") and OSMesaGetProcAddress("glCreateShader") return the same thing on mangled OSMesa, and the former doesn't work on non-mangled OSMesa.
This bug also depends on https://bugs.freedesktop.org/show_bug.cgi?id=91724 (which has a proposed solution)
Plese note that mangled OSMesa is a very useful feature, and may even be necessary in some situations, as I discussed in https://bugs.freedesktop.org/show_bug.cgi?id=91724#c4
I provide scripts for building and installing various flavors of OSMesa, as well as a simple test program that checks the return values of OSMesaGetProcAddress at: https://github.com/devernay/osmesa-install
Fred (early Mesa contributor, see the Mesa 1.2.1 README!)
Your patch looks good to me, so, Reviewed-by: Brian Paul <email@example.com>
I'll commit this soon and tag it for inclusion in the 11.1.x and 11.2.x branches.
Though, I don't see how this directly depends on bug 91724. It seems like a separate issue (though also related to mangling).
Patch committed (23949cdf2c8563)
Closing this bug.