Fix missing water by finalizing each tile completely per frame

Phase-splitting across frames caused water surfaces to not render
correctly. Changed processReadyTiles to run all phases for each tile
before moving to the next, with time budget checked between tiles.
This commit is contained in:
Kelsi 2026-02-25 02:47:37 -08:00
parent 0b6f5a9313
commit 7dd78e2c0a

View file

@ -981,14 +981,13 @@ void TerrainManager::processReadyTiles() {
}
}
// Drive incremental finalization within time budget
// Finalize one complete tile per iteration, check budget between tiles.
// Each tile runs through all phases before moving to the next — this
// avoids subtle state issues from spreading GPU uploads across frames.
while (!finalizingTiles_.empty()) {
auto& ft = finalizingTiles_.front();
bool done = advanceFinalization(ft);
if (done) {
finalizingTiles_.pop_front();
}
while (!advanceFinalization(ft)) {}
finalizingTiles_.pop_front();
auto now = std::chrono::high_resolution_clock::now();
float elapsedMs = std::chrono::duration<float, std::milli>(now - startTime).count();