diff options
author | 2016-04-25 07:01:22 -0700 | |
---|---|---|
committer | 2016-04-25 07:01:23 -0700 | |
commit | 1dc172165b8186950fda4a269bd1b12c11947b14 (patch) | |
tree | f1482ee0e2d88d139c990b212d479885df5d7c8a /src/gpu/batches/GrDrawPathBatch.cpp | |
parent | edf7fcd8b9e339800edb61ae422f8b6c1b77c3e8 (diff) |
Revert of Batch multiple single NVPR draw paths to instanced draws (patchset #5 id:80001 of https://codereview.chromium.org/1908433002/ )
Reason for revert:
This causes what looks like significantly wrong results. Here is an example:
https://gold.skia.org/diff?test=stroke-fill&left=cb47dc2cabbad7d146aedaac199ebace&top=2c6e65d597c574e3bb170a19ca9634c6
Original issue's description:
> Batch multiple single NVPR draw paths to instanced draws
>
> Batch multiple single NVPR draw paths to instanced draws.
> A draw path batch can be combined to other batch if the
> batches do not overlap and have same draw characteristics.
>
> Join the batches in linked list and flatten the list to a
> path list during draw time.
>
> Replace GrPathRendering::drawPath with GrPathRendering::drawPaths.
>
> Perf changes ARM, Shield TV device, Tegra X1 GPU:
> desk_chalkboard.skp_1 21.5ms -> 17.8ms 0.83x
> desk_mapsvg.skp_1 7.49ms -> 6.18ms 0.82x
> Others results are more volatile.
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1908433002
>
> Committed: https://skia.googlesource.com/skia/+/3c33c389e9f8d14d86756ea1ddeba2097f31ad22
TBR=joshualitt@chromium.org,bsalomon@google.com,kkinnunen@nvidia.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1919843002
Diffstat (limited to 'src/gpu/batches/GrDrawPathBatch.cpp')
-rw-r--r-- | src/gpu/batches/GrDrawPathBatch.cpp | 76 |
1 files changed, 5 insertions, 71 deletions
diff --git a/src/gpu/batches/GrDrawPathBatch.cpp b/src/gpu/batches/GrDrawPathBatch.cpp index fb9ca943dc..1395d08328 100644 --- a/src/gpu/batches/GrDrawPathBatch.cpp +++ b/src/gpu/batches/GrDrawPathBatch.cpp @@ -13,84 +13,18 @@ static void pre_translate_transform_values(const float* xforms, SkString GrDrawPathBatch::dumpInfo() const { SkString string; - string.printf("Color: 0x%08x Fill: %x Path count: %d Paths: ", this->color(), this->fillType(), - fTotalPathCount); - const GrDrawPathBatch* batch = this; - do { - string.appendf("0x%p", batch->fPath.get()); - batch = batch->fNext.get(); - } while (batch); - string.append("\n"); + string.printf("PATH: 0x%p", fPath.get()); return string; } -bool GrDrawPathBatch::ListBoundsIntersects(const GrDrawPathBatch* a, const GrDrawPathBatch* b) { - if (!SkRect::Intersects(a->fBounds, b->fBounds)) { - return false; - } - if (!a->fNext && !b->fNext) { - return true; - } - const GrDrawPathBatch* firstA = a; - do { - do { - if (SkRect::Intersects(a->fPathBounds, b->fPathBounds)) { - return true; - } - a = a->fNext.get(); - } while (a); - a = firstA; - b = b->fNext.get(); - } while (b); - return false; -} - -bool GrDrawPathBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { - GrDrawPathBatch* that = t->cast<GrDrawPathBatch>(); - if (this->color() != that->color() || - !this->viewMatrix().cheapEqualTo(that->viewMatrix())) { - return false; - } - if (!GrPipeline::AreEqual(*this->pipeline(), *that->pipeline(), false)) { - return false; - } - if (that->fillType() != this->fillType() || - this->stencilSettings() != that->stencilSettings()) { - return false; - } - if (ListBoundsIntersects(this, that)) { - return false; - } - if (!fPath.get()->canCombineDrawPathBatchWith(*that->fPath.get())) { - return false; - } - SkASSERT(!*fLastSlot); - fLastSlot->reset(SkRef(that)); - fLastSlot = that->fLastSlot; - fTotalPathCount += that->fTotalPathCount; - this->joinBounds(that->fBounds); - return true; -} - void GrDrawPathBatch::onDraw(GrBatchFlushState* state) { + GrProgramDesc desc; + SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(), this->overrides(), this->viewMatrix())); - if (fTotalPathCount > 1) { - SkAutoSTMalloc<32, const GrPath*> paths(fTotalPathCount); - GrDrawPathBatch* batch = this; - int i = 0; - do { - paths[i++] = batch->fPath.get(); - batch = batch->fNext.get(); - } while (batch); - state->gpu()->pathRendering()->drawPaths(*this->pipeline(), *pathProc, - this->stencilSettings(), paths, fTotalPathCount); - } else { - const GrPath* path = fPath.get(); - state->gpu()->pathRendering()->drawPaths(*this->pipeline(), *pathProc, - this->stencilSettings(), &path, 1); - } + state->gpu()->pathRendering()->drawPath(*this->pipeline(), *pathProc, this->stencilSettings(), + fPath.get()); } SkString GrDrawPathRangeBatch::dumpInfo() const { |