Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.5k views
in Technique[技术] by (71.8m points)

glsl - Structure of output of fragment shader?

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...