use of io.xol.chunkstories.api.rendering.vertex.RecyclableByteBuffer in project chunkstories by Hugobros3.
the class VertexBufferGL method uploadData.
/* (non-Javadoc)
* @see io.xol.engine.graphics.geometry.VertexBuffer#uploadData(io.xol.chunkstories.renderer.buffers.ByteBufferPool.RecyclableByteBuffer)
*/
@Override
public Fence uploadData(RecyclableByteBuffer dataToUpload) {
if (glID == -2)
throw new RuntimeException("Illegal operation : Attempted to upload data to a destroyed VerticesObject !");
// Queue for immediate upload
if (Client.getInstance().getGameWindow().isMainGLWindow()) {
Object replacing = waitingToUploadMainThread;
waitingToUploadMainThread = dataToUpload;
if (replacing != null && replacing != dataToUpload && replacing instanceof RecyclableByteBuffer) {
// System.out.println("Watch out, uploading two RecyclableByteBuffer in a row, the first one is getting recycled early to prevent locks");
RecyclableByteBuffer rcb = (RecyclableByteBuffer) replacing;
rcb.recycle();
}
dataSize = dataToUpload.accessByteBuffer().limit();
return new TrivialFence();
}
// This is a deffered call
return setAsyncDataPendingUpload(dataToUpload);
// pendingAsyncUpload = dataToUpload;
// return false;
}
Aggregations