mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
perf(editor): periodic M2 model GPU cache cleanup every 30s
The new persistent path->modelId map keeps models alive across rebuilds, which is great for the common case of moving an instance, but means models that lost all references stay in GPU memory forever. Added a 30s timer that calls m2Renderer->cleanupUnusedModels(), which has its own 60s grace period before actual eviction — so models stick around ~60-90s after their last instance is removed and then get freed.
This commit is contained in:
parent
c1b6c9f621
commit
3abe47adc6
1 changed files with 11 additions and 0 deletions
|
|
@ -119,6 +119,17 @@ void EditorApp::run() {
|
|||
// Refresh dirty terrain chunks
|
||||
refreshDirtyChunks();
|
||||
|
||||
// Periodic GPU model cache cleanup. Models that lost all instances
|
||||
// (e.g. user removed every spawn of one creature) get evicted after
|
||||
// the renderer's grace period. Without this the editor would slowly
|
||||
// accumulate GPU memory across long sessions.
|
||||
static float modelCleanupTimer = 0.0f;
|
||||
modelCleanupTimer += dt;
|
||||
if (modelCleanupTimer >= 30.0f) {
|
||||
modelCleanupTimer = 0.0f;
|
||||
if (auto* m2 = viewport_.getM2Renderer()) m2->cleanupUnusedModels();
|
||||
}
|
||||
|
||||
// Track object and NPC counts separately
|
||||
size_t objCount = objectPlacer_.objectCount();
|
||||
size_t npcCount = npcSpawner_.spawnCount();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue