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
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 98af694..2f64198 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -75,6 +75,10 @@
}
}
+ // 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 7d44ba5..87e2f83 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -227,6 +227,8 @@
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 eb49cef..b99487a 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -31,6 +31,7 @@
};
enum GrGLRenderer {
+ kTegra2_GrGLRenderer,
kTegra3_GrGLRenderer,
kOther_GrGLRenderer