nSight 4.1 - can't see HLSL shader code, only ASM

Hi KuDeSnik33ra,

I just tried the exactly same codes like yours to compile the shader, I have to say it works as expected, I can see the HLSL shaders and debug on it.

Looks like your lib search path order have some issue, in my Win8.1&VS2013, the $(LibraryPath) shows only about vs2010 and win7’s lib path. I just add a new path for exactly win8.1 kit’s include and lib path.

Thanks
An

Are you shure on using correct dlls? Can you, please, check it in DependecyWalker?
Here is a proof:
43: External Media
47: External Media
My OS&nSight: External Media
On My work PC with GTX770, win8.1 x64, etc. - all is the same.

Hi KuDeSnik33ra,

Seems I can’t watch your picture, looks like it’s blocked.

I don’t use DependecyWalker, I just check the callstack from debugger:

D3DCompiler_47.dll!D3DCompile(const void * pSrcData, unsigned long SrcDataSize, const char * pSourceName, const D3D_SHADER_MACRO * pDefines, ID3DInclude * pInclude, const char * pEntrypoint, const char * pTarget, unsigned int Flags1, unsigned int Flags2, ID3D10Blob * * ppCode, ID3D10Blob * * ppErrorMsgs) Line 875 C++
FluidCS11.exe!CompileShaderFromFile(wchar_t * szFileName, const char * szEntryPoint, const char * szShaderModel, ID3D10Blob * * ppBlobOut, const D3D_SHADER_MACRO * pDefines) Line 518 C++
FluidCS11.exe!OnD3D11CreateDevice(ID3D11Device * pd3dDevice, const DXGI_SURFACE_DESC * pBackBufferSurfaceDesc, void * pUserContext) Line 748 C++
FluidCS11.exe!DXUTCreate3DEnvironment11(ID3D11Device * pd3d11DeviceFromApp) Line 2507 C++
FluidCS11.exe!DXUTChangeDevice(DXUTDeviceSettings * pNewDeviceSettings, ID3D11Device * pd3d11DeviceFromApp, bool bForceRecreate, bool bClipWindowToSingleAdapter) Line 1845 C++
FluidCS11.exe!DXUTCreateDevice(D3D_FEATURE_LEVEL reqFL, bool bWindowed, int nSuggestedWidth, int nSuggestedHeight) Line 1672 C++
FluidCS11.exe!wWinMain(HINSTANCE
* hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 304 C++
FluidCS11.exe!__tmainCRTStartup() Line 547 C
FluidCS11.exe!wWinMainCRTStartup() Line 371 C
[External Code]

You can see I am on D3DCompiler_47.dll for sure.

After reintalling of nSight (completely uninstall and install later, manually delete nSight folder in ProgramData) I can see source code, but all breakpoints show me “The breakpoint will not curently be hit. No source correspondence for breakpoint ID …”, can you suggest something to check? Flags for D3DCompile is D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_PREFER_FLOW_CONTROL;

Hi KuDeSnik33ra,

Hard to say why, that depends many things, your shader compile flag looks fine, what’s your GPU, Driver, OS?

Thanks
An

GTX970, 347.09, Win8.1x64.

Hi KuDeSnik33ra,

OK, I think I know the root issue. Currently, Nsight don’t support Maxwell GPU for shader debug, you should use Fermi or Kepler GPU for shader debug. Of course we will support shader debug on Maxwell’s GPU in the future.

Thanks
An

Thanks, tested on GTX770, debuger works, but very slow - one debugger step took more than 10 sec, is it normal, is there any way to speed up it?

Hi KuDeSnik33ra,

Try this:

  • use faster GPU, :)
  • use two machine to do remote shader debug, it’s faster than do shader debug in one machine
  • change Options->Graphics->Shader debugging preference to ‘Minimal Debugging Experience’ [note, this may bring some limitation to your shader debug, but make it faster]

Thanks
An

Hello! Is there any news about GTX970 shader debugging support? nSight 4.6 released with Titan X support, but shader debugging on my GTX970 still don’t work.

Hi KuDeSnik33ra,

We don’t support Mawell’s shader debug right now, ;(

Thanks
An

Hello, even on Titan X? Will it ever be supported?

Hi KuDeSnik33ra,

Yes, Titan X is also a Maxwell GPU. Sure, it will be supported.

Thanks
An

Hello, did you figure out what the issues were here, because now I’m experiencing the same problems, I cannot see any HLSL code, only D3DASM. I can set breakpoints and debug the D3DASM just fine, but I would like to debug HLSL code :\

My setup is this:
Windows 10 - 64-bit
Microsoft Visual Studio Professional 2015 - Version 14.0.25425.01 Update 3
NVIDIA Nsight Visual Studio Edition - 5.2.0.16268
GPU processor: GeForce GTX 760
Driver version: 373.06

In NVIDIA Nsight Option:
Force assembly debugging: False
Show disassembly if source does not exist: Ask

I have downloaded the directx samples from here: GitHub - walbourn/directx-sdk-samples: This repo contains Direct3D 11, XInput, and XAudio2 samples C++ samples from the legacy DirectX SDK updated to build using the Windows 10 SDK
And then built Direct3D11Tutorials/Tutorial02.
I changed the CompileShaderFromFile() function to this:

HRESULT CompileShaderFromFile( WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob** ppBlobOut )
{
    HRESULT hr = S_OK;

    DWORD dwShaderFlags = D3DCOMPILE_PREFER_FLOW_CONTROL | D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;

    ID3DBlob* pErrorBlob = nullptr;
    hr = D3DCompileFromFile( szFileName, nullptr, nullptr, szEntryPoint, szShaderModel, 
        dwShaderFlags, 0, ppBlobOut, &pErrorBlob );
    if( FAILED(hr) )
    {
        if( pErrorBlob )
        {
            OutputDebugStringA( reinterpret_cast<const char*>( pErrorBlob->GetBufferPointer() ) );
            pErrorBlob->Release();
        }
        return hr;
    }
    if( pErrorBlob ) pErrorBlob->Release();

    return S_OK;
}

What I end up with in nSight when debugging the vertex shader of the triangle drawcall (Event 4) is this:

//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
//
0x00000000: vs_5_0
0x00000008: dcl_globalFlags refactoringAllowed | skipOptimization
0x0000000C: dcl_input v0.xyzw
0x00000018: dcl_output_siv o0.xyzw, position
0x00000028: mov o0.xyzw, v0.xyzw
0x0000003C: ret 
// Approximately 2 instruction slots used

What I have tried thus far is:
uninstall nsight, delete Nsight in “\ProgramData\NVIDIA Corporation”, reinstall nSight
delete Nsight folder in “\Users\xxx\AppData\Roaming\NVIDIA Corporation”

Any suggestions?

I have the same issue as MarcusB on very similar configuration. Just in my case its GTX780 and 375.63 driver. All my shaders are debugable but only in D3DASM eventhough I can see the HLSL source code in the capture data.bin. I also tried to reinstall NSIGHT and delete everything in the middle

Hi,

That’s weird, I use the same sample as you, modify the code, launch with Nsight, I can see the shader file as expected.

Can you take a try on the latest Nsight?

Thanks
An

Tried with Nsight 5.2.0.16321
And GeForce drivers 378.78

Still I only get to see ASM shaders.