PDA

View Full Version : Uniform Locations implementation dependant?



Kastenfrosch2
03-08-2013, 07:11 AM
Hey there,

if i compile & link the same GLSL source with different OpenGL-implementations, can the uniform locations that i get with glGetUniformLocation differ?

In general:
Can i be sure, that everything that i don't find in the specification (as the assignment of uniform locations) is implementation-specific?

menzel
03-08-2013, 08:25 AM
Hey there,

if i compile & link the same GLSL source with different OpenGL-implementations, can the uniform locations that i get with glGetUniformLocation differ?


Yes (unless you use explicit locations in your shader).
IIRC nvidia will assign numbers based on the order of appearance in the code while AMD sorts them alphabetically first. This can change with the next driver release! Same with attribute locations. Always query the locations or set them explicitly (not available in all OpenGL versions).



In general:
Can i be sure, that everything that i don't find in the specification (as the assignment of uniform locations) is implementation-specific?

Yes. Never assume anything that isn't stated in the specs explicitly.

Kastenfrosch2
03-08-2013, 08:49 AM
Thanks a lot!