From 52e9b990a192a9329006d5f7dd2ac222effea5a5 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 2 Apr 2010 04:48:42 +0200 Subject: 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.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/auxiliary/util/u_format_s3tc.h') diff --git a/src/gallium/auxiliary/util/u_format_s3tc.h b/src/gallium/auxiliary/util/u_format_s3tc.h index 5c3a9dd22c..5be4bbec12 100644 --- a/src/gallium/auxiliary/util/u_format_s3tc.h +++ b/src/gallium/auxiliary/util/u_format_s3tc.h @@ -31,6 +31,7 @@ #include "pipe/p_compiler.h" +#include "util/u_inline_init.h" enum util_format_dxtn { @@ -65,8 +66,7 @@ extern util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch; extern util_format_dxtn_pack_t util_format_dxtn_pack; -void -util_format_s3tc_init(void); +UTIL_INLINE_INIT(util_format_s3tc); void -- cgit v1.2.3