timing + other

This commit is contained in:
mcrcortex
2025-05-03 15:34:34 +10:00
parent 834253f0ae
commit 365ae58c70
6 changed files with 40 additions and 21 deletions

View File

@@ -73,6 +73,7 @@ public class TimingStatistics {
public static TimeSampler all = new TimeSampler();
public static TimeSampler main = new TimeSampler();
public static TimeSampler dynamic = new TimeSampler();
public static TimeSampler postDynamic = new TimeSampler();
public static void update() {

View File

@@ -200,6 +200,8 @@ public class VoxyRenderSystem {
this.postProcessing.renderPost(projection, matrices.projection(), boundFB);
TimingStatistics.main.stop();
TimingStatistics.postDynamic.start();
PrintfDebugUtil.tick();
@@ -211,11 +213,11 @@ public class VoxyRenderSystem {
this.renderDistanceTracker.setCenterAndProcess(cameraX, cameraZ);
//Done here as is allows less gl state resetup
this.renderer.tickModelService(5_000_000-(System.nanoTime()-startTime));
this.renderer.tickModelService(Math.max(5_000_000-(System.nanoTime()-startTime), 75_000));
}
TimingStatistics.postDynamic.stop();
glBindFramebuffer(GlConst.GL_FRAMEBUFFER, oldFB);
TimingStatistics.main.stop();
TimingStatistics.all.stop();
}
@@ -224,7 +226,7 @@ public class VoxyRenderSystem {
this.renderer.addDebugData(debug);
{
TimingStatistics.update();
debug.add("Voxy frame runtime (millis): " + TimingStatistics.dynamic.pVal() + ", " + TimingStatistics.main.pVal()+ ", " + TimingStatistics.all.pVal());
debug.add("Voxy frame runtime (millis): " + TimingStatistics.dynamic.pVal() + ", " + TimingStatistics.main.pVal()+ ", " + TimingStatistics.postDynamic.pVal()+ ", " + TimingStatistics.all.pVal());
}
PrintfDebugUtil.addToOut(debug);
}

View File

@@ -70,17 +70,16 @@ public class ModelBakerySubsystem {
VarHandle.fullFence();
{
long budget = Math.min(totalBudget-150_000, totalBudget-(this.factory.resultJobs.size()*10_000L))-150_000;
if (budget > 50_000) {
//Always do 1 iteration minimum
Integer i = this.blockIdQueue.poll();
if (i != null) {
do {
this.factory.addEntry(i);
if (budget<(System.nanoTime() - start)+1000)
break;
i = this.blockIdQueue.poll();
} while (i != null && (System.nanoTime() - start < budget));
if (i != null) {//We timedout on our budget and we have an entry so we must add it back
this.blockIdQueue.add(i);
}
}
} while (i != null);
}
}

View File

@@ -142,7 +142,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
//if (this.modelService.getProcessingCount() < 750)
{//Very bad hack to try control things
this.geometryUpdateQueue.consumeNano(2_000_000 - (System.nanoTime() - frameStart));
this.geometryUpdateQueue.consumeNano(3_000_000 - (System.nanoTime() - frameStart));
}
this.nodeCleaner.tick(this.traversal.getNodeBuffer());//Probably do this here??

View File

@@ -371,9 +371,16 @@ public class RenderDataFactory45 {
int iA = idx * 2 + (facingForward == 1 ? 0 : shift);
int iB = idx * 2 + (facingForward == 1 ? shift : 0);
//Check if next culls this face
if (false) {
if (ModelQueries.faceOccludes(this.sectionData[iB + 1], (axis << 1) | (1 - facingForward))) {
this.blockMesher.skip(1);
continue;
}
}
long selfModel = this.sectionData[iA];
long nextModel = this.sectionData[iB];
this.blockMesher.putNext(((long) facingForward) |//Facing
selfModel |
(nextModel & (0xFFL << 55))//Apply lighting
@@ -783,8 +790,19 @@ public class RenderDataFactory45 {
long B = this.sectionData[(idx + 1) * 2];
//Flip data with respect to facing direction
long selfModel = facingForward==1?A:B;
long nextModel = facingForward==1?B:A;
int iA = idx * 2 + (facingForward == 1 ? 0 : 2);
int iB = idx * 2 + (facingForward == 1 ? 2 : 0);
//Check if next culls this face
if (false) {
if (ModelQueries.faceOccludes(this.sectionData[iB + 1], (2 << 1) | (1 - facingForward))) {
mesher.skip(1);
continue;
}
}
long selfModel = this.sectionData[iA];
long nextModel = this.sectionData[iB];
//Example thing thats just wrong but as example
mesher.putNext(((long) facingForward) |//Facing

View File

@@ -51,8 +51,7 @@ public class SaveLoadSystem3 {
long metadataPtr = ptr; ptr += 8;
long blockPtr = ptr; ptr += WorldSection.SECTION_VOLUME*2;
for (int i = 0; i < WorldSection.SECTION_VOLUME; i++) {
long block = data[i];
for (long block : data) {
short mapping = LUT.putIfAbsent(block, (short) LUT.size());
if (mapping == -1) {
mapping = (short) (LUT.size()-1);