Commit graph

183 commits

Author SHA1 Message Date
Dennis Kobert
f5fd0a8bd7 Test using slotmap 2023-06-01 23:50:34 +02:00
Dennis Kobert
95b23ce1af chechpoint 2023-06-01 22:16:39 +02:00
Dennis Kobert
503d4ebbe4 Use safe casting for creating key variants 2023-05-31 20:08:30 +02:00
Dennis Kobert
d4d6a63d84 Remove unused stuff from gstd 2023-05-31 17:13:33 +02:00
Dennis Kobert
d17c394a20 Fix formatting 2023-05-31 17:09:56 +02:00
Dennis Kobert
78618f4a84 Move memo module to core and make it safe 2023-05-31 17:04:02 +02:00
Dennis Kobert
96ee4794ec Fix test 2023-05-31 11:37:15 +02:00
Dennis Kobert
88fa67e2ff Remove unsafe from node graph evaluation 2023-05-31 11:22:32 +02:00
Dennis Kobert
75fe423f40 Make node graph test syncronous 2023-05-31 09:43:47 +02:00
Dennis Kobert
7525be5c7a Remove unsafe code 2023-05-30 22:38:56 +02:00
Dennis Kobert
259dcdc628 Use canvas as target for raster rendering (#1256)
* Implement ApplicationIo

* Simplify output duplication logic

* Fix let node initialization for ExtractImageFrame

* Async macros

* Use manual node registry impl

* Fix canvas insertion into the dom
2023-05-30 20:12:59 +02:00
Alexandru Ică
57415b948b Add the first basic version of the GPU blend node (#1243)
* Implement Gpu Blend node

* Remove duplicate shader input

* Fix formatting

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-05-28 11:34:09 +03:00
Dennis Kobert
9da83d3280 Implement basic request caching for compilation server (#1253)
* Implement basic request caching for compilation server

* Fix formatting
2023-05-28 00:52:10 +02:00
Dennis Kobert
6289d92e02 Increase WGPU limits to what's supported by the adapter (#1251)
* Increase Wgpu limits

* Fix compilation of shaders

* Unbreak debug options
2023-05-28 00:23:47 +02:00
Orson Peters
7148b199ec Make Brush tool use per-stroke options and improve its performance (#1242)
* Laid groundwork for per-stroke brush parameters.

* Added new spacing parameter.

* Added back interpolation, using spacing parameter.

* Move bounding box code into core.

* Initial working prototype of per-stroke styles.

* Removed now useless brush node properties.

* Made default spacing 50% for performance comparison.

* Quick and dirty prototype for BlitNode copied from blend.

* Fixed error after rebase.

* Optimized the blitting loop.

* Pretty big optimization for into_flat_u8.

* Insert brush node for images

* Fix starting position transform

* UX polish

* Code review nits

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-05-27 22:55:49 +02:00
Dennis Kobert
0586d52f3a Implement experimental WebGPU support (#1238)
* Web gpu execution MVP

Ready infrastructure for wgpu experimentation

Start implementing simple gpu test case

Fix Extract Node not working with nested networks

Convert inputs for extracted node to network inputs

Fix missing cors headers

Feature gate gcore to make it once again no-std compatible

Add skeleton structure gpu shader

Work on gpu node graph output saving

Fix Get and Set nodes

Fix storage nodes

Fix shader construction errors -> spirv errors

Add unsafe version

Add once cell node

Web gpu execution MVP
2023-05-27 19:27:46 +02:00
Dennis Kobert
4bd9fbd073 Make the dynamic node graph execution asynchronous (#1218)
* Make node graph execution async

Make node macro generate async node implementations

Start propagating async through the node system

Async checkpoint

Make Any<'i> Send + Sync

Determine node io type using panic node

Fix types for raster_node macro

Finish porting node registry?

Fix lifetime errors

Remove Send + Sync requirements and start making node construction async

Async MVP

Fix tests

Clippy fix

* Fix nodes

* Simplify lifetims for node macro + make node macro more modular

* Reenable more nodes

* Fix pasting images

* Remove http test from brush node

* Fix output type for cache node

* Fix types for let scope

* Fix formatting
2023-05-27 11:48:57 +02:00
0HyperCube
15eb4df8d4 Add the document graph (#1217)
* Thumbnails for the layer node

* Raster node graph frames

* Downscale to a random resolution

* Cleanup and bug fixes

* Generate paths before duplicating outputs

* Fix stable id test

* Add a document node graph

* Fix merge conflict

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-05-26 17:22:58 +01:00
isiko
8d778e4848 Introduce Split/Combine Channels nodes (#1153)
* Add Channel Extrataction Node

* Add hacky BlendModes for Inserting Color Channels

* Fix Channel Exporter

* Add Monochrome Option and Multi Output Node

* Fix Input Mapping

* Fix Formatting

* Split Alpha Extraction to seperate node

* Remove unnecessary functionality

* Add Alpha Channel as an output to the extract channel node

* Fix compilation

* Add unpolished 'Combine Channels' Node

* Fix Rebasing Issues

* Add a bit of polish

* Fix Rebase Issues

* Switch from 'ColorChannel' to 'RedGreenBlue'
I initially added an enum to hold color channels called 'ColorChannel', but while implementing the nodes, there somebody allready added a similar enum so I switched to that type

* Add correct names

* Add Improvement

- Some Performance Improvements
- Some Formatting Improvements

* Add some improvements
Most of this stuff was done by TrueDoctor in my Luchbreak :D

* Implement IO Improvements
- Converted primary output from split node to a dummy output
- Removed primary Input from split node

* Fix Formatting

* Fix Combine RGB Node (hopefully final :D )

* Swap around Inputs and Outputs
Move from ARGB -> RGBA

* Improve naming

* More naming fixes

* Fix Replace -> Into

* Rename Replacment -> Insertion

* Add blank assist area

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-05-25 12:15:00 +02:00
isiko
99d15df1e0 Add some Improvements to Mask Node (#1233)
These Improvements were proposed by nat-rix for PR #1153 but also apply to the Mask Node
2023-05-25 11:26:16 +02:00
Orson Peters
bb93d243a0 Optimize colorspace conversion (#1228)
* Enabled cross-crate inlining for release builds.

* Sprinkled inline-enabling directives in color.rs.

* Reduced abstraction in color channel handling for better inlining.

* Alpha should not use gamma.

* Oops, didn't compile.

* Added discrete sRGB <-> linear float conversion.

* Use new float <-> sRGB conversion.

* Improved comments.

* Don't convert fully transparent pixels.
2023-05-25 10:51:40 +02:00
Dennis Kobert
5816807f18 Decouple node graph execution (#1209)
* Decouple node graph execution from the main loop

* Trigger document Render + Layer updates after the graph evaluation
2023-05-25 10:36:56 +02:00
0HyperCube
6400953af5 Thumbnails for the layer node (#1210)
* Thumbnails for the layer node

* Raster node graph frames

* Downscale to a random resolution

* Cleanup and bug fixes

* Generate paths before duplicating outputs

* Fix stable id test

* Code review changes

* Code review pass with minor changes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-05-18 05:12:50 +01:00
0HyperCube
4e0c673a35 Add Layer and Artboard node definitions and underlying data structures (#1204)
* Add basic node defenitions

* Code review

* change widget code

* Artboard node changes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-05-09 21:57:22 +01:00
0HyperCube
ab2de96640 Fix brush layers growing hugely when resizing transforms with Select tool (#1201)
* Fix brush tool resize

* Fix typo

* Fix image transforms

* Remove input from image network

* Fix merge error

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-05-07 12:17:12 +01:00
0HyperCube
d7c5658852 Imaginate fixes (#1200) 2023-05-07 11:23:16 +01:00
Keavon Chambers
c79cf41c28 Show outline for image frames on hover and when selected with frame tools 2023-05-07 01:30:16 -07:00
Keavon Chambers
59adf9a032 Remove dead code from document-legacy 2023-05-06 17:03:40 -07:00
Dennis Kobert
47f9f7621e Fix "Failed to execute" dialog showing up at times (#1196)
[𝘀𝗽𝗿] initial version

Created using spr 1.3.4
2023-05-03 19:39:02 +02:00
Dennis Kobert
36f24b7730 Implement bounds input to constrain the output frame of the brush node
Test Plan:
Hook up a constraint to the brush node in the editor and
verify the result looks correct

Reviewers: 

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1195
2023-05-03 17:05:04 +02:00
Dennis Kobert
3adcc3031a Implement Infrastructure to reuse previous frames for brush drawing
Implement Infrastructuro to reuse the previous evaluation of the
node graph to blend the new stroke with instead of drawing the
entire trace from scratch.
This does not transition to a blending based approach because that still
caused regressions but allows the brush node to work with input data
natively.

Test Plan:
- Use the brush tool in the editor and check for regressions
- Evaluate the performance

Reviewers: Keavon

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1190
2023-05-03 13:14:41 +02:00
Chase
1aaf2a521b Add fill and stroke color choices to the Pen tool options bar (#1188)
* Add basic layout - WIP

* Add color input min-width -> 80px

* First pass implementation - WIP

* Allow fill to be None

* Fix null Fill color

* refactor fill and stroke options into struct

* toolbar progress - WIP

* Switch is_working_color bool to PenColorType enum

* Add todo

* Add WorkingColorChanged event

* remove unused import

* Add WorkingColor[Primary/Secondary] icons

* Allow new strokes to have no color

* Set to base color when X is pressed (as per req)

* Improve icons for new UI layout design

* Add radio buttons

* Fix menu bar Edit12px -> Edit

* Add tooltips to radio buttons

* Make the color selector only on custom

* Fix edit icon correctly this time (whoops)

* Fix working colors icons

* Changes to improve the UX

* Remove lines obviated by Default::default()

* Make Eyedropper tool use working_color_changed event

* Fix tests

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-05-03 02:08:35 +08:00
Dennis Kobert
cef1cf7587 Hide edge aliasing of hard brushes with a blur (#1189)
* [𝘀𝗽𝗿] initial version

Created using spr 1.3.4

* Formatting

Created using spr 1.3.4

* Rename aa to blur + add comment

Created using spr 1.3.4
2023-04-29 23:35:30 +02:00
Dennis Kobert
1020eb6835 Implement the Brush without relying on a stamp texture
Test Plan: Test the BrushNode in the editor

Reviewers: Keavon

Reviewed By: Keavon

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1184
2023-04-29 01:31:14 +02:00
Dennis Kobert
bea7cc8dd0 Add node introspection API
Closes #1110

Test Plan: query the introspectNode Endpoint from js

Reviewers: 

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1183
2023-04-28 00:20:39 +02:00
Dennis Kobert
a4793fb284 Implement source maps between proto/document nodes
Add the node path to the document node and carry that over to the proto
nodes which are generated from that.
This pr also adds a compiler pass to assign the paths based on the
hierarchical structure of the nodegraph.

Test Plan: - Run units tests which check the path propagation works

Reviewers: Keavon

Reviewed By: Keavon

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1181
2023-04-27 11:02:04 +02:00
0HyperCube
ef93f8442a Migrate text layers to nodes (#1155)
* Initial work towards text to node

* Add the text generate node

* Implement live edit

* Fix merge error

* Cleanup text tool

* Implement text

* Fix transforms

* Fix broken image frame

* Double click to edit text

* Fix rendering text on load

* Moving whilst editing

* Better text properties

* Prevent changing vector when there is a Text node

* Push node api

* Use node fn macro

* Stable ids

* Image module as a seperate file

* Explain check for "Input Frame" node

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-04-27 03:07:43 +01:00
Dennis Kobert
271f9d5158 Add monitor node for graph introspection
Adds a `serialize` function on Node which can be implemented by nodes to
allow introspecting their content. This pr also adds a Monitor Node that
always caches the last value it was evaluated with.

Test Plan: -

Reviewers: 0HyperCube

Reviewed By: 0HyperCube

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1165
2023-04-26 23:21:50 +02:00
nat-rix
c814abc347 Fix too many locals in wasm binary (#1159)
Split function into smaller non-inlinable ones

this fixes the issue that rust creates too many wasm locals in non-optimized
builds. That lead to a compile error in such builds.

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-04-24 21:44:06 +02:00
Dennis Kobert
497bf3dfc5 Fix ordering of MaskNode Trait Bounds
Test Plan: -

Reviewers: 

Pull Request: https://github.com/GraphiteEditor/Graphite/pull/1157
2023-04-24 20:02:45 +02:00
Dennis Kobert
366906b956 Add Luma struct (#1154)
* Make Luma usable for MaskImageNode
2023-04-23 19:42:34 +02:00
Dennis Kobert
bdc1ef926a Restructure GPU execution to model GPU pipelines in the node graph (#1088)
* Start implementing GpuExecutor for wgpu

* Implement read_output_buffer function

* Implement extraction node in the compiler

* Generate type annotations during shader compilation

* Start adding node wrapprs for graph execution api

* Wrap more of the api in nodes

* Restructure Pipeline to accept arbitrary shader inputs

* Adapt nodes to new trait definitions

* Start implementing gpu-compiler trait

* Adapt shader generation

* Hardstuck on pointer casts

* Pass nodes as references in gpu code to avoid zsts

* Update gcore to compile on the gpu

* Fix color doc tests

* Impl Node for node refs
2023-04-23 10:18:31 +02:00
Keavon Chambers
161bbc62b4 Add the Selective Color adjustment node 2023-04-19 03:02:50 -07:00
Dennis Kobert
76c754d38a Simplify node trait definition (#1146)
* Simplify node trait
2023-04-17 23:42:22 +02:00
Dennis Kobert
1d6c4f13dd Bump version of dyn-any to address missues which could lead to ub (#1145)
* Make StaticType trait unsafe

* Mark StaticTypeSized and StaticTypeClone as unsafe as well

* Update dyn-any dependency

* Update manifest links
2023-04-17 23:35:04 +02:00
Keavon Chambers
9db5ad43bf Add the Channel Mixer node (#1142)
* Add the Channel Mixer node

* Fix NodeIdentifier not found in Registry

* Add radio toggle for red/green/blue

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-04-17 12:47:24 -07:00
Dennis Kobert
a1b63811ba Impl byte size function for Color (#1141) 2023-04-17 09:58:21 +02:00
Christopher Mendoza
4c9ef0fe6c Change selection to only the duplicated layer (not both layers) when using Ctrl+D (#1118)
* Nudging is now based on local pixel dimensions

* Brush tool live preview (#1116)

* Disable vector preview for brush tool

* Fix brush preview

* Fix warping

* Left and right square brackets to change size

* Add linear interpolation

* Modfiy existing selected brush layer

* Resolve warnings

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>

* Duplicating a layer selects only new layer

* Add Ctrl+J duplicate alias hotkey

---------

Co-authored-by: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-04-16 14:42:12 -07:00
Keavon Chambers
fa23e9d55b Update nodes to work with linear color by default (#1135)
* Update nodes to work with linear color by default

* Make tests work in linear not gamma
2023-04-16 12:20:44 -07:00
Dennis Kobert
f68bc42fc9 Serialize Color as srgb (#1136) 2023-04-16 15:02:22 +02:00