mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
Fix lifetime of cached textures (#4333)
* Fix in-use textures being destroyed * Remove ImageTexture refs * Review
This commit is contained in:
@@ -11,35 +11,10 @@ use vector_types::vector::style::RenderMode;
|
||||
pub use graphene_resource as resource;
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq, DynAny)]
|
||||
pub struct ImageTexture(Arc<wgpu::Texture>);
|
||||
#[cfg(feature = "wgpu")]
|
||||
impl AsRef<wgpu::Texture> for ImageTexture {
|
||||
fn as_ref(&self) -> &wgpu::Texture {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wgpu")]
|
||||
impl From<wgpu::Texture> for ImageTexture {
|
||||
fn from(texture: wgpu::Texture) -> Self {
|
||||
Self(Arc::new(texture))
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wgpu")]
|
||||
impl From<Arc<wgpu::Texture>> for ImageTexture {
|
||||
fn from(texture: Arc<wgpu::Texture>) -> Self {
|
||||
Self(texture)
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "wgpu")]
|
||||
impl From<ImageTexture> for Arc<wgpu::Texture> {
|
||||
fn from(image_texture: ImageTexture) -> Self {
|
||||
image_texture.0
|
||||
}
|
||||
}
|
||||
pub use raster_types::Texture;
|
||||
#[cfg(not(feature = "wgpu"))]
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq, DynAny)]
|
||||
pub struct ImageTexture;
|
||||
pub struct Texture; // TODO: Consider removing this
|
||||
|
||||
pub trait ApplicationIo {
|
||||
type Executor;
|
||||
|
||||
Reference in New Issue
Block a user