diff options
author | Robert Phillips <robertphillips@google.com> | 2017-03-08 11:50:55 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-08 17:33:41 +0000 |
commit | c01389271162d08303088732c30f419807f25d33 (patch) | |
tree | 524961ad9fb62471cac8853bc16cb1f60d276303 /src/gpu/GrRenderTargetContext.cpp | |
parent | fd171ede0c97dd93871a27fcba548750ff73093b (diff) |
Add a unique ID to GrOpLists and return it from GrRenderTargetContext::addDrawOp
This is to support the preFlush callbacks
Change-Id: I8513ea08b6516681566eceafa789b2ee7925ebce
Reviewed-on: https://skia-review.googlesource.com/9199
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index bae2ea6307..1d891df6b0 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -1673,10 +1673,13 @@ static void op_bounds(SkRect* bounds, const GrOp* op) { } } -void GrRenderTargetContext::addDrawOp(const GrPipelineBuilder& pipelineBuilder, const GrClip& clip, - std::unique_ptr<GrDrawOp> op) { +uint32_t GrRenderTargetContext::addDrawOp(const GrPipelineBuilder& pipelineBuilder, + const GrClip& clip, + std::unique_ptr<GrDrawOp> op) { ASSERT_SINGLE_OWNER - RETURN_IF_ABANDONED + if (this->drawingManager()->wasAbandoned()) { + return SK_InvalidUniqueID; + } SkDEBUGCODE(this->validate();) GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::addDrawOp"); @@ -1686,21 +1689,21 @@ void GrRenderTargetContext::addDrawOp(const GrPipelineBuilder& pipelineBuilder, GrAppliedClip appliedClip(bounds); if (!clip.apply(fContext, this, pipelineBuilder.isHWAntialias(), pipelineBuilder.hasUserStencilSettings(), &appliedClip)) { - return; + return SK_InvalidUniqueID; } // This forces instantiation of the render target. Pipeline creation is moving to flush time // by which point instantiation must have occurred anyway. GrRenderTarget* rt = this->accessRenderTarget(); if (!rt) { - return; + return SK_InvalidUniqueID; } GrResourceProvider* resourceProvider = fContext->resourceProvider(); if (pipelineBuilder.hasUserStencilSettings() || appliedClip.hasStencilClip()) { if (!resourceProvider->attachStencilAttachment(this->accessRenderTarget())) { SkDebugf("ERROR creating stencil attachment. Draw skipped.\n"); - return; + return SK_InvalidUniqueID; } } @@ -1717,13 +1720,13 @@ void GrRenderTargetContext::addDrawOp(const GrPipelineBuilder& pipelineBuilder, if (pipelineBuilder.willXPNeedDstTexture(*this->caps(), analysis)) { this->setupDstTexture(rt, clip, bounds, &args.fDstTexture); if (!args.fDstTexture.texture()) { - return; + return SK_InvalidUniqueID; } } op->initPipeline(args); // TODO: We need to add pipeline dependencies on textures, etc before recording this op. op->setClippedBounds(appliedClip.clippedDrawBounds()); - this->getOpList()->addOp(std::move(op), this); + return this->getOpList()->addOp(std::move(op), this); } void GrRenderTargetContext::setupDstTexture(GrRenderTarget* rt, const GrClip& clip, |