Avoid GrEllipseEffect for small radii on devices without 32 bit float.

Also limit small radius bail in GrCircleEffect to clip out cases.

Change-Id: I14ce736969b05203219d68f30283c36c84f78f3a
Reviewed-on: https://skia-review.googlesource.com/80621
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrEllipseEffect.fp b/src/gpu/effects/GrEllipseEffect.fp
index 27beb85..24cbec2 100644
--- a/src/gpu/effects/GrEllipseEffect.fp
+++ b/src/gpu/effects/GrEllipseEffect.fp
@@ -5,6 +5,10 @@
  * found in the LICENSE file.
  */
 
+@header {
+    #include "GrShaderCaps.h"
+}
+
 layout(key) in GrClipEdgeType edgeType;
 in float2 center;
 in float2 radii;
@@ -18,6 +22,17 @@
 bool useScale = !sk_Caps.floatIs32Bits;
 layout(when=useScale) uniform float2 scale;
 
+@make {
+    static std::unique_ptr<GrFragmentProcessor> Make(GrClipEdgeType edgeType, SkPoint center,
+                                                     SkPoint radii, const GrShaderCaps& caps) {
+        // Small radii produce bad results on devices without full float.
+        if (!caps.floatIs32Bits() && (radii.fX < 0.5f || radii.fY < 0.5f)) {
+            return nullptr;
+        }
+        return std::unique_ptr<GrFragmentProcessor>(new GrEllipseEffect(edgeType, center, radii));
+    }
+}
+
 @optimizationFlags { kCompatibleWithCoverageAsAlpha_OptimizationFlag }
 
 @setData(pdman) {
@@ -101,5 +116,6 @@
     do {
         et = (GrClipEdgeType) testData->fRandom->nextULessThan(kGrClipEdgeTypeCnt);
     } while (GrClipEdgeType::kHairlineAA == et);
-    return GrEllipseEffect::Make(et, center, SkPoint::Make(rx, ry));
+    return GrEllipseEffect::Make(et, center, SkPoint::Make(rx, ry),
+                                 *testData->caps()->shaderCaps());
 }