In compiler.h we define the likely(), unlikely() macros which wrap GCC's __builtin_expect(). But we only use them in a handful of places.

It seems to me that an obvious place to possibly use these would be for GL error testing. For example, in glDrawArrays():

   if (unlikely(count <= 0)) {
      _mesa_error();
   }

Plus, in some of the glBegin/End per-vertex calls such as glVertexAttrib3fARB() where we error test the index parameter.

I guess the key question is how much might we gain from this. I don't really have a good feel for the value at this level. In a tight inner loop, sure, but the GL error checking is pretty high-level code.

I haven't found much on the web about performance gains from __builtin_expect(). Anyone?

-Brian

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to