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.
1 Answer
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 or Nvidia's NSight 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.