I have a GLSL program that contains 3 fragment shader sources that would get linked together, like this:
1.
#version 460 core
void RunA();
void RunB();
void main() {
RunA();
RunB();
}
#version 460 core
layout(location=0) in float inValue;
layout(location=0) out float outValue;
void RunA() {
outValue = inValue;
}
#version 460 core
layout(location=1) in float inValue;
layout(location=1) out float outValue;
void RunB() {
outValue = inValue;
}
In the real codebase fragment shaders 2 and 3 are generated from the same source, with different #defines inserted for the function name and location indices.
It fails because they share the name inValue and outValue.
Is it possible to define them such that they are only local to that shader source, and don't conflict with declarations in other fragment shaders of the same program?
(Similar to a static declaration in C)