TextureCache::TextureCache() : mCache(LruCache<uint32_t, Texture*>::kUnlimitedCapacity) , mSize(0) , mMaxSize(MB(DEFAULT_TEXTURE_CACHE_SIZE)) , mFlushRate(DEFAULT_TEXTURE_CACHE_FLUSH_RATE) , mAssetAtlas(nullptr) { char property[PROPERTY_VALUE_MAX]; if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, nullptr) > 0) { INIT_LOGD(" Setting texture cache size to %sMB", property); setMaxSize(MB(atof(property))); } else { INIT_LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE); } if (property_get(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, property, nullptr) > 0) { float flushRate = atof(property); INIT_LOGD(" Setting texture cache flush rate to %.2f%%", flushRate * 100.0f); setFlushRate(flushRate); } else { INIT_LOGD(" Using default texture cache flush rate of %.2f%%", DEFAULT_TEXTURE_CACHE_FLUSH_RATE * 100.0f); } mCache.setOnEntryRemovedListener(this); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); INIT_LOGD(" Maximum texture dimension is %d pixels", mMaxTextureSize); mDebugEnabled = Properties::debugLevel & kDebugCaches; }
TextureCache::TextureCache(): mCache(LruCache<const SkPixelRef*, Texture*>::kUnlimitedCapacity), mSize(0), mMaxSize(MB(DEFAULT_TEXTURE_CACHE_SIZE)), mFlushRate(DEFAULT_TEXTURE_CACHE_FLUSH_RATE) { bool setSizeByProperty = false; char property[PROPERTY_VALUE_MAX]; if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, NULL) > 0) { INIT_LOGD(" Setting texture cache size to %sMB", property); setMaxSize(MB(atof(property))); setSizeByProperty = true; } else { INIT_LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE); } if (property_get(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, property, NULL) > 0) { float flushRate = atof(property); INIT_LOGD(" Setting texture cache flush rate to %.2f%%", flushRate * 100.0f); setFlushRate(flushRate); } else { INIT_LOGD(" Using default texture cache flush rate of %.2f%%", DEFAULT_TEXTURE_CACHE_FLUSH_RATE * 100.0f); } /// M: Expand texture cache size for project with large resolution. if (!setSizeByProperty) { if (DEFAULT_TEXTURE_CACHE_SCREEN_BASED_SIZE > DEFAULT_TEXTURE_CACHE_SIZE) { INIT_LOGD(" Setting texture cache size to %.2fMB by screen based size", DEFAULT_TEXTURE_CACHE_SCREEN_BASED_SIZE); setMaxSize(MB(DEFAULT_TEXTURE_CACHE_SCREEN_BASED_SIZE)); } } init(); }
TextureCache::TextureCache(): mCache(GenerationCache<SkBitmap*, Texture*>::kUnlimitedCapacity), mSize(0), mMaxSize(MB(DEFAULT_TEXTURE_CACHE_SIZE)), mFlushRate(DEFAULT_TEXTURE_CACHE_FLUSH_RATE) { char property[PROPERTY_VALUE_MAX]; if (property_get(PROPERTY_TEXTURE_CACHE_SIZE, property, NULL) > 0) { INIT_LOGD(" Setting texture cache size to %sMB", property); setMaxSize(MB(atof(property))); } else { INIT_LOGD(" Using default texture cache size of %.2fMB", DEFAULT_TEXTURE_CACHE_SIZE); } if (property_get(PROPERTY_TEXTURE_CACHE_FLUSH_RATE, property, NULL) > 0) { float flushRate = atof(property); INIT_LOGD(" Setting texture cache flush rate to %.2f%%", flushRate * 100.0f); setFlushRate(flushRate); } else { INIT_LOGD(" Using default texture cache flush rate of %.2f%%", DEFAULT_TEXTURE_CACHE_FLUSH_RATE * 100.0f); } init(); }