Beans
This commit is contained in:
@@ -60,11 +60,12 @@ public class RenderService<T extends AbstractSectionRenderer<J, Q>, J extends Vi
|
|||||||
this.modelService = new ModelBakerySubsystem(world.getMapper());
|
this.modelService = new ModelBakerySubsystem(world.getMapper());
|
||||||
|
|
||||||
long geometryCapacity = getGeometryBufferSize();
|
long geometryCapacity = getGeometryBufferSize();
|
||||||
|
|
||||||
this.geometryData = (Q) new BasicSectionGeometryData(1<<20, geometryCapacity);
|
this.geometryData = (Q) new BasicSectionGeometryData(1<<20, geometryCapacity);
|
||||||
|
|
||||||
//Max sections: ~500k
|
//Max sections: ~500k
|
||||||
this.sectionRenderer = (T) new MDICSectionRenderer(this.modelService.getStore(), (BasicSectionGeometryData) this.geometryData);
|
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
|
//Do something incredibly hacky, we dont need to keep the reference to this around, so just connect and discard
|
||||||
var router = new SectionUpdateRouter();
|
var router = new SectionUpdateRouter();
|
||||||
|
|||||||
@@ -223,8 +223,10 @@ public class AsyncNodeManager {
|
|||||||
job.release();
|
job.release();
|
||||||
} while (true);
|
} 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();
|
var job = this.geometryUpdateQueue.poll();
|
||||||
if (job == null)
|
if (job == null)
|
||||||
|
|||||||
@@ -63,12 +63,20 @@ public class BasicAsyncGeometryManager implements IGeometryManager {
|
|||||||
throw new IllegalStateException("Size exceeds limits: " + newId + ", " + this.sectionMetadata.size() + ", " + this.allocationSet.getCount());
|
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);
|
var newMeta = this.createMeta(section);
|
||||||
|
|
||||||
if (newId == this.sectionMetadata.size()) {
|
if (newId == this.sectionMetadata.size()) {
|
||||||
this.sectionMetadata.add(newMeta);
|
this.sectionMetadata.add(newMeta);
|
||||||
} else {
|
} else {
|
||||||
this.sectionMetadata.set(newId, newMeta);
|
if (this.sectionMetadata.set(newId, newMeta) != null) {
|
||||||
|
throw new IllegalStateException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Invalidate the section id
|
//Invalidate the section id
|
||||||
@@ -101,10 +109,13 @@ public class BasicAsyncGeometryManager implements IGeometryManager {
|
|||||||
int size = (int) (section.geometryBuffer.size/GEOMETRY_ELEMENT_SIZE);
|
int size = (int) (section.geometryBuffer.size/GEOMETRY_ELEMENT_SIZE);
|
||||||
//Address
|
//Address
|
||||||
int addr = (int)this.allocationHeap.alloc(size);
|
int addr = (int)this.allocationHeap.alloc(size);
|
||||||
|
if (addr == -1) {
|
||||||
|
throw new IllegalStateException("Geometry OOM");
|
||||||
|
}
|
||||||
this.usedCapacity += size;
|
this.usedCapacity += size;
|
||||||
//Create upload
|
//Create upload
|
||||||
if (this.heapUploads.put(addr, section.geometryBuffer) != null) {
|
if (this.heapUploads.put(addr, section.geometryBuffer) != null) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException("Addr: " + addr);
|
||||||
}
|
}
|
||||||
this.heapRemoveUploads.remove(addr);
|
this.heapRemoveUploads.remove(addr);
|
||||||
//Create Meta
|
//Create Meta
|
||||||
|
|||||||
Reference in New Issue
Block a user