PDA

View Full Version : Uniform arrays locations



Aleksandar
08-08-2013, 07:09 AM
Hi guys,

Recently I have discovered very awkward behavior of NV drivers. Namely, when calling glGetUniformLocation() for array element with index greater than 11, the returned value is unpredictable. I have discovered it after noticing some overwriting in my shaders. Values were changed stochastically on the first glance. But after careful examination I have discovered they were mirrored from other uniforms. Even the newest driver (326.29) exposes that behavior (first noticed on 266.58). I have patched it by calculating location using starting location (location of uniform with index 0) and index as an offset. Beware of this!

Does AMD have a similar bug? Or is it a bug at all?

Alfonse Reinheart
08-08-2013, 09:34 AM
the returned value is unpredictable

Define "unpredictable". Also, what kind of array is it? The only time array indices are "predictable" are if an explicit uniform location is being used (in which case you don't need to ask) or if it is an array of basic types (ie: not a struct or array). If it's not an array of basic types, all bets are off as far as uniform location layout is concerned.

Aleksandar
08-08-2013, 10:41 AM
I'm really sorry! This was a false alarm. The problem was in CPU code and allocation space for uniform array locations.

I beg moderators or a Web master to remove this thread.