Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: src/gpu/GrTexture.cpp

Issue 304743004: Move ETC1 and LATC enums value to GrPixelConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Only generate mipmaps for uncompressed textures. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawTargetCaps.h ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTexture.cpp
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 8651d1090ec96529f08d19008f7eb8ae008e8fa7..20cd597fc4b034d2c0a459fdcf682976e94a92ac 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)) {
+ // 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:
+ SkFAIL("Unknown compressed config");
+ }
+ }
+
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.
« no previous file with comments | « src/gpu/GrDrawTargetCaps.h ('k') | src/gpu/gl/GrGLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698