Use INV_SQRT instead of 1/SQRTF
authorMatt Turner <mattst88@gmail.com>
Fri, 20 Jul 2012 17:03:10 +0000 (10:03 -0700)
committerMatt Turner <mattst88@gmail.com>
Sat, 21 Jul 2012 15:23:38 +0000 (08:23 -0700)
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/math/m_debug_norm.c
src/mesa/tnl/t_vb_points.c

index 02eb1f989f6d0afe2d91470f0d7c9da5793d1960..dc768f3064203c0ccac88b03b8e99fc1305d192f 100644 (file)
@@ -165,7 +165,7 @@ static void ref_norm_transform_normalize( const GLmatrix *mat,
            /* Hmmm, don't know how we could test the precalculated
             * length case...
             */
-            scale = 1.0 / SQRTF( len );
+            scale = INV_SQRTF( len );
            SCALE_SCALAR_3V( out[i], scale, t );
          } else {
             out[i][0] = out[i][1] = out[i][2] = 0;
@@ -241,7 +241,7 @@ static int test_norm_function( normal_func func, int mtype, long *cycles )
       ASSIGN_3V( d2[i], 0.0, 0.0, 0.0 );
       for ( j = 0 ; j < 3 ; j++ )
          s[i][j] = rnd();
-      length[i] = 1 / SQRTF( LEN_SQUARED_3FV( s[i] ) );
+      length[i] = INV_SQRTF( LEN_SQUARED_3FV( s[i] ) );
    }
 
    source->data = (GLfloat(*)[4]) s;
index 9edbbc708e60c1b2f7237d69e91dadc4cf8e4217..0e33b691e0f83d8f717464e279aa622c67a91a9b 100644 (file)
@@ -64,7 +64,7 @@ run_point_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
       for (i = 0; i < VB->Count; i++) {
          const GLfloat dist = FABSF(*eyeCoord);
          const GLfloat q = p0 + dist * (p1 + dist * p2);
-         const GLfloat atten = (q != 0.0F) ? SQRTF(1.0F / q) : 1.0F;
+         const GLfloat atten = (q != 0.0F) ? INV_SQRTF(q) : 1.0F;
          size[i][0] = pointSize * atten; /* clamping done in rasterization */
          eyeCoord += eyeCoordStride;
       }