diff --git a/Cargo.lock b/Cargo.lock index 757768e115..c39cb7752b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1982,8 +1982,6 @@ version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc46dd3ec48fdd8e693a98d2b8bafae273a2d54c1de02a2a7e3d57d501f39677" dependencies = [ - "bytemuck", - "libm", "serde", ] @@ -2194,7 +2192,6 @@ dependencies = [ "serde", "serde_json", "specta", - "spirv-std", "tinyvec", "tokio", "usvg", @@ -3676,7 +3673,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -5753,34 +5749,6 @@ dependencies = [ "bitflags 2.9.0", ] -[[package]] -name = "spirv-std" -version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu.git#6e2c84d4fe64e32df4c060c5a7f3e35a32e45421" -dependencies = [ - "bitflags 1.3.2", - "glam", - "num-traits", - "spirv-std-macros", - "spirv-std-types", -] - -[[package]] -name = "spirv-std-macros" -version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu.git#6e2c84d4fe64e32df4c060c5a7f3e35a32e45421" -dependencies = [ - "proc-macro2", - "quote", - "spirv-std-types", - "syn 2.0.99", -] - -[[package]] -name = "spirv-std-types" -version = "0.9.0" -source = "git+https://github.com/Rust-GPU/rust-gpu.git#6e2c84d4fe64e32df4c060c5a7f3e35a32e45421" - [[package]] name = "stable_deref_trait" version = "1.2.0" diff --git a/editor/Cargo.toml b/editor/Cargo.toml index 9fc8c7b83c..9b1c3d75cd 100644 --- a/editor/Cargo.toml +++ b/editor/Cargo.toml @@ -15,7 +15,6 @@ default = ["wasm"] wasm = ["wasm-bindgen", "graphene-std/wasm", "wasm-bindgen-futures"] gpu = [ "interpreted-executor/gpu", - "graphene-std/gpu", "wgpu-executor", ] tauri = ["ron", "decouple-execution"] diff --git a/editor/src/messages/portfolio/document/node_graph/node_properties.rs b/editor/src/messages/portfolio/document/node_graph/node_properties.rs index 45d2dda88e..73941c7c4c 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_properties.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_properties.rs @@ -1161,13 +1161,6 @@ pub(crate) fn selective_color_properties(node_id: NodeId, context: &mut NodeProp ] } -#[cfg(feature = "gpu")] -pub(crate) fn _gpu_map_properties(parameter_widgets_info: ParameterWidgetsInfo) -> Vec { - let map = text_widget(parameter_widgets_info); - - vec![LayoutGroup::Row { widgets: map }] -} - pub(crate) fn grid_properties(node_id: NodeId, context: &mut NodePropertiesContext) -> Vec { let grid_type_index = grid::GridTypeInput::INDEX; let spacing_index = grid::SpacingInput::::INDEX; diff --git a/frontend/wasm/Cargo.toml b/frontend/wasm/Cargo.toml index d4b308a494..98280c9759 100644 --- a/frontend/wasm/Cargo.toml +++ b/frontend/wasm/Cargo.toml @@ -29,7 +29,7 @@ editor = { path = "../../editor", package = "graphite-editor", features = [ # Workspace dependencies graph-craft = { workspace = true } log = { workspace = true } -graphene-core = { workspace = true, features = ["std", "alloc"] } +graphene-core = { workspace = true } serde = { workspace = true, features = ["derive"] } wasm-bindgen = { workspace = true } serde-wasm-bindgen = { workspace = true } diff --git a/node-graph/gcore/Cargo.toml b/node-graph/gcore/Cargo.toml index a18f6a4c75..9afddb0520 100644 --- a/node-graph/gcore/Cargo.toml +++ b/node-graph/gcore/Cargo.toml @@ -7,28 +7,13 @@ authors = ["Graphite Authors "] license = "MIT OR Apache-2.0" [features] -default = ["serde", "kurbo", "log", "std", "rand_chacha", "wasm"] -log = ["dep:log"] -gpu = ["spirv-std", "glam/bytemuck", "dyn-any", "glam/libm"] +default = ["serde", "wasm"] nightly = [] -alloc = ["dyn-any", "bezier-rs"] type_id_logging = [] wasm = ["web-sys"] wgpu = ["dep:wgpu"] vello = ["dep:vello", "bezier-rs/kurbo", "wgpu"] -dealloc_nodes = ["reflections"] -std = [ - "dyn-any", - "dyn-any/std", - "alloc", - "glam/std", - "specta", - "num-traits/std", - "rustybuzz", - "image", - "reflections", -] -reflections = ["alloc", "ctor"] +dealloc_nodes = [] serde = [ "dep:serde", "glam/serde", @@ -55,31 +40,30 @@ petgraph = { workspace = true, default-features = false, features = [ ] } rustc-hash = { workspace = true } math-parser = { path = "../../libraries/math-parser" } +dyn-any = { workspace = true } +ctor = { workspace = true } +rand_chacha = { workspace = true } +bezier-rs = { workspace = true } +specta = { workspace = true } +rustybuzz = { workspace = true } +image = { workspace = true, default-features = false, features = [ + "png", +] } # Required dependencies half = { version = "2.4.1", default-features = false, features = ["bytemuck"] } tinyvec = { version = "1" } +kurbo = { workspace = true } +log = { workspace = true } # Optional workspace dependencies -dyn-any = { workspace = true, optional = true } -spirv-std = { workspace = true, optional = true } serde = { workspace = true, optional = true, features = ["derive"] } -ctor = { workspace = true, optional = true } -log = { workspace = true, optional = true } -rand_chacha = { workspace = true, optional = true } -bezier-rs = { workspace = true, optional = true } -kurbo = { workspace = true, optional = true } base64 = { workspace = true, optional = true } vello = { workspace = true, optional = true } wgpu = { workspace = true, optional = true } -specta = { workspace = true, optional = true } -rustybuzz = { workspace = true, optional = true } web-sys = { workspace = true, optional = true, features = [ "HtmlCanvasElement", ] } -image = { workspace = true, optional = true, default-features = false, features = [ - "png", -] } [dev-dependencies] # Workspace dependencies diff --git a/node-graph/gcore/src/application_io.rs b/node-graph/gcore/src/application_io.rs index 09188a5e93..c3c44d6bb5 100644 --- a/node-graph/gcore/src/application_io.rs +++ b/node-graph/gcore/src/application_io.rs @@ -36,7 +36,6 @@ impl Hash for SurfaceFrame { } } -#[cfg(feature = "dyn-any")] unsafe impl StaticType for SurfaceFrame { type Static = SurfaceFrame; } @@ -82,7 +81,6 @@ impl PartialEq for ImageTexture { } } -#[cfg(feature = "dyn-any")] unsafe impl StaticType for ImageTexture { type Static = ImageTexture; } @@ -121,7 +119,6 @@ impl Size for SurfaceHandle { } } -#[cfg(feature = "dyn-any")] unsafe impl StaticType for SurfaceHandle { type Static = SurfaceHandle; } @@ -132,7 +129,6 @@ pub struct SurfaceHandleFrame { pub transform: DAffine2, } -#[cfg(feature = "dyn-any")] unsafe impl StaticType for SurfaceHandleFrame { type Static = SurfaceHandleFrame; } @@ -307,7 +303,6 @@ impl Debug for EditorApi { } } -#[cfg(feature = "dyn-any")] unsafe impl StaticType for EditorApi { type Static = EditorApi; } diff --git a/node-graph/gcore/src/gpu.rs b/node-graph/gcore/src/gpu.rs deleted file mode 100644 index 1bc59f21e6..0000000000 --- a/node-graph/gcore/src/gpu.rs +++ /dev/null @@ -1,20 +0,0 @@ -use crate::Color; -use crate::raster::Sample; -use bytemuck::{Pod, Zeroable}; -use spirv_std::image::{Image2d, SampledImage}; - -#[repr(C)] -#[derive(Clone, Copy, Debug, PartialEq, Eq, Pod, Zeroable)] -pub struct PushConstants { - pub n: u32, - pub node: u32, -} - -impl Sample for SampledImage { - type Pixel = Color; - - fn sample(&self, pos: glam::DVec2, _area: glam::DVec2) -> Option { - let color = self.sample(pos); - Color::from_rgbaf32(color.x, color.y, color.z, color.w) - } -} diff --git a/node-graph/gcore/src/instances.rs b/node-graph/gcore/src/instances.rs index 18abd9820a..6a6918c713 100644 --- a/node-graph/gcore/src/instances.rs +++ b/node-graph/gcore/src/instances.rs @@ -142,7 +142,6 @@ impl PartialEq for Instances { } } -#[cfg(feature = "dyn-any")] unsafe impl StaticType for Instances { type Static = Instances; } diff --git a/node-graph/gcore/src/lib.rs b/node-graph/gcore/src/lib.rs index 1aa71eed73..3bb1e63f8b 100644 --- a/node-graph/gcore/src/lib.rs +++ b/node-graph/gcore/src/lib.rs @@ -1,17 +1,10 @@ -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg(feature = "alloc")] extern crate alloc; -#[cfg(feature = "alloc")] -use core::future::Future; -#[cfg_attr(feature = "log", macro_use)] -#[cfg(feature = "log")] +#[macro_use] extern crate log; pub use crate as graphene_core; pub use num_traits; -#[cfg(feature = "reflections")] pub use ctor; pub mod animation; @@ -23,37 +16,26 @@ pub mod logic; pub mod misc; pub mod ops; pub mod structural; -#[cfg(feature = "std")] pub mod text; -#[cfg(feature = "std")] pub mod uuid; pub mod value; -#[cfg(feature = "gpu")] -pub mod gpu; - -#[cfg(feature = "alloc")] pub mod memo; pub mod raster; -#[cfg(feature = "alloc")] pub mod transform; -#[cfg(feature = "alloc")] mod graphic_element; -#[cfg(feature = "alloc")] pub use graphic_element::*; -#[cfg(feature = "alloc")] pub mod vector; -#[cfg(feature = "alloc")] pub mod application_io; -#[cfg(feature = "reflections")] pub mod registry; pub use context::*; use core::any::TypeId; +use core::future::Future; use core::pin::Pin; pub use dyn_any::{StaticTypeSized, WasmNotSend, WasmNotSync}; pub use memo::MemoHash; @@ -74,16 +56,13 @@ pub trait Node<'i, Input> { core::any::type_name::() } /// Serialize the node which is used for the `introspect` function which can retrieve values from monitor nodes. - #[cfg(feature = "std")] fn serialize(&self) -> Option> { log::warn!("Node::serialize not implemented for {}", core::any::type_name::()); None } } -#[cfg(feature = "alloc")] mod types; -#[cfg(feature = "alloc")] pub use types::*; pub trait NodeIO<'i, Input>: Node<'i, Input> @@ -103,7 +82,6 @@ where fn output_type_name(&self) -> &'static str { core::any::type_name::() } - #[cfg(feature = "alloc")] fn to_node_io(&self, inputs: Vec) -> NodeIOTypes { NodeIOTypes { call_argument: concrete!(::Static), @@ -111,7 +89,6 @@ where inputs, } } - #[cfg(feature = "alloc")] fn to_async_node_io(&self, inputs: Vec) -> NodeIOTypes where ::Output: StaticTypeSized, @@ -138,14 +115,12 @@ impl<'i, I: 'i, N: Node<'i, I> + ?Sized> Node<'i, I> for &'i N { (*self).eval(input) } } -#[cfg(feature = "alloc")] impl<'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for Box { type Output = O; fn eval(&'i self, input: I) -> O { (**self).eval(input) } } -#[cfg(feature = "alloc")] impl<'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for alloc::sync::Arc { type Output = O; fn eval(&'i self, input: I) -> O { @@ -153,7 +128,6 @@ impl<'i, I: 'i, O: 'i, N: Node<'i, I, Output = O> + ?Sized> Node<'i, I> for allo } } -#[cfg(feature = "alloc")] impl<'i, I, O: 'i> Node<'i, I> for Pin + 'i>> { type Output = O; fn eval(&'i self, input: I) -> O { @@ -167,7 +141,6 @@ impl<'i, I, O: 'i> Node<'i, I> for Pin<&'i (dyn NodeIO<'i, I, Output = O> + 'i)> } } -#[cfg(feature = "alloc")] pub use crate::application_io::{SurfaceFrame, SurfaceId}; #[cfg(feature = "wasm")] pub type WasmSurfaceHandle = application_io::SurfaceHandle; diff --git a/node-graph/gcore/src/memo.rs b/node-graph/gcore/src/memo.rs index e7beb14903..1f668e6a99 100644 --- a/node-graph/gcore/src/memo.rs +++ b/node-graph/gcore/src/memo.rs @@ -1,5 +1,4 @@ use crate::{Node, WasmNotSend}; -#[cfg(feature = "alloc")] use alloc::sync::Arc; use core::future::Future; use core::ops::Deref; @@ -106,7 +105,6 @@ pub struct IORecord { pub output: O, } -#[cfg(feature = "alloc")] /// Caches the output of the last graph evaluation for introspection #[derive(Default)] pub struct MonitorNode { @@ -115,7 +113,6 @@ pub struct MonitorNode { node: N, } -#[cfg(feature = "alloc")] impl<'i, T, I, N> Node<'i, I> for MonitorNode where I: Clone + 'static + Send + Sync, @@ -139,7 +136,6 @@ where } } -#[cfg(feature = "alloc")] impl MonitorNode { pub fn new(node: N) -> MonitorNode { MonitorNode { io: Arc::new(Mutex::new(None)), node } @@ -173,7 +169,6 @@ impl serde::Serialize for MemoHash { } } -#[cfg(feature = "std")] impl MemoHash { pub fn new(value: T) -> Self { let hash = Self::calc_hash(&value); diff --git a/node-graph/gcore/src/ops.rs b/node-graph/gcore/src/ops.rs index e34cb48918..1582940b07 100644 --- a/node-graph/gcore/src/ops.rs +++ b/node-graph/gcore/src/ops.rs @@ -495,7 +495,6 @@ fn string_value(_: impl Ctx, _primary: (), string: String) -> String { } /// Meant for debugging purposes, not general use. Returns the size of the input type in bytes. -#[cfg(feature = "std")] #[node_macro::node(category("Debug"))] fn size_of(_: impl Ctx, ty: crate::Type) -> Option { ty.size() @@ -535,8 +534,7 @@ fn extract_xy>(_: impl Ctx, #[implementations(DVec2, IVec2, UVec2 /// The X or Y component of a coordinate. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] #[widget(Dropdown)] pub enum XY { #[default] @@ -587,7 +585,6 @@ impl<'i, N: for<'a> Node<'a, I> + Copy, I: 'i> Copy for TypeNode(PhantomData); impl IntoNode { - #[cfg(feature = "alloc")] pub const fn new() -> Self { Self(core::marker::PhantomData) } diff --git a/node-graph/gcore/src/raster.rs b/node-graph/gcore/src/raster.rs index 0887975f61..1bb62526b6 100644 --- a/node-graph/gcore/src/raster.rs +++ b/node-graph/gcore/src/raster.rs @@ -287,9 +287,7 @@ impl BitmapMut for &mut T { } } -#[cfg(feature = "alloc")] pub use self::image::Image; -#[cfg(feature = "alloc")] pub mod image; trait SetBlendMode { diff --git a/node-graph/gcore/src/raster/adjustments.rs b/node-graph/gcore/src/raster/adjustments.rs index ae389f7cb6..256883fa93 100644 --- a/node-graph/gcore/src/raster/adjustments.rs +++ b/node-graph/gcore/src/raster/adjustments.rs @@ -1,9 +1,7 @@ #![allow(clippy::too_many_arguments)] use crate::raster::curve::{CubicSplines, CurveManipulatorGroup}; -#[cfg(feature = "alloc")] use crate::raster::curve::{Curve, ValueMapperNode}; -#[cfg(feature = "alloc")] use crate::raster::image::{Image, RasterDataTable}; use crate::raster::{Channel, Color, Pixel}; use crate::registry::types::{Angle, Percentage, SignedPercentage}; @@ -34,8 +32,7 @@ use spirv_std::num_traits::float::Float; // https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#:~:text=Color%20Lookup%20(Photoshop%20CS6 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, Hash, node_macro::ChoiceType)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, Hash, node_macro::ChoiceType, specta::Type)] #[widget(Dropdown)] pub enum LuminanceCalculation { #[default] @@ -48,8 +45,7 @@ pub enum LuminanceCalculation { } #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, Hash)] +#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, Hash, specta::Type)] #[repr(i32)] // TODO: Enable Int8 capability for SPIR-V so that we don't need this? pub enum BlendMode { // Basic group @@ -923,8 +919,7 @@ async fn vibrance>( /// Color Channel #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] #[widget(Radio)] pub enum RedGreenBlue { #[default] @@ -935,8 +930,7 @@ pub enum RedGreenBlue { /// Color Channel #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] #[widget(Radio)] pub enum RedGreenBlueAlpha { #[default] @@ -948,8 +942,7 @@ pub enum RedGreenBlueAlpha { /// Style of noise pattern #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] #[widget(Dropdown)] pub enum NoiseType { #[default] @@ -965,8 +958,7 @@ pub enum NoiseType { } #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] /// Style of layered levels of the noise pattern pub enum FractalType { #[default] @@ -983,8 +975,7 @@ pub enum FractalType { /// Distance function used by the cellular noise #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] pub enum CellularDistanceFunction { #[default] Euclidean, @@ -995,8 +986,7 @@ pub enum CellularDistanceFunction { } #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] pub enum CellularReturnType { CellValue, #[default] @@ -1016,8 +1006,7 @@ pub enum CellularReturnType { /// Type of domain warp #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] #[widget(Dropdown)] pub enum DomainWarpType { #[default] @@ -1127,8 +1116,7 @@ async fn channel_mixer>( } #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] #[widget(Radio)] pub enum RelativeAbsolute { #[default] @@ -1138,8 +1126,7 @@ pub enum RelativeAbsolute { #[repr(C)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType)] +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)] pub enum SelectiveColorChoice { #[default] Reds, @@ -1421,7 +1408,6 @@ async fn exposure>( const WINDOW_SIZE: usize = 1024; -#[cfg(feature = "alloc")] #[node_macro::node(category(""))] fn generate_curves(_: impl Ctx, curve: Curve, #[implementations(f32, f64)] _target_format: C) -> ValueMapperNode { use bezier_rs::{Bezier, TValue}; @@ -1462,7 +1448,6 @@ fn generate_curves(_: impl Ctx, curve: Curve ValueMapperNode::new(lut) } -#[cfg(feature = "alloc")] #[node_macro::node(category("Raster: Adjustment"))] fn color_overlay>( _: impl Ctx, @@ -1490,10 +1475,8 @@ fn color_overlay>( image } -// #[cfg(feature = "alloc")] // pub use index_node::IndexNode; -// #[cfg(feature = "alloc")] // mod index_node { // use crate::raster::{Color, Image}; // use crate::Ctx; diff --git a/node-graph/gcore/src/raster/color.rs b/node-graph/gcore/src/raster/color.rs index 58342827f6..eeba91a019 100644 --- a/node-graph/gcore/src/raster/color.rs +++ b/node-graph/gcore/src/raster/color.rs @@ -85,8 +85,7 @@ impl Pixel for RGBA16F {} #[repr(C)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable)] +#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable, specta::Type)] pub struct SRGBA8 { red: u8, green: u8, @@ -167,8 +166,7 @@ impl Pixel for SRGBA8 {} #[repr(C)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable)] +#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable, specta::Type)] pub struct Luma(pub f32); impl Luminance for Luma { @@ -209,8 +207,7 @@ impl Pixel for Luma {} /// the values encode the brightness of each channel proportional to the light intensity in cd/m² (nits) in HDR, and `0.0` (black) to `1.0` (white) in SDR color. #[repr(C)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "std", derive(specta::Type))] -#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable)] +#[derive(Debug, Default, Clone, Copy, PartialEq, DynAny, Pod, Zeroable, specta::Type)] pub struct Color { red: f32, green: f32, @@ -798,7 +795,6 @@ impl Color { /// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61); // Premultiplied alpha /// assert_eq!("3240a261", color.to_rgba_hex_srgb()); // Equivalent hex incorporating premultiplied alpha /// ``` - #[cfg(feature = "std")] pub fn to_rgba_hex_srgb(&self) -> String { let gamma = self.to_gamma_srgb(); format!( @@ -816,7 +812,6 @@ impl Color { /// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61); // Premultiplied alpha /// assert_eq!("3240a2", color.to_rgb_hex_srgb()); // Equivalent hex incorporating premultiplied alpha /// ``` - #[cfg(feature = "std")] pub fn to_rgb_hex_srgb(&self) -> String { self.to_gamma_srgb().to_rgb_hex_srgb_from_gamma() } @@ -827,7 +822,6 @@ impl Color { /// let color = Color::from_rgba8_srgb(0x52, 0x67, 0xFA, 0x61); // Premultiplied alpha /// assert_eq!("3240a2", color.to_rgb_hex_srgb()); // Equivalent hex incorporating premultiplied alpha /// ``` - #[cfg(feature = "std")] pub fn to_rgb_hex_srgb_from_gamma(&self) -> String { format!("{:02x?}{:02x?}{:02x?}", (self.r() * 255.) as u8, (self.g() * 255.) as u8, (self.b() * 255.) as u8) } diff --git a/node-graph/gcore/src/raster/curve.rs b/node-graph/gcore/src/raster/curve.rs index 74342e234f..edf8a5a6e2 100644 --- a/node-graph/gcore/src/raster/curve.rs +++ b/node-graph/gcore/src/raster/curve.rs @@ -174,7 +174,6 @@ pub struct ValueMapperNode { lut: Vec, } -#[cfg(feature = "dyn-any")] unsafe impl StaticType for ValueMapperNode { type Static = ValueMapperNode; } diff --git a/node-graph/gcore/src/raster/image.rs b/node-graph/gcore/src/raster/image.rs index 0a5cf9d2df..ee9c994f06 100644 --- a/node-graph/gcore/src/raster/image.rs +++ b/node-graph/gcore/src/raster/image.rs @@ -62,7 +62,6 @@ impl Debug for Image

{ } } -#[cfg(feature = "dyn-any")] unsafe impl

StaticType for Image

where P: dyn_any::StaticTypeSized + Pixel, @@ -261,7 +260,6 @@ pub fn migrate_image_frame<'de, D: serde::Deserializer<'de>>(deserializer: D) -> } } - #[cfg(feature = "dyn-any")] unsafe impl

StaticType for ImageFrame

where P: dyn_any::StaticTypeSized + Pixel, @@ -358,7 +356,6 @@ pub fn migrate_image_frame_instance<'de, D: serde::Deserializer<'de>>(deserializ } } - #[cfg(feature = "dyn-any")] unsafe impl

StaticType for ImageFrame

where P: dyn_any::StaticTypeSized + Pixel, diff --git a/node-graph/gcore/src/structural.rs b/node-graph/gcore/src/structural.rs index 8ac833d1d2..875315a620 100644 --- a/node-graph/gcore/src/structural.rs +++ b/node-graph/gcore/src/structural.rs @@ -55,7 +55,6 @@ pub struct AsyncComposeNode { phantom: PhantomData, } -#[cfg(feature = "alloc")] impl<'i, Input: 'static, First, Second> Node<'i, Input> for AsyncComposeNode where First: Node<'i, Input>, @@ -71,7 +70,6 @@ where } } -#[cfg(feature = "alloc")] impl<'i, First, Second, Input: 'i> AsyncComposeNode where First: Node<'i, Input>, @@ -95,7 +93,6 @@ pub trait Then<'i, Input: 'i>: Sized { impl<'i, First: Node<'i, Input>, Input: 'i> Then<'i, Input> for First {} -#[cfg(feature = "alloc")] pub trait AndThen<'i, Input: 'i>: Sized { fn and_then(self, second: Second) -> AsyncComposeNode where @@ -107,7 +104,6 @@ pub trait AndThen<'i, Input: 'i>: Sized { } } -#[cfg(feature = "alloc")] impl<'i, First: Node<'i, Input>, Input: 'i> AndThen<'i, Input> for First {} pub struct ConsNode, Root>(pub Root, PhantomData); diff --git a/node-graph/gcore/src/text/to_path.rs b/node-graph/gcore/src/text/to_path.rs index 2552127b97..6b4bfc5e7a 100644 --- a/node-graph/gcore/src/text/to_path.rs +++ b/node-graph/gcore/src/text/to_path.rs @@ -23,7 +23,7 @@ impl Builder { impl OutlineBuilder for Builder { fn move_to(&mut self, x: f32, y: f32) { if !self.current_subpath.is_empty() { - self.other_subpaths.push(core::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false))); + self.other_subpaths.push(std::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false))); } self.current_subpath.push_manipulator_group(ManipulatorGroup::new_anchor_with_id(self.point(x, y), self.id.next_id())); } @@ -47,7 +47,7 @@ impl OutlineBuilder for Builder { fn close(&mut self) { self.current_subpath.set_closed(true); - self.other_subpaths.push(core::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false))); + self.other_subpaths.push(std::mem::replace(&mut self.current_subpath, Subpath::new(Vec::new(), false))); } } @@ -139,7 +139,7 @@ pub fn to_path(str: &str, buzz_face: Option, typesetting: Types builder.offset = DVec2::new(glyph_position.x_offset as f64, glyph_position.y_offset as f64) * builder.scale; buzz_face.outline_glyph(glyph_id, &mut builder); if !builder.current_subpath.is_empty() { - builder.other_subpaths.push(core::mem::replace(&mut builder.current_subpath, Subpath::new(Vec::new(), false))); + builder.other_subpaths.push(std::mem::replace(&mut builder.current_subpath, Subpath::new(Vec::new(), false))); } builder.text_cursor += DVec2::new(glyph_position.x_advance as f64 * typesetting.character_spacing, glyph_position.y_advance as f64) * builder.scale; diff --git a/node-graph/gcore/src/types.rs b/node-graph/gcore/src/types.rs index b65668d1c4..8bad9514c3 100644 --- a/node-graph/gcore/src/types.rs +++ b/node-graph/gcore/src/types.rs @@ -1,8 +1,5 @@ use core::any::TypeId; -#[cfg(not(feature = "std"))] -pub use alloc::borrow::Cow; -#[cfg(feature = "std")] pub use std::borrow::Cow; #[macro_export] @@ -215,7 +212,6 @@ impl Default for Type { } } -#[cfg(feature = "dyn-any")] unsafe impl dyn_any::StaticType for Type { type Static = Self; } diff --git a/node-graph/graph-craft/Cargo.toml b/node-graph/graph-craft/Cargo.toml index 2c09d01bb5..71e7180948 100644 --- a/node-graph/graph-craft/Cargo.toml +++ b/node-graph/graph-craft/Cargo.toml @@ -22,7 +22,7 @@ dyn-any = { path = "../../libraries/dyn-any", features = [ ] } # Workspace dependencies -graphene-core = { workspace = true, features = ["std"] } +graphene-core = { workspace = true } log = { workspace = true } glam = { workspace = true } bezier-rs = { workspace = true } diff --git a/node-graph/graphene-cli/Cargo.toml b/node-graph/graphene-cli/Cargo.toml index 00bafb1002..87e0e679f8 100644 --- a/node-graph/graphene-cli/Cargo.toml +++ b/node-graph/graphene-cli/Cargo.toml @@ -15,7 +15,6 @@ passthrough = ["wgpu-executor/passthrough"] gpu = [ "interpreted-executor/gpu", "graphene-std/gpu", - "graphene-core/gpu", "wgpu-executor", ] diff --git a/node-graph/gstd/Cargo.toml b/node-graph/gstd/Cargo.toml index 74b222faff..80fd05a1f8 100644 --- a/node-graph/gstd/Cargo.toml +++ b/node-graph/gstd/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" [features] default = ["wasm", "imaginate"] -gpu = [ "graphene-core/gpu" ] +gpu = [] wgpu = ["gpu", "graph-craft/wgpu"] wasm = ["wasm-bindgen", "web-sys"] imaginate = ["image/png", "base64", "web-sys", "wasm-bindgen-futures"] @@ -22,11 +22,7 @@ wayland = ["graph-craft/wayland"] dyn-any = { path = "../../libraries/dyn-any", features = ["derive", "reqwest"] } graph-craft = { path = "../graph-craft", features = ["serde"] } wgpu-executor = { path = "../wgpu-executor" } -graphene-core = { path = "../gcore", default-features = false, features = [ - "std", - "serde", - "alloc", -] } +graphene-core = { path = "../gcore", default-features = false, features = ["serde"] } # Workspace dependencies fastnoise-lite = { workspace = true } diff --git a/node-graph/interpreted-executor/Cargo.toml b/node-graph/interpreted-executor/Cargo.toml index 87787ee3e5..03c70e9e82 100644 --- a/node-graph/interpreted-executor/Cargo.toml +++ b/node-graph/interpreted-executor/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" [features] default = [] serde = ["dep:serde", "graphene-std/serde", "glam/serde"] -gpu = ["graphene-std/gpu", "graphene-core/gpu", "graphene-std/wgpu"] +gpu = ["graphene-std/gpu", "graphene-std/wgpu"] [dependencies] # Local dependencies @@ -16,7 +16,7 @@ graph-craft = { path = "../graph-craft" } wgpu-executor = { path = "../wgpu-executor" } # Workspace dependencies -graphene-core = { workspace = true, features = ["std"] } +graphene-core = { workspace = true } dyn-any = { workspace = true, features = ["log-bad-types", "glam"] } log = { workspace = true } glam = { workspace = true } diff --git a/node-graph/wgpu-executor/Cargo.toml b/node-graph/wgpu-executor/Cargo.toml index 852d70c3e4..ecbfc7bcb1 100644 --- a/node-graph/wgpu-executor/Cargo.toml +++ b/node-graph/wgpu-executor/Cargo.toml @@ -11,7 +11,7 @@ passthrough = [] [dependencies] # Workspace dependencies -graphene-core = { workspace = true, features = ["std", "alloc", "gpu", "wgpu"] } +graphene-core = { workspace = true, features = ["wgpu"] } dyn-any = { workspace = true, features = ["log-bad-types", "rc", "glam"] } node-macro = { workspace = true } glam = { workspace = true }