From 6dee8759ab8c90dcffd76f114eec333405fd176e Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Fri, 7 Feb 2014 22:39:01 +0000 Subject: Add workaround for Xoom crashing after discard removed from shader. R=robertphillips@google.com TBR=robertphillips@google.com BUG=skia:2149 Author: bsalomon@google.com Review URL: https://codereview.chromium.org/133703016 git-svn-id: http://skia.googlecode.com/svn/trunk@13373 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/effects/GrConvexPolyEffect.cpp | 4 ++++ src/gpu/gl/GrGLUtil.cpp | 2 ++ src/gpu/gl/GrGLUtil.h | 1 + 3 files changed, 7 insertions(+) diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index 98af6948ea..2f641982d7 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -75,6 +75,10 @@ void GrGLConvexPolyEffect::emitCode(GrGLShaderBuilder* builder, } } + // Woe is me. See skbug.com/2149. + if (kTegra2_GrGLRenderer == builder->ctxInfo().renderer()) { + builder->fsCodeAppend("\t\tif (-1.0 == alpha) {\n\t\t\tdiscard;\n\t\t}\n"); + } builder->fsCodeAppendf("\t%s = %s;\n", outputColor, (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_str()); } diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp index 7d44ba5931..87e2f83a28 100644 --- a/src/gpu/gl/GrGLUtil.cpp +++ b/src/gpu/gl/GrGLUtil.cpp @@ -227,6 +227,8 @@ GrGLRenderer GrGLGetRendererFromString(const char* rendererString) { if (NULL != rendererString) { if (0 == strcmp(rendererString, "NVIDIA Tegra 3")) { return kTegra3_GrGLRenderer; + } else if (0 == strcmp(rendererString, "NVIDIA Tegra")) { + return kTegra2_GrGLRenderer; } } return kOther_GrGLRenderer; diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h index eb49cefc42..b99487a1af 100644 --- a/src/gpu/gl/GrGLUtil.h +++ b/src/gpu/gl/GrGLUtil.h @@ -31,6 +31,7 @@ enum GrGLVendor { }; enum GrGLRenderer { + kTegra2_GrGLRenderer, kTegra3_GrGLRenderer, kOther_GrGLRenderer -- cgit v1.2.3