aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-10-26 12:10:11 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-26 16:54:08 +0000
commit8f912d5b1ff27f31e4a834a900b4613eeca9a065 (patch)
tree795be7e11f0626d4630e0ca43609698fd7496e96
parentcfee6ecf5d4812421aead943760832c6daf8e602 (diff)
Tweak gradient shader code to avoid hangs on Tegra3
Bug: skia: Change-Id: I07d638d5f7b399d279f445c8f2b490ea55414e2f Reviewed-on: https://skia-review.googlesource.com/64101 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
-rw-r--r--src/shaders/gradients/SkGradientShader.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index ddff2c2f5f..8e24919c94 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -1251,8 +1251,9 @@ void GrGradientEffect::GLSLProcessor::emitAnalyticalColor(GrGLSLFPFragmentBuilde
}
// If the input colors were floats, or there was a color space xform, we may end up out of
- // range. The simplest solution is to always clamp our (premul) value here.
- fragBuilder->codeAppend("colorTemp.rgb = clamp(colorTemp.rgb, 0, colorTemp.a);");
+ // range. The simplest solution is to always clamp our (premul) value here. We only need to
+ // clamp RGB, but that causes hangs on the Tegra3 Nexus7. Clamping RGBA avoids the problem.
+ fragBuilder->codeAppend("colorTemp = clamp(colorTemp, 0, colorTemp.a);");
fragBuilder->codeAppendf("%s = %s * colorTemp;", outputColor, inputColor);
}