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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to