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

@@ -1,6 +1,6 @@
use dyn_any::DynAny;
#[cfg(feature = "wgpu")]
use graphene_application_io::ImageTexture;
use graphene_application_io::Texture;
use std::sync::Arc;
use std::sync::atomic::{AtomicU64, Ordering};
use web_sys::js_sys::{Object, Reflect};
@@ -23,7 +23,7 @@ pub trait Canvas {
#[cfg(feature = "wgpu")]
pub trait CanvasSurface: Canvas {
fn present(&mut self, image_texture: &ImageTexture, executor: &WgpuExecutor);
fn present(&mut self, texture: &Texture, executor: &WgpuExecutor);
}
#[derive(Clone, DynAny)]
@@ -85,10 +85,10 @@ impl Canvas for CanvasSurfaceHandle {
}
#[cfg(feature = "wgpu")]
impl CanvasSurface for CanvasSurfaceHandle {
fn present(&mut self, image_texture: &ImageTexture, executor: &WgpuExecutor) {
fn present(&mut self, texture: &Texture, executor: &WgpuExecutor) {
let context = executor.context();
let source_texture: &wgpu::Texture = image_texture.as_ref();
let source_texture: &wgpu::Texture = texture.as_ref();
let surface = self.surface(executor);