logo
pub struct AutoCommandBufferBuilder<L, P = StandardCommandPoolBuilder> { /* private fields */ }
Expand description

Note that command buffers allocated from the default command pool (Arc<StandardCommandPool>) don’t implement the Send and Sync traits. If you use this pool, then the AutoCommandBufferBuilder will not implement Send and Sync either. Once a command buffer is built, however, it does implement Send and Sync.

Implementations

Starts building a primary command buffer.

Starts building a secondary compute command buffer.

Same as secondary_compute, but allows specifying how queries are being inherited.

Starts building a secondary graphics command buffer.

Same as secondary_graphics, but allows specifying how queries are being inherited.

Builds the command buffer.

Builds the command buffer.

Returns the binding/setting state.

Binds descriptor sets for future dispatch or draw calls.

Panics
  • Panics if the queue family of the command buffer does not support pipeline_bind_point.
  • Panics if the highest descriptor set slot being bound is not less than the number of sets in pipeline_layout.
  • Panics if self and any element of descriptor_sets do not belong to the same device.

Binds an index buffer for future indexed draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if self and index_buffer do not belong to the same device.
  • Panics if index_buffer does not have the index_buffer usage enabled.
  • If the index buffer contains u8 indices, panics if the index_type_uint8 feature is not enabled on the device.

Binds a compute pipeline for future dispatch calls.

Panics
  • Panics if the queue family of the command buffer does not support compute operations.
  • Panics if self and pipeline do not belong to the same device.

Binds a graphics pipeline for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if self and pipeline do not belong to the same device.

Binds vertex buffers for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the highest vertex buffer binding being bound is greater than the max_vertex_input_bindings
  • Panics if self and any element of vertex_buffers do not belong to the same device.
  • Panics if any element of vertex_buffers does not have the vertex_buffer usage enabled.

Adds a command that blits an image to another.

A blit is similar to an image copy operation, except that the portion of the image that is transferred can be resized. You choose an area of the source and an area of the destination, and the implementation will resize the area of the source so that it matches the size of the area of the destination before writing it.

Blit operations have several restrictions:

  • Blit operations are only allowed on queue families that support graphics operations.
  • The format of the source and destination images must support blit operations, which depends on the Vulkan implementation. Vulkan guarantees that some specific formats must always be supported. See tables 52 to 61 of the specifications.
  • Only single-sampled images are allowed.
  • You can only blit between two images whose formats belong to the same type. The types are: floating-point, signed integers, unsigned integers, depth-stencil.
  • If you blit between depth, stencil or depth-stencil images, the format of both images must match exactly.
  • If you blit between depth, stencil or depth-stencil images, only the Nearest filter is allowed.
  • For two-dimensional images, the Z coordinate must be 0 for the top-left offset and 1 for the bottom-right offset. Same for the Y coordinate for one-dimensional images.
  • For non-array images, the base array layer must be 0 and the number of layers must be 1.

If layer_count is greater than 1, the blit will happen between each individual layer as if they were separate images.

Panic
  • Panics if the source or the destination was not created with device.

Adds a command that clears specific regions of specific attachments of the framebuffer.

attachments specify the types of attachments and their clear values. rects specify the regions to clear.

A graphics pipeline must have been bound using bind_pipeline_graphics. And the command must be inside render pass.

If the render pass instance this is recorded in uses multiview, then ClearRect.base_array_layer must be zero and ClearRect.layer_count must be one.

The rectangle area must be inside the render area ranges.

Adds a command that clears all the layers and mipmap levels of a color image with a specific value.

Panic

Panics if color is not a color value.

Adds a command that clears a color image with a specific value.

Panic
  • Panics if color is not a color value.

Adds a command that clears all the layers of a depth / stencil image with a specific value.

Panic

Panics if clear_value is not a depth / stencil value.

Adds a command that clears a depth / stencil image with a specific value.

Panic
  • Panics if clear_value is not a depth / stencil value.

Adds a command that copies from a buffer to another.

This command will copy from the source to the destination. If their size is not equal, then the amount of data copied is equal to the smallest of the two.

Adds a command that copies a range from the source to the destination buffer. Panics if out of bounds.

Adds a command that copies from a buffer to an image.

Adds a command that copies from a buffer to an image.

Adds a command that copies an image to another.

Copy operations have several restrictions:

  • Copy operations are only allowed on queue families that support transfer, graphics, or compute operations.
  • The number of samples in the source and destination images must be equal.
  • The size of the uncompressed element format of the source image must be equal to the compressed element format of the destination.
  • If you copy between depth, stencil or depth-stencil images, the format of both images must match exactly.
  • For two-dimensional images, the Z coordinate must be 0 for the image offsets and 1 for the extent. Same for the Y coordinate for one-dimensional images.
  • For non-array images, the base array layer must be 0 and the number of layers must be 1.

If layer_count is greater than 1, the copy will happen between each individual layer as if they were separate images.

Panic
  • Panics if the source or the destination was not created with device.

Adds a command that copies from an image to a buffer.

Adds a command that copies from an image to a buffer.

Open a command buffer debug label region.

Note: you need to enable VK_EXT_debug_utils extension when creating an instance.

Close a command buffer label region.

Note: you need to open a command buffer label region first with debug_marker_begin. Note: you need to enable VK_EXT_debug_utils extension when creating an instance.

Insert a label into a command buffer.

Note: you need to enable VK_EXT_debug_utils extension when creating an instance.

Perform a single compute operation using a compute pipeline.

A compute pipeline must have been bound using bind_pipeline_compute. Any resources used by the compute pipeline, such as descriptor sets, must have been set beforehand.

Perform multiple compute operations using a compute pipeline. One dispatch is performed for each DispatchIndirectCommand struct in indirect_buffer.

A compute pipeline must have been bound using bind_pipeline_compute. Any resources used by the compute pipeline, such as descriptor sets, must have been set beforehand.

Perform a single draw operation using a graphics pipeline.

The parameters specify the first vertex and the number of vertices to draw, and the first instance and number of instances. For non-instanced drawing, specify instance_count as 1 and first_instance as 0.

A graphics pipeline must have been bound using bind_pipeline_graphics. Any resources used by the graphics pipeline, such as descriptor sets, vertex buffers and dynamic state, must have been set beforehand. If the bound graphics pipeline uses vertex buffers, then the provided vertex and instance ranges must be in range of the bound vertex buffers.

Perform multiple draw operations using a graphics pipeline.

One draw is performed for each DrawIndirectCommand struct in indirect_buffer. The maximum number of draw commands in the buffer is limited by the max_draw_indirect_count limit. This limit is 1 unless the multi_draw_indirect feature has been enabled.

A graphics pipeline must have been bound using bind_pipeline_graphics. Any resources used by the graphics pipeline, such as descriptor sets, vertex buffers and dynamic state, must have been set beforehand. If the bound graphics pipeline uses vertex buffers, then the vertex and instance ranges of each DrawIndirectCommand in the indirect buffer must be in range of the bound vertex buffers.

Perform a single draw operation using a graphics pipeline, using an index buffer.

The parameters specify the first index and the number of indices in the index buffer that should be used, and the first instance and number of instances. For non-instanced drawing, specify instance_count as 1 and first_instance as 0. The vertex_offset is a constant value that should be added to each index in the index buffer to produce the final vertex number to be used.

An index buffer must have been bound using bind_index_buffer, and the provided index range must be in range of the bound index buffer.

A graphics pipeline must have been bound using bind_pipeline_graphics. Any resources used by the graphics pipeline, such as descriptor sets, vertex buffers and dynamic state, must have been set beforehand. If the bound graphics pipeline uses vertex buffers, then the provided instance range must be in range of the bound vertex buffers. The vertex indices in the index buffer must be in range of the bound vertex buffers.

Perform multiple draw operations using a graphics pipeline, using an index buffer.

One draw is performed for each DrawIndexedIndirectCommand struct in indirect_buffer. The maximum number of draw commands in the buffer is limited by the max_draw_indirect_count limit. This limit is 1 unless the multi_draw_indirect feature has been enabled.

An index buffer must have been bound using bind_index_buffer, and the index ranges of each DrawIndexedIndirectCommand in the indirect buffer must be in range of the bound index buffer.

A graphics pipeline must have been bound using bind_pipeline_graphics. Any resources used by the graphics pipeline, such as descriptor sets, vertex buffers and dynamic state, must have been set beforehand. If the bound graphics pipeline uses vertex buffers, then the instance ranges of each DrawIndexedIndirectCommand in the indirect buffer must be in range of the bound vertex buffers.

Adds a command that writes the content of a buffer.

This function is similar to the memset function in C. The data parameter is a number that will be repeatedly written through the entire buffer.

Note: This function is technically safe because buffers can only contain integers or floating point numbers, which are always valid whatever their memory representation is. But unless your buffer actually contains only 32-bits integers, you are encouraged to use this function only for zeroing the content of a buffer by passing 0 for the data.

Sets push constants for future dispatch or draw calls.

Panics
  • Panics if offset is not a multiple of 4.
  • Panics if the size of push_constants is not a multiple of 4.
  • Panics if any of the bytes in push_constants do not fall within any of the pipeline layout’s push constant ranges.

Pushes descriptor data directly into the command buffer for future dispatch or draw calls.

Panics
  • Panics if the queue family of the command buffer does not support pipeline_bind_point.
  • Panics if the khr_push_descriptor extension is not enabled on the device.
  • Panics if set_num is not less than the number of sets in pipeline_layout.
  • Panics if an element of descriptor_writes is not compatible with pipeline_layout.

Sets the dynamic blend constants for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets whether dynamic color writes should be enabled for each attachment in the framebuffer.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the color_write_enable feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • If there is a graphics pipeline with color blend state bound, enables.len() must equal
  • attachments.len().

Sets the dynamic cull mode for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic depth bias values for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • If the depth_bias_clamp feature is not enabled on the device, panics if clamp is not 0.0.

Sets whether dynamic depth bias is enabled for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state2 feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic depth bounds for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • If the ext_depth_range_unrestricted device extension is not enabled, panics if min or max is not between 0.0 and 1.0 inclusive.

Sets whether dynamic depth bounds testing is enabled for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic depth compare op for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets whether dynamic depth testing is enabled for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets whether dynamic depth write is enabled for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic discard rectangles for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the ext_discard_rectangles extension is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • Panics if the highest discard rectangle slot being set is greater than the max_discard_rectangles device property.

Sets the dynamic front face for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic line stipple values for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the ext_line_rasterization extension is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • Panics if factor is not between 1 and 256 inclusive.

Sets the dynamic line width for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • If the wide_lines feature is not enabled, panics if line_width is not 1.0.

Sets the dynamic logic op for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the extended_dynamic_state2_logic_op feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic number of patch control points for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the extended_dynamic_state2_patch_control_points feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • Panics if num is 0.
  • Panics if num is greater than the max_tessellation_patch_size property of the device.

Sets whether dynamic primitive restart is enabled for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state2 feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic primitive topology for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • If the geometry_shader feature is not enabled, panics if topology is a WithAdjacency topology.
  • If the tessellation_shader feature is not enabled, panics if topology is PatchList.

Sets whether dynamic rasterizer discard is enabled for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state2 feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic scissors for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • Panics if the highest scissor slot being set is greater than the max_viewports device property.
  • If the multi_viewport feature is not enabled, panics if first_scissor is not 0, or if more than 1 scissor is provided.

Sets the dynamic scissors with count for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • Panics if the highest scissor slot being set is greater than the max_viewports device property.
  • If the multi_viewport feature is not enabled, panics if more than 1 scissor is provided.

Sets the dynamic stencil compare mask on one or both faces for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic stencil ops on one or both faces for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic stencil reference on one or both faces for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets whether dynamic stencil testing is enabled for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic stencil write mask on one or both faces for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.

Sets the dynamic viewports for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • Panics if the highest viewport slot being set is greater than the max_viewports device property.
  • If the multi_viewport feature is not enabled, panics if first_viewport is not 0, or if more than 1 viewport is provided.

Sets the dynamic viewports with count for future draw calls.

Panics
  • Panics if the queue family of the command buffer does not support graphics operations.
  • Panics if the device API version is less than 1.3 and the extended_dynamic_state feature is not enabled on the device.
  • Panics if the currently bound graphics pipeline already contains this state internally.
  • Panics if the highest viewport slot being set is greater than the max_viewports device property.
  • If the multi_viewport feature is not enabled, panics if more than 1 viewport is provided.

Adds a command that writes data to a buffer.

If data is larger than the buffer, only the part of data that fits is written. If the buffer is larger than data, only the start of the buffer is written.

Adds a command that begins a query.

The query will be active until end_query is called for the same query.

Safety

The query must be unavailable, ensured by calling reset_query_pool.

Adds a command that ends an active query.

Adds a command that writes a timestamp to a timestamp query.

Safety

The query must be unavailable, ensured by calling reset_query_pool.

Adds a command that copies the results of a range of queries to a buffer on the GPU.

query_pool.ty().result_size() elements will be written for each query in the range, plus 1 extra element per query if QueryResultFlags::with_availability is enabled. The provided buffer must be large enough to hold the data.

See also get_results.

Adds a command to reset a range of queries on a query pool.

The affected queries will be marked as “unavailable” after this command runs, and will no longer return any results. They will be ready to have new results recorded for them.

Safety

The queries in the specified range must not be active in another command buffer.

Commands that can only be executed on primary command buffers

Adds a command that enters a render pass.

If contents is SubpassContents::SecondaryCommandBuffers, then you will only be able to add secondary command buffers while you’re inside the first subpass of the render pass. If it is SubpassContents::Inline, you will only be able to add inline draw commands and not secondary command buffers.

C must contain exactly one clear value for each attachment in the framebuffer.

You must call this before you can add draw commands.

Adds a command that ends the current render pass.

This must be called after you went through all the subpasses and before you can build the command buffer or add further commands.

Adds a command that executes a secondary command buffer.

If the flags that command_buffer was created with are more restrictive than those of self, then self will be restricted to match. E.g. executing a secondary command buffer with Flags::OneTimeSubmit will set self’s flags to Flags::OneTimeSubmit also.

Adds a command that multiple secondary command buffers in a vector.

This requires that the secondary command buffers do not have resource conflicts; an error will be returned if there are any. Use execute_commands if you want to ensure that resource conflicts are automatically resolved.

Adds a command that jumps to the next subpass of the current render pass.

Trait Implementations

Returns the device that owns Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.