问题描述
使用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()
。 [...]
[...]统一控制流是进入
的初始状态main()
,[...]
如何解决此编译错误?
声明main()
函数。