This commit is contained in:
marc0246 2024-10-18 20:00:21 +02:00 committed by GitHub
parent 552caad394
commit 5749fef53c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
63 changed files with 527 additions and 681 deletions

View File

@ -8,8 +8,7 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -196,14 +195,10 @@ fn main() {
.unwrap();
// In order to execute our operation, we have to build a command buffer.
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -11,8 +11,8 @@ use vulkano::{
BufferContents, BufferUsage,
},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
@ -419,14 +419,10 @@ impl ApplicationHandler for App {
.unwrap();
buffer.write().unwrap().copy_from_slice(&data);
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -1,9 +1,8 @@
use std::{error::Error, sync::Arc};
use vulkano::{
command_buffer::{
allocator::StandardCommandBufferAllocator, ClearAttachment, ClearRect,
CommandBufferBeginInfo, CommandBufferLevel, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, ClearAttachment, ClearRect, CommandBufferUsage,
RecordingCommandBuffer, RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
@ -265,14 +264,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
builder

View File

@ -3,9 +3,8 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBuffer, CommandBufferBeginInfo,
CommandBufferInheritanceInfo, CommandBufferLevel, CommandBufferUsage,
RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferInheritanceInfo,
CommandBufferUsage, RecordingCommandBuffer, SecondaryAutoCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -158,7 +157,7 @@ impl AmbientLightingSystem {
viewport_dimensions: [u32; 2],
color_input: Arc<ImageView>,
ambient_color: [f32; 3],
) -> Arc<CommandBuffer> {
) -> Arc<SecondaryAutoCommandBuffer> {
let push_constants = fs::PushConstants {
color: [ambient_color[0], ambient_color[1], ambient_color[2], 1.0],
};
@ -178,16 +177,12 @@ impl AmbientLightingSystem {
depth_range: 0.0..=1.0,
};
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::secondary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
inheritance_info: Some(CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
}),
CommandBufferUsage::MultipleSubmit,
CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
},
)

View File

@ -4,9 +4,8 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBuffer, CommandBufferBeginInfo,
CommandBufferInheritanceInfo, CommandBufferLevel, CommandBufferUsage,
RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferInheritanceInfo,
CommandBufferUsage, RecordingCommandBuffer, SecondaryAutoCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -168,7 +167,7 @@ impl DirectionalLightingSystem {
normals_input: Arc<ImageView>,
direction: Vec3,
color: [f32; 3],
) -> Arc<CommandBuffer> {
) -> Arc<SecondaryAutoCommandBuffer> {
let push_constants = fs::PushConstants {
color: [color[0], color[1], color[2], 1.0],
direction: direction.extend(0.0).into(),
@ -192,16 +191,12 @@ impl DirectionalLightingSystem {
depth_range: 0.0..=1.0,
};
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::secondary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
inheritance_info: Some(CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
}),
CommandBufferUsage::MultipleSubmit,
CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
},
)

View File

@ -4,9 +4,8 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBuffer, CommandBufferBeginInfo,
CommandBufferInheritanceInfo, CommandBufferLevel, CommandBufferUsage,
RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferInheritanceInfo,
CommandBufferUsage, RecordingCommandBuffer, SecondaryAutoCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -179,7 +178,7 @@ impl PointLightingSystem {
screen_to_world: Mat4,
position: Vec3,
color: [f32; 3],
) -> Arc<CommandBuffer> {
) -> Arc<SecondaryAutoCommandBuffer> {
let push_constants = fs::PushConstants {
screen_to_world: screen_to_world.to_cols_array_2d(),
color: [color[0], color[1], color[2], 1.0],
@ -205,16 +204,12 @@ impl PointLightingSystem {
depth_range: 0.0..=1.0,
};
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::secondary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
inheritance_info: Some(CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
}),
CommandBufferUsage::MultipleSubmit,
CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
},
)

View File

@ -7,9 +7,9 @@ use glam::f32::{Mat4, Vec3};
use std::sync::Arc;
use vulkano::{
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBuffer, CommandBufferBeginInfo,
CommandBufferLevel, CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
SubpassBeginInfo, SubpassContents,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, PrimaryAutoCommandBuffer,
RecordingCommandBuffer, RenderPassBeginInfo, SecondaryAutoCommandBuffer, SubpassBeginInfo,
SubpassContents,
},
descriptor_set::allocator::StandardDescriptorSetAllocator,
device::Queue,
@ -338,14 +338,10 @@ impl FrameSystem {
.unwrap();
// Start the command buffer builder that will be filled throughout the frame handling.
let mut command_buffer_builder = RecordingCommandBuffer::new(
let mut command_buffer_builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
command_buffer_builder
@ -398,7 +394,7 @@ pub struct Frame<'a> {
// Framebuffer that was used when starting the render pass.
framebuffer: Arc<Framebuffer>,
// The command buffer builder that will be built during the lifetime of this object.
command_buffer_builder: Option<RecordingCommandBuffer>,
command_buffer_builder: Option<RecordingCommandBuffer<PrimaryAutoCommandBuffer>>,
// Matrix that was passed to `frame()`.
world_to_framebuffer: Mat4,
}
@ -490,7 +486,7 @@ pub struct DrawPass<'f, 's: 'f> {
impl<'f, 's: 'f> DrawPass<'f, 's> {
/// Appends a command that executes a secondary command buffer that performs drawing.
pub fn execute(&mut self, command_buffer: Arc<CommandBuffer>) {
pub fn execute(&mut self, command_buffer: Arc<SecondaryAutoCommandBuffer>) {
self.frame
.command_buffer_builder
.as_mut()

View File

@ -2,9 +2,8 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBuffer, CommandBufferBeginInfo,
CommandBufferInheritanceInfo, CommandBufferLevel, CommandBufferUsage,
RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferInheritanceInfo,
CommandBufferUsage, RecordingCommandBuffer, SecondaryAutoCommandBuffer,
},
device::Queue,
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter, StandardMemoryAllocator},
@ -126,17 +125,13 @@ impl TriangleDrawSystem {
}
/// Builds a secondary command buffer that draws the triangle on the current subpass.
pub fn draw(&self, viewport_dimensions: [u32; 2]) -> Arc<CommandBuffer> {
let mut builder = RecordingCommandBuffer::new(
pub fn draw(&self, viewport_dimensions: [u32; 2]) -> Arc<SecondaryAutoCommandBuffer> {
let mut builder = RecordingCommandBuffer::secondary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
inheritance_info: Some(CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
}),
CommandBufferUsage::MultipleSubmit,
CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
},
)

View File

@ -8,8 +8,7 @@ use std::{iter::repeat, mem::size_of, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, layout::DescriptorType, DescriptorBufferInfo,
@ -238,14 +237,10 @@ fn main() {
.unwrap();
// Build the command buffer, using different offsets for each call.
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -8,8 +8,8 @@ use std::{fs::File, io::BufWriter, path::Path, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyImageToBufferInfo, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyImageToBufferInfo,
RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -249,14 +249,10 @@ fn main() {
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -20,9 +20,8 @@ mod linux {
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo, SemaphoreSubmitInfo,
SubmitInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo, SemaphoreSubmitInfo, SubmitInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -703,14 +702,10 @@ mod linux {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -3,9 +3,8 @@ use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, BlitImageInfo, BufferImageCopy,
ClearColorImageInfo, CommandBufferBeginInfo, CommandBufferLevel, CommandBufferUsage,
CopyBufferToImageInfo, CopyImageInfo, ImageBlit, ImageCopy, RecordingCommandBuffer,
RenderPassBeginInfo,
ClearColorImageInfo, CommandBufferUsage, CopyBufferToImageInfo, CopyImageInfo, ImageBlit,
ImageCopy, RecordingCommandBuffer, RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -186,14 +185,10 @@ impl App {
)
.unwrap();
let mut uploads = RecordingCommandBuffer::new(
let mut uploads = RecordingCommandBuffer::primary(
command_buffer_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -528,14 +523,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -2,8 +2,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyBufferToImageInfo, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyBufferToImageInfo,
RecordingCommandBuffer, RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -183,14 +183,10 @@ impl App {
)
.unwrap();
let mut uploads = RecordingCommandBuffer::new(
let mut uploads = RecordingCommandBuffer::primary(
command_buffer_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -471,14 +467,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -11,8 +11,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyBufferToImageInfo, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyBufferToImageInfo,
RecordingCommandBuffer, RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -189,14 +189,10 @@ impl App {
)
.unwrap();
let mut uploads = RecordingCommandBuffer::new(
let mut uploads = RecordingCommandBuffer::primary(
command_buffer_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -490,14 +486,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -21,8 +21,8 @@ use vulkano::{
BufferContents, BufferUsage,
},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, DrawIndirectCommand, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, DrawIndirectCommand,
RecordingCommandBuffer, RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -522,14 +522,10 @@ impl ApplicationHandler for App {
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -7,8 +7,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
@ -442,14 +442,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -4,8 +4,7 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -147,14 +146,10 @@ impl FractalComputePipeline {
[],
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -1,9 +1,8 @@
use std::sync::Arc;
use vulkano::{
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBuffer, CommandBufferBeginInfo,
CommandBufferInheritanceInfo, CommandBufferLevel, CommandBufferUsage,
RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferInheritanceInfo,
CommandBufferUsage, RecordingCommandBuffer, SecondaryAutoCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -126,17 +125,17 @@ impl PixelsDrawPipeline {
}
/// Draws input `image` over a quad of size -1.0 to 1.0.
pub fn draw(&self, viewport_dimensions: [u32; 2], image: Arc<ImageView>) -> Arc<CommandBuffer> {
let mut builder = RecordingCommandBuffer::new(
pub fn draw(
&self,
viewport_dimensions: [u32; 2],
image: Arc<ImageView>,
) -> Arc<SecondaryAutoCommandBuffer> {
let mut builder = RecordingCommandBuffer::secondary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
inheritance_info: Some(CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
}),
CommandBufferUsage::MultipleSubmit,
CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
},
)

View File

@ -2,9 +2,8 @@ use crate::pixels_draw_pipeline::PixelsDrawPipeline;
use std::sync::Arc;
use vulkano::{
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo, SubpassBeginInfo,
SubpassContents,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo, SubpassBeginInfo, SubpassContents,
},
descriptor_set::allocator::StandardDescriptorSetAllocator,
device::Queue,
@ -80,14 +79,10 @@ impl RenderPassPlaceOverFrame {
let img_dims: [u32; 2] = target.image().extent()[0..2].try_into().unwrap();
// Create primary command buffer builder.
let mut command_buffer_builder = RecordingCommandBuffer::new(
let mut command_buffer_builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -17,8 +17,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -446,14 +446,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -57,8 +57,8 @@ use std::{fs::File, io::BufWriter, path::Path, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyImageToBufferInfo, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyImageToBufferInfo,
RecordingCommandBuffer, RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, QueueCreateInfo,
@ -379,14 +379,10 @@ fn main() {
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -5,8 +5,8 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, PrimaryAutoCommandBuffer,
RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -130,14 +130,10 @@ impl GameOfLifeComputePipeline {
life_color: [f32; 4],
dead_color: [f32; 4],
) -> Box<dyn GpuFuture> {
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.compute_queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -167,7 +163,7 @@ impl GameOfLifeComputePipeline {
/// Builds the command for a dispatch.
fn dispatch(
&self,
builder: &mut RecordingCommandBuffer,
builder: &mut RecordingCommandBuffer<PrimaryAutoCommandBuffer>,
life_color: [f32; 4],
dead_color: [f32; 4],
// Step determines whether we color or compute life (see branch in the shader)s.

View File

@ -2,9 +2,8 @@ use crate::App;
use std::sync::Arc;
use vulkano::{
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBuffer, CommandBufferBeginInfo,
CommandBufferInheritanceInfo, CommandBufferLevel, CommandBufferUsage,
RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferInheritanceInfo,
CommandBufferUsage, RecordingCommandBuffer, SecondaryAutoCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -122,17 +121,17 @@ impl PixelsDrawPipeline {
}
/// Draws input `image` over a quad of size -1.0 to 1.0.
pub fn draw(&self, viewport_dimensions: [u32; 2], image: Arc<ImageView>) -> Arc<CommandBuffer> {
let mut builder = RecordingCommandBuffer::new(
pub fn draw(
&self,
viewport_dimensions: [u32; 2],
image: Arc<ImageView>,
) -> Arc<SecondaryAutoCommandBuffer> {
let mut builder = RecordingCommandBuffer::secondary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
inheritance_info: Some(CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
}),
CommandBufferUsage::MultipleSubmit,
CommandBufferInheritanceInfo {
render_pass: Some(self.subpass.clone().into()),
..Default::default()
},
)

View File

@ -2,9 +2,8 @@ use crate::{pixels_draw::PixelsDrawPipeline, App};
use std::sync::Arc;
use vulkano::{
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo, SubpassBeginInfo,
SubpassContents,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo, SubpassBeginInfo, SubpassContents,
},
device::Queue,
image::view::ImageView,
@ -69,14 +68,10 @@ impl RenderPassPlaceOverFrame {
let img_dims: [u32; 2] = target.image().extent()[0..2].try_into().unwrap();
// Create a primary command buffer builder.
let mut command_buffer_builder = RecordingCommandBuffer::new(
let mut command_buffer_builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.gfx_queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -11,8 +11,8 @@ use std::{collections::HashMap, error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
@ -422,14 +422,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -7,9 +7,8 @@ use std::{fs::File, io::BufWriter, path::Path, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, BufferImageCopy, CommandBufferBeginInfo,
CommandBufferLevel, CommandBufferUsage, CopyImageToBufferInfo, RecordingCommandBuffer,
RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, BufferImageCopy, CommandBufferUsage,
CopyImageToBufferInfo, RecordingCommandBuffer, RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures,
@ -329,14 +328,10 @@ fn main() {
let buffer1 = create_buffer();
let buffer2 = create_buffer();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -6,8 +6,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
@ -478,14 +478,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -5,9 +5,8 @@ use std::{default::Default, fs::File, io::BufWriter, path::Path, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyImageToBufferInfo, RecordingCommandBuffer, RenderPassBeginInfo,
SubpassBeginInfo, SubpassContents,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyImageToBufferInfo,
RecordingCommandBuffer, RenderPassBeginInfo, SubpassBeginInfo, SubpassContents,
},
device::{physical::PhysicalDeviceType, Device, DeviceCreateInfo, QueueCreateInfo, QueueFlags},
format::Format,
@ -274,14 +273,10 @@ fn main() {
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -7,8 +7,7 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -181,14 +180,10 @@ fn main() {
//
// Note that there is no type safety for the push constant data, so be careful to only pass an
// instance of the struct generated by the `vulkano_shaders::shaders!` macro.
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -2,8 +2,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyBufferToImageInfo, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyBufferToImageInfo,
RecordingCommandBuffer, RenderPassBeginInfo,
},
descriptor_set::{layout::DescriptorSetLayoutCreateFlags, WriteDescriptorSet},
device::{
@ -173,14 +173,10 @@ impl App {
)
.unwrap();
let mut uploads = RecordingCommandBuffer::new(
let mut uploads = RecordingCommandBuffer::primary(
command_buffer_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -456,14 +452,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -2,8 +2,8 @@ use std::{error::Error, io::Cursor, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyBufferToImageInfo, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyBufferToImageInfo,
RecordingCommandBuffer, RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, layout::DescriptorBindingFlags, DescriptorSet,
@ -241,14 +241,10 @@ impl App {
)
.unwrap();
let mut uploads = RecordingCommandBuffer::new(
let mut uploads = RecordingCommandBuffer::primary(
command_buffer_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -598,14 +594,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -16,8 +16,8 @@ use std::{error::Error, fs::File, io::Read, path::Path, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
@ -390,14 +390,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
..Default::default()
},
CommandBufferUsage::MultipleSubmit,
)
.unwrap();

View File

@ -6,8 +6,8 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, BufferCopy, CommandBufferBeginInfo,
CommandBufferLevel, CommandBufferUsage, CopyBufferInfoTyped, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, BufferCopy, CommandBufferUsage,
CopyBufferInfoTyped, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -162,14 +162,10 @@ fn main() {
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -6,8 +6,7 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -167,14 +166,10 @@ fn main() {
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -20,8 +20,7 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -193,14 +192,10 @@ fn main() {
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -7,8 +7,8 @@ use std::{error::Error, sync::Arc, time::SystemTime};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyBufferInfo, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyBufferInfo,
RecordingCommandBuffer, RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -210,14 +210,10 @@ impl App {
.unwrap();
// Create one-time command to copy between the buffers.
let mut cbb = RecordingCommandBuffer::new(
let mut cbb = RecordingCommandBuffer::primary(
command_buffer_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
cbb.copy_buffer(CopyBufferInfo::buffers(
@ -542,14 +538,10 @@ impl ApplicationHandler for App {
"not handling sub-optimal swapchains in this sample code",
);
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -4,8 +4,7 @@ use std::sync::Arc;
use vulkano::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferLevel, CommandBufferUsage,
RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -170,14 +169,10 @@ fn main() {
)
.unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
command_buffer_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
vulkano::command_buffer::CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -10,8 +10,8 @@ use vulkano::{
Buffer, BufferCreateInfo, BufferUsage, Subbuffer,
},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -444,14 +444,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -16,8 +16,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures,
@ -417,14 +417,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -2,8 +2,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, CopyBufferToImageInfo, RecordingCommandBuffer, RenderPassBeginInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, CopyBufferToImageInfo,
RecordingCommandBuffer, RenderPassBeginInfo,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -186,14 +186,10 @@ impl App {
)
.unwrap();
let mut uploads = RecordingCommandBuffer::new(
let mut uploads = RecordingCommandBuffer::primary(
command_buffer_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -484,14 +480,10 @@ impl ApplicationHandler for App {
rcx.recreate_swapchain = true;
}
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -11,9 +11,8 @@ use std::{error::Error, sync::Arc, time::Duration};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo, SubpassBeginInfo,
SubpassContents,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo, SubpassBeginInfo, SubpassContents,
},
image::view::ImageView,
memory::allocator::{AllocationCreateInfo, MemoryTypeFilter},
@ -382,14 +381,10 @@ impl ApplicationHandler for App {
//
// Note that we have to pass a queue family when we create the command buffer. The
// command buffer will only be executable on that given queue family.
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.context.graphics_queue().queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -16,8 +16,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderingAttachmentInfo, RenderingInfo,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderingAttachmentInfo, RenderingInfo,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures,
@ -644,14 +644,10 @@ impl ApplicationHandler for App {
//
// Note that we have to pass a queue family when we create the command buffer. The
// command buffer will only be executable on that given queue family.
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -11,9 +11,8 @@ use std::{error::Error, sync::Arc};
use vulkano::{
buffer::{Buffer, BufferContents, BufferCreateInfo, BufferUsage, Subbuffer},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer, RenderPassBeginInfo, SubpassBeginInfo,
SubpassContents,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
RenderPassBeginInfo, SubpassBeginInfo, SubpassContents,
},
device::{
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, Queue,
@ -649,14 +648,10 @@ impl ApplicationHandler for App {
//
// Note that we have to pass a queue family when we create the command buffer. The
// command buffer will only be executable on that given queue family.
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
self.command_buffer_allocator.clone(),
self.queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -21,8 +21,8 @@ use std::{
use vulkano::{
buffer::{Buffer, BufferMemory},
command_buffer::{
sys::{RawCommandBuffer, RawRecordingCommandBuffer},
CommandBufferBeginInfo, CommandBufferLevel, CommandBufferUsage,
sys::{CommandBufferBeginInfo, RawCommandBuffer, RawRecordingCommandBuffer},
CommandBufferLevel, CommandBufferUsage,
},
device::{Device, DeviceOwned, Queue},
image::Image,

View File

@ -78,9 +78,7 @@ const MAX_ARENAS: usize = 32;
/// allocator::{SubbufferAllocator, SubbufferAllocatorCreateInfo},
/// BufferUsage,
/// },
/// command_buffer::{
/// CommandBufferBeginInfo, CommandBufferLevel, CommandBufferUsage, RecordingCommandBuffer,
/// },
/// command_buffer::{CommandBufferUsage, RecordingCommandBuffer},
/// memory::allocator::MemoryTypeFilter,
/// sync::GpuFuture,
/// };
@ -107,14 +105,10 @@ const MAX_ARENAS: usize = 32;
/// *subbuffer.write().unwrap() = data;
///
/// // You can then use `subbuffer` as if it was an entirely separate buffer.
/// RecordingCommandBuffer::new(
/// RecordingCommandBuffer::primary(
/// command_buffer_allocator.clone(),
/// queue.queue_family_index(),
/// CommandBufferLevel::Primary,
/// CommandBufferBeginInfo {
/// usage: CommandBufferUsage::OneTimeSubmit,
/// ..Default::default()
/// },
/// CommandBufferUsage::OneTimeSubmit,
/// )
/// .unwrap()
/// // For the sake of the example we just call `update_buffer` on the buffer, even though

View File

@ -120,10 +120,7 @@ pub mod view;
/// ```
/// use vulkano::{
/// buffer::{BufferUsage, Buffer, BufferCreateInfo},
/// command_buffer::{
/// CommandBufferBeginInfo, CommandBufferLevel, CommandBufferUsage, CopyBufferInfo,
/// RecordingCommandBuffer,
/// },
/// command_buffer::{CommandBufferUsage, CopyBufferInfo, RecordingCommandBuffer},
/// memory::allocator::{AllocationCreateInfo, MemoryTypeFilter},
/// sync::GpuFuture,
/// DeviceSize,
@ -173,14 +170,10 @@ pub mod view;
/// .unwrap();
///
/// // Create a one-time command to copy between the buffers.
/// let mut cbb = RecordingCommandBuffer::new(
/// let mut cbb = RecordingCommandBuffer::primary(
/// command_buffer_allocator.clone(),
/// queue.queue_family_index(),
/// CommandBufferLevel::Primary,
/// CommandBufferBeginInfo {
/// usage: CommandBufferUsage::OneTimeSubmit,
/// ..Default::default()
/// },
/// CommandBufferUsage::OneTimeSubmit,
/// )
/// .unwrap();
/// cbb.copy_buffer(CopyBufferInfo::buffers(

View File

@ -1,11 +1,12 @@
use super::{
CommandBuffer, CommandInfo, RenderPassCommand, Resource, ResourceUseRef2, SubmitState,
CommandInfo, PrimaryAutoCommandBuffer, RenderPassCommand, Resource, ResourceUseRef2,
SecondaryAutoCommandBuffer, SubmitState,
};
use crate::{
buffer::{Buffer, IndexBuffer, Subbuffer},
command_buffer::{
allocator::CommandBufferAllocator,
sys::{CommandBufferBeginInfo, RawRecordingCommandBuffer},
sys::{CommandBufferBeginInfo, RawCommandBuffer, RawRecordingCommandBuffer},
CommandBufferBufferRangeUsage, CommandBufferBufferUsage, CommandBufferImageRangeUsage,
CommandBufferImageUsage, CommandBufferInheritanceInfo,
CommandBufferInheritanceRenderPassType, CommandBufferLevel, CommandBufferResourcesUsage,
@ -45,6 +46,7 @@ use smallvec::SmallVec;
use std::{
collections::hash_map::Entry,
fmt::Debug,
marker::PhantomData,
mem::take,
ops::{Range, RangeInclusive},
sync::{atomic::AtomicBool, Arc},
@ -57,24 +59,151 @@ use std::{
///
/// Note that command buffers in the recording state don't implement the `Send` and `Sync` traits.
/// Once a command buffer has finished recording, however, it *does* implement `Send` and `Sync`.
pub struct RecordingCommandBuffer {
pub struct RecordingCommandBuffer<L> {
pub(in crate::command_buffer) inner: RawRecordingCommandBuffer,
commands: Vec<(
CommandInfo,
Box<dyn Fn(&mut RawRecordingCommandBuffer) + Send + Sync + 'static>,
)>,
pub(in crate::command_buffer) builder_state: CommandBufferBuilderState,
marker: PhantomData<fn() -> L>,
}
impl RecordingCommandBuffer {
/// Allocates and begins recording a new command buffer.
impl RecordingCommandBuffer<PrimaryAutoCommandBuffer> {
/// Allocates and begins recording a new primary command buffer.
#[inline]
pub fn new(
pub fn primary(
allocator: Arc<dyn CommandBufferAllocator>,
queue_family_index: u32,
usage: CommandBufferUsage,
) -> Result<RecordingCommandBuffer<PrimaryAutoCommandBuffer>, Validated<VulkanError>> {
unsafe {
Self::new(
allocator,
queue_family_index,
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage,
inheritance_info: None,
_ne: crate::NonExhaustive(()),
},
)
}
}
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
#[inline]
pub unsafe fn primary_unchecked(
allocator: Arc<dyn CommandBufferAllocator>,
queue_family_index: u32,
usage: CommandBufferUsage,
) -> Result<RecordingCommandBuffer<PrimaryAutoCommandBuffer>, Validated<VulkanError>> {
unsafe {
Self::new_unchecked(
allocator,
queue_family_index,
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage,
inheritance_info: None,
_ne: crate::NonExhaustive(()),
},
)
}
}
/// Ends the recording, returning a command buffer which can be submitted.
pub fn end(self) -> Result<Arc<PrimaryAutoCommandBuffer>, Validated<VulkanError>> {
self.validate_end()?;
let (inner, keep_alive_objects, resources_usage, _) = unsafe { self.end_unchecked()? };
Ok(Arc::new(PrimaryAutoCommandBuffer {
inner,
_keep_alive_objects: keep_alive_objects,
resources_usage,
state: Mutex::new(Default::default()),
}))
}
}
impl RecordingCommandBuffer<SecondaryAutoCommandBuffer> {
/// Allocates and begins recording a new secondary command buffer.
#[inline]
pub fn secondary(
allocator: Arc<dyn CommandBufferAllocator>,
queue_family_index: u32,
usage: CommandBufferUsage,
inheritance_info: CommandBufferInheritanceInfo,
) -> Result<RecordingCommandBuffer<SecondaryAutoCommandBuffer>, Validated<VulkanError>> {
unsafe {
Self::new(
allocator,
queue_family_index,
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage,
inheritance_info: Some(inheritance_info),
_ne: crate::NonExhaustive(()),
},
)
}
}
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
#[inline]
pub unsafe fn secondary_unchecked(
allocator: Arc<dyn CommandBufferAllocator>,
queue_family_index: u32,
usage: CommandBufferUsage,
inheritance_info: CommandBufferInheritanceInfo,
) -> Result<RecordingCommandBuffer<SecondaryAutoCommandBuffer>, Validated<VulkanError>> {
unsafe {
Self::new_unchecked(
allocator,
queue_family_index,
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage,
inheritance_info: Some(inheritance_info),
_ne: crate::NonExhaustive(()),
},
)
}
}
/// Ends the recording, returning a command buffer which can be submitted.
pub fn end(self) -> Result<Arc<SecondaryAutoCommandBuffer>, Validated<VulkanError>> {
self.validate_end()?;
let (inner, keep_alive_objects, _, resources_usage) = unsafe { self.end_unchecked()? };
let submit_state = match inner.usage() {
CommandBufferUsage::MultipleSubmit => SubmitState::ExclusiveUse {
in_use: AtomicBool::new(false),
},
CommandBufferUsage::SimultaneousUse => SubmitState::Concurrent,
CommandBufferUsage::OneTimeSubmit => SubmitState::OneTime {
already_submitted: AtomicBool::new(false),
},
};
Ok(Arc::new(SecondaryAutoCommandBuffer {
inner,
_keep_alive_objects: keep_alive_objects,
resources_usage,
submit_state,
}))
}
}
impl<L> RecordingCommandBuffer<L> {
unsafe fn new(
allocator: Arc<dyn CommandBufferAllocator>,
queue_family_index: u32,
level: CommandBufferLevel,
begin_info: CommandBufferBeginInfo,
) -> Result<RecordingCommandBuffer, Validated<VulkanError>> {
) -> Result<Self, Validated<VulkanError>> {
Self::validate_new(allocator.device(), queue_family_index, level, &begin_info)?;
unsafe { Self::new_unchecked(allocator, queue_family_index, level, begin_info) }
@ -91,8 +220,7 @@ impl RecordingCommandBuffer {
Ok(())
}
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
pub unsafe fn new_unchecked(
unsafe fn new_unchecked(
allocator: Arc<dyn CommandBufferAllocator>,
queue_family_index: u32,
level: CommandBufferLevel,
@ -130,19 +258,14 @@ impl RecordingCommandBuffer {
inner,
commands: Vec::new(),
builder_state,
marker: PhantomData,
})
}
/// Ends the recording, returning a command buffer which can be submitted.
#[inline]
pub fn end(self) -> Result<Arc<CommandBuffer>, Validated<VulkanError>> {
self.validate_end()?;
unsafe { self.end_unchecked() }
}
fn validate_end(&self) -> Result<(), Box<ValidationError>> {
if self.level() == CommandBufferLevel::Primary && self.builder_state.render_pass.is_some() {
if self.inner.level() == CommandBufferLevel::Primary
&& self.builder_state.render_pass.is_some()
{
return Err(Box::new(ValidationError {
problem: "a render pass instance is still active".into(),
vuids: &["VUID-vkEndCommandBuffer-commandBuffer-00060"],
@ -164,8 +287,17 @@ impl RecordingCommandBuffer {
Ok(())
}
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
pub unsafe fn end_unchecked(mut self) -> Result<Arc<CommandBuffer>, Validated<VulkanError>> {
unsafe fn end_unchecked(
mut self,
) -> Result<
(
RawCommandBuffer,
Vec<Box<dyn Fn(&mut RawRecordingCommandBuffer) + Send + Sync + 'static>>,
CommandBufferResourcesUsage,
SecondaryCommandBufferResourcesUsage,
),
Validated<VulkanError>,
> {
let mut auto_sync_state = AutoSyncState::new(
self.device().clone(),
self.inner.level(),
@ -230,28 +362,15 @@ impl RecordingCommandBuffer {
debug_assert!(barriers.is_empty());
let submit_state = match self.inner.usage() {
CommandBufferUsage::MultipleSubmit => SubmitState::ExclusiveUse {
in_use: AtomicBool::new(false),
},
CommandBufferUsage::SimultaneousUse => SubmitState::Concurrent,
CommandBufferUsage::OneTimeSubmit => SubmitState::OneTime {
already_submitted: AtomicBool::new(false),
},
};
Ok(Arc::new(CommandBuffer {
inner: self.inner.end()?,
_keep_alive_objects: self
.commands
Ok((
self.inner.end()?,
self.commands
.into_iter()
.map(|(_, record_func)| record_func)
.collect(),
resources_usage,
secondary_resources_usage,
state: Mutex::new(Default::default()),
submit_state,
}))
))
}
/// Returns the level of the command buffer.
@ -261,7 +380,7 @@ impl RecordingCommandBuffer {
}
}
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
pub(in crate::command_buffer) fn add_command(
&mut self,
name: &'static str,
@ -311,7 +430,7 @@ impl RecordingCommandBuffer {
}
}
unsafe impl DeviceOwned for RecordingCommandBuffer {
unsafe impl<L> DeviceOwned for RecordingCommandBuffer<L> {
#[inline]
fn device(&self) -> &Arc<Device> {
self.inner.device()

View File

@ -64,9 +64,9 @@ pub(in crate::command_buffer) use self::builder::{
};
use super::{
sys::{RawCommandBuffer, RawRecordingCommandBuffer},
CommandBufferInheritanceInfo, CommandBufferLevel, CommandBufferResourcesUsage,
CommandBufferState, CommandBufferUsage, ResourceInCommand,
SecondaryCommandBufferResourcesUsage, SecondaryResourceUseRef,
CommandBufferInheritanceInfo, CommandBufferResourcesUsage, CommandBufferState,
CommandBufferUsage, ResourceInCommand, SecondaryCommandBufferResourcesUsage,
SecondaryResourceUseRef,
};
use crate::{
buffer::Subbuffer,
@ -87,17 +87,14 @@ use std::{
mod builder;
pub struct CommandBuffer {
pub struct PrimaryAutoCommandBuffer {
inner: RawCommandBuffer,
// TODO: Remove all of this.
_keep_alive_objects: Vec<Box<dyn Fn(&mut RawRecordingCommandBuffer) + Send + Sync + 'static>>,
resources_usage: CommandBufferResourcesUsage,
secondary_resources_usage: SecondaryCommandBufferResourcesUsage,
state: Mutex<CommandBufferState>,
submit_state: SubmitState,
}
unsafe impl VulkanObject for CommandBuffer {
unsafe impl VulkanObject for PrimaryAutoCommandBuffer {
type Handle = ash::vk::CommandBuffer;
#[inline]
@ -106,22 +103,22 @@ unsafe impl VulkanObject for CommandBuffer {
}
}
unsafe impl DeviceOwned for CommandBuffer {
unsafe impl DeviceOwned for PrimaryAutoCommandBuffer {
#[inline]
fn device(&self) -> &Arc<Device> {
self.inner.device()
}
}
impl Debug for CommandBuffer {
impl Debug for PrimaryAutoCommandBuffer {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
f.debug_struct("CommandBuffer")
f.debug_struct("PrimaryAutoCommandBuffer")
.field("inner", &self.inner)
.finish_non_exhaustive()
}
}
impl CommandBuffer {
impl PrimaryAutoCommandBuffer {
/// Returns the inner raw command buffer.
#[inline]
pub fn inner(&self) -> &RawCommandBuffer {
@ -134,10 +131,63 @@ impl CommandBuffer {
self.inner.queue_family_index()
}
/// Returns the level of the command buffer.
/// Returns the usage of this command buffer.
#[inline]
pub fn level(&self) -> CommandBufferLevel {
self.inner.level()
pub fn usage(&self) -> CommandBufferUsage {
self.inner.usage()
}
pub(crate) fn state(&self) -> MutexGuard<'_, CommandBufferState> {
self.state.lock()
}
pub(crate) fn resources_usage(&self) -> &CommandBufferResourcesUsage {
&self.resources_usage
}
}
pub struct SecondaryAutoCommandBuffer {
inner: RawCommandBuffer,
_keep_alive_objects: Vec<Box<dyn Fn(&mut RawRecordingCommandBuffer) + Send + Sync + 'static>>,
resources_usage: SecondaryCommandBufferResourcesUsage,
submit_state: SubmitState,
}
unsafe impl VulkanObject for SecondaryAutoCommandBuffer {
type Handle = ash::vk::CommandBuffer;
#[inline]
fn handle(&self) -> Self::Handle {
self.inner.handle()
}
}
unsafe impl DeviceOwned for SecondaryAutoCommandBuffer {
#[inline]
fn device(&self) -> &Arc<Device> {
self.inner.device()
}
}
impl Debug for SecondaryAutoCommandBuffer {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
f.debug_struct("SecondaryAutoCommandBuffer")
.field("inner", &self.inner)
.finish_non_exhaustive()
}
}
impl SecondaryAutoCommandBuffer {
/// Returns the inner raw command buffer.
#[inline]
pub fn inner(&self) -> &RawCommandBuffer {
&self.inner
}
/// Returns the queue family index of this command buffer.
#[inline]
pub fn queue_family_index(&self) -> u32 {
self.inner.queue_family_index()
}
/// Returns the usage of this command buffer.
@ -146,31 +196,17 @@ impl CommandBuffer {
self.inner.usage()
}
/// Returns the inheritance info of the command buffer, if it is a secondary command buffer.
/// Returns the inheritance info of the command buffer.
#[inline]
pub fn inheritance_info(&self) -> Option<&CommandBufferInheritanceInfo> {
self.inner.inheritance_info()
}
pub(crate) fn state(&self) -> MutexGuard<'_, CommandBufferState> {
debug_assert_eq!(self.level(), CommandBufferLevel::Primary);
self.state.lock()
}
pub(crate) fn resources_usage(&self) -> &CommandBufferResourcesUsage {
debug_assert_eq!(self.level(), CommandBufferLevel::Primary);
&self.resources_usage
pub fn inheritance_info(&self) -> &CommandBufferInheritanceInfo {
self.inner.inheritance_info().unwrap()
}
/// Checks whether this command buffer is allowed to be recorded to a command buffer,
/// and if so locks it.
///
/// If you call this function, then you should call `unlock` afterwards.
pub(crate) fn lock_record(&self) -> Result<(), Box<ValidationError>> {
debug_assert_eq!(self.level(), CommandBufferLevel::Secondary);
pub fn lock_record(&self) -> Result<(), Box<ValidationError>> {
match self.submit_state {
SubmitState::OneTime {
ref already_submitted,
@ -211,9 +247,7 @@ impl CommandBuffer {
/// # Safety
///
/// Must not be called if you haven't called `lock_record` before.
pub(crate) unsafe fn unlock(&self) {
debug_assert_eq!(self.level(), CommandBufferLevel::Secondary);
pub unsafe fn unlock(&self) {
match self.submit_state {
SubmitState::OneTime {
ref already_submitted,
@ -228,8 +262,8 @@ impl CommandBuffer {
};
}
pub(crate) fn secondary_resources_usage(&self) -> &SecondaryCommandBufferResourcesUsage {
&self.secondary_resources_usage
pub(crate) fn resources_usage(&self) -> &SecondaryCommandBufferResourcesUsage {
&self.resources_usage
}
}
@ -312,8 +346,7 @@ mod tests {
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::{StandardCommandBufferAllocator, StandardCommandBufferAllocatorCreateInfo},
BufferCopy, CommandBufferBeginInfo, CommandBufferLevel, CommandBufferUsage,
CopyBufferInfoTyped, RecordingCommandBuffer,
BufferCopy, CommandBufferUsage, CopyBufferInfoTyped, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator,
@ -341,14 +374,10 @@ mod tests {
Default::default(),
));
RecordingCommandBuffer::new(
RecordingCommandBuffer::primary(
allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
..Default::default()
},
CommandBufferUsage::MultipleSubmit,
)
.unwrap();
}
@ -411,14 +440,10 @@ mod tests {
device,
Default::default(),
));
let mut cbb = RecordingCommandBuffer::new(
let mut cbb = RecordingCommandBuffer::primary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -461,28 +486,20 @@ mod tests {
));
// Make a secondary CB that doesn't support simultaneous use.
let builder = RecordingCommandBuffer::new(
let builder = RecordingCommandBuffer::secondary(
cb_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
inheritance_info: Some(Default::default()),
..Default::default()
},
CommandBufferUsage::MultipleSubmit,
Default::default(),
)
.unwrap();
let secondary = builder.end().unwrap();
{
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
cb_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::SimultaneousUse,
..Default::default()
},
CommandBufferUsage::SimultaneousUse,
)
.unwrap();
@ -495,27 +512,19 @@ mod tests {
}
{
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
cb_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::SimultaneousUse,
..Default::default()
},
CommandBufferUsage::SimultaneousUse,
)
.unwrap();
builder.execute_commands(secondary.clone()).unwrap();
let cb1 = builder.end().unwrap();
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::SimultaneousUse,
..Default::default()
},
CommandBufferUsage::SimultaneousUse,
)
.unwrap();
@ -554,14 +563,10 @@ mod tests {
device,
Default::default(),
));
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -616,14 +621,10 @@ mod tests {
device,
Default::default(),
));
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::primary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -653,14 +654,10 @@ mod tests {
..Default::default()
},
));
let cbb = RecordingCommandBuffer::new(
let cbb = RecordingCommandBuffer::primary(
cb_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -693,15 +690,11 @@ mod tests {
// Two secondary command buffers that both write to the buffer
let secondary = (0..2)
.map(|_| {
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::secondary(
cb_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Secondary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::SimultaneousUse,
inheritance_info: Some(Default::default()),
..Default::default()
},
CommandBufferUsage::SimultaneousUse,
Default::default(),
)
.unwrap();
builder
@ -712,15 +705,11 @@ mod tests {
.collect::<Vec<_>>();
{
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::secondary(
cb_allocator.clone(),
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::SimultaneousUse,
inheritance_info: Some(Default::default()),
..Default::default()
},
CommandBufferUsage::SimultaneousUse,
Default::default(),
)
.unwrap();
@ -740,15 +729,11 @@ mod tests {
}
{
let mut builder = RecordingCommandBuffer::new(
let mut builder = RecordingCommandBuffer::secondary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::SimultaneousUse,
inheritance_info: Some(Default::default()),
..Default::default()
},
CommandBufferUsage::SimultaneousUse,
Default::default(),
)
.unwrap();
@ -772,14 +757,10 @@ mod tests {
device.clone(),
Default::default(),
));
let mut sync = RecordingCommandBuffer::new(
let mut sync = RecordingCommandBuffer::primary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
..Default::default()
},
CommandBufferUsage::MultipleSubmit,
)
.unwrap();
@ -815,14 +796,10 @@ mod tests {
device.clone(),
Default::default(),
));
let mut sync = RecordingCommandBuffer::new(
let mut sync = RecordingCommandBuffer::primary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::MultipleSubmit,
..Default::default()
},
CommandBufferUsage::MultipleSubmit,
)
.unwrap();
let set_layout = DescriptorSetLayout::new(

View File

@ -24,7 +24,7 @@ use smallvec::SmallVec;
use std::{mem::size_of, sync::Arc};
/// # Commands to do operations on acceleration structures.
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Builds or updates an acceleration structure.
///
/// # Safety

View File

@ -20,7 +20,7 @@ use std::{cmp::min, ffi::c_void, mem::size_of, ptr, sync::Arc};
/// # 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 RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Binds descriptor sets for future dispatch or draw calls.
pub fn bind_descriptor_sets(
&mut self,

View File

@ -14,7 +14,7 @@ use smallvec::{smallvec, SmallVec};
use std::{mem::size_of_val, sync::Arc};
/// # Commands to fill resources with new data.
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Clears a color image with a specific value.
pub fn clear_color_image(
&mut self,

View File

@ -20,7 +20,7 @@ use std::{
};
/// # Commands to transfer data between resources.
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Copies data from a buffer to another buffer.
///
/// # Panics

View File

@ -10,7 +10,7 @@ use crate::{
/// These commands all require the [`ext_debug_utils`] extension to be enabled on the instance.
///
/// [`ext_debug_utils`]: crate::instance::InstanceExtensions::ext_debug_utils
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Opens a command buffer debug label region.
pub fn begin_debug_utils_label(
&mut self,

View File

@ -22,7 +22,7 @@ use std::ops::RangeInclusive;
/// # Commands to set dynamic state for pipelines.
///
/// These commands require a queue with a pipeline type that uses the given state.
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
// Helper function for dynamic state setting.
fn validate_graphics_pipeline_fixed_state(
&self,

View File

@ -52,7 +52,7 @@ macro_rules! vuids {
/// # Commands to execute a bound pipeline.
///
/// Dispatch commands require a compute queue, draw commands require a graphics queue.
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Perform a single compute operation using a compute pipeline.
///
/// A compute pipeline must have been bound using

View File

@ -13,7 +13,7 @@ use crate::{
use std::{ops::Range, sync::Arc};
/// # Commands related to queries.
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Begins a query.
///
/// The query will be active until [`end_query`](Self::end_query) is called for the same query.

View File

@ -24,7 +24,7 @@ use std::{cmp::min, ops::Range, sync::Arc};
/// # Commands for render passes.
///
/// These commands require a graphics queue.
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Begins a render pass using a render pass object and framebuffer.
///
/// You must call this or `begin_rendering` before you can record draw commands.
@ -328,9 +328,7 @@ impl RecordingCommandBuffer {
self
}
}
impl RecordingCommandBuffer {
/// Begins a render pass without a render pass object or framebuffer.
///
/// Requires the [`dynamic_rendering`] device feature.

View File

@ -2,8 +2,8 @@ use crate::{
command_buffer::{
auto::{RenderPassStateType, Resource, ResourceUseRef2},
sys::{RawCommandBuffer, RawRecordingCommandBuffer},
CommandBuffer, CommandBufferInheritanceRenderPassType, CommandBufferLevel,
RecordingCommandBuffer, ResourceInCommand, SecondaryCommandBufferBufferUsage,
CommandBufferInheritanceRenderPassType, CommandBufferLevel, RecordingCommandBuffer,
ResourceInCommand, SecondaryAutoCommandBuffer, SecondaryCommandBufferBufferUsage,
SecondaryCommandBufferImageUsage, SecondaryCommandBufferResourcesUsage, SubpassContents,
},
device::{DeviceOwned, QueueFlags},
@ -17,7 +17,7 @@ use std::{cmp::min, iter, sync::Arc};
///
/// These commands can be called on any queue that can execute the commands recorded in the
/// secondary command buffer.
impl RecordingCommandBuffer {
impl<L> RecordingCommandBuffer<L> {
/// Executes a secondary command buffer.
///
/// If the `flags` that `command_buffer` was created with are more restrictive than those of
@ -25,7 +25,7 @@ impl RecordingCommandBuffer {
/// with `Flags::OneTimeSubmit` will set `self`'s flags to `Flags::OneTimeSubmit` also.
pub fn execute_commands(
&mut self,
command_buffer: Arc<CommandBuffer>,
command_buffer: Arc<SecondaryAutoCommandBuffer>,
) -> Result<&mut Self, Box<ValidationError>> {
let command_buffer = DropUnlockCommandBuffer::new(command_buffer)?;
self.validate_execute_commands(iter::once(&**command_buffer))?;
@ -41,7 +41,7 @@ impl RecordingCommandBuffer {
// TODO ^ would be nice if this just worked without errors
pub fn execute_commands_from_vec(
&mut self,
command_buffers: Vec<Arc<CommandBuffer>>,
command_buffers: Vec<Arc<SecondaryAutoCommandBuffer>>,
) -> Result<&mut Self, Box<ValidationError>> {
let command_buffers: SmallVec<[_; 4]> = command_buffers
.into_iter()
@ -55,7 +55,7 @@ impl RecordingCommandBuffer {
fn validate_execute_commands<'a>(
&self,
command_buffers: impl Iterator<Item = &'a CommandBuffer> + Clone,
command_buffers: impl Iterator<Item = &'a SecondaryAutoCommandBuffer> + Clone,
) -> Result<(), Box<ValidationError>> {
self.inner
.validate_execute_commands(command_buffers.clone().map(|cb| cb.inner()))?;
@ -89,7 +89,7 @@ impl RecordingCommandBuffer {
}
for (command_buffer_index, command_buffer) in command_buffers.enumerate() {
let inheritance_info = command_buffer.inheritance_info().unwrap();
let inheritance_info = command_buffer.inheritance_info();
if let Some(render_pass_state) = &self.builder_state.render_pass {
let inheritance_render_pass =
@ -459,7 +459,7 @@ impl RecordingCommandBuffer {
#[cfg_attr(not(feature = "document_unchecked"), doc(hidden))]
pub unsafe fn execute_commands_unchecked(
&mut self,
command_buffers: SmallVec<[Arc<CommandBuffer>; 4]>,
command_buffers: SmallVec<[Arc<SecondaryAutoCommandBuffer>; 4]>,
) -> &mut Self {
self.execute_commands_locked(
command_buffers
@ -485,7 +485,7 @@ impl RecordingCommandBuffer {
.flat_map(|(index, command_buffer)| {
let index = index as u32;
let SecondaryCommandBufferResourcesUsage { buffers, images } =
command_buffer.secondary_resources_usage();
command_buffer.resources_usage();
(buffers.iter().map(move |usage| {
let &SecondaryCommandBufferBufferUsage {
@ -670,17 +670,17 @@ impl RawRecordingCommandBuffer {
}
}
struct DropUnlockCommandBuffer(Arc<CommandBuffer>);
struct DropUnlockCommandBuffer(Arc<SecondaryAutoCommandBuffer>);
impl DropUnlockCommandBuffer {
fn new(command_buffer: Arc<CommandBuffer>) -> Result<Self, Box<ValidationError>> {
fn new(command_buffer: Arc<SecondaryAutoCommandBuffer>) -> Result<Self, Box<ValidationError>> {
command_buffer.lock_record()?;
Ok(Self(command_buffer))
}
}
impl std::ops::Deref for DropUnlockCommandBuffer {
type Target = Arc<CommandBuffer>;
type Target = Arc<SecondaryAutoCommandBuffer>;
fn deref(&self) -> &Self::Target {
&self.0

View File

@ -41,19 +41,18 @@
//! To record a new command buffer, the most direct way is to create a new
//! [`RecordingCommandBuffer`]. You can then call methods on this object to record new commands to
//! the command buffer. When you are done recording, you call [`end`] to finalise the command
//! buffer and turn it into a [`CommandBuffer`].
//! buffer and turn it into either a [`PrimaryAutoCommandBuffer`] or a
//! [`SecondaryAutoCommandBuffer`].
//!
//! # Submitting a primary command buffer
//!
//! Once a primary command buffer has finished recording, you can submit the [`CommandBuffer`] to a
//! queue. Submitting a command buffer returns an object that implements the [`GpuFuture`] trait
//! and that represents the moment when the execution will end on the GPU.
//! Once a primary command buffer is recorded and built, you can submit the
//! [`PrimaryAutoCommandBuffer`] to a queue. Submitting a command buffer returns an object that
//! implements the [`GpuFuture`] trait and that represents the moment when the execution will end
//! on the GPU.
//!
//! ```
//! use vulkano::command_buffer::{
//! CommandBufferBeginInfo, CommandBufferLevel, CommandBufferUsage, RecordingCommandBuffer,
//! SubpassContents,
//! };
//! use vulkano::command_buffer::{CommandBufferUsage, RecordingCommandBuffer, SubpassContents};
//!
//! # let device: std::sync::Arc<vulkano::device::Device> = return;
//! # let queue: std::sync::Arc<vulkano::device::Queue> = return;
@ -62,11 +61,10 @@
//! # let graphics_pipeline: std::sync::Arc<vulkano::pipeline::graphics::GraphicsPipeline> = return;
//! # let command_buffer_allocator: std::sync::Arc<vulkano::command_buffer::allocator::StandardCommandBufferAllocator> = return;
//! #
//! let mut cb = RecordingCommandBuffer::new(
//! let mut cb = RecordingCommandBuffer::primary(
//! command_buffer_allocator.clone(),
//! queue.queue_family_index(),
//! CommandBufferLevel::Primary,
//! CommandBufferBeginInfo::default(),
//! CommandBufferUsage::OneTimeSubmit,
//! )
//! .unwrap();
//!
@ -100,8 +98,7 @@ pub use self::commands::{
query::*, render_pass::*, secondary::*, sync::*,
};
pub use self::{
auto::{CommandBuffer, RecordingCommandBuffer},
sys::CommandBufferBeginInfo,
auto::{PrimaryAutoCommandBuffer, RecordingCommandBuffer, SecondaryAutoCommandBuffer},
traits::{CommandBufferExecError, CommandBufferExecFuture},
};
use crate::{
@ -1199,7 +1196,7 @@ pub struct CommandBufferSubmitInfo {
/// The command buffer to execute.
///
/// There is no default value.
pub command_buffer: Arc<CommandBuffer>,
pub command_buffer: Arc<PrimaryAutoCommandBuffer>,
pub _ne: crate::NonExhaustive,
}
@ -1207,7 +1204,7 @@ pub struct CommandBufferSubmitInfo {
impl CommandBufferSubmitInfo {
/// Returns a `CommandBufferSubmitInfo` with the specified `command_buffer`.
#[inline]
pub fn new(command_buffer: Arc<CommandBuffer>) -> Self {
pub fn new(command_buffer: Arc<PrimaryAutoCommandBuffer>) -> Self {
Self {
command_buffer,
_ne: crate::NonExhaustive(()),
@ -1223,15 +1220,6 @@ impl CommandBufferSubmitInfo {
// VUID?
assert_eq!(device, command_buffer.device().as_ref());
if self.command_buffer.level() != CommandBufferLevel::Primary {
return Err(Box::new(ValidationError {
context: "command_buffer".into(),
problem: "is not a primary command buffer".into(),
vuids: &["VUID-VkCommandBufferSubmitInfo-commandBuffer-03890"],
..Default::default()
}));
}
Ok(())
}

View File

@ -1,4 +1,4 @@
use super::{CommandBuffer, CommandBufferSubmitInfo, SemaphoreSubmitInfo, SubmitInfo};
use super::{CommandBufferSubmitInfo, PrimaryAutoCommandBuffer, SemaphoreSubmitInfo, SubmitInfo};
use crate::{
buffer::Buffer,
device::{Device, DeviceOwned, Queue},
@ -26,7 +26,7 @@ use std::{
thread,
};
impl CommandBuffer {
impl PrimaryAutoCommandBuffer {
/// Executes this command buffer on a queue.
///
/// This function returns an object that implements the [`GpuFuture`] trait. See the
@ -121,7 +121,7 @@ where
F: GpuFuture,
{
previous: F,
command_buffer: Arc<CommandBuffer>,
command_buffer: Arc<PrimaryAutoCommandBuffer>,
queue: Arc<Queue>,
// True if the command buffer has already been submitted.
// If flush is called multiple times, we want to block so that only one flushing is executed.

View File

@ -433,8 +433,7 @@ mod tests {
use crate::{
buffer::{Buffer, BufferCreateInfo, BufferUsage},
command_buffer::{
allocator::StandardCommandBufferAllocator, CommandBufferBeginInfo, CommandBufferLevel,
CommandBufferUsage, RecordingCommandBuffer,
allocator::StandardCommandBufferAllocator, CommandBufferUsage, RecordingCommandBuffer,
},
descriptor_set::{
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
@ -545,14 +544,10 @@ mod tests {
device.clone(),
Default::default(),
));
let mut cbb = RecordingCommandBuffer::new(
let mut cbb = RecordingCommandBuffer::primary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();
@ -700,14 +695,10 @@ mod tests {
device.clone(),
Default::default(),
));
let mut cbb = RecordingCommandBuffer::new(
let mut cbb = RecordingCommandBuffer::primary(
cb_allocator,
queue.queue_family_index(),
CommandBufferLevel::Primary,
CommandBufferBeginInfo {
usage: CommandBufferUsage::OneTimeSubmit,
..Default::default()
},
CommandBufferUsage::OneTimeSubmit,
)
.unwrap();

View File

@ -234,7 +234,7 @@
//! # let mut swapchain: ::std::sync::Arc<swapchain::Swapchain> = return;
//! // let mut (swapchain, images) = Swapchain::new(...);
//! loop {
//! # let mut command_buffer: ::std::sync::Arc<::vulkano::command_buffer::CommandBuffer> = return;
//! # let mut command_buffer: ::std::sync::Arc<::vulkano::command_buffer::PrimaryAutoCommandBuffer> = return;
//! let (image_index, suboptimal, acquire_future)
//! = swapchain::acquire_next_image(swapchain.clone(), None).unwrap();
//!

View File

@ -91,9 +91,9 @@ use super::{fence::Fence, semaphore::Semaphore};
use crate::{
buffer::{Buffer, BufferState},
command_buffer::{
CommandBuffer, CommandBufferExecError, CommandBufferExecFuture,
CommandBufferResourcesUsage, CommandBufferState, CommandBufferSubmitInfo,
CommandBufferUsage, SubmitInfo,
CommandBufferExecError, CommandBufferExecFuture, CommandBufferResourcesUsage,
CommandBufferState, CommandBufferSubmitInfo, CommandBufferUsage, PrimaryAutoCommandBuffer,
SubmitInfo,
},
device::{DeviceOwned, Queue},
image::{Image, ImageLayout, ImageState},
@ -242,7 +242,7 @@ pub unsafe trait GpuFuture: DeviceOwned {
fn then_execute(
self,
queue: Arc<Queue>,
command_buffer: Arc<CommandBuffer>,
command_buffer: Arc<PrimaryAutoCommandBuffer>,
) -> Result<CommandBufferExecFuture<Self>, CommandBufferExecError>
where
Self: Sized,
@ -256,7 +256,7 @@ pub unsafe trait GpuFuture: DeviceOwned {
/// > `CommandBuffer` trait.
fn then_execute_same_queue(
self,
command_buffer: Arc<CommandBuffer>,
command_buffer: Arc<PrimaryAutoCommandBuffer>,
) -> Result<CommandBufferExecFuture<Self>, CommandBufferExecError>
where
Self: Sized,