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 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.
P | P::Command |
|---|---|
ComputePipeline | [`PipelineCommand<’_, |
| ComputePipeline>`] | |
GraphicPipeline | [`PipelineCommand<’_, |
| GraphicPipeline>`] | |
RayTracePipeline | [`PipelineCommand<’_, |
| RayTracePipeline>`] |
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 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.
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, )
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.
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 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.
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
Sets a debugging name, but only in debug builds.
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)
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.
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, )
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.
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 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.