diff options
author | Brian Salomon <bsalomon@google.com> | 2016-11-30 10:52:10 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-30 22:11:50 +0000 |
commit | 3a7492fc04d83ed2729d2ba226d5277459536b74 (patch) | |
tree | eea42a61e2ea132e3880614ec5633c884054da4d | |
parent | fa565847fe0eb8c931f9dfc7ee08b295ac5db3b2 (diff) |
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>
-rw-r--r-- | src/gpu/GrRenderTargetOpList.cpp | 8 | ||||
-rw-r--r-- | src/gpu/batches/GrBatch.h | 4 | ||||
-rw-r--r-- | src/gpu/batches/GrClearBatch.h | 4 | ||||
-rw-r--r-- | src/gpu/batches/GrClearStencilClipBatch.h | 1 | ||||
-rw-r--r-- | src/gpu/batches/GrCopySurfaceBatch.h | 13 | ||||
-rw-r--r-- | src/gpu/batches/GrDiscardBatch.h | 1 | ||||
-rw-r--r-- | src/gpu/batches/GrDrawBatch.h | 5 | ||||
-rw-r--r-- | src/gpu/batches/GrStencilPathBatch.h | 1 |
8 files changed, 11 insertions, 26 deletions
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index 40c543d361..7b16a55c9d 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -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 }; diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h index ec81ec9bc0..e4065ecace 100644 --- a/src/gpu/batches/GrBatch.h +++ b/src/gpu/batches/GrBatch.h @@ -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 diff --git a/src/gpu/batches/GrClearBatch.h b/src/gpu/batches/GrClearBatch.h index 724981e658..24905d3648 100644 --- a/src/gpu/batches/GrClearBatch.h +++ b/src/gpu/batches/GrClearBatch.h @@ -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 ["); diff --git a/src/gpu/batches/GrClearStencilClipBatch.h b/src/gpu/batches/GrClearStencilClipBatch.h index 7f69f64c16..0f2617355d 100644 --- a/src/gpu/batches/GrClearStencilClipBatch.h +++ b/src/gpu/batches/GrClearStencilClipBatch.h @@ -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 ["); diff --git a/src/gpu/batches/GrCopySurfaceBatch.h b/src/gpu/batches/GrCopySurfaceBatch.h index a014ccb147..3d9fc78ac3 100644 --- a/src/gpu/batches/GrCopySurfaceBatch.h +++ b/src/gpu/batches/GrCopySurfaceBatch.h @@ -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); } } diff --git a/src/gpu/batches/GrDiscardBatch.h b/src/gpu/batches/GrDiscardBatch.h index 799c7462cb..d2ebb4662b 100644 --- a/src/gpu/batches/GrDiscardBatch.h +++ b/src/gpu/batches/GrDiscardBatch.h @@ -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; diff --git a/src/gpu/batches/GrDrawBatch.h b/src/gpu/batches/GrDrawBatch.h index af1de0dc77..95516c9363 100644 --- a/src/gpu/batches/GrDrawBatch.h +++ b/src/gpu/batches/GrDrawBatch.h @@ -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()); diff --git a/src/gpu/batches/GrStencilPathBatch.h b/src/gpu/batches/GrStencilPathBatch.h index 3a6f82d8a1..b95c75a5ce 100644 --- a/src/gpu/batches/GrStencilPathBatch.h +++ b/src/gpu/batches/GrStencilPathBatch.h @@ -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; |