Accept NaN as valid pass value in shader precision atan2 tests
authorMohankumar Nekkarakalaya <mnekkara@qti.qualcomm.com>
Wed, 25 Aug 2021 22:45:12 +0000 (15:45 -0700)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Fri, 24 Sep 2021 15:01:10 +0000 (15:01 +0000)
Spec mentions that implementation may assume arguments are not
Inf if the entrypoint is not declared with SignedZeroInfNanPreserve
and can perform optimizations.

Components: Vulkan

VK-GL-CTS Issue: 3073

Affected tests:
dEQP-VK.spirv_assembly.instruction.compute.float16.*.atan2
dEQP-VK.spirv_assembly.instruction.graphics.float16.*.atan2*
dEQP-VK.glsl.builtin.precision.atan2.*

Change-Id: I6e1fbc14a5654422cf88e1453fae0774bfce0bb6

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

index ed567c4..f6899b4 100644 (file)
@@ -3251,7 +3251,7 @@ protected:
                                ret |= ctx.format.roundOut(Interval(-DE_PI_DOUBLE, DE_PI_DOUBLE), true);
                }
 
-               if (ctx.format.hasInf() != YES && (!yi.isFinite() || !xi.isFinite()))
+               if (!yi.isFinite() || !xi.isFinite())
                {
                        // Infinities may not be supported, allow anything, including NaN
                        ret |= TCU_NAN;
index fa8e00d..db019b8 100644 (file)
@@ -15212,7 +15212,7 @@ struct fp16Atan2 : public fp16PerComponent
                const double    yd              (y.asDouble());
                double                  result  (0.0);
 
-               if (x.isZero() && y.isZero())
+               if ((x.isZero() && y.isZero())||(x.isInf() && y.isInf()))
                        return false;
 
                if (getFlavor() == 0)