<p>A lot goes in to benching performance. I think most would agree that measuring the frame time of your application is the best metric you can gather about how well you're doing at run-time. An easy way to "bench" your shaders in your engine/environment is to simply record frame times for a fixed duration with a fixed view and fixed scene. Then save those frame times out to a CSV and plot them in something like Excel. This should give you a good idea of how much your frame time is fluctuating and if you're actually hitting your frame time targets most of the time. </p>

<p>However if you want to see if your shaders are properly utilizing the GPU you may want to dig into your application with something like <a href="http://developer.amd.com/tools-and-sdks/graphics-development/gpu-perfstudio/" rel="nofollow noreferrer">AMD's GPU Perf Studio</a> or <a href="https://developer.nvidia.com/nvidia-nsight-visual-studio-edition" rel="nofollow noreferrer">Nvidia's NSight</a> tool. I'm more familiar with Perf Studio but it can give you a static shader analysis to see if you're actually taking full advantage of the GPU or if you're overloading certain registers. </p>

CC BY-SA 3.0
2017-01-03T23:35:58.547Z
2017-01-03T23:35:58.547Z
Honeybunch
<p>How can I benchmark a fragment shader? 
What my shader does is basically lots of floating point operations, since it's doing some procedural stuff.</p>

<opengl><shader><glsl><procedural-generation>
Benchmark GLSL fragment shader
user24100
# Benchmark GLSL fragment shader

(Asked by: username_0 on 2017-01-03)

How can I benchmark a fragment shader?
What my shader does is basically lots of floating point operations, since it's doing some procedural stuff.

**Tags:** opengl, shader, glsl, procedural-generation


---

## 1 answers

### Answer by username_1 on 2017-01-03. Score: 3

A lot goes in to benching performance. I think most would agree that measuring the frame time of your application is the best metric you can gather about how well you're doing at run-time. An easy way to "bench" your shaders in your engine/environment is to simply record frame times for a fixed duration with a fixed view and fixed scene. Then save those frame times out to a CSV and plot them in something like Excel. This should give you a good idea of how much your frame time is fluctuating and if you're actually hitting your frame time targets most of the time.

However if you want to see if your shaders are properly utilizing the GPU you may want to dig into your application with something like [AMD's GPU Perf Studio](http://developer.amd.com/tools-and-sdks/graphics-development/gpu-perfstudio/) or [Nvidia's NSight](https://developer.nvidia.com/nvidia-nsight-visual-studio-edition) tool. I'm more familiar with Perf Studio but it can give you a static shader analysis to see if you're actually taking full advantage of the GPU or if you're overloading certain registers.


---

