need to use absolute value for RSQ
authorBrian Paul <brian.paul@tungstengraphics.com>
Sun, 30 Oct 2005 16:52:02 +0000 (16:52 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sun, 30 Oct 2005 16:52:02 +0000 (16:52 +0000)
src/mesa/swrast/s_nvfragprog.c

index 218abedadf2d6dfc30f7266f2361dcdd31171f1b..434f3f5c060833bb245118c73329d242f1333d8e 100644 (file)
@@ -1031,10 +1031,11 @@ execute_program( GLcontext *ctx,
             {
                GLfloat a[4], result[4];
                fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
+               a[0] = FABSF(a[0]);
                result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]);
                store_vector4( inst, machine, result );
 #if DEBUG_FRAG
-               printf("RSQ %g = 1/sqrt(%g)\n", result[0], a[0]);
+               printf("RSQ %g = 1/sqrt(|%g|)\n", result[0], a[0]);
 #endif
             }
             break;