According to the help documentation, there are two ways of debugging a shader: loading it via D3DXCompileShader or compiling it offline with fxc and specifying /Gfp /Zi /Od. My application uses the 2nd method. All the shaders are compiled from a post-build batch file which looks like this:
@cd "%1"
for /r %%i in (*.fx) do call "%~d0%~p0\fxc.bat" /Tfx_5_0 /Od /Zi /Ges /Gfp /Fo "%~2%%~ni.fxo" "%%i"
Yet when I run Nsight, it just says “No symbols have been loaded for this shader” for all my shaders.
How can I fix this? I’m using Nsight 3.1 and VS 2012.
#line 31 “D:\Documents\Visual Studio 2010\Projects\Craft\Craft\Content\Effects\Minimap.fx”
Which is indeed where the source code file is stored. But the application and compiled fxo are in a different directory (same drive though). Would that be an issue or will Nsight find the source just fine?
My mistake, please disregard my last post. I noticed this in fx file. Nsight doesn’t support debugging .fx effects files. I would recommend switching to plain shaders.
Before starting a new topic, I’d like to make a quick verification here since it’s on topic…
When you say Nsight doesn’t support debugging .fx files, do you mean Effects, i.e.: an effect file compiled against a fx__ target, or do you mean any file that follows the .fx syntax?
Okay… then technically even if our shaders have the .fx extension, since we’re compiling each of them individually against vs_5_0, gs_5_0, ps_5_0, etc. targets, Nsight should be able to debug them?
The reason I’m asking is our engine compiles resources including shaders on a separate process, and I haven’t been able to get Nsight to see where the source is located. PIX has the same problem, the only thing that works is VS2012 simply because it asks where the source file is located. I’m thinking my best bet at this point would be to prepend generated shaders with #line directives, but release notes say this doesn’t play very well with Nsight.