Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

OpenGL allows you to share the same shader between multiple programs. Aside from saving small amounts of memory and a shader handle, are there any GPU-side performance benefits to doing this?

share|improve this question

I doubt there is a GPU-side performance benefit.

When you bind a generic shader to a program for example, an efficient implementation should be able to remove unused attributes between that shader and the other shaders in that program and possibly even simplify the shader logic as a result. Of course, this is no real benefit over a hand-tuned shader combination, but it does help manage the complexity/combinatorics, and possibly reduce the number of compiles the driver has to do.

However, there may be drawbacks to doing this in terms of hitting inefficient driver-compiler implementations. And there are some out there, check: for just some simple things that some implementations can get wrong.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.