Modifying the Shader Code

The Intel® GPA Frame Analyzer supports the creation or modification of shaders within the Intel GPA Frame Analyzer, thereby allowing you to perform experiments to see whether changes result in reduced rendering time with an acceptable level of overall scene quality.
Use one of the following methods to revise/replace a section of code:

Specifying a New Source

To replace the shader with another pre-existing one, do the following:

  1. Select the required ergs either in the Visualization panel or in the Scene Overview panel.

  2. Go to the Shaders tab.

  3. Select vertex/pixel/geometry/hull/domain/compute shader code in the Shader column.
  4. Select Assembly or HLSL from the drop-down list to edit assembly or HLSL code respectively.

    NOTE

    The Intel® GPA Frame Analyzer cannot change Assembly shader code for Microsoft DirectX* 10 or Microsoft DirectX* 11 frames.

  5. Click Replace File….

  6. In the Open window, select a file from which to load a new shader.
  7. Click Apply to apply the new shader to the selected erg.
  8. In the Shader Replacer window, click Apply to specify the options to the compiler:
    • In the Include Path field specify a path to the shader’s header files for use by the compiler. If the edited shader was loaded from a file, the default is the path to the file, otherwise there is no default.

    • For HLSL, in the Entry Point field, specify which function the compiler must treat as the main body for the shader. This option corresponds to the pFunctionName parameter in D3DXCompileShader for Microsoft DirectX* 9, in D3DX10CompileFromMemory for Microsoft DirectX* 10, or in D3DX11CompileFromMemory for Microsoft DirectX* 11. If multiple entry points exist in the shader file, supply the name of the “main” shader function in the edit box.    

    • In the Defines field, specify macros that correspond to:

      • the pDefines parameter in D3DXCompileShader for Microsoft DirectX* 9

      • the pDefines parameter in D3DX10CompilerFromMemory for Microsoft DirectX* 10

      • the pDefines parameter in D3DX11CompilerFromMemory for Microsoft DirectX* 11.

      The format for the Defines field is SYMBOL=value; multiple entries are delimited by a semi-colon.

  9. To reject the corrections you made while editing the file, click Undo Edits.
    To revert the shader to the original state, click Revert.
     

Editing the Existing Shader Code

Note that you can edit only one shader at a time.
To edit the shader in the text buffer, do the following:  

  1. Select the required ergs either in the Visualization panel or in the Scene Overview panel.

  2. Go to the Shaders tab.

  3. Select vertex/pixel/geometry/hull/domain/compute shader code in the Shader column.

  4. Select Assembly or HLSL from the drop-down list to edit assembly or HLSL code respectively.

    NOTE

    The Intel® GPA Frame Analyzer provides no possibility to change Assembly shader code for Microsoft DirectX* 10 or Microsoft DirectX* 11 frames.

  5. Edit code as required in the code field. To clear edits that have not yet been applied, click Undo Edits.

  6. Once you finished with the changes, click Apply to specify the options to the compiler in the Shader Replacer window. For details, see step 8 in the section Specifying a New Source.

  7. Click Apply to apply the new shader to the selected ergs, or Cancel to return to the shader being edited without applying it.

  8. To reject the corrections you made while editing the file, click Undo Edits.
    To revert the shader to the original state, click Revert.

All compilation errors appear in the Errors View and the Shader Replacer window will remain open.

Modifying the Shader Code