diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-09 17:11:09 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-09 17:11:09 +0000 |
commit | 1b035d82d2b8b50ae334463edd06e4c5e0639311 (patch) | |
tree | bf31f931a23131308111f369fe24af279c743231 /src/gpu/effects | |
parent | cde171860d85dffe35aecafc8198227bccd790a9 (diff) |
Do div-by-zero check for all gpus in ellipse/rr effects.
R=jvanverth@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/231093002
git-svn-id: http://skia.googlecode.com/svn/trunk@14110 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects')
-rw-r--r-- | src/gpu/effects/GrOvalEffect.cpp | 5 | ||||
-rw-r--r-- | src/gpu/effects/GrRRectEffect.cpp | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index e033a896d8..97b977f754 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -317,9 +317,8 @@ void GLEllipseEffect::emitCode(GrGLShaderBuilder* builder, builder->fsCodeAppend("\t\tfloat implicit = dot(Z, d) - 1.0;\n"); // grad_dot is the squared length of the gradient of the implicit. builder->fsCodeAppendf("\t\tfloat grad_dot = 4.0 * dot(Z, Z);\n"); - if (builder->ctxInfo().caps()->dropsTileOnZeroDivide()) { - builder->fsCodeAppend("\t\tgrad_dot = max(grad_dot, 1.0e-4);\n"); - } + // avoid calling inversesqrt on zero. + builder->fsCodeAppend("\t\tgrad_dot = max(grad_dot, 1.0e-4);\n"); builder->fsCodeAppendf("\t\tfloat approx_dist = implicit * inversesqrt(grad_dot);\n"); switch (ee.getEdgeType()) { diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index c013357064..bc79057478 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -572,9 +572,8 @@ void GLEllipticalRRectEffect::emitCode(GrGLShaderBuilder* builder, builder->fsCodeAppend("\t\tfloat implicit = dot(Z, dxy) - 1.0;\n"); // grad_dot is the squared length of the gradient of the implicit. builder->fsCodeAppendf("\t\tfloat grad_dot = 4.0 * dot(Z, Z);\n"); - if (builder->ctxInfo().caps()->dropsTileOnZeroDivide()) { - builder->fsCodeAppend("\t\tgrad_dot = max(grad_dot, 1.0e-4);\n"); - } + // avoid calling inversesqrt on zero. + builder->fsCodeAppend("\t\tgrad_dot = max(grad_dot, 1.0e-4);\n"); builder->fsCodeAppendf("\t\tfloat approx_dist = implicit * inversesqrt(grad_dot);\n"); if (kFillAA_GrEffectEdgeType == erre.getEdgeType()) { |