Remove GrBatch::renderTarget() and use GrBatch::renderTargetUniqueID() instead.
Change-Id: I621ed38955e374c79a4d44c0020f9bae9655f001 Reviewed-on: https://skia-review.googlesource.com/5344 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
fa565847fe
commit
3a7492fc04
@ -186,20 +186,20 @@ bool GrRenderTargetOpList::drawBatches(GrBatchFlushState* flushState) {
|
||||
}
|
||||
// Draw all the generated geometry.
|
||||
SkRandom random;
|
||||
GrRenderTarget* currentRT = nullptr;
|
||||
GrGpuResource::UniqueID currentRTID = GrGpuResource::UniqueID::InvalidID();
|
||||
std::unique_ptr<GrGpuCommandBuffer> commandBuffer;
|
||||
for (int i = 0; i < fRecordedBatches.count(); ++i) {
|
||||
if (!fRecordedBatches[i].fBatch) {
|
||||
continue;
|
||||
}
|
||||
if (fRecordedBatches[i].fBatch->renderTarget() != currentRT) {
|
||||
if (fRecordedBatches[i].fBatch->renderTargetUniqueID() != currentRTID) {
|
||||
if (commandBuffer) {
|
||||
commandBuffer->end();
|
||||
commandBuffer->submit();
|
||||
commandBuffer.reset();
|
||||
}
|
||||
currentRT = fRecordedBatches[i].fBatch->renderTarget();
|
||||
if (currentRT) {
|
||||
currentRTID = fRecordedBatches[i].fBatch->renderTargetUniqueID();
|
||||
if (!currentRTID.isInvalid()) {
|
||||
static const GrGpuCommandBuffer::LoadAndStoreInfo kBasicLoadStoreInfo
|
||||
{ GrGpuCommandBuffer::LoadOp::kLoad,GrGpuCommandBuffer::StoreOp::kStore,
|
||||
GrColor_ILLEGAL };
|
||||
|
@ -20,7 +20,6 @@
|
||||
class GrCaps;
|
||||
class GrGpuCommandBuffer;
|
||||
class GrBatchFlushState;
|
||||
class GrRenderTarget;
|
||||
|
||||
/**
|
||||
* GrBatch is the base class for all Ganesh deferred geometry generators. To facilitate
|
||||
@ -141,9 +140,6 @@ public:
|
||||
return string;
|
||||
}
|
||||
|
||||
/** Can remove this when multi-draw-buffer lands */
|
||||
virtual GrRenderTarget* renderTarget() const = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Indicates that the batch will produce geometry that extends beyond its bounds for the
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
static sk_sp<GrClearBatch> Make(const GrFixedClip& clip, GrColor color, GrRenderTarget* rt) {
|
||||
sk_sp<GrClearBatch> batch(new GrClearBatch(clip, color, rt));
|
||||
if (!batch->renderTarget()) {
|
||||
if (!batch->fRenderTarget) {
|
||||
return nullptr; // The clip did not contain any pixels within the render target.
|
||||
}
|
||||
return batch;
|
||||
@ -33,8 +33,6 @@ public:
|
||||
GrGpuResource::UniqueID renderTargetUniqueID() const override {
|
||||
return fRenderTarget.get()->uniqueID();
|
||||
}
|
||||
// TODO: store a GrRenderTargetContext instead
|
||||
GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string("Scissor [");
|
||||
|
@ -35,7 +35,6 @@ public:
|
||||
GrGpuResource::UniqueID renderTargetUniqueID() const override {
|
||||
return fRenderTarget.get()->uniqueID();
|
||||
}
|
||||
GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string("Scissor [");
|
||||
|
@ -34,13 +34,11 @@ public:
|
||||
|
||||
// TODO: this needs to be updated to return GrSurfaceProxy::UniqueID
|
||||
GrGpuResource::UniqueID renderTargetUniqueID() const override {
|
||||
// TODO: When we have CopyContexts it seems that this should return the ID
|
||||
// of the SurfaceProxy underlying the CopyContext.
|
||||
GrRenderTarget* rt = fDst.get()->asRenderTarget();
|
||||
return rt ? rt->uniqueID() : GrGpuResource::UniqueID::InvalidID();
|
||||
// Copy surface doesn't work through a GrGpuCommandBuffer. By returning an invalid RT ID we
|
||||
// force the caller to end the previous command buffer and execute this copy before
|
||||
// beginning a new one.
|
||||
return GrGpuResource::UniqueID::InvalidID();
|
||||
}
|
||||
// TODO: this seems odd - figure it out and add a comment!
|
||||
GrRenderTarget* renderTarget() const override { return nullptr; }
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string;
|
||||
@ -74,7 +72,8 @@ private:
|
||||
if (!state->commandBuffer()) {
|
||||
state->gpu()->copySurface(fDst.get(), fSrc.get(), fSrcRect, fDstPoint);
|
||||
} else {
|
||||
// currently we are not sending copies through the GrGpuCommandBuffer
|
||||
// Currently we are not sending copies through the GrGpuCommandBuffer. See comment in
|
||||
// renderTargetUniqueID().
|
||||
SkASSERT(false);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public:
|
||||
GrGpuResource::UniqueID renderTargetUniqueID() const override {
|
||||
return fRenderTarget.get()->uniqueID();
|
||||
}
|
||||
GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string;
|
||||
|
@ -75,11 +75,6 @@ public:
|
||||
return this->pipeline()->getRenderTarget()->uniqueID();
|
||||
}
|
||||
|
||||
// TODO: store a GrRenderTargetContext instead
|
||||
GrRenderTarget* renderTarget() const final {
|
||||
return this->pipeline()->getRenderTarget();
|
||||
}
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string;
|
||||
string.appendf("RT: %d\n", this->renderTargetUniqueID().asUInt());
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
GrGpuResource::UniqueID renderTargetUniqueID() const override {
|
||||
return fRenderTarget.get()->uniqueID();
|
||||
}
|
||||
GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
|
||||
|
||||
SkString dumpInfo() const override {
|
||||
SkString string;
|
||||
|
Loading…
Reference in New Issue
Block a user