No symbols have been loaded for this shader

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.

Any chance we can see the source to one of the shaders?

Sure. Here you go:

float4x4 World;
float4x4 View;
float4x4 Projection;

Texture2D Map;
Texture2D Mask;

SamplerState linearSampler
{
	AddressU = CLAMP;
	AddressV = CLAMP;
	Filter = MIN_MAG_LINEAR_MIP_POINT;
};

struct VertexInput
{
	float3 Position : POSITION;
	float2 TexCoord : TEXCOORD0;
};

struct VertexOutput
{
	float4 Position : SV_POSITION;
	float2 TexCoord : TEXCOORD0;
};

VertexOutput Minimap_VS(VertexInput input)
{
	VertexOutput output = (VertexOutput)0;

	output.Position = float4(input.Position, 1);
	output.TexCoord = input.TexCoord;

	return output;
}

float4 Minimap_PS(VertexOutput input) : SV_TARGET
{
	float4 color = Map.Sample(linearSampler, input.TexCoord);
	float mask = Mask.Sample(linearSampler, input.TexCoord);

	color.a *= mask;

	return color;
}

VertexOutput Waypoint_VS(VertexInput input)
{
	VertexOutput output = (VertexOutput)0;

	float4 worldPosition = mul(float4(input.Position, 1), World);
	float4 cameraPosition = mul(worldPosition, View);
	float4 position = mul(cameraPosition, Projection);

	output.Position = position;
	output.TexCoord = input.TexCoord;

	return output;
}

float4 Waypoint_PS(VertexOutput input) : SV_TARGET
{
	return Map.Sample(linearSampler, input.TexCoord);
}

technique11 Minimap
{
	pass P0
	{
		SetVertexShader(CompileShader(vs_4_0, Minimap_VS()));
		SetPixelShader(CompileShader(ps_4_0, Minimap_PS()));
	}
}

technique11 Waypoint
{
	pass P0
	{
		SetVertexShader(CompileShader(vs_4_0, Waypoint_VS()));
		SetPixelShader(CompileShader(ps_4_0, Waypoint_PS()));
	}
}

I noticed in the ASM that it shows this:

#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?

Yes, Effects–such as those compiled as a fx_3_0 target for instance, are not supported for debugging.

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.