This commit is contained in:
mcrcortex
2025-04-27 11:53:39 +10:00
parent 6d99f45412
commit aed8366206
4 changed files with 28 additions and 10 deletions

View File

@@ -176,9 +176,9 @@ public class ModelTextureBakery {
//SOMEBODY PLEASE FUCKING EXPLAIN TO ME WHY MUST CLEAR THE FRAMEBUFFER HERE WHEN IT IS LITERALLY CLEARED AT THE START OF THE FRAME
// WITHOUT THIS, WATER DOESNT RENDER
//TODO: FIXME, WHAT THE ACTUAL FUCK
//glBindFramebuffer(GL_FRAMEBUFFER, this.capture.framebuffer.id);
//glClearDepth(1);
//glClear(GL_DEPTH_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, this.capture.framebuffer.id);
glClearDepth(1);
glClear(GL_DEPTH_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, 0);

View File

@@ -100,7 +100,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
this.nodeManager.removeTopLevelNode(pos);
}
public void setup(Camera camera) {
public void tickModelService() {
this.modelService.tick();
}
@@ -135,7 +135,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
//Cap the number of consumed sections per frame to 40 + 2% of the queue size, cap of 200
//int geoUpdateCap = 20;//Math.max(100, Math.min((int)(0.15*this.geometryUpdateQueue.count()), 260));
this.geometryUpdateQueue.consumeMillis(2);
this.geometryUpdateQueue.consumeMillis(1);
if (this.nodeManager.writeChanges(this.traversal.getNodeBuffer())) {//TODO: maybe move the node buffer out of the traversal class
UploadStream.INSTANCE.commit();
}

View File

@@ -31,6 +31,7 @@ import org.joml.Matrix4f;
import org.lwjgl.opengl.GL11;
import org.lwjgl.system.MemoryUtil;
import java.lang.invoke.VarHandle;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@@ -45,6 +46,7 @@ public class VoxyRenderSystem {
private final PostProcessing postProcessing;
private final WorldEngine worldIn;
private final RenderDistanceTracker renderDistanceTracker;
private long runTimeNano = 0;
public VoxyRenderSystem(WorldEngine world, ServiceThreadPool threadPool) {
//Trigger the shared index buffer loading
@@ -98,11 +100,18 @@ public class VoxyRenderSystem {
downstream.submit();
downstream.tick();
}*/
VarHandle.fullFence();
long start = System.nanoTime();
VarHandle.fullFence();
this.renderDistanceTracker.setCenterAndProcess(camera.getBlockPos().getX(), camera.getBlockPos().getZ());
this.renderer.setup(camera);
this.renderer.tickModelService();
PrintfDebugUtil.tick();
VarHandle.fullFence();
this.runTimeNano = System.nanoTime() - start;
VarHandle.fullFence();
}
private static Matrix4f makeProjectionMatrix(float near, float far) {
@@ -128,9 +137,9 @@ public class VoxyRenderSystem {
}
public void renderOpaque(MatrixStack matrices, double cameraX, double cameraY, double cameraZ) {
//if (true) return;
VarHandle.fullFence();
long startTime = System.nanoTime();
VarHandle.fullFence();
if (IrisUtil.irisShadowActive()) {
return;
@@ -200,11 +209,20 @@ public class VoxyRenderSystem {
this.postProcessing.renderPost(projection, RenderSystem.getProjectionMatrix(), boundFB);
glBindFramebuffer(GlConst.GL_FRAMEBUFFER, oldFB);
VarHandle.fullFence();
this.runTimeNano += System.nanoTime() - startTime;
VarHandle.fullFence();
}
private double role = 0;
public void addDebugInfo(List<String> debug) {
debug.add("GlBuffer, Count/Size (mb): " + GlBuffer.getCount() + "/" + (GlBuffer.getTotalSize()/1_000_000));
this.renderer.addDebugData(debug);
double aa = (((double)(this.runTimeNano/1000))/1000);
this.role = Math.max(Math.ceil((this.role * 0.99 + (aa*0.01))*1000)/1000, aa);
debug.add("Voxy frame runtime (millis): " + this.role);
PrintfDebugUtil.addToOut(debug);
}

View File

@@ -25,7 +25,7 @@ public class VoxelIngestService {
private final ConcurrentLinkedDeque<IngestSection> ingestQueue = new ConcurrentLinkedDeque<>();
public VoxelIngestService(ServiceThreadPool pool) {
this.threads = pool.createServiceNoCleanup("Ingest service", 1000, ()-> this::processJob);
this.threads = pool.createServiceNoCleanup("Ingest service", 5000, ()-> this::processJob);
}
private void processJob() {