From 5c8f2a43cb3b655ef4a49aa329231fe774a6e90d Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Tue, 20 May 2025 10:09:37 +1000 Subject: [PATCH] Fix cleaning, add assertion --- .../core/rendering/building/RenderGenerationService.java | 3 +++ .../core/rendering/hierachical/AsyncNodeManager.java | 9 +++++++-- .../java/me/cortex/voxy/commonImpl/VoxyInstance.java | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderGenerationService.java b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderGenerationService.java index bdeaa96c..08693405 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderGenerationService.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderGenerationService.java @@ -337,6 +337,9 @@ public class RenderGenerationService { } this.taskMapLock.unlockWrite(stamp); } + if (this.taskQueueCount.get() != 0) { + throw new IllegalStateException(); + } } private long lastChangedTime = 0; diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/hierachical/AsyncNodeManager.java b/src/main/java/me/cortex/voxy/client/core/rendering/hierachical/AsyncNodeManager.java index 443754f7..c21646c0 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/hierachical/AsyncNodeManager.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/hierachical/AsyncNodeManager.java @@ -667,7 +667,6 @@ public class AsyncNodeManager { throw new RuntimeException(e); } - //TODO CLEAN while (true) { var buffer = this.requestBatchQueue.poll(); if (buffer == null) break; @@ -675,7 +674,7 @@ public class AsyncNodeManager { } while (true) { - var buffer = this.requestBatchQueue.poll(); + var buffer = this.removeBatchQueue.poll(); if (buffer == null) break; buffer.free(); } @@ -686,6 +685,12 @@ public class AsyncNodeManager { buffer.free(); } + while (true) { + var section = this.childUpdateQueue.poll(); + if (section == null) break; + section.release(); + } + if (RESULT_HANDLE.get(this) != null) { var result = (SyncResults)RESULT_HANDLE.getAndSet(this, null); result.geometryUpload.free(); diff --git a/src/main/java/me/cortex/voxy/commonImpl/VoxyInstance.java b/src/main/java/me/cortex/voxy/commonImpl/VoxyInstance.java index 9555f437..496c4752 100644 --- a/src/main/java/me/cortex/voxy/commonImpl/VoxyInstance.java +++ b/src/main/java/me/cortex/voxy/commonImpl/VoxyInstance.java @@ -127,7 +127,7 @@ public class VoxyInstance { this.importManager.cancelImport(world); if (world.getActiveSectionCount() != 0) { - Logger.warn("Waiting for world to finish use"); + Logger.warn("Waiting for world to finish use: " + world ); while (world.getActiveSectionCount() != 0) { try { Thread.sleep(100);