public class CLContext extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CLContext.GLTextureTarget |
public Object getClientProperty(Object key)
public Object putClientProperty(Object key, Object value)
public long getMaxMemAllocSize()
public void setCacheBinaries(boolean cacheBinaries)
CLProgram.setCached(boolean).public boolean getCacheBinaries()
setCacheBinaries(boolean) method.CLProgram.setCached(boolean).public CLUserEvent createUserEvent()
public CLQueue createDefaultQueue(CLDevice.QueueProperties... queueProperties)
getDevices()[0].createQueue(context)public CLQueue createDefaultOutOfOrderQueue()
getDevices()[0].createOutOfOrderQueue(context)public CLQueue createDefaultOutOfOrderQueueIfPossible()
public CLQueue createDefaultProfilingQueue()
getDevices()[0].createProfilingQueue(context)public CLImageFormat[] getSupportedImageFormats(CLMem.Flags flags, CLMem.ObjectType imageType)
public CLSampler createSampler(boolean normalized_coords, CLSampler.AddressingMode addressing_mode, CLSampler.FilterMode filter_mode)
public int getDeviceCount()
public CLDevice[] getDevices()
public CLProgram createProgram(String... srcs)
srcs - list of the content of source code for the programpublic CLProgram createProgram(CLDevice[] devices, String... srcs)
public CLProgram loadProgram(InputStream in) throws IOException
CLProgram.store(java.io.OutputStream)in - will be closedIOExceptionpublic CLProgram createProgram(Map<CLDevice,byte[]> binaries, String source)
@Deprecated public CLDevice guessCurrentGLDevice()
public CLBuffer<Byte> createBufferFromGLBuffer(CLMem.Usage usage, int openGLBufferObject)
CLMem.acquireGLObject(com.nativelibs4java.opencl.CLQueue, com.nativelibs4java.opencl.CLEvent[])
see CLMem.releaseGLObject(com.nativelibs4java.opencl.CLQueue, com.nativelibs4java.opencl.CLEvent[])usage - flagsopenGLBufferObject - Identifier of a VBO, as generated by glGenBufferspublic CLImage2D createImage2DFromGLRenderBuffer(CLMem.Usage usage, int openGLRenderBuffer)
CLMem.acquireGLObject(com.nativelibs4java.opencl.CLQueue, com.nativelibs4java.opencl.CLEvent[])
see CLMem.releaseGLObject(com.nativelibs4java.opencl.CLQueue, com.nativelibs4java.opencl.CLEvent[])openGLRenderBuffer - Identifier of an OpenGL render bufferpublic CLImage2D createImage2DFromGLTexture2D(CLMem.Usage usage, CLContext.GLTextureTarget textureTarget, int texture, int mipLevel)
usage - textureTarget - Must be one of GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_TEXTURE_RECTANGLE47. texture_target is used only to define the image type of texture. No reference to a bound GL texture object is made or implied by this parameter.mipLevel - Mipmap level to be used (Implementations may return CL_INVALID_OPERATION for miplevel values > 0)texture - Name of a GL 2D, cubemap or rectangle texture object. The texture object must be a complete texture as per OpenGL rules on texture completeness. The texture format and dimensions defined by OpenGL for the specified miplevel of the texture will be used to create the 2D image object. Only GL texture objects with an internal format that maps to appropriate image channel order and data type specified in tables 5.4 and 5.5 may be used to create a 2D image object.CLException.InvalidMipLevel - if miplevel is less than the value of levelbase (for OpenGL implementations) or zero (for OpenGL ES implementations); or greater than the value of q (for both OpenGL and OpenGL ES). levelbase and q are defined for the texture in section 3.8.10 (Texture Completeness) of the OpenGL 2.1 specification and section 3.7.10 of the OpenGL ES 2.0, or if miplevel is greather than zero and the OpenGL implementation does not support creating from non-zero mipmap levels.CLException.InvalidGLObject - if texture is not a GL texture object whose type matches texture_target, if the specified miplevel of texture is not defined, or if the width or height of the specified miplevel is zero.CLException.InvalidImageFormatDescriptor - if the OpenGL texture internal format does not map to a supported OpenCL image format.public CLPlatform getPlatform()
public CLImage3D createImage3DFromGLTexture3D(CLMem.Usage usage, int texture, int mipLevel)
usage - mipLevel - Mipmap level to be used (Implementations may return CL_INVALID_OPERATION for miplevel values > 0)texture - Name of a GL 3D texture object. The texture object must be a complete texture as per OpenGL rules on texture completeness. The texture format and dimensions defined by OpenGL for the specified miplevel of the texture will be used to create the 3D image object. Only GL texture objects with an internal format that maps to appropriate image channel order and data type specified in tables 5.4 and 5.5 can be used to create the 3D image object.CLException.InvalidMipLevel - if miplevel is less than the value of levelbase (for OpenGL implementations) or zero (for OpenGL ES implementations); or greater than the value of q (for both OpenGL and OpenGL ES). levelbase and q are defined for the texture in section 3.8.10 (Texture Completeness) of the OpenGL 2.1 specification and section 3.7.10 of the OpenGL ES 2.0, or if miplevel is greather than zero and the OpenGL implementation does not support creating from non-zero mipmap levels.CLException.InvalidGLObject - if texture is not a GL texture object whose type matches texture_target, if the specified miplevel of texture is not defined, or if the width or height of the specified miplevel is zero.CLException.InvalidImageFormatDescriptor - if the OpenGL texture internal format does not map to a supported OpenCL image format.public CLImage2D createImage2D(CLMem.Usage usage, Image image, boolean allowUnoptimizingDirectRead)
allowUnoptimizingDirectRead - Some images expose their internal data for direct read, leading to performance increase during the creation of the OpenCL image. However, direct access to the image data disables some Java2D optimizations for this image, leading to degraded performance in subsequent uses with AWT/Swing.public CLImage2D createImage2D(CLMem.Usage usage, CLImageFormat format, long width, long height, long rowPitch, Buffer buffer, boolean copy)
usage - Usage intended for the image.format - Format of the image.width - Image widthheight - Image heightrowPitch - Row pitch.buffer - Image data buffer.copy - Whether to copy the input buffer.public CLImage2D createImage2D(CLMem.Usage usage, CLImageFormat format, long width, long height, long rowPitch)
usage - Usage intended for the image.format - Format of the image.width - Image widthheight - Image heightrowPitch - Row pitch.public CLImage2D createImage2D(CLMem.Usage usage, CLImageFormat format, long width, long height)
usage - Usage intended for the image.format - Format of the image.width - Image widthheight - Image heightpublic CLImage3D createImage3D(CLMem.Usage usage, CLImageFormat format, long width, long height, long depth, long rowPitch, long slicePitch, Buffer buffer, boolean copy)
usage - Usage intended for the image.format - Format of the image.width - Image widthheight - Image heightdepth - Image depthrowPitch - Row pitch.slicePitch - Slice pitch.buffer - Image data buffer.copy - Whether to copy the input buffer.public CLImage3D createImage3D(CLMem.Usage usage, CLImageFormat format, long width, long height, long depth, long rowPitch, long slicePitch)
usage - Usage intended for the image.format - Format of the image.width - Image widthheight - Image heightdepth - Image depthrowPitch - Row pitch.slicePitch - Slice pitch.public CLImage3D createImage3D(CLMem.Usage usage, CLImageFormat format, long width, long height, long depth)
usage - Usage intended for the image.format - Format of the image.width - Image widthheight - Image heightdepth - Image depthpublic CLBuffer<Integer> createIntBuffer(CLMem.Usage usage, IntBuffer data, boolean copy)
CLBuffer<Integer> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Integer> createIntBuffer(CLMem.Usage usage, Pointer<Integer> data)
CLBuffer<Integer> OpenCL buffer big enough to hold the valid values of the provided data pointer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Host data to copy to the bufferpublic CLBuffer<Integer> createIntBuffer(CLMem.Usage usage, Pointer<Integer> data, boolean copy)
CLBuffer<Integer> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Integer> createIntBuffer(CLMem.Usage usage, long elementCount)
CLBuffer<Integer> OpenCL buffer big enough to hold 'length' values of type int.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.elementCount - Length of the buffer expressed in elements (for instance, a CLBuffer<Integer> of length 10 will actually contain 10 * 4 bytes, as ints are 4-bytes-long)public CLBuffer<Long> createLongBuffer(CLMem.Usage usage, LongBuffer data, boolean copy)
CLBuffer<Long> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Long> createLongBuffer(CLMem.Usage usage, Pointer<Long> data)
CLBuffer<Long> OpenCL buffer big enough to hold the valid values of the provided data pointer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Host data to copy to the bufferpublic CLBuffer<Long> createLongBuffer(CLMem.Usage usage, Pointer<Long> data, boolean copy)
CLBuffer<Long> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Long> createLongBuffer(CLMem.Usage usage, long elementCount)
CLBuffer<Long> OpenCL buffer big enough to hold 'length' values of type long.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.elementCount - Length of the buffer expressed in elements (for instance, a CLBuffer<Long> of length 10 will actually contain 10 * 8 bytes, as longs are 8-bytes-long)public CLBuffer<Short> createShortBuffer(CLMem.Usage usage, ShortBuffer data, boolean copy)
CLBuffer<Short> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Short> createShortBuffer(CLMem.Usage usage, Pointer<Short> data)
CLBuffer<Short> OpenCL buffer big enough to hold the valid values of the provided data pointer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Host data to copy to the bufferpublic CLBuffer<Short> createShortBuffer(CLMem.Usage usage, Pointer<Short> data, boolean copy)
CLBuffer<Short> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Short> createShortBuffer(CLMem.Usage usage, long elementCount)
CLBuffer<Short> OpenCL buffer big enough to hold 'length' values of type short.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.elementCount - Length of the buffer expressed in elements (for instance, a CLBuffer<Short> of length 10 will actually contain 10 * 2 bytes, as shorts are 2-bytes-long)public CLBuffer<Byte> createByteBuffer(CLMem.Usage usage, Buffer data, boolean copy)
CLBuffer<Byte> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Byte> createByteBuffer(CLMem.Usage usage, Pointer<Byte> data)
CLBuffer<Byte> OpenCL buffer big enough to hold the valid values of the provided data pointer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Host data to copy to the bufferpublic CLBuffer<Byte> createByteBuffer(CLMem.Usage usage, Pointer<Byte> data, boolean copy)
CLBuffer<Byte> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Byte> createByteBuffer(CLMem.Usage usage, long elementCount)
CLBuffer<Byte> OpenCL buffer big enough to hold 'length' values of type byte.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.elementCount - Length of the buffer expressed in elements (for instance, a CLBuffer<Byte> of length 10 will actually contain 10 * 1 bytes, as bytes are 1-bytes-long)public CLBuffer<Character> createCharBuffer(CLMem.Usage usage, CharBuffer data, boolean copy)
CLBuffer<Character> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Character> createCharBuffer(CLMem.Usage usage, Pointer<Character> data)
CLBuffer<Character> OpenCL buffer big enough to hold the valid values of the provided data pointer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Host data to copy to the bufferpublic CLBuffer<Character> createCharBuffer(CLMem.Usage usage, Pointer<Character> data, boolean copy)
CLBuffer<Character> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Character> createCharBuffer(CLMem.Usage usage, long elementCount)
CLBuffer<Character> OpenCL buffer big enough to hold 'length' values of type char.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.elementCount - Length of the buffer expressed in elements (for instance, a CLBuffer<Character> of length 10 will actually contain 10 * 2 bytes, as chars are 2-bytes-long)public CLBuffer<Float> createFloatBuffer(CLMem.Usage usage, FloatBuffer data, boolean copy)
CLBuffer<Float> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Float> createFloatBuffer(CLMem.Usage usage, Pointer<Float> data)
CLBuffer<Float> OpenCL buffer big enough to hold the valid values of the provided data pointer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Host data to copy to the bufferpublic CLBuffer<Float> createFloatBuffer(CLMem.Usage usage, Pointer<Float> data, boolean copy)
CLBuffer<Float> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Float> createFloatBuffer(CLMem.Usage usage, long elementCount)
CLBuffer<Float> OpenCL buffer big enough to hold 'length' values of type float.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.elementCount - Length of the buffer expressed in elements (for instance, a CLBuffer<Float> of length 10 will actually contain 10 * 4 bytes, as floats are 4-bytes-long)public CLBuffer<Double> createDoubleBuffer(CLMem.Usage usage, DoubleBuffer data, boolean copy)
CLBuffer<Double> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Double> createDoubleBuffer(CLMem.Usage usage, Pointer<Double> data)
CLBuffer<Double> OpenCL buffer big enough to hold the valid values of the provided data pointer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Host data to copy to the bufferpublic CLBuffer<Double> createDoubleBuffer(CLMem.Usage usage, Pointer<Double> data, boolean copy)
CLBuffer<Double> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public CLBuffer<Double> createDoubleBuffer(CLMem.Usage usage, long elementCount)
CLBuffer<Double> OpenCL buffer big enough to hold 'length' values of type double.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.elementCount - Length of the buffer expressed in elements (for instance, a CLBuffer<Double> of length 10 will actually contain 10 * 8 bytes, as doubles are 8-bytes-long)public <T> CLBuffer<T> createBuffer(CLMem.Usage usage, Pointer<T> data)
usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements())public <T> CLBuffer<T> createBuffer(CLMem.Usage usage, Pointer<T> data, boolean copy)
CLBuffer<N> OpenCL buffer with the provided initial values.CLBuffer#map(CLQueue, MapFlags, CLEvent...) is then necessary to ensure the data is properly synchronized with the buffer.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.data - Pointer to the initial values, must have known bounds (see Pointer.getValidElements()).data - Data buffer.copy - Whether to copy the input data.public <T> CLBuffer<T> createBuffer(CLMem.Usage usage, Class<T> elementClass, long elementCount)
CLBuffer<N> OpenCL buffer big enough to hold 'length' values of type T.usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.elementClass - Primitive type of the buffer. For instance a buffer of 'int' values can be created with elementClass being Integer.class or int.class indifferently.elementCount - Length of the buffer expressed in elements@Deprecated public <T> CLBuffer<T> createBuffer(CLMem.Usage usage, PointerIO<T> io, long elementCount)
usage - Usage intended for the pointer in OpenCL kernels : a pointer created with CLMem.Usage.Input cannot be written to in a kernel.io - Delegate responsible for reading and writing values.elementCount - Length of the buffer expressed in elements (for instance, a CLBuffer<Integer> of length 4 will actually contain 4 * 4 bytes, as ints are 4-bytes-long)public ByteOrder getKernelsDefaultByteOrder()
public ByteOrder getByteOrder()
public int getAddressBits()
public boolean isDoubleSupported()
CLDevice.isDoubleSupported()).public boolean isHalfSupported()
CLDevice.isHalfSupported()).public boolean isByteAddressableStoreSupported()
public void release()
public static <E extends TypedPointer,A extends com.nativelibs4java.opencl.CLAbstractEntity> Pointer<E> getEntities(A[] objects, Pointer<E> out)
public int hashCode()
Copyright © 2009-2015. All Rights Reserved.