Don't abort analytic clipping if using MSAA until elements are examined
TBR=joshualitt@google.com
Review URL: https://codereview.chromium.org/1399223005
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 4b464bb..e0a85d1 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -109,6 +109,7 @@
}
bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementList& elements,
+ bool abortIfAA,
SkVector& clipToRTOffset,
const SkRect* drawBounds,
const GrFragmentProcessor** resultFP) {
@@ -151,16 +152,20 @@
if (failed) {
break;
}
-
if (!skip) {
GrPrimitiveEdgeType edgeType;
if (iter.get()->isAA()) {
+ if (abortIfAA) {
+ failed = true;
+ break;
+ }
edgeType =
invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_GrProcessorEdgeType;
} else {
edgeType =
invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProcessorEdgeType;
}
+
switch (iter.get()->getType()) {
case SkClipStack::Element::kPath_Type:
fps[fpCnt] = GrConvexPolyEffect::Create(edgeType, iter.get()->getPath(),
@@ -282,8 +287,9 @@
bool disallowAnalyticAA = pipelineBuilder.getRenderTarget()->isUnifiedMultisampled();
const GrFragmentProcessor* clipFP = nullptr;
if (elements.isEmpty() ||
- (requiresAA && !disallowAnalyticAA &&
- this->getAnalyticClipProcessor(elements, clipToRTOffset, devBounds, &clipFP))) {
+ (requiresAA &&
+ this->getAnalyticClipProcessor(elements, disallowAnalyticAA, clipToRTOffset, devBounds,
+ &clipFP))) {
SkIRect scissorSpaceIBounds(clipSpaceIBounds);
scissorSpaceIBounds.offset(-clip.origin());
if (nullptr == devBounds ||
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 90352f4..3ce3e72 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -89,8 +89,10 @@
// Attempts to install a series of coverage effects to implement the clip. Return indicates
// whether the element list was successfully converted to processors. *fp may be nullptr even
// when the function succeeds because all the elements were ignored. TODO: Make clip reduction
- // bounds-aware and stop checking bounds in this function.
+ // bounds-aware and stop checking bounds in this function. Similarly, we shouldn't need to pass
+ // abortIfAA, but we don't yet know if all the AA elements will be eliminated.
bool getAnalyticClipProcessor(const GrReducedClip::ElementList&,
+ bool abortIfAA,
SkVector& clipOffset,
const SkRect* devBounds,
const GrFragmentProcessor** fp);