Re-add upload texture (#2915)

* vello: code cleanup of resource overwrites

* upload_texture: upload cpu textures as SRGBA8

* vello: fix wgpu::Texture leak within vello's `context.resource_overrides` HashMap

* fix missing feature gate
This commit is contained in:
Firestar99 2025-07-24 12:51:03 +02:00 committed by GitHub
parent 0d43ad2ea0
commit 2d11d96b4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 161 additions and 24 deletions

View file

@ -1,4 +1,5 @@
mod context;
pub mod texture_upload;
use anyhow::Result;
pub use context::Context;
@ -111,20 +112,19 @@ impl WgpuExecutor {
{
let mut renderer = self.vello_renderer.lock().await;
for (id, texture) in context.resource_overrides.iter() {
let texture = texture.clone();
for (image, texture) in context.resource_overrides.iter() {
let texture_view = wgpu::TexelCopyTextureInfoBase {
texture,
texture: texture.clone(),
mip_level: 0,
origin: Origin3d::ZERO,
aspect: TextureAspect::All,
};
renderer.override_image(
&vello::peniko::Image::new(vello::peniko::Blob::from_raw_parts(Arc::new(vec![]), *id), vello::peniko::ImageFormat::Rgba8, 0, 0),
Some(texture_view),
);
renderer.override_image(image, Some(texture_view));
}
renderer.render_to_texture(&self.context.device, &self.context.queue, scene, &target_texture.view, &render_params)?;
for (image, _) in context.resource_overrides.iter() {
renderer.override_image(image, None);
}
}
let surface_texture = surface_inner.get_current_texture()?;