From d3c280d298b3f5edf315d4d9ea198ea69076befb Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Sun, 21 Aug 2022 20:56:22 -0700 Subject: [PATCH] Fix flickering with batching - Call syncPoint before submitting tasks - Reset DrawBuffer even if it has no vertices when drawing --- .../backend/instancing/batching/BatchingDrawTracker.java | 3 ++- .../flywheel/backend/instancing/batching/BatchingEngine.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingDrawTracker.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingDrawTracker.java index 57909678b..97afc1e3b 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingDrawTracker.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingDrawTracker.java @@ -53,8 +53,9 @@ public class BatchingDrawTracker { BufferBuilderExtension scratch = (BufferBuilderExtension) this.scratch; buffer.inject(scratch); renderType.end(this.scratch, 0, 0, 0); - buffer.reset(); } + + buffer.reset(); } /** diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java index 728ceeaf5..1ce22ab22 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java @@ -48,6 +48,8 @@ public class BatchingEngine implements Engine { var stack = FlwUtil.copyPoseStack(context.stack()); stack.translate(-cameraPos.x, -cameraPos.y, -cameraPos.z); + // TODO: async task engine barriers + taskEngine.syncPoint(); submitTasks(taskEngine, stack, context.level()); }