Hi.
Im trying to use the POSITION variable that the VertexShader is passing to my PixelShader to calculate stuff.
The problem is that every time I try to use it, I get this error:
(27): error X4502: invalid input semantic 'POSITION'
(104): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
I've tried renaming the struct members and using POSITION0, but without any luck.
This is my HLSL code. (Or attleast the parts I belive are relevant)
[source=c]
// VS input / output structs
struct VS_INPUT
{
float4 position : POSITION;
float3 normal : NORMAL;
};
struct VS_OUTPUT
{
float4 position : POSITION;
float3 normal : TEXCOORD0;
};
// Vertex shader
VS_OUTPUT VS_Directional(VS_INPUT input)
{
VS_OUTPUT output = (VS_OUTPUT)0;
// Transform into clip space
output.position = mul(input.position, worldViewProjection);
// Rotate normal into world space
output.normal = mul(input.normal, worldViewProjection);
return output;
}
// Pixel shader
float4 PS_Point(VS_OUTPUT input) : COLOR
{
float4 output;
// This will cause the error
float4 tst = input.position;
//... Stuff here that doesn't seem to matter
return output;
}
Any help would be much appreciated.
Thanks.