GLBufferStorage instances via GL API callbacks.
See GLBufferStorage for generic details.
Buffer storage is created via
GL#glBufferData(int, long, java.nio.Buffer, int) - storage recreation with target via createBufferStorage(GLBufferStateTracker, GL, int, long, Buffer, int, int, CreateStorageDispatch, long)GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int) - storage recreation, direct, via createBufferStorage(GL, int, long, Buffer, int, CreateStorageDispatch, long)GL4#glNamedBufferData(int, long, java.nio.Buffer, int) - storage recreation, direct, via createBufferStorage(GL, int, long, Buffer, int, CreateStorageDispatch, long)GL4#glBufferStorage(int, long, Buffer, int) - storage creation with target via createBufferStorage(GLBufferStateTracker, GL, int, long, Buffer, int, int, CreateStorageDispatch, long)GL4#glNamedBufferStorage(int, long, Buffer, int) - storage recreation, direct, via createBufferStorage(GL, int, long, Buffer, int, CreateStorageDispatch, long)Buffers storage is disposed via
GL#glDeleteBuffers(int, IntBuffer) - explicit, direct, via notifyBuffersDeleted(int, IntBuffer) or notifyBuffersDeleted(int, int[], int)GL#glBufferData(int, long, java.nio.Buffer, int) - storage recreation via targetGL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int) - storage recreation, directGL4#glNamedBufferData(int, long, java.nio.Buffer, int) - storage recreation, directGL4#glBufferStorage(int, long, Buffer, int) - storage recreation via targetGL4#glNamedBufferStorage(int, long, Buffer, int) - storage recreation, direct
Implementation throws a GLException in all construction methods as listed below,
if GL-function constraints are not met. createBufferStorage also throws an exception
if the native GL-function fails.
createBufferStorage(GLBufferStateTracker, GL, int, long, Buffer, int, int, CreateStorageDispatch, long), etc ..mapBuffer(GLBufferStateTracker, GL, int, int, MapBufferAllDispatch, long), etc ..
Buffer mapping methods like GL#mapBuffer(int, int) ...,
require knowledge of the buffer's storage size as determined via it's creation with
GL#glBufferData(int, long, java. ....
Hence we track the OpenGL buffer's GLBufferStorage to be able to
access the buffer's storage size. The tracked GLBufferStorage instances
also allow users to conveniently access details of their created and maybe mapped buffer storage.
The GLBufferObjectTracker and it's tracked GLBufferStorage instances
maybe shared across multiple OpenGL context, hence this class is thread safe and employs synchronization.
Implementation requires and utilizes a local GLBufferStateTracker
to resolve the actual buffer-name bound to the given target.
Note
This tracker requires to be notified about all OpenGL buffer storage operations,
as well as the local GLBufferStateTracker to be notified about all
OpenGL buffer binding operations.
Hence buffer storage cannot be accessed properly if managed via native code.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | |
| pack-priv static class | |
| public static interface | |
| public static interface | |
| public static interface | |
| public static interface |
| Modifier and Type | Field and Description |
|---|---|
| private final IntObjectHashMap | bufferName2StorageMap
Map from buffer names to GLBufferObject. |
| protected static final boolean | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final synchronized void | |
| public final synchronized void | createBufferStorage(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final long size, final Buffer data, final int
glBufferData, glNamedBufferData usageglBufferStorage flagsMust be called when [re]creating the GL buffer object via |
| public final synchronized void | createBufferStorage(final GL caller, final int bufferName, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, final GLBufferObjectTracker.
Must be called when [re]creating the GL buffer object
via |
| public final synchronized GLBufferStorage | |
| public final synchronized GLBufferStorage | mapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final int access, final GLBufferObjectTracker.
Must be called when mapping GL buffer objects via |
| public final synchronized GLBufferStorage | mapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final long offset, final long length, final int access, final GLBufferObjectTracker.
Must be called when mapping GL buffer objects via |
| public final synchronized GLBufferStorage | mapBuffer(final int bufferName, final int access, final GLBufferObjectTracker.
Must be called when mapping GL buffer objects via |
| public final synchronized GLBufferStorage | mapBuffer(final int bufferName, final long offset, final long length, final int access, final GLBufferObjectTracker.
Must be called when mapping GL buffer objects via |
| private final synchronized GLBufferStorage | mapBufferImpl(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final boolean useRange, final long offset, final long length, final int access, final GLBufferObjectTracker.
|
| private final synchronized GLBufferStorage | mapBufferImpl(final int target, final int bufferName, final boolean isNamedBuffer, final boolean useRange, long offset, long length, final int access, final GLBufferObjectTracker.
A zero store size will avoid a native call and returns the unmapped |
| private final synchronized void | notifyBufferDeleted(final int bufferName, final int i, final int count)
Must be called when deleting GL buffer objects vis |
| public final synchronized void | notifyBuffersDeleted(final int count, final int[] bufferNames, final int offset)
Must be called when deleting GL buffer objects vis |
| public final synchronized void | notifyBuffersDeleted(final int n, final IntBuffer bufferNames)
Must be called when deleting GL buffer objects vis |
| public final synchronized boolean | unmapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final GLBufferObjectTracker.
Must be called when unmapping GL buffer objects via |
| public final synchronized boolean | unmapBuffer(final int bufferName, final GLBufferObjectTracker.
Must be called when unmapping GL buffer objects via |
| bufferName2StorageMap | back to summary |
|---|---|
| private final IntObjectHashMap bufferName2StorageMap Map from buffer names to GLBufferObject. | |
| DEBUG | back to summary |
|---|---|
| protected static final boolean DEBUG | |
| GL_INVALID_OPERATION | back to summary |
|---|---|
| private static final String GL_INVALID_OPERATION | |
| GL_INVALID_VALUE | back to summary |
|---|---|
| private static final String GL_INVALID_VALUE | |
| msgClazzName | back to summary |
|---|---|
| private static final String msgClazzName | |
| msgCreateBound | back to summary |
|---|---|
| private static final String msgCreateBound | |
| msgCreateNamed | back to summary |
|---|---|
| private static final String msgCreateNamed | |
| msgMapBuffer | back to summary |
|---|---|
| private static final String msgMapBuffer | |
| msgUnmapped | back to summary |
|---|---|
| private static final String msgUnmapped | |
| warning | back to summary |
|---|---|
| private static final String warning | |
| GLBufferObjectTracker | back to summary |
|---|---|
| public GLBufferObjectTracker() | |
| clear | back to summary |
|---|---|
| public final synchronized void clear() Clear all tracked buffer object knowledge. Shall only be called at GLContext destruction iff there are no other shared GLContext instances left. | |
| createBufferStorage | back to summary |
|---|---|
| public final synchronized void createBufferStorage(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, final GLBufferObjectTracker. Must be called when [re]creating the GL buffer object via
| |
| createBufferStorage | back to summary |
|---|---|
| public final synchronized void createBufferStorage(final GL caller, final int bufferName, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, final GLBufferObjectTracker. Must be called when [re]creating the GL buffer object
via
| |
| getBufferStorage | back to summary |
|---|---|
| public final synchronized GLBufferStorage getBufferStorage(final int bufferName) | |
| mapBuffer | back to summary |
|---|---|
| public final synchronized GLBufferStorage mapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final int access, final GLBufferObjectTracker. Must be called when mapping GL buffer objects via
| |
| mapBuffer | back to summary |
|---|---|
| public final synchronized GLBufferStorage mapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final long offset, final long length, final int access, final GLBufferObjectTracker. Must be called when mapping GL buffer objects via
| |
| mapBuffer | back to summary |
|---|---|
| public final synchronized GLBufferStorage mapBuffer(final int bufferName, final int access, final GLBufferObjectTracker. Must be called when mapping GL buffer objects via
| |
| mapBuffer | back to summary |
|---|---|
| public final synchronized GLBufferStorage mapBuffer(final int bufferName, final long offset, final long length, final int access, final GLBufferObjectTracker. Must be called when mapping GL buffer objects via
| |
| mapBufferImpl | back to summary |
|---|---|
private final synchronized GLBufferStorage mapBufferImpl(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final boolean useRange, final long offset, final long length, final int access, final GLBufferObjectTracker.
| |
| mapBufferImpl | back to summary |
|---|---|
| private final synchronized GLBufferStorage mapBufferImpl(final int target, final int bufferName, final boolean isNamedBuffer, final boolean useRange, long offset, long length, final int access, final GLBufferObjectTracker.
A zero store size will avoid a native call and returns the unmapped
A null native mapping result indicating an error will
not cause a GLException but returns the unmapped
| |
| notifyBufferDeleted | back to summary |
|---|---|
| private final synchronized void notifyBufferDeleted(final int bufferName, final int i, final int count) Must be called when deleting GL buffer objects vis | |
| notifyBuffersDeleted | back to summary |
|---|---|
| public final synchronized void notifyBuffersDeleted(final int count, final int[] bufferNames, final int offset) Must be called when deleting GL buffer objects vis | |
| notifyBuffersDeleted | back to summary |
|---|---|
| public final synchronized void notifyBuffersDeleted(final int n, final IntBuffer bufferNames) Must be called when deleting GL buffer objects vis | |
| unmapBuffer | back to summary |
|---|---|
| public final synchronized boolean unmapBuffer(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final GLBufferObjectTracker. Must be called when unmapping GL buffer objects via
Only clear mapped buffer reference of | |
| unmapBuffer | back to summary |
|---|---|
| public final synchronized boolean unmapBuffer(final int bufferName, final GLBufferObjectTracker. Must be called when unmapping GL buffer objects via
Only clear mapped buffer reference of | |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| create | back to summary |
|---|---|
| public void create(final int targetOrBufferName, final long size, final Buffer data, final int mutableUsageOrImmutableFlags) | |
| Access | Constructor and Description |
|---|---|
| pack-priv | GLBufferStorageImpl(final int name, final long size, final int mutableUsage, final int immutableFlags)
|
| Modifier and Type | Method and Description |
|---|---|
| protected final void | reset(final long size, final int mutableUsage, final int immutableFlags)
Overrides com. |
| protected final void | setMappedBuffer(final ByteBuffer buffer)
Overrides com. |
| GLBufferStorageImpl | back to summary |
|---|---|
| pack-priv GLBufferStorageImpl(final int name, final long size, final int mutableUsage, final int immutableFlags) | |
| reset | back to summary |
|---|---|
| protected final void reset(final long size, final int mutableUsage, final int immutableFlags) Overrides com. | |
| setMappedBuffer | back to summary |
|---|---|
| protected final void setMappedBuffer(final ByteBuffer buffer) Overrides com. | |
| Modifier and Type | Method and Description |
|---|---|
| public long |
| mapBuffer | back to summary |
|---|---|
| public long mapBuffer(final int targetOrBufferName, final int access) | |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer |
| allocNioByteBuffer | back to summary |
|---|---|
| public ByteBuffer allocNioByteBuffer(final long addr, final long length) | |
| Modifier and Type | Method and Description |
|---|---|
| public long |
| mapBuffer | back to summary |
|---|---|
| public long mapBuffer(final int targetOrBufferName, final long offset, final long length, final int access) | |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| unmap | back to summary |
|---|---|
| public boolean unmap(final int targetOrBufferName) | |