Persistent buffers v1.5

- Add new sync function to GlBuffer
This commit is contained in:
Jozufozu 2021-08-14 13:33:17 -07:00
parent 5956fbfaa0
commit f82b9d2d23
3 changed files with 8 additions and 3 deletions

View file

@ -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);

View file

@ -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);
}

View file

@ -90,6 +90,9 @@ public class Instancer<D extends InstanceData> {
if (glInstanceCount > 0) model.drawInstances(glInstanceCount);
// persistent mapping sync point
instanceVBO.doneForThisFrame();
vao.unbind();
}