mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
Update Tauri to v2 and execute only the node graph in native (#2362)
* Migrate tauri app to v2 * Move flake files to sub directory * Remove unused plugins * Backport some of the tauri code * Implement async node graph execution Only move node runtime to native code * Always use gpu feature for tauri * Fix serialization * Add logging filters * Enable native window rendering with vello * Cleanup * Remove unused editor instance * Remove changes from vite config * Remove warnings * Remove unused files * Fix most tests * Cleanup * Apply frontend lint * Readd flake.nix * Fix tests using --all-features * Code review * Enable all backends * Fix monitor node downcast types * Change debug log to a warning * Disable shader passthrough * Cleanup unused imports * Remove warning * Update project setup instructions --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -30,61 +30,6 @@ fn return_true() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
// TODO: Eventually remove this document upgrade code
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(untagged))]
|
||||
enum NodeInputVersions {
|
||||
OldNodeInput(OldNodeInput),
|
||||
NodeInput(NodeInput),
|
||||
}
|
||||
|
||||
// TODO: Eventually remove this document upgrade code
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
|
||||
pub enum OldNodeInput {
|
||||
/// A reference to another node in the same network from which this node can receive its input.
|
||||
Node { node_id: NodeId, output_index: usize, lambda: bool },
|
||||
|
||||
/// A hardcoded value that can't change after the graph is compiled. Gets converted into a value node during graph compilation.
|
||||
Value { tagged_value: TaggedValue, exposed: bool },
|
||||
|
||||
/// Input that is provided by the parent network to this document node, instead of from a hardcoded value or another node within the same network.
|
||||
Network(Type),
|
||||
|
||||
/// A Rust source code string. Allows us to insert literal Rust code. Only used for GPU compilation.
|
||||
/// We can use this whenever we spin up Rustc. Sort of like inline assembly, but because our language is Rust, it acts as inline Rust.
|
||||
Inline(InlineRust),
|
||||
}
|
||||
|
||||
// TODO: Eventually remove this document upgrade code
|
||||
#[cfg(feature = "serde")]
|
||||
fn deserialize_inputs<'de, D>(deserializer: D) -> Result<Vec<NodeInput>, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
use serde::Deserialize;
|
||||
let input_versions = Vec::<NodeInputVersions>::deserialize(deserializer)?;
|
||||
|
||||
let inputs = input_versions
|
||||
.into_iter()
|
||||
.map(|old_input| {
|
||||
let old_input = match old_input {
|
||||
NodeInputVersions::OldNodeInput(old_input) => old_input,
|
||||
NodeInputVersions::NodeInput(node_input) => return node_input,
|
||||
};
|
||||
match old_input {
|
||||
OldNodeInput::Node { node_id, output_index, .. } => NodeInput::node(node_id, output_index),
|
||||
OldNodeInput::Value { tagged_value, exposed } => NodeInput::value(tagged_value, exposed),
|
||||
OldNodeInput::Network(network_type) => NodeInput::network(network_type, 0),
|
||||
OldNodeInput::Inline(inline) => NodeInput::Inline(inline),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
Ok(inputs)
|
||||
}
|
||||
|
||||
/// An instance of a [`DocumentNodeDefinition`] that has been instantiated in a [`NodeNetwork`].
|
||||
/// Currently, when an instance is made, it lives all on its own without any lasting connection to the definition.
|
||||
/// But we will want to change it in the future so it merely references its definition.
|
||||
@@ -99,7 +44,7 @@ pub struct DocumentNode {
|
||||
/// In the root network, it is resolved when evaluating the borrow tree.
|
||||
/// Ensure the click target in the encapsulating network is updated when the inputs cause the node shape to change (currently only when exposing/hiding an input)
|
||||
/// by using network.update_click_target(node_id).
|
||||
#[cfg_attr(feature = "serde", serde(deserialize_with = "deserialize_inputs"))]
|
||||
#[cfg_attr(all(feature = "serde", target_arch = "wasm32"), serde(alias = "outputs"))]
|
||||
pub inputs: Vec<NodeInput>,
|
||||
/// Manual composition is the methodology by which most nodes are implemented, involving a call argument and upstream inputs.
|
||||
/// By contrast, automatic composition is an alternative way to handle the composition of nodes as they execute in the graph.
|
||||
@@ -635,7 +580,7 @@ pub struct OldDocumentNode {
|
||||
///
|
||||
/// In the root network, it is resolved when evaluating the borrow tree.
|
||||
/// Ensure the click target in the encapsulating network is updated when the inputs cause the node shape to change (currently only when exposing/hiding an input) by using network.update_click_target(node_id).
|
||||
#[cfg_attr(feature = "serde", serde(deserialize_with = "deserialize_inputs"))]
|
||||
#[cfg_attr(all(feature = "serde", target_arch = "wasm32"), serde(alias = "outputs"))]
|
||||
pub inputs: Vec<NodeInput>,
|
||||
pub manual_composition: Option<Type>,
|
||||
// TODO: Remove once this references its definition instead (see above TODO).
|
||||
@@ -745,7 +690,8 @@ fn default_export_metadata() -> (NodeId, IVec2) {
|
||||
pub struct NodeNetwork {
|
||||
/// The list of data outputs that are exported from this network to the parent network.
|
||||
/// Each export is a reference to a node within this network, paired with its output index, that is the source of the network's exported data.
|
||||
#[cfg_attr(feature = "serde", serde(alias = "outputs", deserialize_with = "deserialize_exports"))] // TODO: Eventually remove this alias document upgrade code
|
||||
// TODO: Eventually remove this alias document upgrade code
|
||||
#[cfg_attr(all(feature = "serde", target_arch = "wasm32"), serde(alias = "outputs", deserialize_with = "deserialize_exports"))]
|
||||
pub exports: Vec<NodeInput>,
|
||||
// TODO: Instead of storing import types in each NodeInput::Network connection, the types are stored here. This is similar to how types need to be defined for parameters when creating a function in Rust.
|
||||
// pub import_types: Vec<Type>,
|
||||
|
||||
Reference in New Issue
Block a user