Refactor Graphite dependency management (#1455)

* Refactor Graphite dependency management

* Remove deprecated future executor

* Code review nits

* Remove unused dependencies

* Update dependencies and make compile with all features

* Replace use of future_executor with wasm-bindgen-futures

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2023-12-04 12:39:55 +01:00
committed by GitHub
co-authored by Keavon Chambers
parent b7fe38cf31
commit d2450b4d61
34 changed files with 1584 additions and 1209 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ jobs:
- name: 🦀 Build Rust code - name: 🦀 Build Rust code
run: | run: |
mold -run cargo build mold -run cargo build --all-features
- name: 🧪 Run Rust tests - name: 🧪 Run Rust tests
run: | run: |
Generated
+1160 -850
View File
File diff suppressed because it is too large Load Diff
+53 -1
View File
@@ -16,7 +16,6 @@ members = [
"node-graph/vulkan-executor", "node-graph/vulkan-executor",
"node-graph/wgpu-executor", "node-graph/wgpu-executor",
"node-graph/gpu-executor", "node-graph/gpu-executor",
"node-graph/future-executor",
"node-graph/gpu-compiler/gpu-compiler-bin-wrapper", "node-graph/gpu-compiler/gpu-compiler-bin-wrapper",
"libraries/dyn-any", "libraries/dyn-any",
"libraries/bezier-rs", "libraries/bezier-rs",
@@ -38,6 +37,59 @@ specta = { git = "https://github.com/0HyperCube/specta.git", rev = "c47a22b4c086
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
# wasm-bindgen upgrades may break various things so we pin the version # wasm-bindgen upgrades may break various things so we pin the version
wasm-bindgen = "=0.2.87" wasm-bindgen = "=0.2.87"
dyn-any = { path = "libraries/dyn-any", features = ["derive", "glam"] }
document-legacy = { path = "document-legacy", package = "graphite-document-legacy" }
graphene-core = { path = "node-graph/gcore" }
graph-craft = { path = "node-graph/graph-craft", features = ["serde"] }
spirv-std = { version = "0.9" }
bytemuck = { version = "1.13", features = ["derive"] }
async-trait = { version = "0.1" }
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
reqwest = { version = "0.11", features = ["rustls", "rustls-tls", "json"] }
futures = "0.3"
log = { version = "0.4" }
bitflags = { version = "2.4", features = ["serde"] }
remain = "0.2.2"
derivative = "2.2.0"
tempfile = "3"
thiserror = "1.0"
anyhow = "1.0.66"
proc-macro2 = "1"
syn = { version = "2.0", default-features = false, features = ["full"] }
quote = "1.0"
axum = "0.6"
chrono = "^0.4.23"
ron = "0.8"
wgpu-types = "0.17"
wgpu = "0.17"
wasm-bindgen-futures = { version = "0.4.36" }
winit = "0.28.6"
url = "2.4.0"
tokio = { version = "1.29", features = ["fs", "io-std"] }
vello = { git = "https://github.com/linebender/vello", version = "0.0.1" }
vello_svg = { git = "https://github.com/linebender/vello", version = "0.0.1" }
resvg = { version = "0.35.0" }
rand = { version = "0.8.5", default-features = false }
rand_chacha = { version = "0.3.1" }
bezier-rs = { path = "libraries/bezier-rs", features = ["dyn-any"] }
kurbo = { git = "https://github.com/linebender/kurbo.git", features = [
"serde",
] }
glam = { version = "0.24", default-features = false, features = ["serde"] }
node-macro = { path = "node-graph/node-macro" }
base64 = { version = "0.21" }
image = { version = "0.24", default-features = false, features = ["png"] }
rustybuzz = { version = "0.8.0" }
num-derive = { version = "0.4" }
num-traits = { version = "0.2.15", default-features = false, features = [
"i128",
] }
js-sys = { version = "0.3.55" }
usvg = "0.35.0"
web-sys = { version = "0.3.55" }
spirv = "0.2.0"
fern = { version = "0.6", features = ["colored"] }
[profile.dev.package.graphite-editor] [profile.dev.package.graphite-editor]
opt-level = 1 opt-level = 1
+10 -14
View File
@@ -13,17 +13,13 @@ license = "Apache-2.0"
[dependencies] [dependencies]
graph-craft = { path = "../node-graph/graph-craft", features = ["serde"] } graph-craft = { path = "../node-graph/graph-craft", features = ["serde"] }
graphene-std = { path = "../node-graph/gstd", features = ["serde"] } graphene-std = { path = "../node-graph/gstd", features = ["serde"] }
graphene-core = { path = "../node-graph/gcore", features = ["serde"] } graphene-core = { workspace = true, features = ["serde"] }
image = { version = "0.24", default-features = false } image = { workspace = true, default-features = false }
log = { workspace = true }
log = "0.4" bezier-rs = { workspace = true }
kurbo = { workspace = true }
bezier-rs = { path = "../libraries/bezier-rs" } specta = { workspace = true }
kurbo = { git = "https://github.com/linebender/kurbo.git", features = [ serde = { workspace = true }
"serde", base64 = { workspace = true }
] } glam = { workspace = true }
specta.workspace = true rustybuzz = { workspace = true }
serde = { version = "1.0", features = ["derive"] }
base64 = "0.21"
glam = { version = "0.24", features = ["serde"] }
rustybuzz = "0.8"
+24 -26
View File
@@ -12,49 +12,47 @@ license = "Apache-2.0"
[features] [features]
default = ["wasm"] default = ["wasm"]
gpu = ["interpreted-executor/gpu", "graphene-std/gpu", "graphene-core/gpu", "wgpu-executor", "gpu-executor"] gpu = [
"interpreted-executor/gpu",
"graphene-std/gpu",
"graphene-core/gpu",
"wgpu-executor",
"gpu-executor",
]
quantization = [ quantization = [
"graphene-std/quantization", "graphene-std/quantization",
"interpreted-executor/quantization", "interpreted-executor/quantization",
] ]
wasm = ["wasm-bindgen", "future-executor", "graphene-std/wasm"] wasm = ["wasm-bindgen", "graphene-std/wasm", "wasm-bindgen-futures"]
[dependencies] [dependencies]
log = "0.4" log = { workspace = true }
bitflags = { version = "2.3", features = ["serde"] } bitflags = { workspace = true }
thiserror = "1.0" thiserror = { workspace = true }
serde = { version = "1.0", features = ["derive"] } serde = { workspace = true }
serde_json = { version = "1.0" } serde_json = { workspace = true }
graphite-proc-macros = { path = "../proc-macros" } graphite-proc-macros = { path = "../proc-macros" }
bezier-rs = { path = "../libraries/bezier-rs" } bezier-rs = { workspace = true }
glam = { version = "0.24", features = ["serde", "debug-glam-assert"] } glam = { workspace = true, features = ["serde", "debug-glam-assert"] }
remain = "0.2.2" remain = { workspace = true }
derivative = "2.2.0" derivative = { workspace = true }
once_cell = "1.13.0" # Remove when `core::cell::LazyCell` is stabilized (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>)
specta.workspace = true specta.workspace = true
image = { workspace = true, features = ["bmp", "png"] }
# Node graph
image = { version = "0.24", default-features = false, features = [
"bmp",
"png",
] }
graph-craft = { path = "../node-graph/graph-craft" } graph-craft = { path = "../node-graph/graph-craft" }
wgpu-executor = { path = "../node-graph/wgpu-executor", optional = true } wgpu-executor = { path = "../node-graph/wgpu-executor", optional = true }
gpu-executor = { path = "../node-graph/gpu-executor", optional = true } gpu-executor = { path = "../node-graph/gpu-executor", optional = true }
interpreted-executor = { path = "../node-graph/interpreted-executor" } interpreted-executor = { path = "../node-graph/interpreted-executor" }
dyn-any = { path = "../libraries/dyn-any" } dyn-any = { workspace = true }
graphene-core = { path = "../node-graph/gcore" } graphene-core = { path = "../node-graph/gcore" }
graphene-std = { path = "../node-graph/gstd" } graphene-std = { path = "../node-graph/gstd" }
future-executor = { path = "../node-graph/future-executor", optional = true }
num_enum = "0.6.1" num_enum = "0.6.1"
wasm-bindgen = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true }
wasm-bindgen-futures = { workspace = true, optional = true }
[dependencies.document-legacy] document-legacy = { workspace = true }
path = "../document-legacy" # Remove when `core::cell::LazyCell` is stabilized (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>)
package = "graphite-document-legacy" once_cell = "1.13.0"
[dev-dependencies] [dev-dependencies]
env_logger = "0.10" env_logger = "0.10"
test-case = "3.1" test-case = "3.1"
futures = "0.3.28" futures = { workspace = true }
@@ -293,7 +293,7 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
self.persistent_data.imaginate.poll_server_check(); self.persistent_data.imaginate.poll_server_check();
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
if let Some(fut) = self.persistent_data.imaginate.initiate_server_check() { if let Some(fut) = self.persistent_data.imaginate.initiate_server_check() {
future_executor::spawn(async move { wasm_bindgen_futures::spawn_local(async move {
let () = fut.await; let () = fut.await;
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
+17 -12
View File
@@ -15,24 +15,29 @@ rust-version = "1.66.0"
tauri-build = { version = "1.2", features = [] } tauri-build = { version = "1.2", features = [] }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = { workspace = true }
serde = { version = "1.0", features = ["derive"] } serde = { workspace = true }
tauri = { version = "1.2", features = ["api-all", "devtools", "linux-protocol-headers", "wry"] } tauri = { version = "1.5", features = [
axum = "0.6.1" "api-all",
graphite-editor = { version = "0.0.0", path = "../../editor" } "devtools",
chrono = "^0.4.23" "linux-protocol-headers",
tokio = { version = "1", features = ["full"] } "wry",
ron = "0.8" ] }
log = "0.4" axum = { workspace = true }
fern = { version = "0.6", features = ["colored"] } graphite-editor = { path = "../../editor" }
futures = "0.3.25" chrono = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
ron = { workspace = true }
log = { workspace = true }
fern = { workspace = true }
futures = { workspace = true }
[features] [features]
gpu = ["graphite-editor/gpu"] gpu = ["graphite-editor/gpu"]
quantization = ["graphite-editor/quantization"] quantization = ["graphite-editor/quantization"]
# by default Tauri runs in production mode # by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL # when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ] default = ["custom-protocol"]
# this feature is used for production builds where `devPath` points to the filesystem # this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this # DO NOT remove this
custom-protocol = ["tauri/custom-protocol"] custom-protocol = ["tauri/custom-protocol"]
+10 -17
View File
@@ -20,27 +20,23 @@ crate-type = ["cdylib", "rlib"]
[dependencies] [dependencies]
editor = { path = "../../editor", package = "graphite-editor" } editor = { path = "../../editor", package = "graphite-editor" }
document-legacy = { path = "../../document-legacy", package = "graphite-document-legacy" } document-legacy = { workspace = true }
graph-craft = { path = "../../node-graph/graph-craft" } graph-craft = { workspace = true }
log = "0.4" log = { workspace = true }
graphene-core = { path = "../../node-graph/gcore", features = [ graphene-core = { workspace = true, features = ["std", "alloc"] }
"async", serde = { workspace = true, features = ["derive"] }
"std",
"alloc",
] }
serde = { version = "1.0", features = ["derive"] }
wasm-bindgen = { workspace = true } wasm-bindgen = { workspace = true }
serde-wasm-bindgen = "0.5.0" serde-wasm-bindgen = "0.6"
js-sys = "0.3.63" js-sys = { workspace = true }
wasm-bindgen-futures = "0.4.36" wasm-bindgen-futures = { workspace = true }
ron = { version = "0.8", optional = true } ron = { version = "0.8", optional = true }
bezier-rs = { path = "../../libraries/bezier-rs" } bezier-rs = { workspace = true }
# We don't have wgpu on multiple threads (yet) https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#wgpu-types-now-send-sync-on-wasm # We don't have wgpu on multiple threads (yet) https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#wgpu-types-now-send-sync-on-wasm
wgpu = { version = "0.17", features = ["fragile-send-sync-non-atomic-wasm"] } wgpu = { version = "0.17", features = ["fragile-send-sync-non-atomic-wasm"] }
meval = "0.2.0" meval = "0.2.0"
[dependencies.web-sys] [dependencies.web-sys]
version = "0.3.4" workspace = true
features = [ features = [
"Window", "Window",
"CanvasRenderingContext2d", "CanvasRenderingContext2d",
@@ -48,9 +44,6 @@ features = [
"HtmlCanvasElement", "HtmlCanvasElement",
] ]
[dev-dependencies]
wasm-bindgen-test = "0.3.22"
[package.metadata.wasm-pack.profile.dev] [package.metadata.wasm-pack.profile.dev]
wasm-opt = false wasm-opt = false
+2 -2
View File
@@ -16,5 +16,5 @@ documentation = "https://graphite.rs/libraries/bezier-rs/"
[dependencies] [dependencies]
glam = { version = "0.24", features = ["serde"] } glam = { version = "0.24", features = ["serde"] }
dyn-any = { version = "0.3.0", path = "../dyn-any", optional = true } dyn-any = { workspace = true, optional = true }
serde = { version = "1.0", features = ["derive"], optional = true } serde = { workspace = true, optional = true }
+3 -3
View File
@@ -14,9 +14,9 @@ readme = "../README.md"
proc-macro = true proc-macro = true
[dependencies] [dependencies]
proc-macro2 = "1" proc-macro2 = { workspace = true }
quote = "1" quote = { workspace = true }
syn = { version = "1", default-features = false, features = [ syn = { workspace = true, default-features = false, features = [
"derive", "derive",
"parsing", "parsing",
"proc-macro", "proc-macro",
+2 -2
View File
@@ -5,7 +5,7 @@ extern crate proc_macro;
use proc_macro::TokenStream; use proc_macro::TokenStream;
use proc_macro2::Span; use proc_macro2::Span;
use quote::quote; use quote::quote;
use syn::{parse_macro_input, DeriveInput, GenericParam, Lifetime, LifetimeDef, TypeParamBound}; use syn::{parse_macro_input, DeriveInput, GenericParam, Lifetime, LifetimeParam, TypeParamBound};
/// Derives an implementation for the [`DynAny`] trait. /// Derives an implementation for the [`DynAny`] trait.
/// ///
@@ -59,7 +59,7 @@ fn replace_lifetimes(generics: &syn::Generics, replacement: &str) -> Vec<proc_ma
.iter() .iter()
.map(|param| { .map(|param| {
let param = match param { let param = match param {
GenericParam::Lifetime(_) => GenericParam::Lifetime(LifetimeDef::new(Lifetime::new(replacement, Span::call_site()))), GenericParam::Lifetime(_) => GenericParam::Lifetime(LifetimeParam::new(Lifetime::new(replacement, Span::call_site()))),
GenericParam::Type(t) => { GenericParam::Type(t) => {
let mut t = t.clone(); let mut t = t.clone();
t.bounds.iter_mut().for_each(|bond| { t.bounds.iter_mut().for_each(|bond| {
+2 -4
View File
@@ -12,11 +12,10 @@ serde_json = "1.0"
graph-craft = { version = "0.1.0", path = "../graph-craft", features = [ graph-craft = { version = "0.1.0", path = "../graph-craft", features = [
"serde", "serde",
] } ] }
graphene-core = { version = "0.1.0", path = "../gcore" } graphene-core = { workspace = true }
gpu-executor = { version = "0.1.0", path = "../gpu-executor" } gpu-executor = { version = "0.1.0", path = "../gpu-executor" }
gpu-compiler-bin-wrapper = { version = "0.1.0", path = "../gpu-compiler/gpu-compiler-bin-wrapper" } gpu-compiler-bin-wrapper = { version = "0.1.0", path = "../gpu-compiler/gpu-compiler-bin-wrapper" }
tempfile = "3.3.0" anyhow = { workspace = true }
anyhow = "1.0.68"
reqwest = { version = "0.11", features = [ reqwest = { version = "0.11", features = [
"blocking", "blocking",
"serde_json", "serde_json",
@@ -24,4 +23,3 @@ reqwest = { version = "0.11", features = [
"rustls", "rustls",
"rustls-tls", "rustls-tls",
] } ] }
future-executor = { path = "../future-executor" }
-4
View File
@@ -16,10 +16,6 @@ pub async fn compile(networks: Vec<ProtoNetwork>, inputs: Vec<Type>, outputs: Ve
}) })
} }
pub fn compile_sync(networks: Vec<ProtoNetwork>, inputs: Vec<Type>, outputs: Vec<Type>, io: ShaderIO) -> Result<Shader, reqwest::Error> {
future_executor::block_on(compile(networks, inputs, outputs, io))
}
// TODO: should we add the entry point as a field? // TODO: should we add the entry point as a field?
/// A compiled shader with type annotations. /// A compiled shader with type annotations.
pub struct Shader { pub struct Shader {
+6 -4
View File
@@ -7,13 +7,15 @@ license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
tokio = { version = "1.29", features = ["full"] } tokio = { version = "1", features = ["full"] }
axum = "0.6.18" axum = "0.7"
serde_json = "1.0" serde_json = "1.0"
graph-craft = { version = "0.1.0", path = "../graph-craft", features = ["serde"] } graph-craft = { version = "0.1.0", path = "../graph-craft", features = [
"serde",
] }
gpu-compiler-bin-wrapper = { version = "0.1.0", path = "../gpu-compiler/gpu-compiler-bin-wrapper" } gpu-compiler-bin-wrapper = { version = "0.1.0", path = "../gpu-compiler/gpu-compiler-bin-wrapper" }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tempfile = "3.6.0" tempfile = "3.6.0"
anyhow = "1.0.72" anyhow = "1.0.72"
futures = "0.3" futures = "0.3"
tower-http = { version = "0.4.1", features = ["cors"] } tower-http = { version = "0.5", features = ["cors"] }
+2 -1
View File
@@ -31,7 +31,8 @@ async fn main() {
.with_state(shared_state); .with_state(shared_state);
// run it with hyper on localhost:3000 // run it with hyper on localhost:3000
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()).serve(app.into_make_service()).await.unwrap(); let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
} }
async fn post_compile_spirv(State(state): State<Arc<AppState>>, Json(compile_request): Json<CompileRequest>) -> Result<Vec<u8>, StatusCode> { async fn post_compile_spirv(State(state): State<Arc<AppState>>, Json(compile_request): Json<CompileRequest>) -> Result<Vec<u8>, StatusCode> {
-20
View File
@@ -1,20 +0,0 @@
[package]
name = "future-executor"
version = "0.1.0"
edition = "2021"
authors = ["Graphite Authors <contact@graphite.rs>"]
license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
futures = "0.3.25"
log = "0.4"
[target.wasm32-unknown-unknown.dependencies]
wasm-rs-async-executor = { version = "0.9.0", features = [
"cooperative-browser",
"debug",
"requestIdleCallback",
] }
wasm-bindgen-futures = "0.4.36"
-29
View File
@@ -1,29 +0,0 @@
use core::future::Future;
pub fn block_on<F: Future + 'static>(future: F) -> F::Output {
#[cfg(target_arch = "wasm32")]
{
use wasm_rs_async_executor::single_threaded as executor;
let val = std::sync::Arc::new(std::sync::Mutex::new(None));
let move_val = val.clone();
let result = executor::spawn(async move {
let result = executor::yield_async(future).await;
*move_val.lock().unwrap() = Some(result);
});
executor::run(Some(result.task()));
loop {
if let Some(result) = val.lock().unwrap().take() {
return result;
}
}
}
#[cfg(not(target_arch = "wasm32"))]
futures::executor::block_on(future)
}
#[cfg(target_arch = "wasm32")]
pub fn spawn<F: Future<Output = ()> + 'static>(future: F) {
wasm_bindgen_futures::spawn_local(future);
}
+37 -38
View File
@@ -9,62 +9,61 @@ license = "MIT OR Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features] [features]
std = ["dyn-any", "dyn-any/std", "alloc", "glam/std", "specta", "num-traits/std", "rustybuzz", "image"] std = [
default = ["async", "serde", "kurbo", "log", "std", "rand_chacha", "wasm"] "dyn-any",
"dyn-any/std",
"alloc",
"glam/std",
"specta",
"num-traits/std",
"rustybuzz",
"image",
]
default = ["serde", "kurbo", "log", "std", "rand_chacha", "wasm"]
log = ["dep:log"] log = ["dep:log"]
serde = ["dep:serde", "glam/serde", "bezier-rs/serde", "bezier-rs/serde", "base64"] serde = [
"dep:serde",
"glam/serde",
"bezier-rs/serde",
"bezier-rs/serde",
"base64",
]
gpu = ["spirv-std", "glam/bytemuck", "dyn-any", "glam/libm"] gpu = ["spirv-std", "glam/bytemuck", "dyn-any", "glam/libm"]
async = ["async-trait", "alloc"]
nightly = [] nightly = []
alloc = ["dyn-any", "bezier-rs"] alloc = ["dyn-any", "bezier-rs"]
type_id_logging = [] type_id_logging = []
wasm = ["web-sys"] wasm = ["web-sys"]
[dependencies] [dependencies]
dyn-any = { path = "../../libraries/dyn-any", features = [ dyn-any = { workspace = true, optional = true }
"derive", spirv-std = { workspace = true, optional = true }
"glam", bytemuck = { workspace = true, features = ["derive"] }
], optional = true, default-features = false } serde = { workspace = true, optional = true, features = ["derive"] }
log = { workspace = true, optional = true }
spirv-std = { version = "0.9", optional = true } rand_chacha = { workspace = true, optional = true }
bytemuck = { version = "1.8", features = ["derive"] } bezier-rs = { workspace = true, optional = true }
async-trait = { version = "0.1", optional = true } kurbo = { workspace = true, optional = true }
serde = { version = "1.0", features = [ glam = { workspace = true, default-features = false, features = [
"derive",
"rc"
], optional = true, default-features = false }
log = { version = "0.4", optional = true }
rand_chacha = { version = "0.3.1", optional = true }
bezier-rs = { path = "../../libraries/bezier-rs", optional = true }
kurbo = { git = "https://github.com/linebender/kurbo.git", features = [
"serde",
], optional = true }
spin = "0.9.2"
glam = { version = "0.24", default-features = false, features = [
"scalar-math", "scalar-math",
] } ] }
node-macro = { path = "../node-macro" } node-macro = { workspace = true }
base64 = { version = "0.21", optional = true } base64 = { workspace = true, optional = true }
image = { version = "0.24", optional = true, default-features = false, features = [ image = { workspace = true, optional = true, default-features = false, features = [
"png", "png",
] } ] }
specta.workspace = true specta = { workspace = true, optional = true }
specta.optional = true
rustybuzz = { version = "0.8.0", optional = true } rustybuzz = { workspace = true, optional = true }
num-derive = { version = "0.4" } num-derive = { workspace = true }
num-traits = { version = "0.2.15", default-features = false, features = [ num-traits = { workspace = true, default-features = false, features = ["i128"] }
"i128",
] }
wasm-bindgen = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true }
js-sys = { version = "0.3.55", optional = true } js-sys = { workspace = true, optional = true }
usvg = "0.35.0" usvg = { workspace = true }
[dependencies.web-sys] [dependencies.web-sys]
version = "0.3.4" workspace = true
optional = true optional = true
features = ["HtmlCanvasElement"] features = ["HtmlCanvasElement"]
@@ -7,6 +7,7 @@ use bezier_rs::Subpath;
pub use quad::Quad; pub use quad::Quad;
use glam::{DAffine2, DVec2}; use glam::{DAffine2, DVec2};
use usvg::TreeParsing;
mod quad; mod quad;
@@ -182,11 +183,38 @@ pub fn format_transform_matrix(transform: DAffine2) -> String {
result.push(')'); result.push(')');
result result
} }
fn to_transform(transform: DAffine2) -> usvg::Transform {
let cols = transform.to_cols_array();
usvg::Transform::from_row(cols[0] as f32, cols[1] as f32, cols[2] as f32, cols[3] as f32, cols[4] as f32, cols[5] as f32)
}
pub trait GraphicElementRendered { pub trait GraphicElementRendered {
fn render_svg(&self, render: &mut SvgRender, render_params: &RenderParams); fn render_svg(&self, render: &mut SvgRender, render_params: &RenderParams);
fn bounding_box(&self, transform: DAffine2) -> Option<[DVec2; 2]>; fn bounding_box(&self, transform: DAffine2) -> Option<[DVec2; 2]>;
fn add_click_targets(&self, click_targets: &mut Vec<ClickTarget>); fn add_click_targets(&self, click_targets: &mut Vec<ClickTarget>);
fn to_usvg_node(&self) -> usvg::Node {
let mut render = SvgRender::new();
let render_params = RenderParams::new(crate::vector::style::ViewMode::Normal, ImageRenderMode::BlobUrl, None, false);
self.render_svg(&mut render, &render_params);
render.format_svg(DVec2::ZERO, DVec2::ONE);
let svg = render.svg.to_string();
let opt = usvg::Options::default();
let tree = usvg::Tree::from_str(&svg, &opt).expect("Failed to parse SVG");
tree.root.clone()
}
fn to_usvg_tree(&self, resolution: glam::UVec2, viewbox: [DVec2; 2]) -> usvg::Tree {
let root_node = self.to_usvg_node();
usvg::Tree {
size: usvg::Size::from_wh(resolution.x as f32, resolution.y as f32).unwrap(),
view_box: usvg::ViewBox {
rect: usvg::NonZeroRect::from_ltrb(viewbox[0].x as f32, viewbox[0].y as f32, viewbox[1].x as f32, viewbox[1].y as f32).unwrap(),
aspect: usvg::AspectRatio::default(),
},
root: root_node.clone(),
}
}
} }
impl GraphicElementRendered for GraphicGroup { impl GraphicElementRendered for GraphicGroup {
@@ -212,6 +240,14 @@ impl GraphicElementRendered for GraphicGroup {
.reduce(Quad::combine_bounds) .reduce(Quad::combine_bounds)
} }
fn add_click_targets(&self, _click_targets: &mut Vec<ClickTarget>) {} fn add_click_targets(&self, _click_targets: &mut Vec<ClickTarget>) {}
fn to_usvg_node(&self) -> usvg::Node {
let root_node = usvg::Node::new(usvg::NodeKind::Group(usvg::Group::default()));
for element in self.iter() {
root_node.append(element.to_usvg_node());
}
root_node
}
} }
impl GraphicElementRendered for VectorData { impl GraphicElementRendered for VectorData {
@@ -250,6 +286,40 @@ impl GraphicElementRendered for VectorData {
}; };
click_targets.extend(self.subpaths.iter().cloned().map(update_closed).map(|subpath| ClickTarget { stroke_width, subpath })) click_targets.extend(self.subpaths.iter().cloned().map(update_closed).map(|subpath| ClickTarget { stroke_width, subpath }))
} }
fn to_usvg_node(&self) -> usvg::Node {
use bezier_rs::BezierHandles;
use usvg::tiny_skia_path::PathBuilder;
let mut builder = PathBuilder::new();
let vector_data = self;
let transform = to_transform(vector_data.transform);
for subpath in vector_data.subpaths.iter() {
let start = vector_data.transform.transform_point2(subpath[0].anchor);
builder.move_to(start.x as f32, start.y as f32);
for bezier in subpath.iter() {
bezier.apply_transformation(|pos| vector_data.transform.transform_point2(pos));
let end = bezier.end;
match bezier.handles {
BezierHandles::Linear => builder.line_to(end.x as f32, end.y as f32),
BezierHandles::Quadratic { handle } => builder.quad_to(handle.x as f32, handle.y as f32, end.x as f32, end.y as f32),
BezierHandles::Cubic { handle_start, handle_end } => {
builder.cubic_to(handle_start.x as f32, handle_start.y as f32, handle_end.x as f32, handle_end.y as f32, end.x as f32, end.y as f32)
}
}
}
if subpath.closed {
builder.close()
}
}
let path = builder.finish().unwrap();
let mut path = usvg::Path::new(path.into());
path.transform = transform;
// TODO: use proper style
path.fill = None;
path.stroke = Some(usvg::Stroke::default());
usvg::Node::new(usvg::NodeKind::Path(path))
}
} }
impl GraphicElementRendered for Artboard { impl GraphicElementRendered for Artboard {
@@ -379,6 +449,25 @@ impl GraphicElementRendered for ImageFrame<Color> {
let subpath = Subpath::new_rect(DVec2::ZERO, DVec2::ONE); let subpath = Subpath::new_rect(DVec2::ZERO, DVec2::ONE);
click_targets.push(ClickTarget { subpath, stroke_width: 0. }); click_targets.push(ClickTarget { subpath, stroke_width: 0. });
} }
fn to_usvg_node(&self) -> usvg::Node {
let image_frame = self;
if image_frame.image.width * image_frame.image.height == 0 {
return usvg::Node::new(usvg::NodeKind::Group(usvg::Group::default()));
}
let png = image_frame.image.to_png();
usvg::Node::new(usvg::NodeKind::Image(usvg::Image {
id: String::new(),
transform: to_transform(image_frame.transform),
visibility: usvg::Visibility::Visible,
view_box: usvg::ViewBox {
rect: usvg::NonZeroRect::from_xywh(0., 0., 1., 1.).unwrap(),
aspect: usvg::AspectRatio::default(),
},
rendering_mode: usvg::ImageRendering::OptimizeSpeed,
kind: usvg::ImageKind::PNG(png.into()),
}))
}
} }
impl GraphicElementRendered for GraphicElementData { impl GraphicElementRendered for GraphicElementData {
@@ -411,6 +500,16 @@ impl GraphicElementRendered for GraphicElementData {
GraphicElementData::Artboard(artboard) => artboard.add_click_targets(click_targets), GraphicElementData::Artboard(artboard) => artboard.add_click_targets(click_targets),
} }
} }
fn to_usvg_node(&self) -> usvg::Node {
match self {
GraphicElementData::VectorShape(vector_data) => vector_data.to_usvg_node(),
GraphicElementData::ImageFrame(image_frame) => image_frame.to_usvg_node(),
GraphicElementData::Text(text) => text.to_usvg_node(),
GraphicElementData::GraphicGroup(graphic_group) => graphic_group.to_usvg_node(),
GraphicElementData::Artboard(artboard) => artboard.to_usvg_node(),
}
}
} }
/// Used to stop rust complaining about upstream traits adding display implementations to `Option<Color>`. This would not be an issue as we control that crate. /// Used to stop rust complaining about upstream traits adding display implementations to `Option<Color>`. This would not be an issue as we control that crate.
@@ -436,6 +535,26 @@ impl<T: Primitive> GraphicElementRendered for T {
} }
fn add_click_targets(&self, _click_targets: &mut Vec<ClickTarget>) {} fn add_click_targets(&self, _click_targets: &mut Vec<ClickTarget>) {}
fn to_usvg_node(&self) -> usvg::Node {
let text = self;
usvg::Node::new(usvg::NodeKind::Text(usvg::Text {
id: String::new(),
transform: usvg::Transform::identity(),
rendering_mode: usvg::TextRendering::OptimizeSpeed,
positions: Vec::new(),
rotate: Vec::new(),
writing_mode: usvg::WritingMode::LeftToRight,
chunks: vec![usvg::TextChunk {
text: text.to_string(),
x: None,
y: None,
anchor: usvg::TextAnchor::Start,
spans: vec![],
text_flow: usvg::TextFlow::Linear,
}],
}))
}
} }
impl GraphicElementRendered for Option<Color> { impl GraphicElementRendered for Option<Color> {
+3 -3
View File
@@ -46,7 +46,7 @@ mod uuid_generation {
use core::cell::Cell; use core::cell::Cell;
use rand_chacha::rand_core::{RngCore, SeedableRng}; use rand_chacha::rand_core::{RngCore, SeedableRng};
use rand_chacha::ChaCha20Rng; use rand_chacha::ChaCha20Rng;
use spin::Mutex; use std::sync::Mutex;
static RNG: Mutex<Option<ChaCha20Rng>> = Mutex::new(None); static RNG: Mutex<Option<ChaCha20Rng>> = Mutex::new(None);
thread_local! { thread_local! {
@@ -58,14 +58,14 @@ mod uuid_generation {
} }
pub fn generate_uuid() -> u64 { pub fn generate_uuid() -> u64 {
let mut lock = RNG.lock(); let Ok(mut lock) = RNG.lock() else { panic!("UUID mutex poisoned") };
if lock.is_none() { if lock.is_none() {
UUID_SEED.with(|seed| { UUID_SEED.with(|seed| {
let random_seed = seed.get().unwrap_or(42); let random_seed = seed.get().unwrap_or(42);
*lock = Some(ChaCha20Rng::seed_from_u64(random_seed)); *lock = Some(ChaCha20Rng::seed_from_u64(random_seed));
}) })
} }
lock.as_mut().map(ChaCha20Rng::next_u64).expect("uuid mutex poisoned") lock.as_mut().map(ChaCha20Rng::next_u64).expect("UUID mutex poisoned")
} }
} }
+11 -15
View File
@@ -12,26 +12,22 @@ serde = ["graphene-core/serde", "glam/serde"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
graphene-core = { path = "../gcore", features = ["async", "std", "alloc"] } graphene-core = { workspace = true, features = ["async", "std", "alloc"] }
graph-craft = { path = "../graph-craft", features = ["serde"] } graph-craft = { path = "../graph-craft", features = ["serde"] }
gpu-executor = { path = "../gpu-executor" } gpu-executor = { path = "../gpu-executor" }
dyn-any = { path = "../../libraries/dyn-any", features = [ dyn-any = { workspace = true, features = ["log-bad-types", "rc", "glam"] }
"log-bad-types", num-traits = { workspace = true }
"rc", log = { workspace = true }
"glam", serde = { workspace = true }
] } glam = { workspace = true }
num-traits = "0.2" base64 = { workspace = true }
log = "0.4"
serde = { version = "1", features = ["derive", "rc"] }
glam = { version = "0.24" }
base64 = "0.21"
bytemuck = { version = "1.8" } bytemuck = { workspace = true }
nvtx = { version = "1.1.1", optional = true } nvtx = { version = "1.1.1", optional = true }
tempfile = "3" tempfile = { workspace = true }
spirv-builder = { version = "0.9", default-features = false, features = [ spirv-builder = { version = "0.9", default-features = false, features = [
"use-installed-tools", "use-installed-tools",
] } ] }
tera = { version = "1.17.1" } tera = { version = "1.17.1" }
anyhow = "1.0.66" anyhow = { workspace = true }
serde_json = "1.0.91" serde_json = { workspace = true }
+1 -1
View File
@@ -235,7 +235,7 @@ mod test {
name: "project".to_owned(), name: "project".to_owned(),
authors: vec!["Example <john.smith@example.com>".to_owned(), "smith.john@example.com".to_owned()], authors: vec!["Example <john.smith@example.com>".to_owned(), "smith.john@example.com".to_owned()],
}); });
let cargo_toml = cargo_toml.expect("failed to build carog toml template"); let cargo_toml = cargo_toml.expect("Failed to build cargo toml template");
let lines = cargo_toml.split('\n').collect::<Vec<_>>(); let lines = cargo_toml.split('\n').collect::<Vec<_>>();
let cargo_toml = lines[..lines.len() - 2].join("\n"); let cargo_toml = lines[..lines.len() - 2].join("\n");
let reference = r#"[package] let reference = r#"[package]
+12 -23
View File
@@ -10,31 +10,20 @@ default = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
graphene-core = { path = "../gcore", features = [ graphene-core = { workspace = true, features = ["std", "alloc", "gpu"] }
"async", graph-craft = { workspace = true }
"std",
"alloc",
"gpu",
] }
graph-craft = { path = "../graph-craft", features = ["serde"] }
node-macro = { path = "../node-macro" } node-macro = { path = "../node-macro" }
dyn-any = { path = "../../libraries/dyn-any", features = [ dyn-any = { workspace = true, features = ["log-bad-types", "rc", "glam"] }
"log-bad-types", num-traits = { workspace = true }
"rc", log = { workspace = true }
"glam", serde = { workspace = true }
] } glam = { workspace = true }
num-traits = "0.2" base64 = { workspace = true }
log = "0.4"
serde = { version = "1", features = ["derive", "rc"] }
glam = "0.24"
base64 = "0.21"
bytemuck = { version = "1.8" } bytemuck = { workspace = true }
anyhow = "1.0.66" anyhow = { workspace = true }
spirv = "0.2.0" futures = { workspace = true }
futures-intrusive = "0.5.0" web-sys = { workspace = true, features = [
futures = "0.3.25"
web-sys = { version = "0.3.4", features = [
"HtmlCanvasElement", "HtmlCanvasElement",
"ImageBitmapRenderingContext", "ImageBitmapRenderingContext",
] } ] }
+14 -13
View File
@@ -12,17 +12,18 @@ dealloc_nodes = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
graphene-core = { path = "../gcore", features = ["std"] } graphene-core = { workspace = true, features = ["std"] }
dyn-any = { path = "../../libraries/dyn-any", features = ["log-bad-types", "rc", "glam"] } dyn-any = { path = "../../libraries/dyn-any", features = [
num-traits = "0.2" "log-bad-types",
dyn-clone = "1.0" "rc",
log = "0.4" "glam",
serde = { version = "1", features = ["derive", "rc"], optional = true } ] }
glam = { version = "0.24" } num-traits = { workspace = true }
base64 = "0.21" log = { workspace = true }
bezier-rs = { path = "../../libraries/bezier-rs", features = ["dyn-any"] } serde = { workspace = true, optional = true }
specta.workspace = true glam = { workspace = true }
base64 = { workspace = true }
bytemuck = { version = "1.8" } bezier-rs = { workspace = true }
anyhow = "1.0.66" specta = { workspace = true }
bytemuck = { workspace = true }
rustc-hash = { workspace = true } rustc-hash = { workspace = true }
+15 -21
View File
@@ -25,38 +25,32 @@ quantization = ["graphene-std/quantization"]
[dependencies] [dependencies]
log = "0.4" log = { workspace = true }
bitflags = "2.4" bitflags = { workspace = true }
serde = { version = "1.0", features = ["derive"] } serde = { workspace = true }
serde_json = { version = "1.0" } serde_json = { workspace = true }
bezier-rs = { path = "../../libraries/bezier-rs" } bezier-rs = { workspace = true }
glam = { version = "0.24", features = ["serde"] } glam = { workspace = true }
# Node graph
graphene-std = { path = "../gstd" } graphene-std = { path = "../gstd" }
image = { version = "0.24", default-features = false, features = [ image = { workspace = true, default-features = false, features = [
"bmp", "bmp",
"png", "png",
] } ] }
graph-craft = { path = "../graph-craft" } graph-craft = { workspace = true }
wgpu-executor = { path = "../wgpu-executor", optional = true } wgpu-executor = { path = "../wgpu-executor", optional = true }
gpu-executor = { path = "../gpu-executor", optional = true } gpu-executor = { path = "../gpu-executor", optional = true }
interpreted-executor = { path = "../interpreted-executor" } interpreted-executor = { path = "../interpreted-executor" }
dyn-any = { path = "../../libraries/dyn-any" } dyn-any = { workspace = true }
graphene-core = { path = "../gcore" } graphene-core = { workspace = true }
future-executor = { path = "../future-executor", optional = true }
wasm-bindgen = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true }
futures = "0.3.28" futures = { workspace = true }
fern = { version = "0.6.2", features = ["colored"] } fern = { workspace = true }
chrono = "0.4.26" chrono = { workspace = true }
tokio = { version = "1.28.2", features = ["macros", "rt"] } tokio = { workspace = true, features = ["macros", "rt"] }
wgpu = "0.17" wgpu = { workspace = true }
[dependencies.document-legacy] [dependencies.document-legacy]
path = "../../document-legacy" path = "../../document-legacy"
package = "graphite-document-legacy" package = "graphite-document-legacy"
[dev-dependencies] [dev-dependencies]
env_logger = "0.10"
test-case = "3.1"
+26 -31
View File
@@ -17,7 +17,7 @@ gpu = [
"gpu-executor", "gpu-executor",
] ]
vulkan = ["gpu", "vulkan-executor"] vulkan = ["gpu", "vulkan-executor"]
wgpu = ["gpu", "wgpu-executor"] wgpu = ["gpu", "wgpu-executor", "dep:wgpu"]
quantization = ["autoquant"] quantization = ["autoquant"]
wasm = ["wasm-bindgen", "web-sys", "js-sys"] wasm = ["wasm-bindgen", "web-sys", "js-sys"]
imaginate = ["image/png", "base64", "js-sys", "web-sys", "wasm-bindgen-futures"] imaginate = ["image/png", "base64", "js-sys", "web-sys", "wasm-bindgen-futures"]
@@ -27,16 +27,15 @@ resvg = ["dep:resvg"]
wayland = [] wayland = []
[dependencies] [dependencies]
rand = { version = "0.8.5", features = [ rand = { workspace = true, features = [
"alloc", "alloc",
"small_rng", "small_rng",
], default-features = false } ], default-features = false }
rand_chacha = { version = "0.3.1", default-features = false } rand_chacha = { workspace = true }
autoquant = { git = "https://github.com/truedoctor/autoquant", optional = true, features = [ autoquant = { git = "https://github.com/truedoctor/autoquant", optional = true, features = [
"fitting", "fitting",
] } ] }
graphene-core = { path = "../gcore", features = [ graphene-core = { path = "../gcore", features = [
"async",
"std", "std",
"serde", "serde",
"alloc", "alloc",
@@ -44,48 +43,44 @@ graphene-core = { path = "../gcore", features = [
dyn-any = { path = "../../libraries/dyn-any", features = ["derive"] } dyn-any = { path = "../../libraries/dyn-any", features = ["derive"] }
graph-craft = { path = "../graph-craft", features = ["serde"] } graph-craft = { path = "../graph-craft", features = ["serde"] }
vulkan-executor = { path = "../vulkan-executor", optional = true } vulkan-executor = { path = "../vulkan-executor", optional = true }
wgpu-executor = { path = "../wgpu-executor", optional = true, version = "0.1" } wgpu-executor = { path = "../wgpu-executor", optional = true }
gpu-executor = { path = "../gpu-executor", optional = true } gpu-executor = { path = "../gpu-executor", optional = true }
gpu-compiler-bin-wrapper = { path = "../gpu-compiler/gpu-compiler-bin-wrapper", optional = true } gpu-compiler-bin-wrapper = { path = "../gpu-compiler/gpu-compiler-bin-wrapper", optional = true }
compilation-client = { path = "../compilation-client", optional = true } compilation-client = { path = "../compilation-client", optional = true }
bytemuck = { version = "1.13" } bytemuck = { workspace = true }
tempfile = "3" image = { workspace = true, default-features = false, features = [
image = { version = "0.24", default-features = false, features = [
"png", "png",
"jpeg", "jpeg",
] } ] }
base64 = { version = "0.21", optional = true } base64 = { workspace = true, optional = true }
dyn-clone = "1.0" wgpu = { workspace = true, optional = true }
log = { workspace = true }
log = "0.4" bezier-rs = { workspace = true, features = ["serde"] }
bezier-rs = { path = "../../libraries/bezier-rs", features = ["serde"] } glam = { workspace = true, features = ["serde"] }
glam = { version = "0.24", features = ["serde"] } node-macro = { workspace = true }
node-macro = { path = "../node-macro" }
rustc-hash = { workspace = true } rustc-hash = { workspace = true }
serde_json = "1.0.96" serde_json = { workspace = true }
reqwest = { version = "0.11.18", features = ["rustls", "rustls-tls", "json"] } reqwest = { workspace = true }
futures = "0.3.28" futures = { workspace = true }
wasm-bindgen = { workspace = true, optional = true } wasm-bindgen = { workspace = true, optional = true }
js-sys = { version = "0.3.63", optional = true } js-sys = { workspace = true, optional = true }
wgpu-types = "0.17" wgpu-types = { workspace = true }
wgpu = "0.17" wasm-bindgen-futures = { workspace = true, optional = true }
wasm-bindgen-futures = { version = "0.4.36", optional = true } winit = { workspace = true }
winit = "0.28.6" url = { workspace = true }
url = "2.4.0" tokio = { workspace = true, optional = true, features = ["fs", "io-std"] }
tokio = { version = "1.29.0", optional = true, features = ["fs", "io-std"] }
image-compare = { version = "0.3.0", optional = true } image-compare = { version = "0.3.0", optional = true }
vello = { git = "https://github.com/linebender/vello", version = "0.0.1", optional = true } vello = { workspace = true, optional = true }
vello_svg = { git = "https://github.com/linebender/vello", version = "0.0.1", optional = true } vello_svg = { workspace = true, optional = true }
resvg = { version = "0.35.0", optional = true } resvg = { workspace = true, optional = true }
[dependencies.serde] [dependencies.serde]
version = "1.0" workspace = true
optional = true optional = true
features = ["derive"] features = ["derive"]
[dependencies.web-sys] [dependencies.web-sys]
version = "0.3.63" workspace = true
optional = true optional = true
features = [ features = [
"Window", "Window",
+1 -1
View File
@@ -344,7 +344,7 @@ fn render_canvas(
*/ */
let frame = SurfaceHandleFrame { let frame = SurfaceHandleFrame {
surface_handle, surface_handle,
transform: DAffine2::IDENTITY, transform: glam::DAffine2::IDENTITY,
}; };
RenderOutput::CanvasFrame(frame.into()) RenderOutput::CanvasFrame(frame.into())
} }
+8 -13
View File
@@ -13,20 +13,15 @@ quantization = ["graphene-std/quantization"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
graphene-core = { path = "../gcore", features = ["async", "std"] } graphene-core = { workspace = true, features = ["std"] }
graphene-std = { path = "../gstd" } graphene-std = { path = "../gstd" }
graph-craft = { path = "../graph-craft" } graph-craft = { path = "../graph-craft" }
gpu-executor = { path = "../gpu-executor" } gpu-executor = { path = "../gpu-executor" }
wgpu-executor = { path = "../wgpu-executor" } wgpu-executor = { path = "../wgpu-executor" }
dyn-any = { path = "../../libraries/dyn-any", features = [ dyn-any = { workspace = true, features = ["log-bad-types", "glam"] }
"log-bad-types", num-traits = { workspace = true }
"glam", log = { workspace = true }
] } serde = { workspace = true, optional = true }
num-traits = "0.2" glam = { workspace = true }
dyn-clone = "1.0" once_cell = "1.18" # Remove when `core::cell::LazyCell` is stabilized (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>)
log = "0.4" futures = { workspace = true }
serde = { version = "1", features = ["derive"], optional = true }
glam = { version = "0.24" }
once_cell = "1.18" # Remove when `core::cell::LazyCell` is stabilized (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>)
futures = "0.3.28"
typed-arena = "2.0.2"
+3 -3
View File
@@ -16,6 +16,6 @@ license = "Apache-2.0"
proc-macro = true proc-macro = true
[dependencies] [dependencies]
syn = { version = "2.0", features = ["full"] } syn = { workspace = true }
proc-macro2 = "1.0" proc-macro2 = { workspace = true }
quote = "1.0" quote = { workspace = true }
+15 -12
View File
@@ -10,15 +10,18 @@ default = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
graphene-core = { path = "../gcore", features = ["async", "std", "alloc", "gpu"] } graphene-core = { path = "../gcore", features = ["std", "alloc", "gpu"] }
graph-craft = {path = "../graph-craft" } graph-craft = { path = "../graph-craft" }
dyn-any = { path = "../../libraries/dyn-any", features = ["log-bad-types", "rc", "glam"] } dyn-any = { path = "../../libraries/dyn-any", features = [
num-traits = "0.2" "log-bad-types",
log = "0.4" "rc",
serde = { version = "1", features = ["derive", "rc"], optional = true } "glam",
glam = { version = "0.24" } ] }
base64 = "0.21" num-traits = { workspace = true }
log = { workspace = true }
vulkano = { git = "https://github.com/GraphiteEditor/vulkano", branch = "fix_rust_gpu"} serde = { workspace = true, optional = true }
bytemuck = { version = "1.13" } glam = { workspace = true }
anyhow = "1.0" base64 = { workspace = true }
vulkano = { git = "https://github.com/GraphiteEditor/vulkano", branch = "fix_rust_gpu" }
bytemuck = { workspace = true }
anyhow = { workspace = true }
+15 -26
View File
@@ -12,32 +12,21 @@ passthrough = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
graphene-core = { path = "../gcore", features = [ graphene-core = { workspace = true, features = ["std", "alloc", "gpu"] }
"async", graph-craft = { workspace = true }
"std",
"alloc",
"gpu",
] }
graph-craft = { path = "../graph-craft" }
gpu-executor = { path = "../gpu-executor" } gpu-executor = { path = "../gpu-executor" }
dyn-any = { path = "../../libraries/dyn-any", features = [ dyn-any = { workspace = true, features = ["log-bad-types", "rc", "glam"] }
"log-bad-types", num-traits = { workspace = true }
"rc", log = { workspace = true }
"glam", serde = { workspace = true, optional = true }
] } glam = { workspace = true }
future-executor = { path = "../future-executor" } base64 = { workspace = true }
num-traits = "0.2" bytemuck = { workspace = true }
log = "0.4" anyhow = { workspace = true }
serde = { version = "1", features = ["derive", "rc"], optional = true } wgpu = { workspace = true, features = ["spirv"] }
glam = { version = "0.24" } spirv = { workspace = true }
base64 = "0.21" futures = { workspace = true }
bytemuck = { version = "1.8" }
anyhow = "1.0.66"
wgpu = { version = "0.17", features = ["spirv"] }
spirv = "0.2.0"
futures-intrusive = "0.5.0" futures-intrusive = "0.5.0"
futures = "0.3.25" web-sys = { workspace = true, features = ["HtmlCanvasElement"] }
web-sys = { version = "0.3.4", features = ["HtmlCanvasElement"] } winit = { workspace = true }
winit = "0.28.6"
nvtx = { version = "1.2", optional = true } nvtx = { version = "1.2", optional = true }
-4
View File
@@ -51,8 +51,4 @@ impl Context {
instance: Arc::new(instance), instance: Arc::new(instance),
}) })
} }
pub fn new_sync() -> Option<Self> {
future_executor::block_on(Self::new())
}
} }
+4 -4
View File
@@ -19,13 +19,13 @@ default = ["serde-discriminant"]
serde-discriminant = [] serde-discriminant = []
[dependencies] [dependencies]
proc-macro2 = "1" proc-macro2 = { workspace = true }
syn = { version = "2.0", features = ["full"] } syn = { workspace = true }
quote = "1.0.9" quote = { workspace = true }
[dev-dependencies.editor] [dev-dependencies.editor]
path = "../editor" path = "../editor"
package = "graphite-editor" package = "graphite-editor"
[dev-dependencies] [dev-dependencies]
serde = "1" serde = { workspace = true }
+7 -10
View File
@@ -14,17 +14,14 @@ license = "Apache-2.0"
crate-type = ["cdylib", "rlib"] crate-type = ["cdylib", "rlib"]
[dependencies] [dependencies]
bezier-rs = { path = "../../../../libraries/bezier-rs", package = "bezier-rs" } bezier-rs = { workspace = true }
log = "0.4" log = { workspace = true }
serde = { version = "1.0", features = ["derive"] } serde = { workspace = true, features = ["derive"] }
wasm-bindgen = { workspace = true } wasm-bindgen = { workspace = true }
serde_json = "1.0" serde_json = { workspace = true }
serde-wasm-bindgen = "0.5" serde-wasm-bindgen = "0.6"
js-sys = "0.3.55" js-sys = { workspace = true }
glam = { version = "0.24", features = ["serde"] } glam = { workspace = true, features = ["serde"] }
[dev-dependencies]
wasm-bindgen-test = "0.3.22"
[package.metadata.wasm-pack.profile.dev] [package.metadata.wasm-pack.profile.dev]
wasm-opt = false wasm-opt = false