Class GPUPoolBehavior<T extends GPUMemoryPool.InternalMemory<D>,D>
-
Field Summary
FieldsModifier and TypeFieldDescriptionBiFunction<Long,? super GPUMemoryPool<T, D>, Long> BiFunction<Long,? super GPUMemoryPool<T, D>, Long> longintFunction<? super GPUMemoryPool<T,D>, Boolean> Consumer<? super GPUMemoryPool<T,D>> Consumer<? super GPUMemoryPool<T,D>> Consumer<? super GPUMemoryPool<T,D>> final intbooleanlongfinal GPUMemoryPool.MemoryBuilder<T,D> final GPUMemoryPool.MemoryBuilder<T,D> booleanintboolean -
Constructor Summary
ConstructorsConstructorDescriptionGPUPoolBehavior(int glTarget, GPUMemoryPool.MemoryBuilder<T, D> newEmptyMemory, GPUMemoryPool.MemoryBuilder<T, D> newNotEmptyMemory) GPUPoolBehavior(GPUPoolBehavior<T, D> src) Shallow copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionsetBufferAccessBits(int access) Only effective whenimmutableBufferAllowwastrue, and related OpenGL features was supported.setBufferExpendRule(BiFunction<Long, ? super GPUMemoryPool<T, D>, Long> bufferExpendRule) The behavior of re‑creating a larger‑capacity Buffer object when the current memory space is insufficient.setBufferInitRule(BiFunction<Long, ? super GPUMemoryPool<T, D>, Long> bufferInitRule) The memory allocation behavior when malloc is first called after initialization.setContextRequirements(Function<? super GPUMemoryPool<T, D>, Boolean> glContextRequirements) The creation conditions of the memory pool, will check it when pool initializations.setDefaultBufferSize(long defaultBufferSize) A nonnegative integer.setImmutableBufferAllow(boolean immutableBufferAllow) falsewhen not create an immutable buffer even if supported.setMaxBufferSize(long maxBufferSize) A nonnegative integer.setNewMemoryFormat(GPUMemoryPool.MemoryFormat<T, D> format) The behavior of make a new memory region byGPUMemoryPool.malloc(Object, long)and then check or write data into memory; withoutGL15.glBindBuffer(int, int)before or after this calls, so you should be bind and unbind your buffer in method.setPoolDestroy(Consumer<? super GPUMemoryPool<T, D>> glPoolDestroy) At end of the buffer objectGPUMemoryPool.destroy(), for delete some vao/texture object.setPoolInit(Consumer<? super GPUMemoryPool<T, D>> glPoolInit) At end of the buffer objectGPUMemoryPool.init().setRebindBuffer(Consumer<? super GPUMemoryPool<T, D>> glRebindBuffer) After a new buffer has created, maybe you want to bind it to any location in shader; withoutGL15.glBindBuffer(int, int)before or after this calls, so you should be bind and unbind your buffer in method.setReservedSize(int reservedSize) A nonnegative integer.setUseDynamicStorageBuffer(boolean useDynamicStorageBuffer) Only effective whenimmutableBufferAllowwastrue.
-
Field Details
-
immutableBufferAllow
public boolean immutableBufferAllow -
useDynamicStorageBuffer
public boolean useDynamicStorageBuffer -
persistentMappingAllow
public boolean persistentMappingAllow -
glTarget
public final int glTarget -
glBufferAccessBits
public int glBufferAccessBits -
reservedSize
public int reservedSize -
defaultBufferSize
public long defaultBufferSize -
maxBufferSize
public long maxBufferSize -
glContextRequirements
public Function<? super GPUMemoryPool<T extends GPUMemoryPool.InternalMemory<D>,D>, glContextRequirementsBoolean> -
glRebindBuffer
-
glPoolInit
-
glPoolDestroy
-
bufferInitRule
@NotNull public BiFunction<Long,? super GPUMemoryPool<T extends GPUMemoryPool.InternalMemory<D>, bufferInitRuleD>, Long> -
bufferExpendRule
@NotNull public BiFunction<Long,? super GPUMemoryPool<T extends GPUMemoryPool.InternalMemory<D>, bufferExpendRuleD>, Long> -
newEmptyMemory
public final GPUMemoryPool.MemoryBuilder<T extends GPUMemoryPool.InternalMemory<D>,D> newEmptyMemory -
newNotEmptyMemory
public final GPUMemoryPool.MemoryBuilder<T extends GPUMemoryPool.InternalMemory<D>,D> newNotEmptyMemory -
newMemoryFormat
-
-
Constructor Details
-
GPUPoolBehavior
public GPUPoolBehavior(int glTarget, @NotNull GPUMemoryPool.MemoryBuilder<T, D> newEmptyMemory, @NotNull GPUMemoryPool.MemoryBuilder<T, D> newNotEmptyMemory) - Parameters:
glTarget- the type of buffer, for example:GL15.GL_ARRAY_BUFFER,GL31.GL_TEXTURE_BUFFER,GL31.GL_UNIFORM_BUFFERetc.newEmptyMemory- for example:(meta, address, size, index, pool) -> new InternalMemory<>(meta, address, size, index, true)newNotEmptyMemory- for example:(meta, address, size, index, pool) -> new InternalMemory<>(meta, address, size, index, false)
-
GPUPoolBehavior
Shallow copy constructor.Do not forget to check if any functional interface have reference of src field.
-
-
Method Details
-
setImmutableBufferAllow
falsewhen not create an immutable buffer even if supported. For default value wastrue. -
setUseDynamicStorageBuffer
Only effective whenimmutableBufferAllowwastrue.The memory pool may be updated after creation through calls to
GL15.glBufferSubData(int, long, java.nio.ByteBuffer)when set totrue.For default value was
true. -
setBufferAccessBits
Only effective whenimmutableBufferAllowwastrue, and related OpenGL features was supported.It must be a bitwise combination of a subset of the following flags:
GL30.GL_MAP_READ_BIT,GL30.GL_MAP_WRITE_BIT,GL44.GL_MAP_PERSISTENT_BIT,GL44.GL_MAP_COHERENT_BIT,GL44.GL_CLIENT_STORAGE_BIT, otherwise set to0.If access contains
GL44.GL_MAP_PERSISTENT_BIT, must contain at least one ofGL30.GL_MAP_READ_BITorGL30.GL_MAP_WRITE_BIT.If access contains
GL44.GL_MAP_COHERENT_BIT, it must also containGL44.GL_MAP_PERSISTENT_BIT, and you should be use barrier and/or sync to ensure client/server can see the read/write commands at after.For default value was
GL_MAP_WRITE_BIT. -
setReservedSize
A nonnegative integer.The reserved size from the start of buffer in
byte, this memory is not part of the pool's accessible memory. -
setDefaultBufferSize
A nonnegative integer.The initialized size of buffer in
byte. -
setMaxBufferSize
A nonnegative integer.Limit value that the buffer object has an explicit size limit defined by the OpenGL specification in
byte, otherwise set to0.When a new buffer object will create with unsupported size, an
OutOfMemoryErrorwill be thrown. -
setContextRequirements
public GPUPoolBehavior<T,D> setContextRequirements(Function<? super GPUMemoryPool<T, D>, Boolean> glContextRequirements) The creation conditions of the memory pool, will check it when pool initializations.Returns
falsewhen not supported on current device, otherwisetrue.nullwhen OpenGL 1.5 required only. -
setRebindBuffer
After a new buffer has created, maybe you want to bind it to any location in shader; withoutGL15.glBindBuffer(int, int)before or after this calls, so you should be bind and unbind your buffer in method.NOTE: For objects that are private to the OpenGL context – such as a VBO thread pool with an associated VAO – the reBind operation should dispatch a signal (or closure) to the actual thread that requires it, thereby deferring VAO configuration to be performed on that thread.
nullwhen without rebind behavior. -
setPoolInit
At end of the buffer objectGPUMemoryPool.init().nullwhen without after-init behavior. -
setPoolDestroy
At end of the buffer objectGPUMemoryPool.destroy(), for delete some vao/texture object.nullwhen without after-destroy behavior. -
setBufferInitRule
public GPUPoolBehavior<T,D> setBufferInitRule(@NotNull BiFunction<Long, ? super GPUMemoryPool<T, D>, Long> bufferInitRule) The memory allocation behavior when malloc is first called after initialization.The first
Longparameter is the requested size for that malloc call, and this function should return a value no less than that parameter. -
setBufferExpendRule
public GPUPoolBehavior<T,D> setBufferExpendRule(@NotNull BiFunction<Long, ? super GPUMemoryPool<T, D>, Long> bufferExpendRule) The behavior of re‑creating a larger‑capacity Buffer object when the current memory space is insufficient.The first
Longparameter is the size of the existing buffer object before expansion, and this function should return a value no less than that parameter. -
setNewMemoryFormat
The behavior of make a new memory region byGPUMemoryPool.malloc(Object, long)and then check or write data into memory; withoutGL15.glBindBuffer(int, int)before or after this calls, so you should be bind and unbind your buffer in method.nullwhen without format behavior.
-