summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Zinnschlag <marc@zpages.de>2013-02-11 19:43:50 +0100
committerMarc Zinnschlag <marc@zpages.de>2013-02-11 19:43:50 +0100
commit04001717e7b6b7bf9dddaa05d45efc04a6a1508c (patch)
treee735802323bfac4314ebb7df6cbb38014b649aa7
parent959accc4d5f63da0f510b97daba2551b5892e735 (diff)
parent62c711d709d9c3bf314b97bd31b198f3768255e9 (diff)
Merge remote-tracking branch 'scrawl/master'openmw-0.21.0
-rw-r--r--extern/shiny/Main/Factory.cpp18
-rw-r--r--extern/shiny/Main/Factory.hpp5
2 files changed, 15 insertions, 8 deletions
diff --git a/extern/shiny/Main/Factory.cpp b/extern/shiny/Main/Factory.cpp
index 21f13e30b6..40c695fd4a 100644
--- a/extern/shiny/Main/Factory.cpp
+++ b/extern/shiny/Main/Factory.cpp
@@ -15,6 +15,7 @@
namespace sh
{
Factory* Factory::sThis = 0;
+ const std::string Factory::mBinaryCacheName = "binaryCache";
Factory& Factory::getInstance()
{
@@ -198,16 +199,16 @@ namespace sh
if (mShadersLastModified[sourceRelative] != lastModified)
{
// delete any outdated shaders based on this shader set
- removeCache (it->first);
- // remove the whole binary cache (removing only the individual shaders does not seem to be possible at this point with OGRE)
- removeBinaryCache = true;
+ if (removeCache (it->first))
+ removeBinaryCache = true;
}
}
else
{
// if we get here, this is either the first run or a new shader file was added
// in both cases we can safely delete
- removeCache (it->first);
+ if (removeCache (it->first))
+ removeBinaryCache = true;
}
mShaderSets.insert(std::make_pair(it->first, newSet));
}
@@ -304,7 +305,7 @@ namespace sh
if (mPlatform->supportsShaderSerialization () && mReadMicrocodeCache && !removeBinaryCache)
{
- std::string file = mPlatform->getCacheFolder () + "/shShaderCache.txt";
+ std::string file = mPlatform->getCacheFolder () + "/" + mBinaryCacheName;
if (boost::filesystem::exists(file))
{
mPlatform->deserializeShaders (file);
@@ -316,7 +317,7 @@ namespace sh
{
if (mPlatform->supportsShaderSerialization () && mWriteMicrocodeCache)
{
- std::string file = mPlatform->getCacheFolder () + "/shShaderCache.txt";
+ std::string file = mPlatform->getCacheFolder () + "/" + mBinaryCacheName;
mPlatform->serializeShaders (file);
}
@@ -590,8 +591,9 @@ namespace sh
m->createForConfiguration (configuration, 0);
}
- void Factory::removeCache(const std::string& pattern)
+ bool Factory::removeCache(const std::string& pattern)
{
+ bool ret = false;
if ( boost::filesystem::exists(mPlatform->getCacheFolder())
&& boost::filesystem::is_directory(mPlatform->getCacheFolder()))
{
@@ -620,10 +622,12 @@ namespace sh
if (shaderName == pattern)
{
boost::filesystem::remove(file);
+ ret = true;
std::cout << "Removing outdated shader: " << file << std::endl;
}
}
}
}
+ return ret;
}
}
diff --git a/extern/shiny/Main/Factory.hpp b/extern/shiny/Main/Factory.hpp
index 6d4175c976..846860b89a 100644
--- a/extern/shiny/Main/Factory.hpp
+++ b/extern/shiny/Main/Factory.hpp
@@ -203,7 +203,10 @@ namespace sh
MaterialInstance* findInstance (const std::string& name);
MaterialInstance* searchInstance (const std::string& name);
- void removeCache (const std::string& pattern);
+ /// @return was anything removed?
+ bool removeCache (const std::string& pattern);
+
+ static const std::string mBinaryCacheName;
};
}