This commit is contained in:
mcrcortex
2025-05-23 09:48:16 +10:00
parent 90a3a16cc2
commit a1ace12042
3 changed files with 15 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ import me.cortex.voxy.client.TimingStatistics;
import me.cortex.voxy.client.core.gl.GlBuffer;
import me.cortex.voxy.client.core.gl.shader.Shader;
import me.cortex.voxy.client.core.gl.shader.ShaderType;
import me.cortex.voxy.client.core.rendering.GeometryCache;
import me.cortex.voxy.client.core.rendering.ISectionWatcher;
import me.cortex.voxy.client.core.rendering.building.BuiltSection;
import me.cortex.voxy.client.core.rendering.section.geometry.BasicAsyncGeometryManager;
@@ -61,6 +62,8 @@ public class AsyncNodeManager {
private final BasicAsyncGeometryManager geometryManager;
private final IGeometryData geometryData;
private final GeometryCache geometryCache = new GeometryCache(1L<<32);
private final AtomicInteger workCounter = new AtomicInteger();
@SuppressWarnings("FieldMayBeFinal")
@@ -740,6 +743,9 @@ public class AsyncNodeManager {
private long usedGeometry;
private final ComputeMemoryCopy geometryUpload = new ComputeMemoryCopy();
//Gpu geometry downloads
//Scatter writes for both geometry and node metadata
private MemoryBuffer scatterWriteBuffer = new MemoryBuffer(8192*2);

View File

@@ -132,12 +132,14 @@ public class NodeCleaner {
}
private boolean shouldCleanGeometry() {
//// if there is less than 200mb of space, clean
//return this.nodeManager.getGeometryManager().getRemainingCapacity() < 1_000_000_000L;
//If used more than 75% of geometry buffer
long used = this.nodeManager.getUsedGeometryCapacity();
return 3<((double)used)/((double)(this.nodeManager.getGeometryCapacity()-used));
if (false) {
//If used more than 75% of geometry buffer
long used = this.nodeManager.getUsedGeometryCapacity();
return 3 < ((double) used) / ((double) (this.nodeManager.getGeometryCapacity() - used));
} else {
long remaining = this.nodeManager.getGeometryCapacity() - this.nodeManager.getUsedGeometryCapacity();
return remaining < 256_000_000;//If less than 256 mb free memory
}
}
public void updateIds(IntOpenHashSet collection) {

View File

@@ -18,6 +18,7 @@ import me.cortex.voxy.common.world.WorldEngine;
import org.lwjgl.system.MemoryUtil;
import java.util.List;
import java.util.function.Consumer;
import static me.cortex.voxy.common.world.WorldEngine.MAX_LOD_LAYER;
import static me.cortex.voxy.common.world.WorldEngine.UPDATE_TYPE_BLOCK_BIT;
@@ -255,9 +256,6 @@ public class NodeManager {
//Removes geometry possible with downloading to cache
this.geometryManager.removeSection(id);
}
//TODO: FIXME: add method to clear geometry cache of position, or the geometry is empty etc jkdfgsl
// this is for cpu/ram side geometry caching
// TODO: IMPLEMENT
private int uploadReplaceSection(int meshId, BuiltSection section) {
if (section.isEmpty()) {