3
\$\begingroup\$

When I try to compile two HLSL files included in my project, the compilation fails with an error:

Error error X4502: invalid vs_2_0 input semantic 'INSTANCE'

However, I notice it's trying to use shader model 2.0; when I'm trying to use 5.0:

Shader Model 5.0 Selected in Project Property Pages

Why is the shader compiler trying to use the 2.0 model when I've told VS to use 5.0? Or have I misunderstood?

\$\endgroup\$
6
  • \$\begingroup\$ Make sure you right click -> properties on each shader file and set the Shader Type as well. The property right above the shader model. \$\endgroup\$ Jan 22, 2015 at 18:05
  • \$\begingroup\$ There could also be something else wrong, can you post your shader? \$\endgroup\$ Jan 22, 2015 at 20:33
  • \$\begingroup\$ You should post your code. With DirectX 11 and Shader Model 5.0, you should be using SV_InstanceID. \$\endgroup\$ Jan 23, 2015 at 5:34
  • \$\begingroup\$ @JoeSwindell Thanks for your advice about setting the shader type, that was the problem. If you add an answer with the same comment I'll accept it. \$\endgroup\$ Jan 26, 2015 at 14:47
  • 1
    \$\begingroup\$ For Direct3D 10.x era instancing, you don't use the legacy INSTANCE semantic. IF you want a user-defined semantic name, then you need to use a different string that isn't a known legacy semantic name. \$\endgroup\$ Jan 26, 2015 at 16:48

2 Answers 2

5
\$\begingroup\$

Make sure you right click -> properties on each shader file and set the Shader Type as well. The property right above the shader model in your graphic.

\$\endgroup\$
-1
\$\begingroup\$

you should set (/fx) in shader type

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .