Skip to content

Commit ed10890

Browse files
committed
Fix graph compile issues
1 parent 6e17c5c commit ed10890

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

node-graph/gstd/src/wasm_application_io.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ pub use graph_craft::wasm_application_io::*;
2323
pub struct CreateSurfaceNode {}
2424

2525
#[node_macro::node_fn(CreateSurfaceNode)]
26-
async fn create_surface_node<'a: 'input>(editor: &'a WasmEditorApi) -> WasmSurfaceHandle {
27-
editor.application_io.as_ref().unwrap().create_surface()
26+
async fn create_surface_node<'a: 'input>(editor: &'a WasmEditorApi) -> Arc<WasmSurfaceHandle> {
27+
Arc::new(editor.application_io.as_ref().unwrap().create_surface())
2828
}
2929

3030
#[cfg(target_arch = "wasm32")]
@@ -34,8 +34,14 @@ pub struct DrawImageFrameNode<Surface> {
3434

3535
#[node_macro::node_fn(DrawImageFrameNode)]
3636
#[cfg(target_arch = "wasm32")]
37-
async fn draw_image_frame_node<'a: 'input>(image: ImageFrame<SRGBA8>, surface_handle: Arc<WasmSurfaceHandle>) -> SurfaceHandleFrame<HtmlCanvasElement> {
37+
async fn draw_image_frame_node<'a: 'input>(
38+
image: ImageFrame<graphene_core::raster::SRGBA8>,
39+
surface_handle: Arc<WasmSurfaceHandle>,
40+
) -> graphene_core::application_io::SurfaceHandleFrame<HtmlCanvasElement> {
41+
use graphene_core::application_io::SurfaceHandleFrame;
42+
3843
let image_data = image.image.data;
44+
use wasm_bindgen::Clamped;
3945
let array: Clamped<&[u8]> = Clamped(bytemuck::cast_slice(image_data.as_slice()));
4046
if image.image.width > 0 && image.image.height > 0 {
4147
let canvas = &surface_handle.surface;

node-graph/interpreted-executor/src/node_registry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
350350
async_node!(graphene_core::memo::MonitorNode<_, _, _>, input: Footprint, output: Artboard, fn_params: [Footprint => Artboard]),
351351
async_node!(graphene_std::wasm_application_io::LoadResourceNode<_>, input: &WasmEditorApi, output: Arc<[u8]>, params: [String]),
352352
register_node!(graphene_std::wasm_application_io::DecodeImageNode, input: Arc<[u8]>, params: []),
353-
async_node!(graphene_std::wasm_application_io::CreateSurfaceNode, input: &WasmEditorApi, output: WasmSurfaceHandle, params: []),
353+
async_node!(graphene_std::wasm_application_io::CreateSurfaceNode, input: &WasmEditorApi, output: Arc<WasmSurfaceHandle>, params: []),
354354
#[cfg(target_arch = "wasm32")]
355355
async_node!(
356356
graphene_std::wasm_application_io::DrawImageFrameNode<_>,
@@ -615,7 +615,7 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
615615
async_node!(graphene_core::memo::MemoNode<_, _>, input: (), output: ShaderInputFrame, params: [ShaderInputFrame]),
616616
#[cfg(feature = "gpu")]
617617
async_node!(graphene_core::memo::MemoNode<_, _>, input: (), output: wgpu_executor::WgpuSurface, params: [wgpu_executor::WgpuSurface]),
618-
// async_node!(graphene_core::memo::MemoNode<_, _>, input: (), output: wgpu_executor::Surface, params: [wgpu_executor::Surface]),
618+
async_node!(graphene_core::memo::MemoNode<_, _>, input: (), output: wgpu_executor::WindowHandle, params: [wgpu_executor::WindowHandle]),
619619
async_node!(graphene_core::memo::MemoNode<_, _>, input: (), output: SurfaceFrame, params: [SurfaceFrame]),
620620
async_node!(graphene_core::memo::MemoNode<_, _>, input: (), output: RenderOutput, params: [RenderOutput]),
621621
async_node!(graphene_core::memo::ImpureMemoNode<_, _, _>, input: Footprint, output: GraphicGroup, fn_params: [Footprint => GraphicGroup]),

node-graph/wgpu-executor/src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ use graphene_core::application_io::{ApplicationIo, EditorApi, SurfaceHandle};
1414
use graphene_core::raster::color::RGBA16F;
1515
use graphene_core::raster::{Image, ImageFrame};
1616
use graphene_core::transform::{Footprint, Transform};
17-
#[cfg(target_arch = "wasm32")]
18-
use graphene_core::WasmSurfaceHandle;
1917
use graphene_core::{Color, Cow, Node, SurfaceFrame};
2018

2119
use std::pin::Pin;
@@ -463,9 +461,9 @@ impl WgpuExecutor {
463461
fn create_surface(&self, canvas: graphene_core::WasmSurfaceHandle) -> Result<SurfaceHandle<Surface>> {
464462
let surface = self.context.instance.create_surface(wgpu::SurfaceTarget::Canvas(canvas.surface))?;
465463

466-
let surface_caps = surface.get_capabilities(&self.context.adapter);
467-
let surface_format = wgpu::TextureFormat::Rgba16Float;
468-
let config = wgpu::SurfaceConfiguration {
464+
// let surface_caps = surface.get_capabilities(&self.context.adapter);
465+
// let surface_format = wgpu::TextureFormat::Rgba16Float;
466+
/*let config = wgpu::SurfaceConfiguration {
469467
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
470468
format: surface_format,
471469
width: 1920,
@@ -474,9 +472,9 @@ impl WgpuExecutor {
474472
alpha_mode: surface_caps.alpha_modes[0],
475473
view_formats: vec![],
476474
desired_maximum_frame_latency: 2,
477-
};
475+
};*/
478476
// surface.configure(&self.context.device, &config);
479-
self.surface_config.set(Some(config));
477+
// self.surface_config.set(Some(config));
480478
Ok(SurfaceHandle {
481479
surface_id: canvas.surface_id,
482480
surface: Surface(surface),

0 commit comments

Comments
 (0)