glslc - 即使使用 -fentry-point 也缺少入口点

glslc - Missing entry point even with -fentry-point

使用 glslc --targe-env="vulkan1.1" -fentry-point="mainColor" test.frag 时,出现错误

test.frag: error: Linking fragment stage: Missing entry point: Each stage requires one entry point 

test.frag 内容:

#version 450

layout (location=0) in vec4 color;
layout (location=0) out vec4 fragColor;

void mainColor()
{
    fragColor = color;
}

void mainWhite()
{
    fragColor = vec4(1, 1, 1, 1);
}

我做错了什么?
如何修复此编译错误?

我做错了什么?

Support multiple entry points in a single module #605:

GLSL only allows a single entry point per stage, so either 0 or 1 per compilation unit, and it must be called main(). [...]

OpenGL Shading Language 4.60 Specification (HTML) - 3.8.2. Dynamically Uniform Expressions and Uniform Control Flow

[...] Uniform control flow is the initial state at the entry into main(), [...]

如何修复这个编译错误?

声明 main() 函数。