From f9b1e5241facc8cf255c258082d5cb5b04783e93 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 4 Mar 2003 16:33:53 +0000 Subject: added _mesa_inv_sqrtf() and INV_SQRTF() (Josh Vanderhoof) --- src/mesa/swrast/s_aalinetemp.h | 4 ++-- src/mesa/swrast/s_nvfragprog.c | 5 ++--- src/mesa/swrast/s_span.c | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 529da48110..9850ff9ac5 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -1,4 +1,4 @@ -/* $Id: s_aalinetemp.h,v 1.22 2003/02/21 21:00:27 brianp Exp $ */ +/* $Id: s_aalinetemp.h,v 1.23 2003/03/04 16:34:02 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -132,7 +132,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1) line.y1 = v1->win[1]; line.dx = line.x1 - line.x0; line.dy = line.y1 - line.y0; - line.len = (GLfloat) sqrt(line.dx * line.dx + line.dy * line.dy); + line.len = SQRTF(line.dx * line.dx + line.dy * line.dy); line.halfWidth = 0.5F * ctx->Line.Width; if (line.len == 0.0 || IS_INF_OR_NAN(line.len)) diff --git a/src/mesa/swrast/s_nvfragprog.c b/src/mesa/swrast/s_nvfragprog.c index 97f65c0479..147b5248d4 100644 --- a/src/mesa/swrast/s_nvfragprog.c +++ b/src/mesa/swrast/s_nvfragprog.c @@ -1,4 +1,4 @@ -/* $Id: s_nvfragprog.c,v 1.5 2003/03/01 01:50:26 brianp Exp $ */ +/* $Id: s_nvfragprog.c,v 1.6 2003/03/04 16:34:03 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -582,8 +582,7 @@ execute_program(GLcontext *ctx, const struct fragment_program *program) { GLfloat a[4], result[4]; fetch_vector1( &inst->SrcReg[0], machine, a ); - result[0] = result[1] = result[2] = result[3] - = 1.0F / SQRTF(a[0]); + result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]); store_vector4( inst, machine, result ); } break; diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index d408151803..2106b87c5b 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1,4 +1,4 @@ -/* $Id: s_span.c,v 1.56 2003/03/01 01:50:26 brianp Exp $ */ +/* $Id: s_span.c,v 1.57 2003/03/04 16:34:03 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -309,8 +309,8 @@ compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, GLfloat dvdx = texH * ((t + dtdx) / (q + dqdx) - t * invQ); GLfloat dudy = texW * ((s + dsdy) / (q + dqdy) - s * invQ); GLfloat dvdy = texH * ((t + dtdy) / (q + dqdy) - t * invQ); - GLfloat x = sqrt(dudx * dudx + dvdx * dvdx); - GLfloat y = sqrt(dudy * dudy + dvdy * dvdy); + GLfloat x = SQRTF(dudx * dudx + dvdx * dvdx); + GLfloat y = SQRTF(dudy * dudy + dvdy * dvdy); GLfloat rho = MAX2(x, y); GLfloat lambda = LOG2(rho); return lambda; -- cgit v1.2.3