gDEBugger GL Tutorial

Analyze Mode

Analyze Mode enables viewing in-depth information about State Change Functions and finding Redundant State Changes. However, gathering this information can have a large performance impact, so it is best avoid using this mode for tasks other than the ones described here.

  1. The Main Window
  2. Analysis Tasks
    1. View State Change Statistics
    2. Locate Redundant State Changes
    3. View Deprecated Function Statistics and Make Your Application Forward-Compatible
    4. View Redundant State Change, Get and Deprecated Functions' Chronological Position in the Frame Rendering Process

The main window

This is gDEBugger GL's default layout for Analyze Mode Analyze Mode. Move your mouse over the screenshot to display the different views' names.

Analyze Mode - gDEBugger GL's main window

Analysis Tasks

View State Change Statistics: Statistical information about the OpenGL state change functions usage is displayed in gDEBugger's Statistics Viewer Statistics Viewer (Ctrl+Shift+S). The best way to get a clear overview of your application's state change statistics is to collect the information from a few complete frames: First, let your application start up by pressing Run Go (F5) in Debug Mode, as Analyze Mode greatly lowers performance. After the application has loaded and rendered some frames, Break Break the execution (F6) and switch to Analyze Mode. Press the Frame Step Frame Step button (Ctrl+F11) once to advance to the end of the current frame. Then, in the Statistics Viewer Statistics Viewer, press the Clear Statistics button. After clearing the Statistics, press the Frame Step Frame Step button a few more times to allow the application to draw a number of complete frames.

In the Statistics Viewer, look at the State Change Statistics tab to view the information. If you wish to find functions which are used redundantly most often, sort the list by percent of redundant calls. If you find a function which has 100% redundant calls, consider removing it from your frame drawing code and moving it to the OpenGL initializations.

Statistics Viewer - State Change Statistics View

Locate Redundant State Changes: After viewing the State Change Statistics and deciding which function's calls you wish to improve, you will need to locate the specific calls to this function which are redundant. There are two ways of doing this:

The first is to add a breakpoint on the most problematic function(s) by choosing this option from the right-click context menu in the Statistics Viewer - this will break the execution before each call to this function, redundant or not. You can also add them in the Breakpoints Dialog.

The second is to enable the "Break on Redundant State Changes" option in the Breakpoints menu or at the bottom of the Statistics Viewer - This will break the execution after each redundant state change, regardless of which function caused it.

After The execution breaks, look at the Calls Stack View to see the position in your source code where the problematic call occurred. If you have the appropriate debug information and source code, double-clicking a line in this view will bring up the Source Code Viewer Source Code Viewer centered on the correct line.

Source Code Viewer

View Deprecated Function Statistics and Make Your Application Forward-Compatible: While running in Analyze Mode, the Statistics Viewer Statistics Viewer's Deprecated Function Calls view will collect information about all function calls made that were deprecated in any OpenGL version. This includes both fully deprecated functions and partially deprecated functions using deprecated features. This view will display a breakdown of deprecated function calls by a combination of OpenGL deprecated function and deprecated features, as well as which OpenGL versions marked this combination as deprecated and which OpenGL version removed it. When you select a line in this view, the Statistics viewer's Properties view will display information about the deprecated feature.
The properties view will also supply a recommendation of a forward-compatible replacement for the deprecated feature you were using.
In the Properties view, you can also find the other functions and bahaviors that belong to this deprecated feature. For example, if you application uses a fully deprecated function from the glLight* family, such as glLightfv(), it probably also uses the partially deprecated function glEnable() with a deprecated target of the GL_LIGHTi family, such as GL_LIGHT1, and also the deprecated target GL_LIGHTS. This will help you easily find the other places you should apply the recommendations to.
If you wish to make your application compatible with a specific OpenGL version, it is best to sort the list by "Removed at OpenGL Version", then clean out all the deprecations that were removed up to this version. For example, if you want your application to be compatible with OpenGL 3.4, you will need to find replacements for the function calls removed by OpenGL 3.4, 3.3, 3.2, ... However, it is highly recommended to avoid using any deprecated features, including ones that are to be removed by future versions, so your application will be truly forward-compatible.
Note: If you only need information about fully deprecated functions and wish to have better performance, gDEBugger's Debug Mode collects this information as well - however, you will not get reports of partially deprecated functions.

View Redundant State Change, Get and Deprecated Functions' Chronological Position in the Frame Rendering Process: While running in Analyze Mode, The OpenGL Calls History View (Both in the main frame and the Statistics Viewer) will display warning icons next to Redundant State Change functions, Get functions and Deprecated functions (both fully deprecated functions and partially deprecated functions using deprecated features). This way, you can easily find these unwanted function calls and see the OpenGL function calls surrounding them.

* Best viewed with Internet Explorer.