diff options
author | Robert Phillips <robertphillips@google.com> | 2016-11-04 10:23:43 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-04 15:35:51 +0000 |
commit | ccd3c8937fce4bb28df19533ed043cad209e277d (patch) | |
tree | 2db35e0f6715ee21118d39633c0db10a8c8fb3f6 /src/gpu/GrTexture.cpp | |
parent | 544da7a7c399ab9775d6dbb441a5a695569f9939 (diff) |
Further centralize computation of GrSurface VRAM consumption
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4383
Change-Id: I054b74f2cd15f904f8e05af0fda58d6e8a523eb9
Reviewed-on: https://skia-review.googlesource.com/4383
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrTexture.cpp')
-rw-r--r-- | src/gpu/GrTexture.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp index 91036bc156..de1135a1eb 100644 --- a/src/gpu/GrTexture.cpp +++ b/src/gpu/GrTexture.cpp @@ -35,29 +35,8 @@ void GrTexture::dirtyMipMaps(bool mipMapsDirty) { } } -size_t GrTexture::ComputeSize(const GrSurfaceDesc& desc, bool hasMipMaps) { - size_t textureSize; - - if (GrPixelConfigIsCompressed(desc.fConfig)) { - textureSize = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight); - } else { - textureSize = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig); - } - - if (hasMipMaps) { - // We don't have to worry about the mipmaps being a different size than - // we'd expect because we never change fDesc.fWidth/fHeight. - textureSize += textureSize/3; - } - - SkASSERT(!SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag)); - SkASSERT(textureSize <= WorstCaseSize(desc)); - - return textureSize; -} - size_t GrTexture::onGpuMemorySize() const { - return ComputeSize(fDesc, this->texturePriv().hasMipMaps()); + return GrSurface::ComputeSize(fDesc, 1, this->texturePriv().hasMipMaps()); } void GrTexture::validateDesc() const { |