Struct TaskGraph

Source
pub struct TaskGraph<W: ?Sized> { /* private fields */ }
Expand description

The task graph is a directed acyclic graph consisting of Task nodes, with edges representing happens-before relations.

Implementations§

Source§

impl<W: ?Sized> TaskGraph<W>

Source

pub unsafe fn compile( self, compile_info: &CompileInfo<'_>, ) -> Result<ExecutableTaskGraph<W>, CompileError<W>>

Compiles the task graph into an executable form.

§Safety
  • There must be no conflicting device accesses in task nodes with no path between them.
  • There must be no accesses that are incompatible with the queue family type of the task node.
  • There must be no accesses that are unsupported by the device.
§Panics
  • Panics if compile_info.queues is empty.
  • Panics if the device of any queue in compile_info.queues or compile_info.present_queue is not the same as that of self.
  • Panics if compile_info.queues contains duplicate queue families.
  • Panics if compile_info.present_queue is None and the task graph uses any swapchains.
§Errors

In order to get a successful compilation, the graph must satisfy the following conditions:

  • It must be weakly connected: every node must be able to reach every other node when disregarding the direction of the edges.
  • It must have no directed cycles: if you were to walk starting from any node following the direction of the edges, there must be no way to end up at the node you started at.
Source§

impl<W: ?Sized> TaskGraph<W>

Source

pub fn new( physical_resources: &Arc<Resources>, max_nodes: u32, max_resources: u32, ) -> Self

Creates a new TaskGraph.

max_nodes is the maximum number of nodes the graph can ever have. max_resources is the maximum number of virtual resources the graph can ever have.

Source

pub fn create_task_node( &mut self, name: impl Into<Cow<'static, str>>, queue_family_type: QueueFamilyType, task: impl Task<World = W>, ) -> TaskNodeBuilder<'_>

Creates a new TaskNode from the given task and adds it to the graph. Returns a builder allowing you to add resource accesses to the task node.

queue_family_type is the type of queue family the task can be executed on.

Source

pub fn remove_task_node( &mut self, id: NodeId, ) -> Result<TaskNode<W>, TaskGraphError>

Removes the task node corresponding to id from the graph.

Source

pub fn add_edge( &mut self, from: NodeId, to: NodeId, ) -> Result<(), TaskGraphError>

Adds an edge starting at the node corresponding to from and ending at the node corresponding to to.

Source

pub fn remove_edge( &mut self, from: NodeId, to: NodeId, ) -> Result<(), TaskGraphError>

Removes an edge starting at the node corresponding to from and ending at the node corresponding to to.

Source

pub fn task_node(&self, id: NodeId) -> Result<&TaskNode<W>, TaskGraphError>

Returns a reference to the task node corresponding to id.

Source

pub fn task_node_mut( &mut self, id: NodeId, ) -> Result<&mut TaskNode<W>, TaskGraphError>

Returns a mutable reference to the task node corresponding to id.

Source

pub fn task_nodes(&self) -> TaskNodes<'_, W>

Returns an iterator over all TaskNodes.

Source

pub fn task_nodes_mut(&mut self) -> TaskNodesMut<'_, W>

Returns an iterator over all TaskNodes that allows you to mutate them.

Source

pub fn add_buffer(&mut self, create_info: &BufferCreateInfo) -> Id<Buffer>

Add a [virtual buffer resource] to the task graph.

Source

pub fn add_image(&mut self, create_info: &ImageCreateInfo) -> Id<Image>

Add a [virtual image resource] to the task graph.

Source

pub fn add_swapchain( &mut self, create_info: &SwapchainCreateInfo, ) -> Id<Swapchain>

Add a [virtual swapchain resource] to the task graph.

Source

pub fn add_host_buffer_access( &mut self, id: Id<Buffer>, access_type: HostAccessType, )

Adds a host buffer access to the task graph.

§Panics
  • Panics if id is not a valid virtual resource ID nor a valid physical ID.
Source

pub fn add_framebuffer(&mut self) -> Id<Framebuffer>

Adds a [virtual framebuffer] to the task graph.

Trait Implementations§

Source§

impl<W: ?Sized> Debug for TaskGraph<W>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<W: ?Sized> DeviceOwned for TaskGraph<W>

Source§

fn device(&self) -> &Arc<Device>

Returns the device that owns self.

Auto Trait Implementations§

§

impl<W> !Freeze for TaskGraph<W>

§

impl<W> !RefUnwindSafe for TaskGraph<W>

§

impl<W> Send for TaskGraph<W>
where W: ?Sized,

§

impl<W> Sync for TaskGraph<W>
where W: ?Sized,

§

impl<W> Unpin for TaskGraph<W>
where W: ?Sized,

§

impl<W> !UnwindSafe for TaskGraph<W>

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.