aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRenderTargetProxy.cpp
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-11-29 22:01:06 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-30 15:37:12 +0000
commit706a6ff60c55bee85cff06fc9f8f3764f6e5154b (patch)
treece416111dc4101cf58ee12bd7c35007317f33819 /src/gpu/GrRenderTargetProxy.cpp
parentde2f1dfebd9d28787cdfd77496f365ed3eb6894d (diff)
Add "lazy" texture proxies
Adds ultra-deferred proxies that are instantiated by a user-supplied callback during flush. Bug: skia:7190 Change-Id: I75a7ac6dba953c3b0a99febc203a7f4d2f3789fc Reviewed-on: https://skia-review.googlesource.com/76461 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetProxy.cpp')
-rw-r--r--src/gpu/GrRenderTargetProxy.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 9453ce8204..dea47e6b5c 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -34,12 +34,20 @@ GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc
}
}
+// Lazy-callback version
+GrRenderTargetProxy::GrRenderTargetProxy(LazyInstantiateCallback&& callback, GrPixelConfig config)
+ : INHERITED(std::move(callback), config)
+ , fSampleCnt(0)
+ , fNeedsStencil(false)
+ , fRenderTargetFlags(GrRenderTargetFlags::kNone) {
+}
+
// Wrapped version
GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin)
- : INHERITED(std::move(surf), origin, SkBackingFit::kExact)
- , fSampleCnt(fTarget->asRenderTarget()->numStencilSamples())
- , fNeedsStencil(false)
- , fRenderTargetFlags(fTarget->asRenderTarget()->renderTargetPriv().flags()) {
+ : INHERITED(std::move(surf), origin, SkBackingFit::kExact)
+ , fSampleCnt(fTarget->asRenderTarget()->numStencilSamples())
+ , fNeedsStencil(false)
+ , fRenderTargetFlags(fTarget->asRenderTarget()->renderTargetPriv().flags()) {
}
int GrRenderTargetProxy::maxWindowRectangles(const GrCaps& caps) const {
@@ -85,8 +93,8 @@ size_t GrRenderTargetProxy::onUninstantiatedGpuMemorySize() const {
int colorSamplesPerPixel = this->numColorSamples() + 1;
// TODO: do we have enough information to improve this worst case estimate?
- return GrSurface::ComputeSize(fConfig, fWidth, fHeight, colorSamplesPerPixel, GrMipMapped::kNo,
- SkBackingFit::kApprox == fFit);
+ return GrSurface::ComputeSize(this->config(), this->width(), this->height(),
+ colorSamplesPerPixel, GrMipMapped::kNo, !this->priv().isExact());
}
bool GrRenderTargetProxy::refsWrappedObjects() const {