You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A recent commit 69249e4 included in release 15.0.0 seems to indicate that the names of variables passed from one stage to the next must match, and only for vulkan. I could not find any documentation to that effect and found explicit mention to the contrary here, though there is no citation:
A very important detail, is that when compiling a pipeline which uses this sort of input and output variables, they always have to match. If there is a mismatch, the pipeline compilation will fail.
To create an output variable, we do this on the vertex shader.
layout (location = 0) out vec3 outColor;
layout(location = 0) is a decorator that lets us add “extra data” to variable declarations and other things in GLSL. In here, we are declaring location = 0, which means that this variable of type vec3 will be on the number 0 slot.
To read the variable from pixel stage, we do this.
layout (location = 0) in vec3 inColor;
The names of the variables do not need to match. On the vertex shader we are calling it outColor, but on the fragment shader > we are calling it inColor. What does need to match, is the Location decorator and the type of the variable. In this case, it’s a location 0 vec3 variable, so things match.
In addition to this, I see the same validation check fails when using gl_* input variables in the fragment shader that have no explicit output equivalent in the vertex shader. For example, if I use gl_SampleMaskIn in the fragment shader, I get this error when linking the program:
ERROR: Linking vertex and fragment stages: Input 'gl_SampleMaskIn' in fragment shader has no corresponding output in vertex shader.
It seems to be that there are two problems to be solved here:
variable names do not matter when passing from one stage to the next, only location (and maybe type?)
built-in variables should not be considered when trying to match inputs of one stage with the outputs of the previous stage.
All of this was seen on Linux Fedora 41 using the tagged source of glslang at 15.0.0, using shader code with the following first three lines:
A recent commit 69249e4 included in release 15.0.0 seems to indicate that the names of variables passed from one stage to the next must match, and only for vulkan. I could not find any documentation to that effect and found explicit mention to the contrary here, though there is no citation:
In addition to this, I see the same validation check fails when using
gl_*
input variables in the fragment shader that have no explicit output equivalent in the vertex shader. For example, if I usegl_SampleMaskIn
in the fragment shader, I get this error when linking the program:It seems to be that there are two problems to be solved here:
All of this was seen on Linux Fedora 41 using the tagged source of glslang at 15.0.0, using shader code with the following first three lines:
The text was updated successfully, but these errors were encountered: