Class GlBuffer
java.lang.Object
com.jozufozu.flywheel.backend.gl.GlObject
com.jozufozu.flywheel.backend.gl.buffer.GlBuffer
- Direct Known Subclasses:
MappedGlBuffer,PersistentGlBuffer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longThe size (in bytes) of the buffer on the GPU.protected intHow much extra room to give the buffer when we reallocate.protected final GlBufferType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_create()protected abstract voidalloc(long size) voidbind()protected voiddeleteInternal(int handle) voidCall this after all draw calls using this buffer are complete.booleanensureCapacity(long size) Ensure that the buffer has at least enough room to store size bytes.abstract MappedBuffergetBuffer(long offset, long length) longstatic GlBufferRequest a Persistent mapped buffer.voidsetGrowthMargin(int growthMargin) voidunbind()abstract voidupload(ByteBuffer directBuffer) Methods inherited from class com.jozufozu.flywheel.backend.gl.GlObject
checkHandle, delete, handle, invalidateHandle, isInvalid, setHandle
-
Field Details
-
type
-
capacity
protected long capacityThe size (in bytes) of the buffer on the GPU. -
growthMargin
protected int growthMarginHow much extra room to give the buffer when we reallocate.
-
-
Constructor Details
-
GlBuffer
-
-
Method Details
-
requestPersistent
Request a Persistent mapped buffer.If Persistent buffers are supported, this will provide one. Otherwise it will fall back to a classic mapped buffer.
- Parameters:
type- The type of buffer you want.- Returns:
- A buffer that will be persistent if the driver supports it.
-
setGrowthMargin
public void setGrowthMargin(int growthMargin) -
getCapacity
public long getCapacity() -
getBuffer
-
getBuffer
-
ensureCapacity
public boolean ensureCapacity(long size) Ensure that the buffer has at least enough room to store size bytes.- Returns:
- true if the buffer grew.
-
doneForThisFrame
public void doneForThisFrame()Call this after all draw calls using this buffer are complete. -
alloc
protected abstract void alloc(long size) -
upload
-
bind
public void bind() -
unbind
public void unbind() -
_create
protected void _create() -
deleteInternal
protected void deleteInternal(int handle) - Specified by:
deleteInternalin classGlObject
-