Respect xfer barriers in InstancedRendering::Op
Fixes a bug introduced when this Op stopped storing a GrPipeline.
Change-Id: I1a39814cebe18b321ea369f005bb7759f233cfe6
Reviewed-on: https://skia-review.googlesource.com/10804
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp
index ad61eb6..4abaef6 100644
--- a/src/gpu/instanced/InstancedRendering.cpp
+++ b/src/gpu/instanced/InstancedRendering.cpp
@@ -234,6 +234,7 @@
, fInstancedRendering(ir)
, fProcessors(std::move(paint))
, fIsTracked(false)
+ , fRequiresBarrierOnOverlap(false)
, fNumDraws(1)
, fNumChangesInGeometry(0) {
fHeadDraw = fTailDraw = fInstancedRendering->fDrawPool.allocate();
@@ -370,6 +371,7 @@
fInfo.fCannotTweakAlphaForCoverage = !analysis.isCompatibleWithCoverageAsAlpha();
fInfo.fUsesLocalCoords = analysis.usesLocalCoords();
+ fRequiresBarrierOnOverlap = analysis.requiresBarrierBetweenOverlappingDraws();
return analysis.requiresDstTexture();
}
@@ -390,6 +392,10 @@
return false;
}
+ SkASSERT(fRequiresBarrierOnOverlap == that->fRequiresBarrierOnOverlap);
+ if (fRequiresBarrierOnOverlap && this->bounds().intersects(that->bounds())) {
+ return false;
+ }
OpInfo combinedInfo = fInfo | that->fInfo;
if (!combinedInfo.isSimpleRects()) {
// This threshold was chosen with the "shapes_mixed" bench on a MacBook with Intel graphics.