Develop

Accessing Vulkan Shader Stats

Updated: Nov 4, 2026
RenderDoc Meta Fork offers access to Meta VR device shader stats through the Vulkan extension KHR_pipeline_executable_properties. RenderDoc Meta Fork implements this extension as a shader disassembly option in the Shader Module panel, so you do not need to write code to retrieve the stats. You can also override a shader during replay, measure the change with performance counters, and preview the result.

Taking and Loading a Capture

A capture is necessary to retrieve Vulkan shader stats. Read Taking and Loading a Capture before following the instructions in this section. You can use either the profiling or non-profiling replay context when retrieving shader stats.

Access Shader Stats

To access Vulkan shader stats in RenderDoc Meta Fork, load a capture and do the following:
  1. In the Event Browser, select the draw call you are interested in. Selecting a draw call for shader stats
  2. Go to the Pipeline State panel. Select Vertex Shader (VS), Fragment Shader (FS), or Compute Shader (CS) and click View.
    Vertex Shader in the Pipeline State panel
  3. The Shader Module panel opens. Select KHR_pipeline_executable_properties from the drop-down menu to see the Vulkan shader stats. KHR_pipeline_executable_properties in the Shader Module panel

Override a Shader

An override replaces a shader with your edited version for the current replay. The original shader in the capture is not modified. Load a capture first. After you read the stats, use the Optimization rows in the Shader Stats Descriptions section to decide what to change. Editing works while you replay on a device, such as a Meta VR device.
In the menu entries and the editor title, FILE is the source file name, TOOL is the decompiler name, RESOURCE is the shader resource name, and ENTRY is the entry point.
  1. In the Event Browser, select the draw call whose shader you want to override.
  2. In the Pipeline State panel, find the row for the shader stage (VS, FS, or CS). Click Edit (tooltip “Edit Shader”) next to View to run the first menu entry, or open the Edit menu and choose an entry. The menu lists these entries in this order:
    • Edit Source - FILE: listed only when the shader carries embedded debug source.
    • Decompile with TOOL: one entry for each decompiler tool RenderDoc finds, and SPIRV-Cross gives GLSL.
    • Edit Pseudocode: available for SPIR-V shaders.
  3. In the editor window, titled Editing RESOURCE - FILE - ENTRY(), edit the shader text. For GLSL, choose a compile tool: glslang (GLSL) or Builtin.
  4. Click Apply changes (tooltip “Compile shader and apply changes”). RenderDoc Meta Fork compiles your edit and applies it to the replay. The status label reads Status: Edited Shader Active. If the compile fails, the editor shows the errors and the original shader stays active.
To go back to the original shader, use one of these options:
  • Click Remove changes (tooltip “Use original shader”). The status label reads Status: Original Shader Active.
  • Click Reset and confirm the prompt to discard your text edits and revert.
  • Close the editor window, which also reverts.
When you save the capture, RenderDoc Meta Fork also stores the text of open editors in the capture file. The original shader is unchanged. When you reopen the capture, the editors reopen without being applied. Click Apply changes again to apply an edit.

Measure the Change

Open the capture on the device’s Profiling Mode replay context before you start. Meta VR Device counters need that context.
To compare the shader before and after your override, sample counters with Status: Original Shader Active, apply your override, then sample counters again with Status: Edited Shader Active. Each click of Capture counters replays with whichever shader is active at that time.
One sampling run has these steps:
  1. From the Window menu, select Performance Counter Viewer.
  2. Click Capture counters.
  3. Check the metrics you want to read.
  4. Click Sample counters.
Repeat the run for each state: once before you apply the override and once after. Keep the editor window open while you sample counters. Closing it reverts the override.
For the counter steps in detail, see Optimize Draw Calls. For what each metric means, see Draw Call Metrics.

Preview the Result

Preview the result to check that the new shader still renders correctly. After you click Apply changes or Remove changes, RenderDoc Meta Fork refreshes the current event. The Texture Viewer and the Mesh Viewer redraw with the active shader. Open both from the Window menu.
The Texture Viewer follows the draw call’s first color output by default.
RenderDoc Meta Fork has no before-and-after or difference view. To compare, click Remove changes, note the result in the Texture Viewer or Mesh Viewer, then click Apply changes and compare.

Override a Shader from the Command Line

Use the command line to read or replace a shader in a script or in repeatable runs. The renderdoccmd tool reads and replaces a draw call’s shader without opening the UI. Run it from a host computer. Neither command reads shader stats or counters.
The commands replay a capture file locally. To replay on a device, add --remote-host adb://SERIAL, where SERIAL is the device serial number. The capture file is the last argument of each command. Both commands print JSON.
shader-get prints a draw call’s shader.
  • --event-id EVENT_ID (required): the event ID (EID) of the draw call in the Event Browser.
  • --stage STAGE (required): one of vs, ps, cs, gs, hs, ds, ts, or ms. The ps value is the fragment stage, shown as FS in Pipeline State.
  • --encoding ENCODING (optional): spirv, spirvasm, glsl, or hlsl. Without this flag, the command returns embedded debug source if the shader has it, and the SPIR-V disassembly otherwise. With glsl, the command returns embedded GLSL source if the shader has it. Otherwise it returns the SPIR-V disassembly unless the driver offers GLSL.
  • --output FILE (optional): writes the result to a file. With --encoding spirv, the file holds the SPIR-V binary.
  • --remote-host adb://SERIAL (optional): replays on the device with that serial number.
  • --retries COUNT (optional, default 20): the number of connection retries for the remote host.
shader-replace is the command-line equivalent of an override. It compiles the new source, replaces the shader bound at that draw call, and replays the capture again. Other draw calls that use the same shader also get the replacement. The replacement applies only for that command.
  • --event-id EVENT_ID (required): the event ID (EID) of the draw call in the Event Browser.
  • --stage STAGE (required): the shader stage, with the same values as shader-get.
  • --encoding ENCODING (required): the source format, one of spirv, glsl, hlsl, dxbc, dxil, or slang.
  • --source-file FILE (required): the file that holds the new source.
  • --entry-point NAME (optional, default main): the entry point name.
  • --output FILE (optional): saves a screenshot of the draw call’s first output after the replay.
  • --output-format FORMAT (optional, default png): png, jpg, or bmp.
  • --remote-host adb://SERIAL (optional): replays on the device with that serial number.
  • --retries COUNT (optional, default 20): the number of connection retries for the remote host.
Note: A compile failure prints success as false, and the command still exits with code 0. Check success in the output.
The capture file is not modified, and the replacement does not persist after the command ends.
The following example reads a fragment shader as a SPIR-V binary, then replaces it with your edited file, first on the host computer and then on a device:
renderdoccmd shader-get --event-id EVENT_ID --stage ps --encoding spirv --output shader.spv capture.rdc
# Edit shader.spv with your SPIR-V tools and save the result as edited.spv
renderdoccmd shader-replace --event-id EVENT_ID --stage ps --encoding spirv --source-file edited.spv --output after.png capture.rdc
renderdoccmd shader-replace --event-id EVENT_ID --stage ps --encoding spirv --source-file edited.spv --output after.png --remote-host adb://SERIAL capture.rdc

Shader Stats Descriptions

Instruction Count All

AttributeDetails
Description
Total count of all instructions. Complex shaders with high instruction counts may have long execution times. More instructions mean longer shader execution time in most cases. An instruction count larger than instruction cache size causes I$ miss and harms shader performance.
Value Range
Positive integer
Optimization
Avoid redundant operations.

ALU Instruction Count 32bit

AttributeDetails
Description
Total count of all 32-bit ALU instructions. More ALU instructions might not affect performance, but can consume more power.
Value Range
0 - Total instructions
Optimization
Remove redundant computations.

ALU Instruction Count 16bit

AttributeDetails
Description
Total count of all 16-bit ALU instructions. 16-bit ALU instructions perform better and use less register space than 32-bit instructions. These are similar to full precision ALU instructions. Converting full-precision ALU instructions into half-precision ALU instructions can improve performance in ALU-bound shaders.
Value Range
0 - Total instructions
Optimization
Use lower precision as much as possible.

Complex Instruction Count

AttributeDetails
Description
Total count of all complex instructions (sin, cos, and so on). EFU instructions are more time consuming than ALU instructions. Short latency sync instruction is needed for the dependency between an EFU and its use instruction.
Value Range
0 - Total instructions
Optimization
If EFU instructions must be used, group some of them together to reduce short sync latency instructions. Aggressively grouping is not recommended.

Texture Read Instruction Count

AttributeDetails
Description
Total count of all texture read instructions. Texture fetch causes memory access latency, which must be hidden by ALU instructions. Latency is decided by the number of texture fetches and their locality in cache.
Value Range
0 - Total instructions
Optimization
Texture fetches that can be coalesced should be grouped together to avoid cache thrashing. Limit the number of texture fetches in each group to be below 15.
Additional Information
Generally, VkImage reads with or without a VkSampler. Also includes input attachment reads.

Flow Control Instruction Count

AttributeDetails
Description
Total count of all flow control instructions. More flow control instructions mean more divergence in shader code, which can harm shader performance. A control flow instruction takes more execution time than an ALU instruction.
Value Range
0 - Total instructions
Optimization
Reduce instructions inside control flow blocks as much as possible so that the control flow can be flattened by the compiler.

Barrier and Fence Instruction Count

AttributeDetails
Description
Total count of all barrier and fence instructions. Global sync reduces wave parallelism and extends application execution time. More power is consumed if the execution time is longer.
Value Range
0 - Total instructions
Optimization
Avoid frequent global synchronization.
Additional Information
Generally, these are op*Barrier instructions in the shader.

Short Latency Sync Instruction Count

AttributeDetails
Description
Total count of all short latency sync instructions. Shader instruction execution can be delayed if it is too close to the instruction that causes this short latency sync, and there is no other wave to hide this latency
Value Range
0 - Total instructions
Optimization
Put EFU instructions together if this does not increase the def-use distance too much.

Long Latency Sync Instruction Count

AttributeDetails
Description
Total count of all long latency sync instructions. This is caused by memory access and it can delay shader instruction execution if the latency is long and there are not enough waves to hide the latency.
Value Range
0 - Total instructions
Optimization
Latency is determined by multiple factors. Improving the locality of memory instructions can help.

Full Precision Register Footprint Per Shader Instance

AttributeDetails
Description
Number of 128-bit registers used by each shader instance. Each 128-bit register can store 4 FP32 values. This is similar to the number of registers. This is the full-precision registers needed by the shader.
Value Range
0 - Max full registers allowed by ISA
Optimization
In addition to the items related to the number of registers, use lower precision variables to avoid high register use in a shader.

Half Precision Register Footprint Per Shader Instance

AttributeDetails
Description
Number of 64-bit registers used by each shader instance. Each 64-bit register can store 4 FP16 values. This is similar to the number of registers. This is the half-precision registers needed by the shader.
Value Range
0 - Max half registers allowed by ISA
Optimization
Try to use half-precision variables, but avoid excessive mixed-precision operations.

Overall Register Footprint Per Shader Instance

AttributeDetails
Description
Number of 128-bit registers used by each shader instance. Each 128-bit register can store 4 FP32 values, or 8 FP16 values. Using too many registers reduces active waves in shader execution and can cause register spill in some cases. Higher active wave counts can hide longer memory latency. However, low active wave count cannot hide latency and ALU utilization will be low.
Value Range
0 - Max registers allowed by ISA
Optimization
Avoid large vector variables with dynamic accesses. Use a constant array/vector if possible, instead of declaring an array/vector and assigning constant values to it.

Scratch Memory Usage Per Shader Instance

AttributeDetails
Description
Number of 128-bit slots of scratch memory used by each shader instance.
Value Range
0 - Max scratch memory size
Optimization
Avoid use of scratch memory. If the shader uses any scratch memory, it will perform poorly.

Output Component Count

AttributeDetails
Description
Total count of all shader stage output components.
Value Range
0 - 128

Input Component Count

AttributeDetails
Description
Total count of all shader stage input components.
Value Range
0 - 128

Shader Processor Utilization Percentage

AttributeDetails
Description
The maximum shader processor utilization for the shader. A higher shader processor utilization percentage means more parallelism in shader execution. Low fiber count can cause memory access latency and idle time on the ALU or other GPU components.
Value Range
0 - 100%
Optimization
Try to lower register use to increase total fiber count. If this number is low, the shader may perform poorly.

Memory Read Instruction Count

AttributeDetails
Description
Total count of all memory read instructions. This is similar to texture fetches, but to different memory access units
Value Range
0 - Total instructions
Optimization
Similar to texture fetches.
Additional Information
Generally, these are VkImage/VkBuffer reads through a storage descriptor.

Memory Write Instruction Count

AttributeDetails
Description
Total count of all memory write instructions.
Value Range
0 - Total instructions
Optimization
Use vector store when possible. Scattered memory store instructions to contiguous memory locations can harm performance.
Additional Information
Generally, these are VkImage/VkBuffer writes through a storage descriptor.

See Also