aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTexture.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-11-07 08:23:48 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-07 14:34:47 +0000
commitd6214d4f4664ce47861dc690b0ddbea3b7a07855 (patch)
treebf32d321ac4395222b9ce5e878618757513cb217 /src/gpu/GrTexture.cpp
parent44b36a210462dbc8c62bf705d002dbba591c8e7f (diff)
Further centralize computation of GrSurface VRAM consumption - take 2
This is the same as https://skia-review.googlesource.com/c/4383/ (Further centralize computation of GrSurface VRAM consumption) but with a suppression for Vulkan in the new test and removal of an assert Chromium was triggering. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4450 Change-Id: Ie87d32fd5f0d35c21326b066a0c733cb6f8a5bea Reviewed-on: https://skia-review.googlesource.com/4450 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrTexture.cpp')
-rw-r--r--src/gpu/GrTexture.cpp23
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 {