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?


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?


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.

  • \$\begingroup\$ 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 \$\endgroup\$ Jan 26 '13 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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