Revert "Split cleanup changes out of bigger CL"
This reverts commit cd11c809f2
.
Reason for revert: assert(rtp->getLastOpList())
Original change's description:
> Split cleanup changes out of bigger CL
>
> This are split out of: https://skia-review.googlesource.com/c/11581/ (Split up opLists)
>
> TBR=bsalomon@google.com
>
> Change-Id: I1239e806a30a93d3c17ad933f118b98a5077dd3a
> Reviewed-on: https://skia-review.googlesource.com/13585
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: Ia3ef7322fe830a6a4dc29226ce931d35d181c6e0
Reviewed-on: https://skia-review.googlesource.com/13641
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
215989330c
commit
e186cfd15f
@ -216,7 +216,13 @@ public:
|
||||
*/
|
||||
TextureSampler();
|
||||
|
||||
// MDB TODO: this is the last GrTexture-based reset call!
|
||||
TextureSampler(GrTexture*, const GrSamplerParams&);
|
||||
explicit TextureSampler(GrTexture*,
|
||||
GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode,
|
||||
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
|
||||
GrShaderFlags visibility = kFragment_GrShaderFlag);
|
||||
void reset(GrTexture*, const GrSamplerParams&,
|
||||
GrShaderFlags visibility = kFragment_GrShaderFlag);
|
||||
void reset(GrTexture*,
|
||||
GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode,
|
||||
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode,
|
||||
|
@ -284,7 +284,7 @@ public:
|
||||
GrTextureOpList* getLastTextureOpList();
|
||||
|
||||
/**
|
||||
* Retrieves the amount of GPU memory that will be or currently is used by this resource
|
||||
* Retrieves the amount of GPU memory that will be or currently is used by this resource
|
||||
* in bytes. It is approximate since we aren't aware of additional padding or copies made
|
||||
* by the driver.
|
||||
*
|
||||
|
@ -31,6 +31,7 @@ void GrDrawingManager::cleanup() {
|
||||
// We shouldn't need to do this, but it turns out some clients still hold onto opLists
|
||||
// after a cleanup
|
||||
fOpLists[i]->reset();
|
||||
fOpLists[i]->unref();
|
||||
}
|
||||
|
||||
fOpLists.reset();
|
||||
@ -85,11 +86,9 @@ void GrDrawingManager::internalFlush(GrSurfaceProxy*, GrResourceCache::FlushType
|
||||
fOpLists[i]->makeClosed();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MDB
|
||||
SkDEBUGCODE(bool result =)
|
||||
SkTTopoSort<GrOpList, GrOpList::TopoSortTraits>(&fOpLists);
|
||||
SkASSERT(result);
|
||||
#endif
|
||||
|
||||
GrPreFlushResourceProvider preFlushProvider(this);
|
||||
|
||||
@ -149,6 +148,9 @@ void GrDrawingManager::internalFlush(GrSurfaceProxy*, GrResourceCache::FlushType
|
||||
|
||||
for (int i = 0; i < fOpLists.count(); ++i) {
|
||||
fOpLists[i]->reset();
|
||||
#ifdef ENABLE_MDB
|
||||
fOpLists[i]->unref();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef ENABLE_MDB
|
||||
@ -204,24 +206,25 @@ sk_sp<GrRenderTargetOpList> GrDrawingManager::newRTOpList(sk_sp<GrRenderTargetPr
|
||||
SkASSERT(fOpLists.count() == 1);
|
||||
// In the non-MDB-world the same GrOpList gets reused for multiple render targets.
|
||||
// Update this pointer so all the asserts are happy
|
||||
rtp->setLastOpList(fOpLists[0].get());
|
||||
rtp->setLastOpList(fOpLists[0]);
|
||||
// DrawingManager gets the creation ref - this ref is for the caller
|
||||
|
||||
// TODO: although this is true right now it isn't cool
|
||||
return sk_ref_sp((GrRenderTargetOpList*) fOpLists[0].get());
|
||||
return sk_ref_sp((GrRenderTargetOpList*) fOpLists[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<GrRenderTargetOpList> opList(new GrRenderTargetOpList(rtp,
|
||||
fContext->getGpu(),
|
||||
fContext->resourceProvider(),
|
||||
fContext->getAuditTrail(),
|
||||
fOptionsForOpLists));
|
||||
SkASSERT(rtp->getLastOpList() == opList.get());
|
||||
GrRenderTargetOpList* opList = new GrRenderTargetOpList(rtp,
|
||||
fContext->getGpu(),
|
||||
fContext->resourceProvider(),
|
||||
fContext->getAuditTrail(),
|
||||
fOptionsForOpLists);
|
||||
SkASSERT(rtp->getLastOpList() == opList);
|
||||
|
||||
fOpLists.push_back() = opList;
|
||||
*fOpLists.append() = opList;
|
||||
|
||||
return opList;
|
||||
// DrawingManager gets the creation ref - this ref is for the caller
|
||||
return sk_ref_sp(opList);
|
||||
}
|
||||
|
||||
sk_sp<GrTextureOpList> GrDrawingManager::newTextureOpList(sk_sp<GrTextureProxy> textureProxy) {
|
||||
|
@ -111,7 +111,7 @@ private:
|
||||
GrSingleOwner* fSingleOwner;
|
||||
|
||||
bool fAbandoned;
|
||||
SkTArray<sk_sp<GrOpList>> fOpLists;
|
||||
SkTDArray<GrOpList*> fOpLists;
|
||||
|
||||
std::unique_ptr<GrAtlasTextContext> fAtlasTextContext;
|
||||
|
||||
|
@ -26,7 +26,7 @@ class SkColorSpace;
|
||||
class SkSurfaceProps;
|
||||
|
||||
/*
|
||||
* This is the base class from which all pre-flush callback objects must be derived. It
|
||||
* This is the base class from which all per-flush callback objects must be derived. It
|
||||
* provides the "preFlush" interface.
|
||||
*/
|
||||
class GrPreFlushCallbackObject : public GrNonAtomicRef<GrPreFlushCallbackObject> {
|
||||
|
@ -204,6 +204,18 @@ bool GrResourceIOProcessor::hasSameSamplersAndAccesses(const GrResourceIOProcess
|
||||
|
||||
GrResourceIOProcessor::TextureSampler::TextureSampler() {}
|
||||
|
||||
GrResourceIOProcessor::TextureSampler::TextureSampler(GrTexture* texture,
|
||||
const GrSamplerParams& params) {
|
||||
this->reset(texture, params);
|
||||
}
|
||||
|
||||
GrResourceIOProcessor::TextureSampler::TextureSampler(GrTexture* texture,
|
||||
GrSamplerParams::FilterMode filterMode,
|
||||
SkShader::TileMode tileXAndY,
|
||||
GrShaderFlags visibility) {
|
||||
this->reset(texture, filterMode, tileXAndY, visibility);
|
||||
}
|
||||
|
||||
GrResourceIOProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider,
|
||||
sk_sp<GrTextureProxy> proxy,
|
||||
const GrSamplerParams& params) {
|
||||
@ -218,7 +230,16 @@ GrResourceIOProcessor::TextureSampler::TextureSampler(GrResourceProvider* resour
|
||||
this->reset(resourceProvider, std::move(proxy), filterMode, tileXAndY, visibility);
|
||||
}
|
||||
|
||||
// MDB TODO: remove this!
|
||||
void GrResourceIOProcessor::TextureSampler::reset(GrTexture* texture,
|
||||
const GrSamplerParams& params,
|
||||
GrShaderFlags visibility) {
|
||||
SkASSERT(texture);
|
||||
fTexture.set(SkRef(texture), kRead_GrIOType);
|
||||
fParams = params;
|
||||
fParams.setFilterMode(SkTMin(params.filterMode(), texture->texturePriv().highestFilterMode()));
|
||||
fVisibility = visibility;
|
||||
}
|
||||
|
||||
void GrResourceIOProcessor::TextureSampler::reset(GrTexture* texture,
|
||||
GrSamplerParams::FilterMode filterMode,
|
||||
SkShader::TileMode tileXAndY,
|
||||
|
@ -1675,10 +1675,7 @@ uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipeline
|
||||
}
|
||||
}
|
||||
op->initPipeline(args, analysis, overrideColor);
|
||||
|
||||
// Add the pipeline dependencies on textures, etc before recording this op.
|
||||
op->addDependenciesTo(fRenderTargetProxy.get());
|
||||
|
||||
// TODO: We need to add pipeline dependencies on textures, etc before recording this op.
|
||||
op->setClippedBounds(bounds);
|
||||
return this->getOpList()->addOp(std::move(op), this);
|
||||
}
|
||||
|
@ -233,10 +233,6 @@ void GrRenderTargetOpList::fullClear(GrRenderTargetContext* renderTargetContext,
|
||||
// As currently implemented, fLastFullClearOp should be the last op because we would
|
||||
// have cleared it when another op was recorded.
|
||||
SkASSERT(fRecordedOps.back().fOp.get() == fLastFullClearOp);
|
||||
GrOP_INFO("opList: %d Fusing clears (opID: %d Color: 0x%08x -> 0x%08x)\n",
|
||||
this->uniqueID(),
|
||||
fLastFullClearOp->uniqueID(),
|
||||
fLastFullClearOp->color(), color);
|
||||
fLastFullClearOp->setColor(color);
|
||||
return;
|
||||
}
|
||||
@ -320,14 +316,15 @@ GrOp* GrRenderTargetOpList::recordOp(std::unique_ptr<GrOp> op,
|
||||
// 3) find a 'blocker'
|
||||
GR_AUDIT_TRAIL_ADD_OP(fAuditTrail, op.get(), renderTarget->uniqueID(),
|
||||
renderTargetContext->asRenderTargetProxy()->uniqueID());
|
||||
GrOP_INFO("opList: %d Recording (%s, opID: %u)\n"
|
||||
"\tBounds [L: %.2f, T: %.2f R: %.2f B: %.2f]\n",
|
||||
this->uniqueID(),
|
||||
GrOP_INFO("Recording (%s, opID: %u)\n"
|
||||
"\tBounds: [L: %f T: %f R: %f B: %f]\n",
|
||||
op->name(),
|
||||
op->uniqueID(),
|
||||
op->bounds().fLeft, op->bounds().fTop,
|
||||
op->bounds().fRight, op->bounds().fBottom);
|
||||
GrOP_INFO(SkTabString(op->dumpInfo(), 1).c_str());
|
||||
GrOP_INFO("\tClipped Bounds: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n", op->bounds().fLeft,
|
||||
op->bounds().fTop, op->bounds().fRight, op->bounds().fBottom);
|
||||
GrOP_INFO("\tOutcome:\n");
|
||||
int maxCandidates = SkTMin(fMaxOpLookback, fRecordedOps.count());
|
||||
// If we don't have a valid destination render target then we cannot reorder.
|
||||
@ -337,33 +334,33 @@ GrOp* GrRenderTargetOpList::recordOp(std::unique_ptr<GrOp> op,
|
||||
const RecordedOp& candidate = fRecordedOps.fromBack(i);
|
||||
// We cannot continue to search backwards if the render target changes
|
||||
if (candidate.fRenderTarget.get() != renderTarget) {
|
||||
GrOP_INFO("\t\tBackward: Breaking because of (%s, opID: %u) Rendertarget mismatch\n",
|
||||
GrOP_INFO("\t\tBreaking because of (%s, opID: %u) Rendertarget mismatch\n",
|
||||
candidate.fOp->name(),
|
||||
candidate.fOp->uniqueID());
|
||||
break;
|
||||
}
|
||||
if (this->combineIfPossible(candidate, op.get(), clip, dstTexture)) {
|
||||
GrOP_INFO("\t\tBackward: Combining with (%s, opID: %u)\n", candidate.fOp->name(),
|
||||
GrOP_INFO("\t\tCombining with (%s, opID: %u)\n", candidate.fOp->name(),
|
||||
candidate.fOp->uniqueID());
|
||||
GrOP_INFO("\t\t\tBackward: Combined op info:\n");
|
||||
GrOP_INFO("\t\t\tCombined op info:\n");
|
||||
GrOP_INFO(SkTabString(candidate.fOp->dumpInfo(), 4).c_str());
|
||||
GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(fAuditTrail, candidate.fOp.get(), op.get());
|
||||
return candidate.fOp.get();
|
||||
}
|
||||
// Stop going backwards if we would cause a painter's order violation.
|
||||
if (!can_reorder(fRecordedOps.fromBack(i).fOp->bounds(), op->bounds())) {
|
||||
GrOP_INFO("\t\tBackward: Intersects with (%s, opID: %u)\n", candidate.fOp->name(),
|
||||
GrOP_INFO("\t\tIntersects with (%s, opID: %u)\n", candidate.fOp->name(),
|
||||
candidate.fOp->uniqueID());
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
if (i == maxCandidates) {
|
||||
GrOP_INFO("\t\tBackward: Reached max lookback or beginning of op array %d\n", i);
|
||||
GrOP_INFO("\t\tReached max lookback or beginning of op array %d\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GrOP_INFO("\t\tBackward: FirstOp\n");
|
||||
GrOP_INFO("\t\tFirstOp\n");
|
||||
}
|
||||
GR_AUDIT_TRAIL_OP_RESULT_NEW(fAuditTrail, op);
|
||||
if (clip) {
|
||||
@ -378,15 +375,12 @@ GrOp* GrRenderTargetOpList::recordOp(std::unique_ptr<GrOp> op,
|
||||
}
|
||||
|
||||
void GrRenderTargetOpList::forwardCombine() {
|
||||
SkASSERT(!this->isClosed());
|
||||
|
||||
if (fMaxOpLookahead <= 0) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < fRecordedOps.count() - 1; ++i) {
|
||||
GrOp* op = fRecordedOps[i].fOp.get();
|
||||
GrRenderTarget* renderTarget = fRecordedOps[i].fRenderTarget.get();
|
||||
SkASSERT(renderTarget);
|
||||
// If we don't have a valid destination render target ID then we cannot reorder.
|
||||
if (!renderTarget) {
|
||||
continue;
|
||||
@ -397,14 +391,13 @@ void GrRenderTargetOpList::forwardCombine() {
|
||||
const RecordedOp& candidate = fRecordedOps[j];
|
||||
// We cannot continue to search if the render target changes
|
||||
if (candidate.fRenderTarget.get() != renderTarget) {
|
||||
GrOP_INFO("\t\tForward: Breaking because of (%s, opID: %u) Rendertarget\n",
|
||||
candidate.fOp->name(),
|
||||
GrOP_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n", candidate.fOp->name(),
|
||||
candidate.fOp->uniqueID());
|
||||
break;
|
||||
}
|
||||
if (this->combineIfPossible(fRecordedOps[i], candidate.fOp.get(),
|
||||
candidate.fAppliedClip, &candidate.fDstTexture)) {
|
||||
GrOP_INFO("\t\tForward: Combining with (%s, opID: %u)\n", candidate.fOp->name(),
|
||||
GrOP_INFO("\t\tCombining with (%s, B%u)\n", candidate.fOp->name(),
|
||||
candidate.fOp->uniqueID());
|
||||
GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(fAuditTrail, op, candidate.fOp.get());
|
||||
fRecordedOps[j].fOp = std::move(fRecordedOps[i].fOp);
|
||||
@ -412,13 +405,13 @@ void GrRenderTargetOpList::forwardCombine() {
|
||||
}
|
||||
// Stop going traversing if we would cause a painter's order violation.
|
||||
if (!can_reorder(fRecordedOps[j].fOp->bounds(), op->bounds())) {
|
||||
GrOP_INFO("\t\tForward: Intersects with (%s, opID: %u)\n", candidate.fOp->name(),
|
||||
GrOP_INFO("\t\tIntersects with (%s, B%u)\n", candidate.fOp->name(),
|
||||
candidate.fOp->uniqueID());
|
||||
break;
|
||||
}
|
||||
++j;
|
||||
if (j > maxCandidateIdx) {
|
||||
GrOP_INFO("\t\tForward: Reached max lookahead or end of op array %d\n", i);
|
||||
GrOP_INFO("\t\tReached max lookahead or end of op array %d\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -45,18 +45,12 @@ public:
|
||||
~GrRenderTargetOpList() override;
|
||||
|
||||
void makeClosed() override {
|
||||
if (this->isClosed()) {
|
||||
return;
|
||||
}
|
||||
INHERITED::makeClosed();
|
||||
|
||||
fLastFullClearOp = nullptr;
|
||||
this->forwardCombine();
|
||||
|
||||
INHERITED::makeClosed();
|
||||
}
|
||||
|
||||
bool isEmpty() const { return fRecordedOps.empty(); }
|
||||
|
||||
/**
|
||||
* Empties the draw buffer of any queued up draws.
|
||||
*/
|
||||
|
@ -108,7 +108,7 @@ void GrTextureOpList::recordOp(std::unique_ptr<GrOp> op,
|
||||
SkASSERT(!this->isClosed());
|
||||
|
||||
GR_AUDIT_TRAIL_ADD_OP(fAuditTrail, op.get(), resourceUniqueID, proxyUniqueID);
|
||||
GrOP_INFO("Re-Recording (%s, opID: %u)\n"
|
||||
GrOP_INFO("Re-Recording (%s, B%u)\n"
|
||||
"\tBounds LRTB (%f, %f, %f, %f)\n",
|
||||
op->name(),
|
||||
op->uniqueID(),
|
||||
|
@ -180,7 +180,6 @@ public:
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString str;
|
||||
str.append(INHERITED::dumpInfo());
|
||||
str.appendf("# combined: %d\n", fRectCnt);
|
||||
const RectInfo* info = this->first();
|
||||
for (int i = 0; i < fRectCnt; ++i) {
|
||||
@ -190,6 +189,7 @@ public:
|
||||
info = this->next(info);
|
||||
}
|
||||
str.append(DumpPipelineInfo(*this->pipeline()));
|
||||
str.append(INHERITED::dumpInfo());
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,6 @@ public:
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string;
|
||||
string.append(INHERITED::dumpInfo());
|
||||
string.appendf("rtID: %d proxyID: %d Scissor [",
|
||||
fRenderTarget.get()->uniqueID().asUInt(),
|
||||
fProxyUniqueID.asUInt());
|
||||
@ -66,11 +65,11 @@ public:
|
||||
} else {
|
||||
string.append("disabled");
|
||||
}
|
||||
string.appendf("], Color: 0x%08x\n", fColor);
|
||||
string.appendf("], Color: 0x%08x ", fColor);
|
||||
string.append(INHERITED::dumpInfo());
|
||||
return string;
|
||||
}
|
||||
|
||||
GrColor color() const { return fColor; }
|
||||
void setColor(GrColor color) { fColor = color; }
|
||||
|
||||
private:
|
||||
|
@ -25,13 +25,13 @@ public:
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string;
|
||||
string.append(INHERITED::dumpInfo());
|
||||
string.printf("src: (proxyID: %d, rtID: %d), dst: (proxyID: %d, rtID: %d),\n"
|
||||
"srcRect: [L: %d, T: %d, R: %d, B: %d], dstPt: [X: %d, Y: %d]\n",
|
||||
string.printf("src: (proxyID: %d, rtID: %d), dst: (proxyID: %d, rtID: %d), "
|
||||
"srcRect: [L: %d, T: %d, R: %d, B: %d], dstPt: [X: %d, Y: %d]",
|
||||
fSrcProxyID.asUInt(), fSrc.get()->uniqueID().asUInt(),
|
||||
fDstProxyID.asUInt(), fDst.get()->uniqueID().asUInt(),
|
||||
fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBottom,
|
||||
fDstPoint.fX, fDstPoint.fY);
|
||||
string.append(INHERITED::dumpInfo());
|
||||
return string;
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,9 @@ public:
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string;
|
||||
string.printf("rtID: %d proxyID: %d ", fRenderTarget.get()->uniqueID().asUInt(),
|
||||
fProxyUniqueID.asUInt());
|
||||
string.append(INHERITED::dumpInfo());
|
||||
string.printf("rtID: %d proxyID: %d\n", fRenderTarget.get()->uniqueID().asUInt(),
|
||||
fProxyUniqueID.asUInt());
|
||||
return string;
|
||||
}
|
||||
|
||||
|
@ -119,10 +119,6 @@ public:
|
||||
this->applyPipelineOptimizations(PipelineOptimizations(analysis, overrideColor));
|
||||
}
|
||||
|
||||
void addDependenciesTo(GrRenderTargetProxy* rtp) {
|
||||
fPipeline.addDependenciesTo(rtp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mesh draw ops use a legacy system in GrRenderTargetContext where the pipeline is created when
|
||||
* the op is recorded. These methods are unnecessary as this information is in the pipeline.
|
||||
|
@ -95,7 +95,6 @@ public:
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString str;
|
||||
str.append(INHERITED::dumpInfo());
|
||||
str.appendf("# combined: %d\n", fRects.count());
|
||||
for (int i = 0; i < fRects.count(); ++i) {
|
||||
const RectInfo& info = fRects[i];
|
||||
@ -104,6 +103,7 @@ public:
|
||||
info.fRect.fBottom);
|
||||
}
|
||||
str.append(DumpPipelineInfo(*this->pipeline()));
|
||||
str.append(INHERITED::dumpInfo());
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,6 @@ void GrVkPipelineState::setData(GrVkGpu* gpu,
|
||||
fXferProcessor->setData(fDataManager, pipeline.getXferProcessor(), dstTexture, offset);
|
||||
GrResourceIOProcessor::TextureSampler dstTextureSampler;
|
||||
if (dstTexture) {
|
||||
// MDB TODO: this is the last usage of a GrTexture-based TextureSampler reset method
|
||||
dstTextureSampler.reset(dstTexture);
|
||||
textureBindings.push_back(&dstTextureSampler);
|
||||
}
|
||||
|
@ -76,8 +76,7 @@ static sk_sp<GrTextureProxy> make_deferred(GrContext* context) {
|
||||
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
||||
|
||||
return GrSurfaceProxy::MakeDeferred(context->resourceProvider(), desc,
|
||||
SkBackingFit::kApprox, SkBudgeted::kYes,
|
||||
GrResourceProvider::kNoPendingIO_Flag);
|
||||
SkBackingFit::kApprox, SkBudgeted::kYes);
|
||||
}
|
||||
|
||||
static sk_sp<GrTextureProxy> make_wrapped(GrContext* context) {
|
||||
|
Loading…
Reference in New Issue
Block a user