diff options
author | Dylan Baker <[email protected]> | 2018-09-06 15:26:19 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2020-04-21 11:09:03 -0700 |
commit | bd4e769515345a6b20562310334bc828c0bb6605 (patch) | |
tree | 47bb02a22015694705ed6e954b098f6946ccf2c2 /src/mesa | |
parent | f8e4542bad7dd9bb97b2990947ef74dbb2ee75e4 (diff) |
replace LOG2 with util_fast_log2
The implementation is somewhat different, although if you go back in
time far enough they're the same, but the one in u_math was changed a
long time back to be faster.
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Kristian H. Kristensen <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/swrast/s_span.c | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_texfilter.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index c5bb058a3b8..cd97d0416e5 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -426,7 +426,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat x = sqrtf(dudx * dudx + dvdx * dvdx); GLfloat y = sqrtf(dudy * dudy + dvdy * dvdy); GLfloat rho = MAX2(x, y); - GLfloat lambda = LOG2(rho); + GLfloat lambda = util_fast_log2(rho); return lambda; } @@ -453,7 +453,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, maxU = MAX2(dsdx2, dsdy2) * texW; maxV = MAX2(dtdx2, dtdy2) * texH; rho = MAX2(maxU, maxV); - lambda = LOG2(rho); + lambda = util_fast_log2(rho); return lambda; } #endif diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index cb91b81260e..13d517b6261 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1961,7 +1961,7 @@ sample_lambda_2d_aniso(struct gl_context *ctx, /* note: we need to have Pmin=sqrt(Pmin2) here, but we can avoid * this since 0.5*log(x) = log(sqrt(x)) */ - lod = 0.5f * LOG2(Pmin2); + lod = 0.5f * util_fast_log2(Pmin2); if (adjustLOD) { /* from swrast/s_texcombine.c _swrast_texture_span */ |