I've been trying to load a CG shader from a file, however, I get the following errors:
basic_v.cg(11) : error C0000: syntax error, unexpected '.', expecting "::" at token "."
basic_v.cg(14) : error C0000: syntax error, unexpected ';', expecting "::" at token ";"
basic_v.cg(15) : error C1016: expression type incompatible with function return type
basic_v.cg(7) : error C1108: function "basic_v" has no statements
when I load the source using the following code:
CGprogram vs = NULL;
vs = cgCreateProgramFromFile(this->context, CG_SOURCE,
reinterpret_cast(e.vertexShaderFileName.c_str()), vertProfile,
reinterpret_cast(e.vertexShaderEntryPoint.c_str()), profileOpts);
where vertProfile is the optimal vertex profile (vs_5_0 on my computer) and profileOpts is an array of arguments to the compiler (neither of these variables are relevant to my problem).
What could cause this? The vertex shader source is as follows:
struct VertexOutput
{
float4 position : POSITION;
float3 color : COLOR;
};
VertexOutput basic_v(float4 position : POSITION)
{
VertexOutput out;
out.position = position;
out.color = float3(0.0f, 1.0f, 0.0f);
return out;
}
My Google searches haven't revealed any relevant information.
Thanks in advance for any help!