diff options
author | Colin Snover | 2016-02-17 18:47:28 -0600 |
---|---|---|
committer | Colin Snover | 2016-02-18 13:18:03 -0600 |
commit | 2f17ba2b0ab77ef939c21efa04f7aaafccbd0c37 (patch) | |
tree | 0ed66bb208dca3a30c64f5b4278695b188063f5d /engines/sci/resource.cpp | |
parent | bb8235063087f5e760b900c32aece5fec614598f (diff) | |
download | scummvm-rg350-2f17ba2b0ab77ef939c21efa04f7aaafccbd0c37.tar.gz scummvm-rg350-2f17ba2b0ab77ef939c21efa04f7aaafccbd0c37.tar.bz2 scummvm-rg350-2f17ba2b0ab77ef939c21efa04f7aaafccbd0c37.zip |
SCI: Increase LRU resource cache for SCI32 games
A single picture in SCI32 is often larger than the 256KiB limit,
meaning that the cache is useless for these games -- which is bad,
because the renderer works directly off raw resource data so it
must be decompressed and in-cache for rendering performance to be
acceptable.
Diffstat (limited to 'engines/sci/resource.cpp')
-rw-r--r-- | engines/sci/resource.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 92d35ba1fc..86c5f52455 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -865,6 +865,7 @@ ResourceManager::ResourceManager() { } void ResourceManager::init() { + _maxMemoryLRU = 256 * 1024; // 256KiB _memoryLocked = 0; _memoryLRU = 0; _LRU.clear(); @@ -918,6 +919,14 @@ void ResourceManager::init() { debugC(1, kDebugLevelResMan, "resMan: Detected %s", getSciVersionDesc(getSciVersion())); + // Resources in SCI32 games are significantly larger than SCI16 + // games and can cause immediate exhaustion of the LRU resource + // cache, leading to constant decompression of picture resources + // and making the renderer very slow. + if (getSciVersion() >= SCI_VERSION_2) { + _maxMemoryLRU = 2048 * 1024; // 2MiB + } + switch (_viewType) { case kViewEga: debugC(1, kDebugLevelResMan, "resMan: Detected EGA graphic resources"); @@ -1023,7 +1032,7 @@ void ResourceManager::printLRU() { } void ResourceManager::freeOldResources() { - while (MAX_MEMORY < _memoryLRU) { + while (_maxMemoryLRU < _memoryLRU) { assert(!_LRU.empty()); Resource *goner = *_LRU.reverse_begin(); removeFromLRU(goner); |