This commit is contained in:
mcrcortex
2025-05-18 10:35:03 +10:00
parent fc612c608f
commit 9be68ac2f4
3 changed files with 19 additions and 5 deletions

View File

@@ -60,11 +60,12 @@ public class RenderService<T extends AbstractSectionRenderer<J, Q>, J extends Vi
this.modelService = new ModelBakerySubsystem(world.getMapper());
long geometryCapacity = getGeometryBufferSize();
this.geometryData = (Q) new BasicSectionGeometryData(1<<20, geometryCapacity);
//Max sections: ~500k
this.sectionRenderer = (T) new MDICSectionRenderer(this.modelService.getStore(), (BasicSectionGeometryData) this.geometryData);
Logger.info("Using renderer: " + this.sectionRenderer.getClass().getSimpleName());
Logger.info("Using renderer: " + this.sectionRenderer.getClass().getSimpleName() + " with geometry buffer of: " + geometryCapacity + " bytes");
//Do something incredibly hacky, we dont need to keep the reference to this around, so just connect and discard
var router = new SectionUpdateRouter();

View File

@@ -223,8 +223,10 @@ public class AsyncNodeManager {
job.release();
} while (true);
final int UPLOAD_LIMIT = 500;
for (int limit = 0; limit < UPLOAD_LIMIT/2; limit++) //Limit uploading, TODO: limit this by frame sync count, not here
//Limit uploading as well as by geometry capacity being available
// must have 50 mb of free geometry space to upload
for (int limit = 0; limit < 200 && (this.geometryCapacity-this.geometryManager.getGeometryUsedBytes())>50_000_000; limit++)
{
var job = this.geometryUpdateQueue.poll();
if (job == null)

View File

@@ -63,12 +63,20 @@ public class BasicAsyncGeometryManager implements IGeometryManager {
throw new IllegalStateException("Size exceeds limits: " + newId + ", " + this.sectionMetadata.size() + ", " + this.allocationSet.getCount());
}
if (newId < this.sectionMetadata.size()) {
if (this.sectionMetadata.get(newId) != null) {
throw new IllegalStateException();
}
}
var newMeta = this.createMeta(section);
if (newId == this.sectionMetadata.size()) {
this.sectionMetadata.add(newMeta);
} else {
this.sectionMetadata.set(newId, newMeta);
if (this.sectionMetadata.set(newId, newMeta) != null) {
throw new IllegalStateException();
}
}
//Invalidate the section id
@@ -101,10 +109,13 @@ public class BasicAsyncGeometryManager implements IGeometryManager {
int size = (int) (section.geometryBuffer.size/GEOMETRY_ELEMENT_SIZE);
//Address
int addr = (int)this.allocationHeap.alloc(size);
if (addr == -1) {
throw new IllegalStateException("Geometry OOM");
}
this.usedCapacity += size;
//Create upload
if (this.heapUploads.put(addr, section.geometryBuffer) != null) {
throw new IllegalStateException();
throw new IllegalStateException("Addr: " + addr);
}
this.heapRemoveUploads.remove(addr);
//Create Meta