mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-26 07:54:07 +00:00
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:
parent
0d43ad2ea0
commit
2d11d96b4a
6 changed files with 161 additions and 24 deletions
|
@ -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()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue