Optimizing States and Shaders

If the Metrics panel shows that shaders are causing a performance bottleneck for the selected draw calls, you can change the shader code inside Graphics Frame Analyzer to check the performance effect without recompiling your code.

To experiment with shader code:

  1. From the Resource viewer, choose the program used in the analyzed draw calls.
  2. In the drop down menu , select the type of shader you want to analyze. Graphics Frame Analyzer supports vertex, fragment, compute, geometry, and tesselation shaders.
    The shader code opens for editing in the pane below:

  3. Edit the shader code to recompile the shader on the fly. If you introduced any errors, you can see the corresponding message in the Error List below the shader code pane:

    .

  4. If the code looks fine, click the Apply button to save the changes.
    Graphics Frame Analyzer recalculates all metrics and displays new data in the Overview panel and in the Bar Chart.

    TIP

    When you click the Apply button, Graphics Frame Analyzer save all the shaders. This allows you to write your own code and replace the whole shader to experiment with binary programs that you cannot modify.

  5. If you want to undo your edits, click the Revert button. The original shaders are restored.

To experiment with states:

  1. From the Resource viewer, choose the state thumbnail to experiment with.
  2. Edit one or more states. Depending on the state type, use one of the following methods:
    • Use ON/OFF toggle buttons to enable/disable state groups.
    • Enter new values to modify numeric scalars, vectors, and bitmask values. If you enter an invalid value, Graphics Frame Analyzer highlights it in red.
    • Click the parameter to toggle between true/false, values or select a new value from the drop-down list with predefined values that conform to the OpenGL/OpenGL* ES specification.

    Graphics Frame Analyzer recalculates all metrics values to reflect the introduced changes. To revert the change, click the button that appears in the group title to which the modified states belong. If you want to revert all changes at once, click the button in the Resource viewer.

See Also

Graphics Frame Analyzer Window: Profiling View

For more complete information about compiler optimizations, see our Optimization Notice.