none
HLSL compiler problem

    Frage

  • Hi, I want to preface this by saying I'm new to DirectX and I'm sure I'm doing something dumb. I built a DirectX Metro app using the template in Visual Studio, tweaking it to do what I'm interested in.  Now I need to integrate that into a XAML app.  I started a new C++ XAML project and moved much of the code from the first project into the second, making changes to support the XAML integration.  My problem is that my dummy SimplePixelShader.hlsl will no longer compile.  The error I'm getting is "invalid vs_2_0 output semantic 'SV_TARGET'".  I added these files to my project using Project->Add Existing Files. The pixel shader is the vanilla, 6 line file from the template.  Is there a special way I need to integrate the hlsl files into the XAML project that is tripping me up?  Thanks. 

    Freitag, 13. April 2012 22:57

Antworten

  • The SimplePixelShader.hlsl needs to be compiled with the "ps" profile, not "vs". You are trying to compile the "pixel shader" as if it were a "vertex shader"

    • Als Antwort markiert DerekMuk Montag, 16. April 2012 20:51
    Samstag, 14. April 2012 00:22

Alle Antworten

  • The SimplePixelShader.hlsl needs to be compiled with the "ps" profile, not "vs". You are trying to compile the "pixel shader" as if it were a "vertex shader"

    • Als Antwort markiert DerekMuk Montag, 16. April 2012 20:51
    Samstag, 14. April 2012 00:22
  • Thanks Chuck.  I see what you are saying, under Properties->HLSL Compiler.
    Montag, 16. April 2012 20:51
  • help me, i can not fix the error, i do not understand what is "Properties->HLSL Compiler", can you talk about it againt ? i get a error : Error : error X4502: invalid vs_2_0 output semantic 'SV_TARGET' 
    Montag, 3. Dezember 2012 05:06
  • In VS 2012, right click on the .hlsl file in the project's Solution Explorer tree view. Go to "Properties". Then "HLSL Compiler" on the resulting Property Pages.

    Shader Model should be set to a 4_0_level_9_x or higher shader profile for DirectX 11 apps. You cannot use the legacy "Shader Model 2"or "Shader Model 3" with Direct3D 10.x or 11.x.

    See Direct3D Feature Levels and HLSL, FXC, and D3DCompile

    Donnerstag, 6. Dezember 2012 23:25
  • This did not solve the problem...
    Dienstag, 26. Februar 2013 01:49
  • Then you need to provide more details on the error you are seeing...
    Dienstag, 26. Februar 2013 19:56
  • Chuck was right. But the change needed is changing the shader Type not the shader version. Try changing the shader type to pixel shader. 
    Freitag, 7. März 2014 16:15