Struct vulkano::command_buffer::AutoCommandBufferBuilder
source · [−]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
sourceimpl AutoCommandBufferBuilder<PrimaryAutoCommandBuffer, StandardCommandPoolBuilder>
impl AutoCommandBufferBuilder<PrimaryAutoCommandBuffer, StandardCommandPoolBuilder>
sourcepub fn primary(
device: Arc<Device>,
queue_family_index: u32,
usage: CommandBufferUsage
) -> Result<AutoCommandBufferBuilder<PrimaryAutoCommandBuffer, StandardCommandPoolBuilder>, CommandBufferBeginError>
pub fn primary(
device: Arc<Device>,
queue_family_index: u32,
usage: CommandBufferUsage
) -> Result<AutoCommandBufferBuilder<PrimaryAutoCommandBuffer, StandardCommandPoolBuilder>, CommandBufferBeginError>
Starts recording a primary command buffer.
sourceimpl AutoCommandBufferBuilder<SecondaryAutoCommandBuffer, StandardCommandPoolBuilder>
impl AutoCommandBufferBuilder<SecondaryAutoCommandBuffer, StandardCommandPoolBuilder>
sourcepub fn secondary(
device: Arc<Device>,
queue_family_index: u32,
usage: CommandBufferUsage,
inheritance_info: CommandBufferInheritanceInfo
) -> Result<AutoCommandBufferBuilder<SecondaryAutoCommandBuffer, StandardCommandPoolBuilder>, CommandBufferBeginError>
pub fn secondary(
device: Arc<Device>,
queue_family_index: u32,
usage: CommandBufferUsage,
inheritance_info: CommandBufferInheritanceInfo
) -> Result<AutoCommandBufferBuilder<SecondaryAutoCommandBuffer, StandardCommandPoolBuilder>, CommandBufferBeginError>
Starts recording a secondary command buffer.
sourceimpl<P> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<P::Alloc>, P>where
P: CommandPoolBuilderAlloc,
impl<P> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<P::Alloc>, P>where
P: CommandPoolBuilderAlloc,
sourcepub fn build(self) -> Result<PrimaryAutoCommandBuffer<P::Alloc>, BuildError>
pub fn build(self) -> Result<PrimaryAutoCommandBuffer<P::Alloc>, BuildError>
Builds the command buffer.
sourceimpl<P> AutoCommandBufferBuilder<SecondaryAutoCommandBuffer<P::Alloc>, P>where
P: CommandPoolBuilderAlloc,
impl<P> AutoCommandBufferBuilder<SecondaryAutoCommandBuffer<P::Alloc>, P>where
P: CommandPoolBuilderAlloc,
sourcepub fn build(self) -> Result<SecondaryAutoCommandBuffer<P::Alloc>, BuildError>
pub fn build(self) -> Result<SecondaryAutoCommandBuffer<P::Alloc>, BuildError>
Builds the command buffer.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
sourcepub fn state(&self) -> CommandBufferState<'_>
pub fn state(&self) -> CommandBufferState<'_>
Returns the binding/setting state.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
Commands to bind or push state for pipeline execution commands.
These commands require a queue with a pipeline type that uses the given state.
sourcepub fn bind_descriptor_sets<S>(
&mut self,
pipeline_bind_point: PipelineBindPoint,
pipeline_layout: Arc<PipelineLayout>,
first_set: u32,
descriptor_sets: S
) -> &mut Selfwhere
S: DescriptorSetsCollection,
pub fn bind_descriptor_sets<S>(
&mut self,
pipeline_bind_point: PipelineBindPoint,
pipeline_layout: Arc<PipelineLayout>,
first_set: u32,
descriptor_sets: S
) -> &mut Selfwhere
S: DescriptorSetsCollection,
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 ofdescriptor_sets
do not belong to the same device.
sourcepub fn bind_index_buffer<Ib, I>(&mut self, index_buffer: Arc<Ib>) -> &mut Selfwhere
Ib: TypedBufferAccess<Content = [I]> + 'static,
I: Index + 'static,
pub fn bind_index_buffer<Ib, I>(&mut self, index_buffer: Arc<Ib>) -> &mut Selfwhere
Ib: TypedBufferAccess<Content = [I]> + 'static,
I: Index + 'static,
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
andindex_buffer
do not belong to the same device. - Panics if
index_buffer
does not have theindex_buffer
usage enabled. - If the index buffer contains
u8
indices, panics if theindex_type_uint8
feature is not enabled on the device.
sourcepub fn bind_pipeline_compute(
&mut self,
pipeline: Arc<ComputePipeline>
) -> &mut Self
pub fn bind_pipeline_compute(
&mut self,
pipeline: Arc<ComputePipeline>
) -> &mut Self
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
andpipeline
do not belong to the same device.
sourcepub fn bind_pipeline_graphics(
&mut self,
pipeline: Arc<GraphicsPipeline>
) -> &mut Self
pub fn bind_pipeline_graphics(
&mut self,
pipeline: Arc<GraphicsPipeline>
) -> &mut Self
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
andpipeline
do not belong to the same device.
sourcepub fn bind_vertex_buffers<V>(
&mut self,
first_binding: u32,
vertex_buffers: V
) -> &mut Selfwhere
V: VertexBuffersCollection,
pub fn bind_vertex_buffers<V>(
&mut self,
first_binding: u32,
vertex_buffers: V
) -> &mut Selfwhere
V: VertexBuffersCollection,
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 ofvertex_buffers
do not belong to the same device. - Panics if any element of
vertex_buffers
does not have thevertex_buffer
usage enabled.
sourcepub fn push_constants<Pc>(
&mut self,
pipeline_layout: Arc<PipelineLayout>,
offset: u32,
push_constants: Pc
) -> &mut Selfwhere
Pc: BufferContents,
pub fn push_constants<Pc>(
&mut self,
pipeline_layout: Arc<PipelineLayout>,
offset: u32,
push_constants: Pc
) -> &mut Selfwhere
Pc: BufferContents,
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.
sourcepub fn push_descriptor_set(
&mut self,
pipeline_bind_point: PipelineBindPoint,
pipeline_layout: Arc<PipelineLayout>,
set_num: u32,
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>
) -> &mut Self
pub fn push_descriptor_set(
&mut self,
pipeline_bind_point: PipelineBindPoint,
pipeline_layout: Arc<PipelineLayout>,
set_num: u32,
descriptor_writes: impl IntoIterator<Item = WriteDescriptorSet>
) -> &mut Self
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 inpipeline_layout
. - Panics if an element of
descriptor_writes
is not compatible withpipeline_layout
.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
Commands for debugging.
These commands all require the
ext_debug_utils
to be enabled on the
instance.
sourcepub fn begin_debug_utils_label(
&mut self,
label_info: DebugUtilsLabel
) -> Result<&mut Self, DebugUtilsError>
pub fn begin_debug_utils_label(
&mut self,
label_info: DebugUtilsLabel
) -> Result<&mut Self, DebugUtilsError>
Opens a command buffer debug label region.
sourcepub unsafe fn end_debug_utils_label(
&mut self
) -> Result<&mut Self, DebugUtilsError>
pub unsafe fn end_debug_utils_label(
&mut self
) -> Result<&mut Self, DebugUtilsError>
Closes a command buffer debug label region.
Safety
- When submitting the command buffer, there must be an outstanding command buffer label
region begun with
begin_debug_utils_label
in the queue, either within this command buffer or a previously submitted one.
sourcepub fn insert_debug_utils_label(
&mut self,
label_info: DebugUtilsLabel
) -> Result<&mut Self, DebugUtilsError>
pub fn insert_debug_utils_label(
&mut self,
label_info: DebugUtilsLabel
) -> Result<&mut Self, DebugUtilsError>
Inserts a command buffer debug label.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
Commands to set dynamic state for pipelines.
These commands require a queue with a pipeline type that uses the given state.
sourcepub fn set_blend_constants(&mut self, constants: [f32; 4]) -> &mut Self
pub fn set_blend_constants(&mut self, constants: [f32; 4]) -> &mut Self
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.
sourcepub fn set_color_write_enable<I>(&mut self, enables: I) -> &mut Selfwhere
I: IntoIterator<Item = bool>,
I::IntoIter: ExactSizeIterator,
pub fn set_color_write_enable<I>(&mut self, enables: I) -> &mut Selfwhere
I: IntoIterator<Item = bool>,
I::IntoIter: ExactSizeIterator,
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()
.
sourcepub fn set_cull_mode(&mut self, cull_mode: CullMode) -> &mut Self
pub fn set_cull_mode(&mut self, cull_mode: CullMode) -> &mut Self
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.
sourcepub fn set_depth_bias(
&mut self,
constant_factor: f32,
clamp: f32,
slope_factor: f32
) -> &mut Self
pub fn set_depth_bias(
&mut self,
constant_factor: f32,
clamp: f32,
slope_factor: f32
) -> &mut Self
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 ifclamp
is not 0.0.
sourcepub fn set_depth_bias_enable(&mut self, enable: bool) -> &mut Self
pub fn set_depth_bias_enable(&mut self, enable: bool) -> &mut Self
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.
sourcepub fn set_depth_bounds(&mut self, bounds: RangeInclusive<f32>) -> &mut Self
pub fn set_depth_bounds(&mut self, bounds: RangeInclusive<f32>) -> &mut Self
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 the start and end ofbounds
are not between 0.0 and 1.0 inclusive.
sourcepub fn set_depth_bounds_test_enable(&mut self, enable: bool) -> &mut Self
pub fn set_depth_bounds_test_enable(&mut self, enable: bool) -> &mut Self
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.
sourcepub fn set_depth_compare_op(&mut self, compare_op: CompareOp) -> &mut Self
pub fn set_depth_compare_op(&mut self, compare_op: CompareOp) -> &mut Self
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.
sourcepub fn set_depth_test_enable(&mut self, enable: bool) -> &mut Self
pub fn set_depth_test_enable(&mut self, enable: bool) -> &mut Self
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.
sourcepub fn set_depth_write_enable(&mut self, enable: bool) -> &mut Self
pub fn set_depth_write_enable(&mut self, enable: bool) -> &mut Self
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.
sourcepub fn set_discard_rectangle<I>(
&mut self,
first_rectangle: u32,
rectangles: I
) -> &mut Selfwhere
I: IntoIterator<Item = Scissor>,
pub fn set_discard_rectangle<I>(
&mut self,
first_rectangle: u32,
rectangles: I
) -> &mut Selfwhere
I: IntoIterator<Item = Scissor>,
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.
sourcepub fn set_front_face(&mut self, face: FrontFace) -> &mut Self
pub fn set_front_face(&mut self, face: FrontFace) -> &mut Self
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.
sourcepub fn set_line_stipple(&mut self, factor: u32, pattern: u16) -> &mut Self
pub fn set_line_stipple(&mut self, factor: u32, pattern: u16) -> &mut Self
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.
sourcepub fn set_line_width(&mut self, line_width: f32) -> &mut Self
pub fn set_line_width(&mut self, line_width: f32) -> &mut Self
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 ifline_width
is not 1.0.
sourcepub fn set_logic_op(&mut self, logic_op: LogicOp) -> &mut Self
pub fn set_logic_op(&mut self, logic_op: LogicOp) -> &mut Self
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.
sourcepub fn set_patch_control_points(&mut self, num: u32) -> &mut Self
pub fn set_patch_control_points(&mut self, num: u32) -> &mut Self
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 themax_tessellation_patch_size
property of the device.
sourcepub fn set_primitive_restart_enable(&mut self, enable: bool) -> &mut Self
pub fn set_primitive_restart_enable(&mut self, enable: bool) -> &mut Self
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.
sourcepub fn set_primitive_topology(
&mut self,
topology: PrimitiveTopology
) -> &mut Self
pub fn set_primitive_topology(
&mut self,
topology: PrimitiveTopology
) -> &mut Self
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 iftopology
is aWithAdjacency
topology. - If the
tessellation_shader
feature is not enabled, panics iftopology
isPatchList
.
sourcepub fn set_rasterizer_discard_enable(&mut self, enable: bool) -> &mut Self
pub fn set_rasterizer_discard_enable(&mut self, enable: bool) -> &mut Self
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.
sourcepub fn set_scissor<I>(&mut self, first_scissor: u32, scissors: I) -> &mut Selfwhere
I: IntoIterator<Item = Scissor>,
pub fn set_scissor<I>(&mut self, first_scissor: u32, scissors: I) -> &mut Selfwhere
I: IntoIterator<Item = Scissor>,
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 iffirst_scissor
is not 0, or if more than 1 scissor is provided.
sourcepub fn set_scissor_with_count<I>(&mut self, scissors: I) -> &mut Selfwhere
I: IntoIterator<Item = Scissor>,
pub fn set_scissor_with_count<I>(&mut self, scissors: I) -> &mut Selfwhere
I: IntoIterator<Item = Scissor>,
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.
sourcepub fn set_stencil_compare_mask(
&mut self,
faces: StencilFaces,
compare_mask: u32
) -> &mut Self
pub fn set_stencil_compare_mask(
&mut self,
faces: StencilFaces,
compare_mask: u32
) -> &mut Self
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.
sourcepub fn set_stencil_op(
&mut self,
faces: StencilFaces,
fail_op: StencilOp,
pass_op: StencilOp,
depth_fail_op: StencilOp,
compare_op: CompareOp
) -> &mut Self
pub fn set_stencil_op(
&mut self,
faces: StencilFaces,
fail_op: StencilOp,
pass_op: StencilOp,
depth_fail_op: StencilOp,
compare_op: CompareOp
) -> &mut Self
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.
sourcepub fn set_stencil_reference(
&mut self,
faces: StencilFaces,
reference: u32
) -> &mut Self
pub fn set_stencil_reference(
&mut self,
faces: StencilFaces,
reference: u32
) -> &mut Self
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.
sourcepub fn set_stencil_test_enable(&mut self, enable: bool) -> &mut Self
pub fn set_stencil_test_enable(&mut self, enable: bool) -> &mut Self
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.
sourcepub fn set_stencil_write_mask(
&mut self,
faces: StencilFaces,
write_mask: u32
) -> &mut Self
pub fn set_stencil_write_mask(
&mut self,
faces: StencilFaces,
write_mask: u32
) -> &mut Self
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.
sourcepub fn set_viewport<I>(&mut self, first_viewport: u32, viewports: I) -> &mut Selfwhere
I: IntoIterator<Item = Viewport>,
pub fn set_viewport<I>(&mut self, first_viewport: u32, viewports: I) -> &mut Selfwhere
I: IntoIterator<Item = Viewport>,
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 iffirst_viewport
is not 0, or if more than 1 viewport is provided.
sourcepub fn set_viewport_with_count<I>(&mut self, viewports: I) -> &mut Selfwhere
I: IntoIterator<Item = Viewport>,
pub fn set_viewport_with_count<I>(&mut self, viewports: I) -> &mut Selfwhere
I: IntoIterator<Item = Viewport>,
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.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
Commands that operate on images.
Unlike transfer commands, these require a graphics queue, except for clear_color_image
, which
can also be called on a compute queue.
sourcepub fn blit_image(
&mut self,
blit_image_info: BlitImageInfo
) -> Result<&mut Self, CopyError>
pub fn blit_image(
&mut self,
blit_image_info: BlitImageInfo
) -> Result<&mut Self, CopyError>
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
.
sourcepub fn clear_color_image(
&mut self,
clear_info: ClearColorImageInfo
) -> Result<&mut Self, CopyError>
pub fn clear_color_image(
&mut self,
clear_info: ClearColorImageInfo
) -> Result<&mut Self, CopyError>
Clears a color image with a specific value.
sourcepub fn clear_depth_stencil_image(
&mut self,
clear_info: ClearDepthStencilImageInfo
) -> Result<&mut Self, CopyError>
pub fn clear_depth_stencil_image(
&mut self,
clear_info: ClearDepthStencilImageInfo
) -> Result<&mut Self, CopyError>
Clears a depth/stencil image with a specific value.
sourcepub fn resolve_image(
&mut self,
resolve_image_info: ResolveImageInfo
) -> Result<&mut Self, CopyError>
pub fn resolve_image(
&mut self,
resolve_image_info: ResolveImageInfo
) -> Result<&mut Self, CopyError>
Resolves a multisampled image into a single-sampled image.
Panics
- Panics if
src_image
ordst_image
were not created from the same device asself
.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
Commands to execute a bound pipeline.
Dispatch commands require a compute queue, draw commands require a graphics queue.
sourcepub fn dispatch(
&mut self,
group_counts: [u32; 3]
) -> Result<&mut Self, PipelineExecutionError>
pub fn dispatch(
&mut self,
group_counts: [u32; 3]
) -> Result<&mut Self, PipelineExecutionError>
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.
sourcepub fn dispatch_indirect<Inb>(
&mut self,
indirect_buffer: Arc<Inb>
) -> Result<&mut Self, PipelineExecutionError>where
Inb: TypedBufferAccess<Content = [DispatchIndirectCommand]> + 'static,
pub fn dispatch_indirect<Inb>(
&mut self,
indirect_buffer: Arc<Inb>
) -> Result<&mut Self, PipelineExecutionError>where
Inb: TypedBufferAccess<Content = [DispatchIndirectCommand]> + 'static,
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.
sourcepub fn draw(
&mut self,
vertex_count: u32,
instance_count: u32,
first_vertex: u32,
first_instance: u32
) -> Result<&mut Self, PipelineExecutionError>
pub fn draw(
&mut self,
vertex_count: u32,
instance_count: u32,
first_vertex: u32,
first_instance: u32
) -> Result<&mut Self, PipelineExecutionError>
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.
sourcepub fn draw_indirect<Inb>(
&mut self,
indirect_buffer: Arc<Inb>
) -> Result<&mut Self, PipelineExecutionError>where
Inb: TypedBufferAccess<Content = [DrawIndirectCommand]> + Send + Sync + 'static,
pub fn draw_indirect<Inb>(
&mut self,
indirect_buffer: Arc<Inb>
) -> Result<&mut Self, PipelineExecutionError>where
Inb: TypedBufferAccess<Content = [DrawIndirectCommand]> + Send + Sync + 'static,
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.
sourcepub fn draw_indexed(
&mut self,
index_count: u32,
instance_count: u32,
first_index: u32,
vertex_offset: i32,
first_instance: u32
) -> Result<&mut Self, PipelineExecutionError>
pub fn draw_indexed(
&mut self,
index_count: u32,
instance_count: u32,
first_index: u32,
vertex_offset: i32,
first_instance: u32
) -> Result<&mut Self, PipelineExecutionError>
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.
sourcepub fn draw_indexed_indirect<Inb>(
&mut self,
indirect_buffer: Arc<Inb>
) -> Result<&mut Self, PipelineExecutionError>where
Inb: TypedBufferAccess<Content = [DrawIndexedIndirectCommand]> + 'static,
pub fn draw_indexed_indirect<Inb>(
&mut self,
indirect_buffer: Arc<Inb>
) -> Result<&mut Self, PipelineExecutionError>where
Inb: TypedBufferAccess<Content = [DrawIndexedIndirectCommand]> + 'static,
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.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
sourcepub unsafe fn begin_query(
&mut self,
query_pool: Arc<QueryPool>,
query: u32,
flags: QueryControlFlags
) -> Result<&mut Self, QueryError>
pub unsafe fn begin_query(
&mut self,
query_pool: Arc<QueryPool>,
query: u32,
flags: QueryControlFlags
) -> Result<&mut Self, QueryError>
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
.
sourcepub fn end_query(
&mut self,
query_pool: Arc<QueryPool>,
query: u32
) -> Result<&mut Self, QueryError>
pub fn end_query(
&mut self,
query_pool: Arc<QueryPool>,
query: u32
) -> Result<&mut Self, QueryError>
Ends an active query.
sourcepub unsafe fn write_timestamp(
&mut self,
query_pool: Arc<QueryPool>,
query: u32,
stage: PipelineStage
) -> Result<&mut Self, QueryError>
pub unsafe fn write_timestamp(
&mut self,
query_pool: Arc<QueryPool>,
query: u32,
stage: PipelineStage
) -> Result<&mut Self, QueryError>
Writes a timestamp to a timestamp query.
Safety
The query must be unavailable, ensured by calling reset_query_pool
.
sourcepub fn copy_query_pool_results<D, T>(
&mut self,
query_pool: Arc<QueryPool>,
queries: Range<u32>,
destination: Arc<D>,
flags: QueryResultFlags
) -> Result<&mut Self, QueryError>where
D: TypedBufferAccess<Content = [T]> + 'static,
T: QueryResultElement,
pub fn copy_query_pool_results<D, T>(
&mut self,
query_pool: Arc<QueryPool>,
queries: Range<u32>,
destination: Arc<D>,
flags: QueryResultFlags
) -> Result<&mut Self, QueryError>where
D: TypedBufferAccess<Content = [T]> + 'static,
T: QueryResultElement,
Copies the results of a range of queries to a buffer on the GPU.
query_pool.ty().result_len()
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
.
sourcepub unsafe fn reset_query_pool(
&mut self,
query_pool: Arc<QueryPool>,
queries: Range<u32>
) -> Result<&mut Self, QueryError>
pub unsafe fn reset_query_pool(
&mut self,
query_pool: Arc<QueryPool>,
queries: Range<u32>
) -> Result<&mut Self, QueryError>
Resets 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.
sourceimpl<P> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<P::Alloc>, P>where
P: CommandPoolBuilderAlloc,
impl<P> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<P::Alloc>, P>where
P: CommandPoolBuilderAlloc,
Commands for render passes.
These commands require a graphics queue.
sourcepub fn begin_render_pass(
&mut self,
render_pass_begin_info: RenderPassBeginInfo,
contents: SubpassContents
) -> Result<&mut Self, RenderPassError>
pub fn begin_render_pass(
&mut self,
render_pass_begin_info: RenderPassBeginInfo,
contents: SubpassContents
) -> Result<&mut Self, RenderPassError>
Begins a render pass using a render pass object and framebuffer.
You must call this or begin_rendering
before you can record draw commands.
contents
specifies what kinds of commands will be recorded in the render pass, either
draw commands or executions of secondary command buffers.
sourcepub fn next_subpass(
&mut self,
contents: SubpassContents
) -> Result<&mut Self, RenderPassError>
pub fn next_subpass(
&mut self,
contents: SubpassContents
) -> Result<&mut Self, RenderPassError>
Advances to the next subpass of the render pass previously begun with begin_render_pass
.
sourcepub fn end_render_pass(&mut self) -> Result<&mut Self, RenderPassError>
pub fn end_render_pass(&mut self) -> Result<&mut Self, RenderPassError>
Ends the render pass previously begun with begin_render_pass
.
This must be called after you went through all the subpasses.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
sourcepub fn begin_rendering(
&mut self,
rendering_info: RenderingInfo
) -> Result<&mut Self, RenderPassError>
pub fn begin_rendering(
&mut self,
rendering_info: RenderingInfo
) -> Result<&mut Self, RenderPassError>
Begins a render pass without a render pass object or framebuffer.
You must call this or begin_render_pass
before you can record draw commands.
sourcepub fn end_rendering(&mut self) -> Result<&mut Self, RenderPassError>
pub fn end_rendering(&mut self) -> Result<&mut Self, RenderPassError>
Ends the render pass previously begun with begin_rendering
.
sourcepub fn clear_attachments(
&mut self,
attachments: impl IntoIterator<Item = ClearAttachment>,
rects: impl IntoIterator<Item = ClearRect>
) -> Result<&mut Self, RenderPassError>
pub fn clear_attachments(
&mut self,
attachments: impl IntoIterator<Item = ClearAttachment>,
rects: impl IntoIterator<Item = ClearRect>
) -> Result<&mut Self, RenderPassError>
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.
sourceimpl<P> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<P::Alloc>, P>where
P: CommandPoolBuilderAlloc,
impl<P> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<P::Alloc>, P>where
P: CommandPoolBuilderAlloc,
Commands to execute a secondary command buffer inside a primary command buffer.
These commands can be called on any queue that can execute the commands recorded in the secondary command buffer.
sourcepub fn execute_commands<C>(
&mut self,
command_buffer: C
) -> Result<&mut Self, ExecuteCommandsError>where
C: SecondaryCommandBuffer + 'static,
pub fn execute_commands<C>(
&mut self,
command_buffer: C
) -> Result<&mut Self, ExecuteCommandsError>where
C: SecondaryCommandBuffer + 'static,
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.
sourcepub fn execute_commands_from_vec<C>(
&mut self,
command_buffers: Vec<C>
) -> Result<&mut Self, ExecuteCommandsError>where
C: SecondaryCommandBuffer + 'static,
pub fn execute_commands_from_vec<C>(
&mut self,
command_buffers: Vec<C>
) -> Result<&mut Self, ExecuteCommandsError>where
C: SecondaryCommandBuffer + 'static,
Executes 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.
sourceimpl<L, P> AutoCommandBufferBuilder<L, P>
impl<L, P> AutoCommandBufferBuilder<L, P>
Commands to transfer data to a resource, either from the host or from another resource.
These commands can be called on a transfer queue, in addition to a compute or graphics queue.
sourcepub fn copy_buffer(
&mut self,
copy_buffer_info: impl Into<CopyBufferInfo>
) -> Result<&mut Self, CopyError>
pub fn copy_buffer(
&mut self,
copy_buffer_info: impl Into<CopyBufferInfo>
) -> Result<&mut Self, CopyError>
Copies data from a buffer to another buffer.
Panics
- Panics if
src_buffer
ordst_buffer
were not created from the same device asself
.
sourcepub fn copy_image(
&mut self,
copy_image_info: CopyImageInfo
) -> Result<&mut Self, CopyError>
pub fn copy_image(
&mut self,
copy_image_info: CopyImageInfo
) -> Result<&mut Self, CopyError>
Copies data from an image to another image.
There are several restrictions:
- 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.
Panics
- Panics if
src_image
ordst_image
were not created from the same device asself
.
sourcepub fn copy_buffer_to_image(
&mut self,
copy_buffer_to_image_info: CopyBufferToImageInfo
) -> Result<&mut Self, CopyError>
pub fn copy_buffer_to_image(
&mut self,
copy_buffer_to_image_info: CopyBufferToImageInfo
) -> Result<&mut Self, CopyError>
Copies from a buffer to an image.
sourcepub fn copy_image_to_buffer(
&mut self,
copy_image_to_buffer_info: CopyImageToBufferInfo
) -> Result<&mut Self, CopyError>
pub fn copy_image_to_buffer(
&mut self,
copy_image_to_buffer_info: CopyImageToBufferInfo
) -> Result<&mut Self, CopyError>
Copies from an image to a buffer.
sourcepub fn fill_buffer(
&mut self,
fill_buffer_info: FillBufferInfo
) -> Result<&mut Self, CopyError>
pub fn fill_buffer(
&mut self,
fill_buffer_info: FillBufferInfo
) -> Result<&mut Self, CopyError>
Fills a region of a buffer with repeated copies of a value.
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.
Panics
- Panics if
dst_buffer
was not created from the same device asself
.
sourcepub fn update_buffer<B, D, Dd>(
&mut self,
data: Dd,
dst_buffer: Arc<B>,
dst_offset: DeviceSize
) -> Result<&mut Self, CopyError>where
B: TypedBufferAccess<Content = D> + 'static,
D: BufferContents + ?Sized,
Dd: SafeDeref<Target = D> + Send + Sync + 'static,
pub fn update_buffer<B, D, Dd>(
&mut self,
data: Dd,
dst_buffer: Arc<B>,
dst_offset: DeviceSize
) -> Result<&mut Self, CopyError>where
B: TypedBufferAccess<Content = D> + 'static,
D: BufferContents + ?Sized,
Dd: SafeDeref<Target = D> + Send + Sync + 'static,
Writes data to a region of a buffer.
Panics
- Panics if
dst_buffer
was not created from the same device asself
.