Struct TaskContext

Source
pub struct TaskContext<'a> { /* private fields */ }
Expand description

The context of a task.

This gives you access to the resources.

Implementations§

Source§

impl<'a> TaskContext<'a>

Source

pub fn buffer(&self, id: Id<Buffer>) -> TaskResult<&'a BufferState>

Returns the buffer corresponding to id, or returns an error if it isn’t present.

Source

pub fn image(&self, id: Id<Image>) -> TaskResult<&'a ImageState>

Returns the image corresponding to id, or returns an error if it isn’t present.

§Panics
  • Panics if id refers to a swapchain image.
Source

pub fn swapchain(&self, id: Id<Swapchain>) -> TaskResult<&'a SwapchainState>

Returns the swapchain corresponding to id, or returns an error if it isn’t present.

Source

pub fn resource_map(&self) -> &'a ResourceMap<'a>

Returns the ResourceMap.

Source

pub fn current_frame_index(&self) -> u32

Returns the index of the current [frame] in [flight].

Source

pub fn read_buffer<T: BufferContents + ?Sized>( &self, id: Id<Buffer>, range: impl RangeBounds<DeviceSize>, ) -> TaskResult<&T>

Tries to get read access to a portion of the buffer corresponding to id.

If host read access for the buffer is not accounted for in the [task graph’s host access set], this method will return an error.

If the memory backing the buffer is not managed by vulkano (i.e. the buffer was created by RawBuffer::assume_bound), then it can’t be read using this method and an error will be returned.

§Panics
Source

pub unsafe fn read_buffer_unchecked<T: BufferContents + ?Sized>( &self, id: Id<Buffer>, range: impl RangeBounds<DeviceSize>, ) -> TaskResult<&T>

Gets read access to a portion of the buffer corresponding to id without checking if this access is accounted for in the [task graph’s host access set].

If the memory backing the buffer is not managed by vulkano (i.e. the buffer was created by RawBuffer::assume_bound), then it can’t be read using this method and an error will be returned.

§Safety

This access must be accounted for in the task graph’s host access set.

§Panics
Source

pub fn write_buffer<T: BufferContents + ?Sized>( &mut self, id: Id<Buffer>, range: impl RangeBounds<DeviceSize>, ) -> TaskResult<&mut T>

Tries to get write access to a portion of the buffer corresponding to id.

If host write access for the buffer is not accounted for in the [task graph’s host access set], this method will return an error.

If the memory backing the buffer is not managed by vulkano (i.e. the buffer was created by RawBuffer::assume_bound), then it can’t be written using this method and an error will be returned.

§Panics
Source

pub unsafe fn write_buffer_unchecked<T: BufferContents + ?Sized>( &mut self, id: Id<Buffer>, range: impl RangeBounds<DeviceSize>, ) -> TaskResult<&mut T>

Gets write access to a portion of the buffer corresponding to id without checking if this access is accounted for in the [task graph’s host access set].

If the memory backing the buffer is not managed by vulkano (i.e. the buffer was created by RawBuffer::assume_bound), then it can’t be written using this method and an error will be returned.

§Safety

This access must be accounted for in the task graph’s host access set.

§Panics
Source

pub unsafe fn push_command_buffer(&mut self, command_buffer: Arc<CommandBuffer>)

Pushes a command buffer into the list of command buffers to be executed on the queue.

All command buffers will be executed in the order in which they are pushed after the task has finished execution. That means in particular, that commands recorded by the task will start execution before execution of any pushed command buffers starts.

§Safety

Since the command buffer will be executed on the same queue right after the current command buffer, without any added synchronization, it must be safe to do so. The given command buffer must not do any accesses not accounted for in the [task’s access set], or ensure that such accesses are appropriately synchronized.

Source

pub unsafe fn extend_command_buffers( &mut self, command_buffers: impl IntoIterator<Item = Arc<CommandBuffer>>, )

Extends the list of command buffers to be executed on the queue.

This function behaves identically to the push_command_buffer method, except that it pushes all command buffers from the given iterator in order.

§Safety

See the push_command_buffer method for the safety preconditions.

Auto Trait Implementations§

§

impl<'a> Freeze for TaskContext<'a>

§

impl<'a> !RefUnwindSafe for TaskContext<'a>

§

impl<'a> !Send for TaskContext<'a>

§

impl<'a> !Sync for TaskContext<'a>

§

impl<'a> Unpin for TaskContext<'a>

§

impl<'a> !UnwindSafe for TaskContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.