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

@@ -5,9 +5,9 @@ use core_types::uuid::generate_uuid;
use core_types::{Ctx, ExtractFootprint};
use glam::{Affine2, UVec2, Vec2};
use graph_craft::document::value::{RenderOutput, RenderOutputType};
use graphic_types::raster_types::Texture;
use rendering::{RenderParams, SvgRender, SvgRenderOutput};
use std::fmt::Write;
use std::sync::Arc;
use wgpu::util::DeviceExt;
use wgpu_executor::{AsyncWgpuPipeline, WgpuExecutor, WgpuPipelineCache};
@@ -147,7 +147,7 @@ pub struct CompositeBackgroundArgs<'a> {
impl AsyncWgpuPipeline for CompositeBackground {
type Args<'a> = CompositeBackgroundArgs<'a>;
type Out = Arc<wgpu::Texture>;
type Out = Texture;
fn create(executor: &WgpuExecutor) -> Self {
let device = &executor.context().device;

View File

@@ -6,7 +6,7 @@ use core_types::{CloneVarArgs, Context, Ctx, ExtractAll, ExtractAnimationTime, E
use glam::{DAffine2, DVec2, IVec2, UVec2};
use graph_craft::application_io::PlatformEditorApi;
use graph_craft::document::value::{RenderOutput, RenderOutputType};
use graphene_application_io::ImageTexture;
use graphene_application_io::Texture;
use rendering::{RenderOutputType as RenderOutputTypeRequest, RenderParams};
use std::collections::HashSet;
use std::hash::Hash;
@@ -25,7 +25,7 @@ pub struct TileCoord {
#[derive(Debug, Clone)]
pub struct CachedRegion {
pub texture: ImageTexture,
pub texture: Texture,
pub texture_size: UVec2,
pub tiles: Vec<TileCoord>,
pub metadata: rendering::RenderMetadata,

View File

@@ -2,8 +2,8 @@ use core_types::transform::{Footprint, Transform};
use core_types::{CloneVarArgs, Context, Ctx, ExtractAll, OwnedContextImpl};
use glam::{DAffine2, DVec2, UVec2, Vec2};
use graph_craft::document::value::{RenderOutput, RenderOutputType};
use graphic_types::raster_types::Texture;
use rendering::{RenderOutputType as RenderOutputTypeRequest, RenderParams};
use std::sync::Arc;
use vector_types::vector::style::RenderMode;
use wgpu_executor::{AsyncWgpuPipeline, WgpuExecutor, WgpuPipelineCache};
@@ -65,7 +65,7 @@ pub async fn render_pixel_preview<'a: 'n>(
})
.await;
result.data = RenderOutputType::Texture(resampled.into());
result.data = RenderOutputType::Texture(resampled);
result
.metadata
@@ -99,7 +99,7 @@ pub struct PixelPreviewArgs<'a> {
impl AsyncWgpuPipeline for PixelPreview {
type Args<'a> = PixelPreviewArgs<'a>;
type Out = Arc<wgpu::Texture>;
type Out = Texture;
fn create(executor: &WgpuExecutor) -> Self {
let device = &executor.context().device;