diff options
author | Luca Barbieri <[email protected]> | 2010-04-02 01:43:49 +0200 |
---|---|---|
committer | Luca Barbieri <[email protected]> | 2010-04-02 02:31:43 +0200 |
commit | aee5bb5b8ad80d4aed849519a80b1d696991e866 (patch) | |
tree | b98b8570bbc11c3aa72253bef2e1d3260cc8fd71 /src | |
parent | ecaaf8c15f98551f809d5219f87af7fdb451c029 (diff) |
gallium/util: add util_format_init that inits s3tc and util_half
Switch from auto-init to explicit init for util_half per Brian Paul's
indication.
NOTE: this is probably broken because not enough things call util_format_init.
Will be fixed shortly
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/util/u_format.c | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_format.h | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_half.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_half.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_screen.c | 3 |
5 files changed, 23 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 7f16cf7d018..d3ee1f03396 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -33,6 +33,8 @@ */ #include "u_format.h" +#include "u_format_s3tc.h" +#include "u_half.h" void @@ -116,3 +118,11 @@ util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_ format_desc->pack_8unorm(dst_row, dst_stride, src_row, src_stride, w, h); } +boolean util_format_inited; + +void +util_format_do_init(void) +{ + util_format_s3tc_init(); + util_half_init(); +} diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 93818a31611..f7daa6d9236 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -32,6 +32,7 @@ #include "pipe/p_format.h" #include "util/u_debug.h" +#include "util/u_inline_init.h" #ifdef __cplusplus extern "C" { @@ -530,6 +531,8 @@ util_format_write_4ub(enum pipe_format format, void *dst, unsigned dst_stride, unsigned x, unsigned y, unsigned w, unsigned h); +UTIL_INLINE_INIT(util_format); + #ifdef __cplusplus } // extern "C" { #endif diff --git a/src/gallium/auxiliary/util/u_half.c b/src/gallium/auxiliary/util/u_half.c index 96b83e5ac00..4c8f8a51c52 100644 --- a/src/gallium/auxiliary/util/u_half.c +++ b/src/gallium/auxiliary/util/u_half.c @@ -59,8 +59,10 @@ uint32_t util_half_to_float_offset_table[64]; uint16_t util_float_to_half_base_table[512]; uint8_t util_float_to_half_shift_table[512]; -static void -util_half_init_tables(void) +boolean util_half_inited; + +void +util_half_do_init(void) { int i; @@ -161,5 +163,3 @@ util_half_init_tables(void) util_float_to_half_shift_table[256 + i] = util_float_to_half_shift_table[i]; } } - -UTIL_INIT(util_half_init_tables); diff --git a/src/gallium/auxiliary/util/u_half.h b/src/gallium/auxiliary/util/u_half.h index 4b80d45b919..02f0f241936 100644 --- a/src/gallium/auxiliary/util/u_half.h +++ b/src/gallium/auxiliary/util/u_half.h @@ -2,7 +2,8 @@ #define U_HALF_H #include "pipe/p_compiler.h" -#include "u_math.h" +#include "util/u_math.h" +#include "util/u_inline_init.h" #ifdef __cplusplus extern "C" { @@ -55,6 +56,8 @@ util_float_to_half(float f) return util_floatui_to_half(i.ui); } +UTIL_INLINE_INIT(util_half); + #ifdef __cplusplus } #endif diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index be64048abfc..26a4bba5746 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -27,6 +27,7 @@ #include "util/u_memory.h" +#include "util/u_format.h" #include "util/u_format_s3tc.h" #include "pipe/p_defines.h" #include "pipe/p_screen.h" @@ -241,7 +242,7 @@ softpipe_create_screen(struct sw_winsys *winsys) screen->base.context_create = softpipe_create_context; screen->base.flush_frontbuffer = softpipe_flush_frontbuffer; - util_format_s3tc_init(); + util_format_init(); softpipe_init_screen_texture_funcs(&screen->base); softpipe_init_screen_buffer_funcs(&screen->base); |