Struct ocl::builders::ProgramBuilder
[−]
[src]
#[must_use = "builders do nothing unless \'::build\' is called"]pub struct ProgramBuilder { /* fields omitted */ }
A builder for Program
.
Methods
impl ProgramBuilder
[src]
fn new() -> ProgramBuilder
Returns a new, empty, build configuration object.
fn build(self, context: &Context) -> OclResult<Program>
Returns a newly built Program.
-
TODO: If the context is associated with more than one device, check that at least one of those devices has been specified. An empty device list will cause an
OpenCL
error in that case. -
TODO: Check for duplicate devices in the final device list.
fn cmplr_def<S: Into<String>>(self, name: S, val: i32) -> ProgramBuilder
Adds a build option containing a compiler command line definition.
Formatted as -D {name}={val}
.
Example
...cmplr_def("MAX_ITERS", 500)...
fn cmplr_opt<S: Into<String>>(self, co: S) -> ProgramBuilder
Adds a build option containing a raw compiler command line parameter.
Formatted as {}
(exact text).
Example
...cmplr_opt("-g")...
fn bo(self, bo: BuildOpt) -> ProgramBuilder
Pushes pre-created build option to the list of options.
fn src_file<P: Into<PathBuf>>(self, file_path: P) -> ProgramBuilder
Adds the contents of a file to the program.
fn src<S: Into<String>>(self, src: S) -> ProgramBuilder
Adds raw text to the program source.
fn devices<D: Into<DeviceSpecifier>>(self, device_spec: D) -> ProgramBuilder
Specifies a list of devices to build this program on. The devices must
be associated with the context passed to ::build
later on.
Devices may be specified in any number of ways including simply
passing a device or slice of devices. See the impl From
section of
DeviceSpecifier
for more information.
Panics
Devices must not have already been specified.
fn get_device_spec(&self) -> &Option<DeviceSpecifier>
Returns the devices specified to be associated the program.
fn get_compiler_options(&self) -> OclResult<CString>
Returns a concatenated string of command line options to be passed to the compiler when building this program.
fn get_src_strings(&self) -> OclResult<Vec<CString>>
Returns the final program source code as a list of strings.
Order of Inclusion
- Macro definitions and code strings specified by a
BuildOpt::IncludeDefine
orBuildOpt::IncludeRaw
via::bo
- Contents of files specified via
::src_file
- Contents of strings specified via
::src
or aBuildOpt::IncludeRawEof
via::bo
Trait Implementations
impl Clone for ProgramBuilder
[src]
fn clone(&self) -> ProgramBuilder
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more