shader cache

actorid
scrawl 13 years ago
parent 950bf66334
commit c27ff546e4

@ -325,7 +325,7 @@ void OMW::Engine::go()
// Create the world // Create the world
mEnvironment.setWorld (new MWWorld::World (*mOgre, mFileCollections, mMaster, 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 // Create window manager - this manages all the MW-specific GUI windows
MWScript::registerExtensions (mExtensions); MWScript::registerExtensions (mExtensions);

@ -40,7 +40,8 @@ using namespace Ogre;
namespace MWRender { 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) :mRendering(_rend), mObjects(mRendering), mActors(mRendering), mAmbientMode(0), mSunEnabled(0), mPhysicsEngine(engine)
{ {
// select best shader mode // select best shader mode
@ -63,7 +64,9 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
// material system // material system
sh::OgrePlatform* platform = new sh::OgrePlatform("General", (resDir / "materials").string()); 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); mFactory = new sh::Factory(platform);
sh::Language lang; sh::Language lang;
@ -75,6 +78,11 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
else else
lang = sh::Language_CG; lang = sh::Language_CG;
mFactory->setCurrentLanguage (lang); mFactory->setCurrentLanguage (lang);
mFactory->setWriteSourceCache (true);
mFactory->setReadSourceCache (true);
mFactory->setReadMicrocodeCache (true);
mFactory->setWriteMicrocodeCache (true);
mFactory->loadAllFiles(); mFactory->loadAllFiles();
// Set default mipmap level (NB some APIs ignore this) // Set default mipmap level (NB some APIs ignore this)

@ -53,7 +53,8 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
virtual MWRender::Actors& getActors(); virtual MWRender::Actors& getActors();
public: 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(); virtual ~RenderingManager();
void togglePOV() { void togglePOV() {

@ -164,7 +164,7 @@ namespace MWWorld
World::World (OEngine::Render::OgreRenderer& renderer, World::World (OEngine::Render::OgreRenderer& renderer,
const Files::Collections& fileCollections, 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) const std::string& encoding, std::map<std::string,std::string> fallbackMap)
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm), mSky (true), mNextDynamicRecord (0), mCells (mStore, mEsm),
@ -173,7 +173,7 @@ namespace MWWorld
mPhysics = new PhysicsSystem(renderer); mPhysics = new PhysicsSystem(renderer);
mPhysEngine = mPhysics->getEngine(); mPhysEngine = mPhysics->getEngine();
mRendering = new MWRender::RenderingManager(renderer, resDir, mPhysEngine); mRendering = new MWRender::RenderingManager(renderer, resDir, cacheDir, mPhysEngine);
mWeatherManager = new MWWorld::WeatherManager(mRendering); mWeatherManager = new MWWorld::WeatherManager(mRendering);

@ -96,7 +96,7 @@ namespace MWWorld
World (OEngine::Render::OgreRenderer& renderer, World (OEngine::Render::OgreRenderer& renderer,
const Files::Collections& fileCollections, 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); const std::string& encoding, std::map<std::string,std::string> fallbackMap);
virtual ~World(); virtual ~World();

@ -147,6 +147,11 @@ const boost::filesystem::path& ConfigurationManager::getGlobalDataPath() const
return mFixedPath.getGlobalDataPath(); return mFixedPath.getGlobalDataPath();
} }
const boost::filesystem::path& ConfigurationManager::getCachePath() const
{
return mFixedPath.getCachePath();
}
const boost::filesystem::path& ConfigurationManager::getInstallPath() const const boost::filesystem::path& ConfigurationManager::getInstallPath() const
{ {
return mFixedPath.getInstallPath(); return mFixedPath.getInstallPath();

@ -40,6 +40,8 @@ struct ConfigurationManager
const boost::filesystem::path& getLocalDataPath() const; const boost::filesystem::path& getLocalDataPath() const;
const boost::filesystem::path& getInstallPath() const; const boost::filesystem::path& getInstallPath() const;
const boost::filesystem::path& getCachePath() const;
const boost::filesystem::path& getLogPath() const; const boost::filesystem::path& getLogPath() const;
private: private:

@ -75,6 +75,7 @@ struct FixedPath
, mLocalPath(mPath.getLocalPath()) , mLocalPath(mPath.getLocalPath())
, mGlobalDataPath(mPath.getGlobalDataPath()) , mGlobalDataPath(mPath.getGlobalDataPath())
, mInstallPath(mPath.getInstallPath()) , mInstallPath(mPath.getInstallPath())
, mCachePath(mPath.getCachePath())
{ {
if (!application_name.empty()) if (!application_name.empty())
{ {
@ -83,6 +84,7 @@ struct FixedPath
mUserPath /= suffix; mUserPath /= suffix;
mGlobalPath /= suffix; mGlobalPath /= suffix;
mGlobalDataPath /= suffix; mGlobalDataPath /= suffix;
mCachePath /= suffix;
} }
} }
@ -126,6 +128,11 @@ struct FixedPath
return mGlobalDataPath; return mGlobalDataPath;
} }
const boost::filesystem::path& getCachePath() const
{
return mCachePath;
}
private: private:
PathType mPath; PathType mPath;
@ -135,6 +142,8 @@ struct FixedPath
boost::filesystem::path mGlobalDataPath; /**< Global application data path */ boost::filesystem::path mGlobalDataPath; /**< Global application data path */
boost::filesystem::path mCachePath;
boost::filesystem::path mInstallPath; boost::filesystem::path mInstallPath;
}; };

@ -62,6 +62,29 @@ boost::filesystem::path LinuxPath::getUserPath() const
return userPath; 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 LinuxPath::getGlobalPath() const
{ {
boost::filesystem::path globalPath("/etc/"); boost::filesystem::path globalPath("/etc/");

@ -67,6 +67,13 @@ struct LinuxPath
*/ */
boost::filesystem::path getGlobalDataPath() const; 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. * \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; 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 boost::filesystem::path MacOsPath::getLocalPath() const
{ {
return boost::filesystem::path("./"); return boost::filesystem::path("./");

@ -60,6 +60,13 @@ struct MacOsPath
*/ */
boost::filesystem::path getLocalPath() const; boost::filesystem::path getLocalPath() const;
/**
* \brief
*
* \return boost::filesystem::path
*/
boost::filesystem::path getCachePath() const;
/** /**
* \brief * \brief
* *

@ -67,6 +67,11 @@ boost::filesystem::path WindowsPath::getGlobalDataPath() const
return getGlobalPath(); return getGlobalPath();
} }
boost::filesystem::path WindowsPath::getCachePath() const
{
return getUserPath() / "/cache";
}
boost::filesystem::path WindowsPath::getInstallPath() const boost::filesystem::path WindowsPath::getInstallPath() const
{ {
boost::filesystem::path installPath(""); boost::filesystem::path installPath("");

@ -61,6 +61,13 @@ struct WindowsPath
*/ */
boost::filesystem::path getLocalPath() const; boost::filesystem::path getLocalPath() const;
/**
* \brief
*
* \return boost::filesystem::path
*/
boost::filesystem::path getCachePath() const;
/** /**
* \brief Return same path like getGlobalPath * \brief Return same path like getGlobalPath
* *

2
extern/shiny vendored

@ -1 +1 @@
Subproject commit 164bc8d3bfe860bd16ad89c0bd1b59f465c9bb24 Subproject commit 278c6952b5c38e4b2a10205953e379598fad71a0
Loading…
Cancel
Save