Search code examples
openglprofilingnvidiansight

Nvidia Nsight 4.0 cannot profile code in OpenGL 4.3


I am using Visual Studio 13 with Nvidia NSights 4.0. In my application I am doing a mix of different types of rendering but, for the purpose of testing the proiler, I did a simple rendering of a scene. I opened the graphics debugger and, when I open the GUI and press spacebar to capture the frame I get this error:

Cannot enter frame debugger. Nsight only supports frame debugging for D3D9, D3D10, D3D11, and OpenGL 4.2. Reason: glEnd

I am using a GT540m and I checked my OpenGL version and it is 4.3 If I, then, try to use the performance anaysis tool and trace OpenGL (following the instructions) I always get some percentage of CPU frames and 0 GPU frames.

I have no idea what am I doing wrong. Is there any solution to this or alternative ways to profile OpenGL?


Solution

  • Are you using immediate mode drawing? Ie. glBegin(..); glVertex<> ; glEnd()

    From the Nsight User Guide's Supported OpenGL Functions page:

    NVIDIA® Nsight™ Visual Studio Edition 4.0 frame debugging supports the set of OpenGL operations, which are defined by the OpenGL 4.2 core profile. Note that it is not necessary to create a core profile context to make use of the frame debugger. An application that uses a compatibility profile context, but restricts itself to using the OpenGL 4.2 core subset, will also work. A few OpenGL 4.2 compatibility profile features, such as support for alpha testing and a default vertex array object, are also supported.

    So, replace the immediate mode rendering with newer drawing functions like glDrawArrays and glDrawElements that vertex array objects.

    Better yet, create a core profile context to ensure you aren't using deprecated functionality.

    My advice: stay away from outdated tutorials online and read the latest edition of the Red book (OpenGL Programming Guide), which only covers modern OpenGL.

    You can also try the more basic GPUView tool that can be found in Win 8 SDK

    UPDATE:

    As for why 0 GPU frames are retrieved, are you sure that your GPU is on the list of supported hardware. I had the same problem where NSight was mostly working (was able to profile other aspects) but 0 GPU frames were collected. Later realized that my card was not officially supported.