Faster terrain/model loading: more workers, batched finalization, skip redundant I/O

- Worker threads: use (cores - 1-2) instead of cores/2, minimum 4
- Outer upload batch in processReadyTiles: ALL model/texture uploads per
  frame share a single command buffer submission + fence wait
- Upload multiple models per finalization step: 8 M2s, 4 WMOs, 16 doodads
  per call instead of 1 each (all within same GPU batch)
- Terrain chunks: 64 per step instead of 16
- Skip redundant M2 file I/O: thread-safe uploadedM2Ids_ set lets
  background workers skip re-reading+parsing models already on GPU
- processAllReadyTiles (loading screen) and processOneReadyTile also
  wrapped in outer upload batches
This commit is contained in:
Kelsi 2026-03-07 12:32:39 -08:00
parent 16b4336700
commit 25bb63c50a
3 changed files with 105 additions and 34 deletions

View file

@ -381,6 +381,11 @@ private:
std::unordered_set<std::string> missingAdtWarnings_;
std::mutex missingAdtWarningsMutex_;
// Thread-safe set of M2 model IDs already uploaded to GPU
// (checked by workers to skip redundant file I/O + parsing)
std::unordered_set<uint32_t> uploadedM2Ids_;
std::mutex uploadedM2IdsMutex_;
// Dedup set for doodad placements across tile boundaries
std::unordered_set<uint32_t> placedDoodadIds;

View file

@ -127,6 +127,7 @@ public:
int getRenderedChunkCount() const { return renderedChunks; }
int getCulledChunkCount() const { return culledChunks; }
int getTriangleCount() const;
VkContext* getVkContext() const { return vkCtx; }
private:
TerrainChunkGPU uploadChunk(const pipeline::ChunkMesh& chunk);