Class SegmentNativeMemory
java.lang.Object
dev.engine.core.memory.SegmentNativeMemory
- All Implemented Interfaces:
NativeMemory
Desktop implementation of
NativeMemory backed by a MemorySegment.
Used by all native backends (OpenGL, Vulkan, desktop WebGPU) where the JVM has direct memory access via the Foreign Function invalid input: '&' Memory API.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyFrom(NativeMemory src) Copy all bytes fromsrcinto this memory at offset 0.bytegetByte(long offset) doublegetDouble(long offset) floatgetFloat(long offset) intgetInt(long offset) longgetLong(long offset) shortgetShort(long offset) voidputByte(long offset, byte value) voidputDouble(long offset, double value) voidputFloat(long offset, float value) voidputFloatArray(long offset, float[] data) Bulk write of a float array starting at the given byte offset.voidputInt(long offset, int value) voidputIntArray(long offset, int[] data) Bulk write of an int array starting at the given byte offset.voidputLong(long offset, long value) voidputShort(long offset, short value) segment()Returns the underlyingMemorySegmentfor backends that need raw access.longsize()slice(long offset, long length) Returns a view of a sub-region of this memory.
-
Constructor Details
-
SegmentNativeMemory
-
-
Method Details
-
segment
Returns the underlyingMemorySegmentfor backends that need raw access. -
putFloat
public void putFloat(long offset, float value) - Specified by:
putFloatin interfaceNativeMemory
-
putInt
public void putInt(long offset, int value) - Specified by:
putIntin interfaceNativeMemory
-
putByte
public void putByte(long offset, byte value) - Specified by:
putBytein interfaceNativeMemory
-
putShort
public void putShort(long offset, short value) - Specified by:
putShortin interfaceNativeMemory
-
putLong
public void putLong(long offset, long value) - Specified by:
putLongin interfaceNativeMemory
-
putDouble
public void putDouble(long offset, double value) - Specified by:
putDoublein interfaceNativeMemory
-
getFloat
public float getFloat(long offset) - Specified by:
getFloatin interfaceNativeMemory
-
getInt
public int getInt(long offset) - Specified by:
getIntin interfaceNativeMemory
-
getByte
public byte getByte(long offset) - Specified by:
getBytein interfaceNativeMemory
-
getShort
public short getShort(long offset) - Specified by:
getShortin interfaceNativeMemory
-
getLong
public long getLong(long offset) - Specified by:
getLongin interfaceNativeMemory
-
getDouble
public double getDouble(long offset) - Specified by:
getDoublein interfaceNativeMemory
-
size
public long size()- Specified by:
sizein interfaceNativeMemory
-
putFloatArray
public void putFloatArray(long offset, float[] data) Description copied from interface:NativeMemoryBulk write of a float array starting at the given byte offset.- Specified by:
putFloatArrayin interfaceNativeMemory
-
putIntArray
public void putIntArray(long offset, int[] data) Description copied from interface:NativeMemoryBulk write of an int array starting at the given byte offset.- Specified by:
putIntArrayin interfaceNativeMemory
-
copyFrom
Description copied from interface:NativeMemoryCopy all bytes fromsrcinto this memory at offset 0.- Specified by:
copyFromin interfaceNativeMemory
-
slice
Description copied from interface:NativeMemoryReturns a view of a sub-region of this memory.- Specified by:
slicein interfaceNativeMemory
-