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>
This commit is contained in:
Brian Osman 2017-10-26 12:10:11 -04:00 committed by Skia Commit-Bot
parent cfee6ecf5d
commit 8f912d5b1f

View File

@ -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);
}