Top Description Inners Fields Constructors Methods
org.lwjgl.opencl

public final Class CL

extends Object
Class Inheritance
Imports
org.lwjgl.*, org.lwjgl.system.*, org.lwjgl.system.macosx.*, javax.annotation.*, java.nio.*, java.util.*

This class loads the OpenCL library (usually via the ICD loader) into the JVM process.

The CLCapabilities instance returned by getICD() contains function pointers for all functionality present in the ICD. This may include multiple platforms with very different capabilities. It should only be used if direct access to the ICD function pointers is required, for customization purposes.

Platform capabilities can be created with createPlatformCapabilities. Calling this method is expensive, so CLCapabilities instances should be cached in user code.

Device capabilities can be created with createDeviceCapabilities. Calling this method is expensive, so CLCapabilities instances should be cached in user code.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static FunctionProviderLocal
private static CLCapabilities

Constructor Summary

AccessConstructor and Description
private
CL()

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
addCLVersions(int MAJOR, int MINOR, Set<String> supportedExtensions)

Must be called after addExtensions.

private static void
addCLVersions(int MAJOR, int MINOR, Set<String> supportedExtensions, String postfix, int[][] versions)

pack-priv static void
addExtensions(String extensionsString, Set<String> supportedExtensions)

pack-priv static <T> T
check(T t)

private static void
checkCLError(int errcode)

public static void
create()

Loads the OpenCL native library, using the default library name.

public static void
create(String
the native library name
libName
)

Loads the OpenCL native library, using the specified library name.

private static void
public static void
create(FunctionProviderLocal
the provider of OpenCL function addresses
functionProvider
)

Initializes OpenCL with the specified FunctionProviderLocal.

public static CLCapabilities

Returns:

the instance
createDeviceCapabilities
(long
the device to query
cl_device_id
,
CLCapabilities platformCapabilities)

Creates a CLCapabilities instance for the specified OpenCL device.

public static CLCapabilities

Returns:

the instance
createPlatformCapabilities
(long
the platform to query
cl_platform_id
)

Creates a CLCapabilities instance for the specified OpenCL platform.

public static void
destroy()

Unloads the OpenCL native library.

private static String
getDeviceInfoStringASCII(long cl_device_id, int param_name)

public static FunctionProviderLocal
getFunctionProvider()

Returns the FunctionProviderLocal for the OpenCL native library.

public static CLCapabilities
getICD()

Returns the CLCapabilities of the ICD.

private static String
getPlatformInfoStringASCII(long cl_platform_id, int param_name)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

functionProviderback to summary
private static FunctionProviderLocal functionProvider
Annotations
@Nullable
icdback to summary
private static CLCapabilities icd
Annotations
@Nullable

Constructor Detail

CLback to summary
private CL()

Method Detail

addCLVersionsback to summary
pack-priv static void addCLVersions(int MAJOR, int MINOR, Set<String> supportedExtensions)

Must be called after addExtensions.

addCLVersionsback to summary
private static void addCLVersions(int MAJOR, int MINOR, Set<String> supportedExtensions, String postfix, int[][] versions)
addExtensionsback to summary
pack-priv static void addExtensions(String extensionsString, Set<String> supportedExtensions)
checkback to summary
pack-priv static <T> T check(T t)
checkCLErrorback to summary
private static void checkCLError(int errcode)
createback to summary
public static void create()

Loads the OpenCL native library, using the default library name.

createback to summary
public static void create(String libName)

Loads the OpenCL native library, using the specified library name.

Parameters
libName:String

the native library name

createback to summary
private static void create(SharedLibrary OPENCL)
createback to summary
public static void create(FunctionProviderLocal functionProvider)

Initializes OpenCL with the specified FunctionProviderLocal. This method can be used to implement custom OpenCL library loading.

Parameters
functionProvider:FunctionProviderLocal

the provider of OpenCL function addresses

createDeviceCapabilitiesback to summary
public static CLCapabilities createDeviceCapabilities(long cl_device_id, CLCapabilities platformCapabilities)

Creates a CLCapabilities instance for the specified OpenCL device.

This method call is relatively expensive. The result should be cached and reused.

Parameters
cl_device_id:long

the device to query

Returns:CLCapabilities

the instance

createPlatformCapabilitiesback to summary
public static CLCapabilities createPlatformCapabilities(long cl_platform_id)

Creates a CLCapabilities instance for the specified OpenCL platform.

This method call is relatively expensive. The result should be cached and reused.

Parameters
cl_platform_id:long

the platform to query

Returns:CLCapabilities

the instance

destroyback to summary
public static void destroy()

Unloads the OpenCL native library.

getDeviceInfoStringASCIIback to summary
private static String getDeviceInfoStringASCII(long cl_device_id, int param_name)
getFunctionProviderback to summary
public static FunctionProviderLocal getFunctionProvider()

Returns the FunctionProviderLocal for the OpenCL native library.

getICDback to summary
public static CLCapabilities getICD()

Returns the CLCapabilities of the ICD.

getPlatformInfoStringASCIIback to summary
private static String getPlatformInfoStringASCII(long cl_platform_id, int param_name)
org.lwjgl.opencl back to summary

private Class CL.SharedLibraryCL

extends Delegate
implements FunctionProviderLocal
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.FunctionProviderLocal, org.lwjgl.system.FunctionProvider

Field Summary

Modifier and TypeField and Description
private final long
private final long
private final long
Inherited from org.lwjgl.system.SharedLibrary.Delegate:
library

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public long
getFunctionAddress(ByteBuffer
the encoded name of the function to query
functionName
)

Implements org.lwjgl.system.FunctionProvider.getFunctionAddress.

Returns the function address of the specified function.
public long
getFunctionAddress(long
the handle to a platform/device/context
handle
,
ByteBuffer
the encoded name of the function to query
functionName
)

Implements org.lwjgl.system.FunctionProviderLocal.getFunctionAddress.

Returns the function address of the specified function for the specified handle.
private boolean
supportsOpenCL12(MemoryStack stack, long platform)

Inherited from org.lwjgl.system.SharedLibrary.Delegate:
addressfreegetNamegetPath

Field Detail

clGetExtensionFunctionAddressback to summary
private final long clGetExtensionFunctionAddress
clGetExtensionFunctionAddressForPlatformback to summary
private final long clGetExtensionFunctionAddressForPlatform
platformback to summary
private final long platform

Constructor Detail

SharedLibraryCLback to summary
pack-priv SharedLibraryCL(SharedLibrary library)

Method Detail

getFunctionAddressback to summary
public long getFunctionAddress(ByteBuffer functionName)

Implements org.lwjgl.system.FunctionProvider.getFunctionAddress.

Doc from org.lwjgl.system.FunctionProvider.getFunctionAddress.

Returns the function address of the specified function. If the function is not supported, returns 0L.

Parameters
functionName:ByteBuffer

the encoded name of the function to query

Returns:long

the function address or 0L if the function is not supported

Annotations
@Override
getFunctionAddressback to summary
public long getFunctionAddress(long handle, ByteBuffer functionName)

Implements org.lwjgl.system.FunctionProviderLocal.getFunctionAddress.

Doc from org.lwjgl.system.FunctionProviderLocal.getFunctionAddress.

Returns the function address of the specified function for the specified handle. If the function is not supported, returns 0L.

Parameters
handle:long

the handle to a platform/device/context

functionName:ByteBuffer

the encoded name of the function to query

Returns:long

the function address or 0L if the function is not supported

Annotations
@Override
supportsOpenCL12back to summary
private boolean supportsOpenCL12(MemoryStack stack, long platform)