Add various improvements

This commit is contained in:
Wojtek Figat
2025-08-11 23:47:48 +02:00
parent 1bedfd3adf
commit 7fcf6f9c97
4 changed files with 14 additions and 10 deletions

View File

@@ -171,10 +171,12 @@ void AnimationsSystem::PostExecute(TaskGraph* graph)
void Animations::AddToUpdate(AnimatedModel* obj)
{
ConcurrentSystemLocker::WriteScope lock(SystemLocker, true);
AnimationManagerInstance.UpdateList.Add(obj);
}
void Animations::RemoveFromUpdate(AnimatedModel* obj)
{
ConcurrentSystemLocker::WriteScope lock(SystemLocker, true);
AnimationManagerInstance.UpdateList.Remove(obj);
}

View File

@@ -15,14 +15,9 @@
namespace
{
CriticalSection Locker;
#if USE_EDITOR
Array<FlaxFile*> Files(1024);
Array<FlaxPackage*> Packages;
#else
Array<FlaxFile*> Files;
Array<FlaxPackage*> Packages(64);
#endif
Dictionary<String, FlaxStorage*> StorageMap(2048);
Array<FlaxPackage*> Packages;
Dictionary<String, FlaxStorage*> StorageMap;
}
class ContentStorageService : public EngineService
@@ -231,6 +226,12 @@ void ContentStorageManager::GetStorage(Array<FlaxStorage*>& result)
bool ContentStorageService::Init()
{
#if USE_EDITOR
Files.EnsureCapacity(1024);
#else
Packages.EnsureCapacity(64);
#endif
StorageMap.EnsureCapacity(2048);
System = New<ContentStorageSystem>();
Engine::UpdateGraph->AddSystem(System);
return false;

View File

@@ -19,7 +19,7 @@ namespace
CriticalSection PoolLocker;
double LastUpdate;
float LastUpdateGameTime;
Dictionary<Object*, float> Pool(8192);
Dictionary<Object*, float> Pool;
uint64 PoolCounter = 0;
}
@@ -114,6 +114,7 @@ void ObjectsRemovalService::Flush(float dt, float gameDelta)
bool ObjectsRemoval::Init()
{
Pool.EnsureCapacity(8192);
LastUpdate = Platform::GetTimeSeconds();
LastUpdateGameTime = 0;
return false;

View File

@@ -191,7 +191,7 @@ void SceneRendering::UpdateActor(Actor* a, int32& key, ISceneRenderingListener::
const int32 category = a->_drawCategory;
ConcurrentSystemLocker::ReadScope lock(Locker); // Read-access only as list doesn't get resized (like Add/Remove do) so allow updating actors from different threads at once
auto& list = Actors[category];
if (list.Count() <= key) // Ignore invalid key softly
if (list.Count() <= key || key < 0) // Ignore invalid key softly
return;
auto& e = list[key];
if (e.Actor == a)
@@ -211,7 +211,7 @@ void SceneRendering::RemoveActor(Actor* a, int32& key)
const int32 category = a->_drawCategory;
ConcurrentSystemLocker::WriteScope lock(Locker, true);
auto& list = Actors[category];
if (list.Count() > key) // Ignore invalid key softly (eg. list after batch clear during scene unload)
if (list.Count() > key || key < 0) // Ignore invalid key softly (eg. list after batch clear during scene unload)
{
auto& e = list.Get()[key];
if (e.Actor == a)