Struct ocl::builders::ProQueBuilder
[−]
[src]
#[must_use = "builders do nothing unless \'::build\' is called"]pub struct ProQueBuilder { /* fields omitted */ }
A builder for ProQue
.
Methods
impl ProQueBuilder
[src]
fn new() -> ProQueBuilder
Returns a new ProQueBuilder
with an empty / default configuration.
The minimum amount of configuration possible before calling ::build
is to
simply assign some source code using ::src
.
For full configuration options, separately create a Context
and
ProgramBuilder
(do not ::build
the ProgramBuilder
, its device
list must be set by this ProQueBuilder
to assure consistency) then
pass them as arguments to the ::context
and ::prog_bldr
methods
respectively.
fn platform(&mut self, platform: Platform) -> &mut ProQueBuilder
Sets the platform to be used and returns the builder.
Panics
If context is set, this will panic upon building. Only one or the other can be configured.
fn context(&mut self, context: Context) -> &mut ProQueBuilder
Sets the context and returns the ProQueBuilder
.
Panics
If platform is set, this will panic upon building. Only one or the other can be configured.
fn device<D: Into<DeviceSpecifier>>(
&mut self,
device_spec: D
) -> &mut ProQueBuilder
&mut self,
device_spec: D
) -> &mut ProQueBuilder
Sets a device or devices to be used and returns a ProQueBuilder
reference.
Must specify only a single device.
fn src<S: Into<String>>(&mut self, src: S) -> &mut ProQueBuilder
Adds some source code to be compiled and returns the ProQueBuilder
.
Creates a ProgramBuilder
if one has not already been added. Attempts
to call ::program_builder
after calling this method will cause a panic.
If you need a more complex build configuration or to add multiple
source files. Pass an unbuilt ProgramBuilder
to the
::program_builder
method (described below).
fn prog_bldr(&mut self, program_builder: ProgramBuilder) -> &mut ProQueBuilder
Adds a pre-configured ProgramBuilder
and returns the ProQueBuilder
.
Panics
This ProQueBuilder
may not already contain a ProgramBuilder
.
program_builder
must not have any device indices configured (via its
::device_idxs
method). ProQueBuilder
will only build programs for
the device specified by ::device_idx
or the default device if none has
been specified.
fn dims<D: Into<SpatialDims>>(&mut self, dims: D) -> &mut ProQueBuilder
Sets the built-in dimensions.
This is optional.
Use if you want to be able to call the ::create_kernel
or
::create_buffer
methods on the ProQue
created by this builder.
Dimensions can alternatively be set after building by using the
ProQue::set_dims
method.
fn queue_properties(
&mut self,
props: CommandQueueProperties
) -> &mut ProQueBuilder
&mut self,
props: CommandQueueProperties
) -> &mut ProQueBuilder
Sets the command queue properties.
Optional.
fn build(&self) -> OclResult<ProQue>
Returns a new ProQue
.
Errors
A ProgramBuilder
or some source code must have been specified with
::prog_bldr
or ::src
before building.