aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2018-04-16 14:23:00 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-16 22:50:45 +0000
commit1d4af54a7b61badf2a7e6c3730b2ef01b9cd1fa2 (patch)
tree9892e21b7451034bfde1126013e8c497cc202418
parent37c5403890000289d7db9fd1d90cf96c2ee12bf3 (diff)
Don't support GrCubicEffect if float != fp32
Otherwise the cubic math is too unstable. Bug: skia: Change-Id: I2c8d8d9abcae517d42dd3eddb5bf455c7c7487dd Reviewed-on: https://skia-review.googlesource.com/121709 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
-rw-r--r--gm/beziereffects.cpp12
-rw-r--r--src/gpu/effects/GrBezierEffect.h5
2 files changed, 17 insertions, 0 deletions
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index ebcd27bb49..57caa46410 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -8,6 +8,7 @@
// This test only works with the GPU backend.
#include "gm.h"
+#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
@@ -135,6 +136,17 @@ protected:
return;
}
+ if (!context->caps()->shaderCaps()->floatIs32Bits()) {
+ SkPaint paint;
+ sk_tool_utils::set_portable_typeface(&paint);
+ paint.setAntiAlias(true);
+ paint.setTextSize(20);
+
+ canvas->clear(SK_ColorWHITE);
+ canvas->drawString("float != fp32", 20, 40, paint);
+ return;
+ }
+
struct Vertex {
SkPoint fPosition;
float fKLM[4]; // The last value is ignored. The effect expects a vec4f.
diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h
index 267259e634..174470410c 100644
--- a/src/gpu/effects/GrBezierEffect.h
+++ b/src/gpu/effects/GrBezierEffect.h
@@ -229,6 +229,11 @@ public:
bool flipKL,
const GrClipEdgeType edgeType,
const GrCaps& caps) {
+ if (!caps.shaderCaps()->floatIs32Bits()) {
+ // Cubic math will be too unstable if the hardware doesn't support full fp32.
+ return nullptr;
+ }
+
// Map KLM to something that operates in device space.
SkMatrix devKLM;
if (!viewMatrix.invert(&devKLM)) {