Move create_image_view to vkSwapchain->create_present_image_view
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
This commit is contained in:
parent
891835c4af
commit
002d6fa9a4
2 changed files with 27 additions and 28 deletions
|
@ -69,32 +69,6 @@ impl VkDevice {
|
||||||
self.queues.get(queue_index as usize)
|
self.queues.get(queue_index as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn create_image_view(
|
|
||||||
&self,
|
|
||||||
image: vk::Image,
|
|
||||||
surface_format: vk::SurfaceFormatKHR,
|
|
||||||
) -> VkResult<vk::ImageView> {
|
|
||||||
let create_view_info = vk::ImageViewCreateInfo::default()
|
|
||||||
.view_type(vk::ImageViewType::TYPE_2D)
|
|
||||||
.format(surface_format.format)
|
|
||||||
.components(vk::ComponentMapping {
|
|
||||||
r: vk::ComponentSwizzle::R,
|
|
||||||
g: vk::ComponentSwizzle::G,
|
|
||||||
b: vk::ComponentSwizzle::B,
|
|
||||||
a: vk::ComponentSwizzle::A,
|
|
||||||
})
|
|
||||||
.subresource_range(vk::ImageSubresourceRange {
|
|
||||||
aspect_mask: vk::ImageAspectFlags::COLOR,
|
|
||||||
base_mip_level: 0,
|
|
||||||
level_count: 1,
|
|
||||||
base_array_layer: 0,
|
|
||||||
layer_count: 1,
|
|
||||||
})
|
|
||||||
.image(image);
|
|
||||||
|
|
||||||
unsafe { self.handle.create_image_view(&create_view_info, None) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn create_command_pool(
|
pub(super) fn create_command_pool(
|
||||||
&self,
|
&self,
|
||||||
info: &vk::CommandPoolCreateInfo,
|
info: &vk::CommandPoolCreateInfo,
|
||||||
|
|
|
@ -96,8 +96,7 @@ impl VkSwapchain {
|
||||||
let present_images_view = present_images
|
let present_images_view = present_images
|
||||||
.iter()
|
.iter()
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
self.device
|
self.create_present_image_view(*i)
|
||||||
.create_image_view(*i, self.surface_format)
|
|
||||||
.expect("Failed to create image view")
|
.expect("Failed to create image view")
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
@ -210,6 +209,32 @@ impl VkSwapchain {
|
||||||
.find(|&mode| mode == vk::PresentModeKHR::MAILBOX)
|
.find(|&mode| mode == vk::PresentModeKHR::MAILBOX)
|
||||||
.unwrap_or(vk::PresentModeKHR::FIFO)
|
.unwrap_or(vk::PresentModeKHR::FIFO)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn create_present_image_view(&self, image: vk::Image) -> VkResult<vk::ImageView> {
|
||||||
|
let create_view_info = vk::ImageViewCreateInfo::default()
|
||||||
|
.view_type(vk::ImageViewType::TYPE_2D)
|
||||||
|
.format(self.surface_format.format)
|
||||||
|
.components(vk::ComponentMapping {
|
||||||
|
r: vk::ComponentSwizzle::R,
|
||||||
|
g: vk::ComponentSwizzle::G,
|
||||||
|
b: vk::ComponentSwizzle::B,
|
||||||
|
a: vk::ComponentSwizzle::A,
|
||||||
|
})
|
||||||
|
.subresource_range(vk::ImageSubresourceRange {
|
||||||
|
aspect_mask: vk::ImageAspectFlags::COLOR,
|
||||||
|
base_mip_level: 0,
|
||||||
|
level_count: 1,
|
||||||
|
base_array_layer: 0,
|
||||||
|
layer_count: 1,
|
||||||
|
})
|
||||||
|
.image(image);
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
self.device
|
||||||
|
.handle
|
||||||
|
.create_image_view(&create_view_info, None)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for VkSwapchain {
|
impl Drop for VkSwapchain {
|
||||||
|
|
Loading…
Reference in a new issue