我目前正试图根据此处的(可能已知的)教程学习Vulkan的编程:
https://vulkan-tutorial.com/
我在介绍如何编译着色器的部分(本部分:
https://vulkan-tutorial.com/en/Drawing_a_triangle/Graphics_pipeline_basics/Shader_modules
)
我尝试做的基本上只是使用VulkanSDK中的glsl编译器编译给定的Vertex Shader示例(我使用的是linux btw)。代码如下所示(与教程中的代码相同):
#version 450
layout(location = 0) out vec3 fragColor;
vec2 positions[3] = vec2[](
vec2(0.0, -0.5),
vec2(0.5, 0.5),
vec2(-0.5, 0.5)
);
vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0)
);
void main() {
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
fragColor = colors[gl_VertexIndex];
}
当我尝试使用此命令进行编译时:
glslc shader.vert - o vert.spv
我收到以下错误:
glslc: error: linking multiple files is not supported yet. Use -c to compile files individually.
我有点困惑,因为我没有改变教程中的任何内容,只是希望它能起作用,而我目前还没有足够的理解来自行解决问题。