aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRenderTargetContext.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-05-29 15:05:15 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-29 19:26:26 +0000
commitbb581ce30f55360fd3a12e7f5aa1fe324b16d085 (patch)
tree6ca8902e7c72278a3e796c9b3c2d3de02aa620b2 /src/gpu/GrRenderTargetContext.cpp
parent9bee2e5894bb8dd374392f238bc429e16f239583 (diff)
Convert DstTexture to DstProxy (take 2)
The last GrTexture-based TextureSampler::reset call must be removed before the TextureSamplers can become purely GrTextureProxy-backed Reland of: https://skia-review.googlesource.com/c/16908/ (Convert DstTexture to DstProxy) Split out of: https://skia-review.googlesource.com/c/10484/ (Omnibus: Push instantiation of GrTextures later (post TextureSampler)) Change-Id: I3a497b6a950fad899f23882c0a9552894ef640f8 Reviewed-on: https://skia-review.googlesource.com/17205 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetContext.cpp')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index deec8c792a..b05be0bd64 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1740,15 +1740,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,
@@ -1801,7 +1801,7 @@ uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipeline
args.fResourceProvider = this->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;
}
}
@@ -1814,23 +1814,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->instantiateTexture(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;
}
}
@@ -1896,15 +1888,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->instantiateTexture(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;
}