diff options
author | 2017-05-24 13:28:36 -0400 | |
---|---|---|
committer | 2017-05-25 15:20:27 +0000 | |
commit | 3fdd0bf2d90b1b82c1ac3aa982bdca600de7f4a8 (patch) | |
tree | cea0a46afca9e4bc94c9cd5ba43eeae8d3a2b2bc /src/gpu/GrRenderTargetContext.cpp | |
parent | cd2f512578a800bdcc3e4aed7eecd21826677d17 (diff) |
Update clearOp for split-OpList world (take 2)
It would reduce a lot of noise if the GrRenderTargetOpList kept a pointer to the GrCaps but, for now, I'm trying to shrink the GrRTOpList, not expand it.
Reland of: https://skia-review.googlesource.com/c/17323/ (Update clearOp for split-OpList world)
Change-Id: I97f3fb81e6258d430e7f7cf1ea8bd51a392f9f47
Reviewed-on: https://skia-review.googlesource.com/17830
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index fa1e0b3d00..ccecd66a55 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -200,7 +200,7 @@ void GrRenderTargetContext::discard() { if (!op) { return; } - this->getOpList()->addOp(std::move(op), this); + this->getOpList()->addOp(std::move(op), *this->caps()); } } @@ -259,11 +259,11 @@ void GrRenderTargetContextPriv::absClear(const SkIRect* clearRect, const GrColor // This path doesn't handle coalescing of full screen clears b.c. it // has to clear the entire render target - not just the content area. // It could be done but will take more finagling. - std::unique_ptr<GrOp> op(GrClearOp::Make(rtRect, color, fRenderTargetContext, !clearRect)); + std::unique_ptr<GrOp> op(GrClearOp::Make(rtRect, color, !clearRect)); if (!op) { return; } - fRenderTargetContext->getOpList()->addOp(std::move(op), fRenderTargetContext); + fRenderTargetContext->getOpList()->addOp(std::move(op), *fRenderTargetContext->caps()); } } @@ -307,13 +307,13 @@ void GrRenderTargetContext::internalClear(const GrFixedClip& clip, this->drawRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(), SkRect::Make(clearRect)); } else if (isFull) { - this->getOpList()->fullClear(this, color); + this->getOpList()->fullClear(*this->caps(), color); } else { - std::unique_ptr<GrOp> op(GrClearOp::Make(clip, color, this)); + std::unique_ptr<GrOp> op(GrClearOp::Make(clip, color, this->asSurfaceProxy())); if (!op) { return; } - this->getOpList()->addOp(std::move(op), this); + this->getOpList()->addOp(std::move(op), *this->caps()); } } @@ -610,7 +610,7 @@ void GrRenderTargetContextPriv::clearStencilClip(const GrFixedClip& clip, bool i if (!op) { return; } - fRenderTargetContext->getOpList()->addOp(std::move(op), fRenderTargetContext); + fRenderTargetContext->getOpList()->addOp(std::move(op), *fRenderTargetContext->caps()); } void GrRenderTargetContextPriv::stencilPath(const GrClip& clip, @@ -668,7 +668,7 @@ void GrRenderTargetContextPriv::stencilPath(const GrClip& clip, return; } op->setClippedBounds(bounds); - fRenderTargetContext->getOpList()->addOp(std::move(op), fRenderTargetContext); + fRenderTargetContext->getOpList()->addOp(std::move(op), *fRenderTargetContext->caps()); } void GrRenderTargetContextPriv::stencilRect(const GrClip& clip, @@ -1759,14 +1759,14 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr return SK_InvalidUniqueID; } - // This forces instantiation of the render target. - GrRenderTarget* rt = this->accessRenderTarget(); - if (!rt) { - return SK_InvalidUniqueID; - } - if (fixedFunctionFlags & GrDrawOp::FixedFunctionFlags::kUsesStencil || appliedClip.hasStencilClip()) { + // This forces instantiation of the render target. + GrRenderTarget* rt = this->accessRenderTarget(); + if (!rt) { + return SK_InvalidUniqueID; + } + if (!fContext->resourceProvider()->attachStencilAttachment(rt)) { SkDebugf("ERROR creating stencil attachment. Draw skipped.\n"); return SK_InvalidUniqueID; @@ -1781,7 +1781,8 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr } op->setClippedBounds(bounds); - return this->getOpList()->addOp(std::move(op), this, std::move(appliedClip), dstTexture); + return this->getOpList()->addOp(std::move(op), *this->caps(), + std::move(appliedClip), dstTexture); } uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipelineBuilder, @@ -1843,7 +1844,7 @@ uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipeline op->addDependenciesTo(fRenderTargetProxy.get()); op->setClippedBounds(bounds); - return this->getOpList()->addOp(std::move(op), this); + return this->getOpList()->addOp(std::move(op), *this->caps()); } bool GrRenderTargetContext::setupDstTexture(GrRenderTargetProxy* rtProxy, const GrClip& clip, |