Package net.haesleinhuepf.clij.clearcl
Class ClearCLBuffer
- java.lang.Object
-
- net.haesleinhuepf.clij.clearcl.abs.ClearCLBase
-
- net.haesleinhuepf.clij.clearcl.abs.ClearCLMemBase
-
- net.haesleinhuepf.clij.clearcl.ClearCLBuffer
-
- All Implemented Interfaces:
AutoCloseable,ClearCLImageInterface,ClearCLMemInterface,net.haesleinhuepf.clij.coremem.interfaces.SizedInBytes
public class ClearCLBuffer extends ClearCLMemBase implements ClearCLMemInterface, ClearCLImageInterface
ClearCLBuffer is the ClearCL abstraction for OpenCL buffers.- Author:
- royer
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcopyTo(ClearCLBuffer pDstBuffer, boolean pBlockingCopy)Copies this OpenCl buffer into another OpenCl buffer of same length.voidcopyTo(ClearCLBuffer pDstBuffer, long[] pOriginInSrcBuffer, long[] pOriginInDstBuffer, long[] pRegion, boolean pBlockingCopy)Copies a 3D region of this OpenCl buffer into a 3D region of same dimensions of another OpenCl buffer.voidcopyTo(ClearCLBuffer pDstBuffer, long pOffsetInSrcBuffer, long pOffsetInDstBuffer, long pLengthInElements, boolean pBlockingCopy)Copies a linear region of this OpenCl buffer into a linear region of same length of another OpenCl buffer.voidcopyTo(ClearCLHostImageBuffer pClearCLHostImage, boolean pBlockingCopy)Copies this image into a host image.voidcopyTo(ClearCLImage pDstImage, boolean pBlockingCopy)Copies this OpenCl buffer to an OpenCl image.voidcopyTo(ClearCLImage pDstImage, long pOffsetInSrcBuffer, long[] pDstOrigin, long[] pDstRegion, boolean pBlockingCopy)Copies a 3D region of this OpenCl buffer into a 3D region of same dimensions of an OpenCl image.voidfill(byte[] pPattern, boolean pBlockingFill)Fills the buffer with a given byte pattern.voidfill(byte[] pPattern, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingFill)Fills the buffer with a given byte pattern, from a given starting offset, and for a certain length.voidfill(byte pByte, boolean pBlockingFill)Fills the buffer with a given byte.ClearCLContextgetContext()Returns ClearCL context associated to this OpenCL mem object.long[]getDimensions()Returns this image dimensions.longgetLength()Returns length in elements, an element is composed of potentially several channels and is certainly not equal to the size in bytes!StringgetName()net.haesleinhuepf.clij.coremem.enums.NativeTypeEnumgetNativeType()Returns data type.longgetNumberOfChannels()Returns the number of channels in this imagelonggetSizeInBytes()Returns the size in bytes.voidreadFrom(Buffer pBuffer, boolean pBlockingRead)Reads from a linear region of a NIO buffer into this OpenCl buffer.voidreadFrom(Buffer pBuffer, long[] pSourceOrigin, long[] pDestinationOrigin, long[] pRegion, boolean pBlockingRead)Reads from a 3D region of a NIO buffer into a 3D region of this OpenCl buffer.voidreadFrom(Buffer pBuffer, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingRead)Reads from a linear region of a NIO buffer into this OpenCl buffer.voidreadFrom(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, boolean pBlockingRead)Reads from a linear region of a CoreMem buffer into this OpenCl buffer.voidreadFrom(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, long[] pSourceOrigin, long[] pDestinationOrigin, long[] pRegion, boolean pBlockingRead)Reads from a 3D region of a CoreMem buffer into a 3D region of this OpenCl buffer.voidreadFrom(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingRead)Reads from a linear region of a CoreMem buffer into this OpenCl buffer.voidsetName(String name)StringtoString()voidwriteTo(Buffer pBuffer, boolean pBlockingWrite)Writes a NIO buffer into this OpenCl buffer.voidwriteTo(Buffer pBuffer, long[] pSourceOrigin, long[] pDestinationOrigin, long[] pRegion, boolean pBlockingWrite)Writes to a 3D region of a NIO buffer into a 3D region of this OpenCl buffer.voidwriteTo(Buffer pBuffer, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingWrite)Writes a linear region of a NIO buffer into this OpenCl buffer.voidwriteTo(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, boolean pBlockingWrite)Writes the contents of this OpenCl buffer into CoreMem buffer.voidwriteTo(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, long[] pSourceOrigin, long[] pDestinationOrigin, long[] pRegion, boolean pBlockingWrite)Writes to a 3D region of a CoreMem buffer into a 3D region of this OpenCl buffer.voidwriteTo(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingWrite)Writes the contents of this OpenCl buffer into a linear region of a CoreMem buffer.-
Methods inherited from class net.haesleinhuepf.clij.clearcl.abs.ClearCLMemBase
addListener, getHostAccessType, getKernelAccessType, getMemAllocMode, notifyListenersOfChange, removeListener
-
Methods inherited from class net.haesleinhuepf.clij.clearcl.abs.ClearCLBase
getBackend, getPeerPointer, setPeerPointer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.haesleinhuepf.clij.clearcl.interfaces.ClearCLImageInterface
getBackend, getDepth, getDimension, getHeight, getPeerPointer, getPixelSizeInBytes, getVolume, getWidth
-
Methods inherited from interface net.haesleinhuepf.clij.clearcl.interfaces.ClearCLMemInterface
addListener, getHostAccessType, getKernelAccessType, getMemAllocMode, notifyListenersOfChange
-
-
-
-
Field Detail
-
name
protected String name
-
-
Method Detail
-
fill
public void fill(byte pByte, boolean pBlockingFill)Fills the buffer with a given byte.- Parameters:
pByte- byte to fill buffer withpBlockingFill- true blocking call, false asynchronous call
-
fill
public void fill(byte[] pPattern, boolean pBlockingFill)Fills the buffer with a given byte pattern.- Parameters:
pPattern- pattern as a sequence of bytespBlockingFill- true blocking call, false asynchronous call
-
fill
public void fill(byte[] pPattern, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingFill)Fills the buffer with a given byte pattern, from a given starting offset, and for a certain length. This call can be required to block until operation is finished.- Parameters:
pPattern- pattern as a sequence of bytespOffsetInBuffer- offset in buffer in elementspLengthInBuffer- length in buffer in elementspBlockingFill- true blocking call, false asynchronous call
-
copyTo
public void copyTo(ClearCLBuffer pDstBuffer, boolean pBlockingCopy)
Copies this OpenCl buffer into another OpenCl buffer of same length.- Specified by:
copyToin interfaceClearCLImageInterface- Parameters:
pDstBuffer- destination bufferpBlockingCopy- true blocking call, false asynchronous call
-
copyTo
public void copyTo(ClearCLBuffer pDstBuffer, long pOffsetInSrcBuffer, long pOffsetInDstBuffer, long pLengthInElements, boolean pBlockingCopy)
Copies a linear region of this OpenCl buffer into a linear region of same length of another OpenCl buffer.- Parameters:
pDstBuffer- destination bufferpOffsetInSrcBuffer- source buffer offset in elementspOffsetInDstBuffer- destination buffer offset in elementspLengthInElements- copy length in elementspBlockingCopy- true blocking call, false asynchronous call
-
copyTo
public void copyTo(ClearCLBuffer pDstBuffer, long[] pOriginInSrcBuffer, long[] pOriginInDstBuffer, long[] pRegion, boolean pBlockingCopy)
Copies a 3D region of this OpenCl buffer into a 3D region of same dimensions of another OpenCl buffer.- Parameters:
pDstBuffer- destination bufferpOriginInSrcBuffer- source buffer originpOriginInDstBuffer- destination buffer originpRegion- region to copypBlockingCopy- true blocking call, false asynchronous call
-
copyTo
public void copyTo(ClearCLImage pDstImage, boolean pBlockingCopy)
Copies this OpenCl buffer to an OpenCl image.- Specified by:
copyToin interfaceClearCLImageInterface- Parameters:
pDstImage- destination imagepBlockingCopy- true blocking call, false asynchronous call
-
copyTo
public void copyTo(ClearCLImage pDstImage, long pOffsetInSrcBuffer, long[] pDstOrigin, long[] pDstRegion, boolean pBlockingCopy)
Copies a 3D region of this OpenCl buffer into a 3D region of same dimensions of an OpenCl image.- Parameters:
pDstImage- destination imagepOffsetInSrcBuffer- source buffer offset in elementspDstOrigin- destination originpDstRegion- destination regionpBlockingCopy- true blocking call, false asynchronous call
-
copyTo
public void copyTo(ClearCLHostImageBuffer pClearCLHostImage, boolean pBlockingCopy)
Copies this image into a host image.- Parameters:
pClearCLHostImage- host image.pBlockingCopy- true blocking call, false asynchronous call
-
writeTo
public void writeTo(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, boolean pBlockingWrite)Writes the contents of this OpenCl buffer into CoreMem buffer.- Specified by:
writeToin interfaceClearCLImageInterface- Parameters:
pContiguousMemory- destination CoreMem bufferpBlockingWrite- true blocking call, false asynchronous call
-
writeTo
public void writeTo(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingWrite)Writes the contents of this OpenCl buffer into a linear region of a CoreMem buffer.- Parameters:
pContiguousMemory- destination CoreMem bufferpOffsetInBuffer- offset in destination buffer in elementspLengthInBuffer- length to write in elementspBlockingWrite- true blocking call, false asynchronous call
-
writeTo
public void writeTo(Buffer pBuffer, boolean pBlockingWrite)
Writes a NIO buffer into this OpenCl buffer.- Specified by:
writeToin interfaceClearCLImageInterface- Parameters:
pBuffer- destination NIO bufferpBlockingWrite- true blocking call, false asynchronous call
-
writeTo
public void writeTo(Buffer pBuffer, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingWrite)
Writes a linear region of a NIO buffer into this OpenCl buffer.- Parameters:
pBuffer- destination NIO bufferpOffsetInBuffer- offset in destination buffer in elementspLengthInBuffer- length to write in elementspBlockingWrite- true blocking call, false asynchronous call
-
readFrom
public void readFrom(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, boolean pBlockingRead)Reads from a linear region of a CoreMem buffer into this OpenCl buffer.- Specified by:
readFromin interfaceClearCLImageInterface- Parameters:
pContiguousMemory- source NIO bufferpBlockingRead- true blocking call, false asynchronous call
-
readFrom
public void readFrom(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingRead)Reads from a linear region of a CoreMem buffer into this OpenCl buffer.- Parameters:
pContiguousMemory- source CoreMem bufferpOffsetInBuffer- offset in source buffer in elementspLengthInBuffer- length to read in elementspBlockingRead- true blocking call, false asynchronous call
-
readFrom
public void readFrom(Buffer pBuffer, boolean pBlockingRead)
Reads from a linear region of a NIO buffer into this OpenCl buffer.- Specified by:
readFromin interfaceClearCLImageInterface- Parameters:
pBuffer- source NIO bufferpBlockingRead- true blocking call, false asynchronous call
-
readFrom
public void readFrom(Buffer pBuffer, long pOffsetInBuffer, long pLengthInBuffer, boolean pBlockingRead)
Reads from a linear region of a NIO buffer into this OpenCl buffer.- Parameters:
pBuffer- source NIO bufferpOffsetInBuffer- offset in source buffer in elementspLengthInBuffer- length to read in elementspBlockingRead- true blocking call, false asynchronous call
-
writeTo
public void writeTo(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, long[] pSourceOrigin, long[] pDestinationOrigin, long[] pRegion, boolean pBlockingWrite)Writes to a 3D region of a CoreMem buffer into a 3D region of this OpenCl buffer.- Parameters:
pContiguousMemory- destination CoreMem bufferpSourceOrigin- origin in destination bufferpDestinationOrigin- origin in source bufferpRegion- region to writepBlockingWrite- true blocking call, false asynchronous call
-
writeTo
public void writeTo(Buffer pBuffer, long[] pSourceOrigin, long[] pDestinationOrigin, long[] pRegion, boolean pBlockingWrite)
Writes to a 3D region of a NIO buffer into a 3D region of this OpenCl buffer.- Parameters:
pBuffer- destination NIO bufferpSourceOrigin- origin in source bufferpDestinationOrigin- origin in destination bufferpRegion- region to writepBlockingWrite- true blocking call, false asynchronous call
-
readFrom
public void readFrom(net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface pContiguousMemory, long[] pSourceOrigin, long[] pDestinationOrigin, long[] pRegion, boolean pBlockingRead)Reads from a 3D region of a CoreMem buffer into a 3D region of this OpenCl buffer.- Parameters:
pContiguousMemory- source CoreMem bufferpSourceOrigin- origin in source bufferpDestinationOrigin- origin in destination bufferpRegion- region to readpBlockingRead- true blocking call, false asynchronous call
-
readFrom
public void readFrom(Buffer pBuffer, long[] pSourceOrigin, long[] pDestinationOrigin, long[] pRegion, boolean pBlockingRead)
Reads from a 3D region of a NIO buffer into a 3D region of this OpenCl buffer.- Parameters:
pBuffer- source NIO bufferpSourceOrigin- origin in source bufferpDestinationOrigin- origin in destination bufferpRegion- region to readpBlockingRead- true blocking call, false asynchronous call
-
getContext
public ClearCLContext getContext()
Description copied from interface:ClearCLMemInterfaceReturns ClearCL context associated to this OpenCL mem object.- Specified by:
getContextin interfaceClearCLMemInterface- Returns:
- context
-
getNativeType
public net.haesleinhuepf.clij.coremem.enums.NativeTypeEnum getNativeType()
Returns data type.- Specified by:
getNativeTypein interfaceClearCLImageInterface- Returns:
- data type
-
getLength
public long getLength()
Returns length in elements, an element is composed of potentially several channels and is certainly not equal to the size in bytes!- Returns:
- length in elements
-
getNumberOfChannels
public long getNumberOfChannels()
Description copied from interface:ClearCLImageInterfaceReturns the number of channels in this image- Specified by:
getNumberOfChannelsin interfaceClearCLImageInterface- Returns:
- number of channels
-
getDimensions
public long[] getDimensions()
Description copied from interface:ClearCLImageInterfaceReturns this image dimensions.- Specified by:
getDimensionsin interfaceClearCLImageInterface- Returns:
- dimensions
-
getSizeInBytes
public long getSizeInBytes()
Returns the size in bytes.- Specified by:
getSizeInBytesin interfacenet.haesleinhuepf.clij.coremem.interfaces.SizedInBytes- Returns:
- size in bytes
-
setName
public void setName(String name)
- Specified by:
setNamein interfaceClearCLImageInterface
-
getName
public String getName()
- Specified by:
getNamein interfaceClearCLImageInterface
-
toString
public String toString()
- Overrides:
toStringin classClearCLMemBase
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceClearCLImageInterface- Specified by:
closein classClearCLBase
-
-