Skip to content

Commit

Permalink
Restore old initial/final layout requirement bahavior (#2288)
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0246 authored Aug 16, 2023
1 parent 54d20c0 commit db3df4e
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion vulkano/src/image/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,10 +1156,34 @@ impl RawImage {
return Err((VulkanError::from(err), self, allocations.into_iter()));
}

let usage = self
.usage
.difference(ImageUsage::TRANSFER_SRC | ImageUsage::TRANSFER_DST);

let layout = if usage.intersects(ImageUsage::SAMPLED | ImageUsage::INPUT_ATTACHMENT)
&& usage
.difference(ImageUsage::SAMPLED | ImageUsage::INPUT_ATTACHMENT)
.is_empty()
{
ImageLayout::ShaderReadOnlyOptimal
} else if usage.intersects(ImageUsage::COLOR_ATTACHMENT)
&& usage.difference(ImageUsage::COLOR_ATTACHMENT).is_empty()
{
ImageLayout::ColorAttachmentOptimal
} else if usage.intersects(ImageUsage::DEPTH_STENCIL_ATTACHMENT)
&& usage
.difference(ImageUsage::DEPTH_STENCIL_ATTACHMENT)
.is_empty()
{
ImageLayout::DepthStencilAttachmentOptimal
} else {
ImageLayout::General
};

Ok(Image::from_raw(
self,
ImageMemory::Normal(allocations),
ImageLayout::General,
layout,
))
}

Expand Down

0 comments on commit db3df4e

Please sign in to comment.