When writing a fragment shader in GLSL for Vulkan I guess I've learned by example that the color of the fragment can be output like this:
layout(location = 0) out vec4 outColor;
void main() {
outColor = /*...*/;
}
My question is where in the Vulkan or GLSL spec is this specified? ie That the out variable of location 0 should contain the output color and its type can be (must be?) vec4
?
In the Vulkan spec it doesn't seem to be mentioned in 9.9 Fragment Shaders, and 26 Fragment Operations just links back to 9.9.
The GLSL spec has a two paragraph overview 2.5 Fragment Processor, doesn't go into specifics. In 7.1.5. Fragment Shader Special Variables it lists global variables, but no mention of the "out" variable. There is some discussion under Layout Qualifiers, but doesn't seem very specific.
Any idea?
question from:
https://stackoverflow.com/questions/65855985/structure-of-output-of-fragment-shader 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…