Class ByteBufferNativeMemory
java.lang.Object
dev.engine.core.memory.ByteBufferNativeMemory
- All Implemented Interfaces:
NativeMemory
Web implementation of
NativeMemory backed by a ByteBuffer.
Used by the TeaVM WebGPU backend where java.lang.foreign.MemorySegment
is not available.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuffer()Returns the underlying ByteBuffer for passing to WebGPU APIs.voidcopyFrom(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) longsize()slice(long offset, long length) Returns a view of a sub-region of this memory.
-
Constructor Details
-
ByteBufferNativeMemory
public ByteBufferNativeMemory(int size) -
ByteBufferNativeMemory
-
-
Method Details
-
buffer
Returns the underlying ByteBuffer for passing to WebGPU APIs. -
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
-