How to test shader performance

Is there a good way to test shader performance? Is there any way to find out how long a frame takes?

(I am considering using an if statement or two in a fragment shader and it would helpful to know the cost)

I guess there is MS box on stats: stats.js | JavaScript Performance Monitor

I’m wondering if there is anything more specific to vertex and fragment shader render time/performance.

I guess there is MS box on stats: stats.js | JavaScript Performance Monitor

This just measures JS performance and won’t be great for measuring the impact of shader changes.

See this PR which adds a panel for stat.js which measures the amount of time the GPU spends doing work. It uses the disjoint_timer_query extension, which seems to only be available in chrome, and provides timings in nanoseconds (while the panel in the PR displays timings in MS):

1 Like

Thank you, this looks great.