Stricter codomain in atan2 precision tests
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Wed, 15 Jan 2020 11:46:48 +0000 (12:46 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 18 Feb 2020 08:54:10 +0000 (03:54 -0500)
With this change calculation of codomain can use EvalContext
which alows to limit atan2 codomain to <-pi;pi>.

Components: Vulkan

VK-GL-CTS issue: 479

Affects:
dEQP-VK.glsl.builtin.precision*atan2*

Change-Id: Ie71a650b8611e867aa9eacd2205f090b6f5de613

external/vulkancts/modules/vulkan/shaderexecutor/vktShaderBuiltinPrecisionTests.cpp

index 71f1e0e..0710385 100644 (file)
@@ -2333,7 +2333,7 @@ protected:
                                                                         TCU_SET_INTERVAL(ret, point,
                                                                                                          point = this->applyPoint(ctx, x, y)));
                reti |= innerExtrema(ctx, xi, yi);
-               reti &= (this->getCodomain() | TCU_NAN);
+               reti &= (this->getCodomain(ctx) | TCU_NAN);
 
                return ctx.format.convert(reti);
        }
@@ -2360,7 +2360,7 @@ protected:
                TCU_THROW(InternalError, "Cannot apply");
        }
 
-       virtual Interval        getCodomain             (void) const
+       virtual Interval        getCodomain             (const EvalContext&) const
        {
                return Interval::unbounded(true);
        }
@@ -3266,7 +3266,10 @@ protected:
                        return ctx.format.ulp(ret, 5.0);
        }
 
-       // Codomain could be [-pi, pi], but that would probably be too strict.
+       Interval getCodomain(const EvalContext& ctx) const
+       {
+               return ctx.format.roundOut(Interval(-DE_PI_DOUBLE, DE_PI_DOUBLE), true);
+       }
 };
 
 ExprP<float> atan2     (const ExprP<float>& x, const ExprP<float>& y)  { return app<ATan2<Signature<float, float, float> > >(x, y); }