Fix terrain loss after map transition and GPU crash on WMO-only maps

Three fixes:
1. Water captureSceneHistory gated on hasSurfaces() — the image layout
   transitions (PRESENT_SRC→TRANSFER_SRC→PRESENT_SRC) were running every
   frame even on WMO-only maps with no water, causing VK_ERROR_DEVICE_LOST.

2. Tile cache invalidation: softReset() now clears tileCache_ since cache
   keys are (x,y) without map name — prevents stale cross-map cache hits.

3. Copy terrain/mesh into TerrainTile instead of std::move — the moved-from
   PendingTile was cached with empty data, so subsequent map loads returned
   tiles with 0 valid chunks from cache.

Also adds diagnostic skip env vars (WOWEE_SKIP_TERRAIN, WOWEE_SKIP_SKY,
WOWEE_SKIP_PREPASSES) and a 0-chunk warning in loadTerrain.
This commit is contained in:
Kelsi 2026-03-02 09:52:09 -08:00
parent 5519c73f5c
commit 335b1b1c3a
3 changed files with 34 additions and 12 deletions

View file

@ -320,6 +320,10 @@ void TerrainRenderer::shutdown() {
bool TerrainRenderer::loadTerrain(const pipeline::TerrainMesh& mesh,
const std::vector<std::string>& texturePaths,
int tileX, int tileY) {
if (mesh.validChunkCount == 0) {
LOG_WARNING("loadTerrain[", tileX, ",", tileY, "]: mesh has 0 valid chunks (", texturePaths.size(), " textures)");
return false;
}
LOG_DEBUG("Loading terrain mesh: ", mesh.validChunkCount, " chunks");
for (int y = 0; y < 16; y++) {