mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Keep M2 models permanently in VRAM to eliminate loading hitches
Modern GPUs have 8-16GB VRAM - leverage this to cache all M2 models permanently. Changes: - Disabled cleanupUnusedModels() call when tiles unload - Models now stay in VRAM after initial load, even when tiles unload - Increased taxi mounting delay from 3s to 5s for more precache time - Added logging: M2 model count, instance count, and GPU upload duration - Added debug logging when M2 models are uploaded per tile This fixes the "building pops up then pause" issue - models were being: 1. Loaded when tile loads 2. Unloaded when tile unloads (behind taxi) 3. Re-loaded when flying through again (causing hitch) Now models persist in VRAM permanently (few hundred MB for typical session). First pass loads to VRAM, subsequent passes are instant.
This commit is contained in:
parent
92031102e4
commit
71b52046e0
3 changed files with 26 additions and 14 deletions
|
|
@ -528,13 +528,16 @@ void TerrainManager::finalizeTile(const std::shared_ptr<PendingTile>& pending) {
|
|||
m2Renderer->initialize(assetManager);
|
||||
}
|
||||
|
||||
// Upload unique models
|
||||
// Upload unique M2 models to GPU (stays in VRAM permanently until shutdown)
|
||||
std::unordered_set<uint32_t> uploadedModelIds;
|
||||
for (auto& m2Ready : pending->m2Models) {
|
||||
if (m2Renderer->loadModel(m2Ready.model, m2Ready.modelId)) {
|
||||
uploadedModelIds.insert(m2Ready.modelId);
|
||||
}
|
||||
}
|
||||
if (!uploadedModelIds.empty()) {
|
||||
LOG_DEBUG(" Uploaded ", uploadedModelIds.size(), " unique M2 models to VRAM for tile [", x, ",", y, "]");
|
||||
}
|
||||
|
||||
// Create instances (deduplicate by uniqueId across tile boundaries)
|
||||
int loadedDoodads = 0;
|
||||
|
|
@ -1202,16 +1205,19 @@ void TerrainManager::streamTiles() {
|
|||
}
|
||||
|
||||
if (!tilesToUnload.empty()) {
|
||||
// Clean up models that lost all instances (once, after all tiles removed)
|
||||
if (m2Renderer) {
|
||||
m2Renderer->cleanupUnusedModels();
|
||||
}
|
||||
if (wmoRenderer) {
|
||||
wmoRenderer->cleanupUnusedModels();
|
||||
}
|
||||
// Don't clean up models during streaming - keep them in VRAM for performance
|
||||
// Modern GPUs have 8-16GB VRAM, models are only ~hundreds of MB
|
||||
// Cleanup can be done manually when memory pressure is detected
|
||||
// NOTE: Disabled permanent model cleanup to leverage modern VRAM capacity
|
||||
// if (m2Renderer) {
|
||||
// m2Renderer->cleanupUnusedModels();
|
||||
// }
|
||||
// if (wmoRenderer) {
|
||||
// wmoRenderer->cleanupUnusedModels();
|
||||
// }
|
||||
|
||||
LOG_INFO("Unloaded ", tilesToUnload.size(), " distant tiles, ",
|
||||
loadedTiles.size(), " remain");
|
||||
loadedTiles.size(), " remain (models kept in VRAM)");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue