Skip to content

Commit 6e17c5c

Browse files
committed
Fix warnings
1 parent 25f29af commit 6e17c5c

File tree

16 files changed

+33
-53
lines changed

16 files changed

+33
-53
lines changed

editor/src/dispatcher.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ mod test {
436436
// UNCOMMENT THIS FOR RUNNING UNDER MIRI
437437
//
438438
// let files = [
439-
// include_str!("../../demo-artwork/isometric-fountain.graphite"),
440-
// include_str!("../../demo-artwork/just-a-potted-cactus.graphite"),
441-
// include_str!("../../demo-artwork/procedural-string-lights.graphite"),
439+
// include_str!("../../demo-artwork/isometric-fountain.graphite").to_string(),
440+
// include_str!("../../demo-artwork/just-a-potted-cactus.graphite").to_string(),
441+
// include_str!("../../demo-artwork/procedural-string-lights.graphite").to_string(),
442442
// include_str!("../../demo-artwork/red-dress.graphite"),
443443
// include_str!("../../demo-artwork/valley-of-spires.graphite"),
444444
// ];
@@ -456,14 +456,14 @@ mod test {
456456

457457
let responses = editor.handle_message(PortfolioMessage::OpenDocumentFile {
458458
document_name: document_name.into(),
459-
document_serialized_content: document_serialized_content.into(),
459+
document_serialized_content,
460460
});
461461

462462
// Check if the graph renders
463463
let portfolio = &mut editor.dispatcher.message_handlers.portfolio_message_handler;
464464
portfolio
465465
.executor
466-
.submit_node_graph_evaluation(portfolio.documents.get_mut(&portfolio.active_document_id.unwrap()).unwrap(), glam::UVec2::ONE)
466+
.submit_node_graph_evaluation(portfolio.documents.get_mut(&portfolio.active_document_id.unwrap()).unwrap(), glam::UVec2::ONE, true)
467467
.expect("submit_node_graph_evaluation failed");
468468
crate::node_graph_executor::run_node_graph().await;
469469
let mut messages = VecDeque::new();

editor/src/messages/portfolio/document/node_graph/document_node_types.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ use crate::messages::portfolio::utility_types::PersistentData;
66
use crate::messages::prelude::Message;
77
use crate::node_graph_executor::NodeGraphExecutor;
88

9-
#[cfg(feature = "gpu")]
10-
use gpu_executor::*;
119
use graph_craft::concrete;
1210
use graph_craft::document::value::*;
1311
use graph_craft::document::*;

editor/src/messages/portfolio/portfolio_message_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
289289
self.executor.update_font_cache(self.persistent_data.font_cache.clone());
290290
for document_id in self.document_ids.iter() {
291291
let _ = self.executor.submit_node_graph_evaluation(
292-
self.documents.get_mut(&document_id).expect("Tried to render no existent Document"),
292+
self.documents.get_mut(document_id).expect("Tried to render no existent Document"),
293293
ipp.viewport_bounds.size().as_uvec2(),
294294
true,
295295
);

editor/src/node_graph_executor.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ use interpreted_executor::dynamic_executor::{DynamicExecutor, ResolvedDocumentNo
2525

2626
use glam::{DAffine2, DVec2, UVec2};
2727
use std::cell::RefCell;
28-
use std::collections::hash_map::DefaultHasher;
29-
use std::hash::Hash;
30-
use std::hash::Hasher;
3128
use std::rc::Rc;
3229
use std::sync::mpsc::{Receiver, Sender};
3330
use std::sync::Arc;
@@ -43,8 +40,6 @@ pub struct NodeRuntime {
4340
recompile_graph: bool,
4441

4542
editor_api: Arc<WasmEditorApi>,
46-
47-
graph_hash: Option<u64>,
4843
node_graph_errors: GraphErrors,
4944
resolved_types: ResolvedDocumentNodeTypes,
5045
monitor_nodes: Vec<Vec<NodeId>>,
@@ -92,7 +87,7 @@ pub struct ExecutionResponse {
9287
new_upstream_transforms: HashMap<NodeId, (Footprint, DAffine2)>,
9388
transform: DAffine2,
9489
}
95-
pub(crate) struct CompilationResponse {
90+
pub struct CompilationResponse {
9691
result: Result<(), String>,
9792
resolved_types: ResolvedDocumentNodeTypes,
9893
node_graph_errors: GraphErrors,
@@ -144,7 +139,6 @@ impl NodeRuntime {
144139
}
145140
.into(),
146141

147-
graph_hash: None,
148142
node_graph_errors: Vec::new(),
149143
resolved_types: ResolvedDocumentNodeTypes::default(),
150144
monitor_nodes: Vec::new(),

node-graph/gcore/src/application_io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::vector::style::ViewMode;
55
use dyn_any::{DynAny, StaticType, StaticTypeSized};
66

77
use alloc::sync::Arc;
8-
use core::fmt::{Debug, Write};
8+
use core::fmt::Debug;
99
use core::future::Future;
1010
use core::hash::{Hash, Hasher};
1111
use core::pin::Pin;

node-graph/gcore/src/graphic_element.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
use crate::application_io::{SurfaceHandle, SurfaceHandleFrame};
1+
use crate::application_io::SurfaceHandleFrame;
22
use crate::raster::{BlendMode, ImageFrame};
33
use crate::renderer::GraphicElementRendered;
44
use crate::transform::Footprint;
55
use crate::vector::VectorData;
66
use crate::{Color, Node, SurfaceFrame};
77

8-
use bezier_rs::BezierHandles;
98
use dyn_any::{DynAny, StaticType};
109
use node_macro::node_fn;
1110
use web_sys::HtmlCanvasElement;
@@ -328,15 +327,3 @@ impl GraphicGroup {
328327
tree
329328
}
330329
}
331-
332-
impl<'a> Into<&'a dyn GraphicElementRendered> for &'a GraphicElement {
333-
fn into(self) -> &'a dyn GraphicElementRendered {
334-
match self {
335-
GraphicElement::VectorData(vector_data) => vector_data.as_ref(),
336-
GraphicElement::ImageFrame(image_frame) => image_frame,
337-
GraphicElement::GraphicGroup(graphic_group) => graphic_group,
338-
GraphicElement::Artboard(artboard) => artboard,
339-
GraphicElement::Surface(surface) => surface,
340-
}
341-
}
342-
}

node-graph/gcore/src/graphic_element/renderer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
mod quad;
22

3-
use core::ops::Deref;
4-
53
use crate::raster::bbox::Bbox;
64
use crate::raster::{BlendMode, Image, ImageFrame};
75
use crate::transform::Transform;

node-graph/gcore/src/vector/vector_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl HandleId {
337337
}
338338

339339
#[cfg(test)]
340-
fn assert_subpath_eq(generated: &Vec<bezier_rs::Subpath<PointId>>, expected: &[bezier_rs::Subpath<PointId>]) {
340+
fn assert_subpath_eq(generated: &[bezier_rs::Subpath<PointId>], expected: &[bezier_rs::Subpath<PointId>]) {
341341
assert_eq!(generated.len(), expected.len());
342342
for (generated, expected) in generated.iter().zip(expected) {
343343
assert_eq!(generated.manipulator_groups().len(), expected.manipulator_groups().len());

node-graph/gcore/src/vector/vector_data/modification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ fn modify_existing() {
443443
false,
444444
),
445445
];
446-
let mut vector_data = VectorData::from_subpaths(&subpaths, false);
446+
let mut vector_data = VectorData::from_subpaths(subpaths, false);
447447

448448
let mut modify_new = VectorModification::create_from_vector(&vector_data);
449449
let mut modify_original = VectorModification::default();

node-graph/graph-craft/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
default = ["dealloc_nodes"]
99
serde = ["dep:serde", "graphene-core/serde", "glam/serde", "bezier-rs/serde"]
1010
dealloc_nodes = []
11-
wgpu = ["wgpu-executor"]
11+
wgpu = []
1212

1313
[dependencies]
1414
# Local dependencies
@@ -32,7 +32,7 @@ url = { workspace = true }
3232
reqwest = { workspace = true }
3333

3434
# Optional workspace dependencies
35-
wgpu-executor = { workspace = true, optional = true }
35+
wgpu-executor = { workspace = true }
3636
serde = { workspace = true, optional = true }
3737

3838
[target.'cfg(target_arch = "wasm32")'.dependencies]

node-graph/graph-craft/src/wasm_application_io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use std::pin::Pin;
1212
#[cfg(target_arch = "wasm32")]
1313
use std::sync::atomic::AtomicU64;
1414
use std::sync::Arc;
15-
#[cfg(not(target_arch = "wasm32"))]
16-
use std::sync::Mutex;
15+
// #[cfg(not(target_arch = "wasm32"))]
16+
// use std::sync::Mutex;
1717
#[cfg(feature = "tokio")]
1818
use tokio::io::AsyncReadExt;
1919
#[cfg(target_arch = "wasm32")]

node-graph/gstd/src/gpu_nodes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use graphene_core::*;
1111
use wgpu_executor::Shader;
1212
use wgpu_executor::WgpuExecutor;
1313
use wgpu_executor::WgpuShaderInput;
14-
use wgpu_executor::{Bindgroup, GpuExecutor, PipelineLayout, ShaderIO, ShaderInput};
14+
use wgpu_executor::{Bindgroup, PipelineLayout, ShaderIO, ShaderInput};
1515

1616
#[cfg(feature = "quantization")]
1717
use graphene_core::quantization::PackedPixel;

node-graph/gstd/src/vector.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::Node;
22

33
use bezier_rs::{ManipulatorGroup, Subpath};
4-
use graphene_core::raster::ImageFrame;
54
use graphene_core::transform::Transform;
65
pub use graphene_core::vector::*;
76
use graphene_core::Color;

node-graph/gstd/src/wasm_application_io.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use graphene_core::application_io::{ApplicationIo, ExportFormat, RenderConfig, SurfaceHandle, SurfaceHandleFrame};
1+
#[cfg(all(any(feature = "resvg", feature = "vello"), target_arch = "wasm32"))]
2+
use graphene_core::application_io::SurfaceHandleFrame;
3+
use graphene_core::application_io::{ApplicationIo, ExportFormat, RenderConfig, SurfaceHandle};
24
use graphene_core::raster::bbox::Bbox;
35
use graphene_core::raster::Image;
46
use graphene_core::raster::ImageFrame;
@@ -9,12 +11,11 @@ use graphene_core::Node;
911

1012
use base64::Engine;
1113
use glam::DAffine2;
12-
use wgpu_executor::WgpuSurface;
1314

1415
use core::future::Future;
1516
use std::marker::PhantomData;
1617
use std::sync::Arc;
17-
use wasm_bindgen::{Clamped, JsCast};
18+
use wasm_bindgen::JsCast;
1819
use web_sys::{CanvasRenderingContext2d, HtmlCanvasElement};
1920

2021
pub use graph_craft::wasm_application_io::*;
@@ -26,6 +27,7 @@ async fn create_surface_node<'a: 'input>(editor: &'a WasmEditorApi) -> WasmSurfa
2627
editor.application_io.as_ref().unwrap().create_surface()
2728
}
2829

30+
#[cfg(target_arch = "wasm32")]
2931
pub struct DrawImageFrameNode<Surface> {
3032
surface_handle: Surface,
3133
}

node-graph/interpreted-executor/src/node_registry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use graphene_core::transform::Footprint;
1010
use graphene_core::value::{ClonedNode, CopiedNode, ValueNode};
1111
use graphene_core::vector::brush_stroke::BrushStroke;
1212
use graphene_core::vector::VectorData;
13-
use graphene_core::{application_io::SurfaceHandle, SurfaceFrame, WasmSurfaceHandleFrame};
1413
use graphene_core::{concrete, generic, Artboard, ArtboardGroup, GraphicGroup};
1514
use graphene_core::{fn_type, raster::*};
1615
use graphene_core::{Cow, ProtoNodeIdentifier, Type};
1716
use graphene_core::{Node, NodeIO, NodeIOTypes};
17+
use graphene_core::{SurfaceFrame, WasmSurfaceHandleFrame};
1818
use graphene_std::any::{ComposeTypeErased, DowncastBothNode, DynAnyNode, FutureWrapperNode, IntoTypeErasedNode};
1919
use graphene_std::application_io::RenderConfig;
2020
use graphene_std::wasm_application_io::*;
@@ -25,7 +25,7 @@ use graphene_std::wasm_application_io::WasmEditorApi;
2525
use wgpu_executor::WgpuExecutor;
2626
use wgpu_executor::WindowHandle;
2727
#[cfg(feature = "gpu")]
28-
use wgpu_executor::{CommandBuffer, GpuExecutor, ShaderHandle, ShaderInput, ShaderInputFrame, WgpuShaderInput};
28+
use wgpu_executor::{CommandBuffer, ShaderHandle, ShaderInputFrame, WgpuShaderInput};
2929

3030
use dyn_any::StaticType;
3131
use glam::{DAffine2, DVec2, UVec2};

node-graph/wgpu-executor/src/lib.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod context;
22
mod executor;
33

44
pub use context::Context;
5-
use dyn_any::{DynAny, StaticType, StaticTypeSized};
5+
use dyn_any::{DynAny, StaticType};
66
pub use executor::GpuExecutor;
77
use glam::DAffine2;
88
use gpu_executor::{ComputePassDimensions, GPUConstant, StorageBufferOptions, TextureBufferOptions, TextureBufferType, ToStorageBuffer, ToUniformBuffer};
@@ -12,9 +12,11 @@ use anyhow::{bail, Result};
1212
use futures::Future;
1313
use graphene_core::application_io::{ApplicationIo, EditorApi, SurfaceHandle};
1414
use graphene_core::raster::color::RGBA16F;
15-
use graphene_core::raster::{Image, ImageFrame, Pixel, SRGBA8};
15+
use graphene_core::raster::{Image, ImageFrame};
1616
use graphene_core::transform::{Footprint, Transform};
17-
use graphene_core::{Color, Cow, Node, SurfaceFrame, WasmSurfaceHandle};
17+
#[cfg(target_arch = "wasm32")]
18+
use graphene_core::WasmSurfaceHandle;
19+
use graphene_core::{Color, Cow, Node, SurfaceFrame};
1820

1921
use std::pin::Pin;
2022
use std::sync::Arc;
@@ -294,7 +296,7 @@ impl WgpuExecutor {
294296
Ok(CommandBuffer(encoder.finish()))
295297
}
296298

297-
pub fn create_render_pass(&self, footprint: Footprint, texture: ShaderInputFrame, canvas: Arc<SurfaceHandle<Surface>>) -> Result<()> {
299+
pub fn create_render_pass(&self, _footprint: Footprint, texture: ShaderInputFrame, canvas: Arc<SurfaceHandle<Surface>>) -> Result<()> {
298300
let transform = texture.transform;
299301
let texture = texture.shader_input;
300302
let texture = texture.texture().expect("Expected texture input");
@@ -312,7 +314,7 @@ impl WgpuExecutor {
312314
// TODO:
313315
let resolution = transform.decompose_scale().as_uvec2();
314316
let surface_format = wgpu::TextureFormat::Bgra8Unorm;
315-
let config = wgpu::SurfaceConfiguration {
317+
let config = SurfaceConfiguration {
316318
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
317319
format: surface_format,
318320
width: resolution.x,
@@ -448,7 +450,7 @@ impl WgpuExecutor {
448450
})
449451
}
450452

451-
fn create_texture_view(&self, texture: WgpuShaderInput) -> Result<WgpuShaderInput> {
453+
pub fn create_texture_view(&self, texture: WgpuShaderInput) -> Result<WgpuShaderInput> {
452454
// Ok(ShaderInput::TextureView(texture.create_view(&wgpu::TextureViewDescriptor::default()), ) )
453455
let ShaderInput::TextureBuffer(texture, ty) = &texture else {
454456
bail!("Tried to create a texture view from a non texture");
@@ -488,7 +490,7 @@ impl WgpuExecutor {
488490
let surface_caps = surface.get_capabilities(&self.context.adapter);
489491
println!("{surface_caps:?}");
490492
let surface_format = wgpu::TextureFormat::Rgba16Float;
491-
let config = wgpu::SurfaceConfiguration {
493+
let _config = wgpu::SurfaceConfiguration {
492494
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
493495
format: surface_format,
494496
width: size.width,
@@ -896,7 +898,7 @@ async fn render_texture_node<'a: 'input, InFut: Future<Output = ShaderInputFrame
896898
) -> SurfaceFrame {
897899
let surface_id = surface.surface_id;
898900
let image = self.image.eval(footprint).await;
899-
let transform = image.transform.clone();
901+
let transform = image.transform;
900902

901903
executor.create_render_pass(footprint, image, surface).unwrap();
902904

0 commit comments

Comments
 (0)