From: Brian Paul Date: Mon, 29 Mar 2010 17:31:02 +0000 (-0600) Subject: glsl: avoid using rcp in length() functions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1cbd51068802a3aa530b9c12d86c40cb3a1bbfa4;p=mesa.git glsl: avoid using rcp in length() functions See prev commit for related info. --- 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); }