From 0af463dc55e84f97329892396bb667e746f9992d Mon Sep 17 00:00:00 2001 From: douira Date: Mon, 8 Jan 2024 20:30:14 +0100 Subject: [PATCH] only mark as needing a graph update if the uploads could have changed the graph, since sort results never change the graph --- .../render/chunk/RenderSectionManager.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager.java index 99c1babb5b..a7f7db5bc2 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/RenderSectionManager.java @@ -296,27 +296,29 @@ public void uploadChunks() { return; } - this.processChunkBuildResults(results); + // only mark as needing a graph update if the uploads could have changed the graph + // (sort results never change the graph) + // generally there's no sort results without a camera movement, which would also trigger + // a graph update, but it can sometimes happen because of async task execution + this.needsGraphUpdate = this.needsGraphUpdate || this.processChunkBuildResults(results); for (var result : results) { result.deleteAfterUploadSafe(); } - - // TODO: only needed if the tasks actually changed the visibility (sort tasks - // don't count, though there would never be a sort task without camera movement - // so it likely doesn't matter) - this.needsGraphUpdate = true; } - private void processChunkBuildResults(ArrayList results) { + private boolean processChunkBuildResults(ArrayList results) { var filtered = filterChunkBuildResults(results); this.regions.uploadResults(RenderDevice.INSTANCE.createCommandList(), filtered); + boolean touchedSectionInfo = false; for (var result : filtered) { TranslucentData oldData = result.render.getTranslucentData(); if (result instanceof ChunkBuildOutput chunkBuildOutput) { this.updateSectionInfo(result.render, chunkBuildOutput.info); + touchedSectionInfo = true; + if (chunkBuildOutput.translucentData != null) { this.ts.integrateTranslucentData(oldData, chunkBuildOutput.translucentData, this.cameraPosition, this::scheduleSort); @@ -338,6 +340,8 @@ private void processChunkBuildResults(ArrayList results) { result.render.setLastUploadFrame(result.submitTime); } + + return touchedSectionInfo; } private void updateSectionInfo(RenderSection render, BuiltSectionInfo info) {