From 1cbd51068802a3aa530b9c12d86c40cb3a1bbfa4 Mon Sep 17 00:00:00 2001
From: Brian Paul <brianp@vmware.com>
Date: Mon, 29 Mar 2010 11:31:02 -0600
Subject: glsl: avoid using rcp in length() functions

See prev commit for related info.
---
 src/mesa/shader/slang/library/slang_common_builtin.gc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/mesa')

diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index 3d464630df2..d75354deffe 100644
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -1160,7 +1160,7 @@ float length(const vec2 v)
    float r;
    const float p = dot(v, v);      // p = v.x * v.x + v.y * v.y
    __asm float_rsq r, p;           // r = 1 / sqrt(p)
-   __asm float_rcp __retVal.x, r;  // retVal = 1 / r
+   __retVal = p * r;               // p * r = sqrt(p);
 }
 
 float length(const vec3 v)
@@ -1168,7 +1168,7 @@ float length(const vec3 v)
    float r;
    const float p = dot(v, v);      // p = v.x * v.x + v.y * v.y + v.z * v.z
    __asm float_rsq r, p;           // r = 1 / sqrt(p)
-   __asm float_rcp __retVal, r;    // retVal = 1 / r
+   __retVal = p * r;               // p * r = sqrt(p);
 }
 
 float length(const vec4 v)
@@ -1176,7 +1176,7 @@ float length(const vec4 v)
    float r;
    const float p = dot(v, v);      // p = v.x * v.x + v.y * v.y + ...
    __asm float_rsq r, p;           // r = 1 / sqrt(p)
-   __asm float_rcp __retVal, r;    // retVal = 1 / r
+   __retVal = p * r;               // p * r = sqrt(p);
 }
 
 
-- 
cgit v1.2.3