diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java b/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java index 83b1a253d..29fdd16db 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java +++ b/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/GlBuffer.java @@ -27,6 +27,10 @@ public abstract class GlBuffer extends GlObject { GL20.glBindBuffer(type.glEnum, 0); } + public void doneForThisFrame() { + + } + public abstract void alloc(long size); public abstract void upload(ByteBuffer directBuffer); diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/PersistentGlBuffer.java b/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/PersistentGlBuffer.java index 49c0876b4..d58bc8e23 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/PersistentGlBuffer.java +++ b/src/main/java/com/jozufozu/flywheel/backend/gl/buffer/PersistentGlBuffer.java @@ -20,9 +20,7 @@ public class PersistentGlBuffer extends GlBuffer { } @Override - public void unbind() { - super.unbind(); - + public void doneForThisFrame() { fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/Instancer.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/Instancer.java index 87069f7db..6d72a12da 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/Instancer.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/Instancer.java @@ -90,6 +90,9 @@ public class Instancer { if (glInstanceCount > 0) model.drawInstances(glInstanceCount); + // persistent mapping sync point + instanceVBO.doneForThisFrame(); + vao.unbind(); }