Index: src/gpu/GrTexture.cpp |
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp |
index 8651d1090ec96529f08d19008f7eb8ae008e8fa7..0f59bff4495dce793a48cc19dd68915e140350dc 100644 |
--- a/src/gpu/GrTexture.cpp |
+++ b/src/gpu/GrTexture.cpp |
@@ -62,6 +62,25 @@ size_t GrTexture::gpuMemorySize() const { |
size_t textureSize = (size_t) fDesc.fWidth * |
fDesc.fHeight * |
GrBytesPerPixel(fDesc.fConfig); |
+ |
+ if (GrPixelConfigIsCompressed(fDesc.fConfig)) { |
robertphillips
2014/05/29 20:08:43
Do we need some assert about no mipmaps in here?
krajcevski
2014/05/29 20:31:28
I don't think so, since the texture can be both co
bsalomon
2014/05/29 20:38:20
Oh yes, we lazily compute mipmaps for bitmap-textu
|
+ // Figure out the width and height corresponding to the data... |
+ |
+ // Both of the available formats (ETC1 and LATC) have 4x4 |
+ // blocks that compress down to 8 bytes. |
+ switch(fDesc.fConfig) { |
+ case kETC1_GrPixelConfig: |
+ case kLATC_GrPixelConfig: |
+ SkASSERT((fDesc.fWidth & 3) == 0); |
+ SkASSERT((fDesc.fHeight & 3) == 0); |
+ textureSize = (fDesc.fWidth >> 2) * (fDesc.fHeight >> 2) * 8; |
+ break; |
+ |
+ default: |
robertphillips
2014/05/29 20:08:43
comrpessed ?
krajcevski
2014/05/29 20:31:28
The if statement checks that the config is compres
|
+ SkFAIL("Unknown comrpessed format"); |
+ } |
+ } |
+ |
if (this->impl()->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. |