}
// 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 };
class GrCaps;
class GrGpuCommandBuffer;
class GrBatchFlushState;
-class GrRenderTarget;
/**
* GrBatch is the base class for all Ganesh deferred geometry generators. To facilitate
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
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;
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 [");
GrGpuResource::UniqueID renderTargetUniqueID() const override {
return fRenderTarget.get()->uniqueID();
}
- GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
SkString dumpInfo() const override {
SkString string("Scissor [");
// 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;
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);
}
}
GrGpuResource::UniqueID renderTargetUniqueID() const override {
return fRenderTarget.get()->uniqueID();
}
- GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
SkString dumpInfo() const override {
SkString string;
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());
GrGpuResource::UniqueID renderTargetUniqueID() const override {
return fRenderTarget.get()->uniqueID();
}
- GrRenderTarget* renderTarget() const override { return fRenderTarget.get(); }
SkString dumpInfo() const override {
SkString string;