Skip to content

Commit

Permalink
Revert #2425
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 committed Oct 16, 2024
1 parent 1da590f commit 7d891c9
Show file tree
Hide file tree
Showing 63 changed files with 524 additions and 678 deletions.
11 changes: 3 additions & 8 deletions examples/basic-compute-shader/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down
12 changes: 4 additions & 8 deletions examples/buffer-allocator/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down
13 changes: 4 additions & 9 deletions examples/clear-attachments/main.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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
Expand Down
19 changes: 7 additions & 12 deletions examples/deferred/frame/ambient_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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],
};
Expand All @@ -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()
},
)
Expand Down
19 changes: 7 additions & 12 deletions examples/deferred/frame/directional_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand All @@ -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()
},
)
Expand Down
19 changes: 7 additions & 12 deletions examples/deferred/frame/point_lighting_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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],
Expand All @@ -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()
},
)
Expand Down
18 changes: 7 additions & 11 deletions examples/deferred/frame/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
Expand Down Expand Up @@ -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()
Expand Down
19 changes: 7 additions & 12 deletions examples/deferred/triangle_draw_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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()
},
)
Expand Down
11 changes: 3 additions & 8 deletions examples/dynamic-buffers/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down
12 changes: 4 additions & 8 deletions examples/dynamic-local-size/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down
13 changes: 4 additions & 9 deletions examples/gl-interop/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();

Expand Down
Loading

0 comments on commit 7d891c9

Please sign in to comment.