Top Description Inners Fields Constructors Methods
com.jogamp.opencl

public abstract Class CLMemory<B extends Buffer>

extends CLObjectResource
Class Inheritance
Known Direct Subclasses
com.jogamp.opencl.CLBuffer, com.jogamp.opencl.CLImage
Imports
com.jogamp.opencl.llb.CLMemObjBinding, .CL, com.jogamp.common.nio.Buffers, .PointerBuffer, com.jogamp.opencl.llb.impl.CLMemObjectDestructorCallback, java.nio.Buffer, .IntBuffer, java.util.ArrayList, .EnumSet, .List

Common superclass for all OpenCL memory types. Represents an OpenCL memory object and wraps an optional NIO buffer.
Author
Michael Bien, et al.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static enum
CLMemory.Map

Configures the mapping process.

public static enum
CLMemory.Mem

Memory settings for configuring CLMemory.

Field Summary

Modifier and TypeField and Description
private final CLMemObjBinding
pack-priv B
protected int
protected int
protected final int
protected long

Constructor Summary

AccessConstructor and Description
protected <Buffer>
CLMemory(final CLContext context, final long size, final long id, final int flags)

protected
CLMemory(final CLContext context, final B directBuffer, final long size, final long id, final int flags)

Method Summary

Modifier and TypeMethod and Description
public abstract <T extends Buffer> CLMemory<T>
cloneWith(T directBuffer)

Returns a new instance of CLMemory pointing to the same CLResource but using a different Buffer.

public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Returns the OpenGL buffer type of this shared buffer.
public B
getBuffer()

Returns the optional NIO buffer for this memory object.

protected static CL
getCL(final CLContext context)

public int
getCLCapacity()

Returns the size in buffer elements of this memory object.

public long
getCLSize()

Returns the size of the allocated OpenCL memory in bytes.

public EnumSet<CLMemory.Mem>
getConfig()

Returns the configuration of this memory object.

public int
getElementSize()

Returns the size in bytes of a single buffer element.

public int
getMapCount()

Returns the number of buffer mappings.

public int
getNIOCapacity()

Returns the capacity of the wrapped direct buffer or 0 if no buffer available.

public int
getNIOSize()

Returns the size of the wrapped direct buffer in byte or 0 if no buffer available.

protected static long
getSizeImpl(final CLContext context, final long id)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
protected final void
private void
protected static boolean
isHostPointerFlag(final int flags)

Returns true if a host pointer must be specified on mem object creation.

public boolean
isReadOnly()

Returns true if this memory object was created with the Mem#READ_ONLY flag.

public boolean
isReadWrite()

Returns true if this memory object was created with the Mem#READ_WRITE flag.

public boolean
isWriteOnly()

Returns true if this memory object was created with the Mem#WRITE_ONLY flag.

public void
registerDestructorCallback(final CLMemObjectListener listener)

Registers a callback which will be called by the OpenCL implementation when the memory object is released.

public void
release()

Overrides com.jogamp.opencl.CLObjectResource.release.

Implements com.jogamp.opencl.CLResource.release.

Releases the OpenCL resource.
public String
toString()

Overrides com.jogamp.opencl.CLObject.toString.

Returns a string representation of the object.
public CLMemory<B>
use(final B buffer)

Inherited from com.jogamp.opencl.CLObjectResource:
closeisReleased

Field Detail

bindingback to summary
private final CLMemObjBinding binding
bufferback to summary
pack-priv B buffer
clCapacityback to summary
protected int clCapacity
elementSizeback to summary
protected int elementSize
FLAGSback to summary
protected final int FLAGS
sizeback to summary
protected long size

Constructor Detail

CLMemoryback to summary
protected <Buffer> CLMemory(final CLContext context, final long size, final long id, final int flags)
CLMemoryback to summary
protected CLMemory(final CLContext context, final B directBuffer, final long size, final long id, final int flags)

Method Detail

cloneWithback to summary
public abstract <T extends Buffer> CLMemory<T> cloneWith(T directBuffer)

Returns a new instance of CLMemory pointing to the same CLResource but using a different Buffer.

equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Returns the OpenGL buffer type of this shared buffer.

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getBufferback to summary
public B getBuffer()

Returns the optional NIO buffer for this memory object.

getCLback to summary
protected static CL getCL(final CLContext context)
getCLCapacityback to summary
public int getCLCapacity()

Returns the size in buffer elements of this memory object.

getCLSizeback to summary
public long getCLSize()

Returns the size of the allocated OpenCL memory in bytes.

getConfigback to summary
public EnumSet<CLMemory.Mem> getConfig()

Returns the configuration of this memory object.

getElementSizeback to summary
public int getElementSize()

Returns the size in bytes of a single buffer element. This method returns 1 if no buffer is available indicating regular byte access.

getMapCountback to summary
public int getMapCount()

Returns the number of buffer mappings. The map count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for debugging.

getNIOCapacityback to summary
public int getNIOCapacity()

Returns the capacity of the wrapped direct buffer or 0 if no buffer available.

getNIOSizeback to summary
public int getNIOSize()

Returns the size of the wrapped direct buffer in byte or 0 if no buffer available.

getSizeImplback to summary
protected static long getSizeImpl(final CLContext context, final long id)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
initCLCapacityback to summary
protected final void initCLCapacity()
initElementSizeback to summary
private void initElementSize()
isHostPointerFlagback to summary
protected static boolean isHostPointerFlag(final int flags)

Returns true if a host pointer must be specified on mem object creation.

isReadOnlyback to summary
public boolean isReadOnly()

Returns true if this memory object was created with the Mem#READ_ONLY flag.

isReadWriteback to summary
public boolean isReadWrite()

Returns true if this memory object was created with the Mem#READ_WRITE flag.

isWriteOnlyback to summary
public boolean isWriteOnly()

Returns true if this memory object was created with the Mem#WRITE_ONLY flag.

registerDestructorCallbackback to summary
public void registerDestructorCallback(final CLMemObjectListener listener)

Registers a callback which will be called by the OpenCL implementation when the memory object is released.

releaseback to summary
public void release()

Overrides com.jogamp.opencl.CLObjectResource.release.

Implements com.jogamp.opencl.CLResource.release.

Doc from com.jogamp.opencl.CLResource.release.

Releases the OpenCL resource.

Annotations
@Override
toStringback to summary
public String toString()

Overrides com.jogamp.opencl.CLObject.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
useback to summary
public CLMemory<B> use(final B buffer)
com.jogamp.opencl back to summary

public final Enum CLMemory.GLObjectType

extends Enum<CLMemory.GLObjectType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final CLMemory.GLObjectType
public static final CLMemory.GLObjectType
public static final CLMemory.GLObjectType
public static final CLMemory.GLObjectType
public final int

Constructor Summary

AccessConstructor and Description
private
GLObjectType(final int type)

Method Summary

Modifier and TypeMethod and Description
public static CLMemory.GLObjectType
public static CLMemory.GLObjectType
valueOf(final int type)

public static CLMemory.GLObjectType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

GL_OBJECT_BUFFERback to summary
public static final CLMemory.GLObjectType GL_OBJECT_BUFFER
GL_OBJECT_RENDERBUFFERback to summary
public static final CLMemory.GLObjectType GL_OBJECT_RENDERBUFFER
GL_OBJECT_TEXTURE2Dback to summary
public static final CLMemory.GLObjectType GL_OBJECT_TEXTURE2D
GL_OBJECT_TEXTURE3Dback to summary
public static final CLMemory.GLObjectType GL_OBJECT_TEXTURE3D
TYPEback to summary
public final int TYPE

Constructor Detail

GLObjectTypeback to summary
private GLObjectType(final int type)

Method Detail

valueOfback to summary
public static CLMemory.GLObjectType valueOf(String name)
valueOfback to summary
public static CLMemory.GLObjectType valueOf(final int type)
valuesback to summary
public static CLMemory.GLObjectType[] values()
com.jogamp.opencl back to summary

public final Enum CLMemory.Map

extends Enum<CLMemory.Map>
Class Inheritance

Configures the mapping process.
See Also
com.jogamp.opencl.CLCommandQueue#putMapBuffer(CLBuffer, com.jogamp.opencl.CLMemory.Map, boolean)., com.jogamp.opencl.CLCommandQueue#putMapImage(CLImage2d, com.jogamp.opencl.CLMemory.Map, boolean), com.jogamp.opencl.CLCommandQueue#putMapImage(CLImage3d, com.jogamp.opencl.CLMemory.Map, boolean)

Field Summary

Modifier and TypeField and Description
public final int
FLAGS

Value of wrapped OpenCL flag.

public static final CLMemory.Map
READ

Enum representing CL_MAP_READ.

public static final CLMemory.Map
READ_WRITE

Enum representing CL_MAP_READ | CL_MAP_WRITE.

public static final CLMemory.Map
WRITE

Enum representing CL_MAP_WRITE.

Constructor Summary

AccessConstructor and Description
private
Map(final int flags)

Method Summary

Modifier and TypeMethod and Description
public static CLMemory.Map
public CLMemory.Map
valueOf(final int flag)

public static CLMemory.Map[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

FLAGSback to summary
public final int FLAGS

Value of wrapped OpenCL flag.

READback to summary
public static final CLMemory.Map READ

Enum representing CL_MAP_READ. This flag specifies that the memory object will be mapped for read operation.

READ_WRITEback to summary
public static final CLMemory.Map READ_WRITE

Enum representing CL_MAP_READ | CL_MAP_WRITE. This flag specifies that the memory object will be mapped for read and write operation.

WRITEback to summary
public static final CLMemory.Map WRITE

Enum representing CL_MAP_WRITE. This flag specifies that the memory object will be mapped for write operation.

Constructor Detail

Mapback to summary
private Map(final int flags)

Method Detail

valueOfback to summary
public static CLMemory.Map valueOf(String name)
valueOfback to summary
public CLMemory.Map valueOf(final int flag)
valuesback to summary
public static CLMemory.Map[] values()
com.jogamp.opencl back to summary

public final Enum CLMemory.Mem

extends Enum<CLMemory.Mem>
Class Inheritance

Memory settings for configuring CLMemory.

Field Summary

Modifier and TypeField and Description
public static final CLMemory.Mem
ALLOCATE_BUFFER

Enum representing CL_MEM_ALLOC_HOST_PTR.

public final int
CONFIG

Value of wrapped OpenCL flag.

public static final CLMemory.Mem
COPY_BUFFER

Enum representing CL_MEM_COPY_HOST_PTR.

public static final CLMemory.Mem
READ_ONLY

Enum representing CL_MEM_READ_ONLY.

public static final CLMemory.Mem
READ_WRITE

Enum representing CL_MEM_READ_WRITE.

public static final CLMemory.Mem
USE_BUFFER

Enum representing CL_MEM_USE_HOST_PTR.

public static final CLMemory.Mem
WRITE_ONLY

Enum representing CL_MEM_WRITE_ONLY.

Constructor Summary

AccessConstructor and Description
private
Mem(final int config)

Method Summary

Modifier and TypeMethod and Description
public static int
flagsToInt(final CLMemory.Mem[] flags)

public static CLMemory.Mem
public static CLMemory.Mem
valueOf(final int bufferFlag)

public static CLMemory.Mem[]
public static EnumSet<CLMemory.Mem>
valuesOf(final int bitfield)

Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALLOCATE_BUFFERback to summary
public static final CLMemory.Mem ALLOCATE_BUFFER

Enum representing CL_MEM_ALLOC_HOST_PTR. This flag specifies that the application wants the OpenCL implementation to allocate memory from host accessible memory. ALLOCATE_BUFFER and USE_BUFFER are mutually exclusive.

CONFIGback to summary
public final int CONFIG

Value of wrapped OpenCL flag.

COPY_BUFFERback to summary
public static final CLMemory.Mem COPY_BUFFER

Enum representing CL_MEM_COPY_HOST_PTR. If COPY_BUFFER specified, it indicates that the application wants the OpenCL implementation to allocate memory for the memory object and copy the data from memory referenced by host_ptr.
COPY_BUFFER and USE_BUFFER are mutually exclusive.

READ_ONLYback to summary
public static final CLMemory.Mem READ_ONLY

Enum representing CL_MEM_READ_ONLY. This flag specifies that the memory object is a read-only memory object when used inside a kernel. Writing to a buffer or image object created withREAD_ONLY inside a kernel is undefined.

READ_WRITEback to summary
public static final CLMemory.Mem READ_WRITE

Enum representing CL_MEM_READ_WRITE. This flag specifies that the memory object will be read and written by a kernel.

USE_BUFFERback to summary
public static final CLMemory.Mem USE_BUFFER

Enum representing CL_MEM_USE_HOST_PTR. If specified, it indicates that the application wants the OpenCL implementation to use memory referenced by host_ptr as the storage bits for the memory object. OpenCL implementations are allowed to cache the buffer contents pointed to by host_ptr in device memory. This cached copy can be used when kernels are executed on a device.

WRITE_ONLYback to summary
public static final CLMemory.Mem WRITE_ONLY

Enum representing CL_MEM_WRITE_ONLY. This flags specifies that the memory object will be written but not read by a kernel. Reading from a buffer or image object created with WRITE_ONLY inside a kernel is undefined.

Constructor Detail

Memback to summary
private Mem(final int config)

Method Detail

flagsToIntback to summary
public static int flagsToInt(final CLMemory.Mem[] flags)
valueOfback to summary
public static CLMemory.Mem valueOf(String name)
valueOfback to summary
public static CLMemory.Mem valueOf(final int bufferFlag)
valuesback to summary
public static CLMemory.Mem[] values()
valuesOfback to summary
public static EnumSet<CLMemory.Mem> valuesOf(final int bitfield)