This commit is contained in:
marc0246 2023-01-15 15:37:40 +01:00 committed by GitHub
parent f3205183ed
commit 046af69be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1024,12 +1024,16 @@ impl RawImage {
}
};
let memory_requirements = if flags.intersects(ImageCreateFlags::DISJOINT) {
(0..format.unwrap().planes().len())
.map(|plane| Self::get_memory_requirements(&device, handle, Some(plane)))
.collect()
let memory_requirements = if needs_destruction {
if flags.intersects(ImageCreateFlags::DISJOINT) {
(0..format.unwrap().planes().len())
.map(|plane| Self::get_memory_requirements(&device, handle, Some(plane)))
.collect()
} else {
smallvec![Self::get_memory_requirements(&device, handle, None)]
}
} else {
smallvec![Self::get_memory_requirements(&device, handle, None)]
smallvec![]
};
RawImage {
@ -1605,6 +1609,7 @@ impl RawImage {
/// Returns the memory requirements for this image.
///
/// - If the image is a swapchain image, this returns a slice with a length of 0.
/// - If `self.flags().disjoint` is not set, this returns a slice with a length of 1.
/// - If `self.flags().disjoint` is set, this returns a slice with a length equal to
/// `self.format().unwrap().planes().len()`.
@ -2086,6 +2091,7 @@ impl Image {
/// Returns the memory requirements for this image.
///
/// - If the image is a swapchain image, this returns a slice with a length of 0.
/// - If `self.flags().disjoint` is not set, this returns a slice with a length of 1.
/// - If `self.flags().disjoint` is set, this returns a slice with a length equal to
/// `self.format().unwrap().planes().len()`.