Should layout quantifier (location) differ between uniform/in/out?

Viewed 1024

I am now setting up layout quantifier (location) for my GLSL shaders. And this question hits me whether those quantifier ID need differ with each other.

Does it have to be:

layout (location = 0) uniform vec3 v1;
layout (location = 1) in vec3 v2;
layout (location = 2) uniform vec3 v3;
layout (location = 3) in vec3 v4;

Or it can be (as the location can be specified as uniforms or inputs):

layout (location = 0) uniform vec3 v1;
layout (location = 0) in vec3 v2;
layout (location = 1) uniform vec3 v3;
layout (location = 1) in vec3 v4;

Thanks.

1 Answers
Related