Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to draw a full screen quad without a vertex buffer. SV_VertexID should do the trick, although I get a weird error in my shader on the following line:

PS_IN VS(uint VertexID : SV_VertexID)// << this is the line that causes trouble
{
    PS_IN output = (PS_IN)0;

    float4 pos = float4( (VertexID << 1) & 2, VertexID & 2 ,0,1);
    output.pos = mul(pos, wvp );

    float4 t = mul(pos, texTransform);
    output.tex = float2(t.x,t.y);

    return output;
}

The error message:

invalid type used for 'SV_VertexID' input semantics, must be integral

This is how I compile the shader:

fxc.exe /Tvs_4_0_level_9_3 /EVS /Fo Texture_VS.fxo Texture.fx

I dont understand why, as the type is integral. Why do I get this compiler error?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Do you do a #define uint float or similar anywhere?

That code compiled for me as vs_5_0 once I added appropriate definitions of PS_IN etc. Are you compiling it as a pixel shader or something?

http://msdn.microsoft.com/en-us/library/windows/desktop/bb509647%28v=vs.85%29.aspx

Other system values (SV_VertexID, SV_InstanceID, SV_IsFrontFace) can only be input into the first active shader in the pipeline that can interpret the particular value; after that the shader function must pass the values to subsequent stages.

share|improve this answer
    
thanks for the hints, it made me realize that I compiled the shader for the wrong feature level, this input semantics is not supported for 9. Weird that the compiler gives this funny error though –  pivotnig Jan 26 '13 at 14:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.