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:
Kelsi 2026-02-08 22:08:42 -08:00
parent 92031102e4
commit 71b52046e0
3 changed files with 26 additions and 14 deletions

View file

@ -731,9 +731,15 @@ void Application::setupUICallbacks() {
// Taxi flight start callback - upload all precached tiles to GPU before flight begins
gameHandler->setTaxiFlightStartCallback([this]() {
if (renderer && renderer->getTerrainManager()) {
LOG_INFO("Uploading all precached tiles to GPU before taxi flight...");
if (renderer && renderer->getTerrainManager() && renderer->getM2Renderer()) {
LOG_INFO("Uploading all precached tiles (terrain + M2 models) to GPU before taxi flight...");
auto start = std::chrono::steady_clock::now();
renderer->getTerrainManager()->processAllReadyTiles();
auto end = std::chrono::steady_clock::now();
auto durationMs = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
uint32_t m2Count = renderer->getM2Renderer()->getModelCount();
uint32_t instCount = renderer->getM2Renderer()->getInstanceCount();
LOG_INFO("GPU upload completed in ", durationMs, "ms - ", m2Count, " M2 models in VRAM (", instCount, " instances)");
}
});