Don't abort analytic clipping if using MSAA until elements are examined

TBR=joshualitt@google.com

Review URL: https://codereview.chromium.org/1399223005
This commit is contained in:
bsalomon 2015-10-14 15:01:50 -07:00 committed by Commit bot
parent a3b8c67ea6
commit a912ddef05
2 changed files with 12 additions and 4 deletions

View File

@ -109,6 +109,7 @@ bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder& pipelineBuilder,
} }
bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementList& elements, bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementList& elements,
bool abortIfAA,
SkVector& clipToRTOffset, SkVector& clipToRTOffset,
const SkRect* drawBounds, const SkRect* drawBounds,
const GrFragmentProcessor** resultFP) { const GrFragmentProcessor** resultFP) {
@ -151,16 +152,20 @@ bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementLis
if (failed) { if (failed) {
break; break;
} }
if (!skip) { if (!skip) {
GrPrimitiveEdgeType edgeType; GrPrimitiveEdgeType edgeType;
if (iter.get()->isAA()) { if (iter.get()->isAA()) {
if (abortIfAA) {
failed = true;
break;
}
edgeType = edgeType =
invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_GrProcessorEdgeType; invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_GrProcessorEdgeType;
} else { } else {
edgeType = edgeType =
invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProcessorEdgeType; invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProcessorEdgeType;
} }
switch (iter.get()->getType()) { switch (iter.get()->getType()) {
case SkClipStack::Element::kPath_Type: case SkClipStack::Element::kPath_Type:
fps[fpCnt] = GrConvexPolyEffect::Create(edgeType, iter.get()->getPath(), fps[fpCnt] = GrConvexPolyEffect::Create(edgeType, iter.get()->getPath(),
@ -282,8 +287,9 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
bool disallowAnalyticAA = pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); bool disallowAnalyticAA = pipelineBuilder.getRenderTarget()->isUnifiedMultisampled();
const GrFragmentProcessor* clipFP = nullptr; const GrFragmentProcessor* clipFP = nullptr;
if (elements.isEmpty() || if (elements.isEmpty() ||
(requiresAA && !disallowAnalyticAA && (requiresAA &&
this->getAnalyticClipProcessor(elements, clipToRTOffset, devBounds, &clipFP))) { this->getAnalyticClipProcessor(elements, disallowAnalyticAA, clipToRTOffset, devBounds,
&clipFP))) {
SkIRect scissorSpaceIBounds(clipSpaceIBounds); SkIRect scissorSpaceIBounds(clipSpaceIBounds);
scissorSpaceIBounds.offset(-clip.origin()); scissorSpaceIBounds.offset(-clip.origin());
if (nullptr == devBounds || if (nullptr == devBounds ||

View File

@ -89,8 +89,10 @@ private:
// Attempts to install a series of coverage effects to implement the clip. Return indicates // 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 // 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 // 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 getAnalyticClipProcessor(const GrReducedClip::ElementList&,
bool abortIfAA,
SkVector& clipOffset, SkVector& clipOffset,
const SkRect* devBounds, const SkRect* devBounds,
const GrFragmentProcessor** fp); const GrFragmentProcessor** fp);