title: Profiling graphics shaders
body: <p>For quite some time, I've been avoiding branching in my shader code by, instead of </p>
  
  <pre><code>float invert_value(in float value)
  {
  if(value == 0.0)
      return 0.0;
  else
      return 1.0 / value;
  }
  </code></pre>
  
  <p>writing 'clever' code like this</p>
  
  <pre><code>float invert_value_ifless(in float value)
  {
  float sign_value = sign(value);
  float sign_value_squared = sign_value*sign_value;
  return sign_value_squared / ( value + sign_value_squared - 1.0); 
  }
  </code></pre>
  
  <p>This returns exactly what the first function does and has no branches, thus it is faster.</p>
  
  <p>Or is it? Am I fighting with ghosts here?</p>
  
  <p>How to profile graphics shaders for speed? I am most interested in recent mobile platforms (Android) but any advice on graphics profiling in general would be welcome! </p>