Struct ExecutionManager

Source
pub struct ExecutionManager<A: Allocator = DefaultAllocator> { /* private fields */ }
Expand description

The execution manager is responsible for allocating command buffers on correct queues. To obtain any command buffer, you must allocate it by calling ExecutionManager::on_domain(). An execution domain is a type that implements the domain::ExecutionDomain trait. Four domains are already defined, and these should cover virtually every available use case.

Note that all domains also implement a couple commands that apply to all domains with no restrictions on queue type support, such as pipeline barriers.

§Example

use phobos::prelude::*;
// Create an execution manager first. You only want one of these.
let exec = ExecutionManager::new(device.clone(), &physical_device, pool);
// Obtain a command buffer on the Transfer domain
let cmd = exec.on_domain::<domain::Transfer>()?
              .copy_image(/*command parameters*/)
              .finish()?;
// Submit the command buffer, either to this frame's command list,
// or to the execution manager for submitting commands outside of a
// frame context (such as on another thread).

Implementations§

Source§

impl<A: Allocator> ExecutionManager<A>

Source

pub fn new( device: Device, physical_device: &PhysicalDevice, pool: ResourcePool<A>, ) -> Result<Self>

Create a new execution manager. You should only ever have on instance of this struct in your program.

Source

pub fn try_on_domain<'q, D: ExecutionDomain>( &'q self, ) -> Result<D::CmdBuf<'q, A>>

Tries to obtain a command buffer over a domain, or returns an Err state if the lock is currently being held. If this command buffer needs access to pipelines or descriptor sets, pass in the relevant caches.

Source

pub fn on_domain<'q, D: ExecutionDomain>(&'q self) -> Result<D::CmdBuf<'q, A>>

Obtain a command buffer capable of operating on the specified domain. If this command buffer needs access to pipelines or descriptor sets, pass in the relevant caches.

Source

pub fn start_submit_batch<D: ExecutionDomain + 'static>( &self, ) -> Result<SubmitBatch<D, A>>

Begin a submit batch. Note that all submits in a batch are over a single domain (currently).

§Example
use phobos::prelude::*;
let exec = ExecutionManager::new(device.clone(), &physical_device, pool)?;
let cmd1 = exec.on_domain::<domain::All>()?.finish()?;
let cmd2 = exec.on_domain::<domain::All>()?.finish()?;
let mut batch = exec.start_submit_batch()?;
// Submit the first command buffer first
batch.submit(cmd1)?
     // The second command buffer waits at COLOR_ATTACHMENT_OUTPUT on the first command buffer's completion.
     .then(PipelineStage::COLOR_ATTACHMENT_OUTPUT, cmd2, &mut batch)?;
batch.finish()?.wait()?;
Source

pub fn try_get_queue<D: ExecutionDomain>( &self, ) -> TryLockResult<MutexGuard<'_, Queue>>

Try to get a reference to a queue matching the domain, or return an error state if this would need to block to lock the queue.

Source

pub fn get_queue<D: ExecutionDomain>(&self) -> Option<MutexGuard<'_, Queue>>

Obtain a reference to a queue matching the domain. Blocks if this queue is currently locked.

Source§

impl<A: Allocator + 'static> ExecutionManager<A>

Source

pub fn submit<D: ExecutionDomain + 'static>( &self, cmd: CommandBuffer<D>, ) -> Result<Pooled<Fence>>

Submit a command buffer to its queue.

Trait Implementations§

Source§

impl<A: Clone + Allocator> Clone for ExecutionManager<A>

Source§

fn clone(&self) -> ExecutionManager<A>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug + Allocator> Debug for ExecutionManager<A>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.