diff options
author | 2017-05-15 14:56:51 -0400 | |
---|---|---|
committer | 2017-05-17 12:17:03 +0000 | |
commit | 87f7f1c3ce519115141b40f1d8faede437c8f357 (patch) | |
tree | e35d12c8ae40e0192e8af889ca848d3c5f60eed9 /src/gpu/GrRenderTargetContext.cpp | |
parent | 1314918f903f0a1b40c2695f2b27737e9a8b443a (diff) |
Convert DstTexture to DstProxy
The last GrTexture-based TextureSampler::reset call must be removed before the TextureSamplers can become purely GrTextureProxy-backed
Split out of: https://skia-review.googlesource.com/c/10484/ (Omnibus: Push instantiation of GrTextures later (post TextureSampler))
Change-Id: Ic1435177d8b5d9bd3fc38b4903c9baae8205cfb0
Reviewed-on: https://skia-review.googlesource.com/16908
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r-- | src/gpu/GrRenderTargetContext.cpp | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 0076812845..1c92d37316 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -1598,15 +1598,15 @@ uint32_t GrRenderTargetContext::addDrawOp(const GrClip& clip, std::unique_ptr<Gr } } - GrXferProcessor::DstTexture dstTexture; + GrXferProcessor::DstProxy dstProxy; if (op->xpRequiresDstTexture(*this->caps(), &appliedClip)) { - if (!this->setupDstTexture(fRenderTargetProxy.get(), clip, op->bounds(), &dstTexture)) { + if (!this->setupDstProxy(this->asRenderTargetProxy(), clip, op->bounds(), &dstProxy)) { return SK_InvalidUniqueID; } } op->setClippedBounds(bounds); - return this->getOpList()->addOp(std::move(op), this, std::move(appliedClip), dstTexture); + return this->getOpList()->addOp(std::move(op), this, std::move(appliedClip), dstProxy); } uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipelineBuilder, @@ -1656,9 +1656,10 @@ uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipeline args.fAppliedClip = &appliedClip; args.fRenderTarget = rt; args.fCaps = this->caps(); + args.fResourceProvider = fContext->resourceProvider(); if (analysis.requiresDstTexture()) { - if (!this->setupDstTexture(fRenderTargetProxy.get(), clip, bounds, &args.fDstTexture)) { + if (!this->setupDstProxy(this->asRenderTargetProxy(), clip, bounds, &args.fDstProxy)) { return SK_InvalidUniqueID; } } @@ -1671,22 +1672,15 @@ uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipeline return this->getOpList()->addOp(std::move(op), this); } -bool GrRenderTargetContext::setupDstTexture(GrRenderTargetProxy* rtProxy, const GrClip& clip, +bool GrRenderTargetContext::setupDstProxy(GrRenderTargetProxy* rtProxy, const GrClip& clip, const SkRect& opBounds, - GrXferProcessor::DstTexture* dstTexture) { + GrXferProcessor::DstProxy* dstProxy) { if (this->caps()->textureBarrierSupport()) { if (GrTextureProxy* texProxy = rtProxy->asTextureProxy()) { - // MDB TODO: remove this instantiation. Blocked on making DstTexture be proxy-based - sk_sp<GrTexture> tex(sk_ref_sp(texProxy->instantiate(fContext->resourceProvider()))); - if (!tex) { - SkDebugf("setupDstTexture: instantiation of src texture failed.\n"); - return false; // We have bigger problems now - } - // The render target is a texture, so we can read from it directly in the shader. The XP // will be responsible to detect this situation and request a texture barrier. - dstTexture->setTexture(std::move(tex)); - dstTexture->setOffset(0, 0); + dstProxy->setProxy(sk_ref_sp(texProxy)); + dstProxy->setOffset(0, 0); return true; } } @@ -1752,15 +1746,7 @@ bool GrRenderTargetContext::setupDstTexture(GrRenderTargetProxy* rtProxy, const return false; } - GrTextureProxy* copyProxy = sContext->asTextureProxy(); - // MDB TODO: remove this instantiation once DstTexture is proxy-backed - sk_sp<GrTexture> copy(sk_ref_sp(copyProxy->instantiate(fContext->resourceProvider()))); - if (!copy) { - SkDebugf("setupDstTexture: instantiation of copied texture failed.\n"); - return false; - } - - dstTexture->setTexture(std::move(copy)); - dstTexture->setOffset(dstOffset); + dstProxy->setProxy(sContext->asTextureProxyRef()); + dstProxy->setOffset(dstOffset); return true; } |