diff options
author | 2017-05-04 12:39:56 -0400 | |
---|---|---|
committer | 2017-05-04 17:36:00 +0000 | |
commit | a4677b5db51fca9f2d1077a4d09dd8f7c80df3d1 (patch) | |
tree | 0778cf68e2c83b24b49a5ec6d7c19d9944f6f196 /src/gpu/ops | |
parent | cef018896e5cad8eb46a536b60cdf79ebe2b0191 (diff) |
Make GrSimpleMeshDrawOpHelper consider blend barriers/dst textures for batching.
Change-Id: Idc6f924e39a08da9fb4b441a72c4d9caa76b0fe0
Reviewed-on: https://skia-review.googlesource.com/15312
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/ops')
-rw-r--r-- | src/gpu/ops/GrNewNonAAFillRectOp.cpp | 2 | ||||
-rw-r--r-- | src/gpu/ops/GrSimpleMeshDrawOpHelper.h | 27 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/gpu/ops/GrNewNonAAFillRectOp.cpp b/src/gpu/ops/GrNewNonAAFillRectOp.cpp index 15e025a4c8..328f01b4fb 100644 --- a/src/gpu/ops/GrNewNonAAFillRectOp.cpp +++ b/src/gpu/ops/GrNewNonAAFillRectOp.cpp @@ -161,7 +161,7 @@ private: bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override { NewNonAAFillRectOp* that = t->cast<NewNonAAFillRectOp>(); - if (!fHelper.isCompatible(that->fHelper)) { + if (!fHelper.isCompatible(that->fHelper, caps, this->bounds(), that->bounds())) { return false; } fRects.push_back_n(that->fRects.count(), that->fRects.begin()); diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h index f64f9eca2e..03b9b1a96d 100644 --- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h +++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h @@ -12,6 +12,7 @@ #include "GrOpFlushState.h" #include "GrPipeline.h" #include "GrProcessorSet.h" +#include "GrRect.h" #include "GrUserStencilSettings.h" /** @@ -38,7 +39,8 @@ public: GrUserStencilSettings* stencilSettings = nullptr) : fProcessors(args.fProcessorSet) , fPipelineFlags(args.fSRGBFlags) - , fAAType((int)aaType) { + , fAAType((int)aaType) + , fRequiresDstTexture(false) { SkASSERT(!stencilSettings); if (GrAATypeIsHW(aaType)) { fPipelineFlags |= GrPipeline::kHWAntialias_Flag; @@ -60,12 +62,21 @@ public: : GrDrawOp::FixedFunctionFlags::kNone; } - bool isCompatible(const GrSimpleMeshDrawOpHelper& that) const { + bool isCompatible(const GrSimpleMeshDrawOpHelper& that, const GrCaps& caps, + const SkRect& aBounds, const SkRect& bBounds) const { if (SkToBool(fProcessors) != SkToBool(that.fProcessors)) { return false; } - if (SkToBool(fProcessors) && *fProcessors != *that.fProcessors) { - return false; + if (fProcessors) { + if (*fProcessors != *that.fProcessors) { + return false; + } + if (fRequiresDstTexture || (fProcessors->xferProcessor() && + fProcessors->xferProcessor()->xferBarrierType(caps))) { + if (GrRectsTouchOrOverlap(aBounds, bBounds)) { + return false; + } + } } return fPipelineFlags == that.fPipelineFlags && fAAType == that.fAAType; } @@ -82,6 +93,7 @@ public: bool isMixedSamples = this->aaType() == GrAAType::kMixedSamples; GrProcessorSet::Analysis analysis = fProcessors->finalize(*color, coverage, clip, isMixedSamples, caps, color); + fRequiresDstTexture = analysis.requiresDstTexture(); return analysis.requiresDstTexture(); } else { return GrProcessorSet::EmptySetAnalysis().requiresDstTexture(); @@ -124,6 +136,7 @@ private: GrProcessorSet* fProcessors; unsigned fPipelineFlags : 8; unsigned fAAType : 2; + unsigned fRequiresDstTexture : 1; }; /** @@ -158,8 +171,10 @@ public: using GrSimpleMeshDrawOpHelper::xpRequiresDstTexture; - bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that) const { - return INHERITED::isCompatible(that) && fStencilSettings == that.fStencilSettings; + bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps& caps, + const SkRect& aBounds, const SkRect& bBounds) const { + return INHERITED::isCompatible(that, caps, aBounds, bBounds) && + fStencilSettings == that.fStencilSettings; } GrPipeline* makePipeline(GrMeshDrawOp::Target* target) const { |