Bug 94994 - OSMesaGetProcAdress always fails on mangled OSMesa
Summary: OSMesaGetProcAdress always fails on mangled OSMesa
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 11.2
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on: 91724
  Show dependency treegraph
Reported: 2016-04-18 16:04 UTC by Frederic Devernay
Modified: 2016-04-26 17:18 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

patch (1.29 KB, text/plain)
2016-04-18 16:04 UTC, Frederic Devernay

Description Frederic Devernay 2016-04-18 16:04:56 UTC
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!)
Comment 1 Brian Paul 2016-04-25 16:34:24 UTC
Hi Frederic,
Your patch looks good to me, so, Reviewed-by: Brian Paul <brianp@vmware.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).
Comment 2 Brian Paul 2016-04-26 17:18:54 UTC
Patch committed (23949cdf2c8563)
Closing this bug.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.