I'm on Linux and I am trying to compile basic shaders for bgfx using shaderc.
My Compile Lines:
shaderc -f ./vs_triangle.sc -o vs_triangle.bin --type vertex --platform linux --profile spirv --varyingdef ./varying.def.sc
shaderc -f ./fs_triangle.sc -o fs_triangle.bin --type fragment --platform linux --profile spirv --varyingdef ./varying.def.sc
I am very new to shader programming and I am just trying to set up a project to learn shaders.
Here is my varying.def.sc:
vec3 a_position : POSITION;
vec4 a_color0 : COLOR0;
vec4 v_color0 : COLOR0;
Here is my vertex shader:
$input a_position, a_color0
$output v_color0
void main()
{
gl_Position = vec4(a_position, 1.0);
v_color0 = a_color0;
}
Here is my fragment shader:
$input v_color0
$output o_color
void main()
{
o_color = v_color0;
}
When I try to compile my fragment shader I get this:
Code:
---
1: // shaderc command line:
2: // shaderc -f ./fs_triangle.sc -o fs_triangle.bin --type fragment --platform linux --profile spirv --varyingdef ./varying.def.sc
3:
4: void main( float4 gl_FragCoord : SV_POSITION , float4 v_color0 : COLOR0 )
5: {
>>> 6: float4 bgfx_VoidFrag = vec4_splat(0.0);
>>> 0: ^
7: o_color = v_color0;
8: }
---
ERROR: 0:6: 'vec4_splat' : no matching overloaded function found
ERROR: 0:6: 'declaration' : Expected
(6): error at column 39, HLSL parsing failed.
ERROR: 3 compilation errors. No code generated.
Failed to build shader.
Why is it throwing an error with code that's not even in my shader code?