Guard the sqrt(temp) where temp < 0 in 2pt conical gradient

Although Linux and Android will return NAN, iOS and some some Win10
devices would return undefined values.

This relands 82161 (with the fix mentioned above). The speedup is
a little less due to the additional temp < 0 check.

    4.08% faster in gradient_conicalOutZero_clamp
    6.83% faster in gradient_conical_clamp_shallow_dither
    9.43% faster in gradient_conicalOutZero_clamp_3color
   12.66% faster in gradient_conicalOut_clamp_hicolor
   16.67% faster in gradient_conicalOut_clamp_3color
   17.83% faster in gradient_conicalOut_clamp

and the speedup is further reduced because we break up the if with
two conditions into two ifs with single condition:

    7.32% faster in gradient_conical_clamp_shallow_dither
    8.00% faster in gradient_conicalOut_clamp_hicolor
    8.57% faster in gradient_conicalOut_clamp
    8.73% faster in gradient_conicalOut_clamp_3color

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-All-Android,Test-Android-Clang-Nexus7-GPU-Tegra3-arm-Debug-All-Android,Test-Mac-Clang-MacMini7.1-GPU-IntelIris5100-x86_64-Debug-All-CommandBuffer

Change-Id: I41fb8d97e31c577b52a200f0b883591c9bdc4d1c
Reviewed-on: https://skia-review.googlesource.com/84963
Commit-Queue: Yuqian Li <liyuqian@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Yuqian Li 2017-12-14 13:45:08 -05:00 committed by Skia Commit-Bot
parent e7a58321bb
commit 915817b940
4 changed files with 332 additions and 1206 deletions

View File

@ -54,7 +54,7 @@ SkTArray<GrXPFactoryTestFactory*, true>* GrXPFactoryTestFactory::GetFactories()
* we verify the count is as expected. If a new factory is added, then these numbers must be
* manually adjusted.
*/
static const int kFPFactoryCount = 42;
static const int kFPFactoryCount = 38;
static const int kGPFactoryCount = 14;
static const int kXPFactoryCount = 4;

View File

@ -69,8 +69,6 @@ public:
kBlockInputFragmentProcessor_ClassID,
kCCPRClipProcessor_ClassID,
kCircleGeometryProcessor_ClassID,
kCircleInside2PtConicalEffect_ClassID,
kCircleOutside2PtConicalEffect_ClassID,
kCircularRRectEffect_ClassID,
kColorMatrixEffect_ClassID,
kColorTableEffect_ClassID,
@ -83,11 +81,9 @@ public:
kDefaultGeoProc_ClassID,
kDIEllipseGeometryProcessor_ClassID,
kDisableColorXP_ClassID,
kEdge2PtConicalEffect_ClassID,
kTwoPointConicalEffect_ClassID,
kEllipseGeometryProcessor_ClassID,
kEllipticalRRectEffect_ClassID,
kFocalInside2PtConicalEffect_ClassID,
kFocalOutside2PtConicalEffect_ClassID,
kGP_ClassID,
kGrAARectEffect_ClassID,
kGrAlphaThresholdFragmentProcessor_ClassID,

View File

@ -255,7 +255,7 @@ protected:
GrGradientEffect(ClassID classID, const CreateArgs&, bool isOpaque);
explicit GrGradientEffect(const GrGradientEffect&); // facilitates clone() implementations
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const final;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
// Helper function used by derived class factories to handle color space transformation and
// modulation by input alpha.

File diff suppressed because it is too large Load Diff