Code Editor in PVRShaderEditor

The editor allows editing of shader files and provides real-time cycle counts and syntax highlighting

The editor area is the part of the GUI where the source code text is actually edited. Opened files are arranged as tabs so it is easy to switch between editing multiple different files.

The editor has several key features which make the job of writing and editing shaders much simpler.

Syntax highlighting

The editor provides syntax highlighting for GLSL, HLSL, OpenCL, PFX2, and PFX3 files. This includes highlighting variable type specifiers, precision modifiers, built-in functions, function definitions, and commented sections.

The colour of this highlighting for different languages can be customised using the Editor Colours tab of the Preferences window. The language syntax which will be highlighted can be selected from the Syntax mode: dropdown menu which is located in the status bar at the bottom of the GUI.

Compiler Feedback

The editor automatically checks for syntax and compilation errors as soon as the code is written. When a mistake or issue is found it is highlighted in two ways:
  1. An error message appears in the Debug Panel with the line number in the editor of where the issue is located.
  2. A small red circle with an arrow inside appears next to the line number of where the issue is located in the editor, as illustrated below.

Cycle Counts

PVRShaderEditor can display approximate cycle count information for the currently opened shader. Two sets of cycle counts are available:

  • Per-line cycle counts: In the blue column, next to the line numbers, a line by line breakdown of the cycle cost of the shader will be displayed. As with the other features shown here these values are updated in real-time.
  • Per-shader cycle counts: These counts are available in the Profile Output Panel and give the overall cost for that shader.
Note: All cycle count values in the editor window are approximations intended to assist in identifying areas for optimisation. Hardware may be able to reduce these numbers through instruction scheduling and other methods, that cannot be taken into account by this offline analysis. It is also important to bear in mind that texture sampling is not included in the cost.