Mesa (master): st/mesa: rewrite st_choose_format() to be table driven

Brian Paul brianp at kemper.freedesktop.org
Tue May 24 15:01:02 UTC 2011


Module: Mesa
Branch: master
Commit: d57e95f22af1a1b2d9013db7a15524717bd29579
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d57e95f22af1a1b2d9013db7a15524717bd29579

Author: Brian Paul <brianp at vmware.com>
Date:   Sat May 21 10:43:49 2011 -0600

st/mesa: rewrite st_choose_format() to be table driven

Instead of using a giant switch statement with lots of code, use a
table to convert GL format enums to pipe formats.

Tested by running the old code next to the new and asserting that
the return value was the same for piglit tests.

We're doing a linear search, but if that ever appears to be too slow
the table could easily be sorted or hashed.

---

 src/mesa/state_tracker/st_format.c | 1454 ++++++++++++++----------------------
 1 files changed, 549 insertions(+), 905 deletions(-)

Diff:   http://cgit.freedesktop.org/mesa/mesa/diff/?id=d57e95f22af1a1b2d9013db7a15524717bd29579



More information about the mesa-commit mailing list