-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
420 additions
and
57 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//! # Allocated Image | ||
//! A custom image separate from the swapchain. | ||
use ash::{prelude::VkResult, vk}; | ||
|
||
pub struct AllocatedImage { | ||
image: super::Image, | ||
image_view: super::ImageView, | ||
extent: vk::Extent3D, | ||
format: vk::Format, | ||
device: ash::Device, | ||
} | ||
|
||
impl AllocatedImage { | ||
pub(super) fn new(device: &super::Device, image_create_info: &vk::ImageCreateInfo, image_view_create_info: &vk::ImageViewCreateInfo, extent: vk::Extent3D, format: vk::Format) -> VkResult<Self> { | ||
let image = device.create_image(image_create_info)?; | ||
let image_view_create_info = image_view_create_info | ||
.image(*image); | ||
let image_view = device.create_image_view(&image_view_create_info)?; | ||
Ok( | ||
Self { | ||
image, | ||
image_view, | ||
extent, | ||
format, | ||
device: device.inner.clone(), | ||
} | ||
) | ||
} | ||
|
||
#[inline] | ||
pub fn image(&self) -> &super::Image { | ||
&self.image | ||
} | ||
|
||
#[inline] | ||
pub fn image_view(&self) -> &super::ImageView { | ||
&self.image_view | ||
} | ||
} |
Oops, something went wrong.