Package com.jme3.opencl
Class Program
java.lang.Object
com.jme3.opencl.AbstractOpenCLObject
com.jme3.opencl.Program
- All Implemented Interfaces:
OpenCLObject
- Direct Known Subclasses:
LwjglProgram
A wrapper for an OpenCL program. A program is created from kernel source code,
manages the build process and creates the kernels.
Warning: Creating the same kernel more than one leads to undefined behaviour,
this is especially important for createAllKernels()
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jme3.opencl.OpenCLObject
OpenCLObject.ObjectReleaser -
Field Summary
Fields inherited from class com.jme3.opencl.AbstractOpenCLObject
releaser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild()Builds this program without additional argumentsabstract voidBuilds this program with the specified argument string on the specified devices.abstract Kernel[]Creates all available kernels in this program.abstract KernelcreateKernel(String name) Creates the kernel with the specified name.abstract ByteBufferQueries a compiled binary representation of this program for a particular device.register()Registers this object for automatic releasing on garbage collection.Methods inherited from class com.jme3.opencl.AbstractOpenCLObject
finalize, getReleaser, release
-
Constructor Details
-
Program
-
-
Method Details
-
register
Description copied from interface:OpenCLObjectRegisters this object for automatic releasing on garbage collection. By default, OpenCLObjects are not registered in theOpenCLObjectManager, you have to release it manually by callingOpenCLObject.release(). Without registering or releasing, a memory leak might occur.
Returnsthisto allow calls likeBuffer buffer = clContext.createBuffer(1024).register();.- Specified by:
registerin interfaceOpenCLObject- Overrides:
registerin classAbstractOpenCLObject- Returns:
this
-
build
Builds this program with the specified argument string on the specified devices. Please see the official OpenCL specification for a definition of all supported arguments. The list of devices specify on which device the compiled program can then be executed. It must be a subset ofContext.getDevices(). Ifnullis passed, the program is built on all available devices.- Parameters:
args- the compilation argumentsdevices- a list of devices on which the program is build.- Throws:
KernelCompilationException- if the compilation fails- See Also:
-
build
Builds this program without additional arguments- Throws:
KernelCompilationException- if the compilation fails
-
createKernel
Creates the kernel with the specified name.- Parameters:
name- the name of the kernel as defined in the source code- Returns:
- the kernel object
- Throws:
OpenCLException- if the kernel was not found or some other error occurred
-
createAllKernels
Creates all available kernels in this program. The names of the kernels can then be queried byKernel.getName().- Returns:
- an array of all kernels
-
getBinary
Queries a compiled binary representation of this program for a particular device. This binary can then be used e.g. in the next application launch to create the program from the binaries and not from the sources. This saves time.- Parameters:
device- the device from which the binaries are taken- Returns:
- the binaries
- See Also:
-