Image: allow alias on &Arc<Self>, then clone parent or self
This commit is contained in:
parent
208b1569d6
commit
9334e8fa9e
|
@ -2,7 +2,7 @@ use std::{borrow::Cow, collections::HashMap, sync::Arc};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
define_device_owned_handle,
|
define_device_owned_handle,
|
||||||
device::{self, DeviceOwned, QueueFlags},
|
device::{DeviceOwned, QueueFlags},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::Device;
|
use super::Device;
|
||||||
|
@ -237,8 +237,8 @@ impl Image {
|
||||||
self.size.depth
|
self.size.depth
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_parent(self: Arc<Self>) -> Arc<Image> {
|
fn get_parent(self: &Arc<Self>) -> Arc<Image> {
|
||||||
self.parent.clone().unwrap_or(self)
|
self.parent.clone().unwrap_or_else(|| self.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_alloc(&self) -> Option<&vk_mem::Allocation> {
|
fn get_alloc(&self) -> Option<&vk_mem::Allocation> {
|
||||||
|
@ -247,7 +247,7 @@ impl Image {
|
||||||
.or(self.parent.as_ref().and_then(|image| image.get_alloc()))
|
.or(self.parent.as_ref().and_then(|image| image.get_alloc()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn get_alias(self: Arc<Self>, desc: ImageDesc) -> VkResult<Arc<Self>> {
|
pub unsafe fn get_alias(self: &Arc<Self>, desc: ImageDesc) -> VkResult<Arc<Self>> {
|
||||||
self.get_parent().get_alias_inner(desc)
|
self.get_parent().get_alias_inner(desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue