mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Incremental terrain upload + M2 instance dedup hash for city stutter
Terrain finalization was uploading all 256 chunks (GPU fence waits) in one atomic advanceFinalization call that couldn't be interrupted by the 5ms time budget. Now split into incremental batches of 16 chunks per call, allowing the time budget to yield between batches. M2 instance creation had O(N) dedup scans iterating ALL instances to check for duplicates. In cities with 5000+ doodads, this caused O(N²) total work during tile loading. Replaced with hash-based DedupKey map for O(1) lookups. Changes: - TerrainRenderer::loadTerrainIncremental: uploads N chunks per call - FinalizingTile tracks terrainChunkNext for cross-frame progress - TERRAIN phase yields after preload and after each chunk batch - M2Renderer::DedupKey hash map replaces linear scan in createInstance and createInstanceWithMatrix - Dedup map maintained through rebuildSpatialIndex and clear paths
This commit is contained in:
parent
f9410cc4bd
commit
884b72bc1c
6 changed files with 193 additions and 35 deletions
|
|
@ -86,6 +86,13 @@ public:
|
|||
const std::vector<std::string>& texturePaths,
|
||||
int tileX = -1, int tileY = -1);
|
||||
|
||||
/// Upload a batch of terrain chunks incrementally. Returns true when all chunks done.
|
||||
/// chunkIndex is updated to the next chunk to process (0-255 row-major).
|
||||
bool loadTerrainIncremental(const pipeline::TerrainMesh& mesh,
|
||||
const std::vector<std::string>& texturePaths,
|
||||
int tileX, int tileY,
|
||||
int& chunkIndex, int maxChunksPerCall = 16);
|
||||
|
||||
void removeTile(int tileX, int tileY);
|
||||
|
||||
void uploadPreloadedTextures(const std::unordered_map<std::string, pipeline::BLPImage>& textures);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue