Struct vulkano::command_buffer::auto::AutoCommandBufferBuilder
source · pub struct AutoCommandBufferBuilder<L, A = StandardCommandBufferAllocator>where
A: CommandBufferAllocator,{ /* private fields */ }
Expand description
Note that command buffers allocated from StandardCommandBufferAllocator
don’t implement
the Send
and Sync
traits. If you use this allocator, then the AutoCommandBufferBuilder
will not implement Send
and Sync
either. Once a command buffer is built, however, it does
implement Send
and Sync
.
Implementations§
source§impl<A> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer, A>where
A: CommandBufferAllocator,
impl<A> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer, A>where A: CommandBufferAllocator,
sourcepub fn primary(
allocator: &A,
queue_family_index: u32,
usage: CommandBufferUsage
) -> Result<AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<A>, A>, Validated<VulkanError>>
pub fn primary( allocator: &A, queue_family_index: u32, usage: CommandBufferUsage ) -> Result<AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<A>, A>, Validated<VulkanError>>
Starts recording a primary command buffer.
source§impl<A> AutoCommandBufferBuilder<SecondaryAutoCommandBuffer, A>where
A: CommandBufferAllocator,
impl<A> AutoCommandBufferBuilder<SecondaryAutoCommandBuffer, A>where A: CommandBufferAllocator,
sourcepub fn secondary(
allocator: &A,
queue_family_index: u32,
usage: CommandBufferUsage,
inheritance_info: CommandBufferInheritanceInfo
) -> Result<AutoCommandBufferBuilder<SecondaryAutoCommandBuffer<A>, A>, Validated<VulkanError>>
pub fn secondary( allocator: &A, queue_family_index: u32, usage: CommandBufferUsage, inheritance_info: CommandBufferInheritanceInfo ) -> Result<AutoCommandBufferBuilder<SecondaryAutoCommandBuffer<A>, A>, Validated<VulkanError>>
Starts recording a secondary command buffer.
source§impl<A> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<A>, A>where
A: CommandBufferAllocator,
impl<A> AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<A>, A>where A: CommandBufferAllocator,
sourcepub fn build(
self
) -> Result<Arc<PrimaryAutoCommandBuffer<A>>, Validated<VulkanError>>
pub fn build( self ) -> Result<Arc<PrimaryAutoCommandBuffer<A>>, Validated<VulkanError>>
Builds the command buffer.
source§impl<A> AutoCommandBufferBuilder<SecondaryAutoCommandBuffer<A>, A>where
A: CommandBufferAllocator,
impl<A> AutoCommandBufferBuilder<SecondaryAutoCommandBuffer<A>, A>where A: CommandBufferAllocator,
sourcepub fn build(
self
) -> Result<Arc<SecondaryAutoCommandBuffer<A>>, Validated<VulkanError>>
pub fn build( self ) -> Result<Arc<SecondaryAutoCommandBuffer<A>>, Validated<VulkanError>>
Builds the command buffer.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
sourcepub unsafe fn build_acceleration_structure(
&mut self,
info: AccelerationStructureBuildGeometryInfo,
build_range_infos: SmallVec<[AccelerationStructureBuildRangeInfo; 8]>
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn build_acceleration_structure( &mut self, info: AccelerationStructureBuildGeometryInfo, build_range_infos: SmallVec<[AccelerationStructureBuildRangeInfo; 8]> ) -> Result<&mut Self, Box<ValidationError>>
Builds or updates an acceleration structure.
Safety
If info.mode
is BuildAccelerationStructureMode::Update
, then the rest of info
must
be valid for an update operation, as follows:
- The source acceleration structure must have been previously built, with
BuildAccelerationStructureFlags::ALLOW_UPDATE
included inAccelerationStructureBuildGeometryInfo::flags
. info
must only differ from theinfo
used to build the source acceleration structure, according to the allowed changes listed in theacceleration_structure
module.
If info.geometries
is AccelerationStructureGeometries::Triangles
, then for each
geometry and the corresponding element in build_range_infos
:
- If
index_data
isSome
, then ifindex_max
is the highest index value in the index buffer that is accessed, then the size ofvertex_data
must be at least
vertex_stride
* (first_vertex
+index_max
+ 1). - If
transform_data
isSome
, then for the 3x4 matrix in the buffer, the first three columns must be a 3x3 invertible matrix.
If info.geometries
is AccelerationStructureGeometries::Aabbs
, then for each geometry:
- For each accessed
AabbPositions
element indata
, each value inmin
must not be greater than the corresponding value inmax
.
If info.geometries
is AccelerationStructureGeometries::Instances
, then the contents
of the buffer in data
must be valid,
as follows:
- Any
AccelerationStructureInstance::acceleration_structure_reference
address contained in or referenced bydata
must be either 0, or a device address that was returned from callingdevice_address
on a bottom-level acceleration structure. - If an
AccelerationStructureInstance::acceleration_structure_reference
address is not 0, then the corresponding acceleration structure object must be kept alive and not be dropped while it is bound to the top-level acceleration structure. - If
data
isAccelerationStructureGeometryInstancesDataType::Pointers
, then the addresses in the buffer must be a multiple of 16.
sourcepub unsafe fn build_acceleration_structure_indirect(
&mut self,
info: AccelerationStructureBuildGeometryInfo,
indirect_buffer: Subbuffer<[u8]>,
stride: u32,
max_primitive_counts: SmallVec<[u32; 8]>
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn build_acceleration_structure_indirect( &mut self, info: AccelerationStructureBuildGeometryInfo, indirect_buffer: Subbuffer<[u8]>, stride: u32, max_primitive_counts: SmallVec<[u32; 8]> ) -> Result<&mut Self, Box<ValidationError>>
Builds or updates an acceleration structure, using AccelerationStructureBuildRangeInfo
elements stored in an indirect buffer.
Safety
The same requirements as for build_acceleration_structure
. In addition, the following
requirements apply for each AccelerationStructureBuildRangeInfo
element contained in
indirect_buffer
:
primitive_count
must not be greater than the corresponding element ofmax_primitive_counts
.- If
info.geometries
isAccelerationStructureGeometries::Instances
, thenprimitive_count
must not be greater than themax_instance_count
limit. Otherwise, it must not be greater than themax_primitive_count
limit.
If info.geometries
is AccelerationStructureGeometries::Triangles
, then:
primitive_offset
must be a multiple of:index_data.index_type().size()
ifindex_data
isSome
.- The byte size of the smallest component of
vertex_format
ifindex_data
isNone
.
transform_offset
must be a multiple of 16.- The size of
vertex_data
must be at least
primitive_offset
+ (first_vertex
+ 3 *primitive_count
) *vertex_stride
ifindex_data
isNone
, and as inbuild_acceleration_structure
ifindex_data
isSome
. - The size of
index_data
must be at least
primitive_offset
+ 3 *primitive_count
*index_data.index_type().size()
. - The size of
transform_data
must be at least
transform_offset
+size_of::<TransformMatrix>()
.
If info.geometries
is AccelerationStructureGeometries::Aabbs
, then:
primitive_offset
must be a multiple of 8.- The size of
data
must be at least
primitive_offset
+primitive_count
*stride
.
If info.geometries
is AccelerationStructureGeometries::Instances
, then:
primitive_offset
must be a multiple of 16.- The size of
data
must be at least:primitive_offset
+primitive_count
*size_of::<AccelerationStructureInstance>()
ifdata
isAccelerationStructureGeometryInstancesDataType::Values
.primitive_offset
+primitive_count
*size_of::<DeviceSize>()
ifdata
isAccelerationStructureGeometryInstancesDataType::Pointers
.
sourcepub unsafe fn copy_acceleration_structure(
&mut self,
info: CopyAccelerationStructureInfo
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn copy_acceleration_structure( &mut self, info: CopyAccelerationStructureInfo ) -> Result<&mut Self, Box<ValidationError>>
Copies the data of one acceleration structure to another.
Safety
info.src
must have been built when this command is executed.- If
info.mode
isCopyAccelerationStructureMode::Compact
, theninfo.src
must have been built withBuildAccelerationStructureFlags::ALLOW_COMPACTION
.
sourcepub unsafe fn copy_acceleration_structure_to_memory(
&mut self,
info: CopyAccelerationStructureToMemoryInfo
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn copy_acceleration_structure_to_memory( &mut self, info: CopyAccelerationStructureToMemoryInfo ) -> Result<&mut Self, Box<ValidationError>>
Serializes the data of an acceleration structure and writes it to a buffer.
Safety
info.src
must have been built when this command is executed.info.dst
must be large enough to hold the serialized form ofinfo.src
. This can be queried usingwrite_acceleration_structures_properties
with a query pool whose type isQueryType::AccelerationStructureSerializationSize
.
sourcepub unsafe fn copy_memory_to_acceleration_structure(
&mut self,
info: CopyMemoryToAccelerationStructureInfo
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn copy_memory_to_acceleration_structure( &mut self, info: CopyMemoryToAccelerationStructureInfo ) -> Result<&mut Self, Box<ValidationError>>
Reads data of a previously serialized acceleration structure from a buffer, and deserializes it back into an acceleration structure.
Safety
info.src
must contain data previously serialized usingcopy_acceleration_structure_to_memory
, and must have a format compatible with the device (as queried byDevice::acceleration_structure_is_compatible
).info.dst.size()
must be at least the size that the structure ininfo.src
had before it was serialized.
sourcepub unsafe fn write_acceleration_structures_properties(
&mut self,
acceleration_structures: SmallVec<[Arc<AccelerationStructure>; 4]>,
query_pool: Arc<QueryPool>,
first_query: u32
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn write_acceleration_structures_properties( &mut self, acceleration_structures: SmallVec<[Arc<AccelerationStructure>; 4]>, query_pool: Arc<QueryPool>, first_query: u32 ) -> Result<&mut Self, Box<ValidationError>>
Writes the properties of one or more acceleration structures to a query.
For each element in acceleration_structures
, one query is written, in numeric order
starting at first_query
.
Safety
- All elements of
acceleration_structures
must have been built when this command is executed. - If
query_pool.query_type()
isQueryType::AccelerationStructureCompactedSize
, all elements ofacceleration_structures
must have been built withBuildAccelerationStructureFlags::ALLOW_COMPACTION
. - The queries must be unavailable, ensured by calling
reset_query_pool
.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
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(
&mut self,
pipeline_bind_point: PipelineBindPoint,
pipeline_layout: Arc<PipelineLayout>,
first_set: u32,
descriptor_sets: impl DescriptorSetsCollection
) -> Result<&mut Self, Box<ValidationError>>
pub fn bind_descriptor_sets( &mut self, pipeline_bind_point: PipelineBindPoint, pipeline_layout: Arc<PipelineLayout>, first_set: u32, descriptor_sets: impl DescriptorSetsCollection ) -> Result<&mut Self, Box<ValidationError>>
Binds descriptor sets for future dispatch or draw calls.
sourcepub fn bind_index_buffer(
&mut self,
index_buffer: impl Into<IndexBuffer>
) -> Result<&mut Self, Box<ValidationError>>
pub fn bind_index_buffer( &mut self, index_buffer: impl Into<IndexBuffer> ) -> Result<&mut Self, Box<ValidationError>>
Binds an index buffer for future indexed draw calls.
sourcepub fn bind_pipeline_compute(
&mut self,
pipeline: Arc<ComputePipeline>
) -> Result<&mut Self, Box<ValidationError>>
pub fn bind_pipeline_compute( &mut self, pipeline: Arc<ComputePipeline> ) -> Result<&mut Self, Box<ValidationError>>
Binds a compute pipeline for future dispatch calls.
sourcepub fn bind_pipeline_graphics(
&mut self,
pipeline: Arc<GraphicsPipeline>
) -> Result<&mut Self, Box<ValidationError>>
pub fn bind_pipeline_graphics( &mut self, pipeline: Arc<GraphicsPipeline> ) -> Result<&mut Self, Box<ValidationError>>
Binds a graphics pipeline for future draw calls.
sourcepub fn bind_vertex_buffers(
&mut self,
first_binding: u32,
vertex_buffers: impl VertexBuffersCollection
) -> Result<&mut Self, Box<ValidationError>>
pub fn bind_vertex_buffers( &mut self, first_binding: u32, vertex_buffers: impl VertexBuffersCollection ) -> Result<&mut Self, Box<ValidationError>>
Binds vertex buffers for future draw calls.
sourcepub fn push_constants<Pc>(
&mut self,
pipeline_layout: Arc<PipelineLayout>,
offset: u32,
push_constants: Pc
) -> Result<&mut Self, Box<ValidationError>>where
Pc: BufferContents,
pub fn push_constants<Pc>( &mut self, pipeline_layout: Arc<PipelineLayout>, offset: u32, push_constants: Pc ) -> Result<&mut Self, Box<ValidationError>>where Pc: BufferContents,
Sets push constants for future dispatch or draw calls.
sourcepub fn push_descriptor_set(
&mut self,
pipeline_bind_point: PipelineBindPoint,
pipeline_layout: Arc<PipelineLayout>,
set_num: u32,
descriptor_writes: SmallVec<[WriteDescriptorSet; 8]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn push_descriptor_set( &mut self, pipeline_bind_point: PipelineBindPoint, pipeline_layout: Arc<PipelineLayout>, set_num: u32, descriptor_writes: SmallVec<[WriteDescriptorSet; 8]> ) -> Result<&mut Self, Box<ValidationError>>
Pushes descriptor data directly into the command buffer for future dispatch or draw calls.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
sourcepub fn clear_color_image(
&mut self,
clear_info: ClearColorImageInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn clear_color_image( &mut self, clear_info: ClearColorImageInfo ) -> Result<&mut Self, Box<ValidationError>>
Clears a color image with a specific value.
sourcepub fn clear_depth_stencil_image(
&mut self,
clear_info: ClearDepthStencilImageInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn clear_depth_stencil_image( &mut self, clear_info: ClearDepthStencilImageInfo ) -> Result<&mut Self, Box<ValidationError>>
Clears a depth/stencil image with a specific value.
sourcepub fn fill_buffer(
&mut self,
dst_buffer: Subbuffer<[u32]>,
data: u32
) -> Result<&mut Self, Box<ValidationError>>
pub fn fill_buffer( &mut self, dst_buffer: Subbuffer<[u32]>, data: u32 ) -> Result<&mut Self, Box<ValidationError>>
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.
sourcepub fn update_buffer<D, Dd>(
&mut self,
dst_buffer: Subbuffer<D>,
data: Dd
) -> Result<&mut Self, Box<ValidationError>>where
D: BufferContents + ?Sized,
Dd: SafeDeref<Target = D> + Send + Sync + 'static,
pub fn update_buffer<D, Dd>( &mut self, dst_buffer: Subbuffer<D>, data: Dd ) -> Result<&mut Self, Box<ValidationError>>where D: BufferContents + ?Sized, Dd: SafeDeref<Target = D> + Send + Sync + 'static,
Writes data to a region of a buffer.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
sourcepub fn copy_buffer(
&mut self,
copy_buffer_info: impl Into<CopyBufferInfo>
) -> Result<&mut Self, Box<ValidationError>>
pub fn copy_buffer( &mut self, copy_buffer_info: impl Into<CopyBufferInfo> ) -> Result<&mut Self, Box<ValidationError>>
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, Box<ValidationError>>
pub fn copy_image( &mut self, copy_image_info: CopyImageInfo ) -> Result<&mut Self, Box<ValidationError>>
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, Box<ValidationError>>
pub fn copy_buffer_to_image( &mut self, copy_buffer_to_image_info: CopyBufferToImageInfo ) -> Result<&mut Self, Box<ValidationError>>
Copies from a buffer to an image.
sourcepub fn copy_image_to_buffer(
&mut self,
copy_image_to_buffer_info: CopyImageToBufferInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn copy_image_to_buffer( &mut self, copy_image_to_buffer_info: CopyImageToBufferInfo ) -> Result<&mut Self, Box<ValidationError>>
Copies from an image to a buffer.
sourcepub fn blit_image(
&mut self,
blit_image_info: BlitImageInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn blit_image( &mut self, blit_image_info: BlitImageInfo ) -> Result<&mut Self, Box<ValidationError>>
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.
Panics
- Panics if the source or the destination was not created with
device
.
sourcepub fn resolve_image(
&mut self,
resolve_image_info: ResolveImageInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn resolve_image( &mut self, resolve_image_info: ResolveImageInfo ) -> Result<&mut Self, Box<ValidationError>>
Resolves a multisampled image into a single-sampled image.
Panics
- Panics if
src_image
ordst_image
were not created from the same device asself
.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
Commands for debugging.
These commands all require the ext_debug_utils
extension to be enabled on the instance.
sourcepub fn begin_debug_utils_label(
&mut self,
label_info: DebugUtilsLabel
) -> Result<&mut Self, Box<ValidationError>>
pub fn begin_debug_utils_label( &mut self, label_info: DebugUtilsLabel ) -> Result<&mut Self, Box<ValidationError>>
Opens a command buffer debug label region.
sourcepub unsafe fn end_debug_utils_label(
&mut self
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn end_debug_utils_label( &mut self ) -> Result<&mut Self, Box<ValidationError>>
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, Box<ValidationError>>
pub fn insert_debug_utils_label( &mut self, label_info: DebugUtilsLabel ) -> Result<&mut Self, Box<ValidationError>>
Inserts a command buffer debug label.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
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]
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_blend_constants( &mut self, constants: [f32; 4] ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic blend constants for future draw calls.
sourcepub fn set_color_write_enable(
&mut self,
enables: SmallVec<[bool; 4]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_color_write_enable( &mut self, enables: SmallVec<[bool; 4]> ) -> Result<&mut Self, Box<ValidationError>>
Sets whether dynamic color writes should be enabled for each attachment in the framebuffer.
sourcepub fn set_cull_mode(
&mut self,
cull_mode: CullMode
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_cull_mode( &mut self, cull_mode: CullMode ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic cull mode for future draw calls.
sourcepub fn set_depth_bias(
&mut self,
constant_factor: f32,
clamp: f32,
slope_factor: f32
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_depth_bias( &mut self, constant_factor: f32, clamp: f32, slope_factor: f32 ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic depth bias values for future draw calls.
sourcepub fn set_depth_bias_enable(
&mut self,
enable: bool
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_depth_bias_enable( &mut self, enable: bool ) -> Result<&mut Self, Box<ValidationError>>
Sets whether dynamic depth bias is enabled for future draw calls.
sourcepub fn set_depth_bounds(
&mut self,
bounds: RangeInclusive<f32>
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_depth_bounds( &mut self, bounds: RangeInclusive<f32> ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic depth bounds for future draw calls.
sourcepub fn set_depth_bounds_test_enable(
&mut self,
enable: bool
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_depth_bounds_test_enable( &mut self, enable: bool ) -> Result<&mut Self, Box<ValidationError>>
Sets whether dynamic depth bounds testing is enabled for future draw calls.
sourcepub fn set_depth_compare_op(
&mut self,
compare_op: CompareOp
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_depth_compare_op( &mut self, compare_op: CompareOp ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic depth compare op for future draw calls.
sourcepub fn set_depth_test_enable(
&mut self,
enable: bool
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_depth_test_enable( &mut self, enable: bool ) -> Result<&mut Self, Box<ValidationError>>
Sets whether dynamic depth testing is enabled for future draw calls.
sourcepub fn set_depth_write_enable(
&mut self,
enable: bool
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_depth_write_enable( &mut self, enable: bool ) -> Result<&mut Self, Box<ValidationError>>
Sets whether dynamic depth write is enabled for future draw calls.
sourcepub fn set_discard_rectangle(
&mut self,
first_rectangle: u32,
rectangles: SmallVec<[Scissor; 2]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_discard_rectangle( &mut self, first_rectangle: u32, rectangles: SmallVec<[Scissor; 2]> ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic discard rectangles for future draw calls.
sourcepub fn set_front_face(
&mut self,
face: FrontFace
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_front_face( &mut self, face: FrontFace ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic front face for future draw calls.
sourcepub fn set_line_stipple(
&mut self,
factor: u32,
pattern: u16
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_line_stipple( &mut self, factor: u32, pattern: u16 ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic line stipple values for future draw calls.
sourcepub fn set_line_width(
&mut self,
line_width: f32
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_line_width( &mut self, line_width: f32 ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic line width for future draw calls.
sourcepub fn set_logic_op(
&mut self,
logic_op: LogicOp
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_logic_op( &mut self, logic_op: LogicOp ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic logic op for future draw calls.
sourcepub fn set_patch_control_points(
&mut self,
num: u32
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_patch_control_points( &mut self, num: u32 ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic number of patch control points for future draw calls.
sourcepub fn set_primitive_restart_enable(
&mut self,
enable: bool
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_primitive_restart_enable( &mut self, enable: bool ) -> Result<&mut Self, Box<ValidationError>>
Sets whether dynamic primitive restart is enabled for future draw calls.
sourcepub fn set_primitive_topology(
&mut self,
topology: PrimitiveTopology
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_primitive_topology( &mut self, topology: PrimitiveTopology ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic primitive topology for future draw calls.
sourcepub fn set_rasterizer_discard_enable(
&mut self,
enable: bool
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_rasterizer_discard_enable( &mut self, enable: bool ) -> Result<&mut Self, Box<ValidationError>>
Sets whether dynamic rasterizer discard is enabled for future draw calls.
sourcepub fn set_scissor(
&mut self,
first_scissor: u32,
scissors: SmallVec<[Scissor; 2]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_scissor( &mut self, first_scissor: u32, scissors: SmallVec<[Scissor; 2]> ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic scissors for future draw calls.
sourcepub fn set_scissor_with_count(
&mut self,
scissors: SmallVec<[Scissor; 2]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_scissor_with_count( &mut self, scissors: SmallVec<[Scissor; 2]> ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic scissors with count for future draw calls.
sourcepub fn set_stencil_compare_mask(
&mut self,
faces: StencilFaces,
compare_mask: u32
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_stencil_compare_mask( &mut self, faces: StencilFaces, compare_mask: u32 ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic stencil compare mask on one or both faces for future draw calls.
sourcepub fn set_stencil_op(
&mut self,
faces: StencilFaces,
fail_op: StencilOp,
pass_op: StencilOp,
depth_fail_op: StencilOp,
compare_op: CompareOp
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_stencil_op( &mut self, faces: StencilFaces, fail_op: StencilOp, pass_op: StencilOp, depth_fail_op: StencilOp, compare_op: CompareOp ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic stencil ops on one or both faces for future draw calls.
sourcepub fn set_stencil_reference(
&mut self,
faces: StencilFaces,
reference: u32
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_stencil_reference( &mut self, faces: StencilFaces, reference: u32 ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic stencil reference on one or both faces for future draw calls.
sourcepub fn set_stencil_test_enable(
&mut self,
enable: bool
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_stencil_test_enable( &mut self, enable: bool ) -> Result<&mut Self, Box<ValidationError>>
Sets whether dynamic stencil testing is enabled for future draw calls.
sourcepub fn set_stencil_write_mask(
&mut self,
faces: StencilFaces,
write_mask: u32
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_stencil_write_mask( &mut self, faces: StencilFaces, write_mask: u32 ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic stencil write mask on one or both faces for future draw calls.
sourcepub fn set_viewport(
&mut self,
first_viewport: u32,
viewports: SmallVec<[Viewport; 2]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_viewport( &mut self, first_viewport: u32, viewports: SmallVec<[Viewport; 2]> ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic viewports for future draw calls.
sourcepub fn set_viewport_with_count(
&mut self,
viewports: SmallVec<[Viewport; 2]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn set_viewport_with_count( &mut self, viewports: SmallVec<[Viewport; 2]> ) -> Result<&mut Self, Box<ValidationError>>
Sets the dynamic viewports with count for future draw calls.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
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, Box<ValidationError>>
pub fn dispatch( &mut self, group_counts: [u32; 3] ) -> Result<&mut Self, Box<ValidationError>>
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(
&mut self,
indirect_buffer: Subbuffer<[DispatchIndirectCommand]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn dispatch_indirect( &mut self, indirect_buffer: Subbuffer<[DispatchIndirectCommand]> ) -> Result<&mut Self, Box<ValidationError>>
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, Box<ValidationError>>
pub fn draw( &mut self, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32 ) -> Result<&mut Self, Box<ValidationError>>
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(
&mut self,
indirect_buffer: Subbuffer<[DrawIndirectCommand]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn draw_indirect( &mut self, indirect_buffer: Subbuffer<[DrawIndirectCommand]> ) -> Result<&mut Self, Box<ValidationError>>
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, Box<ValidationError>>
pub fn draw_indexed( &mut self, index_count: u32, instance_count: u32, first_index: u32, vertex_offset: i32, first_instance: u32 ) -> Result<&mut Self, Box<ValidationError>>
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(
&mut self,
indirect_buffer: Subbuffer<[DrawIndexedIndirectCommand]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn draw_indexed_indirect( &mut self, indirect_buffer: Subbuffer<[DrawIndexedIndirectCommand]> ) -> Result<&mut Self, Box<ValidationError>>
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.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
sourcepub unsafe fn begin_query(
&mut self,
query_pool: Arc<QueryPool>,
query: u32,
flags: QueryControlFlags
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn begin_query( &mut self, query_pool: Arc<QueryPool>, query: u32, flags: QueryControlFlags ) -> Result<&mut Self, Box<ValidationError>>
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, Box<ValidationError>>
pub fn end_query( &mut self, query_pool: Arc<QueryPool>, query: u32 ) -> Result<&mut Self, Box<ValidationError>>
Ends an active query.
sourcepub unsafe fn write_timestamp(
&mut self,
query_pool: Arc<QueryPool>,
query: u32,
stage: PipelineStage
) -> Result<&mut Self, Box<ValidationError>>
pub unsafe fn write_timestamp( &mut self, query_pool: Arc<QueryPool>, query: u32, stage: PipelineStage ) -> Result<&mut Self, Box<ValidationError>>
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<T>(
&mut self,
query_pool: Arc<QueryPool>,
queries: Range<u32>,
destination: Subbuffer<[T]>,
flags: QueryResultFlags
) -> Result<&mut Self, Box<ValidationError>>where
T: QueryResultElement,
pub fn copy_query_pool_results<T>( &mut self, query_pool: Arc<QueryPool>, queries: Range<u32>, destination: Subbuffer<[T]>, flags: QueryResultFlags ) -> Result<&mut Self, Box<ValidationError>>where 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, Box<ValidationError>>
pub unsafe fn reset_query_pool( &mut self, query_pool: Arc<QueryPool>, queries: Range<u32> ) -> Result<&mut Self, Box<ValidationError>>
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.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
Commands for render passes.
These commands require a graphics queue.
sourcepub fn begin_render_pass(
&mut self,
render_pass_begin_info: RenderPassBeginInfo,
subpass_begin_info: SubpassBeginInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn begin_render_pass( &mut self, render_pass_begin_info: RenderPassBeginInfo, subpass_begin_info: SubpassBeginInfo ) -> Result<&mut Self, Box<ValidationError>>
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,
subpass_end_info: SubpassEndInfo,
subpass_begin_info: SubpassBeginInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn next_subpass( &mut self, subpass_end_info: SubpassEndInfo, subpass_begin_info: SubpassBeginInfo ) -> Result<&mut Self, Box<ValidationError>>
Advances to the next subpass of the render pass previously begun with begin_render_pass
.
sourcepub fn end_render_pass(
&mut self,
subpass_end_info: SubpassEndInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn end_render_pass( &mut self, subpass_end_info: SubpassEndInfo ) -> Result<&mut Self, Box<ValidationError>>
Ends the render pass previously begun with begin_render_pass
.
This must be called after you went through all the subpasses.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
sourcepub fn begin_rendering(
&mut self,
rendering_info: RenderingInfo
) -> Result<&mut Self, Box<ValidationError>>
pub fn begin_rendering( &mut self, rendering_info: RenderingInfo ) -> Result<&mut Self, Box<ValidationError>>
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, Box<ValidationError>>
pub fn end_rendering(&mut self) -> Result<&mut Self, Box<ValidationError>>
Ends the render pass previously begun with begin_rendering
.
sourcepub fn clear_attachments(
&mut self,
attachments: SmallVec<[ClearAttachment; 4]>,
rects: SmallVec<[ClearRect; 4]>
) -> Result<&mut Self, Box<ValidationError>>
pub fn clear_attachments( &mut self, attachments: SmallVec<[ClearAttachment; 4]>, rects: SmallVec<[ClearRect; 4]> ) -> Result<&mut Self, Box<ValidationError>>
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.
source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
impl<L, A> AutoCommandBufferBuilder<L, A>where A: CommandBufferAllocator,
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(
&mut self,
command_buffer: Arc<dyn SecondaryCommandBufferAbstract>
) -> Result<&mut Self, Box<ValidationError>>
pub fn execute_commands( &mut self, command_buffer: Arc<dyn SecondaryCommandBufferAbstract> ) -> Result<&mut Self, Box<ValidationError>>
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(
&mut self,
command_buffers: Vec<Arc<dyn SecondaryCommandBufferAbstract>>
) -> Result<&mut Self, Box<ValidationError>>
pub fn execute_commands_from_vec( &mut self, command_buffers: Vec<Arc<dyn SecondaryCommandBufferAbstract>> ) -> Result<&mut Self, Box<ValidationError>>
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.