glslc-即使使用-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);
}

我做错了什么?
如何解决此编译错误

解决方法

我在做什么错了?

请参见Support multiple entry points in a single module #605

GLSL每个阶段只允许一个入口点,因此每个编译单元为0或1,必须将其称为main()。 [...]

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

[...]统一控制流是进入main(),[...]

的初始状态

如何解决此编译错误?

声明main()函数。