title: Most efficient way of discarding pixel shader calculations with OpenGL ES
body: <p>I have multiple texture reads in my fragment shader, and I am supposedly doing <strong>bad things</strong>, like using the <code>discard</code> command and conditionals inside the shader.</p>
  
  <p>The thing is, I am rendering to a texture and I want to reuse it in following passes with other shaders, that do not have to operate on pixels that were previously "discarded". This is for performance. The thing is, I need also to discard calculations if uniforms are out of certain ranges (which I read from another texture): imagine a loop with these shaders running always on the same textures, which are not cleared.</p>
  
  <p>So what I have now, is a terrible performance. One idea I thought about is using <code>glFragDepth</code> together with the depth buffer and use that to fire depth testing in order to discard some pixels. But this does not work with the fact I want to have ranges.</p>
  
  <p>Is there any alternative?</p>