Skip to content

Commit ed617a4

Browse files
committed
Use direct texture copy instead of bitter and fix graphene_cli
1 parent 97fcf76 commit ed617a4

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

editor/src/node_graph_executor/runtime.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use interpreted_executor::util::wrap_network_in_scope;
2626
use spin::Mutex;
2727
use std::sync::Arc;
2828
use std::sync::mpsc::{Receiver, Sender};
29+
use vello::wgpu::TexelCopyTextureInfoBase;
2930

3031
/// Persistent data between graph executions. It's updated via message passing from the editor thread with [`GraphRuntimeRequest`]`.
3132
/// Some of these fields are put into a [`WasmEditorApi`] which is passed to the final compiled graph network upon each execution.
@@ -358,12 +359,20 @@ impl NodeRuntime {
358359
let surface_texture = surface_inner.get_current_texture().expect("Failed to get surface texture");
359360
self.current_viewport_texture = Some(image_texture.clone());
360361

361-
// Blit the rendered texture to the surface
362-
surface.surface.blitter.copy(
363-
&executor.context.device,
364-
&mut encoder,
365-
&image_texture.texture.create_view(&vello::wgpu::TextureViewDescriptor::default()),
366-
&surface_texture.texture.create_view(&vello::wgpu::TextureViewDescriptor::default()),
362+
encoder.copy_texture_to_texture(
363+
TexelCopyTextureInfoBase {
364+
texture: image_texture.texture.as_ref(),
365+
mip_level: 0,
366+
origin: Default::default(),
367+
aspect: Default::default(),
368+
},
369+
TexelCopyTextureInfoBase {
370+
texture: &surface_texture.texture,
371+
mip_level: 0,
372+
origin: Default::default(),
373+
aspect: Default::default(),
374+
},
375+
image_texture.texture.size(),
367376
);
368377

369378
executor.context.queue.submit([encoder.finish()]);

node-graph/graphene-cli/src/export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub async fn export_document(
6666
}
6767
RenderOutputType::Texture(image_texture) => {
6868
// Convert GPU texture to CPU buffer
69-
let gpu_raster = Raster::<GPU>::new_gpu(image_texture.texture);
69+
let gpu_raster = Raster::<GPU>::new_gpu(image_texture.texture.as_ref().clone());
7070
let cpu_raster: Raster<CPU> = gpu_raster.convert(Footprint::BOUNDLESS, wgpu_executor).await;
7171
let (data, width, height) = cpu_raster.to_flat_u8();
7272

0 commit comments

Comments
 (0)