When compile HLSL shader model5.1, get error X3506: unrecognized compiler target 'vs_5_1'

昊霖 鲁 101 Reputation points
2021-03-19T00:47:03.147+00:00

Hello, I'm working on HLSL shaders with some new features of shader model 5.1. I use D3DCompileFromFile to compile the shader using target "vs_5_1". It actually works well on my laptop, but when it turns to my desktop computer, it gets an exception : "get error X3506: unrecognized compiler target 'vs_5_1'".

I think that might because the "d3dcompiler_47.dll" in "Windows32" folder is too old, it seems that my laptop gets a newer version, but it's actually difficult to replace the file as it is always used by "dwm.exe".

Is this problem solvable? Or it just means my hardware does not support version 5_1? I specified D3D_FEATURE_LEVEL_12_0 when creating the device and it supports the feature level. I think as it's a compile error it should just be a software problem but I cannot find out how to solve it.

Developer technologies | Visual Studio | Debugging
0 comments No comments
{count} votes

Answer accepted by question author
  1. 昊霖 鲁 101 Reputation points
    2021-03-19T04:34:50.12+00:00

    I finally solve the problem, I took two steps:

    1. replace the d3dcompiler_47.dll with the newer version
    2. remove the project and pull it from git again, then build

    I have no idea which step actually fixes the problem, maybe both.

    I first replace the .dll but it still doesn't work.
    The hint is that I start a new project and only try to compile the shader, and find it actually works well.
    So I rebuild my project, and luckily it works!


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.