[osg-users] Mac OSX NVIDIA GLSL bug w/ Uniform arrays broken

Robert Osfield robert.osfield at gmail.com
Thu Mar 12 02:20:30 PDT 2009

HI Davis,

Sorry to hear that you are hitting up against a driver bug.  It does
seem that NVidia on Macs is a bit of second class citizen, feedback
from Mac users (I've seen it first hand as well) is that ATI drivers
are better that NVidia drivers, with is rather than the reverse of
Windows/Linux.  This doesn't help you alas.

As for workarounds for one particular platform, we'll this is
something of a moving target, one driver revision a bug will appear,
and the next it could be fixed while others bugs can appear.  Since
the OSG isn't tied to any particular hardware or driver version it
isn't possible to match any of these driver bugs.  The best we can do
is provide a mechnanism for disabling bugs via env vars, which is what
we do - see include/osg/GLExtensions.

W.r.t not introducing OpenGL/OSG features that break on some
platforms, this would be insane, we can't drop the OSG down to the
lowest common denominator just because some drivers and some points in
time are broken, we'd end up with practically no functionality exposed
by the OSG at all, and over time we'd need to keep rolling back what
functionality that is exposed as new bugs like the one you are
reporting come in.

In your own case you have a machine with a broken driver, the people
to address this are Apple so I have to recommend that you approach
Apple with a bug report.  The other approach would be to dual boot
your machine with Windows and Linux where the NVidia drivers are
better quality.

As a general note, Mac's users make up minority of our community (web
stats suggest 5%) with Windows and Linux being the main platforms for
graphics development.  This unfortunately means that OSG gets less
testing under Mac than the other main platforms so few problems will
be spotted, and pool of engineers that are available to help support
Mac is also smaller.  While vast majority of the OSG is cross
platform, but areas like OpenGL driver quality is something that does
not cross platform boundaries, and with the smaller pool for testing
and development does put greater need for developers under Mac to
relatively more proactive to enable similar quality of results.


On Wed, Mar 11, 2009 at 10:20 PM, McKay Davis <mckay.cpp at gmail.com> wrote:
> Robert et al.,
> I've run into a driver bug on OSX where all GLSL uniform array
> elements are returning a value of 0 in the shader as though they were
> not bound.
> This is the same bug referenced in this thread:
> http://markmail.org/thread/5mans4howfbu2qtg
> But, it is no longer an ATI only bug as I have the following config:
> OSX 10.5.4,  MacBook Pro 15", Nvidia GeForce 9400M, and OSG 2.6.1.
> (The latest macbook pro release)
> The workaround is to strip the '[0]' from the uniform name before
> calling glGetUniformLocation.  I did this by adding the following
> lines right after the call to glGetActiveUniform on line 528 of
> src/osg/Program.cpp:
> // Strip [0] from uniform array name to work around driver bugs
> const int len = strlen(name);
> if (len >= 3 && name[len-1] == ']')
>   name[len-3] = 0;
> I've tested the above fix on a linux box w/ a GeForce 8800 GTX, where
> the bug did not exist in the first place, and it does not break
> anything.
> Now, I agree w/ your statement in the thread: 'One can't use a blanket
> "OSG should do all it can" to provide workarounds for driver bugs.',
> but isn't this a case where it should make it into the main tree as it
> affects a huge swath of users (all macbook pros) and does not break
> existing functionality?
> Thanks,
> -McKay Davis
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list