|
|
|
@ -59,8 +59,8 @@ impl GetDevice for IndepImage {
|
|
|
|
|
impl GetDevice for Image { |
|
|
|
|
fn get_device(&self) -> &Rc<Device> { |
|
|
|
|
match self { |
|
|
|
|
Self::Owned(image) => image.get_device(), |
|
|
|
|
Self::Indep(image) => image.get_device(), |
|
|
|
|
| Self::Owned(image) => image.get_device(), |
|
|
|
|
| Self::Indep(image) => image.get_device(), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -104,8 +104,7 @@ impl ImageInfo {
|
|
|
|
|
|
|
|
|
|
impl IndepImage { |
|
|
|
|
pub fn create( |
|
|
|
|
cmd_pool: &CommandPool, |
|
|
|
|
mip: &MipImage, |
|
|
|
|
cmd_pool: &CommandPool, mip: &MipImage, |
|
|
|
|
) -> Result<Self, ErrAllocMem> { |
|
|
|
|
let device = cmd_pool.get_device().clone(); |
|
|
|
|
|
|
|
|
@ -152,9 +151,7 @@ impl IndepImage {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub fn create_depth( |
|
|
|
|
cmd_pool: &CommandPool, |
|
|
|
|
width: u32, |
|
|
|
|
height: u32, |
|
|
|
|
cmd_pool: &CommandPool, width: u32, height: u32, |
|
|
|
|
) -> Result<Self, ErrAllocMem> { |
|
|
|
|
let device = cmd_pool.get_device().clone(); |
|
|
|
|
|
|
|
|
@ -188,9 +185,7 @@ impl IndepImage {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn layout_barrier( |
|
|
|
|
&self, |
|
|
|
|
cmd_pool: &CommandPool, |
|
|
|
|
layout_stage: LayoutStage, |
|
|
|
|
&self, cmd_pool: &CommandPool, layout_stage: LayoutStage, |
|
|
|
|
) -> Result<(), vk::Result> { |
|
|
|
|
let ( |
|
|
|
|
old_layout, |
|
|
|
@ -200,7 +195,7 @@ impl IndepImage {
|
|
|
|
|
src_stage, |
|
|
|
|
dst_stage, |
|
|
|
|
) = match layout_stage { |
|
|
|
|
LayoutStage::Xfer => ( |
|
|
|
|
| LayoutStage::Xfer => ( |
|
|
|
|
vk::ImageLayout::UNDEFINED, |
|
|
|
|
vk::ImageLayout::TRANSFER_DST_OPTIMAL, |
|
|
|
|
vk::AccessFlags::empty(), |
|
|
|
@ -208,7 +203,7 @@ impl IndepImage {
|
|
|
|
|
vk::PipelineStageFlags::TOP_OF_PIPE, |
|
|
|
|
vk::PipelineStageFlags::TRANSFER, |
|
|
|
|
), |
|
|
|
|
LayoutStage::Dpth => ( |
|
|
|
|
| LayoutStage::Dpth => ( |
|
|
|
|
vk::ImageLayout::UNDEFINED, |
|
|
|
|
vk::ImageLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL, |
|
|
|
|
vk::AccessFlags::empty(), |
|
|
|
@ -217,7 +212,7 @@ impl IndepImage {
|
|
|
|
|
vk::PipelineStageFlags::TOP_OF_PIPE, |
|
|
|
|
vk::PipelineStageFlags::EARLY_FRAGMENT_TESTS, |
|
|
|
|
), |
|
|
|
|
LayoutStage::Frag => ( |
|
|
|
|
| LayoutStage::Frag => ( |
|
|
|
|
vk::ImageLayout::TRANSFER_DST_OPTIMAL, |
|
|
|
|
vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL, |
|
|
|
|
vk::AccessFlags::TRANSFER_WRITE, |
|
|
|
@ -265,9 +260,7 @@ impl IndepImage {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn copy_mips_to_image( |
|
|
|
|
&self, |
|
|
|
|
cmd_pool: &CommandPool, |
|
|
|
|
mip: &MipImage, |
|
|
|
|
&self, cmd_pool: &CommandPool, mip: &MipImage, |
|
|
|
|
) -> Result<(), ErrAllocMem> { |
|
|
|
|
let buffer = |
|
|
|
|
Buffer::create_image(cmd_pool.get_device().clone(), mip.data())?; |
|
|
|
@ -324,8 +317,8 @@ impl Image {
|
|
|
|
|
|
|
|
|
|
pub const fn info(&self) -> &ImageInfo { |
|
|
|
|
match self { |
|
|
|
|
Self::Owned(image) => &image.info, |
|
|
|
|
Self::Indep(image) => &image.info, |
|
|
|
|
| Self::Owned(image) => &image.info, |
|
|
|
|
| Self::Indep(image) => &image.info, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -357,8 +350,8 @@ impl std::ops::Deref for Image {
|
|
|
|
|
type Target = vk::Image; |
|
|
|
|
fn deref(&self) -> &Self::Target { |
|
|
|
|
match self { |
|
|
|
|
Self::Owned(image) => &image.handle, |
|
|
|
|
Self::Indep(image) => &image.handle, |
|
|
|
|
| Self::Owned(image) => &image.handle, |
|
|
|
|
| Self::Indep(image) => &image.handle, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|