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 2ab0e221ce
commit b9ac4f1fdc
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();
}