{
const unsigned X = 0;
- store[X + 0] = LOG2( store[X + 0] );
- store[X + 1] = LOG2( store[X + 1] );
- store[X + 2] = LOG2( store[X + 2] );
- store[X + 3] = LOG2( store[X + 3] );
+ store[X + 0] = util_fast_log2( store[X + 0] );
+ store[X + 1] = util_fast_log2( store[X + 1] );
+ store[X + 2] = util_fast_log2( store[X + 2] );
+ store[X + 3] = util_fast_log2( store[X + 3] );
}
static void
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_util.h"
+#include "util/u_math.h"
#include "sp_clear.h"
#include "sp_context.h"
#include "sp_flush.h"
struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
uint i;
+ util_init_math();
+
#ifdef PIPE_ARCH_X86
softpipe->use_sse = !debug_get_bool_option( "GALLIUM_NOSSE", FALSE );
#else
#include "pipe/p_defines.h"
#include "pipe/p_util.h"
#include "tgsi/tgsi_exec.h"
+#include "util/u_math.h"
/*
rho = MAX2(rho, max);
}
- lambda = LOG2(rho);
+ lambda = util_fast_log2(rho);
lambda += lodbias + sampler->state->lod_bias;
lambda = CLAMP(lambda, sampler->state->min_lod, sampler->state->max_lod);
#define FABSF(x) ((float) fabs(x))
#endif
-/* Pretty fast, and accurate.
- * Based on code from http://www.flipcode.com/totd/
- */
-static INLINE float LOG2(float val)
-{
- union fi num;
- int log_2;
-
- num.f = val;
- log_2 = ((num.i >> 23) & 255) - 128;
- num.i &= ~(255 << 23);
- num.i += 127 << 23;
- num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
- return num.f + log_2;
-}
#if defined(__GNUC__)
#define CEILF(x) ceilf(x)