mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
fix: add 60-second grace period to M2 model cleanup
Models that lose all instances are no longer immediately evicted from GPU memory. Instead they get a 60-second grace period, preventing the thrash cycle where GO models (barrels, chests, herbs) were evicted every 5 seconds and re-loaded when the same object type respawned.
This commit is contained in:
parent
3c60ef8464
commit
f78d885e13
2 changed files with 25 additions and 2 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <string>
|
||||
#include <optional>
|
||||
#include <random>
|
||||
#include <chrono>
|
||||
#include <future>
|
||||
|
||||
namespace wowee {
|
||||
|
|
@ -434,6 +435,9 @@ private:
|
|||
void* glowVBMapped_ = nullptr;
|
||||
|
||||
std::unordered_map<uint32_t, M2ModelGPU> models;
|
||||
// Grace period for model cleanup: track when a model first became instanceless.
|
||||
// Models are only evicted after 60 seconds with no instances.
|
||||
std::unordered_map<uint32_t, std::chrono::steady_clock::time_point> modelUnusedSince_;
|
||||
std::vector<M2Instance> instances;
|
||||
|
||||
// O(1) dedup: key = (modelId, quantized x, quantized y, quantized z) → instanceId
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue