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

Unified Diff: src/gpu/GrClipMaskManager.cpp

Issue 1407883004: Remove GrPipelineBuilder from getPathRenderer call (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrClipMaskManager.cpp
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index ff00a94f5aaebee244e3269da47199ff454a05c7..e25f991ab4bc1daeb8bea805ddb41d48cf72df6d 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -50,7 +50,8 @@ static const GrFragmentProcessor* create_fp_for_mask(GrTexture* result, const Sk
// optionally, set 'prOut' to NULL. If not, return false (and, optionally, set
// 'prOut' to the non-SW path renderer that will do the job).
static bool path_needs_SW_renderer(GrContext* context,
- const GrPipelineBuilder& pipelineBuilder,
+ bool isStencilDisabled,
+ const GrRenderTarget* rt,
const SkMatrix& viewMatrix,
const Element* element,
GrPathRenderer** prOut,
@@ -87,8 +88,10 @@ static bool path_needs_SW_renderer(GrContext* context,
}
// the 'false' parameter disallows use of the SW path renderer
- GrPathRenderer* pr = context->getPathRenderer(pipelineBuilder, viewMatrix, path,
- stroke, false, type);
+ GrPathRenderer* pr = context->getPathRenderer(viewMatrix, path,
+ stroke, false, type,
+ isStencilDisabled,
+ rt->isStencilBufferMultisampled());
if (prOut) {
*prOut = pr;
}
@@ -100,16 +103,15 @@ static bool path_needs_SW_renderer(GrContext* context,
// alpha mask simultaneously. If so and the element is a path a compatible path renderer is
// also returned.
static bool can_stencil_and_draw_element(GrContext* context,
- GrPipelineBuilder* pipelineBuilder,
GrTexture* texture,
const SkMatrix& viewMatrix,
const SkClipStack::Element* element,
GrPathRenderer** pr) {
- pipelineBuilder->setRenderTarget(texture->asRenderTarget());
-
static const bool kNeedsStencil = true;
+ static const bool kStencilIsDisabled = true;
return !path_needs_SW_renderer(context,
- *pipelineBuilder,
+ kStencilIsDisabled,
+ texture->asRenderTarget(),
viewMatrix,
element,
pr,
@@ -129,6 +131,7 @@ GrContext* GrClipMaskManager::getContext() { return fDrawTarget->cmmAccess().con
* entire clip should be rendered in SW and then uploaded en masse to the gpu.
*/
bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder& pipelineBuilder,
+ const GrRenderTarget* rt,
const SkVector& clipToMaskOffset,
const GrReducedClip::ElementList& elements) {
// TODO: generalize this function so that when
@@ -147,8 +150,8 @@ bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder& pipelineBuilder,
bool needsStencil = invert ||
SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op == op;
- if (path_needs_SW_renderer(this->getContext(), pipelineBuilder, translate,
- element, nullptr, needsStencil)) {
+ if (path_needs_SW_renderer(this->getContext(), pipelineBuilder.getStencil().isDisabled(),
+ rt, translate, element, nullptr, needsStencil)) {
return true;
}
}
@@ -358,7 +361,7 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
SkIntToScalar(-clipSpaceIBounds.fTop)
};
- if (this->useSWOnlyPath(pipelineBuilder, clipToMaskOffset, elements)) {
+ if (this->useSWOnlyPath(pipelineBuilder, rt, clipToMaskOffset, elements)) {
// The clip geometry is complex enough that it will be more efficient to create it
// entirely in software
result.reset(this->createSoftwareClipMask(genID,
@@ -424,7 +427,8 @@ bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder,
const SkClipStack::Element* element,
GrPathRenderer* pr) {
- pipelineBuilder->setRenderTarget(target->asRenderTarget());
+ GrRenderTarget* rt = target->asRenderTarget();
+ pipelineBuilder->setRenderTarget(rt);
// The color we use to draw does not matter since we will always be using a GrCoverageSetOpXP
// which ignores color.
@@ -460,8 +464,10 @@ bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder,
GrPathRendererChain::DrawType type;
type = element->isAA() ? GrPathRendererChain::kColorAntiAlias_DrawType :
GrPathRendererChain::kColor_DrawType;
- pr = this->getContext()->getPathRenderer(*pipelineBuilder, viewMatrix,
- path, stroke, false, type);
+ pr = this->getContext()->getPathRenderer(viewMatrix,
+ path, stroke, false, type,
+ pipelineBuilder->getStencil().isDisabled(),
+ rt->isStencilBufferMultisampled());
}
if (nullptr == pr) {
return false;
@@ -606,8 +612,11 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setClip(clip);
+ pipelineBuilder.setRenderTarget(texture->asRenderTarget());
+
+ SkASSERT(pipelineBuilder.getStencil().isDisabled());
GrPathRenderer* pr = nullptr;
- bool useTemp = !can_stencil_and_draw_element(this->getContext(), &pipelineBuilder,
+ bool useTemp = !can_stencil_and_draw_element(this->getContext(),
texture, translate, element, &pr);
// useSWOnlyPath should now filter out all cases where gpu-side mask merging is
@@ -786,12 +795,16 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
if (fillInverted) {
clipPath.toggleInverseFillType();
}
- pr = this->getContext()->getPathRenderer(pipelineBuilder,
- viewMatrix,
+
+ SkASSERT(pipelineBuilder.getStencil().isDisabled());
+
+ pr = this->getContext()->getPathRenderer(viewMatrix,
clipPath,
stroke,
false,
GrPathRendererChain::kStencilOnly_DrawType,
+ true,
+ rt->isStencilBufferMultisampled(),
&stencilSupport);
if (nullptr == pr) {
return false;

Powered by Google App Engine
This is Rietveld 408576698