Reputation: 381
In a GLSL vertex shader I have:
#version 330
layout (location=0) uniform mat4 wm_;
layout (location=1) uniform mat4 vm_;
...more code...
I get no compile errors when the shader is compiled. Later, I am assert()ing on glGetUniformLocation for wm_ and vm_ returning the locations specified in the shader source. The asserions fire, as glGetUniformLocation returns different values (it do not return -1, that is, the uniforms don't get optimized away, they get assigned what appear to be valid but different locations.)
Can anyone explain this behavior?
Upvotes: 3
Views: 1266
Reputation: 511
Explicit uniform locations are supported since GLSL 4.30 or by extension GL_ARB_explicit_uniform_location. The compiler here is too tolerant and allows syntax that is not supported in GLSL 3.30 This should be considered as a driver bug.
Upvotes: 4