PDA

View Full Version : Shader program caching at the driver level



pjcozzi
10-08-2010, 08:52 AM
Hello,

It is a common practice for applications to sort by shader (and other states) before rendering. In order to implement this, I keep a cache of shader programs so I never call glCreateProgram for one that already exists.

My question is do drivers cache shader programs and objects under the hood? I imagine they do, at the least to avoid redundant compile and link steps. If so, is there still a cost associated with "switching shader programs" that are actually the same program under the hood (but different external IDs)?

I suppose this is more of a "just curious" question since I imagine it is a best practice for an application to do caching to minimize the number of GL objects created.

Regards,
Patrick