Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Queue operations refactoring #1995

Merged
merged 1 commit into from
Sep 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions examples/src/bin/buffer-pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ use vulkano::{
},
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
swapchain::{
acquire_next_image, AcquireError, PresentInfo, Swapchain, SwapchainCreateInfo,
SwapchainCreationError,
acquire_next_image, AcquireError, Swapchain, SwapchainAbstract, SwapchainCreateInfo,
SwapchainCreationError, SwapchainPresentInfo,
},
sync::{self, FlushError, GpuFuture},
VulkanLibrary,
Expand Down Expand Up @@ -281,7 +281,7 @@ fn main() {
recreate_swapchain = false;
}

let (image_num, suboptimal, acquire_future) =
let (image_index, suboptimal, acquire_future) =
match acquire_next_image(swapchain.clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
Expand Down Expand Up @@ -339,7 +339,9 @@ fn main() {
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into())],
..RenderPassBeginInfo::framebuffer(framebuffers[image_num].clone())
..RenderPassBeginInfo::framebuffer(
framebuffers[image_index as usize].clone(),
)
},
SubpassContents::Inline,
)
Expand All @@ -362,10 +364,7 @@ fn main() {
.unwrap()
.then_swapchain_present(
queue.clone(),
PresentInfo {
index: image_num,
..PresentInfo::swapchain(swapchain.clone())
},
SwapchainPresentInfo::swapchain_image_index(swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
15 changes: 7 additions & 8 deletions examples/src/bin/clear_attachments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use vulkano::{
instance::{Instance, InstanceCreateInfo},
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass},
swapchain::{
acquire_next_image, AcquireError, PresentInfo, Swapchain, SwapchainCreateInfo,
SwapchainCreationError,
acquire_next_image, AcquireError, Swapchain, SwapchainAbstract, SwapchainCreateInfo,
SwapchainCreationError, SwapchainPresentInfo,
},
sync::{self, FlushError, GpuFuture},
VulkanLibrary,
Expand Down Expand Up @@ -198,7 +198,7 @@ fn main() {
recreate_swapchain = false;
}

let (image_num, suboptimal, acquire_future) =
let (image_index, suboptimal, acquire_future) =
match acquire_next_image(swapchain.clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
Expand All @@ -222,7 +222,9 @@ fn main() {
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into())],
..RenderPassBeginInfo::framebuffer(framebuffers[image_num].clone())
..RenderPassBeginInfo::framebuffer(
framebuffers[image_index as usize].clone(),
)
},
SubpassContents::Inline,
)
Expand Down Expand Up @@ -270,10 +272,7 @@ fn main() {
.unwrap()
.then_swapchain_present(
queue.clone(),
PresentInfo {
index: image_num,
..PresentInfo::swapchain(swapchain.clone())
},
SwapchainPresentInfo::swapchain_image_index(swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
18 changes: 9 additions & 9 deletions examples/src/bin/deferred/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ use vulkano::{
image::{view::ImageView, ImageUsage},
instance::{Instance, InstanceCreateInfo},
swapchain::{
acquire_next_image, AcquireError, PresentInfo, Swapchain, SwapchainCreateInfo,
SwapchainCreationError,
acquire_next_image, AcquireError, Swapchain, SwapchainAbstract, SwapchainCreateInfo,
SwapchainCreationError, SwapchainPresentInfo,
},
sync::{self, FlushError, GpuFuture},
VulkanLibrary,
Expand Down Expand Up @@ -209,7 +209,7 @@ fn main() {
recreate_swapchain = false;
}

let (image_num, suboptimal, acquire_future) =
let (image_index, suboptimal, acquire_future) =
match acquire_next_image(swapchain.clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
Expand All @@ -224,8 +224,11 @@ fn main() {
}

let future = previous_frame_end.take().unwrap().join(acquire_future);
let mut frame =
frame_system.frame(future, images[image_num].clone(), Matrix4::identity());
let mut frame = frame_system.frame(
future,
images[image_index as usize].clone(),
Matrix4::identity(),
);
let mut after_future = None;
while let Some(pass) = frame.next_pass() {
match pass {
Expand All @@ -250,10 +253,7 @@ fn main() {
.unwrap()
.then_swapchain_present(
queue.clone(),
PresentInfo {
index: image_num,
..PresentInfo::swapchain(swapchain.clone())
},
SwapchainPresentInfo::swapchain_image_index(swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
21 changes: 12 additions & 9 deletions examples/src/bin/gl-interop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ mod linux {
render_pass::{Framebuffer, RenderPass, Subpass},
sampler::{Filter, Sampler, SamplerAddressMode, SamplerCreateInfo},
swapchain::{
AcquireError, PresentInfo, Swapchain, SwapchainCreateInfo, SwapchainCreationError,
AcquireError, Swapchain, SwapchainAbstract, SwapchainCreateInfo,
SwapchainCreationError, SwapchainPresentInfo,
},
sync::{
now, ExternalSemaphoreHandleType, ExternalSemaphoreHandleTypes, FlushError, GpuFuture,
Expand Down Expand Up @@ -255,7 +256,7 @@ mod linux {
Event::RedrawEventsCleared => {
unsafe {
let mut builder = SubmitCommandBufferBuilder::new();
builder.add_signal_semaphore(&acquire_sem);
builder.add_signal_semaphore(acquire_sem.clone());
builder.submit(&queue).unwrap();
};

Expand All @@ -265,7 +266,7 @@ mod linux {
unsafe {
let mut builder = SubmitCommandBufferBuilder::new();
builder.add_wait_semaphore(
&release_sem,
release_sem.clone(),
PipelineStages {
all_commands: true,
..PipelineStages::empty()
Expand Down Expand Up @@ -298,7 +299,7 @@ mod linux {
recreate_swapchain = false;
}

let (image_num, suboptimal, acquire_future) =
let (image_index, suboptimal, acquire_future) =
match vulkano::swapchain::acquire_next_image(swapchain.clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
Expand All @@ -322,7 +323,9 @@ mod linux {
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into())],
..RenderPassBeginInfo::framebuffer(framebuffers[image_num].clone())
..RenderPassBeginInfo::framebuffer(
framebuffers[image_index as usize].clone(),
)
},
SubpassContents::Inline,
)
Expand All @@ -349,10 +352,10 @@ mod linux {
.unwrap()
.then_swapchain_present(
queue.clone(),
PresentInfo {
index: image_num,
..PresentInfo::swapchain(swapchain.clone())
},
SwapchainPresentInfo::swapchain_image_index(
swapchain.clone(),
image_index,
),
)
.then_signal_fence_and_flush();

Expand Down
15 changes: 7 additions & 8 deletions examples/src/bin/image-self-copy-blit/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ use vulkano::{
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
sampler::{Filter, Sampler, SamplerAddressMode, SamplerCreateInfo},
swapchain::{
acquire_next_image, AcquireError, PresentInfo, Swapchain, SwapchainCreateInfo,
SwapchainCreationError,
acquire_next_image, AcquireError, Swapchain, SwapchainAbstract,
SwapchainCreateInfo, SwapchainCreationError, SwapchainPresentInfo,
},
sync::{self, FlushError, GpuFuture},
VulkanLibrary,
Expand Down Expand Up @@ -391,7 +391,7 @@ fn main() {
recreate_swapchain = false;
}

let (image_num, suboptimal, acquire_future) =
let (image_index, suboptimal, acquire_future) =
match acquire_next_image(swapchain.clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
Expand All @@ -415,7 +415,9 @@ fn main() {
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into())],
..RenderPassBeginInfo::framebuffer(framebuffers[image_num].clone())
..RenderPassBeginInfo::framebuffer(
framebuffers[image_index as usize].clone(),
)
},
SubpassContents::Inline,
)
Expand Down Expand Up @@ -443,10 +445,7 @@ fn main() {
.unwrap()
.then_swapchain_present(
queue.clone(),
PresentInfo {
index: image_num,
..PresentInfo::swapchain(swapchain.clone())
},
SwapchainPresentInfo::swapchain_image_index(swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
15 changes: 7 additions & 8 deletions examples/src/bin/image/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ use vulkano::{
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
sampler::{Filter, Sampler, SamplerAddressMode, SamplerCreateInfo},
swapchain::{
acquire_next_image, AcquireError, PresentInfo, Swapchain, SwapchainCreateInfo,
SwapchainCreationError,
acquire_next_image, AcquireError, Swapchain, SwapchainAbstract,
SwapchainCreateInfo, SwapchainCreationError, SwapchainPresentInfo,
},
sync::{self, FlushError, GpuFuture},
VulkanLibrary,
Expand Down Expand Up @@ -308,7 +308,7 @@ fn main() {
recreate_swapchain = false;
}

let (image_num, suboptimal, acquire_future) =
let (image_index, suboptimal, acquire_future) =
match acquire_next_image(swapchain.clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
Expand All @@ -332,7 +332,9 @@ fn main() {
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into())],
..RenderPassBeginInfo::framebuffer(framebuffers[image_num].clone())
..RenderPassBeginInfo::framebuffer(
framebuffers[image_index as usize].clone(),
)
},
SubpassContents::Inline,
)
Expand Down Expand Up @@ -360,10 +362,7 @@ fn main() {
.unwrap()
.then_swapchain_present(
queue.clone(),
PresentInfo {
index: image_num,
..PresentInfo::swapchain(swapchain.clone())
},
SwapchainPresentInfo::swapchain_image_index(swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
15 changes: 7 additions & 8 deletions examples/src/bin/immutable-sampler/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ use vulkano::{
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
sampler::{Filter, Sampler, SamplerAddressMode, SamplerCreateInfo},
swapchain::{
acquire_next_image, AcquireError, PresentInfo, Swapchain, SwapchainCreateInfo,
SwapchainCreationError,
acquire_next_image, AcquireError, Swapchain, SwapchainAbstract,
SwapchainCreateInfo, SwapchainCreationError, SwapchainPresentInfo,
},
sync::{self, FlushError, GpuFuture},
VulkanLibrary,
Expand Down Expand Up @@ -319,7 +319,7 @@ fn main() {
recreate_swapchain = false;
}

let (image_num, suboptimal, acquire_future) =
let (image_index, suboptimal, acquire_future) =
match acquire_next_image(swapchain.clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
Expand All @@ -343,7 +343,9 @@ fn main() {
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into())],
..RenderPassBeginInfo::framebuffer(framebuffers[image_num].clone())
..RenderPassBeginInfo::framebuffer(
framebuffers[image_index as usize].clone(),
)
},
SubpassContents::Inline,
)
Expand Down Expand Up @@ -371,10 +373,7 @@ fn main() {
.unwrap()
.then_swapchain_present(
queue.clone(),
PresentInfo {
index: image_num,
..PresentInfo::swapchain(swapchain.clone())
},
SwapchainPresentInfo::swapchain_image_index(swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
15 changes: 7 additions & 8 deletions examples/src/bin/indirect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ use vulkano::{
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
single_pass_renderpass,
swapchain::{
acquire_next_image, AcquireError, PresentInfo, Swapchain, SwapchainCreateInfo,
SwapchainCreationError,
acquire_next_image, AcquireError, Swapchain, SwapchainAbstract,
SwapchainCreateInfo, SwapchainCreationError, SwapchainPresentInfo,
},
sync::{self, FlushError, GpuFuture},
VulkanLibrary,
Expand Down Expand Up @@ -357,7 +357,7 @@ fn main() {
recreate_swapchain = false;
}

let (image_num, suboptimal, acquire_future) =
let (image_index, suboptimal, acquire_future) =
match acquire_next_image(swapchain.clone(), None) {
Ok(r) => r,
Err(AcquireError::OutOfDate) => {
Expand Down Expand Up @@ -420,7 +420,9 @@ fn main() {
.begin_render_pass(
RenderPassBeginInfo {
clear_values: vec![Some([0.0, 0.0, 1.0, 1.0].into())],
..RenderPassBeginInfo::framebuffer(framebuffers[image_num].clone())
..RenderPassBeginInfo::framebuffer(
framebuffers[image_index as usize].clone(),
)
},
SubpassContents::Inline,
)
Expand All @@ -444,10 +446,7 @@ fn main() {
.unwrap()
.then_swapchain_present(
queue.clone(),
PresentInfo {
index: image_num,
..PresentInfo::swapchain(swapchain.clone())
},
SwapchainPresentInfo::swapchain_image_index(swapchain.clone(), image_index),
)
.then_signal_fence_and_flush();

Expand Down
Loading