Don't batch circles and circular rrects beyond index limit
authorJim Van Verth <jvanverth@google.com>
Thu, 9 Feb 2017 16:36:37 +0000 (11:36 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 9 Feb 2017 17:29:31 +0000 (17:29 +0000)
BUG=skia:6158, chromium:690144, chromium:688582, chromium:684112

Change-Id: I7a6d1fb73cbe6cb4328848acd153ff2505b5fea2
Reviewed-on: https://skia-review.googlesource.com/8256
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>

src/gpu/ops/GrOvalOpFactory.cpp

index 2f50bb49bb416b7c211b9fe3bab94e1110617773..4c00189a3b021d860e9423317ab28bed40b6a4f9 100644 (file)
@@ -1103,6 +1103,12 @@ private:
 
     bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
         CircleOp* that = t->cast<CircleOp>();
+
+        // can only represent 65535 unique vertices with 16-bit indices
+        if (fVertCount + that->fVertCount > 65535) {
+            return false;
+        }
+
         if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
                                     that->bounds(), caps)) {
             return false;
@@ -1994,6 +2000,12 @@ private:
 
     bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
         CircularRRectOp* that = t->cast<CircularRRectOp>();
+
+        // can only represent 65535 unique vertices with 16-bit indices
+        if (fVertCount + that->fVertCount > 65535) {
+            return false;
+        }
+
         if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
                                     that->bounds(), caps)) {
             return false;