diff options
author | Greg Daniel <egdaniel@google.com> | 2017-10-23 16:05:23 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-23 20:25:59 +0000 |
commit | e252f08982b0c747cd4d34c00ce413ab1005e99a (patch) | |
tree | 1fde0a4ac30cf4dc1fc752ef39fc2a0b905be210 /src/gpu/GrTextureProxy.cpp | |
parent | 33397f279393a33eff8e32d47fc56be86b86c9bc (diff) |
Add hint to SkSurface::MakeRenderTarget that we will use mips
Additionally this changed triggered a cascade of plumbing GrMipMapped
down throughout Ganesh.
Bug: skia:
Change-Id: I4181f44d9046d66139bb491c7abf86703305aaeb
Reviewed-on: https://skia-review.googlesource.com/63000
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrTextureProxy.cpp')
-rw-r--r-- | src/gpu/GrTextureProxy.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp index 534adaa709..4617285b1c 100644 --- a/src/gpu/GrTextureProxy.cpp +++ b/src/gpu/GrTextureProxy.cpp @@ -16,7 +16,7 @@ GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted, const void* srcData, size_t /*rowBytes*/, uint32_t flags) : INHERITED(srcDesc, fit, budgeted, flags) - , fIsMipMapped(false) + , fMipMapped(GrMipMapped::kNo) , fMipColorMode(SkDestinationSurfaceColorMode::kLegacy) , fCache(nullptr) , fDeferredUploader(nullptr) { @@ -25,7 +25,7 @@ GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, S GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin) : INHERITED(std::move(surf), origin, SkBackingFit::kExact) - , fIsMipMapped(fTarget->asTexture()->texturePriv().hasMipMaps()) + , fMipMapped(fTarget->asTexture()->texturePriv().mipMapped()) , fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode()) , fCache(nullptr) , fDeferredUploader(nullptr) { @@ -48,11 +48,12 @@ GrTextureProxy::~GrTextureProxy() { bool GrTextureProxy::instantiate(GrResourceProvider* resourceProvider) { if (!this->instantiateImpl(resourceProvider, 0, /* needsStencil = */ false, - kNone_GrSurfaceFlags, fIsMipMapped, fMipColorMode, + kNone_GrSurfaceFlags, fMipMapped, fMipColorMode, fUniqueKey.isValid() ? &fUniqueKey : nullptr)) { return false; } + SkASSERT(!fTarget->asRenderTarget()); SkASSERT(fTarget->asTexture()); return true; } @@ -61,11 +62,12 @@ sk_sp<GrSurface> GrTextureProxy::createSurface(GrResourceProvider* resourceProvi sk_sp<GrSurface> surface= this->createSurfaceImpl(resourceProvider, 0, /* needsStencil = */ false, kNone_GrSurfaceFlags, - fIsMipMapped, fMipColorMode); + fMipMapped, fMipColorMode); if (!surface) { return nullptr; } + SkASSERT(!surface->asRenderTarget()); SkASSERT(surface->asTexture()); return surface; } @@ -107,10 +109,9 @@ GrSamplerState::Filter GrTextureProxy::highestFilterMode() const { } size_t GrTextureProxy::onUninstantiatedGpuMemorySize() const { - static const bool kHasMipMaps = true; // TODO: add tracking of mipmap state to improve the estimate. We track whether we are created // with mip maps but not whether a texture read from the proxy will lazily generate mip maps. - return GrSurface::ComputeSize(fConfig, fWidth, fHeight, 1, kHasMipMaps, + return GrSurface::ComputeSize(fConfig, fWidth, fHeight, 1, GrMipMapped::kYes, SkBackingFit::kApprox == fFit); } |