Package com.jogamp.opencl
Class CLMemory<B extends Buffer>
- java.lang.Object
-
- com.jogamp.opencl.CLObject
-
- com.jogamp.opencl.CLMemory<B>
-
- All Implemented Interfaces:
AutoCloseable,CLResource
public abstract class CLMemory<B extends Buffer> extends CLObject
Common superclass for all OpenCL memory types. Represents an OpenCL memory object and wraps an optional NIO buffer.- Author:
- Michael Bien, et al.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCLMemory.GLObjectTypestatic classCLMemory.MapConfigures the mapping process.static classCLMemory.MemMemory settings for configuring CLMemory.
-
Field Summary
Fields Modifier and Type Field Description protected intclCapacityprotected intelementSizeprotected intFLAGSprotected longsize
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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.voidclose()Deprecated.This method is not intended to be called from client code.booleanequals(Object obj)Returns the OpenGL buffer type of this shared buffer.BgetBuffer()Returns the optional NIO buffer for this memory object.protected static CLgetCL(CLContext context)intgetCLCapacity()Returns the size in buffer elements of this memory object.longgetCLSize()Returns the size of the allocated OpenCL memory in bytes.EnumSet<CLMemory.Mem>getConfig()Returns the configuration of this memory object.intgetElementSize()Returns the size in bytes of a single buffer element.intgetMapCount()Returns the number of buffer mappings.intgetNIOCapacity()Returns the capacity of the wrapped direct buffer or 0 if no buffer available.intgetNIOSize()Returns the size of the wrapped direct buffer in byte or 0 if no buffer available.protected static longgetSizeImpl(CLContext context, long id)inthashCode()protected voidinitCLCapacity()protected static booleanisHostPointerFlag(int flags)Returns true if a host pointer must be specified on mem object creation.booleanisReadOnly()Returns true if this memory object was created with theCLMemory.Mem.READ_ONLYflag.booleanisReadWrite()Returns true if this memory object was created with theCLMemory.Mem.READ_WRITEflag.booleanisReleased()Returns true ifCLResource.release()has been called.booleanisWriteOnly()Returns true if this memory object was created with theCLMemory.Mem.WRITE_ONLYflag.voidregisterDestructorCallback(CLMemObjectListener listener)Registers a callback which will be called by the OpenCL implementation when the memory object is released.voidrelease()Releases the OpenCL resource.StringtoString()CLMemory<B>use(B buffer)-
Methods inherited from class com.jogamp.opencl.CLObject
getContext, getID, getPlatform
-
-
-
-
Method Detail
-
initCLCapacity
protected final void initCLCapacity()
-
isHostPointerFlag
protected static boolean isHostPointerFlag(int flags)
Returns true if a host pointer must be specified on mem object creation.
-
getSizeImpl
protected static long getSizeImpl(CLContext context, long id)
-
registerDestructorCallback
public void registerDestructorCallback(CLMemObjectListener listener)
Registers a callback which will be called by the OpenCL implementation when the memory object is released.
-
cloneWith
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.
-
getBuffer
public B getBuffer()
Returns the optional NIO buffer for this memory object.
-
getNIOCapacity
public int getNIOCapacity()
Returns the capacity of the wrapped direct buffer or 0 if no buffer available.
-
getNIOSize
public int getNIOSize()
Returns the size of the wrapped direct buffer in byte or 0 if no buffer available.
-
getCLSize
public long getCLSize()
Returns the size of the allocated OpenCL memory in bytes.
-
getCLCapacity
public int getCLCapacity()
Returns the size in buffer elements of this memory object.
-
getElementSize
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.
-
getConfig
public EnumSet<CLMemory.Mem> getConfig()
Returns the configuration of this memory object.
-
getMapCount
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.
-
isReadOnly
public boolean isReadOnly()
Returns true if this memory object was created with theCLMemory.Mem.READ_ONLYflag.
-
isWriteOnly
public boolean isWriteOnly()
Returns true if this memory object was created with theCLMemory.Mem.WRITE_ONLYflag.
-
isReadWrite
public boolean isReadWrite()
Returns true if this memory object was created with theCLMemory.Mem.READ_WRITEflag.
-
release
public void release()
Description copied from interface:CLResourceReleases the OpenCL resource.- Specified by:
releasein interfaceCLResource
-
equals
public boolean equals(Object obj)
Returns the OpenGL buffer type of this shared buffer.
-
close
@Deprecated public final void close()
Deprecated.This method is not intended to be called from client code.Implementation detail, satisfyingAutoCloseable. Might be remove as soon we have extension methods, but shall validate with Java 1.5 specs.- Specified by:
closein interfaceAutoCloseable- See Also:
AutoCloseable
-
isReleased
public boolean isReleased()
Description copied from interface:CLResourceReturns true ifCLResource.release()has been called.- Specified by:
isReleasedin interfaceCLResource
-
-