Putting calls to util_format_init all over the codebase is infeasible.
Instead, half float tables are pregenerated, and the s3tc library is
loaded on demand.
I believe this is a solution that combines performance, cleanliness,
flexibility and portability.
#include <stdio.h>
#include <float.h>
-#include "util/u_half.h"
#include "util/u_format.h"
#include "util/u_format_tests.h"
-#include "util/u_format_s3tc.h"
static boolean
{
boolean success;
- util_format_init();
-
success = test_all();
return success ? 0 : 1;
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();
-}
void *dst, unsigned dst_stride,
unsigned x, unsigned y, unsigned w, unsigned h);
-UTIL_INLINE_INIT(util_format);
-
#ifdef __cplusplus
} // extern "C" {
#endif
struct nv50_screen *screen = nv50_screen(pscreen);
struct nv50_context *nv50;
- util_format_init();
-
nv50 = CALLOC_STRUCT(nv50_context);
if (!nv50)
return NULL;
screen->base.context_create = softpipe_create_context;
screen->base.flush_frontbuffer = softpipe_flush_frontbuffer;
- util_format_init();
+ util_format_s3tc_init();
softpipe_init_screen_texture_funcs(&screen->base);
softpipe_init_screen_buffer_funcs(&screen->base);