public abstract class Program extends AbstractOpenCLObject
Warning: Creating the same kernel more than one leads to undefined behaviour,
this is especially important for createAllKernels()
OpenCLObject.ObjectReleaser
releaser
Modifier | Constructor and Description |
---|---|
protected |
Program(OpenCLObject.ObjectReleaser releaser) |
Modifier and Type | Method and Description |
---|---|
void |
build()
Builds this program without additional arguments
|
abstract void |
build(java.lang.String args,
Device... devices)
Builds this program with the specified argument string on the specified
devices.
|
abstract Kernel[] |
createAllKernels()
Creates all available kernels in this program.
|
abstract Kernel |
createKernel(java.lang.String name)
Creates the kernel with the specified name.
|
abstract java.nio.ByteBuffer |
getBinary(Device device)
Queries a compiled binary representation of this program for a particular
device.
|
Program |
register()
Registers this object for automatic releasing on garbage collection.
|
finalize, getReleaser, release
protected Program(OpenCLObject.ObjectReleaser releaser)
public Program register()
OpenCLObject
OpenCLObjectManager
, you have to release it manually
by calling OpenCLObject.release()
.
Without registering or releasing, a memory leak might occur.
this
to allow calls like
Buffer buffer = clContext.createBuffer(1024).register();
.register
in interface OpenCLObject
register
in class AbstractOpenCLObject
this
public abstract void build(java.lang.String args, Device... devices) throws KernelCompilationException
Context.getDevices()
.
If null
is passed, the program is built on all available devices.args
- the compilation argumentsdevices
- a list of devices on which the program is build.KernelCompilationException
- if the compilation failsbuild()
public void build() throws KernelCompilationException
KernelCompilationException
- if the compilation failspublic abstract Kernel createKernel(java.lang.String name)
name
- the name of the kernel as defined in the source codeOpenCLException
- if the kernel was not found or some other error
occurredpublic abstract Kernel[] createAllKernels()
Kernel.getName()
.public abstract java.nio.ByteBuffer getBinary(Device device)
device
- the device from which the binaries are takenContext.createProgramFromBinary(java.nio.ByteBuffer, com.jme3.opencl.Device)