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::{
|
||||
define_device_owned_handle,
|
||||
device::{self, DeviceOwned, QueueFlags},
|
||||
device::{DeviceOwned, QueueFlags},
|
||||
};
|
||||
|
||||
use super::Device;
|
||||
|
@ -237,8 +237,8 @@ impl Image {
|
|||
self.size.depth
|
||||
}
|
||||
|
||||
fn get_parent(self: Arc<Self>) -> Arc<Image> {
|
||||
self.parent.clone().unwrap_or(self)
|
||||
fn get_parent(self: &Arc<Self>) -> Arc<Image> {
|
||||
self.parent.clone().unwrap_or_else(|| self.clone())
|
||||
}
|
||||
|
||||
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()))
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue