Package com.jogamp.opencl
Class CLProgramBuilder
- java.lang.Object
-
- com.jogamp.opencl.CLProgramBuilder
-
- All Implemented Interfaces:
CLBuildConfiguration,CLProgramConfiguration,Serializable,Cloneable
public final class CLProgramBuilder extends Object implements CLProgramConfiguration, Serializable, Cloneable
CLProgramBuilder is a helper for building programs with more complex configurations or building multiple programs with similar configurations. CLProgramBuilder is used to createCLProgramConfigurations andCLBuildConfigurations.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CLProgramBuilderasBuildConfiguration()Returns a new instance of of this configuration without aCLProgram, program binaries or sources associated with it.CLProgrambuild()Builds or rebuilds a program.CLProgrambuild(CLProgram program)Builds or rebuilds the program.CLProgrambuild(CLProgram program, CLBuildListener listener)Builds or rebuilds the program.CLProgrambuild(CLBuildListener listener)Builds or rebuilds a program.CLProgramBuilderclone()Clones this configuration.static CLBuildConfigurationcreateConfiguration()Creates a new CLBuildConfiguration.static CLProgramConfigurationcreateConfiguration(CLProgram program)Creates a new CLProgramConfiguration for this program.booleanequals(Object o)CLProgramBuilderforDevice(CLDevice device)Adds the device as build target.CLProgramBuilderforDevices(CLDevice... devices)Adds the devices as build target.CLProgramgetProgram()Returns the program.inthashCode()static CLBuildConfigurationloadConfiguration(ObjectInputStream ois)Loads a CLBuildConfiguration.static CLProgramConfigurationloadConfiguration(ObjectInputStream ois, CLContext context)Loads a CLProgramConfiguration containing a CLProgram.CLProgramBuilderreset()Resets this builder's configuration like options, devices and definitions.CLProgramConfigurationresetDefines()Resets this builder's macro definitions.CLProgramConfigurationresetDevices()Resets this builder's device list.CLProgramConfigurationresetOptions()Resets this builder's configuration options.voidsave(ObjectOutputStream oos)Saves this configuration to the ObjectOutputStream.CLProgramBuildersetProgram(CLProgram program)Sets the program which should be build.StringtoString()CLProgramBuilderwithDefine(String name)Adds the definition to the build configuration.CLProgramBuilderwithDefine(String name, Object value)Adds the definition to the build configuration.CLProgramBuilderwithDefines(String... names)Adds the definitions to the build configuration.CLProgramBuilderwithDefines(Map<String,? extends Object> defines)Adds the definitions to the build configuration.CLProgramBuilderwithOption(String option)Adds the compiler option to the build configuration.CLProgramBuilderwithOptions(String... options)Adds the compiler options to the build configuration.
-
-
-
Method Detail
-
createConfiguration
public static CLBuildConfiguration createConfiguration()
Creates a new CLBuildConfiguration.
-
createConfiguration
public static CLProgramConfiguration createConfiguration(CLProgram program)
Creates a new CLProgramConfiguration for this program.
-
loadConfiguration
public static CLBuildConfiguration loadConfiguration(ObjectInputStream ois) throws IOException, ClassNotFoundException
Loads a CLBuildConfiguration.- Parameters:
ois- The ObjectInputStream for reading the object.- Throws:
IOExceptionClassNotFoundException
-
loadConfiguration
public static CLProgramConfiguration loadConfiguration(ObjectInputStream ois, CLContext context) throws IOException, ClassNotFoundException
Loads a CLProgramConfiguration containing a CLProgram. The CLProgram is initialized and ready to be build after this method call. This method prefers program initialization from binaries if this fails or if no binaries have been found, it will try to load the program from sources. If this also fails an appropriate exception will be thrown.- Parameters:
ois- The ObjectInputStream for reading the object.context- The context used for program initialization.- Throws:
IOExceptionClassNotFoundException
-
save
public void save(ObjectOutputStream oos) throws IOException
Description copied from interface:CLBuildConfigurationSaves this configuration to the ObjectOutputStream. The caller is responsible for closing the stream.- Specified by:
savein interfaceCLBuildConfiguration- Throws:
IOException
-
withOption
public CLProgramBuilder withOption(String option)
Description copied from interface:CLBuildConfigurationAdds the compiler option to the build configuration.- Specified by:
withOptionin interfaceCLBuildConfiguration- Specified by:
withOptionin interfaceCLProgramConfiguration- See Also:
CLProgram.CompilerOptions
-
withOptions
public CLProgramBuilder withOptions(String... options)
Description copied from interface:CLBuildConfigurationAdds the compiler options to the build configuration.- Specified by:
withOptionsin interfaceCLBuildConfiguration- Specified by:
withOptionsin interfaceCLProgramConfiguration- See Also:
CLProgram.CompilerOptions
-
withDefine
public CLProgramBuilder withDefine(String name)
Description copied from interface:CLBuildConfigurationAdds the definition to the build configuration.- Specified by:
withDefinein interfaceCLBuildConfiguration- Specified by:
withDefinein interfaceCLProgramConfiguration- See Also:
CLProgram.define(java.lang.String)
-
withDefines
public CLProgramBuilder withDefines(String... names)
Description copied from interface:CLBuildConfigurationAdds the definitions to the build configuration.- Specified by:
withDefinesin interfaceCLBuildConfiguration- Specified by:
withDefinesin interfaceCLProgramConfiguration- See Also:
CLProgram.define(java.lang.String)
-
withDefine
public CLProgramBuilder withDefine(String name, Object value)
Description copied from interface:CLBuildConfigurationAdds the definition to the build configuration.- Specified by:
withDefinein interfaceCLBuildConfiguration- Specified by:
withDefinein interfaceCLProgramConfiguration- See Also:
CLProgram.define(java.lang.String, java.lang.Object)
-
withDefines
public CLProgramBuilder withDefines(Map<String,? extends Object> defines)
Description copied from interface:CLBuildConfigurationAdds the definitions to the build configuration.- Specified by:
withDefinesin interfaceCLBuildConfiguration- Specified by:
withDefinesin interfaceCLProgramConfiguration- See Also:
CLProgram.define(java.lang.String, java.lang.Object)
-
forDevice
public CLProgramBuilder forDevice(CLDevice device)
Description copied from interface:CLBuildConfigurationAdds the device as build target.- Specified by:
forDevicein interfaceCLBuildConfiguration- Specified by:
forDevicein interfaceCLProgramConfiguration
-
forDevices
public CLProgramBuilder forDevices(CLDevice... devices)
Description copied from interface:CLBuildConfigurationAdds the devices as build target.- Specified by:
forDevicesin interfaceCLBuildConfiguration- Specified by:
forDevicesin interfaceCLProgramConfiguration
-
build
public CLProgram build()
Description copied from interface:CLProgramConfigurationBuilds or rebuilds a program.- Specified by:
buildin interfaceCLProgramConfiguration
-
build
public CLProgram build(CLBuildListener listener)
Description copied from interface:CLProgramConfigurationBuilds or rebuilds a program.- Specified by:
buildin interfaceCLProgramConfiguration- Parameters:
listener- The callback who will be notified when the program has built.
-
build
public CLProgram build(CLProgram program)
Description copied from interface:CLBuildConfigurationBuilds or rebuilds the program.- Specified by:
buildin interfaceCLBuildConfiguration- Parameters:
program- The program which should be build.
-
build
public CLProgram build(CLProgram program, CLBuildListener listener)
Description copied from interface:CLBuildConfigurationBuilds or rebuilds the program.- Specified by:
buildin interfaceCLBuildConfiguration- Parameters:
program- The program which should be build.listener- The callback who is notified when the program has built.
-
reset
public CLProgramBuilder reset()
Description copied from interface:CLBuildConfigurationResets this builder's configuration like options, devices and definitions.- Specified by:
resetin interfaceCLBuildConfiguration- Specified by:
resetin interfaceCLProgramConfiguration
-
resetDefines
public CLProgramConfiguration resetDefines()
Description copied from interface:CLBuildConfigurationResets this builder's macro definitions.- Specified by:
resetDefinesin interfaceCLBuildConfiguration- Specified by:
resetDefinesin interfaceCLProgramConfiguration
-
resetDevices
public CLProgramConfiguration resetDevices()
Description copied from interface:CLBuildConfigurationResets this builder's device list.- Specified by:
resetDevicesin interfaceCLBuildConfiguration- Specified by:
resetDevicesin interfaceCLProgramConfiguration
-
resetOptions
public CLProgramConfiguration resetOptions()
Description copied from interface:CLBuildConfigurationResets this builder's configuration options.- Specified by:
resetOptionsin interfaceCLBuildConfiguration- Specified by:
resetOptionsin interfaceCLProgramConfiguration
-
asBuildConfiguration
public CLProgramBuilder asBuildConfiguration()
Description copied from interface:CLProgramConfigurationReturns a new instance of of this configuration without aCLProgram, program binaries or sources associated with it.- Specified by:
asBuildConfigurationin interfaceCLProgramConfiguration
-
clone
public CLProgramBuilder clone()
Description copied from interface:CLBuildConfigurationClones this configuration.- Specified by:
clonein interfaceCLBuildConfiguration- Specified by:
clonein interfaceCLProgramConfiguration- Overrides:
clonein classObject
-
getProgram
public CLProgram getProgram()
Description copied from interface:CLProgramConfigurationReturns the program.- Specified by:
getProgramin interfaceCLProgramConfiguration
-
setProgram
public CLProgramBuilder setProgram(CLProgram program)
Description copied from interface:CLBuildConfigurationSets the program which should be build.- Specified by:
setProgramin interfaceCLBuildConfiguration
-
-