From 4fdcdd50d72a1317dbab9f75738e5bb9ccd30634 Mon Sep 17 00:00:00 2001 From: Pyry Haulos Date: Tue, 5 May 2015 12:31:13 -0700 Subject: [PATCH] Relax builtin precision tests, fix issue in div rounding * sin(), cos() and derived: Use |x| * 2^-10 for mediump inputs outside of range [-pi,pi]. * asin(), acos(), and atan(): Use 4096 ULP for highp (from OpenCL's fast relaxed math). * modf(): allow any value, including NaN, as fractional if Inf support is not mandated for the precision (lowp and mediump). * atan(y, x): allow any value if y or x is Inf and no Inf support is mandated for the precision. * div (and derived): allow rounding of -/+inf to -/+maxval when both inputs are ordinary and denominator is not 0 (legal in RTZ mode). Bug: 20453754 Bug: 18323265 Change-Id: I8e2fad8909e29993e961d66a175963071ea2e5a8 --- android/cts/master/com.drawelements.deqp.gles3.xml | 140 +++++++++++++++++++++ .../cts/master/com.drawelements.deqp.gles31.xml | 42 +++++++ android/cts/master/gles3-master.txt | 40 ++++++ android/cts/master/gles31-master.txt | 12 ++ android/cts/master/src/gles3-test-issues.txt | 40 ------ android/cts/master/src/gles31-test-issues.txt | 12 -- framework/common/tcuFloatFormat.cpp | 8 +- framework/common/tcuFloatFormat.hpp | 1 + modules/glshared/glsBuiltinPrecisionTests.cpp | 61 +++++++-- 9 files changed, 287 insertions(+), 69 deletions(-) diff --git a/android/cts/master/com.drawelements.deqp.gles3.xml b/android/cts/master/com.drawelements.deqp.gles3.xml index 9adc06d..b21e0c9 100644 --- a/android/cts/master/com.drawelements.deqp.gles3.xml +++ b/android/cts/master/com.drawelements.deqp.gles3.xml @@ -55396,6 +55396,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -55684,6 +55712,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -55928,6 +55984,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -56518,6 +56602,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57866,6 +57978,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/cts/master/com.drawelements.deqp.gles31.xml b/android/cts/master/com.drawelements.deqp.gles31.xml index 7d41635..b63d31f 100644 --- a/android/cts/master/com.drawelements.deqp.gles31.xml +++ b/android/cts/master/com.drawelements.deqp.gles31.xml @@ -6744,6 +6744,20 @@ + + + + + + + + + + + + + + @@ -6876,6 +6890,20 @@ + + + + + + + + + + + + + + @@ -7214,6 +7242,20 @@ + + + + + + + + + + + + + + diff --git a/android/cts/master/gles3-master.txt b/android/cts/master/gles3-master.txt index 7a0b102..80cecdc 100644 --- a/android/cts/master/gles3-master.txt +++ b/android/cts/master/gles3-master.txt @@ -17085,6 +17085,14 @@ dEQP-GLES3.functional.shaders.builtin_functions.precision.div.mediump_fragment.s dEQP-GLES3.functional.shaders.builtin_functions.precision.div.mediump_fragment.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.div.mediump_fragment.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.div.mediump_fragment.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_vertex.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_vertex.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_vertex.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_vertex.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_fragment.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_fragment.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_fragment.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_fragment.vec4 dEQP-GLES3.functional.shaders.builtin_functions.precision.radians.lowp_vertex.scalar dEQP-GLES3.functional.shaders.builtin_functions.precision.radians.lowp_vertex.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.radians.lowp_vertex.vec3 @@ -17165,6 +17173,14 @@ dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.lowp_fragment.scal dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.lowp_fragment.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.lowp_fragment.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.lowp_fragment.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_vertex.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_vertex.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_vertex.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_vertex.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_fragment.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_fragment.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_fragment.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_fragment.vec4 dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.highp_vertex.scalar dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.highp_vertex.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.highp_vertex.vec3 @@ -17233,6 +17249,14 @@ dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.mediump_fragment. dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.mediump_fragment.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.mediump_fragment.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.mediump_fragment.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_vertex.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_vertex.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_vertex.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_vertex.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_fragment.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_fragment.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_fragment.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_fragment.vec4 dEQP-GLES3.functional.shaders.builtin_functions.precision.atan2.lowp_vertex.scalar dEQP-GLES3.functional.shaders.builtin_functions.precision.atan2.lowp_vertex.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.atan2.lowp_vertex.vec3 @@ -17397,6 +17421,14 @@ dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.mediump_vertex.s dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.mediump_vertex.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.mediump_vertex.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.mediump_vertex.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_vertex.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_vertex.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_vertex.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_vertex.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_fragment.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_fragment.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_fragment.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_fragment.vec4 dEQP-GLES3.functional.shaders.builtin_functions.precision.pow.lowp_vertex.scalar dEQP-GLES3.functional.shaders.builtin_functions.precision.pow.lowp_vertex.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.pow.lowp_vertex.vec3 @@ -17773,6 +17805,14 @@ dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.mediump_fragment.s dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.mediump_fragment.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.mediump_fragment.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.mediump_fragment.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_vertex.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_vertex.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_vertex.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_vertex.vec4 +dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_fragment.scalar +dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_fragment.vec2 +dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_fragment.vec3 +dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_fragment.vec4 dEQP-GLES3.functional.shaders.builtin_functions.precision.modf.lowp_vertex dEQP-GLES3.functional.shaders.builtin_functions.precision.modf.lowp_fragment dEQP-GLES3.functional.shaders.builtin_functions.precision.modf.mediump_vertex diff --git a/android/cts/master/gles31-master.txt b/android/cts/master/gles31-master.txt index e696a1d..6c34134 100644 --- a/android/cts/master/gles31-master.txt +++ b/android/cts/master/gles31-master.txt @@ -2190,6 +2190,10 @@ dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.lowp_compute.scal dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.lowp_compute.vec2 dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.lowp_compute.vec3 dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.lowp_compute.vec4 +dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.mediump_compute.scalar +dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.mediump_compute.vec2 +dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.mediump_compute.vec3 +dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.mediump_compute.vec4 dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.highp_compute.scalar dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.highp_compute.vec2 dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.highp_compute.vec3 @@ -2226,6 +2230,10 @@ dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.mediump_compute. dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.mediump_compute.vec2 dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.mediump_compute.vec3 dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.mediump_compute.vec4 +dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.highp_compute.scalar +dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.highp_compute.vec2 +dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.highp_compute.vec3 +dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.highp_compute.vec4 dEQP-GLES31.functional.shaders.builtin_functions.precision.atan2.lowp_compute.scalar dEQP-GLES31.functional.shaders.builtin_functions.precision.atan2.lowp_compute.vec2 dEQP-GLES31.functional.shaders.builtin_functions.precision.atan2.lowp_compute.vec3 @@ -2318,6 +2326,10 @@ dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.mediump_compute dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.mediump_compute.vec2 dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.mediump_compute.vec3 dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.mediump_compute.vec4 +dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.highp_compute.scalar +dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.highp_compute.vec2 +dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.highp_compute.vec3 +dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.highp_compute.vec4 dEQP-GLES31.functional.shaders.builtin_functions.precision.pow.lowp_compute.scalar dEQP-GLES31.functional.shaders.builtin_functions.precision.pow.lowp_compute.vec2 dEQP-GLES31.functional.shaders.builtin_functions.precision.pow.lowp_compute.vec3 diff --git a/android/cts/master/src/gles3-test-issues.txt b/android/cts/master/src/gles3-test-issues.txt index 4ad3b83..d11aebb 100644 --- a/android/cts/master/src/gles3-test-issues.txt +++ b/android/cts/master/src/gles3-test-issues.txt @@ -13,44 +13,12 @@ dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.mediump_fragment dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.mediump_fragment.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.mediump_fragment.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.mediump_fragment.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_vertex.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_vertex.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_vertex.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_vertex.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_fragment.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_fragment.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_fragment.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.atanh.highp_fragment.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_vertex.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_vertex.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_vertex.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_vertex.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_fragment.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_fragment.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_fragment.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.acos.highp_fragment.vec4 dEQP-GLES3.functional.shaders.builtin_functions.precision.smoothstep.highp_vertex.scalar dEQP-GLES3.functional.shaders.builtin_functions.precision.smoothstep.highp_vertex.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.smoothstep.highp_vertex.vec4 dEQP-GLES3.functional.shaders.builtin_functions.precision.smoothstep.highp_fragment.scalar dEQP-GLES3.functional.shaders.builtin_functions.precision.smoothstep.highp_fragment.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.smoothstep.highp_fragment.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_vertex.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_vertex.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_vertex.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_vertex.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_fragment.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_fragment.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_fragment.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.div.highp_fragment.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_vertex.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_vertex.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_vertex.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_vertex.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_fragment.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_fragment.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_fragment.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_fragment.vec4 dEQP-GLES3.functional.shaders.builtin_functions.precision.inverse.highp_vertex.mat2 dEQP-GLES3.functional.shaders.builtin_functions.precision.inverse.highp_fragment.mat2 dEQP-GLES3.functional.shaders.builtin_functions.precision.atan.lowp_vertex.scalar @@ -69,14 +37,6 @@ dEQP-GLES3.functional.shaders.builtin_functions.precision.atan.mediump_fragment. dEQP-GLES3.functional.shaders.builtin_functions.precision.atan.mediump_fragment.vec2 dEQP-GLES3.functional.shaders.builtin_functions.precision.atan.mediump_fragment.vec3 dEQP-GLES3.functional.shaders.builtin_functions.precision.atan.mediump_fragment.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_vertex.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_vertex.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_vertex.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_vertex.vec4 -dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_fragment.scalar -dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_fragment.vec2 -dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_fragment.vec3 -dEQP-GLES3.functional.shaders.builtin_functions.precision.cos.mediump_fragment.vec4 # Bug 19408572 dEQP-GLES3.functional.shaders.builtin_functions.precision.reflect.* diff --git a/android/cts/master/src/gles31-test-issues.txt b/android/cts/master/src/gles31-test-issues.txt index bf2eac3..2ba1e49 100644 --- a/android/cts/master/src/gles31-test-issues.txt +++ b/android/cts/master/src/gles31-test-issues.txt @@ -6,22 +6,10 @@ dEQP-GLES31.functional.image_load_store.*.atomic.comp_swap_*_return_value # Bug 18323265 dEQP-GLES31.functional.shaders.builtin_functions.precision.dot.highp_compute.vec4 -dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.highp_compute.scalar -dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.highp_compute.vec2 -dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.highp_compute.vec3 -dEQP-GLES31.functional.shaders.builtin_functions.precision.atanh.highp_compute.vec4 -dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.highp_compute.scalar -dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.highp_compute.vec2 -dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.highp_compute.vec3 -dEQP-GLES31.functional.shaders.builtin_functions.precision.acos.highp_compute.vec4 dEQP-GLES31.functional.shaders.builtin_functions.precision.smoothstep.mediump_compute.scalar dEQP-GLES31.functional.shaders.builtin_functions.precision.smoothstep.mediump_compute.vec2 dEQP-GLES31.functional.shaders.builtin_functions.precision.smoothstep.mediump_compute.vec3 dEQP-GLES31.functional.shaders.builtin_functions.precision.smoothstep.mediump_compute.vec4 -dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.mediump_compute.scalar -dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.mediump_compute.vec2 -dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.mediump_compute.vec3 -dEQP-GLES31.functional.shaders.builtin_functions.precision.cos.mediump_compute.vec4 # Bug 18033342 dEQP-GLES31.functional.debug.negative_coverage.get_error.state.get_framebuffer_attachment_parameteriv diff --git a/framework/common/tcuFloatFormat.cpp b/framework/common/tcuFloatFormat.cpp index 31f5907..4c51d3e 100644 --- a/framework/common/tcuFloatFormat.cpp +++ b/framework/common/tcuFloatFormat.cpp @@ -61,14 +61,14 @@ FloatFormat::FloatFormat (int minExp, int fractionBits, bool exactPrecision, YesNoMaybe hasSubnormal_, - YesNoMaybe hasInf, - YesNoMaybe hasNaN) + YesNoMaybe hasInf_, + YesNoMaybe hasNaN_) : m_minExp (minExp) , m_maxExp (maxExp) , m_fractionBits (fractionBits) , m_hasSubnormal (hasSubnormal_) - , m_hasInf (hasInf) - , m_hasNaN (hasNaN) + , m_hasInf (hasInf_) + , m_hasNaN (hasNaN_) , m_exactPrecision (exactPrecision) , m_maxValue (computeMaxValue(maxExp, fractionBits)) { diff --git a/framework/common/tcuFloatFormat.hpp b/framework/common/tcuFloatFormat.hpp index 165c781..ddc3cf6 100644 --- a/framework/common/tcuFloatFormat.hpp +++ b/framework/common/tcuFloatFormat.hpp @@ -55,6 +55,7 @@ public: int getMaxExp (void) const { return m_maxExp; } double getMaxValue (void) const { return m_maxValue; } int getFractionBits (void) const { return m_fractionBits; } + YesNoMaybe hasInf (void) const { return m_hasInf; } YesNoMaybe hasSubnormal (void) const { return m_hasSubnormal; } double ulp (double x, double count = 1.0) const; diff --git a/modules/glshared/glsBuiltinPrecisionTests.cpp b/modules/glshared/glsBuiltinPrecisionTests.cpp index d4a24ee..0032fce 100644 --- a/modules/glshared/glsBuiltinPrecisionTests.cpp +++ b/modules/glshared/glsBuiltinPrecisionTests.cpp @@ -1987,16 +1987,23 @@ protected: return ret; } -protected: - - double applyExact (double x, double y) const { return x / y; } + double applyExact (double x, double y) const { return x / y; } - Interval applyPoint (const EvalContext& ctx, double x, double y) const + Interval applyPoint (const EvalContext& ctx, double x, double y) const { - return FloatFunc2::applyPoint(ctx, x, y); + Interval ret = FloatFunc2::applyPoint(ctx, x, y); + + if (!deIsInf(x) && !deIsInf(y) && y != 0.0) + { + const Interval dst = ctx.format.convert(ret); + if (dst.contains(-TCU_INFINITY)) ret |= -ctx.format.getMaxValue(); + if (dst.contains(+TCU_INFINITY)) ret |= +ctx.format.getMaxValue(); + } + + return ret; } - double precision (const EvalContext& ctx, double ret, double, double den) const + double precision (const EvalContext& ctx, double ret, double, double den) const { const FloatFormat& fmt = ctx.format; @@ -2255,8 +2262,23 @@ protected: return deLdExp(deAbs(arg), -12); } } + else if (ctx.floatPrecision == glu::PRECISION_MEDIUMP) + { + if (-DE_PI_DOUBLE <= arg && arg <= DE_PI_DOUBLE) + { + // from OpenCL half-float extension specification + return ctx.format.ulp(ret, 2.0); + } + else + { + // |x| * 2^-10, slightly larger than 2 ULP at x == pi + return deLdExp(deAbs(DE_PI_DOUBLE), -10); + } + } else { + DE_ASSERT(ctx.floatPrecision == glu::PRECISION_LOWP); + // from OpenCL half-float extension specification return ctx.format.ulp(ret, 2.0); } @@ -2313,7 +2335,7 @@ protected: if (ctx.floatPrecision == glu::PRECISION_HIGHP) { - // Use OpenCL's precision + // Use OpenCL's fast relaxed math precision return ctx.format.ulp(ret, m_precision); } else @@ -2334,7 +2356,7 @@ protected: class ASin : public ArcTrigFunc { public: - ASin (void) : ArcTrigFunc("asin", deAsin, 4.0, + ASin (void) : ArcTrigFunc("asin", deAsin, 4096.0, Interval(-1.0, 1.0), Interval(-DE_PI_DOUBLE * 0.5, DE_PI_DOUBLE * 0.5)) {} }; @@ -2342,7 +2364,7 @@ public: class ACos : public ArcTrigFunc { public: - ACos (void) : ArcTrigFunc("acos", deAcos, 4.0, + ACos (void) : ArcTrigFunc("acos", deAcos, 4096.0, Interval(-1.0, 1.0), Interval(0.0, DE_PI_DOUBLE)) {} }; @@ -2350,7 +2372,7 @@ public: class ATan : public ArcTrigFunc { public: - ATan (void) : ArcTrigFunc("atan", deAtanOver, 5.0, + ATan (void) : ArcTrigFunc("atan", deAtanOver, 4096.0, Interval::unbounded(), Interval(-DE_PI_DOUBLE * 0.5, DE_PI_DOUBLE * 0.5)) {} }; @@ -2361,7 +2383,7 @@ public: ATan2 (void) : CFloatFunc2 ("atan", deAtan2) {} protected: - Interval innerExtrema (const EvalContext&, + Interval innerExtrema (const EvalContext& ctx, const Interval& yi, const Interval& xi) const { @@ -2375,13 +2397,19 @@ protected: ret |= Interval(-DE_PI_DOUBLE, DE_PI_DOUBLE); } + if (ctx.format.hasInf() != YES && (!yi.isFinite() || !xi.isFinite())) + { + // Infinities may not be supported, allow anything, including NaN + ret |= TCU_NAN; + } + return ret; } double precision (const EvalContext& ctx, double ret, double, double) const { if (ctx.floatPrecision == glu::PRECISION_HIGHP) - return ctx.format.ulp(ret, 6.0); + return ctx.format.ulp(ret, 4096.0); else return ctx.format.ulp(ret, 2.0); } @@ -3131,7 +3159,7 @@ public: } protected: - IRet doApply (const EvalContext&, const IArgs& iargs) const + IRet doApply (const EvalContext& ctx, const IArgs& iargs) const { Interval fracIV; Interval& wholeIV = const_cast(iargs.b); @@ -3140,6 +3168,13 @@ protected: TCU_INTERVAL_APPLY_MONOTONE1(fracIV, x, iargs.a, frac, frac = deModf(x, &intPart)); TCU_INTERVAL_APPLY_MONOTONE1(wholeIV, x, iargs.a, whole, deModf(x, &intPart); whole = intPart); + + if ((ctx.format.hasInf() != YES) && !iargs.a.isFinite()) + { + // Behavior on modf(Inf) not well-defined, allow anything as a fractional part + fracIV |= TCU_NAN; + } + return fracIV; } -- 2.7.4