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,
§Commands to do operations on acceleration structures.
impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
§Commands to do operations on acceleration structures.
Sourcepub unsafe fn build_acceleration_structure(
&mut self,
info: AccelerationStructureBuildGeometryInfo,
build_range_infos: SmallVec<[AccelerationStructureBuildRangeInfo; 8]>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub unsafe fn build_acceleration_structure( &mut self, info: AccelerationStructureBuildGeometryInfo, build_range_infos: SmallVec<[AccelerationStructureBuildRangeInfo; 8]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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_UPDATEincluded inAccelerationStructureBuildGeometryInfo::flags. infomust only differ from theinfoused to build the source acceleration structure, according to the allowed changes listed in theacceleration_structuremodule.
If info.geometries is AccelerationStructureGeometries::Triangles, then for each
geometry and the corresponding element in build_range_infos:
- If
index_dataisSome, then ifindex_maxis the highest index value in the index buffer that is accessed, then the size ofvertex_datamust be at least
vertex_stride* (first_vertex+index_max+ 1). - If
transform_dataisSome, 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
AabbPositionselement indata, each value inminmust 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_referenceaddress contained in or referenced bydatamust be either 0, or a device address that was returned from callingdevice_addresson a bottom-level acceleration structure. - If an
AccelerationStructureInstance::acceleration_structure_referenceaddress 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
dataisAccelerationStructureGeometryInstancesDataType::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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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_countmust not be greater than the corresponding element ofmax_primitive_counts.- If
info.geometriesisAccelerationStructureGeometries::Instances, thenprimitive_countmust not be greater than themax_instance_countlimit. Otherwise, it must not be greater than themax_primitive_countlimit.
If info.geometries is AccelerationStructureGeometries::Triangles, then:
primitive_offsetmust be a multiple of:index_data.index_type().size()ifindex_dataisSome.- The byte size of the smallest component of
vertex_formatifindex_dataisNone.
transform_offsetmust be a multiple of 16.- The size of
vertex_datamust be at least
primitive_offset+ (first_vertex+ 3 *primitive_count) *vertex_stride
ifindex_dataisNone, and as inbuild_acceleration_structureifindex_dataisSome. - The size of
index_datamust be at least
primitive_offset+ 3 *primitive_count*index_data.index_type().size(). - The size of
transform_datamust be at least
transform_offset+size_of::<TransformMatrix>().
If info.geometries is AccelerationStructureGeometries::Aabbs, then:
primitive_offsetmust be a multiple of 8.- The size of
datamust be at least
primitive_offset+primitive_count*stride.
If info.geometries is AccelerationStructureGeometries::Instances, then:
primitive_offsetmust be a multiple of 16.- The size of
datamust be at least:primitive_offset+primitive_count*size_of::<AccelerationStructureInstance>()
ifdataisAccelerationStructureGeometryInstancesDataType::Values.primitive_offset+primitive_count*size_of::<DeviceSize>()
ifdataisAccelerationStructureGeometryInstancesDataType::Pointers.
Sourcepub unsafe fn copy_acceleration_structure(
&mut self,
info: CopyAccelerationStructureInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub unsafe fn copy_acceleration_structure( &mut self, info: CopyAccelerationStructureInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Copies the data of one acceleration structure to another.
§Safety
info.srcmust have been built when this command is executed.- If
info.modeisCopyAccelerationStructureMode::Compact, theninfo.srcmust have been built withBuildAccelerationStructureFlags::ALLOW_COMPACTION.
Sourcepub unsafe fn copy_acceleration_structure_to_memory(
&mut self,
info: CopyAccelerationStructureToMemoryInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub unsafe fn copy_acceleration_structure_to_memory( &mut self, info: CopyAccelerationStructureToMemoryInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Serializes the data of an acceleration structure and writes it to a buffer.
§Safety
info.srcmust have been built when this command is executed.info.dstmust be large enough to hold the serialized form ofinfo.src. This can be queried usingwrite_acceleration_structures_propertieswith a query pool whose type isQueryType::AccelerationStructureSerializationSize.
Sourcepub unsafe fn copy_memory_to_acceleration_structure(
&mut self,
info: CopyMemoryToAccelerationStructureInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub unsafe fn copy_memory_to_acceleration_structure( &mut self, info: CopyMemoryToAccelerationStructureInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Reads data of a previously serialized acceleration structure from a buffer, and deserializes it back into an acceleration structure.
§Safety
info.srcmust 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.srchad 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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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_structuresmust have been built when this command is executed. - If
query_pool.query_type()isQueryType::AccelerationStructureCompactedSize, all elements ofacceleration_structuresmust 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,
§Commands to bind or push state for pipeline execution commands.
These commands require a queue with a pipeline type that uses the given state.
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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Binds descriptor sets for future dispatch or draw calls.
Examples found in repository?
165pub fn get_cmd_bufs(
166 vk: Arc<Vk>,
167 renderer: &Renderer,
168 imgui_renderer: &mut ImGui,
169 presenter: &Presenter,
170 pipeline: Arc<GraphicsPipeline>,
171) -> Vec<CommandBufferType> {
172 let mut cmd_bufs: Vec<CommandBufferType> = vec![];
173
174 let ubo = VkBuffer::uniform(vk.allocators.clone(), vs::Camera {
175 view: renderer.camera.get_view(),
176 proj: renderer.camera.get_proj(),
177 });
178
179 let camera_desc_set = descriptor_set(
180 vk.clone(),
181 0,
182 pipeline.clone(),
183 [WriteDescriptorSet::buffer(0, ubo.content.clone())]
184 ).0;
185
186 let render_passes = imgui_renderer.get_renderpasses(
187 presenter.images.clone(),
188 vk.clone()
189 );
190
191 let mut i = 0;
192 for framebuffer in &presenter.framebuffers.clone() {
193 let mut builder = VkBuilder::new_multiple(vk.clone());
194
195 builder.0
196 .begin_render_pass(
197 RenderPassBeginInfo {
198 clear_values: vec![Some([0.1, 0.2, 0.3, 1.0].into()), Some(1.0.into())],
199 ..RenderPassBeginInfo::framebuffer(framebuffer.clone())
200 },
201 SubpassBeginInfo {
202 contents: SubpassContents::Inline,
203 ..Default::default()
204 },
205 )
206 .unwrap()
207 .bind_pipeline_graphics(pipeline.clone())
208 .unwrap()
209 .bind_descriptor_sets(
210 vulkano::pipeline::PipelineBindPoint::Graphics,
211 pipeline.layout().clone(),
212 0,
213 camera_desc_set.clone(),
214 )
215 .unwrap();
216
217 for mesh in &renderer.meshes {
218 mesh.build_commands(vk.clone(), &mut builder.0, pipeline.clone());
219 }
220
221 builder.0.end_render_pass(Default::default()).unwrap();
222
223 let render_pass = &render_passes[i];
224 builder.0.begin_render_pass(
225 RenderPassBeginInfo {
226 clear_values: vec![None],
227 render_pass: render_pass.rp.clone(),
228 ..RenderPassBeginInfo::framebuffer(render_pass.framebuffer.clone())
229 },
230 SubpassBeginInfo {
231 contents: SubpassContents::SecondaryCommandBuffers,
232 ..Default::default()
233 },
234 ).expect(&format!("failed to start imgui render pass on framebuffer {:?}", framebuffer));
235
236 builder.0.execute_commands(render_pass.cmd_buf.clone()).unwrap();
237
238 builder.0.end_render_pass(Default::default()).unwrap();
239
240
241 cmd_bufs.push(
242 builder.command_buffer()
243 );
244
245 i += 1;
246 }
247
248 cmd_bufs
249}Sourcepub fn bind_index_buffer(
&mut self,
index_buffer: impl Into<IndexBuffer>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn bind_index_buffer( &mut self, index_buffer: impl Into<IndexBuffer>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Binds an index buffer for future indexed draw calls.
Sourcepub fn bind_pipeline_compute(
&mut self,
pipeline: Arc<ComputePipeline>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn bind_pipeline_compute( &mut self, pipeline: Arc<ComputePipeline>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Binds a compute pipeline for future dispatch calls.
Sourcepub fn bind_pipeline_graphics(
&mut self,
pipeline: Arc<GraphicsPipeline>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn bind_pipeline_graphics( &mut self, pipeline: Arc<GraphicsPipeline>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Binds a graphics pipeline for future draw calls.
Examples found in repository?
165pub fn get_cmd_bufs(
166 vk: Arc<Vk>,
167 renderer: &Renderer,
168 imgui_renderer: &mut ImGui,
169 presenter: &Presenter,
170 pipeline: Arc<GraphicsPipeline>,
171) -> Vec<CommandBufferType> {
172 let mut cmd_bufs: Vec<CommandBufferType> = vec![];
173
174 let ubo = VkBuffer::uniform(vk.allocators.clone(), vs::Camera {
175 view: renderer.camera.get_view(),
176 proj: renderer.camera.get_proj(),
177 });
178
179 let camera_desc_set = descriptor_set(
180 vk.clone(),
181 0,
182 pipeline.clone(),
183 [WriteDescriptorSet::buffer(0, ubo.content.clone())]
184 ).0;
185
186 let render_passes = imgui_renderer.get_renderpasses(
187 presenter.images.clone(),
188 vk.clone()
189 );
190
191 let mut i = 0;
192 for framebuffer in &presenter.framebuffers.clone() {
193 let mut builder = VkBuilder::new_multiple(vk.clone());
194
195 builder.0
196 .begin_render_pass(
197 RenderPassBeginInfo {
198 clear_values: vec![Some([0.1, 0.2, 0.3, 1.0].into()), Some(1.0.into())],
199 ..RenderPassBeginInfo::framebuffer(framebuffer.clone())
200 },
201 SubpassBeginInfo {
202 contents: SubpassContents::Inline,
203 ..Default::default()
204 },
205 )
206 .unwrap()
207 .bind_pipeline_graphics(pipeline.clone())
208 .unwrap()
209 .bind_descriptor_sets(
210 vulkano::pipeline::PipelineBindPoint::Graphics,
211 pipeline.layout().clone(),
212 0,
213 camera_desc_set.clone(),
214 )
215 .unwrap();
216
217 for mesh in &renderer.meshes {
218 mesh.build_commands(vk.clone(), &mut builder.0, pipeline.clone());
219 }
220
221 builder.0.end_render_pass(Default::default()).unwrap();
222
223 let render_pass = &render_passes[i];
224 builder.0.begin_render_pass(
225 RenderPassBeginInfo {
226 clear_values: vec![None],
227 render_pass: render_pass.rp.clone(),
228 ..RenderPassBeginInfo::framebuffer(render_pass.framebuffer.clone())
229 },
230 SubpassBeginInfo {
231 contents: SubpassContents::SecondaryCommandBuffers,
232 ..Default::default()
233 },
234 ).expect(&format!("failed to start imgui render pass on framebuffer {:?}", framebuffer));
235
236 builder.0.execute_commands(render_pass.cmd_buf.clone()).unwrap();
237
238 builder.0.end_render_pass(Default::default()).unwrap();
239
240
241 cmd_bufs.push(
242 builder.command_buffer()
243 );
244
245 i += 1;
246 }
247
248 cmd_bufs
249}Sourcepub fn bind_vertex_buffers(
&mut self,
first_binding: u32,
vertex_buffers: impl VertexBuffersCollection,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn bind_vertex_buffers( &mut self, first_binding: u32, vertex_buffers: impl VertexBuffersCollection, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>where
Pc: BufferContents,
pub fn push_constants<Pc>(
&mut self,
pipeline_layout: Arc<PipelineLayout>,
offset: u32,
push_constants: Pc,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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,
§Commands to fill resources with new data.
impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
§Commands to fill resources with new data.
Sourcepub fn clear_color_image(
&mut self,
clear_info: ClearColorImageInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn clear_color_image( &mut self, clear_info: ClearColorImageInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Clears a color image with a specific value.
Sourcepub fn clear_depth_stencil_image(
&mut self,
clear_info: ClearDepthStencilImageInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn clear_depth_stencil_image( &mut self, clear_info: ClearDepthStencilImageInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn fill_buffer( &mut self, dst_buffer: Subbuffer<[u32]>, data: u32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn update_buffer<D, Dd>( &mut self, dst_buffer: Subbuffer<D>, data: Dd, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Writes data to a region of a buffer.
Source§impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
§Commands to transfer data between resources.
impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
§Commands to transfer data between resources.
Sourcepub fn copy_buffer(
&mut self,
copy_buffer_info: impl Into<CopyBufferInfo>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn copy_buffer( &mut self, copy_buffer_info: impl Into<CopyBufferInfo>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Copies data from a buffer to another buffer.
§Panics
- Panics if
src_bufferordst_bufferwere not created from the same device asself.
Sourcepub fn copy_image(
&mut self,
copy_image_info: CopyImageInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn copy_image( &mut self, copy_image_info: CopyImageInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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_imageordst_imagewere not created from the same device asself.
Sourcepub fn copy_buffer_to_image(
&mut self,
copy_buffer_to_image_info: CopyBufferToImageInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn copy_buffer_to_image( &mut self, copy_buffer_to_image_info: CopyBufferToImageInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn copy_image_to_buffer( &mut self, copy_image_to_buffer_info: CopyImageToBufferInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Copies from an image to a buffer.
Sourcepub fn blit_image(
&mut self,
blit_image_info: BlitImageInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn blit_image( &mut self, blit_image_info: BlitImageInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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
Nearestfilter 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn resolve_image( &mut self, resolve_image_info: ResolveImageInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Resolves a multisampled image into a single-sampled image.
§Panics
- Panics if
src_imageordst_imagewere not created from the same device asself.
Source§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.
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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn begin_debug_utils_label( &mut self, label_info: DebugUtilsLabel, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Opens a command buffer debug label region.
Sourcepub unsafe fn end_debug_utils_label(
&mut self,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub unsafe fn end_debug_utils_label( &mut self, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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_labelin 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn insert_debug_utils_label( &mut self, label_info: DebugUtilsLabel, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Inserts a command buffer debug label.
Source§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.
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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_blend_constants( &mut self, constants: [f32; 4], ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_color_write_enable( &mut self, enables: SmallVec<[bool; 4]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_cull_mode( &mut self, cull_mode: CullMode, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_depth_bias( &mut self, constant_factor: f32, clamp: f32, slope_factor: f32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic depth bias values for future draw calls.
Sourcepub fn set_depth_bias_enable(
&mut self,
enable: bool,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_depth_bias_enable( &mut self, enable: bool, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_depth_bounds( &mut self, bounds: RangeInclusive<f32>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic depth bounds for future draw calls.
Sourcepub fn set_depth_bounds_test_enable(
&mut self,
enable: bool,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_depth_bounds_test_enable( &mut self, enable: bool, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_depth_compare_op( &mut self, compare_op: CompareOp, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic depth compare op for future draw calls.
Sourcepub fn set_depth_test_enable(
&mut self,
enable: bool,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_depth_test_enable( &mut self, enable: bool, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_depth_write_enable( &mut self, enable: bool, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_discard_rectangle( &mut self, first_rectangle: u32, rectangles: SmallVec<[Scissor; 2]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic discard rectangles for future draw calls.
Sourcepub fn set_front_face(
&mut self,
face: FrontFace,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_front_face( &mut self, face: FrontFace, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic front face for future draw calls.
Sourcepub fn set_line_stipple(
&mut self,
factor: u32,
pattern: u16,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_line_stipple( &mut self, factor: u32, pattern: u16, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic line stipple values for future draw calls.
Sourcepub fn set_line_width(
&mut self,
line_width: f32,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_line_width( &mut self, line_width: f32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic line width for future draw calls.
Sourcepub fn set_logic_op(
&mut self,
logic_op: LogicOp,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_logic_op( &mut self, logic_op: LogicOp, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic logic op for future draw calls.
Sourcepub fn set_patch_control_points(
&mut self,
num: u32,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_patch_control_points( &mut self, num: u32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_primitive_restart_enable( &mut self, enable: bool, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets whether dynamic primitive restart is enabled for future draw calls.
Sourcepub fn set_primitive_topology(
&mut self,
topology: PrimitiveTopology,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_primitive_topology( &mut self, topology: PrimitiveTopology, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic primitive topology for future draw calls.
Sourcepub fn set_rasterizer_discard_enable(
&mut self,
enable: bool,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_rasterizer_discard_enable( &mut self, enable: bool, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_scissor( &mut self, first_scissor: u32, scissors: SmallVec<[Scissor; 2]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic scissors for future draw calls.
Sourcepub fn set_scissor_with_count(
&mut self,
scissors: SmallVec<[Scissor; 2]>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_scissor_with_count( &mut self, scissors: SmallVec<[Scissor; 2]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_stencil_compare_mask( &mut self, faces: StencilFaces, compare_mask: u32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_stencil_reference( &mut self, faces: StencilFaces, reference: u32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_stencil_test_enable( &mut self, enable: bool, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_stencil_write_mask( &mut self, faces: StencilFaces, write_mask: u32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_viewport( &mut self, first_viewport: u32, viewports: SmallVec<[Viewport; 2]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic viewports for future draw calls.
Sourcepub fn set_viewport_with_count(
&mut self,
viewports: SmallVec<[Viewport; 2]>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn set_viewport_with_count( &mut self, viewports: SmallVec<[Viewport; 2]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Sets the dynamic viewports with count for future draw calls.
Source§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.
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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn dispatch( &mut self, group_counts: [u32; 3], ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn dispatch_indirect( &mut self, indirect_buffer: Subbuffer<[DispatchIndirectCommand]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn draw( &mut self, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn draw_indirect( &mut self, indirect_buffer: Subbuffer<[DrawIndirectCommand]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn draw_indexed_indirect( &mut self, indirect_buffer: Subbuffer<[DrawIndexedIndirectCommand]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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,
§Commands related to queries.
impl<L, A> AutoCommandBufferBuilder<L, A>where
A: CommandBufferAllocator,
§Commands related to queries.
Sourcepub unsafe fn begin_query(
&mut self,
query_pool: Arc<QueryPool>,
query: u32,
flags: QueryControlFlags,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub unsafe fn begin_query( &mut self, query_pool: Arc<QueryPool>, query: u32, flags: QueryControlFlags, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn end_query( &mut self, query_pool: Arc<QueryPool>, query: u32, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Ends an active query.
Sourcepub unsafe fn write_timestamp(
&mut self,
query_pool: Arc<QueryPool>,
query: u32,
stage: PipelineStage,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub unsafe fn write_timestamp( &mut self, query_pool: Arc<QueryPool>, query: u32, stage: PipelineStage, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub unsafe fn reset_query_pool( &mut self, query_pool: Arc<QueryPool>, queries: Range<u32>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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,
§Commands for render passes.
These commands require a graphics queue.
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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn begin_render_pass( &mut self, render_pass_begin_info: RenderPassBeginInfo, subpass_begin_info: SubpassBeginInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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.
Examples found in repository?
165pub fn get_cmd_bufs(
166 vk: Arc<Vk>,
167 renderer: &Renderer,
168 imgui_renderer: &mut ImGui,
169 presenter: &Presenter,
170 pipeline: Arc<GraphicsPipeline>,
171) -> Vec<CommandBufferType> {
172 let mut cmd_bufs: Vec<CommandBufferType> = vec![];
173
174 let ubo = VkBuffer::uniform(vk.allocators.clone(), vs::Camera {
175 view: renderer.camera.get_view(),
176 proj: renderer.camera.get_proj(),
177 });
178
179 let camera_desc_set = descriptor_set(
180 vk.clone(),
181 0,
182 pipeline.clone(),
183 [WriteDescriptorSet::buffer(0, ubo.content.clone())]
184 ).0;
185
186 let render_passes = imgui_renderer.get_renderpasses(
187 presenter.images.clone(),
188 vk.clone()
189 );
190
191 let mut i = 0;
192 for framebuffer in &presenter.framebuffers.clone() {
193 let mut builder = VkBuilder::new_multiple(vk.clone());
194
195 builder.0
196 .begin_render_pass(
197 RenderPassBeginInfo {
198 clear_values: vec![Some([0.1, 0.2, 0.3, 1.0].into()), Some(1.0.into())],
199 ..RenderPassBeginInfo::framebuffer(framebuffer.clone())
200 },
201 SubpassBeginInfo {
202 contents: SubpassContents::Inline,
203 ..Default::default()
204 },
205 )
206 .unwrap()
207 .bind_pipeline_graphics(pipeline.clone())
208 .unwrap()
209 .bind_descriptor_sets(
210 vulkano::pipeline::PipelineBindPoint::Graphics,
211 pipeline.layout().clone(),
212 0,
213 camera_desc_set.clone(),
214 )
215 .unwrap();
216
217 for mesh in &renderer.meshes {
218 mesh.build_commands(vk.clone(), &mut builder.0, pipeline.clone());
219 }
220
221 builder.0.end_render_pass(Default::default()).unwrap();
222
223 let render_pass = &render_passes[i];
224 builder.0.begin_render_pass(
225 RenderPassBeginInfo {
226 clear_values: vec![None],
227 render_pass: render_pass.rp.clone(),
228 ..RenderPassBeginInfo::framebuffer(render_pass.framebuffer.clone())
229 },
230 SubpassBeginInfo {
231 contents: SubpassContents::SecondaryCommandBuffers,
232 ..Default::default()
233 },
234 ).expect(&format!("failed to start imgui render pass on framebuffer {:?}", framebuffer));
235
236 builder.0.execute_commands(render_pass.cmd_buf.clone()).unwrap();
237
238 builder.0.end_render_pass(Default::default()).unwrap();
239
240
241 cmd_bufs.push(
242 builder.command_buffer()
243 );
244
245 i += 1;
246 }
247
248 cmd_bufs
249}Sourcepub fn next_subpass(
&mut self,
subpass_end_info: SubpassEndInfo,
subpass_begin_info: SubpassBeginInfo,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn next_subpass( &mut self, subpass_end_info: SubpassEndInfo, subpass_begin_info: SubpassBeginInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn end_render_pass( &mut self, subpass_end_info: SubpassEndInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
Ends the render pass previously begun with begin_render_pass.
This must be called after you went through all the subpasses.
Examples found in repository?
165pub fn get_cmd_bufs(
166 vk: Arc<Vk>,
167 renderer: &Renderer,
168 imgui_renderer: &mut ImGui,
169 presenter: &Presenter,
170 pipeline: Arc<GraphicsPipeline>,
171) -> Vec<CommandBufferType> {
172 let mut cmd_bufs: Vec<CommandBufferType> = vec![];
173
174 let ubo = VkBuffer::uniform(vk.allocators.clone(), vs::Camera {
175 view: renderer.camera.get_view(),
176 proj: renderer.camera.get_proj(),
177 });
178
179 let camera_desc_set = descriptor_set(
180 vk.clone(),
181 0,
182 pipeline.clone(),
183 [WriteDescriptorSet::buffer(0, ubo.content.clone())]
184 ).0;
185
186 let render_passes = imgui_renderer.get_renderpasses(
187 presenter.images.clone(),
188 vk.clone()
189 );
190
191 let mut i = 0;
192 for framebuffer in &presenter.framebuffers.clone() {
193 let mut builder = VkBuilder::new_multiple(vk.clone());
194
195 builder.0
196 .begin_render_pass(
197 RenderPassBeginInfo {
198 clear_values: vec![Some([0.1, 0.2, 0.3, 1.0].into()), Some(1.0.into())],
199 ..RenderPassBeginInfo::framebuffer(framebuffer.clone())
200 },
201 SubpassBeginInfo {
202 contents: SubpassContents::Inline,
203 ..Default::default()
204 },
205 )
206 .unwrap()
207 .bind_pipeline_graphics(pipeline.clone())
208 .unwrap()
209 .bind_descriptor_sets(
210 vulkano::pipeline::PipelineBindPoint::Graphics,
211 pipeline.layout().clone(),
212 0,
213 camera_desc_set.clone(),
214 )
215 .unwrap();
216
217 for mesh in &renderer.meshes {
218 mesh.build_commands(vk.clone(), &mut builder.0, pipeline.clone());
219 }
220
221 builder.0.end_render_pass(Default::default()).unwrap();
222
223 let render_pass = &render_passes[i];
224 builder.0.begin_render_pass(
225 RenderPassBeginInfo {
226 clear_values: vec![None],
227 render_pass: render_pass.rp.clone(),
228 ..RenderPassBeginInfo::framebuffer(render_pass.framebuffer.clone())
229 },
230 SubpassBeginInfo {
231 contents: SubpassContents::SecondaryCommandBuffers,
232 ..Default::default()
233 },
234 ).expect(&format!("failed to start imgui render pass on framebuffer {:?}", framebuffer));
235
236 builder.0.execute_commands(render_pass.cmd_buf.clone()).unwrap();
237
238 builder.0.end_render_pass(Default::default()).unwrap();
239
240
241 cmd_bufs.push(
242 builder.command_buffer()
243 );
244
245 i += 1;
246 }
247
248 cmd_bufs
249}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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn begin_rendering( &mut self, rendering_info: RenderingInfo, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn end_rendering( &mut self, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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 AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn clear_attachments( &mut self, attachments: SmallVec<[ClearAttachment; 4]>, rects: SmallVec<[ClearRect; 4]>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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,
§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.
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<Handle = CommandBuffer>>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn execute_commands( &mut self, command_buffer: Arc<dyn SecondaryCommandBufferAbstract<Handle = CommandBuffer>>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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.
Examples found in repository?
165pub fn get_cmd_bufs(
166 vk: Arc<Vk>,
167 renderer: &Renderer,
168 imgui_renderer: &mut ImGui,
169 presenter: &Presenter,
170 pipeline: Arc<GraphicsPipeline>,
171) -> Vec<CommandBufferType> {
172 let mut cmd_bufs: Vec<CommandBufferType> = vec![];
173
174 let ubo = VkBuffer::uniform(vk.allocators.clone(), vs::Camera {
175 view: renderer.camera.get_view(),
176 proj: renderer.camera.get_proj(),
177 });
178
179 let camera_desc_set = descriptor_set(
180 vk.clone(),
181 0,
182 pipeline.clone(),
183 [WriteDescriptorSet::buffer(0, ubo.content.clone())]
184 ).0;
185
186 let render_passes = imgui_renderer.get_renderpasses(
187 presenter.images.clone(),
188 vk.clone()
189 );
190
191 let mut i = 0;
192 for framebuffer in &presenter.framebuffers.clone() {
193 let mut builder = VkBuilder::new_multiple(vk.clone());
194
195 builder.0
196 .begin_render_pass(
197 RenderPassBeginInfo {
198 clear_values: vec![Some([0.1, 0.2, 0.3, 1.0].into()), Some(1.0.into())],
199 ..RenderPassBeginInfo::framebuffer(framebuffer.clone())
200 },
201 SubpassBeginInfo {
202 contents: SubpassContents::Inline,
203 ..Default::default()
204 },
205 )
206 .unwrap()
207 .bind_pipeline_graphics(pipeline.clone())
208 .unwrap()
209 .bind_descriptor_sets(
210 vulkano::pipeline::PipelineBindPoint::Graphics,
211 pipeline.layout().clone(),
212 0,
213 camera_desc_set.clone(),
214 )
215 .unwrap();
216
217 for mesh in &renderer.meshes {
218 mesh.build_commands(vk.clone(), &mut builder.0, pipeline.clone());
219 }
220
221 builder.0.end_render_pass(Default::default()).unwrap();
222
223 let render_pass = &render_passes[i];
224 builder.0.begin_render_pass(
225 RenderPassBeginInfo {
226 clear_values: vec![None],
227 render_pass: render_pass.rp.clone(),
228 ..RenderPassBeginInfo::framebuffer(render_pass.framebuffer.clone())
229 },
230 SubpassBeginInfo {
231 contents: SubpassContents::SecondaryCommandBuffers,
232 ..Default::default()
233 },
234 ).expect(&format!("failed to start imgui render pass on framebuffer {:?}", framebuffer));
235
236 builder.0.execute_commands(render_pass.cmd_buf.clone()).unwrap();
237
238 builder.0.end_render_pass(Default::default()).unwrap();
239
240
241 cmd_bufs.push(
242 builder.command_buffer()
243 );
244
245 i += 1;
246 }
247
248 cmd_bufs
249}Sourcepub fn execute_commands_from_vec(
&mut self,
command_buffers: Vec<Arc<dyn SecondaryCommandBufferAbstract<Handle = CommandBuffer>>>,
) -> Result<&mut AutoCommandBufferBuilder<L, A>, Box<ValidationError>>
pub fn execute_commands_from_vec( &mut self, command_buffers: Vec<Arc<dyn SecondaryCommandBufferAbstract<Handle = CommandBuffer>>>, ) -> Result<&mut AutoCommandBufferBuilder<L, A>, 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.