Shaders: Uncovering Performance Issues

Given a scene with multiple shaders applied, how might one go about discovering which shaders are the most performance-intensive, and within the various shaders, what sections are particularly impacting performance…?

I usually just switch off/on (hide/show) some objects or disable some parts of the GLSL code to observe FPS-meter behaviour (my FPS meter is usually not limited to 60 fps during development, so I can clearly learn the performance).

PStats could be helpful.

https://docs.panda3d.org/1.10/python/optimization/using-pstats

Thank you both for your replies! :slight_smile:

I’ve certainly used that–but it seems to me that performance improvements gained by doing so would not necessarily be due to the shader applied to the objects in question. For example, the objects may have complex transforms applied, or be part of an overdraw issue…

This too is something that I’ve done before–but my understanding is that it may incur changes to the optimisation of the shader. For example, preceding lines that only affected the removed lines may themselves be then removed, I think. Which may then muddy the interpretation of the results…

It certainly is!

But while it can tell me, for example, that I have an issue with state changes, it doesn’t necessarily tell me which shaders (if any) might be problematic, or which parts of shaders (if any) might be slow–at least so far as I see!

If you are using a NVidia GPU, you can use NSight to profile your shaders, see this blog article https://developer.nvidia.com/blog/identifying-shader-limiters-with-the-shader-profiler-in-nvidia-nsight-graphics/

1 Like

Ooh, that looks like just the thing! Thank you so much! :slight_smile: