I was able to debug shaders in VS2012.
I used this command line:
fxc /TTargetProfile /EShaderMainFunctionName /Od /Zi /FdMyShader.pdb MyShaderFile
In code, I used:
D3DX11CompileFromFile(filename, NULL, NULL, "ShaderMainFunctionName, "TargetProfile", D3D10_SHADER_DEBUG | D3D10_SHADER_SKIP_OPTIMIZATION, ...);
TargetProfile is something like vs_5_0
or ps_5_0
.
I'm pretty sure it would work with D3DCompile.
When I forgot to put D3D10_SHADER_DEBUG | D3D10_SHADER_SKIP_OPTIMIZATION
, and I tried to load the pdb file manually, it said the symbols didn't match.
When I got it right, the Pixel Shader in the Pixel History view was a blue link. When I clicked it, it automatically loaded the correct file and I could start debugging it.
I couldn't find an in-code equivalend to /Fd that generated the pdb file, which is why I had to go through command line.