From dbddfff933522762ea164372b7fbe3d760eb78d4 Mon Sep 17 00:00:00 2001 From: Michael Ludwig Date: Mon, 27 May 2019 15:47:01 +0000 Subject: [PATCH] Revert "Update GrRTC to use GrFillRectOp::MakeGeneric" This reverts commit ffd4da3cd4ad32d638e97c1ecc63b47d273ef482. Reason for revert: Likely breaking Adreno 405 bot Original change's description: > Update GrRTC to use GrFillRectOp::MakeGeneric > > Change-Id: I4b137c545e726a49c7c5a64febdb83388f335e08 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215082 > Commit-Queue: Michael Ludwig > Reviewed-by: Brian Salomon TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I495da5181e71b98a280c53787e8e3279a5d7b162 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216281 Reviewed-by: Michael Ludwig Commit-Queue: Michael Ludwig --- src/gpu/GrRenderTargetContext.cpp | 88 ++++++++++++++----------------- 1 file changed, 40 insertions(+), 48 deletions(-) diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 055e7a7b19..858f22a90d 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -347,9 +347,8 @@ void GrRenderTargetContext::internalClear(const GrFixedClip& clip, GrPaint paint; clear_to_grpaint(color, &paint); this->addDrawOp(GrFixedClip::Disabled(), - GrFillRectOp::MakeGeneric(fContext, std::move(paint), - GrAAType::kNone, GrQuadAAFlags::kNone, - GrPerspQuad(rtRect), GrPerspQuad(rtRect))); + GrFillRectOp::Make(fContext, std::move(paint), + GrAAType::kNone, SkMatrix::I(), rtRect)); } else { this->getRTOpList()->addOp(GrClearOp::Make(fContext, SkIRect::MakeEmpty(), color, /* fullscreen */ true), *this->caps()); @@ -361,10 +360,8 @@ void GrRenderTargetContext::internalClear(const GrFixedClip& clip, GrPaint paint; clear_to_grpaint(color, &paint); - this->addDrawOp(clip, - GrFillRectOp::MakeGeneric(fContext, std::move(paint), - GrAAType::kNone, GrQuadAAFlags::kNone, - GrPerspQuad(scissor), GrPerspQuad(scissor))); + this->addDrawOp(clip, GrFillRectOp::Make(fContext, std::move(paint), GrAAType::kNone, + SkMatrix::I(), scissor)); } else { std::unique_ptr op(GrClearOp::Make(fContext, clip, color, this->asSurfaceProxy())); @@ -408,14 +405,16 @@ void GrRenderTargetContextPriv::absClear(const SkIRect* clearRect, const SkPMCol if (fRenderTargetContext->caps()->performPartialClearsAsDraws()) { GrPaint paint; clear_to_grpaint(color, &paint); - GrPerspQuad clearQuad(SkRect::Make(rtRect)); + // Use the disabled clip; the rect geometry already matches the clear rectangle and // if it were added to a scissor, that would be intersected with the logical surface // bounds and not the worst case dimensions required here. fRenderTargetContext->addDrawOp(GrFixedClip::Disabled(), - GrFillRectOp::MakeGeneric(fRenderTargetContext->fContext, std::move(paint), - GrAAType::kNone, GrQuadAAFlags::kNone, - clearQuad, clearQuad)); + GrFillRectOp::Make(fRenderTargetContext->fContext, + std::move(paint), + GrAAType::kNone, + SkMatrix::I(), + SkRect::Make(rtRect))); } else { // Must use the ClearOp factory that takes a boolean (false) instead of a surface // proxy. The surface proxy variant would intersect the clip rect with its logical @@ -435,11 +434,12 @@ void GrRenderTargetContextPriv::absClear(const SkIRect* clearRect, const SkPMCol // width and height like in internalClear(). GrPaint paint; clear_to_grpaint(color, &paint); - GrPerspQuad clearQuad(SkRect::Make(rtRect)); fRenderTargetContext->addDrawOp(GrFixedClip::Disabled(), - GrFillRectOp::MakeGeneric(fRenderTargetContext->fContext, std::move(paint), - GrAAType::kNone, GrQuadAAFlags::kNone, - clearQuad, clearQuad)); + GrFillRectOp::Make(fRenderTargetContext->fContext, + std::move(paint), + GrAAType::kNone, + SkMatrix::I(), + SkRect::Make(rtRect))); } else { // Nothing special about this path in absClear compared to internalClear() fRenderTargetContext->getRTOpList()->addOp( @@ -501,9 +501,8 @@ void GrRenderTargetContext::drawPaint(const GrClip& clip, } AutoCheckFlush acf(this->drawingManager()); - std::unique_ptr op = GrFillRectOp::MakeGeneric( - fContext, std::move(paint), GrAAType::kNone, GrQuadAAFlags::kNone, - GrPerspQuad(r), GrPerspQuad::MakeFromRect(r, localMatrix)); + std::unique_ptr op = GrFillRectOp::MakeWithLocalMatrix( + fContext, std::move(paint), GrAAType::kNone, SkMatrix::I(), localMatrix, r); this->addDrawOp(clip, std::move(op)); } @@ -698,8 +697,8 @@ bool GrRenderTargetContext::drawFilledRectAsClear(const GrClip& clip, GrPaint&& aa = edgeFlags == GrQuadAAFlags::kNone ? GrAA::kNo : GrAA::kYes; GrAAType aaType = this->chooseAAType(aa); this->addDrawOp(GrFixedClip::Disabled(), - GrFillRectOp::MakeGeneric(fContext, std::move(paint), aaType, edgeFlags, - GrPerspQuad(combinedRect), GrPerspQuad(combinedRect))); + GrFillRectOp::MakePerEdge(fContext, std::move(paint), aaType, edgeFlags, + SkMatrix::I(), combinedRect)); return true; } @@ -725,9 +724,8 @@ void GrRenderTargetContext::drawFilledRect(const GrClip& clip, } GrAAType aaType = this->chooseAAType(aa); - this->addDrawOp(clip, GrFillRectOp::MakeGeneric(fContext, std::move(paint), aaType, - aa == GrAA::kYes ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone, - GrPerspQuad::MakeFromRect(croppedRect, viewMatrix), GrPerspQuad(croppedRect), ss)); + this->addDrawOp(clip, GrFillRectOp::Make(fContext, std::move(paint), aaType, viewMatrix, + croppedRect, ss)); } void GrRenderTargetContext::drawRect(const GrClip& clip, @@ -835,14 +833,14 @@ void GrRenderTargetContext::internalStencilClear(const GrFixedClip& clip, bool i // Configure the paint to have no impact on the color buffer GrPaint paint; - paint.setXPFactory(GrDisableColorXPFactory::Get()); + paint.setColor4f({0.f, 0.f, 0.f, 0.f}); + paint.setPorterDuffXPFactory(SkBlendMode::kSrcOver); // Mark stencil usage here before addDrawOp() so that it doesn't try to re-call // internalStencilClear() just because the op has stencil settings. this->setNeedsStencil(); - GrPerspQuad clearRect(rtRect); - this->addDrawOp(clip, GrFillRectOp::MakeGeneric(fContext, std::move(paint), GrAAType::kNone, - GrQuadAAFlags::kNone, clearRect, clearRect, ss)); + this->addDrawOp(clip, GrFillRectOp::Make(fContext, std::move(paint), + GrAAType::kNone, SkMatrix::I(), rtRect, ss)); } else { std::unique_ptr op(GrClearStencilClipOp::Make(fContext, clip, insideStencilMask, fRenderTargetProxy.get())); @@ -910,9 +908,8 @@ void GrRenderTargetContextPriv::stencilRect(const GrHardClip& clip, GrPaint paint; paint.setXPFactory(GrDisableColorXPFactory::Get()); auto aaType = (GrAA::kYes == doStencilMSAA) ? GrAAType::kMSAA : GrAAType::kNone; - std::unique_ptr op = GrFillRectOp::MakeGeneric( - fRenderTargetContext->fContext, std::move(paint), aaType, GrQuadAAFlags::kNone, - GrPerspQuad::MakeFromRect(rect, viewMatrix), GrPerspQuad(rect), ss); + std::unique_ptr op = GrFillRectOp::Make( + fRenderTargetContext->fContext, std::move(paint), aaType, viewMatrix, rect, ss); fRenderTargetContext->addDrawOp(clip, std::move(op)); } @@ -959,9 +956,8 @@ void GrRenderTargetContext::fillRectWithEdgeAA(const GrClip& clip, GrPaint&& pai &croppedLocalRect)) { return; } - op = GrFillRectOp::MakeGeneric(fContext, std::move(paint), aaType, edgeAA, - GrPerspQuad::MakeFromRect(croppedRect, viewMatrix), - GrPerspQuad(croppedLocalRect)); + op = GrFillRectOp::MakePerEdgeWithLocalRect(fContext, std::move(paint), aaType, edgeAA, + viewMatrix, croppedRect, croppedLocalRect); } else { // If aaType turns into MSAA, make sure to keep quads with no AA edges as MSAA. Sending // those to drawFilledRect() would have it turn off MSAA in that case, which breaks seaming @@ -979,8 +975,8 @@ void GrRenderTargetContext::fillRectWithEdgeAA(const GrClip& clip, GrPaint&& pai if (!crop_filled_rect(this->width(), this->height(), clip, viewMatrix, &croppedRect)) { return; } - op = GrFillRectOp::MakeGeneric(fContext, std::move(paint), aaType, edgeAA, - GrPerspQuad::MakeFromRect(croppedRect, viewMatrix), GrPerspQuad(croppedRect)); + op = GrFillRectOp::MakePerEdge(fContext, std::move(paint), aaType, edgeAA, viewMatrix, + croppedRect); } AutoCheckFlush acf(this->drawingManager()); @@ -998,10 +994,9 @@ void GrRenderTargetContext::fillQuadWithEdgeAA(const GrClip& clip, GrPaint&& pai GrAAType aaType = this->chooseAAType(aa); AutoCheckFlush acf(this->drawingManager()); - const SkPoint* localPoints = localQuad ? localQuad : quad; - this->addDrawOp(clip, GrFillRectOp::MakeGeneric(fContext, std::move(paint), aaType, edgeAA, - GrPerspQuad::MakeFromSkQuad(quad, viewMatrix), - GrPerspQuad::MakeFromSkQuad(localPoints, SkMatrix::I()))); + // MakePerEdgeQuad automatically does the right thing if localQuad is null or not + this->addDrawOp(clip, GrFillRectOp::MakePerEdgeQuad(fContext, std::move(paint), aaType, edgeAA, + viewMatrix, quad, localQuad)); } // Creates a paint for GrFillRectOp that matches behavior of GrTextureOp @@ -1067,8 +1062,8 @@ void GrRenderTargetContext::drawTexture(const GrClip& clip, sk_spdrawingManager()); GrAAType aaType = this->chooseAAType(aa); - this->addDrawOp(clip, GrFillRectOp::MakeGeneric(fContext, std::move(paint), aaType, - aa == GrAA::kYes ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone, - GrPerspQuad::MakeFromRect(rectToDraw, viewMatrix), - GrPerspQuad::MakeFromRect(rectToDraw, localMatrix))); + this->addDrawOp(clip, GrFillRectOp::MakeWithLocalMatrix(fContext, std::move(paint), aaType, + viewMatrix, localMatrix, croppedRect)); } void GrRenderTargetContext::drawVertices(const GrClip& clip,