i am trying to create a shader for Vulkan using shaderc but when compiling the fragment shader i get the error: '' : unexpected token.
here is my fragment shader:
#version 450 core
layout(location = 0) out vec4 color;
layout(push_constant) uniform Material
{
vec4 u_Color;
} u_MaterialUniforms;
void main()
{
color = u_MaterialUniforms.u_Color;
}
and here is the code for compiling it:
shaderc::Compiler compiler;
shaderc::CompileOptions options;
options.SetTargetEnvironment(shaderc_target_env_vulkan, shaderc_env_version_vulkan_1_2);
const bool optimize = true;
if (optimize) {
options.SetOptimizationLevel(shaderc_optimization_level_performance);
}
shaderc::SpvCompilationResult module = compiler.CompileGlslToSpv(source, shaderc_glsl_fragment_shader, FilePath.c_str(), options);
if (module.GetCompilationStatus() != shaderc_compilation_status_success)
{
AE_ASSERT(false, module.GetErrorMessage());
}
The vertex shader works and compiles. I tried simplifying the fragment shader so it uses a static color but that did not work and gave the same error. I am not sure where to start trouble shooting to find the bug.