miujin's picture

Debugging with nsight


i try to install Nvidia nsight and debug my program with it. The problem is, that my program always crash when i start it.

So my question is, is it possible to debug an OpenTK program with Nvidia nsight?

Thanks for the answer.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Can you post a stack trace for this task? It might help if you build a debug version of OpenTK.dll and run your application using that.

It should possible to run an OpenTK application with nsight, but I do not currently have a system with Windows+Nvidia to test directly.

miujin's picture

Ok, I only want to know if it is possible. If I have problems I will ask here again.

At the moment I have bigger problem.
I have a driver problem, with the Nvidia Quadro Driver 259.57 my programm runs normal. But if I try a higher driver version, I only get a white window. Does anybody know what the problem is? The OpenTK examples work with the newer version.

the Fiddler's picture

Trying calling GL.GetError() and GL.GetShaderInfoLog(). It is possible that some shader is failing to compile or you are otherwise entering an error state.

Again, using a debug version of OpenTK.dll will help you pinpoint the error (you will get an exception on the exact GL call that causes the error).

pigu66's picture

Hi miujin
I have experienced similar problem using NVidia driver and NSight for Visual Studio. Usually the problem results from more than one reason.

Some useful suggestions could be:

  • always unistall the old NVidia driver before installing the new one. You should check "plain driver installation" installing new driver (I had your same problem installing version 326 over 320, with Internet Explorer...)
  • NSight for Visual Studio requires special driver (instrumented?). Be sure to install it as reccommended above
  • On my system (Win 7 Ultimate, 64 bit with Visual Studio 10 Pro SP1), NSight seems to be unable to debug 64 bit application (it reports generic Win32 error...). Be sure that your application and referenced libraries (including OpenTK) are compiled for 32 bit platform
  • I have experienced that some GL commands leads NSight to crash when they are executed. E.g. GL.PushAttrib(AttribMask.EnableBit) is in my black list.
  • NSight requires graphic adapter that supports OpenGL 4.2 at least. I do not know what happens debugging OpenGL application using version < 4.2
  • NSight is useful to debug shaders or to analyse GPU performance, not to debug the application (NSight runs the Visual Studio project application as external task). You should consider which OpenGL version you need and OpenTK supports, to evaulate the benefits of using NSight.

I'm using NSight without any problem in my project, with the following setup:

  • OS: Win 7 Ultimate (64 bit), fully updated
  • Graphics card: NVidia Quadro K2000 with 326.19(beta) driver
  • NSight version 3.1 for Visual Studio 2010, 64 bit version
  • OpenTK branch to support OpenGL4, compiled for .NET 4.o framework (don't forget to define NET40 compiler symbol)
  • Visaul Studio solution projects compiled for 32 bit application

Have a good luck...

kkevin's picture

> I do not know what happens debugging OpenGL application using version < 4.2

You can use NSight with OpenGL < 4.2 but you are not able to debug shaders (which is quite annoying).
You will however get this Timeline Feature and some Performance tools.
You can step back your graphic calls for instance which is quite handy, to see how your images are drawn.
But not being able to see whats going on in the chip (within the shaders) is more than a drawback.

Most annoying thing: I can't imagine shader development started with OpenGL version 4.2 so where to hell are the tools used in previous versions?
Does anyone know if there are tools for debugging shaders which are OpenGL 3.3 or even older?
All Tools I found where an disappointment. (Missing Features, incompatible to hardware, outdated etc.).
I also tried Mali Shader Development Studio (I know it's for Embedded GL but due the lack of tools what else shall I use?) to develop my shaders which worked quite well, yet they fail if they come to real hardware.
Any references or quickwords to look up?

the Fiddler's picture

I am using apitrace which works quite well for general purpose OpenGL debugging and GPU PerfStudio for shader prototyping.

However, most of all I am waiting for the new Valve OpenGL debugger.

kkevin's picture

I now got a newer Graphics device from NVidia (GF GTX 650).
Even though it is not on the List of supported devices, shader debugging now works quite well.
So you can get this to work for a small amount of money.
Make sure to use the 331 version display driver the newer ones did not work for me (shader list was always blank).

I also ran into constant system freezes when I tried to use the Shader Debugger for OpenGL with anti aliasing enabled.
Disabling anti aliasing (had a overloaded GLControl with 16x FSAA active) did the trick for me.

Happy debugging ... :)