Fix lifetime of cached textures (#4333)

* Fix in-use textures being destroyed

* Remove ImageTexture refs

* Review
This commit is contained in:
Timon
2026-07-14 13:23:31 +02:00
committed by Keavon Chambers
parent ba0a97aefe
commit 7e29fe9a31
18 changed files with 100 additions and 79 deletions

View File

@@ -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;