@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface MappedType
MappedObject
for API details and org.lwjgl.test.mapped.TestMappedObject
for examples.
The instance fields of the annotated class should only be limited to primitive types or
ByteBuffer
. Static fields are supported and they can have any type.
The purpose of mapped objects is to reduce the memory requirements required for the type
of data that are often used in OpenGL/OpenCL programming, while at the same time enabling
clean Java code. There are also performance benefits related to not having to copy data
between buffers and Java objects and the removal of bounds checking when accessing
buffer data.Modifier and Type | Optional Element and Description |
---|---|
int |
align
The mapped data memory alignment, in bytes.
|
boolean |
autoGenerateOffsets
When autoGenerateOffsets is true, byte offsets of the mapped fields will
be generated automatically.
|
boolean |
cacheLinePadding
When true, SIZEOF will be increased (if necessary) so that it's a multiple of the CPU cache line size.
|
int |
padding
The number of bytes to add to the total byte size.
|
public abstract int padding
SIZEOF = max(field_offset + field_length) + padding
.
Cannot be used with cacheLinePadding()
.public abstract boolean cacheLinePadding
MappedObject.malloc(int)
on the mapped object type will automatically use
CacheUtil.createByteBuffer(int)
instead of the unaligned BufferUtils.createByteBuffer(int)
.
Cannot be used with padding()
.CacheUtil
public abstract int align
public abstract boolean autoGenerateOffsets
MappedField
annotation.Copyright © 2002-2009 lwjgl.org. All Rights Reserved.