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:
- Bind resources (
Self::bind_resource) - Declare resource accesses (
Self::resource_access) - Record general-purpose command buffers or acceleration structure operations
(
Self::record_cmd) - 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>
impl<'a> Command<'a>
Sourcepub fn builder(graph: &'a mut Graph) -> CommandBuilder<'a>
pub fn builder(graph: &'a mut Graph) -> CommandBuilder<'a>
Begins a command builder in graph.
Sourcepub fn into_builder(self) -> CommandBuilder<'a>
pub fn into_builder(self) -> CommandBuilder<'a>
Converts this command into a builder.
Sourcepub fn track_execution(&mut self) -> CommandExecution
pub fn track_execution(&mut self) -> CommandExecution
Returns a handle that tracks whether this graph command has completed device execution.
This may be called multiple times. Each returned handle independently observes the same command execution.
Sourcepub fn write_timestamp(&mut self) -> TimestampQuery
pub fn write_timestamp(&mut self) -> TimestampQuery
Records a timestamp query point at the current position in this command.
A timestamp written before any command work is recorded at the start of this command. After command work is recorded, timestamps are recorded after the most recently added execution.
See Graph::write_timestamp for graph-boundary timestamps.
Sourcepub fn bind_resource<R>(&mut self, resource: R) -> R::Nodewhere
R: Resource,
pub fn bind_resource<R>(&mut self, resource: R) -> R::Nodewhere
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.
Sourcepub fn bind_pipeline<P>(self, pipeline: P) -> P::Commandwhere
P: Pipeline<'a>,
pub fn bind_pipeline<P>(self, pipeline: P) -> P::Commandwhere
P: Pipeline<'a>,
Binds a shader pipeline to the current command, allowing for strongly typed access to the related functions.
Sourcepub fn debug_name(self, name: impl Into<String>) -> Self
pub fn debug_name(self, name: impl Into<String>) -> Self
Sets a debugging name, but only in debug builds.
Sourcepub fn end_cmd(self) -> &'a mut Graph
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.
Sourcepub fn record_cmd(
self,
func: impl FnOnce(CommandRef<'_>) + Send + 'static,
) -> Self
pub fn record_cmd( self, func: impl FnOnce(CommandRef<'_>) + Send + 'static, ) -> Self
Begin recording general-purpose work for this graph command.
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.
Sourcepub fn record_cmd_mut(
&mut self,
func: impl FnOnce(CommandRef<'_>) + Send + 'static,
)
pub fn record_cmd_mut( &mut self, func: impl FnOnce(CommandRef<'_>) + Send + 'static, )
Mutable-borrow form of Self::record_cmd.
Sourcepub fn blit_image(
self,
src: impl Into<AnyImageNode>,
dst: impl Into<AnyImageNode>,
filter: Filter,
regions: impl AsRef<[ImageBlit]> + 'static + Send,
) -> Self
pub fn blit_image( self, src: impl Into<AnyImageNode>, dst: impl Into<AnyImageNode>, filter: Filter, regions: impl AsRef<[ImageBlit]> + 'static + Send, ) -> Self
Blits image regions.
Sourcepub fn clear_color_image(
self,
image: impl Into<AnyImageNode>,
color: impl Into<ClearColorValue>,
) -> Self
pub fn clear_color_image( self, image: impl Into<AnyImageNode>, color: impl Into<ClearColorValue>, ) -> Self
Clears a color image.
Sourcepub fn clear_depth_stencil_image(
self,
image: impl Into<AnyImageNode>,
depth: f32,
stencil: u32,
) -> Self
pub fn clear_depth_stencil_image( self, image: impl Into<AnyImageNode>, depth: f32, stencil: u32, ) -> Self
Clears a depth/stencil image.
Sourcepub fn copy_buffer(
self,
src: impl Into<AnyBufferNode>,
dst: impl Into<AnyBufferNode>,
regions: impl AsRef<[BufferCopy]> + 'static + Send,
) -> Self
pub fn copy_buffer( self, src: impl Into<AnyBufferNode>, dst: impl Into<AnyBufferNode>, regions: impl AsRef<[BufferCopy]> + 'static + Send, ) -> Self
Copies data between buffer regions.
Sourcepub fn copy_buffer_to_image(
self,
src: impl Into<AnyBufferNode>,
dst: impl Into<AnyImageNode>,
regions: impl AsRef<[BufferImageCopy]> + 'static + Send,
) -> Self
pub fn copy_buffer_to_image( self, src: impl Into<AnyBufferNode>, dst: impl Into<AnyImageNode>, regions: impl AsRef<[BufferImageCopy]> + 'static + Send, ) -> Self
Copies data from a buffer into image regions.
Sourcepub fn copy_image(
self,
src: impl Into<AnyImageNode>,
dst: impl Into<AnyImageNode>,
regions: impl AsRef<[ImageCopy]> + 'static + Send,
) -> Self
pub fn copy_image( self, src: impl Into<AnyImageNode>, dst: impl Into<AnyImageNode>, regions: impl AsRef<[ImageCopy]> + 'static + Send, ) -> Self
Copies data between image regions.
Sourcepub fn copy_image_to_buffer(
self,
src: impl Into<AnyImageNode>,
dst: impl Into<AnyBufferNode>,
regions: impl AsRef<[BufferImageCopy]> + 'static + Send,
) -> Self
pub fn copy_image_to_buffer( self, src: impl Into<AnyImageNode>, dst: impl Into<AnyBufferNode>, regions: impl AsRef<[BufferImageCopy]> + 'static + Send, ) -> Self
Copies image region data into a buffer.
Sourcepub fn fill_buffer(
self,
buffer: impl Into<AnyBufferNode>,
region: Range<DeviceSize>,
data: u32,
) -> Self
pub fn fill_buffer( self, buffer: impl Into<AnyBufferNode>, region: Range<DeviceSize>, data: u32, ) -> Self
Fills a region of a buffer with a fixed value.
Sourcepub fn resource<N>(&self, resource_node: N) -> &N::Resourcewhere
N: Node,
pub fn resource<N>(&self, resource_node: N) -> &N::Resourcewhere
N: Node,
Returns a borrow of the original Vulkan resource (buffer, image or acceleration structure) which the given bound resource node represents.
Sourcepub fn resource_access<N>(self, resource_node: N, access: AccessType) -> Self
pub fn resource_access<N>(self, resource_node: N, access: AccessType) -> Self
Informs the command that recorded work will read or write resource_node
using access.
An access function must be called for resource_node before it is used within a recording
function.
Sourcepub fn set_debug_name(&mut self, name: impl Into<String>) -> &mut Self
pub fn set_debug_name(&mut self, name: impl Into<String>) -> &mut Self
Mutable-borrow form of Self::debug_name.
Sourcepub fn set_resource_access<N>(&mut self, resource_node: N, access: AccessType)
pub fn set_resource_access<N>(&mut self, resource_node: N, access: AccessType)
Mutable-borrow form of Self::resource_access.
Sourcepub fn set_subresource_access<N>(
&mut self,
resource_node: N,
subresource: impl Into<N::Range>,
access: AccessType,
)
pub fn set_subresource_access<N>( &mut self, resource_node: N, subresource: impl Into<N::Range>, access: AccessType, )
Mutable-borrow form of Self::subresource_access.
Sourcepub fn subresource_access<N>(
self,
resource_node: N,
subresource: impl Into<N::Range>,
access: AccessType,
) -> Self
pub fn subresource_access<N>( self, resource_node: N, subresource: impl Into<N::Range>, access: AccessType, ) -> Self
Informs the command that recorded work 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 recording
function.
Sourcepub fn update_buffer(
self,
buffer: impl Into<AnyBufferNode>,
offset: DeviceSize,
data: impl AsRef<[u8]> + 'static + Send,
) -> Self
pub fn update_buffer( self, buffer: impl Into<AnyBufferNode>, offset: DeviceSize, data: impl AsRef<[u8]> + 'static + Send, ) -> Self
Records a vkCmdUpdateBuffer
command.
Vulkan requires data to be at most 65536 bytes.
These constraints are validated by the Vulkan Validation Layer (VVL) when it is active.
When the checked feature is enabled, vk-graph also validates the data size and bounds
before recording the command.