From 58e389b0518b46bbe58ba01c23443cf23c18435c Mon Sep 17 00:00:00 2001 From: mtklein Date: Fri, 15 Jul 2016 07:00:11 -0700 Subject: Expand _01 half<->float limitation to _finite. Simplify. It's become clear we need to sometimes deal with values <0 or >1. I'm not yet convinced we care about NaN or +-inf. We had some fairly clever tricks and optimizations here for NEON and SSE. I've thrown them out in favor of a single implementation. If we find the specializations mattered, we can certainly figure out how to extend them to this new range/domain. This happens to add a vectorized float -> half for ARMv7, which was missing from the _01 version. (The SSE strategy was not portable to platforms that flush denorm floats to zero.) I've tested the full float range for FloatToHalf on my desktop and a 5x. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2145663003 CQ_INCLUDE_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot;master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot,Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Fast-Trybot Committed: https://skia.googlesource.com/skia/+/3296bee70d074bb8094b3229dbe12fa016657e90 Review-Url: https://codereview.chromium.org/2145663003 --- src/effects/gradients/Sk4fGradientPriv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/effects/gradients') diff --git a/src/effects/gradients/Sk4fGradientPriv.h b/src/effects/gradients/Sk4fGradientPriv.h index ae6fe7ce46..68e95a63d9 100644 --- a/src/effects/gradients/Sk4fGradientPriv.h +++ b/src/effects/gradients/Sk4fGradientPriv.h @@ -143,11 +143,11 @@ struct DstTraits { } static void store(const Sk4f& c, Type* dst) { - *dst = SkFloatToHalf_01(PM::apply(c)); + *dst = SkFloatToHalf_finite(PM::apply(c)); } static void store(const Sk4f& c, Type* dst, int n) { - sk_memset64(dst, SkFloatToHalf_01(PM::apply(c)), n); + sk_memset64(dst, SkFloatToHalf_finite(PM::apply(c)), n); } static void store4x(const Sk4f& c0, const Sk4f& c1, -- cgit v1.2.3