title: Once upon a time, when > was faster than < ... Wait, what?
body: <p>I am reading <a href="https://paroj.github.io/gltut/Positioning/Tut05%20Overlap%20and%20Depth%20Buffering.html" rel="nofollow noreferrer">an awesome OpenGL tutorial</a>. It's really great, trust me. The topic I am currently at is Z-buffer. Aside from explaining what's it all about, the author mentions that we can perform custom depth tests, such as GL_LESS, GL_ALWAYS, etc. He also explains that the actual meaning of depth values (which is top and which isn't) can also be customized. I understand so far. And then the author says something unbelievable:</p>
  <blockquote>
  <p>The range zNear can be greater than the range zFar; if it is, then the
  window-space values will be reversed, in terms of what constitutes
  closest or farthest from the viewer.</p>
  <p>Earlier, it was said that the window-space Z value of 0 is closest and
  1 is farthest. However, if our clip-space Z values were negated, the
  depth of 1 would be closest to the view and the depth of 0 would be
  farthest. Yet, if we flip the direction of the depth test (GL_LESS to
  GL_GREATER, etc), we get the exact same result. So it's really just a
  convention. <em><strong>Indeed, flipping the sign of Z and the depth test was once
  a vital performance optimization for many games.</strong></em></p>
  </blockquote>
  <p>If I understand correctly, performance-wise, flipping the sign of Z and the depth test is nothing but changing a <code>&lt;</code> comparison to a <code>&gt;</code> comparison. So, if I understand correctly and the author isn't lying or making things up, then changing <code>&lt;</code> to <code>&gt;</code> used to be <em><strong>a vital optimization</strong></em> for many games.</p>
  <p>Is the author making things up, am I misunderstanding something, or is it indeed the case that once <code>&lt;</code> was slower (<em>vitally</em>, as the author says) than <code>&gt;</code>?</p>
  <p>Thanks for clarifying this quite curious matter!</p>
  <p><sub>Disclaimer: I am fully aware that algorithm complexity is the primary source for optimizations. Furthermore, I suspect that nowadays it definitely wouldn't make any difference and I am not asking this to optimize anything. I am just extremely, painfully, maybe prohibitively curious.</sub></p>