diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-11-29 22:01:06 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-30 15:37:12 +0000 |
commit | 706a6ff60c55bee85cff06fc9f8f3764f6e5154b (patch) | |
tree | ce416111dc4101cf58ee12bd7c35007317f33819 /src/gpu/GrTextureProxy.cpp | |
parent | de2f1dfebd9d28787cdfd77496f365ed3eb6894d (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/GrTextureProxy.cpp')
-rw-r--r-- | src/gpu/GrTextureProxy.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp index 9afa63f374..9b3dc9cb53 100644 --- a/src/gpu/GrTextureProxy.cpp +++ b/src/gpu/GrTextureProxy.cpp @@ -13,6 +13,7 @@ #include "GrResourceCache.h" #include "GrTexturePriv.h" +// Deferred version GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted, const void* srcData, size_t /*rowBytes*/, uint32_t flags) : INHERITED(srcDesc, fit, budgeted, flags) @@ -23,6 +24,16 @@ GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, S SkASSERT(!srcData); // currently handled in Make() } +// Lazy-callback version +GrTextureProxy::GrTextureProxy(LazyInstantiateCallback&& callback, GrPixelConfig config) + : INHERITED(std::move(callback), config) + , fMipMapped(GrMipMapped::kNo) + , fMipColorMode(SkDestinationSurfaceColorMode::kLegacy) + , fCache(nullptr) + , fDeferredUploader(nullptr) { +} + +// Wrapped version GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin) : INHERITED(std::move(surf), origin, SkBackingFit::kExact) , fMipMapped(fTarget->asTexture()->texturePriv().mipMapped()) @@ -109,8 +120,8 @@ GrSamplerState::Filter GrTextureProxy::highestFilterMode() const { } size_t GrTextureProxy::onUninstantiatedGpuMemorySize() const { - return GrSurface::ComputeSize(fConfig, fWidth, fHeight, 1, this->mipMapped(), - SkBackingFit::kApprox == fFit); + return GrSurface::ComputeSize(this->config(), this->width(), this->height(), 1, + this->mipMapped(), !this->priv().isExact()); } void GrTextureProxy::setUniqueKey(GrResourceCache* cache, const GrUniqueKey& key) { @@ -131,3 +142,10 @@ void GrTextureProxy::clearUniqueKey() { fCache = nullptr; } +#ifdef SK_DEBUG +void GrTextureProxy::validateLazyTexture(const GrTexture* texture) { + SkASSERT(!texture->asRenderTarget()); + SkASSERT(GrMipMapped::kNo == this->mipMapped()); +} +#endif + |