I have a call
glUniformMatrix4fv(42, ...other parameters...)
with a shader that has
layout (location = 42) uniform mat4 someMat;
which fails as an invalid operation (glDebugMessageCallback says invalid location).
But when I use glGetUinformLocation(shader, "someMat") the function actually still returns 42, and when using it the same call works and throws no errors.
Why could this be? Is the driver allowed to rearrange locations if they are not requested with glGetUniformLocation? Seems like that would defeat the purpose of giving uniforms predefined locations.