Pass cache expiry delay to GenericResourceManager constructor

macos_ci_fix
elsid 1 year ago
parent bcc3365766
commit 053a3caf7b
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -172,10 +172,11 @@ namespace
const EsmLoader::EsmData esmData
= EsmLoader::loadEsmData(query, contentFiles, fileCollections, readers, &encoder);
Resource::ImageManager imageManager(&vfs);
constexpr double expiryDelay = 0;
Resource::ImageManager imageManager(&vfs, expiryDelay);
Resource::NifFileManager nifFileManager(&vfs);
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager);
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager);
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager, expiryDelay);
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager, expiryDelay);
Resource::forEachBulletObject(
readers, vfs, bulletShapeManager, esmData, [](const ESM::Cell& cell, const Resource::BulletObject& object) {

@ -218,10 +218,12 @@ namespace NavMeshTool
const EsmLoader::EsmData esmData
= EsmLoader::loadEsmData(query, contentFiles, fileCollections, readers, &encoder);
Resource::ImageManager imageManager(&vfs);
constexpr double expiryDelay = 0;
Resource::ImageManager imageManager(&vfs, expiryDelay);
Resource::NifFileManager nifFileManager(&vfs);
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager);
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager);
Resource::SceneManager sceneManager(&vfs, &imageManager, &nifFileManager, expiryDelay);
Resource::BulletShapeManager bulletShapeManager(&vfs, &sceneManager, &nifFileManager, expiryDelay);
DetourNavigator::RecastGlobalAllocator::init();
DetourNavigator::Settings navigatorSettings = DetourNavigator::makeSettingsFromSettingsManager();
navigatorSettings.mRecast.mSwimHeightScale

@ -142,12 +142,14 @@ CSMWorld::Data::Data(ToUTF8::FromType encoding, const Files::PathContainer& data
, mReaderIndex(1)
, mDataPaths(dataPaths)
, mArchives(archives)
, mVFS(std::make_unique<VFS::Manager>())
{
mVFS = std::make_unique<VFS::Manager>();
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths), mArchives, true);
mResourcesManager.setVFS(mVFS.get());
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get());
constexpr double expiryDelay = 0;
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get(), expiryDelay);
Shader::ShaderManager::DefineMap defines
= mResourceSystem->getSceneManager()->getShaderManager().getGlobalDefines();

@ -146,8 +146,9 @@ void CSVRender::Cell::updateLand()
}
else
{
constexpr double expiryDelay = 0;
mTerrain = std::make_unique<Terrain::TerrainGrid>(mCellNode, mCellNode, mData.getResourceSystem().get(),
mTerrainStorage, Mask_Terrain, ESM::Cell::sDefaultWorldspaceId);
mTerrainStorage, Mask_Terrain, ESM::Cell::sDefaultWorldspaceId, expiryDelay);
}
mTerrain->loadCell(esmLand.mX, esmLand.mY);

@ -645,7 +645,7 @@ void OMW::Engine::prepareEngine()
VFS::registerArchives(mVFS.get(), mFileCollections, mArchives, true);
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get());
mResourceSystem = std::make_unique<Resource::ResourceSystem>(mVFS.get(), Settings::cells().mCacheExpiryDelay);
mResourceSystem->getSceneManager()->getShaderManager().setMaxTextureUnits(mGlMaxTextureImageUnits);
mResourceSystem->getSceneManager()->setUnRefImageDataAfterApply(
false); // keep to Off for now to allow better state sharing

@ -94,8 +94,9 @@ namespace
namespace MWPhysics
{
PhysicsSystem::PhysicsSystem(Resource::ResourceSystem* resourceSystem, osg::ref_ptr<osg::Group> parentNode)
: mShapeManager(std::make_unique<Resource::BulletShapeManager>(
resourceSystem->getVFS(), resourceSystem->getSceneManager(), resourceSystem->getNifFileManager()))
: mShapeManager(
std::make_unique<Resource::BulletShapeManager>(resourceSystem->getVFS(), resourceSystem->getSceneManager(),
resourceSystem->getNifFileManager(), Settings::cells().mCacheExpiryDelay))
, mResourceSystem(resourceSystem)
, mDebugDrawEnabled(false)
, mTimeAccum(0.0f)

@ -14,6 +14,7 @@
#include <components/misc/convert.hpp>
#include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/nodecallback.hpp>
#include <components/settings/values.hpp>
#include <components/shader/shadermanager.hpp>
#include <components/terrain/quadtreenode.hpp>
@ -327,7 +328,7 @@ namespace MWRender
Groundcover::Groundcover(
Resource::SceneManager* sceneManager, float density, float viewDistance, const MWWorld::GroundcoverStore& store)
: GenericResourceManager<GroundcoverChunkId>(nullptr)
: GenericResourceManager<GroundcoverChunkId>(nullptr, Settings::cells().mCacheExpiryDelay)
, mSceneManager(sceneManager)
, mDensity(density)
, mStateset(new osg::StateSet)

@ -3,6 +3,7 @@
#include <osg/Stats>
#include <components/resource/objectcache.hpp>
#include <components/settings/values.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
@ -12,7 +13,7 @@ namespace MWRender
{
LandManager::LandManager(int loadFlags)
: GenericResourceManager<ESM::ExteriorCellLocation>(nullptr)
: GenericResourceManager<ESM::ExteriorCellLocation>(nullptr, Settings::cells().mCacheExpiryDelay)
, mLoadFlags(loadFlags)
{
}

@ -33,7 +33,7 @@
#include <components/sceneutil/morphgeometry.hpp>
#include <components/sceneutil/riggeometry.hpp>
#include <components/sceneutil/riggeometryosgaextension.hpp>
#include <components/settings/settings.hpp>
#include <components/settings/values.hpp>
#include "apps/openmw/mwbase/environment.hpp"
#include "apps/openmw/mwbase/world.hpp"
@ -454,7 +454,7 @@ namespace MWRender
};
ObjectPaging::ObjectPaging(Resource::SceneManager* sceneManager, ESM::RefId worldspace)
: GenericResourceManager<ChunkId>(nullptr)
: GenericResourceManager<ChunkId>(nullptr, Settings::cells().mCacheExpiryDelay)
, Terrain::QuadTreeWorld::ChunkManager(worldspace)
, mSceneManager(sceneManager)
, mRefTrackerLocked(false)

@ -99,7 +99,7 @@ namespace
{ "shaders/missing_sampler_source.omwfx", &missing_sampler_source },
{ "shaders/repeated_shared_block.omwfx", &repeated_shared_block },
}))
, mImageManager(mVFS.get())
, mImageManager(mVFS.get(), 0)
{
}

@ -28,7 +28,7 @@ namespace
struct BaseNifOsgLoaderTest
{
VFS::Manager mVfs;
Resource::ImageManager mImageManager{ &mVfs };
Resource::ImageManager mImageManager{ &mVfs, 0 };
const osgDB::ReaderWriter* mReaderWriter = osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
osg::ref_ptr<osgDB::Options> mOptions = new osgDB::Options;

@ -98,8 +98,8 @@ namespace Resource
};
BulletShapeManager::BulletShapeManager(
const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager)
: ResourceManager(vfs)
const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager, double expiryDelay)
: ResourceManager(vfs, expiryDelay)
, mInstanceCache(new MultiObjectCache)
, mSceneManager(sceneMgr)
, mNifFileManager(nifFileManager)

@ -25,7 +25,8 @@ namespace Resource
class BulletShapeManager : public ResourceManager
{
public:
BulletShapeManager(const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager);
BulletShapeManager(
const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager, double expiryDelay);
~BulletShapeManager();
/// @note May return a null pointer if the object has no shape.

@ -46,8 +46,8 @@ namespace
namespace Resource
{
ImageManager::ImageManager(const VFS::Manager* vfs)
: ResourceManager(vfs)
ImageManager::ImageManager(const VFS::Manager* vfs, double expiryDelay)
: ResourceManager(vfs, expiryDelay)
, mWarningImage(createWarningImage())
, mOptions(new osgDB::Options("dds_flip dds_dxt1_detect_rgba ignoreTga2Fields"))
, mOptionsNoFlip(new osgDB::Options("dds_dxt1_detect_rgba ignoreTga2Fields"))

@ -23,7 +23,7 @@ namespace Resource
class ImageManager : public ResourceManager
{
public:
ImageManager(const VFS::Manager* vfs);
explicit ImageManager(const VFS::Manager* vfs, double expiryDelay);
~ImageManager();
/// Create or retrieve an Image

@ -207,8 +207,8 @@ namespace Resource
namespace Resource
{
KeyframeManager::KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager)
: ResourceManager(vfs)
KeyframeManager::KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay)
: ResourceManager(vfs, expiryDelay)
, mSceneManager(sceneManager)
{
}

@ -48,7 +48,7 @@ namespace Resource
class KeyframeManager : public ResourceManager
{
public:
KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager);
explicit KeyframeManager(const VFS::Manager* vfs, SceneManager* sceneManager, double expiryDelay);
~KeyframeManager() = default;
/// Retrieve a read-only keyframe resource by name (case-insensitive).

@ -3,8 +3,6 @@
#include <osg/ref_ptr>
#include <components/settings/values.hpp>
#include "objectcache.hpp"
namespace VFS
@ -41,8 +39,7 @@ namespace Resource
public:
typedef GenericObjectCache<KeyType> CacheType;
explicit GenericResourceManager(
const VFS::Manager* vfs, double expiryDelay = Settings::cells().mCacheExpiryDelay)
explicit GenericResourceManager(const VFS::Manager* vfs, double expiryDelay)
: mVFS(vfs)
, mCache(new CacheType)
, mExpiryDelay(expiryDelay)
@ -80,11 +77,6 @@ namespace Resource
class ResourceManager : public GenericResourceManager<std::string>
{
public:
explicit ResourceManager(const VFS::Manager* vfs)
: GenericResourceManager<std::string>(vfs)
{
}
explicit ResourceManager(const VFS::Manager* vfs, double expiryDelay)
: GenericResourceManager<std::string>(vfs, expiryDelay)
{

@ -10,13 +10,13 @@
namespace Resource
{
ResourceSystem::ResourceSystem(const VFS::Manager* vfs)
ResourceSystem::ResourceSystem(const VFS::Manager* vfs, double expiryDelay)
: mVFS(vfs)
{
mNifFileManager = std::make_unique<NifFileManager>(vfs);
mImageManager = std::make_unique<ImageManager>(vfs);
mSceneManager = std::make_unique<SceneManager>(vfs, mImageManager.get(), mNifFileManager.get());
mKeyframeManager = std::make_unique<KeyframeManager>(vfs, mSceneManager.get());
mImageManager = std::make_unique<ImageManager>(vfs, expiryDelay);
mSceneManager = std::make_unique<SceneManager>(vfs, mImageManager.get(), mNifFileManager.get(), expiryDelay);
mKeyframeManager = std::make_unique<KeyframeManager>(vfs, mSceneManager.get(), expiryDelay);
addResourceManager(mNifFileManager.get());
addResourceManager(mKeyframeManager.get());

@ -30,7 +30,7 @@ namespace Resource
class ResourceSystem
{
public:
ResourceSystem(const VFS::Manager* vfs);
explicit ResourceSystem(const VFS::Manager* vfs, double expiryDelay);
~ResourceSystem();
SceneManager* getSceneManager();

@ -352,9 +352,9 @@ namespace Resource
std::vector<osg::ref_ptr<SceneUtil::RigGeometryHolder>> mRigGeometryHolders;
};
SceneManager::SceneManager(
const VFS::Manager* vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager)
: ResourceManager(vfs)
SceneManager::SceneManager(const VFS::Manager* vfs, Resource::ImageManager* imageManager,
Resource::NifFileManager* nifFileManager, double expiryDelay)
: ResourceManager(vfs, expiryDelay)
, mShaderManager(new Shader::ShaderManager)
, mForceShaders(false)
, mClampLighting(true)

@ -89,8 +89,8 @@ namespace Resource
class SceneManager : public ResourceManager
{
public:
SceneManager(
const VFS::Manager* vfs, Resource::ImageManager* imageManager, Resource::NifFileManager* nifFileManager);
explicit SceneManager(const VFS::Manager* vfs, Resource::ImageManager* imageManager,
Resource::NifFileManager* nifFileManager, double expiryDelay);
~SceneManager();
Shader::ShaderManager& getShaderManager();

@ -20,8 +20,8 @@ namespace Terrain
{
ChunkManager::ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager,
CompositeMapRenderer* renderer, ESM::RefId worldspace)
: GenericResourceManager<ChunkKey>(nullptr)
CompositeMapRenderer* renderer, ESM::RefId worldspace, double expiryDelay)
: GenericResourceManager<ChunkKey>(nullptr, expiryDelay)
, QuadTreeWorld::ChunkManager(worldspace)
, mStorage(storage)
, mSceneManager(sceneMgr)

@ -75,8 +75,8 @@ namespace Terrain
class ChunkManager : public Resource::GenericResourceManager<ChunkKey>, public QuadTreeWorld::ChunkManager
{
public:
ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager,
CompositeMapRenderer* renderer, ESM::RefId worldspace);
explicit ChunkManager(Storage* storage, Resource::SceneManager* sceneMgr, TextureManager* textureManager,
CompositeMapRenderer* renderer, ESM::RefId worldspace, double expiryDelay);
osg::ref_ptr<osg::Node> getChunk(float size, const osg::Vec2f& center, unsigned char lod, unsigned int lodFlags,
bool activeGrid, const osg::Vec3f& viewPoint, bool compile) override;

@ -23,9 +23,10 @@ namespace Terrain
};
TerrainGrid::TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, unsigned int preCompileMask,
Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, double expiryDelay, unsigned int preCompileMask,
unsigned int borderMask)
: Terrain::World(parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask, worldspace)
: Terrain::World(
parent, compileRoot, resourceSystem, storage, nodeMask, preCompileMask, borderMask, worldspace, expiryDelay)
, mNumSplits(4)
{
}

@ -26,9 +26,9 @@ namespace Terrain
class TerrainGrid : public Terrain::World
{
public:
TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, unsigned int preCompileMask = ~0u,
unsigned int borderMask = 0);
explicit TerrainGrid(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
Storage* storage, unsigned int nodeMask, ESM::RefId worldspace, double expiryDelay,
unsigned int preCompileMask = ~0u, unsigned int borderMask = 0);
TerrainGrid(osg::Group* parent, Storage* storage, ESM::RefId worldspace, unsigned int nodeMask = ~0u);
~TerrainGrid();

@ -10,8 +10,8 @@
namespace Terrain
{
TextureManager::TextureManager(Resource::SceneManager* sceneMgr)
: ResourceManager(sceneMgr->getVFS())
TextureManager::TextureManager(Resource::SceneManager* sceneMgr, double expiryDelay)
: ResourceManager(sceneMgr->getVFS(), expiryDelay)
, mSceneManager(sceneMgr)
{
}

@ -21,7 +21,7 @@ namespace Terrain
class TextureManager : public Resource::ResourceManager
{
public:
TextureManager(Resource::SceneManager* sceneMgr);
explicit TextureManager(Resource::SceneManager* sceneMgr, double expiryDelay);
void updateTextureFiltering();

@ -5,6 +5,7 @@
#include <components/resource/resourcesystem.hpp>
#include <components/resource/scenemanager.hpp>
#include <components/settings/values.hpp>
#include "chunkmanager.hpp"
#include "compositemaprenderer.hpp"
@ -17,7 +18,7 @@ namespace Terrain
World::World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask,
ESM::RefId worldspace)
ESM::RefId worldspace, double expiryDelay)
: mStorage(storage)
, mParent(parent)
, mResourceSystem(resourceSystem)
@ -45,9 +46,9 @@ namespace Terrain
mParent->addChild(mTerrainRoot);
mTextureManager = std::make_unique<TextureManager>(mResourceSystem->getSceneManager());
mChunkManager = std::make_unique<ChunkManager>(
mStorage, mResourceSystem->getSceneManager(), mTextureManager.get(), mCompositeMapRenderer, mWorldspace);
mTextureManager = std::make_unique<TextureManager>(mResourceSystem->getSceneManager(), expiryDelay);
mChunkManager = std::make_unique<ChunkManager>(mStorage, mResourceSystem->getSceneManager(),
mTextureManager.get(), mCompositeMapRenderer, mWorldspace, expiryDelay);
mChunkManager->setNodeMask(nodeMask);
mCellBorder
= std::make_unique<CellBorder>(this, mTerrainRoot.get(), borderMask, mResourceSystem->getSceneManager());

@ -49,8 +49,9 @@ namespace Terrain
/// @param storage Storage instance to get terrain data from (heights, normals, colors, textures..)
/// @param nodeMask mask for the terrain root
/// @param preCompileMask mask for pre compiling textures
World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem, Storage* storage,
unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask, ESM::RefId worldspace);
explicit World(osg::Group* parent, osg::Group* compileRoot, Resource::ResourceSystem* resourceSystem,
Storage* storage, unsigned int nodeMask, unsigned int preCompileMask, unsigned int borderMask,
ESM::RefId worldspace, double expiryDelay);
World(osg::Group* parent, Storage* storage, unsigned int nodeMask, ESM::RefId worldspace);
virtual ~World();

Loading…
Cancel
Save