mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 13:02:20 +00:00
Deprecate LetNodes in favor of new scope API (#1814)
* WIP * Start deprecating let nodes * Replace WasmEditorApi network imports with new Scope input * Add missing unwrap * Add #[serde(default)] to scope_injections * Restructure WasmEditorApi definition to be available as a TaggedValue * Fix text node * Use stable toolchain in nix shell again * Code review * FIx text node and remove all remaining warnings * Require executor input to be 'static --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
a17ed68008
commit
3657b37574
55 changed files with 774 additions and 980 deletions
|
@ -1,14 +1,12 @@
|
|||
use bytemuck::{Pod, Zeroable};
|
||||
use graph_craft::proto::ProtoNetwork;
|
||||
use dyn_any::{StaticType, StaticTypeSized};
|
||||
use graphene_core::application_io::{ApplicationIo, EditorApi, SurfaceHandle};
|
||||
use graphene_core::raster::{Image, ImageFrame, Pixel, SRGBA8};
|
||||
use graphene_core::*;
|
||||
|
||||
use anyhow::Result;
|
||||
use dyn_any::{StaticType, StaticTypeSized};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use futures::Future;
|
||||
use glam::{DAffine2, UVec3};
|
||||
use graphene_core::application_io::{ApplicationIo, EditorApi, SurfaceHandle};
|
||||
use graphene_core::raster::{Image, ImageFrame, Pixel, SRGBA8};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
|
@ -61,15 +59,9 @@ pub trait GpuExecutor {
|
|||
fn create_surface(&self, window: SurfaceHandle<Self::Window>) -> Result<SurfaceHandle<Self::Surface<'_>>>;
|
||||
}
|
||||
|
||||
pub trait SpirVCompiler {
|
||||
fn compile(&self, network: &[ProtoNetwork], io: &ShaderIO) -> Result<Shader>;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub struct CompileRequest {
|
||||
pub networks: Vec<ProtoNetwork>,
|
||||
pub io: ShaderIO,
|
||||
}
|
||||
// pub trait SpirVCompiler {
|
||||
// fn compile(&self, network: &[ProtoNetwork], io: &ShaderIO) -> Result<Shader>;
|
||||
// }
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
/// GPU constants that can be used as inputs to a shader.
|
||||
|
@ -496,9 +488,9 @@ async fn read_output_buffer_node<'a: 'input, E: 'a + GpuExecutor>(buffer: Arc<Sh
|
|||
pub struct CreateGpuSurfaceNode {}
|
||||
|
||||
#[node_macro::node_fn(CreateGpuSurfaceNode)]
|
||||
async fn create_gpu_surface<'a: 'input, E: 'a + GpuExecutor<Window = Io::Surface>, Io: ApplicationIo<Executor = E>>(editor_api: EditorApi<'a, Io>) -> Arc<SurfaceHandle<E::Surface<'a>>> {
|
||||
let canvas = editor_api.application_io.create_surface();
|
||||
let executor = editor_api.application_io.gpu_executor().unwrap();
|
||||
async fn create_gpu_surface<'a: 'input, E: 'a + GpuExecutor<Window = Io::Surface>, Io: ApplicationIo<Executor = E> + 'input>(editor_api: &'a EditorApi<Io>) -> Arc<SurfaceHandle<E::Surface<'a>>> {
|
||||
let canvas = editor_api.application_io.as_ref().unwrap().create_surface();
|
||||
let executor = editor_api.application_io.as_ref().unwrap().gpu_executor().unwrap();
|
||||
Arc::new(executor.create_surface(canvas).unwrap())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue