From 1b023f859ba12b9946660a77e8af0a48ed2f86b4 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Sat, 13 Sep 2025 21:25:15 +1000 Subject: [PATCH] more debug --- .../section/geometry/BasicAsyncGeometryManager.java | 8 +++++--- .../java/me/cortex/voxy/common/util/AllocationArena.java | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/section/geometry/BasicAsyncGeometryManager.java b/src/main/java/me/cortex/voxy/client/core/rendering/section/geometry/BasicAsyncGeometryManager.java index 2e705641..3d0e9832 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/section/geometry/BasicAsyncGeometryManager.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/section/geometry/BasicAsyncGeometryManager.java @@ -107,12 +107,14 @@ public class BasicAsyncGeometryManager implements IGeometryManager { private SectionMeta createMeta(BuiltSection section) { if ((section.geometryBuffer.size%GEOMETRY_ELEMENT_SIZE)!=0) throw new IllegalStateException(); int size = (int) (section.geometryBuffer.size/GEOMETRY_ELEMENT_SIZE); + //clamp size upwards + int upsized = (size+511)&~511; //Address - int addr = (int)this.allocationHeap.alloc(size); + int addr = (int)this.allocationHeap.alloc(upsized); if (addr == -1) { - throw new IllegalStateException("Geometry OOM"); + throw new IllegalStateException("Geometry OOM. requested allocation size (in elements): " + size + ", Heap size at top remaining: " + (this.allocationHeap.getLimit()-this.allocationHeap.getSize()) + ", used elements: " + this.usedCapacity); } - this.usedCapacity += size; + this.usedCapacity += upsized; //Create upload if (this.heapUploads.put(addr, section.geometryBuffer) != null) { throw new IllegalStateException("Addr: " + addr); diff --git a/src/main/java/me/cortex/voxy/common/util/AllocationArena.java b/src/main/java/me/cortex/voxy/common/util/AllocationArena.java index 2d99af6f..e2b2ceec 100644 --- a/src/main/java/me/cortex/voxy/common/util/AllocationArena.java +++ b/src/main/java/me/cortex/voxy/common/util/AllocationArena.java @@ -190,4 +190,8 @@ public class AllocationArena { throw new IllegalStateException("Size set smaller than current size"); } } + + public long getLimit() { + return this.sizeLimit; + } }