Struct ocl::builders::BufferWriteCmd[][src]

#[must_use = "commands do nothing unless enqueued"]
pub struct BufferWriteCmd<'c, 'd, T> where
    T: 'c + 'd + OclPrm
{ /* fields omitted */ }

A buffer command builder used to enqueue writes.

See SDK docs for more details.

Methods

impl<'c, 'd, T> BufferWriteCmd<'c, 'd, T> where
    T: OclPrm
[src]

Specifies a queue to use for this call only.

Overrides the buffer's default queue if one is set. If no default queue is set, this method must be called before enqueuing the command.

Specifies whether or not to block the current thread until completion.

Ignored if this is not a read or write operation.

Default is block = true.

Safety

When performing non-blocking reads or writes, the caller must ensure that the data being read from or written to is not accessed improperly until the command completes. Use events (Event::wait_for) or the command queue (Queue::finish) to synchronize.

If possible, prefer instead to use ::map with ::enq_async for optimal performance and data integrity.

Sets the linear offset for an operation.

Panics

The 'shape' may not have already been set to rectangular by the ::rect function.

Sets an offset into the source data.

Equivalent to setting the start position of a slice into the source data (e.g. src_data[src_offset..]). Use ::len to set the end position (resulting in src_data[dst_offset..len]).

Defaults to 0 if not set. Panics if ::rect has been called.

Sets the total length of data to write.

Equivalent to setting the end position of a slice into the source data (e.g. src_data[..len]). Use ::src_offset to set the start position (resulting in src_data[src_offset..len]).

Defaults to the length of the write source provided. Panics if ::rect has been called.

Specifies that this will be a rectangularly shaped operation (the default being linear).

Row and slice pitches must all be expressed in bytes.

Panics if :offset, src_offset, or ::len have been called.

Specifies an event or list of events to wait on before the command will run.

When events generated using the ::enew method of other, previously enqueued commands are passed here (either individually or as part of an EventList), this command will not execute until those commands have completed.

Using events can compliment the use of queues to order commands by creating temporal dependencies between them (where commands in one queue must wait for the completion of commands in another). Events can also supplant queues altogether when, for example, using out-of-order queues.

Example

This example is not tested
// Create an event list:
let mut event_list = EventList::new();
// Enqueue a kernel on `queue_1`, creating an event representing the kernel
// command in our list:
kernel.cmd().queue(&queue_1).enew(&mut event_list).enq()?;
// Write to a buffer using `queue_2`, ensuring the write does not begin until
// after the kernel command has completed:
buffer.write(rwvec.clone()).queue(&queue_2).ewait(&event_list).enq_async()?;

Specifies the destination to store a new, optionally created event associated with this command.

The destination can be a mutable reference to an empty event (created using Event::empty) or a mutable reference to an event list.

After this command is enqueued, the event in the destination can be passed to the ::ewait method of another command. Doing so will cause the other command to wait until this command has completed before executing.

Using events can compliment the use of queues to order commands by creating temporal dependencies between them (where commands in one queue must wait for the completion of commands in another). Events can also supplant queues altogether when, for example, using out-of-order queues.

Example

This example is not tested
// Create an event list:
let mut event = Event::empty();
// Enqueue a kernel on `queue_1`, creating an event representing the kernel
// command in our list:
kernel.cmd().queue(&queue_1).enew(&mut event).enq()?;
// Write to a buffer using `queue_2`, ensuring the write does not begin until
// after the kernel command has completed:
buffer.write(rwvec.clone()).queue(&queue_2).ewait(&event).enq_async()?;

Enqueues this command, blocking the current thread until it is complete.

If an RwVec is being used as the data destination, the current thread will be blocked until an exclusive lock can be obtained before running the command (which will also block).

Enqueues this command and returns a future representing its completion which resolves to a read guard usable within subsequent futures.

A data destination container appropriate for an asynchronous operation (such as RwVec) must have been passed to ::write.

The returned future must be resolved.

Enqueues this command and returns a future representing its completion.

The returned future resolves to a write guard providing exclusive data access available within subsequent futures. This is important when a write must occur at the correct time in the global read/write order.

A data destination container appropriate for an asynchronous operation (such as RwVec) must have been passed to ::write.

The returned future must be resolved.

Auto Trait Implementations

impl<'c, 'd, T> !Send for BufferWriteCmd<'c, 'd, T>

impl<'c, 'd, T> !Sync for BufferWriteCmd<'c, 'd, T>