gallium/util: load s3tc on demand
authorLuca Barbieri <luca@luca-barbieri.com>
Fri, 2 Apr 2010 02:48:42 +0000 (04:48 +0200)
committerLuca Barbieri <luca@luca-barbieri.com>
Fri, 2 Apr 2010 04:16:30 +0000 (06:16 +0200)
commit52e9b990a192a9329006d5f7dd2ac222effea5a5
tree18b64892f9384a5a5b94d66803d1465d071e53f0
parent6259264c57537896d72158f811674a192c6a1596
gallium/util: load s3tc on demand

This changes the S3TC function pointers to be initialized to stubs
that load the S3TC library and then delegate to the real functions.

If the S3TC library fails to load, the function pointers are replaced
with a "nop" function.

The code is also changed to attempt to load the library only one time.c

Note that unlike checking for a flag, this method has no performance
cost at all.

The use of the "nop" functions also allows to avoid most checks, that
are only preserved when the function does non-trivial work.
src/gallium/auxiliary/util/u_format_s3tc.c
src/gallium/auxiliary/util/u_format_s3tc.h