title: Shader limitations
body: <p>I've been tuning my game's renderer for my laptop, which has a Radeon HD 3850. This chip has a decent amount of processing power, but rather limited memory bandwidth, so I've been trying to move more shader work into fewer passes.</p>
  <p>Previously, I was using a simple multipass model:</p>
  <ul>
    <li>
      Bind and clear FP16 blend buffer (with depth buffer)
      <ul>
        <li>Depth-only pass</li>
        <li>For each light, do an additive light pass</li>
      </ul>
    </li>
    <li>
      Bind backbuffer, use blend buffer as a texture
      <ul>
        <li>Tone mapping pass</li>
      </ul>
    </li>
  </ul>
  <p>In an attempt to improve the performance of this method, I wrote a new rendering path that counts the number and type of lights to dynamically build custom GLSL shaders. These shaders accept all light parameters as uniforms and do all lighting in a single pass. I was expecting to run into some kind of limit, so I tested it first with one light. Then three. Then twenty-one, with no errors or artifacts, and with great performance. This leads me to my actual questions:</p>
  <blockquote>
  <p>Is the maximum number of uniforms retrievable?</p>
  <p>Is this method viable on older hardware, or are uniforms much more limited?</p>
  <p>If I push it too far, at what point will I get an error? Shader compilation? Program linking? Using the program?</p>
  </blockquote>