OSDN Git Service

Precision fix for inversesqrt.
authorAlexis Hetu <sugoi@google.com>
Mon, 13 Nov 2017 22:31:20 +0000 (17:31 -0500)
committerAlexis Hétu <sugoi@google.com>
Tue, 14 Nov 2017 18:26:53 +0000 (18:26 +0000)
Fixes all dEQP failures in inversesqrt and normalize.

Change-Id: Ifd1ac2714fa95bab1c720b65c95a27bbf23ea933
Reviewed-on: https://swiftshader-review.googlesource.com/13728
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
src/Shader/ShaderCore.cpp

index 29fea75..53644b8 100644 (file)
@@ -227,7 +227,7 @@ namespace sw
 
                Float4 rsq;
 
-               if(!pp && rsqPrecision >= IEEE)
+               if(!pp)
                {
                        rsq = Float4(1.0f) / Sqrt(abs);
                }
@@ -239,10 +239,9 @@ namespace sw
                        {
                                rsq = rsq * (Float4(3.0f) - rsq * rsq * abs) * Float4(0.5f);
                        }
-               }
 
-               int big = 0x7F7FFFFF;
-               rsq = Min(rsq, Float4((float&)big));
+                       rsq = As<Float4>(CmpNEQ(As<Int4>(abs), Int4(0x7F800000)) & As<Int4>(rsq));
+               }
 
                return rsq;
        }