Class ARBMapBufferRange
ARB_map_buffer_range expands the buffer object API to allow greater performance when a client application only needs to write to a sub-range of a buffer object. To that end, this extension introduces two new buffer object features: non-serialized buffer modification and explicit sub-range flushing for mapped buffer objects.
OpenGL requires that commands occur in a FIFO manner meaning that any changes to buffer objects either block until the data has been processed by the OpenGL pipeline or else create extra copies to avoid such a block. By providing a method to asynchronously modify buffer object data, an application is then able to manage the synchronization points themselves and modify ranges of data contained by a buffer object even though OpenGL might still be using other parts of it.
This extension also provides a method for explicitly flushing ranges of a mapped buffer object so OpenGL does not have to assume that the entire range may have been modified. Further, it allows the application to more precisely specify its intent with respect to reading, writing, and whether the previous contents of a mapped range of interest need be preserved prior to modification.
Requires OpenGL 2.1
. Promoted to core in OpenGL 3.0
.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Accepted by theaccess
parameter of MapBufferRange.static final int
Accepted by theaccess
parameter of MapBufferRange.static final int
Accepted by theaccess
parameter of MapBufferRange.static final int
Accepted by theaccess
parameter of MapBufferRange.static final int
Accepted by theaccess
parameter of MapBufferRange.static final int
Accepted by theaccess
parameter of MapBufferRange. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
glFlushMappedBufferRange
(int target, long offset, long length) Indicates modifications to a range of a mapped buffer.static ByteBuffer
glMapBufferRange
(int target, long offset, long length, int access) Maps a section of a buffer object's data store.static ByteBuffer
glMapBufferRange
(int target, long offset, long length, int access, ByteBuffer old_buffer) Maps a section of a buffer object's data store.static long
nglMapBufferRange
(int target, long offset, long length, int access) Unsafe version of:MapBufferRange
-
Field Details
-
GL_MAP_READ_BIT
public static final int GL_MAP_READ_BITAccepted by theaccess
parameter of MapBufferRange.- See Also:
-
GL_MAP_WRITE_BIT
public static final int GL_MAP_WRITE_BITAccepted by theaccess
parameter of MapBufferRange.- See Also:
-
GL_MAP_INVALIDATE_RANGE_BIT
public static final int GL_MAP_INVALIDATE_RANGE_BITAccepted by theaccess
parameter of MapBufferRange.- See Also:
-
GL_MAP_INVALIDATE_BUFFER_BIT
public static final int GL_MAP_INVALIDATE_BUFFER_BITAccepted by theaccess
parameter of MapBufferRange.- See Also:
-
GL_MAP_FLUSH_EXPLICIT_BIT
public static final int GL_MAP_FLUSH_EXPLICIT_BITAccepted by theaccess
parameter of MapBufferRange.- See Also:
-
GL_MAP_UNSYNCHRONIZED_BIT
public static final int GL_MAP_UNSYNCHRONIZED_BITAccepted by theaccess
parameter of MapBufferRange.- See Also:
-
-
Method Details
-
nglMapBufferRange
public static long nglMapBufferRange(int target, long offset, long length, int access) Unsafe version of:MapBufferRange
-
glMapBufferRange
@Nullable public static ByteBuffer glMapBufferRange(int target, long offset, long length, int access) Maps a section of a buffer object's data store.LWJGL note: This method comes in 2 flavors:
glMapBufferRange(int, long, long, int)
- Always returns a new ByteBuffer instance.glMapBufferRange(int, long, long, int, ByteBuffer)
- Theold_buffer
parameter is reused if not null.
- Parameters:
target
- a binding to which the target buffer is bound. One of:offset
- the starting offset within the buffer of the range to be mappedlength
- the length of the range to be mappedaccess
- a combination of access flags indicating the desired access to the range. One or more of:MAP_READ_BIT
MAP_WRITE_BIT
MAP_INVALIDATE_RANGE_BIT
MAP_INVALIDATE_BUFFER_BIT
MAP_FLUSH_EXPLICIT_BIT
MAP_UNSYNCHRONIZED_BIT
-
glMapBufferRange
@Nullable public static ByteBuffer glMapBufferRange(int target, long offset, long length, int access, @Nullable ByteBuffer old_buffer) Maps a section of a buffer object's data store.LWJGL note: This method comes in 2 flavors:
glMapBufferRange(int, long, long, int)
- Always returns a new ByteBuffer instance.glMapBufferRange(int, long, long, int, ByteBuffer)
- Theold_buffer
parameter is reused if not null.
- Parameters:
target
- a binding to which the target buffer is bound. One of:offset
- the starting offset within the buffer of the range to be mappedlength
- the length of the range to be mappedaccess
- a combination of access flags indicating the desired access to the range. One or more of:MAP_READ_BIT
MAP_WRITE_BIT
MAP_INVALIDATE_RANGE_BIT
MAP_INVALIDATE_BUFFER_BIT
MAP_FLUSH_EXPLICIT_BIT
MAP_UNSYNCHRONIZED_BIT
-
glFlushMappedBufferRange
public static void glFlushMappedBufferRange(int target, long offset, long length) Indicates modifications to a range of a mapped buffer.- Parameters:
target
- the target of the flush operation. One of:offset
- the start of the buffer subrange, in basic machine unitslength
- the length of the buffer subrange, in basic machine units
-