more debug

This commit is contained in:
mcrcortex
2025-09-13 21:25:15 +10:00
parent 9edb680114
commit 1b023f859b
2 changed files with 9 additions and 3 deletions

View File

@@ -107,12 +107,14 @@ public class BasicAsyncGeometryManager implements IGeometryManager {
private SectionMeta createMeta(BuiltSection section) { private SectionMeta createMeta(BuiltSection section) {
if ((section.geometryBuffer.size%GEOMETRY_ELEMENT_SIZE)!=0) throw new IllegalStateException(); if ((section.geometryBuffer.size%GEOMETRY_ELEMENT_SIZE)!=0) throw new IllegalStateException();
int size = (int) (section.geometryBuffer.size/GEOMETRY_ELEMENT_SIZE); int size = (int) (section.geometryBuffer.size/GEOMETRY_ELEMENT_SIZE);
//clamp size upwards
int upsized = (size+511)&~511;
//Address //Address
int addr = (int)this.allocationHeap.alloc(size); int addr = (int)this.allocationHeap.alloc(upsized);
if (addr == -1) { 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 //Create upload
if (this.heapUploads.put(addr, section.geometryBuffer) != null) { if (this.heapUploads.put(addr, section.geometryBuffer) != null) {
throw new IllegalStateException("Addr: " + addr); throw new IllegalStateException("Addr: " + addr);

View File

@@ -190,4 +190,8 @@ public class AllocationArena {
throw new IllegalStateException("Size set smaller than current size"); throw new IllegalStateException("Size set smaller than current size");
} }
} }
public long getLimit() {
return this.sizeLimit;
}
} }