forked from teamnwah/openmw-tes3coop
shader cache
This commit is contained in:
parent
950bf66334
commit
c27ff546e4
15 changed files with 103 additions and 8 deletions
|
@ -325,7 +325,7 @@ void OMW::Engine::go()
|
|||
|
||||
// Create the world
|
||||
mEnvironment.setWorld (new MWWorld::World (*mOgre, mFileCollections, mMaster,
|
||||
mResDir, mNewGame, mEncoding, mFallbackMap));
|
||||
mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoding, mFallbackMap));
|
||||
|
||||
// Create window manager - this manages all the MW-specific GUI windows
|
||||
MWScript::registerExtensions (mExtensions);
|
||||
|
|
|
@ -40,7 +40,8 @@ using namespace Ogre;
|
|||
|
||||
namespace MWRender {
|
||||
|
||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine)
|
||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir,
|
||||
const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine)
|
||||
:mRendering(_rend), mObjects(mRendering), mActors(mRendering), mAmbientMode(0), mSunEnabled(0), mPhysicsEngine(engine)
|
||||
{
|
||||
// select best shader mode
|
||||
|
@ -63,7 +64,9 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
|
||||
// material system
|
||||
sh::OgrePlatform* platform = new sh::OgrePlatform("General", (resDir / "materials").string());
|
||||
platform->setCacheFolder ("./");
|
||||
if (!boost::filesystem::exists (cacheDir))
|
||||
boost::filesystem::create_directory (cacheDir);
|
||||
platform->setCacheFolder (cacheDir.string());
|
||||
mFactory = new sh::Factory(platform);
|
||||
|
||||
sh::Language lang;
|
||||
|
@ -75,6 +78,11 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
else
|
||||
lang = sh::Language_CG;
|
||||
mFactory->setCurrentLanguage (lang);
|
||||
mFactory->setWriteSourceCache (true);
|
||||
mFactory->setReadSourceCache (true);
|
||||
mFactory->setReadMicrocodeCache (true);
|
||||
mFactory->setWriteMicrocodeCache (true);
|
||||
|
||||
mFactory->loadAllFiles();
|
||||
|
||||
// Set default mipmap level (NB some APIs ignore this)
|
||||
|
|
|
@ -53,7 +53,8 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
|
|||
virtual MWRender::Actors& getActors();
|
||||
|
||||
public:
|
||||
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine);
|
||||
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir,
|
||||
const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine);
|
||||
virtual ~RenderingManager();
|
||||
|
||||
void togglePOV() {
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace MWWorld
|
|||
|
||||
World::World (OEngine::Render::OgreRenderer& renderer,
|
||||
const Files::Collections& fileCollections,
|
||||
const std::string& master, const boost::filesystem::path& resDir, bool newGame,
|
||||
const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame,
|
||||
const std::string& encoding, std::map<std::string,std::string> fallbackMap)
|
||||
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||
mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm),
|
||||
|
@ -173,7 +173,7 @@ namespace MWWorld
|
|||
mPhysics = new PhysicsSystem(renderer);
|
||||
mPhysEngine = mPhysics->getEngine();
|
||||
|
||||
mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine);
|
||||
mRendering = new MWRender::RenderingManager(renderer, resDir, cacheDir, mPhysEngine);
|
||||
|
||||
mWeatherManager = new MWWorld::WeatherManager(mRendering);
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace MWWorld
|
|||
|
||||
World (OEngine::Render::OgreRenderer& renderer,
|
||||
const Files::Collections& fileCollections,
|
||||
const std::string& master, const boost::filesystem::path& resDir, bool newGame,
|
||||
const std::string& master, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, bool newGame,
|
||||
const std::string& encoding, std::map<std::string,std::string> fallbackMap);
|
||||
|
||||
virtual ~World();
|
||||
|
|
|
@ -147,6 +147,11 @@ const boost::filesystem::path& ConfigurationManager::getGlobalDataPath() const
|
|||
return mFixedPath.getGlobalDataPath();
|
||||
}
|
||||
|
||||
const boost::filesystem::path& ConfigurationManager::getCachePath() const
|
||||
{
|
||||
return mFixedPath.getCachePath();
|
||||
}
|
||||
|
||||
const boost::filesystem::path& ConfigurationManager::getInstallPath() const
|
||||
{
|
||||
return mFixedPath.getInstallPath();
|
||||
|
|
|
@ -40,6 +40,8 @@ struct ConfigurationManager
|
|||
const boost::filesystem::path& getLocalDataPath() const;
|
||||
const boost::filesystem::path& getInstallPath() const;
|
||||
|
||||
const boost::filesystem::path& getCachePath() const;
|
||||
|
||||
const boost::filesystem::path& getLogPath() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -75,6 +75,7 @@ struct FixedPath
|
|||
, mLocalPath(mPath.getLocalPath())
|
||||
, mGlobalDataPath(mPath.getGlobalDataPath())
|
||||
, mInstallPath(mPath.getInstallPath())
|
||||
, mCachePath(mPath.getCachePath())
|
||||
{
|
||||
if (!application_name.empty())
|
||||
{
|
||||
|
@ -83,6 +84,7 @@ struct FixedPath
|
|||
mUserPath /= suffix;
|
||||
mGlobalPath /= suffix;
|
||||
mGlobalDataPath /= suffix;
|
||||
mCachePath /= suffix;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,6 +128,11 @@ struct FixedPath
|
|||
return mGlobalDataPath;
|
||||
}
|
||||
|
||||
const boost::filesystem::path& getCachePath() const
|
||||
{
|
||||
return mCachePath;
|
||||
}
|
||||
|
||||
private:
|
||||
PathType mPath;
|
||||
|
||||
|
@ -135,6 +142,8 @@ struct FixedPath
|
|||
|
||||
boost::filesystem::path mGlobalDataPath; /**< Global application data path */
|
||||
|
||||
boost::filesystem::path mCachePath;
|
||||
|
||||
boost::filesystem::path mInstallPath;
|
||||
|
||||
};
|
||||
|
|
|
@ -62,6 +62,29 @@ boost::filesystem::path LinuxPath::getUserPath() const
|
|||
return userPath;
|
||||
}
|
||||
|
||||
boost::filesystem::path LinuxPath::getCachePath() const
|
||||
{
|
||||
boost::filesystem::path userPath(".");
|
||||
|
||||
const char* theDir = getenv("HOME");
|
||||
if (theDir == NULL)
|
||||
{
|
||||
struct passwd* pwd = getpwuid(getuid());
|
||||
if (pwd != NULL)
|
||||
{
|
||||
theDir = pwd->pw_dir;
|
||||
}
|
||||
}
|
||||
|
||||
if (theDir != NULL)
|
||||
{
|
||||
userPath = boost::filesystem::path(theDir);
|
||||
}
|
||||
userPath /= "/.cache/";
|
||||
|
||||
return userPath;
|
||||
}
|
||||
|
||||
boost::filesystem::path LinuxPath::getGlobalPath() const
|
||||
{
|
||||
boost::filesystem::path globalPath("/etc/");
|
||||
|
|
|
@ -67,6 +67,13 @@ struct LinuxPath
|
|||
*/
|
||||
boost::filesystem::path getGlobalDataPath() const;
|
||||
|
||||
/**
|
||||
* \brief
|
||||
*
|
||||
* \return boost::filesystem::path
|
||||
*/
|
||||
boost::filesystem::path getCachePath() const;
|
||||
|
||||
/**
|
||||
* \brief Gets the path of the installed Morrowind version if there is one.
|
||||
*
|
||||
|
|
|
@ -69,6 +69,27 @@ boost::filesystem::path MacOsPath::getGlobalPath() const
|
|||
return globalPath;
|
||||
}
|
||||
|
||||
boost::filesystem::path MacOsPath::getCachePath() const
|
||||
{
|
||||
boost::filesystem::path userPath(".");
|
||||
|
||||
const char* theDir = getenv("HOME");
|
||||
if (theDir == NULL)
|
||||
{
|
||||
struct passwd* pwd = getpwuid(getuid());
|
||||
if (pwd != NULL)
|
||||
{
|
||||
theDir = pwd->pw_dir;
|
||||
}
|
||||
}
|
||||
if (theDir != NULL)
|
||||
{
|
||||
userPath = boost::filesystem::path(theDir) / "Library/Caches/";
|
||||
}
|
||||
|
||||
return userPath;
|
||||
}
|
||||
|
||||
boost::filesystem::path MacOsPath::getLocalPath() const
|
||||
{
|
||||
return boost::filesystem::path("./");
|
||||
|
|
|
@ -60,6 +60,13 @@ struct MacOsPath
|
|||
*/
|
||||
boost::filesystem::path getLocalPath() const;
|
||||
|
||||
/**
|
||||
* \brief
|
||||
*
|
||||
* \return boost::filesystem::path
|
||||
*/
|
||||
boost::filesystem::path getCachePath() const;
|
||||
|
||||
/**
|
||||
* \brief
|
||||
*
|
||||
|
|
|
@ -67,6 +67,11 @@ boost::filesystem::path WindowsPath::getGlobalDataPath() const
|
|||
return getGlobalPath();
|
||||
}
|
||||
|
||||
boost::filesystem::path WindowsPath::getCachePath() const
|
||||
{
|
||||
return getUserPath() / "/cache";
|
||||
}
|
||||
|
||||
boost::filesystem::path WindowsPath::getInstallPath() const
|
||||
{
|
||||
boost::filesystem::path installPath("");
|
||||
|
|
|
@ -61,6 +61,13 @@ struct WindowsPath
|
|||
*/
|
||||
boost::filesystem::path getLocalPath() const;
|
||||
|
||||
/**
|
||||
* \brief
|
||||
*
|
||||
* \return boost::filesystem::path
|
||||
*/
|
||||
boost::filesystem::path getCachePath() const;
|
||||
|
||||
/**
|
||||
* \brief Return same path like getGlobalPath
|
||||
*
|
||||
|
|
2
extern/shiny
vendored
2
extern/shiny
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 164bc8d3bfe860bd16ad89c0bd1b59f465c9bb24
|
||||
Subproject commit 278c6952b5c38e4b2a10205953e379598fad71a0
|
Loading…
Reference in a new issue