Skip to main content

Command

Struct Command 

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

A general-purpose Vulkan command which may contain acceleration structure operations, transfers, or shader pipelines.

There are four main uses of a Command:

  1. Bind resources (Self::bind_resource)
  2. Declare resource accesses (Self::resource_access)
  3. Record general-purpose command buffers or acceleration structure operations (Self::record_cmd)
  4. Bind shader pipelines (Self::bind_pipeline)

When bound, a shader pipeline consumes the Command and returns a PipelineCommand which provides command recording functions specific to each pipeline type.

Implementations§

Source§

impl<'a> Command<'a>

Source

pub fn bind_resource<R>(&mut self, resource: R) -> R::Node
where R: Resource,

Binds a Vulkan buffer, image, or acceleration structure resource to the graph associated with this command.

Bound nodes may be used in commands for pipeline and shader operations.

Source

pub fn bind_pipeline<P>(self, pipeline: P) -> P::Command
where P: Pipeline<'a>,

Binds a shader pipeline to the current command, allowing for strongly typed access to the related functions.

PP::Command
ComputePipeline[`PipelineCommand<’_,
ComputePipeline>`]
GraphicPipeline[`PipelineCommand<’_,
GraphicPipeline>`]
RayTracePipeline[`PipelineCommand<’_,
RayTracePipeline>`]
Source

pub fn debug_name(self, name: impl Into<String>) -> Self

Sets a debugging name, but only in debug builds

Source

pub fn end_cmd(self) -> &'a mut Graph

Finalize the recording of this command and return to the Graph where you may record additional commands.

Source

pub fn record_cmd( self, func: impl FnOnce(CommandRef<'_>) + Send + 'static, ) -> Self

Begin recording a general-purpose command buffer.

This is the entry point for building and updating an AccelerationStructure instance.

The provided closure allows you to run any Vulkan code, or interoperate with other Vulkan code and interfaces.

Source

pub fn record_cmd_mut( &mut self, func: impl FnOnce(CommandRef<'_>) + Send + 'static, )

Begin recording a general-purpose command buffer.

This is the entry point for building and updating an AccelerationStructure instance.

The provided closure allows you to run any Vulkan code, or interoperate with other Vulkan code and interfaces.

Source

pub fn resource<N>(&self, resource_node: N) -> &N::Resource
where N: Node,

Returns a borrow of the original Vulkan resource (buffer, image or acceleration structure) which the given bound resource node represents.

Source

pub fn resource_access<N>(self, resource_node: N, access: AccessType) -> Self
where N: Node + Subresource, SubresourceRange: From<N::Range>,

Informs the command that the next recorded command buffer will read or write resource_node using access.

An access function must be called for resource_node before it is used within a record_-function.

Source

pub fn set_debug_name(&mut self, _name: impl Into<String>) -> &mut Self

Sets a debugging name, but only in debug builds.

Source

pub fn set_resource_access<N>(&mut self, resource_node: N, access: AccessType)
where N: Node + Subresource, SubresourceRange: From<N::Range>,

Informs the command that the next recorded command buffer will read or write resource_node using access.

An access function must be called for resource_node before it is used within a record_-function.

Source

pub fn set_subresource_access<N>( &mut self, resource_node: N, subresource: impl Into<N::Range>, access: AccessType, )
where N: Node + Subresource, SubresourceRange: From<N::Range>,

Informs the command that the next recorded command buffer will read or write the subresource of resource_node using access.

An access function must be called for resource_node before it is used within a record_-function.

Source

pub fn subresource_access<N>( self, resource_node: N, subresource: impl Into<N::Range>, access: AccessType, ) -> Self
where N: Node + Subresource, SubresourceRange: From<N::Range>,

Informs the command that the next recorded command buffer will read or write the subresource of resource using access.

An access function must be called for resource before it is used within a record_-function.

Auto Trait Implementations§

§

impl<'a> Freeze for Command<'a>

§

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

§

impl<'a> Send for Command<'a>

§

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

§

impl<'a> Unpin for Command<'a>

§

impl<'a> UnsafeUnpin for Command<'a>

§

impl<'a> !UnwindSafe for Command<'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.