Fix bakery ™️

This commit is contained in:
mcrcortex
2024-07-30 10:42:33 +10:00
parent 87f7d71c94
commit 433f3ace9f
6 changed files with 26 additions and 17 deletions

View File

@@ -607,7 +607,7 @@ public class ModelFactory {
glDeleteSamplers(this.blockSampler);
}
public void addDebugInfo(List<String> info) {
info.add("BlockModels registered: " + this.modelTexture2id.size() + "/" + (1<<16));
public int getBakedCount() {
return this.modelTexture2id.size();
}
}

View File

@@ -23,16 +23,24 @@ public class OnThreadModelBakerySystem {
}
public void tick() {
if (!this.blockIdQueue.isEmpty()) {
int blockId = -1;
synchronized (this.blockIdQueue) {
if (!this.blockIdQueue.isEmpty()) {
blockId = this.blockIdQueue.removeFirstInt();
VarHandle.fullFence();//Ensure memory coherancy
//There should be a method to access the frame time IIRC, if the user framecap is unlimited lock it to like 60 fps for computation
int BUDGET = 5;//TODO: make this computed based on the remaining free time in a frame (and like div by 2 to reduce overhead) (with a min of 1)
for (int i = 0; i < BUDGET; i++) {
if (!this.blockIdQueue.isEmpty()) {
int blockId = -1;
synchronized (this.blockIdQueue) {
if (!this.blockIdQueue.isEmpty()) {
blockId = this.blockIdQueue.removeFirstInt();
VarHandle.fullFence();//Ensure memory coherancy
} else {
break;
}
}
}
if (blockId != -1) {
this.factory.addEntry(blockId);
if (blockId != -1) {
this.factory.addEntry(blockId);
}
} else {
break;
}
}
}
@@ -51,6 +59,6 @@ public class OnThreadModelBakerySystem {
}
public void addDebugData(List<String> debug) {
debug.add("MBQ/MBC: " + this.blockIdQueue.size() + "/"+ this.factory.getBakedCount());//Model bake queue/model baked count
}
}

View File

@@ -27,7 +27,7 @@ public class RenderService {
}
private void consumeRenderBuildResult(BuiltSection section) {
System.err.println("Section " + WorldEngine.pprintPos(section.position));
//System.err.println("Section " + WorldEngine.pprintPos(section.position));
section.free();
}

View File

@@ -229,6 +229,6 @@ public class RenderGenerationService {
}
public void addDebugData(List<String> debug) {
debug.add("RMQ: " + this.taskQueue.size());//render mesh queue
}
}

View File

@@ -142,7 +142,6 @@ public abstract class AbstractFarWorldRenderer <T extends Viewport, J extends Ab
}
public void addDebugData(List<String> debug) {
this.models.addDebugInfo(debug);
debug.add("Geometry buffer usage: " + ((float)Math.round((this.geometry.getGeometryBufferUsage()*100000))/1000) + "%");
debug.add("Render Sections: " + this.geometry.getSectionCount());
}

View File

@@ -56,8 +56,10 @@ void setupScreenspace(in UnpackedNode node) {
}
//TODO: MORE ACCURATLY DETERMIN SCREENSPACE AREA, this can be done by computing and adding
// the projected surface area of each face which winding order faces the camera
// (this is just the dot product of 2 projected vectors afaik)
// the projected surface area of each face/quad which winding order faces the camera
// (this is just the dot product of 2 projected vectors)
//can do a funny by not doing the perspective divide except on the output of the area
//printf("Screenspace MIN: %f, %f, %f MAX: %f, %f, %f", minBB.x,minBB.y,minBB.z, maxBB.x,maxBB.y,maxBB.z);