OverviewFilesCommitsIssuesDocsReleasesPeers

dc-terrain commits / a85a915

dc: throttle the bake's GPU-wait warning
bake_volume_mesh returns null while the device comes up and the caller polls, so the warning fired every frame. In the full erosion map the GPU was ready at 6.2 s and the poll had already logged 9601 times by then -- a buried log, and load added to the very bring-up it was waiting for. Every 600th now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
a85a9151d0939be4e11caa7c9e74c67bf7a1980f
by plankatron <fleeky@gmail.com> · 2026-09-06T16:41:41.000Z

Changed files (1) +17 -4

src/dc_terrain.cpp +17 -4
……@@ -3211,19 +3211,32 @@ Ref<ArrayMesh> DCTerrain::bake_volume_mesh(const String &p_glsl, const Vector3 &
32113211 // terrain later enters game mode it finds gpu_thread_ non-null and reuses
32123212 // it. One device, ever. A second VkDevice is the 30.2 s starvation that
32133213 // left two meshers in one world (hyper-games #58).
3214 bool made_it_here = false;
32143215 if (!gpu_thread_) {
32153216 gpu_thread_ = std::make_unique<DCGpuThread>();
32163217 gpu_thread_->start();
3218 made_it_here = true;
3219 UtilityFunctions::print(
3220 "DCTerrain.bake_volume_mesh: no GPU thread existed, starting one "
3221 "(this instance was not streaming).");
32173222 }
3223 (void)made_it_here;
32183224 if (!gpu_thread_->is_available()) {
32193225 // NON-BLOCKING ON PURPOSE. Bring-up takes seconds, and blocking a bound
32203226 // call for that freezes the frame -- the same "right total, wrong shape"
32213227 // mistake the worker deferral records. Return null and let the caller
32223228 // ask again.
3223 UtilityFunctions::push_warning(
3224 "DCTerrain.bake_volume_mesh: the GPU is still coming up. This "
3225 "returns null rather than blocking the frame -- call again next "
3226 "frame.");
3229 static uint64_t s_waits = 0;
3230 if ((s_waits++ % 600) == 0) {
3231 // THROTTLED. Polling this every frame is normal -- the caller
3232 // cannot know when the device is up -- but a warning per frame
3233 // buries the log and adds load to the very bring-up it is waiting
3234 // for. Measured in the full map: ready at 6.2 s, and the poll had
3235 // already logged 9601 times by then.
3236 UtilityFunctions::push_warning(
3237 "DCTerrain.bake_volume_mesh: GPU still coming up (poll #",
3238 (int64_t)s_waits, "). Returning null rather than blocking.");
3239 }
32273240 return out;
32283241 }
32293242 if (p_cells < 1) p_cells = 1;