Closed coolcatcoder closed 6 months ago
There are already methods:
pub fn swapchain_image_view(&self) -> Arc<ImageView> {
self.final_views[self.image_index as usize].clone()
}
pub fn image_index(&self) -> u32 {
self.image_index
}
Do these help?
Unfortunately for swapchain_image_view(), it returns the current swapchain image. Useful for creating a framebuffer every frame, but not useful for creating framebuffers in advance. As for image_index(), I just somehow completely missed that. That is definitely better than my solution of returning the u32 as part of acquire(), whoops.
The reason I decided to name the callback function on_recreate_swapchain
, instead of mentioning resize, is because the swapchain could be recreated for more reasons than just a resize, so this name feels more accurate.
(Also just realised I messed up the last commit's name… It should not have that "to on_recreate_swapchain" on the end, whoops.)
Being able to access image_index and final_views in VulkanoWindowRenderer should make creating frame buffers easier. The new example should make it easier to learn vulkano-util.
I'm still quite new to rust and vulkan, as such I have not yet figured out how to make multi-window-game-of-life and interactive-fractal use these changes to store their frame buffers, instead of creating one every frame.
This is my attempt at a solution to this issue.
Changelog:
This is the first time I've created a proper pull request, so I hope I did it correctly.