Revert "Reland "Notify RTC when OpsTask is closed so it can drop ownership""
This reverts commit3b8486afd3
. Reason for revert: Broke stencil preservation Original change's description: > Reland "Notify RTC when OpsTask is closed so it can drop ownership" > > This reverts commit777f239a65
. > > Assigns observer in GrRenderTargetContext constructor. > > Change-Id: Ie1d4a425eb959f7b822b5fc4988b2bb6ca2ed6a5 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284733 > Reviewed-by: Greg Daniel <egdaniel@google.com> > Commit-Queue: Brian Salomon <bsalomon@google.com> TBR=egdaniel@google.com,bsalomon@google.com Change-Id: Ib72f6ef2bcfa820a130bf3d3b71e40c9a75f1d3f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332179 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Adlai Holler <adlai@google.com>
This commit is contained in:
parent
d7e7659cad
commit
6ecfddbf95
@ -9,7 +9,6 @@
|
||||
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkRectPriv.h"
|
||||
#include "src/core/SkScopeExit.h"
|
||||
#include "src/core/SkTraceEvent.h"
|
||||
#include "src/gpu/GrAttachment.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
@ -38,10 +37,6 @@ using DstProxyView = GrXferProcessor::DstProxyView;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrOpsTaskClosedObserver::~GrOpsTaskClosedObserver() = default;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline bool can_reorder(const SkRect& a, const SkRect& b) { return !GrRectsOverlap(a, b); }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -382,16 +377,6 @@ GrOpsTask::~GrOpsTask() {
|
||||
this->deleteOps();
|
||||
}
|
||||
|
||||
void GrOpsTask::removeClosedObserver(GrOpsTaskClosedObserver* observer) {
|
||||
SkASSERT(observer);
|
||||
for (int i = 0; i < fClosedObservers.count(); ++i) {
|
||||
if (fClosedObservers[i] == observer) {
|
||||
fClosedObservers.removeShuffle(i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GrOpsTask::endFlush(GrDrawingManager* drawingMgr) {
|
||||
fLastClipStackGenID = SK_InvalidUniqueID;
|
||||
this->deleteOps();
|
||||
@ -893,12 +878,6 @@ void GrOpsTask::forwardCombine(const GrCaps& caps) {
|
||||
GrRenderTask::ExpectedOutcome GrOpsTask::onMakeClosed(
|
||||
const GrCaps& caps, SkIRect* targetUpdateBounds) {
|
||||
this->forwardCombine(caps);
|
||||
SkScopeExit triggerObservers([&] {
|
||||
for (const auto& o : fClosedObservers) {
|
||||
o->wasClosed(*this);
|
||||
}
|
||||
fClosedObservers.reset();
|
||||
});
|
||||
if (!this->isNoOp()) {
|
||||
GrSurfaceProxy* proxy = this->target(0).proxy();
|
||||
// Use the entire backing store bounds since the GPU doesn't clip automatically to the
|
||||
|
@ -33,17 +33,6 @@ class GrClearOp;
|
||||
class GrGpuBuffer;
|
||||
class GrRenderTargetProxy;
|
||||
|
||||
/** Observer is notified when a GrOpsTask is closed. */
|
||||
class GrOpsTaskClosedObserver {
|
||||
public:
|
||||
virtual ~GrOpsTaskClosedObserver() = 0;
|
||||
/**
|
||||
* Called when the GrOpsTask is closed. Must not add/remove observers to 'task'.
|
||||
* The GrOpsTask will remove all its observers after it finishes calling wasClosed().
|
||||
*/
|
||||
virtual void wasClosed(const GrOpsTask& task) = 0;
|
||||
};
|
||||
|
||||
class GrOpsTask : public GrRenderTask {
|
||||
private:
|
||||
using DstProxyView = GrXferProcessor::DstProxyView;
|
||||
@ -56,13 +45,6 @@ public:
|
||||
|
||||
GrOpsTask* asOpsTask() override { return this; }
|
||||
|
||||
void addClosedObserver(GrOpsTaskClosedObserver* observer) {
|
||||
SkASSERT(observer);
|
||||
fClosedObservers.push_back(observer);
|
||||
}
|
||||
|
||||
void removeClosedObserver(GrOpsTaskClosedObserver* observer);
|
||||
|
||||
bool isEmpty() const { return fOpChains.empty(); }
|
||||
|
||||
/**
|
||||
@ -315,8 +297,6 @@ private:
|
||||
GrRecordingContext::Arenas fArenas;
|
||||
GrAuditTrail* fAuditTrail;
|
||||
|
||||
SkSTArray<2, GrOpsTaskClosedObserver*, true> fClosedObservers;
|
||||
|
||||
GrLoadOp fColorLoadOp = GrLoadOp::kLoad;
|
||||
SkPMColor4f fLoadClearColor = SK_PMColor4fTRANSPARENT;
|
||||
StencilContent fInitialStencilContent = StencilContent::kDontCare;
|
||||
|
@ -309,9 +309,6 @@ GrRenderTargetContext::GrRenderTargetContext(GrRecordingContext* context,
|
||||
, fManagedOpsTask(managedOpsTask)
|
||||
, fGlyphPainter(*this) {
|
||||
fOpsTask = sk_ref_sp(context->priv().drawingManager()->getLastOpsTask(this->asSurfaceProxy()));
|
||||
if (fOpsTask) {
|
||||
fOpsTask->addClosedObserver(this);
|
||||
}
|
||||
SkASSERT(this->asSurfaceProxy() == fWriteView.proxy());
|
||||
SkASSERT(this->origin() == fWriteView.origin());
|
||||
|
||||
@ -328,9 +325,6 @@ void GrRenderTargetContext::onValidate() const {
|
||||
|
||||
GrRenderTargetContext::~GrRenderTargetContext() {
|
||||
ASSERT_SINGLE_OWNER
|
||||
if (fOpsTask) {
|
||||
fOpsTask->removeClosedObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
inline GrAAType GrRenderTargetContext::chooseAAType(GrAA aa) {
|
||||
@ -356,7 +350,7 @@ GrOpsTask* GrRenderTargetContext::getOpsTask() {
|
||||
ASSERT_SINGLE_OWNER
|
||||
SkDEBUGCODE(this->validate();)
|
||||
|
||||
if (!fOpsTask) {
|
||||
if (!fOpsTask || fOpsTask->isClosed()) {
|
||||
sk_sp<GrOpsTask> newOpsTask =
|
||||
this->drawingManager()->newOpsTask(this->writeSurfaceView(), fManagedOpsTask);
|
||||
if (fOpsTask && fNumStencilSamples > 0) {
|
||||
@ -367,7 +361,6 @@ GrOpsTask* GrRenderTargetContext::getOpsTask() {
|
||||
// values?
|
||||
newOpsTask->setInitialStencilContent(GrOpsTask::StencilContent::kPreserved);
|
||||
}
|
||||
newOpsTask->addClosedObserver(this);
|
||||
fOpsTask = std::move(newOpsTask);
|
||||
}
|
||||
SkASSERT(!fOpsTask->isClosed());
|
||||
@ -2129,8 +2122,3 @@ bool GrRenderTargetContext::blitTexture(GrSurfaceProxyView view, const SkIRect&
|
||||
SkRect::Make(clippedSrcRect));
|
||||
return true;
|
||||
}
|
||||
|
||||
void GrRenderTargetContext::wasClosed(const GrOpsTask& task) {
|
||||
SkASSERT(&task == fOpsTask.get());
|
||||
fOpsTask.reset();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class SkVertices;
|
||||
/**
|
||||
* A helper object to orchestrate commands (draws, etc...) for GrSurfaces that are GrRenderTargets.
|
||||
*/
|
||||
class GrRenderTargetContext : public GrSurfaceContext, public GrOpsTaskClosedObserver {
|
||||
class GrRenderTargetContext : public GrSurfaceContext {
|
||||
public:
|
||||
static std::unique_ptr<GrRenderTargetContext> Make(
|
||||
GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, sk_sp<GrSurfaceProxy>,
|
||||
@ -586,8 +586,6 @@ public:
|
||||
GrRenderTargetContextPriv priv();
|
||||
const GrRenderTargetContextPriv priv() const; // NOLINT(readability-const-return-type)
|
||||
|
||||
void wasClosed(const GrOpsTask& task) override;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool testingOnly_IsInstantiated() const { return this->asSurfaceProxy()->isInstantiated(); }
|
||||
void testingOnly_SetPreserveOpsOnFullClear() { fPreserveOpsOnFullClear_TestingOnly = true; }
|
||||
|
Loading…
Reference in New Issue
Block a user