Fix the 'Upload Texture' node (#2680)

* Fix upload texture node

* Feature gate gpu node implemenations
This commit is contained in:
Dennis Kobert 2025-05-29 13:35:35 +02:00 committed by GitHub
parent 4d2e1d57fd
commit 76ecdc8f1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 13 deletions

View file

@ -13,7 +13,7 @@ use graphene_core::{fn_type_fut, future};
use graphene_std::Context;
use graphene_std::GraphicElement;
use graphene_std::any::{ComposeTypeErased, DowncastBothNode, DynAnyNode, IntoTypeErasedNode};
use graphene_std::application_io::ImageTexture;
use graphene_std::application_io::{ImageTexture, TextureFrameTable};
use graphene_std::wasm_application_io::*;
use node_registry_macros::{async_node, into_node};
use once_cell::sync::Lazy;
@ -21,12 +21,11 @@ use std::collections::HashMap;
use std::sync::Arc;
#[cfg(feature = "gpu")]
use wgpu_executor::ShaderInputFrame;
use wgpu_executor::{WgpuSurface, WindowHandle};
use wgpu_executor::{WgpuExecutor, WgpuSurface, WindowHandle};
// TODO: turn into hashmap
fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeConstructor>> {
let node_types: Vec<(ProtoNodeIdentifier, NodeConstructor, NodeIOTypes)> = vec![
into_node!(from: f64, to: f64),
into_node!(from: f64, to: f64),
into_node!(from: u32, to: f64),
into_node!(from: u8, to: u32),
@ -113,6 +112,12 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
#[cfg(feature = "gpu")]
async_node!(graphene_core::memo::ImpureMemoNode<_, _, _>, input: Context, fn_params: [Context => ShaderInputFrame]),
#[cfg(feature = "gpu")]
async_node!(graphene_core::memo::ImpureMemoNode<_, _, _>, input: Context, fn_params: [Context => TextureFrameTable]),
#[cfg(feature = "gpu")]
async_node!(graphene_core::memo::MemoNode<_, _>, input: Context, fn_params: [Context => TextureFrameTable]),
#[cfg(feature = "gpu")]
into_node!(from: &WasmEditorApi, to: &WgpuExecutor),
#[cfg(feature = "gpu")]
(
ProtoNodeIdentifier::new(stringify!(wgpu_executor::CreateGpuSurfaceNode<_>)),
|args| {