Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: src/gpu/GrClipMaskManager.cpp

Issue 1399223005: Don't abort analytic clipping if using MSAA until elements are examined (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrClipMaskManager.h" 8 #include "GrClipMaskManager.h"
9 #include "GrCaps.h" 9 #include "GrCaps.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (path_needs_SW_renderer(this->getContext(), fDrawTarget, pipeline Builder, translate, 102 if (path_needs_SW_renderer(this->getContext(), fDrawTarget, pipeline Builder, translate,
103 path, stroke, element->isAA())) { 103 path, stroke, element->isAA())) {
104 return true; 104 return true;
105 } 105 }
106 } 106 }
107 } 107 }
108 return false; 108 return false;
109 } 109 }
110 110
111 bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementLis t& elements, 111 bool GrClipMaskManager::getAnalyticClipProcessor(const GrReducedClip::ElementLis t& elements,
112 bool abortIfAA,
112 SkVector& clipToRTOffset, 113 SkVector& clipToRTOffset,
113 const SkRect* drawBounds, 114 const SkRect* drawBounds,
114 const GrFragmentProcessor** res ultFP) { 115 const GrFragmentProcessor** res ultFP) {
115 SkRect boundsInClipSpace; 116 SkRect boundsInClipSpace;
116 if (drawBounds) { 117 if (drawBounds) {
117 boundsInClipSpace = *drawBounds; 118 boundsInClipSpace = *drawBounds;
118 boundsInClipSpace.offset(-clipToRTOffset.fX, -clipToRTOffset.fY); 119 boundsInClipSpace.offset(-clipToRTOffset.fX, -clipToRTOffset.fY);
119 } 120 }
120 SkASSERT(elements.count() <= kMaxAnalyticElements); 121 SkASSERT(elements.count() <= kMaxAnalyticElements);
121 const GrFragmentProcessor* fps[kMaxAnalyticElements]; 122 const GrFragmentProcessor* fps[kMaxAnalyticElements];
(...skipping 22 matching lines...) Expand all
144 // We don't currently have a cheap test for whether a rect is fu lly outside an 145 // We don't currently have a cheap test for whether a rect is fu lly outside an
145 // element's primitive, so don't attempt to set skip. 146 // element's primitive, so don't attempt to set skip.
146 break; 147 break;
147 default: 148 default:
148 failed = true; 149 failed = true;
149 break; 150 break;
150 } 151 }
151 if (failed) { 152 if (failed) {
152 break; 153 break;
153 } 154 }
154
155 if (!skip) { 155 if (!skip) {
156 GrPrimitiveEdgeType edgeType; 156 GrPrimitiveEdgeType edgeType;
157 if (iter.get()->isAA()) { 157 if (iter.get()->isAA()) {
158 if (abortIfAA) {
159 failed = true;
160 break;
161 }
158 edgeType = 162 edgeType =
159 invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_GrProc essorEdgeType; 163 invert ? kInverseFillAA_GrProcessorEdgeType : kFillAA_GrProc essorEdgeType;
160 } else { 164 } else {
161 edgeType = 165 edgeType =
162 invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProc essorEdgeType; 166 invert ? kInverseFillBW_GrProcessorEdgeType : kFillBW_GrProc essorEdgeType;
163 } 167 }
168
164 switch (iter.get()->getType()) { 169 switch (iter.get()->getType()) {
165 case SkClipStack::Element::kPath_Type: 170 case SkClipStack::Element::kPath_Type:
166 fps[fpCnt] = GrConvexPolyEffect::Create(edgeType, iter.get() ->getPath(), 171 fps[fpCnt] = GrConvexPolyEffect::Create(edgeType, iter.get() ->getPath(),
167 &clipToRTOffset); 172 &clipToRTOffset);
168 break; 173 break;
169 case SkClipStack::Element::kRRect_Type: { 174 case SkClipStack::Element::kRRect_Type: {
170 SkRRect rrect = iter.get()->getRRect(); 175 SkRRect rrect = iter.get()->getRRect();
171 rrect.offset(clipToRTOffset.fX, clipToRTOffset.fY); 176 rrect.offset(clipToRTOffset.fX, clipToRTOffset.fY);
172 fps[fpCnt] = GrRRectEffect::Create(edgeType, rrect); 177 fps[fpCnt] = GrRRectEffect::Create(edgeType, rrect);
173 break; 178 break;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // configuration's relative costs of switching RTs to generate a mask vs 280 // configuration's relative costs of switching RTs to generate a mask vs
276 // longer shaders. 281 // longer shaders.
277 if (elements.count() <= kMaxAnalyticElements) { 282 if (elements.count() <= kMaxAnalyticElements) {
278 SkVector clipToRTOffset = { SkIntToScalar(-clip.origin().fX), 283 SkVector clipToRTOffset = { SkIntToScalar(-clip.origin().fX),
279 SkIntToScalar(-clip.origin().fY) }; 284 SkIntToScalar(-clip.origin().fY) };
280 // When there are multiple color samples we want to do per-sample clippi ng, not compute 285 // When there are multiple color samples we want to do per-sample clippi ng, not compute
281 // a fractional pixel coverage. 286 // a fractional pixel coverage.
282 bool disallowAnalyticAA = pipelineBuilder.getRenderTarget()->isUnifiedMu ltisampled(); 287 bool disallowAnalyticAA = pipelineBuilder.getRenderTarget()->isUnifiedMu ltisampled();
283 const GrFragmentProcessor* clipFP = nullptr; 288 const GrFragmentProcessor* clipFP = nullptr;
284 if (elements.isEmpty() || 289 if (elements.isEmpty() ||
285 (requiresAA && !disallowAnalyticAA && 290 (requiresAA &&
286 this->getAnalyticClipProcessor(elements, clipToRTOffset, devBounds, &clipFP))) { 291 this->getAnalyticClipProcessor(elements, disallowAnalyticAA, clipTo RTOffset, devBounds,
292 &clipFP))) {
287 SkIRect scissorSpaceIBounds(clipSpaceIBounds); 293 SkIRect scissorSpaceIBounds(clipSpaceIBounds);
288 scissorSpaceIBounds.offset(-clip.origin()); 294 scissorSpaceIBounds.offset(-clip.origin());
289 if (nullptr == devBounds || 295 if (nullptr == devBounds ||
290 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) { 296 !SkRect::Make(scissorSpaceIBounds).contains(*devBounds)) {
291 scissorState->set(scissorSpaceIBounds); 297 scissorState->set(scissorSpaceIBounds);
292 } 298 }
293 this->setPipelineBuilderStencil(pipelineBuilder, ars); 299 this->setPipelineBuilderStencil(pipelineBuilder, ars);
294 out->fClipCoverageFP.reset(clipFP); 300 out->fClipCoverageFP.reset(clipFP);
295 return true; 301 return true;
296 } 302 }
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 1117
1112 //////////////////////////////////////////////////////////////////////////////// 1118 ////////////////////////////////////////////////////////////////////////////////
1113 1119
1114 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment, 1120 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment,
1115 GrStencilSettings* settings) { 1121 GrStencilSettings* settings) {
1116 if (stencilAttachment) { 1122 if (stencilAttachment) {
1117 int stencilBits = stencilAttachment->bits(); 1123 int stencilBits = stencilAttachment->bits();
1118 this->adjustStencilParams(settings, fClipMode, stencilBits); 1124 this->adjustStencilParams(settings, fClipMode, stencilBits);
1119 } 1125 }
1120 } 1126 }
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698