mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-01 07:24:56 -10:00
Compare commits
897
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d5521b3f9 | ||
|
|
cbf011b74f | ||
|
|
37bec45aeb | ||
|
|
b9716478a0 | ||
|
|
1996d64dc7 | ||
|
|
7039bc061e | ||
|
|
526c7b850c | ||
|
|
2774595caf | ||
|
|
8d6fc2a8ea | ||
|
|
0798f0f6d2 | ||
|
|
f1136abfd4 | ||
|
|
085833d1a6 | ||
|
|
1bfddeefd6 | ||
|
|
4dfc9d3596 | ||
|
|
a66a8abf4b | ||
|
|
f32f31a57a | ||
|
|
4914c9c51a | ||
|
|
d1c52db648 | ||
|
|
0f915cfbb3 | ||
|
|
a4ed8f0031 | ||
|
|
243372dd5a | ||
|
|
91d87bd6ab | ||
|
|
772e9161b7 | ||
|
|
8c97698080 | ||
|
|
3ade7e31ff | ||
|
|
76039460d4 | ||
|
|
1f1cab1b21 | ||
|
|
6713e4ff5b | ||
|
|
7710ff64d7 | ||
|
|
b4d07595ca | ||
|
|
6b30e415e6 | ||
|
|
e3bd661f54 | ||
|
|
6e018d17d2 | ||
|
|
b5e603b784 | ||
|
|
7477cd2fab | ||
|
|
d9f045aaec | ||
|
|
c099b7e76b | ||
|
|
a024a8102f | ||
|
|
8f087a395b | ||
|
|
b345ca3fd2 | ||
|
|
baf2403d7e | ||
|
|
377ba8f00c | ||
|
|
f8f3ca5a53 | ||
|
|
a2f8a5dd6a | ||
|
|
4c3fabbaa5 | ||
|
|
e391d10831 | ||
|
|
45f0d21f25 | ||
|
|
24746da590 | ||
|
|
8ef7432e33 | ||
|
|
e4bcb13b2a | ||
|
|
275d3d0af9 | ||
|
|
02a60ce521 | ||
|
|
d033921124 | ||
|
|
4e4dc189f2 | ||
|
|
59aa4510d0 | ||
|
|
e38fab2245 | ||
|
|
7ec230b71a | ||
|
|
8f323f09bc | ||
|
|
38e4036230 | ||
|
|
658f03704f | ||
|
|
34eedcc3ac | ||
|
|
bb7c1a2073 | ||
|
|
39158dec4b | ||
|
|
28ed22824f | ||
|
|
d10ccbedac | ||
|
|
55c4e6689b | ||
|
|
0c983566f6 | ||
|
|
68c3c759d5 | ||
|
|
ac5be43448 | ||
|
|
d24919c2c3 | ||
|
|
34a9aa9a48 | ||
|
|
ae321b3409 | ||
|
|
c2fb97cc81 | ||
|
|
aa27f55ab5 | ||
|
|
8f5d500459 | ||
|
|
f7562b6fd7 | ||
|
|
fdcbdd1646 | ||
|
|
2ef9c11cd3 | ||
|
|
46c84c21fe | ||
|
|
b1b372f1d6 | ||
|
|
907b7d5ce3 | ||
|
|
ddafaaa757 | ||
|
|
2c1cca7e99 | ||
|
|
c91d0cd5a3 | ||
|
|
84ed60a404 | ||
|
|
942d138fc1 | ||
|
|
dadc8717ff | ||
|
|
9423dcada7 | ||
|
|
2941c74051 | ||
|
|
cd00af84f3 | ||
|
|
951339a6d6 | ||
|
|
f5507c0959 | ||
|
|
60bba681d3 | ||
|
|
f868aadd8d | ||
|
|
b610d9bc23 | ||
|
|
69398a6703 | ||
|
|
d7ae6029e0 | ||
|
|
343710b623 | ||
|
|
f872c5cd57 | ||
|
|
626956c950 | ||
|
|
b22bbf6d95 | ||
|
|
75117e8d6b | ||
|
|
95672018b0 | ||
|
|
d0fb9a1efc | ||
|
|
f0622d62b6 | ||
|
|
2da22f2458 | ||
|
|
849e08829d | ||
|
|
679421ec80 | ||
|
|
9a925d16e5 | ||
|
|
e49c707524 | ||
|
|
506690d109 | ||
|
|
4813fe39b0 | ||
|
|
6e44a74254 | ||
|
|
3d13dc379b | ||
|
|
aee07b052a | ||
|
|
2ed5e775e5 | ||
|
|
23e6b0f11d | ||
|
|
97d8452a1d | ||
|
|
ab32a60476 | ||
|
|
7d1303f695 | ||
|
|
f90bef159c | ||
|
|
cb30348215 | ||
|
|
3f1351e3b9 | ||
|
|
eb4a122322 | ||
|
|
358eb317d2 | ||
|
|
04a401c1b8 | ||
|
|
6f06f030d6 | ||
|
|
fac555ab3b | ||
|
|
8d111e37f5 | ||
|
|
fdf6cfe296 | ||
|
|
c6d6f9f8be | ||
|
|
68d2a06c80 | ||
|
|
0bede7969c | ||
|
|
e38926004f | ||
|
|
e8f7366a43 | ||
|
|
5e705aaa04 | ||
|
|
cc444da637 | ||
|
|
1940e430dc | ||
|
|
eaadea6593 | ||
|
|
ecd2007e63 | ||
|
|
fea741cdef | ||
|
|
98550f6f25 | ||
|
|
89b797f4c1 | ||
|
|
21cceeb7ba | ||
|
|
96024d6c2c | ||
|
|
645d346565 | ||
|
|
3e51b757db | ||
|
|
944d00cac5 | ||
|
|
e725f55043 | ||
|
|
fb35dadf1b | ||
|
|
5612b63633 | ||
|
|
97430120f4 | ||
|
|
b0567122f5 | ||
|
|
ae87be30b0 | ||
|
|
f11e6f3bc6 | ||
|
|
d2bf8f99d2 | ||
|
|
63725ea623 | ||
|
|
80746a7f55 | ||
|
|
23c7a96a94 | ||
|
|
4d9a626df2 | ||
|
|
54c5aa32f0 | ||
|
|
dd84cd7417 | ||
|
|
2a1d7d0721 | ||
|
|
34b2312113 | ||
|
|
de8713b686 | ||
|
|
7986cabadb | ||
|
|
150cfaa550 | ||
|
|
5457b4faec | ||
|
|
1c055bfaab | ||
|
|
c64a9e5cee | ||
|
|
ff2afbccda | ||
|
|
3bb6aa97b9 | ||
|
|
d5bb887b79 | ||
|
|
c2afc07a04 | ||
|
|
c8f38059f8 | ||
|
|
c7a64fff0c | ||
|
|
fd31f2d89b | ||
|
|
10256dd22c | ||
|
|
96cc520c4b | ||
|
|
8c48d5acce | ||
|
|
681b38d3d6 | ||
|
|
5a16e18b2a | ||
|
|
3c5e1b8a38 | ||
|
|
404d9f3047 | ||
|
|
c8667edacc | ||
|
|
2fa6b743fe | ||
|
|
daa8b6a5a4 | ||
|
|
39425ca7ea | ||
|
|
48e776c1af | ||
|
|
c19f79977b | ||
|
|
5c580f9dac | ||
|
|
e3b968f7e2 | ||
|
|
8f1b2bed5f | ||
|
|
c111308c67 | ||
|
|
20af96c1d9 | ||
|
|
2df0bd25c3 | ||
|
|
656daa26bc | ||
|
|
e9e7ef54f6 | ||
|
|
51662a5fe8 | ||
|
|
35a98a2975 | ||
|
|
ef6d430f97 | ||
|
|
d63362718f | ||
|
|
104b8b71e6 | ||
|
|
f635c56eab | ||
|
|
c507b35645 | ||
|
|
ba7cbd83bc | ||
|
|
69585b25e3 | ||
|
|
d117c3eace | ||
|
|
a034923695 | ||
|
|
3994312440 | ||
|
|
9a129ecf5c | ||
|
|
8e23d3509b | ||
|
|
b593b26ad7 | ||
|
|
759519782b | ||
|
|
ceb2de51fb | ||
|
|
c75c6c9695 | ||
|
|
b22158b022 | ||
|
|
e68735f98e | ||
|
|
c6e17a789b | ||
|
|
6b1e9912ef | ||
|
|
681b4033f5 | ||
|
|
4b01abe36d | ||
|
|
461ddbc872 | ||
|
|
3f082c881f | ||
|
|
faed7f81bf | ||
|
|
fd01d66070 | ||
|
|
0b922f1452 | ||
|
|
7762ab2e4c | ||
|
|
1bd4ddf377 | ||
|
|
7c8b189c71 | ||
|
|
9b3d07dc51 | ||
|
|
788fe227c6 | ||
|
|
ca44dbaf55 | ||
|
|
e907a4d574 | ||
|
|
b2265be88f | ||
|
|
049b9dbc4d | ||
|
|
79136c95be | ||
|
|
808662e3d2 | ||
|
|
2f24459344 | ||
|
|
e52a442504 | ||
|
|
5927eff059 | ||
|
|
949022cee0 | ||
|
|
0952933ede | ||
|
|
b2e5b6645c | ||
|
|
9332c7f775 | ||
|
|
0bce26c54e | ||
|
|
343cdb31a8 | ||
|
|
dcabaf1ae4 | ||
|
|
20f9780f55 | ||
|
|
eabaf82a26 | ||
|
|
85d6eda68e | ||
|
|
7af4fe4bad | ||
|
|
9bbb203da1 | ||
|
|
e00dab0dc4 | ||
|
|
5c3982fff2 | ||
|
|
3d7e85c054 | ||
|
|
95f2b3bbad | ||
|
|
515a5265fe | ||
|
|
2f65a3aee2 | ||
|
|
1964fdb99e | ||
|
|
117da97dd5 | ||
|
|
f88896a887 | ||
|
|
0eab6aa93c | ||
|
|
581bb05f5d | ||
|
|
048c458789 | ||
|
|
d241cdcb2e | ||
|
|
a770448bc9 | ||
|
|
2090e9979a | ||
|
|
a040362d4a | ||
|
|
e40fe7843d | ||
|
|
dc813e35fc | ||
|
|
f0bb2edb3d | ||
|
|
7e29fe9a31 | ||
|
|
ba0a97aefe | ||
|
|
97a43e66fb | ||
|
|
97f8113fe4 | ||
|
|
6a54dcb5da | ||
|
|
9f9899cfd0 | ||
|
|
f82b0a8fca | ||
|
|
540a4ff273 | ||
|
|
294952e152 | ||
|
|
f05a644bd9 | ||
|
|
95c1ab81f3 | ||
|
|
7ae7bda3d3 | ||
|
|
1648e33c1f | ||
|
|
8a38af5be7 | ||
|
|
7c870d9426 | ||
|
|
0882637801 | ||
|
|
9626c047a4 | ||
|
|
3e674c939b | ||
|
|
2a3f1a12a8 | ||
|
|
6ee0239b96 | ||
|
|
244b25708d | ||
|
|
a979ccd5bd | ||
|
|
fa27d53b98 | ||
|
|
cc465d6f2a | ||
|
|
21bf290013 | ||
|
|
684496109a | ||
|
|
f3faefd460 | ||
|
|
6fb6e83d68 | ||
|
|
ebbbb6bd1b | ||
|
|
03c33dc784 | ||
|
|
57ee2b00ca | ||
|
|
1158d93bb4 | ||
|
|
c1fa8ba8da | ||
|
|
f798b48b83 | ||
|
|
b286e89746 | ||
|
|
d753ce26f7 | ||
|
|
a72ac39059 | ||
|
|
1f05000238 | ||
|
|
b45cc312dd | ||
|
|
de11d29d8e | ||
|
|
194c5b2222 | ||
|
|
e8f9413e03 | ||
|
|
7bc0f042ce | ||
|
|
674b3a213f | ||
|
|
3bf32443ed | ||
|
|
5f100946f2 | ||
|
|
13abf9fa8c | ||
|
|
236ab7a11c | ||
|
|
5b008936d2 | ||
|
|
9a9436c5b9 | ||
|
|
b1d8ac0e64 | ||
|
|
a5e7a4f905 | ||
|
|
9f01e54a9b | ||
|
|
8b8cac23d1 | ||
|
|
82879c7a08 | ||
|
|
3414b32d5e | ||
|
|
971d1fb16b | ||
|
|
077d11bdba | ||
|
|
34e0fd7757 | ||
|
|
b56af15e5e | ||
|
|
cde8dd78e6 | ||
|
|
2b8ef42086 | ||
|
|
e524dff1a7 | ||
|
|
05d3d66587 | ||
|
|
26a0b901d4 | ||
|
|
97324cd852 | ||
|
|
f658665d4a | ||
|
|
a7171f5939 | ||
|
|
f2c83d2278 | ||
|
|
863b1f9993 | ||
|
|
02a40a860f | ||
|
|
b4e04e616a | ||
|
|
bc1f63ccc6 | ||
|
|
04bca4a877 | ||
|
|
cc7d700bfd | ||
|
|
2835c3b536 | ||
|
|
7a6e4f6f25 | ||
|
|
b645871dbc | ||
|
|
85ee5e41b9 | ||
|
|
d5c67eeb55 | ||
|
|
2c29d2c406 | ||
|
|
a3b62dac00 | ||
|
|
9d2071ce6a | ||
|
|
6fe1af3afe | ||
|
|
08c6d02e5b | ||
|
|
cd8ea1f554 | ||
|
|
7b9c480a8d | ||
|
|
e32ff4b7f0 | ||
|
|
78679a5ba2 | ||
|
|
51427bef5f | ||
|
|
a40e0d2887 | ||
|
|
bbbe04903f | ||
|
|
d0d9a350c7 | ||
|
|
9dccc526bb | ||
|
|
96be4ec351 | ||
|
|
62287d7893 | ||
|
|
c3b0c87cfe | ||
|
|
2770df7567 | ||
|
|
21d2994059 | ||
|
|
d5f0140f26 | ||
|
|
c4a978009a | ||
|
|
256dd26b99 | ||
|
|
06e2a049de | ||
|
|
79df7cfa87 | ||
|
|
16c7544d96 | ||
|
|
a56746c6bf | ||
|
|
456a7c868d | ||
|
|
1c9c19a697 | ||
|
|
696b625a3e | ||
|
|
4d5dce976e | ||
|
|
629a1f4b4c | ||
|
|
f6def3b911 | ||
|
|
98daa75c26 | ||
|
|
a28b9437aa | ||
|
|
6b3e4757de | ||
|
|
cb21e5960b | ||
|
|
d97fe835b5 | ||
|
|
9d876ab27d | ||
|
|
dff8ac5511 | ||
|
|
0834bff2da | ||
|
|
525e49f7e9 | ||
|
|
1596469e92 | ||
|
|
9512f7df41 | ||
|
|
24c857ddc7 | ||
|
|
2ae35a67e7 | ||
|
|
c0a8241f50 | ||
|
|
1c2ac19b16 | ||
|
|
8ae8c47fe1 | ||
|
|
023cf1bedd | ||
|
|
d106bedecd | ||
|
|
ecf94258fa | ||
|
|
22a6e0d767 | ||
|
|
9565d43481 | ||
|
|
05f6138b65 | ||
|
|
39a7c45ccd | ||
|
|
269a217cf9 | ||
|
|
5becf132e7 | ||
|
|
644e9cf91e | ||
|
|
9db91a1ac4 | ||
|
|
e59612c4ce | ||
|
|
62203cb171 | ||
|
|
21e5e06b0b | ||
|
|
b27b4c6be7 | ||
|
|
ebdb835890 | ||
|
|
de2ae29edd | ||
|
|
325e9aff06 | ||
|
|
ab7f59ca61 | ||
|
|
a0d5f418d9 | ||
|
|
9943af5248 | ||
|
|
485bac89e5 | ||
|
|
eeb1f85e25 | ||
|
|
42f4c1396b | ||
|
|
eddd742f9b | ||
|
|
0acfd3e178 | ||
|
|
29f6e686ee | ||
|
|
7cd5531730 | ||
|
|
83d03ad67d | ||
|
|
4c1974c200 | ||
|
|
4474de4662 | ||
|
|
86134c26b4 | ||
|
|
4b2430290c | ||
|
|
e686ee9f42 | ||
|
|
8cadafa063 | ||
|
|
f52009b402 | ||
|
|
ba63c26c62 | ||
|
|
0847d7b0ab | ||
|
|
5774ec215d | ||
|
|
f6c73d1c20 | ||
|
|
b6ac217b70 | ||
|
|
d44b0cd308 | ||
|
|
b152f46380 | ||
|
|
fc7348d08a | ||
|
|
6b11b47753 | ||
|
|
84fb901b5a | ||
|
|
b396d17211 | ||
|
|
cf150b5cff | ||
|
|
df8c2125d9 | ||
|
|
e0368435b9 | ||
|
|
3eba762135 | ||
|
|
881784ba66 | ||
|
|
afc2c9178e | ||
|
|
76938eb69a | ||
|
|
324b9e664c | ||
|
|
824d1162eb | ||
|
|
3d84e63ef9 | ||
|
|
7bb01c9651 | ||
|
|
c9c76df40c | ||
|
|
c32c808d5b | ||
|
|
6c0af72053 | ||
|
|
328c4f272b | ||
|
|
a59fed9d1c | ||
|
|
1444c333ab | ||
|
|
f42d12da9e | ||
|
|
fcf9396a71 | ||
|
|
e2117d9a02 | ||
|
|
d3f36a95cf | ||
|
|
c2e1208d82 | ||
|
|
6c5e3c97f8 | ||
|
|
2a2a60883d | ||
|
|
60f16d72a5 | ||
|
|
79d778a535 | ||
|
|
da45ab2f87 | ||
|
|
661e8bc569 | ||
|
|
b100892bfa | ||
|
|
b099e2faca | ||
|
|
39656d4c73 | ||
|
|
0eb440db14 | ||
|
|
211111a01f | ||
|
|
1d0337285a | ||
|
|
848ff5fd52 | ||
|
|
19aaeb374b | ||
|
|
bf269d7693 | ||
|
|
a99b2806ff | ||
|
|
e0212ca4b9 | ||
|
|
55463fe0aa | ||
|
|
4360359d60 | ||
|
|
7077e877f9 | ||
|
|
b52bf7b7d4 | ||
|
|
55115d89d5 | ||
|
|
5edb00bd9a | ||
|
|
ab822afae4 | ||
|
|
1a06d3ea80 | ||
|
|
87bd3d41df | ||
|
|
662691f32a | ||
|
|
1543d974ac | ||
|
|
79bf1ab688 | ||
|
|
211b9113a1 | ||
|
|
d41883a942 | ||
|
|
86e41a110a | ||
|
|
203910a92f | ||
|
|
a3ea6ab0af | ||
|
|
e2a142333f | ||
|
|
71ff4c937f | ||
|
|
50a618ad12 | ||
|
|
6388a32ac5 | ||
|
|
865e9713ad | ||
|
|
e529f74495 | ||
|
|
36366b34f2 | ||
|
|
11b7af61ef | ||
|
|
a10092c10c | ||
|
|
9727e14fe9 | ||
|
|
9a23b9908e | ||
|
|
4a37ce4576 | ||
|
|
5b1e1cb2fb | ||
|
|
bf486b4cb5 | ||
|
|
b7a1b3e665 | ||
|
|
342160b803 | ||
|
|
06f27f1d3a | ||
|
|
b0cc8a9243 | ||
|
|
96418e8f5d | ||
|
|
17da9ec099 | ||
|
|
d5d10fe548 | ||
|
|
4a0c2016e6 | ||
|
|
087b4cd71f | ||
|
|
9bcac1af2d | ||
|
|
ed7987c881 | ||
|
|
64fd12a1a0 | ||
|
|
0c7b5cd534 | ||
|
|
2e2c4fe180 | ||
|
|
124b17f609 | ||
|
|
eb562146ce | ||
|
|
2e842cb425 | ||
|
|
7f6571ee52 | ||
|
|
187b4c38b4 | ||
|
|
d9214c7292 | ||
|
|
df8001fca8 | ||
|
|
efd142f030 | ||
|
|
f7815d0cd0 | ||
|
|
4c45c88034 | ||
|
|
eb30ee78bc | ||
|
|
a3f88b0f96 | ||
|
|
a18b7ff79d | ||
|
|
6d0357bbcf | ||
|
|
81d0b8b8d4 | ||
|
|
116a4106c4 | ||
|
|
2ac82a10b5 | ||
|
|
90533e656f | ||
|
|
58aae4f87b | ||
|
|
095c2a6d47 | ||
|
|
35b812ccfe | ||
|
|
8e52309bb0 | ||
|
|
3a7a5f5953 | ||
|
|
b1933e3bcb | ||
|
|
2910e50b2f | ||
|
|
e7a2800665 | ||
|
|
9f9dd71e91 | ||
|
|
20501cac96 | ||
|
|
4300a885dc | ||
|
|
f06983d072 | ||
|
|
52d2b38a82 | ||
|
|
fbd2658148 | ||
|
|
3d1491ce92 | ||
|
|
5d22292072 | ||
|
|
50ef6e15cb | ||
|
|
ead914ec2b | ||
|
|
8a1dfb9d8f | ||
|
|
f00a15a4c9 | ||
|
|
5834ee9ce4 | ||
|
|
8a75c0c1e1 | ||
|
|
54a02dedd5 | ||
|
|
7cc3097acd | ||
|
|
a8b5203d6c | ||
|
|
9ecbfb7110 | ||
|
|
f1cbc4b396 | ||
|
|
81c73d11ff | ||
|
|
cde7d5f951 | ||
|
|
da7437c023 | ||
|
|
4090f6c980 | ||
|
|
e62771845f | ||
|
|
82cf8eb369 | ||
|
|
8117ddcdb3 | ||
|
|
b4679b0675 | ||
|
|
4a6cdffd84 | ||
|
|
7250b091d5 | ||
|
|
65ca8610eb | ||
|
|
3b91d02fff | ||
|
|
691d965bcf | ||
|
|
a1c1039ea1 | ||
|
|
71b4c98de7 | ||
|
|
9f2c8713ff | ||
|
|
a2d3b3f410 | ||
|
|
9d83998463 | ||
|
|
0531769c41 | ||
|
|
5aca75dcbd | ||
|
|
7ca6470656 | ||
|
|
5a1503fc98 | ||
|
|
ba177c4c5d | ||
|
|
bd1c54907d | ||
|
|
da278e0264 | ||
|
|
258748ec51 | ||
|
|
3f999bf231 | ||
|
|
6824f55929 | ||
|
|
e1357c5c34 | ||
|
|
9bf3605b85 | ||
|
|
b433ddd007 | ||
|
|
5d5993bcca | ||
|
|
e5827f2b81 | ||
|
|
f801ed72bb | ||
|
|
3571c0d577 | ||
|
|
2fe0cf7a4c | ||
|
|
3b1a51b393 | ||
|
|
723f7b14ea | ||
|
|
ed20f4ac9b | ||
|
|
20e12edd45 | ||
|
|
5b92901715 | ||
|
|
f186465220 | ||
|
|
b697cc8131 | ||
|
|
82f7dc7062 | ||
|
|
87739ff877 | ||
|
|
2f8ee1b1bf | ||
|
|
97c86125f6 | ||
|
|
df0c9dcba2 | ||
|
|
c574f58ecd | ||
|
|
84f91eb795 | ||
|
|
8738e59c21 | ||
|
|
6c10364c8c | ||
|
|
8b67840f0c | ||
|
|
f2dfd42754 | ||
|
|
1b1400b989 | ||
|
|
011bd724bc | ||
|
|
b5b896f89f | ||
|
|
119a554260 | ||
|
|
e606efd008 | ||
|
|
ea68d62ec4 | ||
|
|
cd241095a2 | ||
|
|
9ae13634d0 | ||
|
|
bb6fea95e4 | ||
|
|
f4a5c77df8 | ||
|
|
1ec75ab213 | ||
|
|
d2eaa03498 | ||
|
|
a1a9abd6a2 | ||
|
|
4cdfbb22e8 | ||
|
|
4cda1ddd29 | ||
|
|
9633de5929 | ||
|
|
0f10c242e2 | ||
|
|
2f5ccad5ea | ||
|
|
acab171bc5 | ||
|
|
5efa81df85 | ||
|
|
1a9f0a543c | ||
|
|
9c56c852ca | ||
|
|
c7e3d01e2b | ||
|
|
46989438c1 | ||
|
|
3f97ae4c57 | ||
|
|
d04def886d | ||
|
|
7e436f48f9 | ||
|
|
f36d455d03 | ||
|
|
2e297777a0 | ||
|
|
8e8428a572 | ||
|
|
ba361cdd6a | ||
|
|
910fb54c15 | ||
|
|
5ace2c9660 | ||
|
|
da518857ad | ||
|
|
390004897b | ||
|
|
ea293575e0 | ||
|
|
84e9d8c192 | ||
|
|
5fd1a24f16 | ||
|
|
19e9af3d43 | ||
|
|
3488d5b8e7 | ||
|
|
5e61d59e50 | ||
|
|
b4e9d7b9eb | ||
|
|
c07124332b | ||
|
|
a88342b8da | ||
|
|
568831bd2f | ||
|
|
ede34b1b9f | ||
|
|
7a5790744f | ||
|
|
2be7790d4d | ||
|
|
781fa7ae95 | ||
|
|
7af60e02a3 | ||
|
|
5543afd44b | ||
|
|
95d3556204 | ||
|
|
07fbcd489c | ||
|
|
fd0addf61c | ||
|
|
00718c5b61 | ||
|
|
2ffb87c9d2 | ||
|
|
915a344a05 | ||
|
|
3b55064f44 | ||
|
|
c13647aef4 | ||
|
|
c60ddcf875 | ||
|
|
73682b482b | ||
|
|
6616d1bfb1 | ||
|
|
39849c9c02 | ||
|
|
aadc989134 | ||
|
|
c46060db44 | ||
|
|
20a595db39 | ||
|
|
654a05bb41 | ||
|
|
e3ad59ad9c | ||
|
|
a6052c5819 | ||
|
|
4fea2b0fe7 | ||
|
|
479688d86b | ||
|
|
5dd11bf138 | ||
|
|
33e3a88458 | ||
|
|
d98f19bf4a | ||
|
|
1b91198b28 | ||
|
|
bd847034f3 | ||
|
|
f808e6d37c | ||
|
|
fcf32b3cff | ||
|
|
9cb856eee4 | ||
|
|
e88db022af | ||
|
|
02e3293e72 | ||
|
|
a42cad8bfb | ||
|
|
4f4ec7ffff | ||
|
|
2a59bd50bd | ||
|
|
cf85ec736f | ||
|
|
c2a29470c3 | ||
|
|
bd1f7eefdb | ||
|
|
fafc687d84 | ||
|
|
8f25eb6ca4 | ||
|
|
42440c0d0b | ||
|
|
ee2e61f38f | ||
|
|
403ab7ba31 | ||
|
|
2fa958aa79 | ||
|
|
fa45efa9e2 | ||
|
|
4ab75c9c1c | ||
|
|
0b38beb79b | ||
|
|
9f25c50ca1 | ||
|
|
63217feac6 | ||
|
|
6dea184b03 | ||
|
|
2f880fa035 | ||
|
|
415d4b578a | ||
|
|
11e2882cb2 | ||
|
|
9d26c040e9 | ||
|
|
20bbe6cdcc | ||
|
|
64ed21f694 | ||
|
|
f705d0080d | ||
|
|
123108c813 | ||
|
|
e73e524f3d | ||
|
|
c21ccf5284 | ||
|
|
d441a02e72 | ||
|
|
d16fd46399 | ||
|
|
0a5e65bc9d | ||
|
|
3000519a10 | ||
|
|
f1e8ebefc5 | ||
|
|
2c21e1a90b | ||
|
|
e99f30e633 | ||
|
|
2d6d054359 | ||
|
|
6f087eb981 | ||
|
|
14b8cdf4cb | ||
|
|
6733a24e47 | ||
|
|
b97978e91d | ||
|
|
57055e373e | ||
|
|
b4fc3d0580 | ||
|
|
820865389c | ||
|
|
e44f993095 | ||
|
|
7532bd7260 | ||
|
|
6d852f11af | ||
|
|
d6c06da878 | ||
|
|
532dc30028 | ||
|
|
90c91db550 | ||
|
|
68a9bbced0 | ||
|
|
bba771bd08 | ||
|
|
9fc98cf03f | ||
|
|
3926337b44 | ||
|
|
a6f83291b4 | ||
|
|
fb0fab0622 | ||
|
|
a5cf62a90b | ||
|
|
2e4481880e | ||
|
|
5b472a64b2 | ||
|
|
74d9c911bd | ||
|
|
8ca546c164 | ||
|
|
2ee8e56cef | ||
|
|
783ea0b437 | ||
|
|
3c4ad8b720 | ||
|
|
4581689d9c | ||
|
|
810ce40e9b | ||
|
|
6ed42d06bb | ||
|
|
39b5229df7 | ||
|
|
600fb5c28f | ||
|
|
3fd0460d03 | ||
|
|
e8ebcc2c21 | ||
|
|
94e5c8fc05 | ||
|
|
bb4516e377 | ||
|
|
406f3d93f3 | ||
|
|
221c2e9b47 | ||
|
|
f4608a6e40 | ||
|
|
8cebde76e2 | ||
|
|
ab5c87f017 | ||
|
|
8383a3afac | ||
|
|
5ebf6d6bc0 | ||
|
|
9eb8835bd5 | ||
|
|
d247b81966 | ||
|
|
eb0f019b15 | ||
|
|
117ce301b0 | ||
|
|
5ff399d3f2 | ||
|
|
96c5e3ec18 | ||
|
|
3f532e478c | ||
|
|
a932eaedcf | ||
|
|
6e66c79392 | ||
|
|
7afbeaa1f9 | ||
|
|
548e0df1a1 | ||
|
|
788e82a7d0 | ||
|
|
f61aebb777 | ||
|
|
06484ef4e0 | ||
|
|
7d739c4542 | ||
|
|
6a3b098681 | ||
|
|
57b0b9c7ed | ||
|
|
12453d2e61 | ||
|
|
85965c8b6a | ||
|
|
e751979e5c | ||
|
|
181c30bc0a | ||
|
|
ebb434692a | ||
|
|
94414adaf8 | ||
|
|
3871b6c4cf | ||
|
|
ca5785bc8f | ||
|
|
2835fbc73d | ||
|
|
ac74bd9903 | ||
|
|
0298f9a5ad | ||
|
|
4e65887b90 | ||
|
|
7f10a4258e | ||
|
|
e42950b4be | ||
|
|
f5ef1a94fe | ||
|
|
2f45cf7ff2 | ||
|
|
72a291d808 | ||
|
|
9be207f4c5 | ||
|
|
f02f834097 | ||
|
|
7254c470ef | ||
|
|
881ec0b193 | ||
|
|
3490111b96 | ||
|
|
68e67055d8 | ||
|
|
6b315c3b68 | ||
|
|
96d73a8570 | ||
|
|
0d76ffd66d | ||
|
|
6d669ad734 | ||
|
|
055d543117 | ||
|
|
0998abdaf3 | ||
|
|
0d8c521fbe | ||
|
|
c4bbb7e880 | ||
|
|
d919dfe757 | ||
|
|
7c28a53cd1 | ||
|
|
1b9a492a74 | ||
|
|
40c6c6160b | ||
|
|
e5f40a3316 | ||
|
|
f102801059 | ||
|
|
5be9b1fabc | ||
|
|
6ca25e4ea9 | ||
|
|
52e98ea8a3 | ||
|
|
3a80560a68 | ||
|
|
c4f6a2c9c1 | ||
|
|
7fbe440e73 | ||
|
|
557df6917d | ||
|
|
37bf2ade11 | ||
|
|
39f4ccf8e0 | ||
|
|
5acf50c1ef | ||
|
|
e8f18b0ac0 | ||
|
|
8d3a8c2c11 | ||
|
|
3509f0b035 | ||
|
|
591096a817 | ||
|
|
717defb2bb | ||
|
|
34d0b76333 | ||
|
|
497758c273 | ||
|
|
e366e4d64e | ||
|
|
ca70fd8380 | ||
|
|
9dd715e4e9 | ||
|
|
e39fbb8903 | ||
|
|
5df3196b58 | ||
|
|
3364059e02 | ||
|
|
55a64064b0 | ||
|
|
91b08f4b4f | ||
|
|
fc9afce504 | ||
|
|
6c033a2cd6 | ||
|
|
48ac24da14 | ||
|
|
bfba632100 | ||
|
|
074a33f58f | ||
|
|
593a89f2e2 | ||
|
|
3cfacccc61 | ||
|
|
7e8c6cc432 | ||
|
|
c697b61a7e | ||
|
|
bc66148d2b | ||
|
|
84e44810d2 | ||
|
|
ffc74273cc | ||
|
|
4bb1d05fc3 | ||
|
|
d06c8164e1 | ||
|
|
ed22e6a63d | ||
|
|
4e47b5db93 | ||
|
|
d595089bb0 | ||
|
|
04a2452333 | ||
|
|
b4be616de0 | ||
|
|
d15f63f4fd | ||
|
|
21f34ab19a | ||
|
|
09bc891ab2 | ||
|
|
46d5928724 | ||
|
|
f4a0f272dd | ||
|
|
ac4665683b | ||
|
|
edc018d7b4 | ||
|
|
9d15e56ce1 | ||
|
|
7e3ab78ea4 |
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
https://github.com/Keavon/graphite-branded-assets/archive/ca7dd793caba8999ec33fde99bb721a69c3d221f.tar.gz
|
||||||
|
77e8a6b68d67a8d5fcfd6268a6b7938ac9322d877378c6563e933a57df6da821
|
||||||
+11
-1
@@ -1,4 +1,8 @@
|
|||||||
[target.wasm32-unknown-unknown]
|
# Keep `--cfg=web_sys_unstable_apis` here so the wasm wrapper crates build with the same web-sys API signatures (e.g. `put_image_data`/`get_image_data` taking `i32` rather than `f64`) on both native and the wasm target.
|
||||||
|
[target.'cfg(not(target_family = "wasm"))']
|
||||||
|
rustflags = ["--cfg=web_sys_unstable_apis"]
|
||||||
|
|
||||||
|
[target.'cfg(target_family = "wasm")']
|
||||||
rustflags = [
|
rustflags = [
|
||||||
# Currently disabled because of https://github.com/GraphiteEditor/Graphite/issues/1262
|
# Currently disabled because of https://github.com/GraphiteEditor/Graphite/issues/1262
|
||||||
# The current simd implementation leads to undefined behavior
|
# The current simd implementation leads to undefined behavior
|
||||||
@@ -9,4 +13,10 @@ rustflags = [
|
|||||||
"-C",
|
"-C",
|
||||||
"link-arg=--max-memory=4294967296",
|
"link-arg=--max-memory=4294967296",
|
||||||
"--cfg=web_sys_unstable_apis",
|
"--cfg=web_sys_unstable_apis",
|
||||||
|
# TODO: Remove this and find a better way to stay within the 25MB limit of cloudflare pages
|
||||||
|
"-C",
|
||||||
|
"opt-level=s",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[env]
|
||||||
|
CARGO_WORKSPACE_DIR = { value = "", relative = true }
|
||||||
@@ -2,11 +2,25 @@
|
|||||||
"image": "mcr.microsoft.com/devcontainers/base:debian",
|
"image": "mcr.microsoft.com/devcontainers/base:debian",
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/rust:1": {
|
"ghcr.io/devcontainers/features/rust:1": {
|
||||||
"profile": "default"
|
"profile": "default",
|
||||||
|
"targets": "wasm32-unknown-unknown"
|
||||||
},
|
},
|
||||||
"ghcr.io/devcontainers/features/node:1": {}
|
"ghcr.io/devcontainers/features/node:1": {
|
||||||
|
// NOTICE: keep in sync with `.nvmrc`
|
||||||
|
"version": "24"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// NOTICE: keep these tool versions in sync with `.github/workflows/build.yml`, `.nix/dev.nix` and `.nix/pkgs/graphite.nix` (wasm-bindgen-cli), `tools/cargo-run/src/requirements.rs` (wasm-bindgen-cli, cargo-about), `tools/cargo-run/src/requirements/wasm_opt.rs` (Binaryen), and the `wasm-bindgen` crate in `Cargo.toml`
|
||||||
|
"containerEnv": {
|
||||||
|
"WASM_BINDGEN_CLI_VERSION": "0.2.121",
|
||||||
|
"CARGO_ABOUT_VERSION": "0.9.2",
|
||||||
|
"BINARYEN_VERSION": "130",
|
||||||
|
"CARGO_BINSTALL_VERSION": "1.23.0"
|
||||||
|
},
|
||||||
|
"onCreateCommand": {
|
||||||
|
"Install cargo-about and wasm-bindgen-cli": "curl -sSfL https://github.com/cargo-bins/cargo-binstall/releases/download/v$CARGO_BINSTALL_VERSION/cargo-binstall-$(uname -m)-unknown-linux-musl.tgz | tar xz -C $CARGO_HOME/bin && BINSTALL_DISABLE_TELEMETRY=true cargo binstall --no-confirm cargo-about@$CARGO_ABOUT_VERSION wasm-bindgen-cli@$WASM_BINDGEN_CLI_VERSION",
|
||||||
|
"Install Binaryen wasm-opt": "curl -sSfL https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-$(uname -m)-linux.tar.gz | tar xz -C $CARGO_HOME/bin --strip-components=2 binaryen-version_$BINARYEN_VERSION/bin/wasm-opt"
|
||||||
},
|
},
|
||||||
"onCreateCommand": "cargo install cargo-watch wasm-pack cargo-about && cargo install -f [email protected]",
|
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
// NOTE: Keep this in sync with `.vscode/extensions.json`
|
// NOTE: Keep this in sync with `.vscode/extensions.json`
|
||||||
@@ -16,14 +30,16 @@
|
|||||||
"tamasfe.even-better-toml",
|
"tamasfe.even-better-toml",
|
||||||
// Web
|
// Web
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
"svelte.svelte-vscode",
|
"svelte.svelte-vscode",
|
||||||
"vitaliymaz.vscode-svg-previewer",
|
"vitaliymaz.vscode-svg-previewer",
|
||||||
// Code quality
|
// Code quality
|
||||||
"wayou.vscode-todo-highlight",
|
"wayou.vscode-todo-highlight",
|
||||||
"streetsidesoftware.code-spell-checker",
|
"streetsidesoftware.code-spell-checker",
|
||||||
// Helpful
|
// Git
|
||||||
"mhutchie.git-graph",
|
"mhutchie.git-graph",
|
||||||
"qezhu.gitlink",
|
"qezhu.gitlink",
|
||||||
|
// Helpful
|
||||||
"wmaurer.change-case"
|
"wmaurer.change-case"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Keavon Chambers (@Keavon [email protected])
|
||||||
|
|
||||||
|
|
||||||
|
# Dennis Kobert (@TrueDoctor [email protected])
|
||||||
|
|
||||||
|
/document/format/ @TrueDoctor
|
||||||
|
|
||||||
|
/node-graph/graph-craft/ @TrueDoctor
|
||||||
|
/node-graph/preprocessor/ @TrueDoctor
|
||||||
|
/node-graph/node-macro/ @TrueDoctor
|
||||||
|
/node-graph/interpreted-executor/ @TrueDoctor
|
||||||
|
/node-graph/graphene-cli/ @TrueDoctor
|
||||||
|
|
||||||
|
# Timon Schelling (@timon-schelling [email protected])
|
||||||
|
|
||||||
|
/.nix/ @timon-schelling
|
||||||
|
/flake.nix @timon-schelling
|
||||||
|
/flake.lock @timon-schelling
|
||||||
|
|
||||||
|
/desktop/ @timon-schelling
|
||||||
|
|
||||||
|
/editor/src/messages/future/ @timon-schelling
|
||||||
|
/editor/src/messages/resource_storage/ @timon-schelling
|
||||||
|
/editor/src/messages/network/ @timon-schelling
|
||||||
|
/editor/src/messages/app_window/ @timon-schelling
|
||||||
|
/editor/src/messages/clipboard/ @timon-schelling
|
||||||
|
/editor/src/messages/viewport/ @timon-schelling
|
||||||
|
|
||||||
|
/libraries/wgpu-sync/ @timon-schelling
|
||||||
|
|
||||||
|
/node-graph/libraries/canvas-utils/ @timon-schelling
|
||||||
|
|
||||||
|
/tools/cargo-run/ @timon-schelling
|
||||||
|
/tools/third-party-licenses/ @timon-schelling
|
||||||
@@ -1,3 +1,13 @@
|
|||||||
<!-- Please reference any relevant issue number below, optionally with a "Closes"/"Resolves"/"Fixes" prefix -->
|
<!--
|
||||||
|
Graphite has ZERO-TOLERANCE for contributing undisclosed AI-generated content.
|
||||||
|
If your PR involves AI, you must read our AI contribution policy (it's short):
|
||||||
|
https://graphite.art/volunteer/guide/starting-a-task/ai-contribution-policy
|
||||||
|
|
||||||
Closes #
|
REMEMBER:
|
||||||
|
- You are responsible for thoroughly testing the successful implementation of your changes and ensuring no obvious regressions occur.
|
||||||
|
- Egregiously dysfunctional PRs may be assumed to be undisclosed AI slop. If in doubt, ask on Discord before attempting a PR.
|
||||||
|
- You are highly recommended to include a video showing the before-and-after behavior of your changes and screenshots of any new or modified UI.
|
||||||
|
- Remember that Graphite maintains high standards for quality and the project is not a classroom for inexperienced developers to gain industry experience.
|
||||||
|
- In this PR description, reference any relevant tasks by writing "Closes", "Resolves", or "Fixes" with the issue # or the URL of a Discord message documenting the task.
|
||||||
|
- To acknowledge that you've read this, you must delete these rules and fill in the (strictly human-written) PR description in its place.
|
||||||
|
-->
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
name: "Editor: Dev & CI"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request: {}
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="dev.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: self-hosted
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
deployments: write
|
|
||||||
pull-requests: write
|
|
||||||
actions: write
|
|
||||||
env:
|
|
||||||
RUSTC_WRAPPER: /usr/bin/sccache
|
|
||||||
CARGO_INCREMENTAL: 0
|
|
||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 📥 Clone and checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: 🗑 Clear wasm-bindgen cache
|
|
||||||
run: rm -r ~/.cache/.wasm-pack || true
|
|
||||||
|
|
||||||
- name: 🟢 Install the latest Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "latest"
|
|
||||||
|
|
||||||
- name: 🚧 Install Node dependencies
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: 🦀 Install the latest Rust
|
|
||||||
run: |
|
|
||||||
echo "Initial system version:"
|
|
||||||
rustc --version
|
|
||||||
rustup update stable
|
|
||||||
echo "Latest updated version:"
|
|
||||||
rustc --version
|
|
||||||
|
|
||||||
- name: 🦀 Fetch Rust dependencies
|
|
||||||
run: |
|
|
||||||
echo "If it fails here, the committed Cargo.lock may be out of date"
|
|
||||||
cargo fetch --locked
|
|
||||||
|
|
||||||
- name: ✂ Replace template in <head> of index.html
|
|
||||||
run: |
|
|
||||||
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
|
|
||||||
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
|
|
||||||
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
|
|
||||||
|
|
||||||
- name: 🌐 Build Graphite web code
|
|
||||||
env:
|
|
||||||
NODE_ENV: production
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
mold -run npm run build
|
|
||||||
|
|
||||||
- name: 📤 Publish to Cloudflare Pages
|
|
||||||
id: cloudflare
|
|
||||||
uses: cloudflare/pages-action@1
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
projectName: graphite-dev
|
|
||||||
directory: frontend/dist
|
|
||||||
|
|
||||||
- name: 💬 Comment build link URL to commit hash page on GitHub
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
gh api \
|
|
||||||
-X POST \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
/repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \
|
|
||||||
-f body="| 📦 **Build Complete for** $(git rev-parse HEAD) |
|
|
||||||
|-|
|
|
||||||
| ${{ steps.cloudflare.outputs.url }} |"
|
|
||||||
|
|
||||||
- name: 👕 Lint Graphite web formatting
|
|
||||||
env:
|
|
||||||
NODE_ENV: production
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm run lint
|
|
||||||
|
|
||||||
- name: 🔬 Check Rust formatting
|
|
||||||
run: |
|
|
||||||
mold -run cargo fmt --all -- --check
|
|
||||||
|
|
||||||
- name: 🦀 Build Rust code
|
|
||||||
env:
|
|
||||||
RUSTFLAGS: -Dwarnings
|
|
||||||
run: |
|
|
||||||
mold -run cargo build --all-features
|
|
||||||
|
|
||||||
- name: 🧪 Run Rust tests
|
|
||||||
run: |
|
|
||||||
mold -run cargo test --all-features
|
|
||||||
|
|
||||||
- name: 📃 Generate code documentation info for website
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
run: |
|
|
||||||
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
|
|
||||||
mkdir -p artifacts-generated
|
|
||||||
mv hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt
|
|
||||||
|
|
||||||
- name: 💿 Obtain cache of auto-generated code docs artifacts, to check if they've changed
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
id: cache-website-code-docs
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
key: website-code-docs
|
|
||||||
|
|
||||||
- name: 🔍 Check if auto-generated code docs artifacts changed
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
id: website-code-docs-changed
|
|
||||||
run: |
|
|
||||||
if ! diff --brief --recursive artifacts-generated artifacts; then
|
|
||||||
echo "Auto-generated code docs artifacts have changed."
|
|
||||||
rm -rf artifacts
|
|
||||||
mv artifacts-generated artifacts
|
|
||||||
echo "changed=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Auto-generated code docs artifacts have not changed."
|
|
||||||
rm -rf artifacts
|
|
||||||
rm -rf artifacts-generated
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: 💾 Save cache of auto-generated code docs artifacts
|
|
||||||
if: steps.website-code-docs-changed.outputs.changed == 'true'
|
|
||||||
uses: actions/cache/save@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
key: ${{ steps.cache-website-code-docs.outputs.cache-primary-key }}
|
|
||||||
|
|
||||||
- name: ♻️ Trigger website rebuild if the auto-generated code docs artifacts have changed
|
|
||||||
if: steps.website-code-docs-changed.outputs.changed == 'true'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
rm -rf artifacts
|
|
||||||
gh workflow run website.yml --ref master
|
|
||||||
|
|
||||||
# miri:
|
|
||||||
# runs-on: self-hosted
|
|
||||||
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# - name: 🧪 Run Rust miri
|
|
||||||
# run: |
|
|
||||||
# mold -run cargo +nightly miri nextest run -j32 --all-features
|
|
||||||
|
|
||||||
cargo-deny:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 📥 Clone and checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: 📜 Check crate license compatibility for root workspace
|
|
||||||
uses: EmbarkStudios/cargo-deny-action@v2
|
|
||||||
with:
|
|
||||||
command: check bans licenses sources
|
|
||||||
|
|
||||||
- name: 📜 Check crate license compatibility for /libraries/rawkit
|
|
||||||
uses: EmbarkStudios/cargo-deny-action@v2
|
|
||||||
with:
|
|
||||||
command: check bans licenses sources
|
|
||||||
manifest-path: libraries/rawkit/Cargo.toml
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
name: "Editor: Production (Latest Stable)"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "latest-stable"
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: self-hosted
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
deployments: write
|
|
||||||
env:
|
|
||||||
RUSTC_WRAPPER: /usr/bin/sccache
|
|
||||||
CARGO_INCREMENTAL: 0
|
|
||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
|
||||||
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="editor.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 📥 Clone and checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: 🗑 Clear wasm-bindgen cache
|
|
||||||
run: rm -r ~/.cache/.wasm-pack
|
|
||||||
|
|
||||||
- name: 🟢 Install the latest Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "latest"
|
|
||||||
|
|
||||||
- name: 🚧 Install Node dependencies
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: 🦀 Install the latest Rust
|
|
||||||
run: |
|
|
||||||
echo "Initial system version:"
|
|
||||||
rustc --version
|
|
||||||
rustup update stable
|
|
||||||
echo "Latest updated version:"
|
|
||||||
rustc --version
|
|
||||||
|
|
||||||
- name: ✂ Replace template in <head> of index.html
|
|
||||||
run: |
|
|
||||||
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
|
|
||||||
|
|
||||||
- name: 🌐 Build Graphite web code
|
|
||||||
env:
|
|
||||||
NODE_ENV: production
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
mold -run npm run build
|
|
||||||
|
|
||||||
- name: 📤 Publish to Cloudflare Pages
|
|
||||||
id: cloudflare
|
|
||||||
uses: cloudflare/pages-action@1
|
|
||||||
with:
|
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
projectName: graphite-editor
|
|
||||||
directory: frontend/dist
|
|
||||||
branch: master
|
|
||||||
|
|
||||||
- name: 📦 Upload assets to GitHub release
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d)
|
|
||||||
cd frontend
|
|
||||||
sed -i "s|$INDEX_HTML_HEAD_REPLACEMENT||" dist/index.html
|
|
||||||
mv dist "graphite-$DATE"
|
|
||||||
zip -r "graphite-self-hosted-build.zip" "graphite-$DATE"
|
|
||||||
gh release upload latest-stable "graphite-self-hosted-build.zip" --clobber
|
|
||||||
@@ -0,0 +1,807 @@
|
|||||||
|
name: "Build"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- latest-stable
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
web:
|
||||||
|
description: "Web"
|
||||||
|
type: boolean
|
||||||
|
windows:
|
||||||
|
description: "Windows"
|
||||||
|
type: boolean
|
||||||
|
mac:
|
||||||
|
description: "Mac"
|
||||||
|
type: boolean
|
||||||
|
linux:
|
||||||
|
description: "Linux"
|
||||||
|
type: boolean
|
||||||
|
debug:
|
||||||
|
description: "Debug build"
|
||||||
|
type: boolean
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
web:
|
||||||
|
type: boolean
|
||||||
|
windows:
|
||||||
|
type: boolean
|
||||||
|
mac:
|
||||||
|
type: boolean
|
||||||
|
linux:
|
||||||
|
type: boolean
|
||||||
|
debug:
|
||||||
|
type: boolean
|
||||||
|
checkout_repo:
|
||||||
|
type: string
|
||||||
|
checkout_ref:
|
||||||
|
type: string
|
||||||
|
pr_number:
|
||||||
|
type: string
|
||||||
|
merge_queue:
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
web:
|
||||||
|
if: github.event_name == 'push' || inputs.web
|
||||||
|
runs-on: [self-hosted, target/wasm]
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
deployments: write
|
||||||
|
pull-requests: write
|
||||||
|
actions: write
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
RUSTC_WRAPPER: /usr/bin/sccache
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
SCCACHE_DIR: /var/lib/github-actions/.cache
|
||||||
|
# NOTICE: keep these tool versions in sync with the other jobs in this file, `.devcontainer/devcontainer.json`, `.nix/dev.nix` and `.nix/pkgs/graphite.nix` (wasm-bindgen-cli), `tools/cargo-run/src/requirements.rs` (wasm-bindgen-cli, cargo-about), `tools/cargo-run/src/requirements/wasm_opt.rs` (Binaryen), and the `wasm-bindgen` crate in `Cargo.toml`
|
||||||
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: 🟢 Install Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
target: wasm32-unknown-unknown
|
||||||
|
|
||||||
|
- name: 🚧 Install wasm-bindgen-cli and Binaryen wasm-opt
|
||||||
|
run: |
|
||||||
|
if ! wasm-bindgen --version 2>/dev/null | grep -qF "$WASM_BINDGEN_CLI_VERSION"; then
|
||||||
|
cargo install -f "wasm-bindgen-cli@$WASM_BINDGEN_CLI_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
BINARYEN_DIR="$HOME/.cache/binaryen-version_$BINARYEN_VERSION"
|
||||||
|
if [ ! -x "$BINARYEN_DIR/bin/wasm-opt" ]; then
|
||||||
|
mkdir -p "$BINARYEN_DIR"
|
||||||
|
curl -sSfL "https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-x86_64-linux.tar.gz" | tar xz -C "$BINARYEN_DIR" --strip-components=1
|
||||||
|
fi
|
||||||
|
echo "$BINARYEN_DIR/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: 🔀 Choose production deployment environment and insert template
|
||||||
|
id: production-env
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.ref }}" == "refs/tags/latest-stable" ]]; then
|
||||||
|
echo "cf_project=graphite-editor" >> $GITHUB_OUTPUT
|
||||||
|
DOMAIN="editor.graphite.art"
|
||||||
|
else
|
||||||
|
echo "cf_project=graphite-dev" >> $GITHUB_OUTPUT
|
||||||
|
DOMAIN="dev.graphite.art"
|
||||||
|
fi
|
||||||
|
TEMPLATE="<script defer data-domain=\"$DOMAIN\" data-api=\"https://graphite.art/visit/event\" src=\"https://graphite.art/visit/script.hash.js\"></script>"
|
||||||
|
echo "template=$TEMPLATE" >> $GITHUB_OUTPUT
|
||||||
|
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$TEMPLATE|" frontend/index.html
|
||||||
|
|
||||||
|
- name: 🌐 Build Graphite web code
|
||||||
|
env:
|
||||||
|
NODE_ENV: production
|
||||||
|
# Split the Wasm binary to fit Cloudflare Pages' file size limit (see `wasmSplitting` in `frontend/vite.config.ts`)
|
||||||
|
SPLIT_WASM: "1"
|
||||||
|
run: mold -run cargo run build web${{ inputs.debug && ' debug' || '' }}
|
||||||
|
|
||||||
|
- name: 📤 Publish to Cloudflare Pages
|
||||||
|
if: inputs.merge_queue == false
|
||||||
|
id: cloudflare
|
||||||
|
continue-on-error: ${{ github.event_name != 'push' }}
|
||||||
|
env:
|
||||||
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$CLOUDFLARE_API_TOKEN" ]; then
|
||||||
|
echo "No Cloudflare API token available (fork PR), skipping deploy."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
DEPLOY_BRANCH="master"
|
||||||
|
else
|
||||||
|
DEPLOY_BRANCH="${{ inputs.checkout_ref || github.head_ref || github.ref_name }}"
|
||||||
|
if [ "$DEPLOY_BRANCH" = "master" ] || [ -z "$DEPLOY_BRANCH" ]; then
|
||||||
|
DEPLOY_BRANCH="preview-${{ github.run_id }}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAX_ATTEMPTS=8
|
||||||
|
DELAY=15
|
||||||
|
for ATTEMPT in $(seq 1 $MAX_ATTEMPTS); do
|
||||||
|
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS..."
|
||||||
|
npx wrangler@3 pages deploy "frontend/dist" --project-name="${{ steps.production-env.outputs.cf_project || 'graphite-dev' }}" --branch="$DEPLOY_BRANCH" --commit-dirty=true 2>&1 | tee /tmp/wrangler_output
|
||||||
|
if [ ${PIPESTATUS[0]} -eq 0 ]; then
|
||||||
|
URL=$(grep -oP 'https://[^\s]+\.pages\.dev' /tmp/wrangler_output | head -1)
|
||||||
|
echo "url=$URL" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Published successfully: $URL"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Attempt $ATTEMPT failed."
|
||||||
|
if [ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]; then
|
||||||
|
echo "Retrying in ${DELAY}s..."
|
||||||
|
sleep $DELAY
|
||||||
|
DELAY=$((DELAY * 2))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "All $MAX_ATTEMPTS Cloudflare Pages publish attempts failed."
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
- name: 🚀 Create a GitHub environment deployment
|
||||||
|
if: (inputs.checkout_repo == '' || inputs.checkout_repo == github.repository) && inputs.merge_queue == false
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CF_URL: ${{ steps.cloudflare.outputs.url }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$CF_URL" ]; then
|
||||||
|
echo "No Cloudflare URL available, skipping deployment."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "${{ github.ref }}" = "refs/tags/latest-stable" ]; then
|
||||||
|
REF="latest-stable"
|
||||||
|
ENVIRONMENT="graphite-editor (Production)"
|
||||||
|
AUTO_INACTIVE="true"
|
||||||
|
TRANSIENT_ENVIRONMENT="false"
|
||||||
|
elif [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
REF="master"
|
||||||
|
ENVIRONMENT="graphite-dev (Production)"
|
||||||
|
AUTO_INACTIVE="true"
|
||||||
|
TRANSIENT_ENVIRONMENT="false"
|
||||||
|
else
|
||||||
|
REF="${{ inputs.checkout_ref || github.head_ref || github.ref_name }}"
|
||||||
|
ENVIRONMENT="graphite-dev (Preview)"
|
||||||
|
AUTO_INACTIVE="false"
|
||||||
|
TRANSIENT_ENVIRONMENT="true"
|
||||||
|
fi
|
||||||
|
create_deployment() {
|
||||||
|
gh api \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
repos/${{ github.repository }}/deployments \
|
||||||
|
--input - \
|
||||||
|
--jq '.id' <<EOF
|
||||||
|
{
|
||||||
|
"ref": "$1",
|
||||||
|
"environment": "$ENVIRONMENT",
|
||||||
|
"auto_merge": false,
|
||||||
|
"required_contexts": [],
|
||||||
|
"auto_inactive": $AUTO_INACTIVE,
|
||||||
|
"transient_environment": $TRANSIENT_ENVIRONMENT
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
# Try branch name first (needed for GitHub's PR "View deployment" button), fall back to commit SHA if the branch was deleted
|
||||||
|
DEPLOY_ID=$(create_deployment "$REF" 2>/dev/null) || DEPLOY_ID=$(create_deployment "$(git rev-parse HEAD)")
|
||||||
|
gh api \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
repos/${{ github.repository }}/deployments/$DEPLOY_ID/statuses \
|
||||||
|
-f state=success \
|
||||||
|
-f environment_url="$CF_URL" \
|
||||||
|
-f log_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||||
|
|
||||||
|
- name: 💬 Comment with the build link
|
||||||
|
if: github.event_name != 'pull_request' && inputs.merge_queue == false
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CF_URL: ${{ steps.cloudflare.outputs.url }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$CF_URL" ]; then
|
||||||
|
echo "No Cloudflare URL available, skipping comment."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
size_of() { find frontend/dist/assets "$@" -printf '%s\n' | awk '{s+=$1} END {printf "%.2f MB", s/1048576}'; }
|
||||||
|
WASM_SIZE=$(size_of -name '*.wasm')
|
||||||
|
JS_SIZE=$(size_of -name '*.js')
|
||||||
|
CSS_SIZE=$(size_of -name '*.css')
|
||||||
|
FONT_SIZE=$(size_of \( -name '*.woff2' -o -name '*.woff' -o -name '*.ttf' -o -name '*.otf' \))
|
||||||
|
IMAGE_SIZE=$(size_of \( -name '*.png' -o -name '*.jpg' -o -name '*.svg' \))
|
||||||
|
ALL_SIZE=$(size_of -type f)
|
||||||
|
|
||||||
|
COMMENT_BODY="| 📦 **Web Build Complete for** $(git rev-parse HEAD) |
|
||||||
|
|-|
|
||||||
|
| $CF_URL |
|
||||||
|
|
||||||
|
Wasm: **$WASM_SIZE** — JS: **$JS_SIZE** — CSS: **$CSS_SIZE** — Fonts: **$FONT_SIZE** — Images: **$IMAGE_SIZE** — All Assets: **$ALL_SIZE**"
|
||||||
|
|
||||||
|
if [ "${{ github.ref }}" = "refs/tags/latest-stable" ]; then
|
||||||
|
# Push tag: skip commenting (commit was already commented on master merge)
|
||||||
|
echo "Tag push, skipping comment."
|
||||||
|
elif [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
# Push master: comment on the commit hash page
|
||||||
|
gh api \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \
|
||||||
|
-f body="$COMMENT_BODY"
|
||||||
|
elif [ "${{ github.event_name }}" != "pull_request" ]; then
|
||||||
|
# Manual trigger (workflow_dispatch, !build): comment on the PR
|
||||||
|
PR_NUMBER="${{ inputs.pr_number }}"
|
||||||
|
if [ -z "$PR_NUMBER" ]; then
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$PR_NUMBER" ]; then
|
||||||
|
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "$COMMENT_BODY"
|
||||||
|
else
|
||||||
|
echo "No open PR found, skipping comment."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: ✂ Strip template from completed build for a clean artifact
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
env:
|
||||||
|
TEMPLATE: ${{ steps.production-env.outputs.template }}
|
||||||
|
run: sed -i "s|$TEMPLATE||" frontend/dist/index.html
|
||||||
|
|
||||||
|
- name: 📦 Upload web bundle artifact
|
||||||
|
if: github.event_name != 'pull_request' && inputs.merge_queue == false
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-web-bundle
|
||||||
|
path: frontend/dist
|
||||||
|
|
||||||
|
- name: 👕 Lint Graphite web formatting
|
||||||
|
env:
|
||||||
|
NODE_ENV: production
|
||||||
|
run: |
|
||||||
|
cd frontend
|
||||||
|
npm run check
|
||||||
|
|
||||||
|
- name: 📃 Trigger website rebuild if auto-generated code docs are stale
|
||||||
|
if: github.event_name == 'push' && github.ref != 'refs/tags/latest-stable'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
cargo run -p editor-message-tree -- website/generated
|
||||||
|
TREE=volunteer/guide/codebase-overview/hierarchical-message-system-tree
|
||||||
|
curl -sf "https://graphite.art/$TREE.txt" -o "website/static/$TREE.live.txt" \
|
||||||
|
&& diff -q "website/static/$TREE.txt" "website/static/$TREE.live.txt" > /dev/null \
|
||||||
|
|| gh workflow run website.yml --ref master
|
||||||
|
|
||||||
|
windows:
|
||||||
|
if: (github.event_name == 'push' && github.ref != 'refs/tags/latest-stable') || inputs.windows
|
||||||
|
runs-on: windows-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
# NOTICE: keep these tool versions in sync with the other jobs in this file, `.devcontainer/devcontainer.json`, `.nix/dev.nix` and `.nix/pkgs/graphite.nix` (wasm-bindgen-cli), `tools/cargo-run/src/requirements.rs` (wasm-bindgen-cli, cargo-about), `tools/cargo-run/src/requirements/wasm_opt.rs` (Binaryen), and the `wasm-bindgen` crate in `Cargo.toml`
|
||||||
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
|
CARGO_ABOUT_VERSION: "0.9.2"
|
||||||
|
CARGO_BINSTALL_VERSION: "1.23.0"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
target: wasm32-unknown-unknown
|
||||||
|
|
||||||
|
- name: 💾 Set up Cargo cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: 🟢 Install Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: |
|
||||||
|
package-lock.json
|
||||||
|
frontend/package-lock.json
|
||||||
|
|
||||||
|
- name: 📦 Install Cargo-binstall
|
||||||
|
uses: cargo-bins/[email protected]
|
||||||
|
with:
|
||||||
|
version: ${{ env.CARGO_BINSTALL_VERSION }}
|
||||||
|
|
||||||
|
- name: 🚧 Install native dependencies
|
||||||
|
shell: pwsh
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
BINSTALL_DISABLE_TELEMETRY: "true"
|
||||||
|
run: |
|
||||||
|
winget install --id LLVM.LLVM -e --accept-package-agreements --accept-source-agreements
|
||||||
|
winget install --id Kitware.CMake -e --accept-package-agreements --accept-source-agreements
|
||||||
|
winget install --id OpenSSL.OpenSSL -e --accept-package-agreements --accept-source-agreements
|
||||||
|
winget install --id GnuWin32.PkgConfig -e --accept-package-agreements --accept-source-agreements
|
||||||
|
|
||||||
|
"OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
|
"PKG_CONFIG_PATH=C:\Program Files\OpenSSL-Win64\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
|
|
||||||
|
curl.exe -sSfL -o "$env:RUNNER_TEMP\binaryen.tar.gz" "https://github.com/WebAssembly/binaryen/releases/download/version_$env:BINARYEN_VERSION/binaryen-version_$env:BINARYEN_VERSION-x86_64-windows.tar.gz"
|
||||||
|
tar -xzf "$env:RUNNER_TEMP\binaryen.tar.gz" -C $env:RUNNER_TEMP
|
||||||
|
"$env:RUNNER_TEMP\binaryen-version_$env:BINARYEN_VERSION\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
|
||||||
|
|
||||||
|
cargo binstall --no-confirm --force "cargo-about@$env:CARGO_ABOUT_VERSION"
|
||||||
|
cargo binstall --no-confirm --force "wasm-bindgen-cli@$env:WASM_BINDGEN_CLI_VERSION"
|
||||||
|
|
||||||
|
- name: 🏗 Build Windows bundle
|
||||||
|
shell: bash # `cargo-about` refuses to run in powershell
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
run: cargo run build desktop${{ inputs.debug && ' debug' || '' }}
|
||||||
|
|
||||||
|
- name: 📁 Stage artifacts
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
PROFILE=${{ inputs.debug && 'debug' || 'release' }}
|
||||||
|
rm -rf target/artifacts
|
||||||
|
mkdir -p target/artifacts
|
||||||
|
cp -R target/$PROFILE/Graphite target/artifacts/Graphite
|
||||||
|
|
||||||
|
- name: 📦 Upload Windows bundle
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-windows-bundle
|
||||||
|
path: target/artifacts
|
||||||
|
|
||||||
|
- name: 💬 Comment artifact link on PR
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-windows-bundle") | .id')
|
||||||
|
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
|
||||||
|
PR_NUMBER="${{ inputs.pr_number }}"
|
||||||
|
if [ -z "$PR_NUMBER" ]; then
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
|
||||||
|
BODY="| 📦 **Windows Build Complete for** $(git rev-parse HEAD) |"$'\n'
|
||||||
|
BODY+="|-|"$'\n'
|
||||||
|
BODY+="| [Download binary]($ARTIFACT_URL) |"
|
||||||
|
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "$BODY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 🔑 Azure login
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
uses: azure/login@v1
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
enable-AzPSSession: true
|
||||||
|
|
||||||
|
- name: 🔏 Sign
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
uses: azure/artifact-signing-action@v1
|
||||||
|
with:
|
||||||
|
endpoint: https://eus.codesigning.azure.net/
|
||||||
|
signing-account-name: Graphite
|
||||||
|
certificate-profile-name: Graphite
|
||||||
|
files: |
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\Graphite.exe
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\libcef.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\chrome_elf.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\vulkan-1.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\dxcompiler.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\libEGL.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\libGLESv2.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\vk_swiftshader.dll
|
||||||
|
file-digest: SHA256
|
||||||
|
timestamp-rfc3161: http://timestamp.acs.microsoft.com
|
||||||
|
timestamp-digest: SHA256
|
||||||
|
correlation-id: ${{ github.sha }}
|
||||||
|
|
||||||
|
- name: ✅ Verify signatures
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$TargetDir = "target\artifacts\Graphite"
|
||||||
|
|
||||||
|
if (-not (Test-Path $TargetDir)) {
|
||||||
|
throw "TargetDir not found: $TargetDir"
|
||||||
|
}
|
||||||
|
|
||||||
|
$UnsignedOrBad = @()
|
||||||
|
|
||||||
|
Get-ChildItem -Path $TargetDir -Recurse -File -Include *.exe,*.dll | ForEach-Object {
|
||||||
|
$sig = Get-AuthenticodeSignature -FilePath $_.FullName
|
||||||
|
|
||||||
|
if ($sig.Status -ne 'Valid') {
|
||||||
|
$UnsignedOrBad += "$($_.FullName) (Status=$($sig.Status))"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($UnsignedOrBad.Count -gt 0) {
|
||||||
|
Write-Host "Unsigned or invalid binaries detected:"
|
||||||
|
$UnsignedOrBad | ForEach-Object {
|
||||||
|
Write-Host "::error::$_"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($env:GITHUB_STEP_SUMMARY) {
|
||||||
|
"### ❌ Unsigned or invalid binaries detected" |
|
||||||
|
Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
|
||||||
|
"" | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
|
||||||
|
$UnsignedOrBad | ForEach-Object {
|
||||||
|
"* `$_" | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "All binaries are signed and valid."
|
||||||
|
|
||||||
|
if ($env:GITHUB_STEP_SUMMARY) {
|
||||||
|
"### ✅ All binaries are signed and valid" |
|
||||||
|
Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: 📦 Upload signed Windows bundle
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-windows-bundle-signed
|
||||||
|
path: target/artifacts
|
||||||
|
|
||||||
|
mac:
|
||||||
|
if: (github.event_name == 'push' && github.ref != 'refs/tags/latest-stable') || inputs.mac
|
||||||
|
runs-on: macos-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
# NOTICE: keep these tool versions in sync with the other jobs in this file, `.devcontainer/devcontainer.json`, `.nix/dev.nix` and `.nix/pkgs/graphite.nix` (wasm-bindgen-cli), `tools/cargo-run/src/requirements.rs` (wasm-bindgen-cli, cargo-about), `tools/cargo-run/src/requirements/wasm_opt.rs` (Binaryen), and the `wasm-bindgen` crate in `Cargo.toml`
|
||||||
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
|
CARGO_ABOUT_VERSION: "0.9.2"
|
||||||
|
CARGO_BINSTALL_VERSION: "1.23.0"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
target: wasm32-unknown-unknown
|
||||||
|
|
||||||
|
- name: 💾 Set up Cargo cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: 🟢 Install Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: |
|
||||||
|
package-lock.json
|
||||||
|
frontend/package-lock.json
|
||||||
|
|
||||||
|
- name: 📦 Install Cargo-binstall
|
||||||
|
uses: cargo-bins/[email protected]
|
||||||
|
with:
|
||||||
|
version: ${{ env.CARGO_BINSTALL_VERSION }}
|
||||||
|
|
||||||
|
- name: 🚧 Install native dependencies
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
BINSTALL_DISABLE_TELEMETRY: "true"
|
||||||
|
run: |
|
||||||
|
brew update
|
||||||
|
brew install \
|
||||||
|
pkg-config \
|
||||||
|
openssl@3 \
|
||||||
|
llvm
|
||||||
|
|
||||||
|
echo "OPENSSL_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV
|
||||||
|
echo "PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig" >> $GITHUB_ENV
|
||||||
|
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
BINARYEN_DIR="$HOME/.cache/binaryen-version_$BINARYEN_VERSION"
|
||||||
|
if [ ! -x "$BINARYEN_DIR/bin/wasm-opt" ]; then
|
||||||
|
mkdir -p "$BINARYEN_DIR"
|
||||||
|
curl -sSfL "https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-arm64-macos.tar.gz" | tar xz -C "$BINARYEN_DIR" --strip-components=1
|
||||||
|
fi
|
||||||
|
echo "$BINARYEN_DIR/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
cargo binstall --no-confirm --force "cargo-about@${CARGO_ABOUT_VERSION}"
|
||||||
|
cargo binstall --no-confirm --force "wasm-bindgen-cli@${WASM_BINDGEN_CLI_VERSION}"
|
||||||
|
|
||||||
|
- name: 🏗 Build Mac bundle
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
run: cargo run build desktop${{ inputs.debug && ' debug' || '' }}
|
||||||
|
|
||||||
|
- name: 📁 Stage artifacts
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
PROFILE=${{ inputs.debug && 'debug' || 'release' }}
|
||||||
|
rm -rf target/artifacts
|
||||||
|
mkdir -p target/artifacts
|
||||||
|
cp -R target/$PROFILE/Graphite.app target/artifacts/Graphite.app
|
||||||
|
|
||||||
|
- name: 📦 Upload Mac bundle
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-mac-bundle
|
||||||
|
path: target/artifacts
|
||||||
|
|
||||||
|
- name: 💬 Comment artifact link on PR
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-mac-bundle") | .id')
|
||||||
|
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
|
||||||
|
PR_NUMBER="${{ inputs.pr_number }}"
|
||||||
|
if [ -z "$PR_NUMBER" ]; then
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
|
||||||
|
BODY="| 📦 **Mac Build Complete for** $(git rev-parse HEAD) |"$'\n'
|
||||||
|
BODY+="|-|"$'\n'
|
||||||
|
BODY+="| [Download binary]($ARTIFACT_URL) |"
|
||||||
|
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "$BODY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 🔏 Sign and notarize (preparation)
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
env:
|
||||||
|
APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }}
|
||||||
|
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
mkdir -p .sign
|
||||||
|
echo "$APPLE_CERT_BASE64" | base64 --decode > .sign/certificate.p12
|
||||||
|
|
||||||
|
security create-keychain -p "" .sign/main.keychain
|
||||||
|
security default-keychain -s .sign/main.keychain
|
||||||
|
security unlock-keychain -p "" .sign/main.keychain
|
||||||
|
security set-keychain-settings -t 3600 -u .sign/main.keychain
|
||||||
|
|
||||||
|
security import .sign/certificate.p12 -k .sign/main.keychain -P "$APPLE_CERT_PASSWORD" -T /usr/bin/codesign -T /usr/bin/productsign
|
||||||
|
security set-key-partition-list -S apple-tool:,apple: -s -k "" .sign/main.keychain
|
||||||
|
|
||||||
|
cat > .sign/entitlements.plist <<'EOF'
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>com.apple.security.cs.allow-jit</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.disable-executable-page-protection</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.disable-library-validation</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: 🔏 Sign and notarize
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
env:
|
||||||
|
APPLE_EMAIL: ${{ secrets.APPLE_EMAIL }}
|
||||||
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
|
APPLE_CERT_NAME: ${{ secrets.APPLE_CERT_NAME }}
|
||||||
|
run: |
|
||||||
|
CERTIFICATE="$APPLE_CERT_NAME"
|
||||||
|
ENTITLEMENTS=".sign/entitlements.plist"
|
||||||
|
APP_PATH="target/artifacts/Graphite.app"
|
||||||
|
ZIP_PATH=".sign/Graphite.zip"
|
||||||
|
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH/Contents/Frameworks/Graphite Helper.app"
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH/Contents/Frameworks/Graphite Helper (GPU).app"
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH/Contents/Frameworks/Graphite Helper (Renderer).app"
|
||||||
|
find "$APP_PATH/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries" -name "*.dylib" -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" {} \;
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH/Contents/Frameworks/Chromium Embedded Framework.framework"
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH" --deep
|
||||||
|
|
||||||
|
codesign --verify --deep --strict --verbose=4 "$APP_PATH"
|
||||||
|
|
||||||
|
ditto -c -k --keepParent "$APP_PATH" "$ZIP_PATH"
|
||||||
|
SUBMISSION_ID=$(xcrun notarytool submit "$ZIP_PATH" --wait --output-format json --apple-id "$APPLE_EMAIL" --team-id "$APPLE_TEAM_ID" --password "$APPLE_PASSWORD" | tee /dev/stderr | jq -r '.id')
|
||||||
|
STATUS=$(xcrun notarytool info "$SUBMISSION_ID" --output-format json --apple-id "$APPLE_EMAIL" --team-id "$APPLE_TEAM_ID" --password "$APPLE_PASSWORD" | jq -r '.status')
|
||||||
|
if [ "$STATUS" != "Accepted" ]; then
|
||||||
|
echo "Notarization failed with status: $STATUS"
|
||||||
|
xcrun notarytool log "$SUBMISSION_ID" --apple-id "$APPLE_EMAIL" --team-id "$APPLE_TEAM_ID" --password "$APPLE_PASSWORD"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm "$ZIP_PATH"
|
||||||
|
|
||||||
|
xcrun stapler staple -v "$APP_PATH"
|
||||||
|
|
||||||
|
spctl -a -vv "$APP_PATH"
|
||||||
|
|
||||||
|
- name: 📦 Upload signed Mac bundle
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-mac-bundle-signed
|
||||||
|
path: target/artifacts
|
||||||
|
|
||||||
|
linux:
|
||||||
|
if: (github.event_name == 'push' && github.ref != 'refs/tags/latest-stable') || inputs.linux
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: ❄ Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
extra-conf: |
|
||||||
|
extra-substituters = https://graphite.cachix.org https://graphite-dev.cachix.org
|
||||||
|
extra-trusted-public-keys = graphite.cachix.org-1:B7Il1yMpkquN/dXM+5GRmz+4Xmu2aaCS1GcWNfFhsOo= graphite-dev.cachix.org-1:RppXYpiV1qO2TYKTkXXGHsAEQDOB5G51b3VlrN9QmbI=
|
||||||
|
|
||||||
|
- name: 🗑 Free disk space
|
||||||
|
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
|
||||||
|
|
||||||
|
- name: 📦 Build Nix package
|
||||||
|
run: nix build .#graphite${{ inputs.debug && '-dev' || '' }} --no-link --print-out-paths --print-build-logs
|
||||||
|
|
||||||
|
- name: 📤 Push to Nix cache
|
||||||
|
env:
|
||||||
|
NIX_CACHE_AUTH_TOKEN: ${{ (!inputs.debug && github.ref == 'refs/heads/master') && secrets.NIX_CACHE_AUTH_TOKEN || secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
|
||||||
|
NIX_CACHE_NAME: ${{ (!inputs.debug && github.ref == 'refs/heads/master') && 'graphite' || 'graphite-dev' }}
|
||||||
|
run: |
|
||||||
|
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
|
||||||
|
nix build .#graphite${{ inputs.debug && '-dev' || '' }} --no-link --print-out-paths | nix run nixpkgs#cachix -- push $NIX_CACHE_NAME
|
||||||
|
|
||||||
|
- name: 📤 Push Dependencies to dev Nix cache
|
||||||
|
env:
|
||||||
|
NIX_CACHE_AUTH_TOKEN: ${{ secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
|
||||||
|
NIX_CACHE_NAME: graphite-dev
|
||||||
|
run: |
|
||||||
|
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
|
||||||
|
nix build .#graphite${{ inputs.debug && '-dev' || '' }}.deps --no-link --print-out-paths | nix run nixpkgs#cachix -- push $NIX_CACHE_NAME
|
||||||
|
|
||||||
|
- name: 🏗 Build Linux bundle
|
||||||
|
run: nix build .#graphite-bundle${{ inputs.debug && '-dev' || '' }}.tar.xz && cp ./result ./graphite-linux-bundle.tar.xz
|
||||||
|
|
||||||
|
- name: 📦 Upload Linux bundle
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-linux-bundle
|
||||||
|
path: graphite-linux-bundle.tar.xz
|
||||||
|
compression-level: 0
|
||||||
|
|
||||||
|
- name: 💬 Comment artifact link on PR
|
||||||
|
id: linux-comment
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-linux-bundle") | .id')
|
||||||
|
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
|
||||||
|
PR_NUMBER="${{ inputs.pr_number }}"
|
||||||
|
if [ -z "$PR_NUMBER" ]; then
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
|
||||||
|
BODY="| 📦 **Linux Build Complete for** $(git rev-parse HEAD) |"$'\n'
|
||||||
|
BODY+="|-|"$'\n'
|
||||||
|
BODY+="| [Download binary]($ARTIFACT_URL) |"
|
||||||
|
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments -f body="$BODY" --jq '.id')
|
||||||
|
echo "comment_id=$COMMENT_ID" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 🔧 Install Flatpak tooling
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y flatpak flatpak-builder
|
||||||
|
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||||
|
|
||||||
|
- name: 🏗 Build Flatpak
|
||||||
|
run: |
|
||||||
|
nix build .#graphite-flatpak-manifest${{ inputs.debug && '-dev' || '' }}
|
||||||
|
|
||||||
|
rm -rf .flatpak
|
||||||
|
mkdir -p .flatpak
|
||||||
|
|
||||||
|
cp ./result .flatpak/manifest.json
|
||||||
|
|
||||||
|
cd .flatpak
|
||||||
|
mkdir -p repo
|
||||||
|
|
||||||
|
flatpak-builder --user --force-clean --install-deps-from=flathub --repo=repo build ./manifest.json
|
||||||
|
|
||||||
|
flatpak build-bundle repo Graphite.flatpak art.graphite.Graphite --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||||
|
|
||||||
|
- name: 📦 Upload Flatpak package
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-flatpak
|
||||||
|
path: .flatpak/Graphite.flatpak
|
||||||
|
compression-level: 0
|
||||||
|
|
||||||
|
- name: 💬 Update PR comment with Flatpak artifact link
|
||||||
|
if: github.event_name != 'push' && steps.linux-comment.outputs.comment_id
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-flatpak") | .id')
|
||||||
|
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
|
||||||
|
COMMENT_ID="${{ steps.linux-comment.outputs.comment_id }}"
|
||||||
|
if [ -n "$ARTIFACT_ID" ]; then
|
||||||
|
EXISTING_BODY=$(gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body')
|
||||||
|
BODY="$EXISTING_BODY"$'\n'
|
||||||
|
BODY+="| [Download Flatpak]($ARTIFACT_URL) |"
|
||||||
|
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH -f body="$BODY"
|
||||||
|
fi
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
name: "Audit Security Advisories"
|
name: "Audit Security Advisories"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Run once each day
|
# Run once each week
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * 0"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cargo-deny:
|
cargo-deny:
|
||||||
|
if: github.repository == 'GraphiteEditor/Graphite' # Don't run on forks by default
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone and checkout repository
|
- name: 📥 Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 🔒 Check crate security advisories for root workspace
|
- name: 🔒 Check crate security advisories for root workspace
|
||||||
uses: EmbarkStudios/cargo-deny-action@v2
|
uses: EmbarkStudios/cargo-deny-action@v2
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
name: "Check"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request: {}
|
||||||
|
merge_group: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Check if CI can be skipped (for merge queue deduplication)
|
||||||
|
skip-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
skip: ${{ steps.check.outputs.skip-check }}
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 🚦 Check if CI can be skipped
|
||||||
|
id: check
|
||||||
|
uses: cariad-tech/merge-queue-ci-skipper@cf80db21fc70244e36487acc531b3f1118889b0a
|
||||||
|
|
||||||
|
# Build the web app via the shared build workflow
|
||||||
|
build:
|
||||||
|
needs: skip-check
|
||||||
|
if: needs.skip-check.outputs.skip != 'true'
|
||||||
|
uses: ./.github/workflows/build.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
web: true
|
||||||
|
merge_queue: ${{ github.event_name == 'merge_group' }}
|
||||||
|
|
||||||
|
# Run the Rust tests on the self-hosted native runner
|
||||||
|
test:
|
||||||
|
needs: skip-check
|
||||||
|
if: needs.skip-check.outputs.skip != 'true'
|
||||||
|
runs-on: [self-hosted, target/native]
|
||||||
|
env:
|
||||||
|
RUSTC_WRAPPER: /usr/bin/sccache
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
SCCACHE_DIR: /var/lib/github-actions/.cache
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
|
||||||
|
- name: 🦀 Fetch Rust dependencies
|
||||||
|
run: cargo fetch --locked
|
||||||
|
|
||||||
|
- name: 🧪 Run Rust tests
|
||||||
|
env:
|
||||||
|
# `--cfg=web_sys_unstable_apis` mirrors the `[build]` section of `.cargo/config.toml`
|
||||||
|
RUSTFLAGS: "-Dwarnings --cfg=web_sys_unstable_apis"
|
||||||
|
run: mold -run cargo test --all-features
|
||||||
|
|
||||||
|
# Rust format check on GitHub runner
|
||||||
|
rust-fmt:
|
||||||
|
needs: skip-check
|
||||||
|
if: needs.skip-check.outputs.skip != 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
components: rustfmt
|
||||||
|
|
||||||
|
- name: 🔬 Check Rust formatting
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
# License compatibility check on GitHub runner
|
||||||
|
check-licenses:
|
||||||
|
needs: skip-check
|
||||||
|
if: needs.skip-check.outputs.skip != 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 📜 Check crate license compatibility for root workspace
|
||||||
|
uses: EmbarkStudios/cargo-deny-action@v2
|
||||||
|
with:
|
||||||
|
command: check bans licenses sources
|
||||||
|
|
||||||
|
- name: 📜 Check crate license compatibility for /libraries/rawkit
|
||||||
|
uses: EmbarkStudios/cargo-deny-action@v2
|
||||||
|
with:
|
||||||
|
command: check bans licenses sources
|
||||||
|
manifest-path: libraries/rawkit/Cargo.toml
|
||||||
@@ -1,122 +1,137 @@
|
|||||||
# USAGE:
|
# USAGE:
|
||||||
# After reviewing the code, core team members may comment on a PR with the exact text:
|
# After reviewing the code, core team members may comment on a PR with `!build` followed by optional `<target>` and `<profile>` arguments.
|
||||||
# - `!build-dev` to build with debug symbols and optimizations disabled
|
# This matches the syntax of the `cargo run build` CLI command, but allows platforms to be specified.
|
||||||
# - `!build-profiling` to build with debug symbols and optimizations enabled
|
#
|
||||||
# - `!build` to build without debug symbols and optimizations enabled
|
# `<target>`: `web` (default), `desktop` (all platforms), or `desktop:<platforms>` (subset of `windows+mac+linux`)
|
||||||
# The comment may not contain any other text, not even whitespace or newlines.
|
# `<profile>`: `release` (default) or `debug`
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
# - !build
|
||||||
|
# - !build debug
|
||||||
|
# - !build desktop
|
||||||
|
# - !build desktop:windows+mac
|
||||||
|
# - !build desktop:linux debug
|
||||||
name: "!build PR Command"
|
name: "!build PR Command"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types:
|
types:
|
||||||
- created
|
- created
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
setup:
|
||||||
# Command should be limited to core team members (those in the organization) for security.
|
# Command should be limited to core team members (those in the organization) for security.
|
||||||
# From the GitHub Actions docs:
|
# From the GitHub Actions docs:
|
||||||
# author_association = 'MEMBER': Author is a member of the organization that owns the repository.
|
# author_association = 'MEMBER': Author is a member of the organization that owns the repository.
|
||||||
if: >
|
if: >
|
||||||
github.event.issue.pull_request &&
|
github.event.issue.pull_request &&
|
||||||
github.event.comment.author_association == 'MEMBER' &&
|
github.event.comment.author_association == 'MEMBER' &&
|
||||||
(github.event.comment.body == '!build-dev' || github.event.comment.body == '!build-profiling' || github.event.comment.body == '!build')
|
startsWith(github.event.comment.body, '!build')
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
|
||||||
deployments: write
|
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
env:
|
outputs:
|
||||||
RUSTC_WRAPPER: /usr/bin/sccache
|
repo: ${{ steps.pr_info.outputs.repo }}
|
||||||
CARGO_INCREMENTAL: 0
|
ref: ${{ steps.pr_info.outputs.ref }}
|
||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
web: ${{ steps.pr_info.outputs.web }}
|
||||||
|
windows: ${{ steps.pr_info.outputs.windows }}
|
||||||
|
mac: ${{ steps.pr_info.outputs.mac }}
|
||||||
|
linux: ${{ steps.pr_info.outputs.linux }}
|
||||||
|
debug: ${{ steps.pr_info.outputs.debug }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 🔎 Find branch for this PR
|
- name: 🔎 Parse command, find branch, and set build flags
|
||||||
id: commit_info
|
id: pr_info
|
||||||
run: |
|
run: |
|
||||||
RESPONSE=$(curl -L -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
|
COMMENT="${{ github.event.comment.body }}"
|
||||||
REPO=$(echo $RESPONSE | jq -r '.head.repo.full_name')
|
|
||||||
REF=$(echo $RESPONSE | jq -r '.head.ref')
|
|
||||||
SHA=$(echo $RESPONSE | jq -r '.head.sha')
|
|
||||||
echo "repo=$REPO" >> $GITHUB_OUTPUT
|
|
||||||
echo "ref=$REF" >> $GITHUB_OUTPUT
|
|
||||||
echo "sha=$SHA" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: 📥 Clone and checkout repository
|
# Split into space-separated words
|
||||||
uses: actions/checkout@v3
|
read -ra WORDS <<< "$COMMENT"
|
||||||
with:
|
|
||||||
repository: ${{ steps.commit_info.outputs.repo }}
|
|
||||||
ref: ${{ steps.commit_info.outputs.ref }}
|
|
||||||
|
|
||||||
- name: 🗑 Clear wasm-bindgen cache
|
# First word must be "!build"
|
||||||
continue-on-error: true
|
if [[ "${WORDS[0]}" != "!build" ]]; then
|
||||||
run: rm -r ~/.cache/.wasm-pack
|
echo "::error::Expected comment to start with !build"
|
||||||
|
exit 1
|
||||||
- name: 🟢 Install the latest Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "latest"
|
|
||||||
|
|
||||||
- name: 🚧 Install Node dependencies
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: 🦀 Install the latest Rust
|
|
||||||
run: |
|
|
||||||
echo "Initial system version:"
|
|
||||||
rustc --version
|
|
||||||
rustup update stable
|
|
||||||
echo "Latest updated version:"
|
|
||||||
rustc --version
|
|
||||||
|
|
||||||
- name: ✂ Replace template in <head> of index.html
|
|
||||||
env:
|
|
||||||
INDEX_HTML_HEAD_REPLACEMENT: ""
|
|
||||||
run: |
|
|
||||||
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
|
|
||||||
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
|
|
||||||
|
|
||||||
- name: ⌨ Set build command based on comment
|
|
||||||
id: build_command
|
|
||||||
run: |
|
|
||||||
if [[ "${{ github.event.comment.body }}" == "!build-dev" ]]; then
|
|
||||||
echo "command=build-dev" >> $GITHUB_OUTPUT
|
|
||||||
elif [[ "${{ github.event.comment.body }}" == "!build-profiling" ]]; then
|
|
||||||
echo "command=build-profiling" >> $GITHUB_OUTPUT
|
|
||||||
elif [[ "${{ github.event.comment.body }}" == "!build" ]]; then
|
|
||||||
echo "command=build" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Failed to detect if the build command written in the comment should have been '!build-dev', '!build-profiling', or '!build'" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: 🌐 Build Graphite web code
|
# Initialize build flags (web defaults to true, matching the CLI default target)
|
||||||
env:
|
WEB="true"
|
||||||
NODE_ENV: production
|
WINDOWS="false"
|
||||||
run: |
|
MAC="false"
|
||||||
cd frontend
|
LINUX="false"
|
||||||
mold -run npm run ${{ steps.build_command.outputs.command }}
|
DEBUG="false"
|
||||||
|
|
||||||
- name: 📤 Publish to Cloudflare Pages
|
# Parse target (optional, defaults to `web` if omitted)
|
||||||
id: cloudflare
|
IDX=1
|
||||||
uses: cloudflare/pages-action@1
|
case "${WORDS[$IDX]:-}" in
|
||||||
continue-on-error: true
|
# Target: `web` enables just the web build (already the default, but accepted explicitly)
|
||||||
with:
|
"web")
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
((IDX++)) ;;
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
# Target: `desktop` enables all three desktop platforms
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
"desktop")
|
||||||
projectName: graphite-dev
|
WEB="false"; WINDOWS="true"; MAC="true"; LINUX="true"; ((IDX++)) ;;
|
||||||
directory: frontend/dist
|
# Target: `desktop:<platforms>` enables a subset of desktop platforms, split by `+`
|
||||||
|
desktop:*)
|
||||||
|
WEB="false"
|
||||||
|
PLATFORMS="${WORDS[$IDX]#desktop:}"
|
||||||
|
IFS='+' read -ra PARTS <<< "$PLATFORMS"
|
||||||
|
for PART in "${PARTS[@]}"; do
|
||||||
|
case "$PART" in
|
||||||
|
"windows") WINDOWS="true" ;;
|
||||||
|
"mac") MAC="true" ;;
|
||||||
|
"linux") LINUX="true" ;;
|
||||||
|
*) echo "::error::Unrecognized platform: $PART"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
((IDX++))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
- name: 💬 Comment build link
|
# Parse profile (optional, defaults to `release` if omitted)
|
||||||
uses: actions/github-script@v6
|
case "${WORDS[$IDX]:-}" in
|
||||||
|
"debug") DEBUG="true"; ((IDX++)) ;;
|
||||||
|
"release") ((IDX++)) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Reject any unexpected trailing words
|
||||||
|
if [[ $IDX -lt ${#WORDS[@]} ]]; then
|
||||||
|
echo "::error::Unexpected argument: ${WORDS[$IDX]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Write parsed build flags to job outputs
|
||||||
|
echo "web=$WEB" >> $GITHUB_OUTPUT
|
||||||
|
echo "windows=$WINDOWS" >> $GITHUB_OUTPUT
|
||||||
|
echo "mac=$MAC" >> $GITHUB_OUTPUT
|
||||||
|
echo "linux=$LINUX" >> $GITHUB_OUTPUT
|
||||||
|
echo "debug=$DEBUG" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Fetch the PR's head branch and repo (needed for forked PRs where the code lives in another repo)
|
||||||
|
RESPONSE=$(curl -L -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
|
||||||
|
echo "repo=$(echo $RESPONSE | jq -r '.head.repo.full_name')" >> $GITHUB_OUTPUT
|
||||||
|
echo "ref=$(echo $RESPONSE | jq -r '.head.ref')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: 💬 Edit comment with workflow run link
|
||||||
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
github.rest.issues.createComment({
|
github.rest.issues.updateComment({
|
||||||
issue_number: context.issue.number,
|
comment_id: ${{ github.event.comment.id }},
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: '| 📦 **Build Complete for** ${{ steps.commit_info.outputs.sha }} |\n|-|\n| ${{ steps.cloudflare.outputs.url }} |'
|
body: '${{ github.event.comment.body }} ([Run ID ' + context.runId + '](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + '))'
|
||||||
})
|
});
|
||||||
|
|
||||||
|
invoke-build:
|
||||||
|
needs: setup
|
||||||
|
uses: ./.github/workflows/build.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
web: ${{ needs.setup.outputs.web == 'true' }}
|
||||||
|
windows: ${{ needs.setup.outputs.windows == 'true' }}
|
||||||
|
mac: ${{ needs.setup.outputs.mac == 'true' }}
|
||||||
|
linux: ${{ needs.setup.outputs.linux == 'true' }}
|
||||||
|
debug: ${{ needs.setup.outputs.debug == 'true' }}
|
||||||
|
checkout_repo: ${{ needs.setup.outputs.repo }}
|
||||||
|
checkout_ref: ${{ needs.setup.outputs.ref }}
|
||||||
|
pr_number: ${{ github.event.issue.number }}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Clippy Check
|
name: "Clippy Check"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Delete previous comments
|
- name: Delete previous comments
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -76,7 +76,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Comment PR
|
- name: Comment PR
|
||||||
if: steps.clippy.outputs.CLIPPY_ISSUES_FOUND == 'true'
|
if: steps.clippy.outputs.CLIPPY_ISSUES_FOUND == 'true'
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
name: Profiling Changes
|
name: "Profiling Changes"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request: {}
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "node-graph/**"
|
||||||
|
- "Cargo.toml"
|
||||||
|
- "Cargo.lock"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
@@ -11,35 +15,21 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: Install Valgrind
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y valgrind
|
|
||||||
|
|
||||||
- name: Cache Rust dependencies
|
- name: Cache Rust dependencies
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
# Cache on Cargo.lock file
|
# Cache on Cargo.lock file
|
||||||
cache-on-failure: true
|
cache-on-failure: true
|
||||||
|
|
||||||
- name: Cache iai-callgrind binary
|
- name: Install gungraun-runner and valgrind
|
||||||
id: cache-iai
|
uses: gungraun/setup-gungraun@v1
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/bin/iai-callgrind-runner
|
|
||||||
key: ${{ runner.os }}-iai-callgrind-runner-0.16.1
|
|
||||||
|
|
||||||
- name: Install iai-callgrind
|
|
||||||
if: steps.cache-iai.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
cargo install [email protected]
|
|
||||||
|
|
||||||
- name: Checkout master branch
|
- name: Checkout master branch
|
||||||
run: |
|
run: |
|
||||||
@@ -50,42 +40,52 @@ jobs:
|
|||||||
id: master-sha
|
id: master-sha
|
||||||
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Get CPU info
|
||||||
|
id: cpu-info
|
||||||
|
run: |
|
||||||
|
# Get CPU model and create a short hash for cache key
|
||||||
|
CPU_MODEL=$(cat /proc/cpuinfo | grep "model name" | head -1 | cut -d: -f2 | xargs)
|
||||||
|
CPU_HASH=$(echo "$CPU_MODEL" | sha256sum | cut -c1-8)
|
||||||
|
echo "cpu-hash=$CPU_HASH" >> $GITHUB_OUTPUT
|
||||||
|
echo "CPU: $CPU_MODEL (hash: $CPU_HASH)"
|
||||||
|
|
||||||
- name: Cache benchmark baselines
|
- name: Cache benchmark baselines
|
||||||
id: cache-benchmark-baselines
|
id: cache-benchmark-baselines
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: target/iai
|
path: target/gungraun
|
||||||
key: ${{ runner.os }}-benchmark-baselines-master-${{ steps.master-sha.outputs.sha }}
|
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.cpu-info.outputs.cpu-hash }}-gungraun-benchmark-baselines-master-${{ steps.master-sha.outputs.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-benchmark-baselines-master-
|
${{ runner.os }}-${{ runner.arch }}-${{ steps.cpu-info.outputs.cpu-hash }}-gungraun-benchmark-baselines-master-
|
||||||
|
|
||||||
- name: Run baseline benchmarks
|
- name: Run baseline benchmarks
|
||||||
if: steps.cache-benchmark-baselines.outputs.cache-hit != 'true'
|
if: steps.cache-benchmark-baselines.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
# Compile benchmarks
|
# Compile benchmarks
|
||||||
cargo bench --bench compile_demo_art_iai -- --save-baseline=master
|
cargo bench --bench compile_demo_art_gungraun -- --save-baseline=master
|
||||||
|
|
||||||
# Runtime benchmarks
|
# Runtime benchmarks
|
||||||
cargo bench --bench update_executor_iai -- --save-baseline=master
|
cargo bench --bench update_executor_gungraun -- --save-baseline=master
|
||||||
cargo bench --bench run_once_iai -- --save-baseline=master
|
cargo bench --bench run_once_gungraun -- --save-baseline=master
|
||||||
cargo bench --bench run_cached_iai -- --save-baseline=master
|
cargo bench --bench run_cached_gungraun -- --save-baseline=master
|
||||||
|
|
||||||
- name: Checkout PR branch
|
- name: Checkout PR branch
|
||||||
run: |
|
run: git checkout ${{ github.event.pull_request.head.sha }}
|
||||||
git checkout ${{ github.event.pull_request.head.sha }}
|
|
||||||
|
|
||||||
- name: Run PR benchmarks
|
- name: Run PR benchmarks
|
||||||
run: |
|
run: |
|
||||||
# Compile benchmarks
|
# Compile benchmarks
|
||||||
cargo bench --bench compile_demo_art_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/compile_output.json
|
cargo bench --bench compile_demo_art_gungraun -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/compile_output.json
|
||||||
|
|
||||||
# Runtime benchmarks
|
# Runtime benchmarks
|
||||||
cargo bench --bench update_executor_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/update_output.json
|
cargo bench --bench update_executor_gungraun -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/update_output.json
|
||||||
cargo bench --bench run_once_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/run_once_output.json
|
cargo bench --bench run_once_gungraun -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/run_once_output.json
|
||||||
cargo bench --bench run_cached_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/run_cached_output.json
|
cargo bench --bench run_cached_gungraun -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/run_cached_output.json
|
||||||
|
|
||||||
- name: Make old comments collapsed by default
|
- name: Make old comments collapsed by default
|
||||||
uses: actions/github-script@v7
|
# Only run if we have write permissions (not a fork)
|
||||||
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -109,8 +109,75 @@ jobs:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- name: Analyze profiling changes
|
||||||
|
id: analyze
|
||||||
|
uses: actions/github-script@v8
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
function isSignificantChange(diffPct, absoluteChange, benchmarkType) {
|
||||||
|
const meetsPercentageThreshold = Math.abs(diffPct) > 5;
|
||||||
|
const meetsAbsoluteThreshold = absoluteChange > 200000;
|
||||||
|
const isCachedExecution = benchmarkType === 'run_cached' ||
|
||||||
|
benchmarkType.includes('Cached Execution');
|
||||||
|
|
||||||
|
return isCachedExecution
|
||||||
|
? (meetsPercentageThreshold && meetsAbsoluteThreshold)
|
||||||
|
: meetsPercentageThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
const allOutputs = [
|
||||||
|
JSON.parse(fs.readFileSync('/tmp/compile_output.json', 'utf8')),
|
||||||
|
JSON.parse(fs.readFileSync('/tmp/update_output.json', 'utf8')),
|
||||||
|
JSON.parse(fs.readFileSync('/tmp/run_once_output.json', 'utf8')),
|
||||||
|
JSON.parse(fs.readFileSync('/tmp/run_cached_output.json', 'utf8'))
|
||||||
|
];
|
||||||
|
const outputNames = ['compile', 'update', 'run_once', 'run_cached'];
|
||||||
|
const sectionTitles = ['Compilation', 'Update', 'Run Once', 'Cached Execution'];
|
||||||
|
|
||||||
|
let hasSignificantChanges = false;
|
||||||
|
let hasRegressions = false;
|
||||||
|
let regressionDetails = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < allOutputs.length; i++) {
|
||||||
|
const benchmarkOutput = allOutputs[i];
|
||||||
|
const outputName = outputNames[i];
|
||||||
|
const sectionTitle = sectionTitles[i];
|
||||||
|
|
||||||
|
for (const benchmark of benchmarkOutput) {
|
||||||
|
if (benchmark.profiles?.[0]?.summaries?.parts?.[0]?.metrics_summary?.Callgrind?.Ir?.diffs?.diff_pct) {
|
||||||
|
const diffPct = parseFloat(benchmark.profiles[0].summaries.parts[0].metrics_summary.Callgrind.Ir.diffs.diff_pct);
|
||||||
|
const oldValue = benchmark.profiles[0].summaries.parts[0].metrics_summary.Callgrind.Ir.metrics.Both[1].Int;
|
||||||
|
const newValue = benchmark.profiles[0].summaries.parts[0].metrics_summary.Callgrind.Ir.metrics.Both[0].Int;
|
||||||
|
const absoluteChange = Math.abs(newValue - oldValue);
|
||||||
|
|
||||||
|
if (isSignificantChange(diffPct, absoluteChange, outputName)) {
|
||||||
|
hasSignificantChanges = true;
|
||||||
|
|
||||||
|
// Only an increase in instruction count is a regression; improvements must not fail CI.
|
||||||
|
if (diffPct > 0) {
|
||||||
|
hasRegressions = true;
|
||||||
|
regressionDetails.push({
|
||||||
|
module_path: benchmark.module_path,
|
||||||
|
id: benchmark.id,
|
||||||
|
diffPct,
|
||||||
|
absoluteChange,
|
||||||
|
sectionTitle
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.setOutput('has-significant-changes', hasSignificantChanges);
|
||||||
|
core.setOutput('has-regressions', hasRegressions);
|
||||||
|
core.setOutput('regression-details', JSON.stringify(regressionDetails));
|
||||||
|
|
||||||
- name: Comment PR
|
- name: Comment PR
|
||||||
uses: actions/github-script@v7
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -121,11 +188,11 @@ jobs:
|
|||||||
const runOnceOutput = JSON.parse(fs.readFileSync('/tmp/run_once_output.json', 'utf8'));
|
const runOnceOutput = JSON.parse(fs.readFileSync('/tmp/run_once_output.json', 'utf8'));
|
||||||
const runCachedOutput = JSON.parse(fs.readFileSync('/tmp/run_cached_output.json', 'utf8'));
|
const runCachedOutput = JSON.parse(fs.readFileSync('/tmp/run_cached_output.json', 'utf8'));
|
||||||
|
|
||||||
let significantChanges = false;
|
const hasSignificantChanges = '${{ steps.analyze.outputs.has-significant-changes }}' === 'true';
|
||||||
let commentBody = "";
|
let commentBody = "";
|
||||||
|
|
||||||
function formatNumber(num) {
|
function formatNumber(num) {
|
||||||
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
return String(num).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatPercentage(pct) {
|
function formatPercentage(pct) {
|
||||||
@@ -146,6 +213,17 @@ jobs:
|
|||||||
let hasResults = false;
|
let hasResults = false;
|
||||||
let hasSignificantChanges = false;
|
let hasSignificantChanges = false;
|
||||||
|
|
||||||
|
function isSignificantChange(diffPct, absoluteChange, benchmarkType) {
|
||||||
|
const meetsPercentageThreshold = Math.abs(diffPct) > 5;
|
||||||
|
const meetsAbsoluteThreshold = absoluteChange > 200000;
|
||||||
|
const isCachedExecution = benchmarkType === 'run_cached' ||
|
||||||
|
benchmarkType.includes('Cached Execution');
|
||||||
|
|
||||||
|
return isCachedExecution
|
||||||
|
? (meetsPercentageThreshold && meetsAbsoluteThreshold)
|
||||||
|
: meetsPercentageThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
for (const benchmark of benchmarkOutput) {
|
for (const benchmark of benchmarkOutput) {
|
||||||
if (benchmark.profiles && benchmark.profiles.length > 0) {
|
if (benchmark.profiles && benchmark.profiles.length > 0) {
|
||||||
const profile = benchmark.profiles[0];
|
const profile = benchmark.profiles[0];
|
||||||
@@ -182,7 +260,7 @@ jobs:
|
|||||||
|
|
||||||
sectionBody += "```\n</details>\n\n";
|
sectionBody += "```\n</details>\n\n";
|
||||||
|
|
||||||
if (Math.abs(irDiff.diff_pct) > 5) {
|
if (isSignificantChange(irDiff.diff_pct, Math.abs(irDiff.new - irDiff.old), sectionTitle)) {
|
||||||
significantChanges = true;
|
significantChanges = true;
|
||||||
hasSignificantChanges = true;
|
hasSignificantChanges = true;
|
||||||
}
|
}
|
||||||
@@ -232,7 +310,7 @@ jobs:
|
|||||||
if (commentBody.length > 0) {
|
if (commentBody.length > 0) {
|
||||||
const output = `<details open>\n<summary>Performance Benchmark Results</summary>\n\n${commentBody}\n</details>`;
|
const output = `<details open>\n<summary>Performance Benchmark Results</summary>\n\n${commentBody}\n</details>`;
|
||||||
|
|
||||||
if (significantChanges) {
|
if (hasSignificantChanges) {
|
||||||
github.rest.issues.createComment({
|
github.rest.issues.createComment({
|
||||||
issue_number: context.issue.number,
|
issue_number: context.issue.number,
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
@@ -246,3 +324,13 @@ jobs:
|
|||||||
} else {
|
} else {
|
||||||
console.log("No benchmark results to display.");
|
console.log("No benchmark results to display.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- name: Fail on significant regressions
|
||||||
|
if: steps.analyze.outputs.has-regressions == 'true'
|
||||||
|
uses: actions/github-script@v8
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const regressionDetails = JSON.parse('${{ steps.analyze.outputs.regression-details }}');
|
||||||
|
const firstRegression = regressionDetails[0];
|
||||||
|
|
||||||
|
core.setFailed(`Significant performance regression detected: ${firstRegression.module_path} ${firstRegression.id} increased by ${firstRegression.absoluteChange.toLocaleString()} instructions (${firstRegression.diffPct.toFixed(2)}%)`);
|
||||||
@@ -25,19 +25,26 @@ jobs:
|
|||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
SCCACHE_DIR: /var/lib/github-actions/.cache
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone and checkout repository
|
- name: 📥 Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 🦀 Install the latest Rust
|
- name: 🦀 Install Rust
|
||||||
run: |
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
echo "Initial system version:"
|
with:
|
||||||
rustc --version
|
toolchain: stable
|
||||||
rustup update stable
|
override: true
|
||||||
echo "Latest updated version:"
|
cache: false
|
||||||
rustc --version
|
rustflags: ""
|
||||||
|
|
||||||
- name: 📦 Run sccache-cache
|
- name: 📦 Run sccache-cache
|
||||||
uses: mozilla-actions/[email protected]
|
uses: mozilla-actions/[email protected]
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: 🔧 Fallback if sccache fails
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
echo "sccache failed, disabling it"
|
||||||
|
echo "RUSTC_WRAPPER=" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: 🔬 Check Rust formatting
|
- name: 🔬 Check Rust formatting
|
||||||
run: |
|
run: |
|
||||||
@@ -56,4 +63,4 @@ jobs:
|
|||||||
|
|
||||||
- name: 📈 Run sccache stat for check
|
- name: 📈 Run sccache stat for check
|
||||||
shell: bash
|
shell: bash
|
||||||
run: sccache --show-stats
|
run: sccache --show-stats || echo "sccache stats unavailable"
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
name: "Nix Housekeeping"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cache-dev-shell:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: ❄ Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
extra-conf: |
|
||||||
|
extra-substituters = https://graphite.cachix.org https://graphite-dev.cachix.org
|
||||||
|
extra-trusted-public-keys = graphite.cachix.org-1:B7Il1yMpkquN/dXM+5GRmz+4Xmu2aaCS1GcWNfFhsOo= graphite-dev.cachix.org-1:RppXYpiV1qO2TYKTkXXGHsAEQDOB5G51b3VlrN9QmbI=
|
||||||
|
|
||||||
|
- name: 🔎 Check whether development shell is already in binary cache
|
||||||
|
id: cache-check
|
||||||
|
run: |
|
||||||
|
out_path="$(nix eval --raw .#devShells.x86_64-linux.default.outPath)"
|
||||||
|
if nix path-info --store https://graphite-dev.cachix.org "$out_path" &>/dev/null; then
|
||||||
|
echo "cached=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Development shell is already cached at $out_path"
|
||||||
|
else
|
||||||
|
echo "cached=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Development shell is not cached"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 📦 Build Nix development shell
|
||||||
|
if: steps.cache-check.outputs.cached == 'false'
|
||||||
|
run: nix build .#devShells.x86_64-linux.default --no-link --print-out-paths
|
||||||
|
|
||||||
|
- name: 📤 Push Nix development shell to binary cache
|
||||||
|
if: steps.cache-check.outputs.cached == 'false'
|
||||||
|
env:
|
||||||
|
NIX_CACHE_AUTH_TOKEN: ${{ secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
|
||||||
|
run: |
|
||||||
|
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
|
||||||
|
nix build .#devShells.x86_64-linux.default --no-link --print-out-paths | nix run nixpkgs#cachix -- push graphite-dev
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
name: "Provide Shaders"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: ❄ Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
extra-conf: |
|
||||||
|
extra-substituters = https://graphite.cachix.org https://graphite-dev.cachix.org
|
||||||
|
extra-trusted-public-keys = graphite.cachix.org-1:B7Il1yMpkquN/dXM+5GRmz+4Xmu2aaCS1GcWNfFhsOo= graphite-dev.cachix.org-1:RppXYpiV1qO2TYKTkXXGHsAEQDOB5G51b3VlrN9QmbI=
|
||||||
|
|
||||||
|
- name: 🏗 Build graphene raster nodes shaders
|
||||||
|
run: nix build .#graphite-raster-nodes-shaders && cp result raster_nodes_shaders_entrypoint.wgsl
|
||||||
|
|
||||||
|
- name: 📤 Upload graphene raster nodes shaders to artifacts repository
|
||||||
|
run: |
|
||||||
|
bash .github/workflows/scripts/artifact-upload.bash \
|
||||||
|
${{ vars.ARTIFACTS_REPO_OWNER }} \
|
||||||
|
${{ vars.ARTIFACTS_REPO_NAME }} \
|
||||||
|
${{ vars.ARTIFACTS_REPO_BRANCH }} \
|
||||||
|
rev/${{ github.sha }}/raster_nodes_shaders_entrypoint.wgsl \
|
||||||
|
raster_nodes_shaders_entrypoint.wgsl \
|
||||||
|
"${{ github.sha }} raster_nodes_shaders_entrypoint.wgsl" \
|
||||||
|
${{ secrets.ARTIFACTS_REPO_TOKEN }}
|
||||||
|
|
||||||
|
- name: 📤 Push shaders to dev Nix cache
|
||||||
|
env:
|
||||||
|
NIX_CACHE_AUTH_TOKEN: ${{ secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
|
||||||
|
NIX_CACHE_NAME: graphite-dev
|
||||||
|
run: |
|
||||||
|
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
|
||||||
|
nix build .#graphite-raster-nodes-shaders --no-link --print-out-paths | nix run nixpkgs#cachix -- push $NIX_CACHE_NAME
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 <owner> <repo> <branch> <target-path> <artifact-file> <commit-message> <github-token>
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
owner : GitHub user or organization of the target repo
|
||||||
|
repo : Target repo name
|
||||||
|
branch : Branch name (e.g. main)
|
||||||
|
target-path : Full path (including folders + filename) in the target repo where to upload
|
||||||
|
artifact-file : Local file path to upload
|
||||||
|
commit-message : Commit message for creating/updating the file
|
||||||
|
github-token : GitHub token (PAT or equivalent) with write access to the target repo
|
||||||
|
|
||||||
|
This will perform a GitHub API PUT to /repos/{owner}/{repo}/contents/{target-path}.
|
||||||
|
If a file already exists at that path, it will auto-detect the SHA and update; otherwise it will create a new one.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -ne 7 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
OWNER="$1"
|
||||||
|
REPO="$2"
|
||||||
|
BRANCH="$3"
|
||||||
|
TARGET_PATH="$4"
|
||||||
|
ARTIFACT_PATH="$5"
|
||||||
|
COMMIT_MSG="$6"
|
||||||
|
TOKEN="$7"
|
||||||
|
|
||||||
|
if [ ! -f "$ARTIFACT_PATH" ]; then
|
||||||
|
echo "Error: artifact file not found: $ARTIFACT_PATH" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOCAL_SHA=$(git hash-object "$ARTIFACT_PATH")
|
||||||
|
echo "Local blob SHA: $LOCAL_SHA"
|
||||||
|
|
||||||
|
GET_URL="https://api.github.com/repos/${OWNER}/${REPO}/contents/${TARGET_PATH}?ref=${BRANCH}"
|
||||||
|
GET_RESPONSE=$(curl -s -H "Authorization: token ${TOKEN}" "$GET_URL")
|
||||||
|
|
||||||
|
REMOTE_SHA=$(echo "$GET_RESPONSE" | jq -r .sha 2>/dev/null || echo "")
|
||||||
|
|
||||||
|
if [ "$REMOTE_SHA" != "null" ] && [ -n "$REMOTE_SHA" ]; then
|
||||||
|
echo "Remote blob SHA: $REMOTE_SHA"
|
||||||
|
if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
|
||||||
|
echo "The remote file is identical. Skipping upload."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Remote file differs. Preparing to upload."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No existing remote file or no SHA found. Creating."
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONTENT_TMP_BASE64=$(mktemp)
|
||||||
|
if base64 --help 2>&1 | grep -q -- "-w"; then
|
||||||
|
base64 -w 0 "$ARTIFACT_PATH" > "$CONTENT_TMP_BASE64"
|
||||||
|
else
|
||||||
|
base64 "$ARTIFACT_PATH" | tr -d '\n' > "$CONTENT_TMP_BASE64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PAYLOAD_TMP=$(mktemp)
|
||||||
|
jq -n \
|
||||||
|
--arg message "$COMMIT_MSG" \
|
||||||
|
--arg branch "$BRANCH" \
|
||||||
|
--arg sha "$REMOTE_SHA" \
|
||||||
|
--rawfile content "$CONTENT_TMP_BASE64" \
|
||||||
|
'{
|
||||||
|
message: $message,
|
||||||
|
content: $content,
|
||||||
|
branch: $branch
|
||||||
|
} + (if ($sha != "" and $sha != "null") then { sha: $sha } else {} end)' \
|
||||||
|
> "$PAYLOAD_TMP"
|
||||||
|
|
||||||
|
UPLOAD_RESPONSE=$(curl -s -X PUT \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d @"$PAYLOAD_TMP" \
|
||||||
|
"https://api.github.com/repos/${OWNER}/${REPO}/contents/${TARGET_PATH}")
|
||||||
|
|
||||||
|
echo "Upload Response:"
|
||||||
|
echo "$UPLOAD_RESPONSE"
|
||||||
|
|
||||||
|
rm -f "$CONTENT_TMP_BASE64" "$PAYLOAD_TMP"
|
||||||
@@ -1,18 +1,24 @@
|
|||||||
name: "Website"
|
name: "Website"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- website/**
|
- website/**
|
||||||
|
- frontend/eslint.config.js
|
||||||
|
- frontend/eslint-require-data-selectors.js
|
||||||
|
- frontend/package-lock.json
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- website/**
|
- website/**
|
||||||
workflow_dispatch: {}
|
- frontend/eslint.config.js
|
||||||
|
- frontend/eslint-require-data-selectors.js
|
||||||
|
- frontend/package-lock.json
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
INDEX_HTML_HEAD_INCLUSION: <script defer data-domain="graphite.rs" data-api="/visit/event" src="/visit/script.hash.js"></script>
|
INDEX_HTML_HEAD_INCLUSION: <script defer data-domain="graphite.art" data-api="/visit/event" src="/visit/script.hash.js"></script>
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -23,13 +29,22 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone and checkout repository
|
- name: 📥 Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 🟢 Install Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: |
|
||||||
|
frontend/package-lock.json
|
||||||
|
website/package-lock.json
|
||||||
|
|
||||||
- name: 🕸 Install Zola
|
- name: 🕸 Install Zola
|
||||||
uses: taiki-e/install-action@v2
|
uses: taiki-e/install-action@v2
|
||||||
with:
|
with:
|
||||||
tool: [email protected]0.0
|
tool: [email protected]2.0
|
||||||
|
|
||||||
- name: 🔍 Check if `website/other` directory changed
|
- name: 🔍 Check if `website/other` directory changed
|
||||||
uses: dorny/paths-filter@v3
|
uses: dorny/paths-filter@v3
|
||||||
@@ -44,49 +59,34 @@ jobs:
|
|||||||
# Remove the INDEX_HTML_HEAD_INCLUSION environment variable for build links (not master deploys)
|
# Remove the INDEX_HTML_HEAD_INCLUSION environment variable for build links (not master deploys)
|
||||||
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_INCLUSION=""
|
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_INCLUSION=""
|
||||||
|
|
||||||
- name: 💿 Obtain cache of auto-generated code docs artifacts
|
- name: 🦀 Produce auto-generated code docs data
|
||||||
id: cache-website-code-docs
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
key: website-code-docs
|
|
||||||
|
|
||||||
- name: 📁 Fallback in case auto-generated code docs artifacts weren't cached
|
|
||||||
if: steps.cache-website-code-docs.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "🦀 Initial system version of Rust:"
|
|
||||||
rustc --version
|
|
||||||
rustup update stable
|
rustup update stable
|
||||||
echo "🦀 Latest updated version of Rust:"
|
cargo run -p crate-hierarchy-viz -- website/generated
|
||||||
rustc --version
|
cargo run -p editor-message-tree -- website/generated
|
||||||
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
|
|
||||||
mkdir artifacts
|
|
||||||
mv hierarchical_message_system_tree.txt artifacts/hierarchical_message_system_tree.txt
|
|
||||||
|
|
||||||
- name: 🚚 Move `artifacts` contents to the project root
|
- name: 🔧 Install website and frontend npm dependencies
|
||||||
run: |
|
run: |
|
||||||
mv artifacts/* .
|
# The website is linted by the frontend's ESLint config and the tools it installs
|
||||||
|
cd frontend
|
||||||
|
npm ci
|
||||||
|
cd ../website
|
||||||
|
npm ci
|
||||||
|
|
||||||
- name: 🔧 Build auto-generated code docs artifacts into HTML
|
- name: 📃 Generate node catalog documentation
|
||||||
run: |
|
run: cargo run -p node-docs -- website/content/learn/node-catalog
|
||||||
cd website
|
|
||||||
npm run generate-editor-structure
|
|
||||||
|
|
||||||
- name: 🌐 Build Graphite website with Zola
|
- name: 🌐 Build Graphite website with Zola
|
||||||
env:
|
env:
|
||||||
MODE: prod
|
MODE: prod
|
||||||
run: |
|
run: |
|
||||||
cd website
|
cd website
|
||||||
npm run install-fonts
|
npm run check
|
||||||
zola --config config.toml build --minify
|
zola --config config.toml build --minify
|
||||||
|
|
||||||
- name: 📤 Publish to Cloudflare Pages
|
- name: 📤 Publish to Cloudflare Pages
|
||||||
id: cloudflare
|
|
||||||
uses: cloudflare/pages-action@1
|
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
env:
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
run: npx wrangler@3 pages deploy "website/public" --project-name="graphite-website" --commit-dirty=true
|
||||||
projectName: graphite-website
|
|
||||||
directory: website/public
|
|
||||||
+7
-2
@@ -1,4 +1,8 @@
|
|||||||
|
branding/
|
||||||
target/
|
target/
|
||||||
|
third-party-licenses.txt*
|
||||||
|
result/
|
||||||
|
.flatpak-builder/
|
||||||
*.spv
|
*.spv
|
||||||
*.exrc
|
*.exrc
|
||||||
perf.data*
|
perf.data*
|
||||||
@@ -7,5 +11,6 @@ profile.json.gz
|
|||||||
flamegraph.svg
|
flamegraph.svg
|
||||||
.idea/
|
.idea/
|
||||||
.direnv
|
.direnv
|
||||||
hierarchical_message_system_tree.txt
|
.DS_Store
|
||||||
hierarchical_message_system_tree.html
|
.nvim.lua
|
||||||
|
/.devcontainer/devcontainer-lock.json
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
inputs:
|
||||||
|
|
||||||
|
let
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
forAllSystems = f: inputs.nixpkgs.lib.genAttrs systems (system: f system);
|
||||||
|
args =
|
||||||
|
system:
|
||||||
|
(
|
||||||
|
let
|
||||||
|
lib = inputs.nixpkgs.lib // {
|
||||||
|
call = p: import p args;
|
||||||
|
};
|
||||||
|
|
||||||
|
pkgs = import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [ (import inputs.rust-overlay) ];
|
||||||
|
};
|
||||||
|
|
||||||
|
info = {
|
||||||
|
pname = "graphite";
|
||||||
|
version = "unstable";
|
||||||
|
src = inputs.nixpkgs.lib.cleanSourceWith {
|
||||||
|
src = ./..;
|
||||||
|
filter = path: type: !(type == "directory" && builtins.baseNameOf path == ".nix");
|
||||||
|
};
|
||||||
|
cargoVendored = deps.crane.lib.vendorCargoDeps { inherit (info) src; };
|
||||||
|
};
|
||||||
|
|
||||||
|
deps = {
|
||||||
|
crane = lib.call ./deps/crane.nix;
|
||||||
|
rustGPU = lib.call ./deps/rust-gpu.nix;
|
||||||
|
};
|
||||||
|
|
||||||
|
args = {
|
||||||
|
inherit system;
|
||||||
|
inherit (inputs) self;
|
||||||
|
inherit inputs;
|
||||||
|
inherit pkgs;
|
||||||
|
inherit lib;
|
||||||
|
inherit info;
|
||||||
|
inherit deps;
|
||||||
|
}
|
||||||
|
// inputs;
|
||||||
|
in
|
||||||
|
args
|
||||||
|
);
|
||||||
|
withArgs = f: forAllSystems (system: f (args system));
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = withArgs (
|
||||||
|
{ lib, ... }:
|
||||||
|
rec {
|
||||||
|
default = graphite;
|
||||||
|
graphite = (lib.call ./pkgs/graphite.nix) { };
|
||||||
|
graphite-dev = (lib.call ./pkgs/graphite.nix) { dev = true; };
|
||||||
|
graphite-raster-nodes-shaders = lib.call ./pkgs/graphite-raster-nodes-shaders.nix;
|
||||||
|
graphite-branding = lib.call ./pkgs/graphite-branding.nix;
|
||||||
|
graphite-bundle = (lib.call ./pkgs/graphite-bundle.nix) { };
|
||||||
|
graphite-bundle-dev = (lib.call ./pkgs/graphite-bundle.nix) { graphite = graphite-dev; };
|
||||||
|
graphite-flatpak-manifest = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { };
|
||||||
|
graphite-flatpak-manifest-dev = (lib.call ./pkgs/graphite-flatpak-manifest.nix) {
|
||||||
|
graphite-bundle = graphite-bundle-dev;
|
||||||
|
};
|
||||||
|
graphite-cef = lib.call ./pkgs/graphite-cef.nix;
|
||||||
|
|
||||||
|
# TODO: graphene-cli = lib.call ./pkgs/graphene-cli.nix;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
devShells = withArgs (
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
shell = lib.makeOverridable (lib.call ./dev.nix);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
default = shell {
|
||||||
|
desktop = true;
|
||||||
|
};
|
||||||
|
full = shell {
|
||||||
|
desktop = true;
|
||||||
|
x11 = true;
|
||||||
|
playwright = true;
|
||||||
|
};
|
||||||
|
minimal = shell { };
|
||||||
|
x11 = shell {
|
||||||
|
desktop = true;
|
||||||
|
x11 = true;
|
||||||
|
};
|
||||||
|
playwright = shell {
|
||||||
|
playwright = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
formatter = withArgs ({ pkgs, ... }: pkgs.nixfmt-tree);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
lib = (inputs.crane.mkLib pkgs) // {
|
||||||
|
vendorCargoDepsFlatten =
|
||||||
|
src:
|
||||||
|
pkgs.stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
|
name = "graphite-cargo-vendored";
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
cp -rL --no-preserve=mode "$src" "$out"
|
||||||
|
chmod -R u+w "$out"
|
||||||
|
find "$out" -type f -print0 | xargs -r -0 sed -i "s|$src|$out|g"
|
||||||
|
'';
|
||||||
|
|
||||||
|
disallowedReferences = [ finalAttrs.src ];
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
toolchain = pkgs.rust-bin.nightly."2026-07-03".default.override {
|
||||||
|
extensions = [
|
||||||
|
"rust-src"
|
||||||
|
"rust-analyzer"
|
||||||
|
"clippy"
|
||||||
|
"cargo"
|
||||||
|
"rustc-dev"
|
||||||
|
"llvm-tools"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
cargo = pkgs.writeShellScriptBin "cargo" ''
|
||||||
|
#!${pkgs.lib.getExe pkgs.bash}
|
||||||
|
|
||||||
|
filtered_args=()
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
+nightly|+nightly-*) ;;
|
||||||
|
*) filtered_args+=("$arg") ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
exec ${toolchain}/bin/cargo ${"\${filtered_args[@]}"}
|
||||||
|
'';
|
||||||
|
rustc_codegen_spirv =
|
||||||
|
(pkgs.makeRustPlatform {
|
||||||
|
cargo = toolchain;
|
||||||
|
rustc = toolchain;
|
||||||
|
}).buildRustPackage
|
||||||
|
(finalAttrs: {
|
||||||
|
pname = "rustc_codegen_spirv";
|
||||||
|
version = "0.10.0";
|
||||||
|
src = pkgs.fetchCrate {
|
||||||
|
inherit (finalAttrs) pname version;
|
||||||
|
sha256 = "sha256-QluNI2TdJI0j2CBOeAbB9DfOv+8LqzWk7siZyT1WWLU=";
|
||||||
|
};
|
||||||
|
cargoHash = "sha256-vvviUccnip+j60Ml1vqLNJ49KyEF40VLUoV1TMALHMs=";
|
||||||
|
cargoBuildFlags = [
|
||||||
|
"-p"
|
||||||
|
"rustc_codegen_spirv"
|
||||||
|
"--features=use-compiled-tools"
|
||||||
|
"--no-default-features"
|
||||||
|
];
|
||||||
|
doCheck = false;
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
toolchain = toolchain;
|
||||||
|
env = {
|
||||||
|
RUST_GPU_PATH_OVERRIDE = "${cargo}/bin:${toolchain}/bin";
|
||||||
|
RUSTC_CODEGEN_SPIRV_PATH = "${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
deps,
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
desktop ? false,
|
||||||
|
x11 ? false,
|
||||||
|
playwright ? false,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
features = [
|
||||||
|
{
|
||||||
|
packages = [
|
||||||
|
pkgs.pkg-config
|
||||||
|
|
||||||
|
pkgs.lld
|
||||||
|
pkgs.nodejs
|
||||||
|
pkgs.binaryen
|
||||||
|
pkgs.wasm-bindgen-cli_0_2_121
|
||||||
|
pkgs.cargo-about
|
||||||
|
|
||||||
|
pkgs.rustc
|
||||||
|
pkgs.cargo
|
||||||
|
pkgs.rust-analyzer
|
||||||
|
pkgs.clippy
|
||||||
|
pkgs.rustfmt
|
||||||
|
|
||||||
|
pkgs.git
|
||||||
|
|
||||||
|
pkgs.cargo-nextest
|
||||||
|
pkgs.cargo-expand
|
||||||
|
|
||||||
|
# Linker
|
||||||
|
pkgs.mold
|
||||||
|
|
||||||
|
# Profiling tools
|
||||||
|
pkgs.gnuplot
|
||||||
|
pkgs.samply
|
||||||
|
pkgs.cargo-flamegraph
|
||||||
|
|
||||||
|
# Plotting tools
|
||||||
|
pkgs.graphviz
|
||||||
|
];
|
||||||
|
}
|
||||||
|
deps.rustGPU
|
||||||
|
(lib.optionalAttrs desktop (
|
||||||
|
{
|
||||||
|
libs = [
|
||||||
|
pkgs.wayland
|
||||||
|
pkgs.vulkan-loader
|
||||||
|
pkgs.libGL
|
||||||
|
pkgs.libxkbcommon
|
||||||
|
self.packages.${system}.graphite-cef
|
||||||
|
];
|
||||||
|
env = {
|
||||||
|
CEF_PATH = "${self.packages.${system}.graphite-cef}/lib";
|
||||||
|
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
))
|
||||||
|
(lib.optionalAttrs x11 {
|
||||||
|
libs = [
|
||||||
|
pkgs.libXcursor
|
||||||
|
pkgs.libxcb
|
||||||
|
pkgs.libX11
|
||||||
|
];
|
||||||
|
})
|
||||||
|
(lib.optionalAttrs playwright (
|
||||||
|
assert pkgs.playwright-driver.version == (lib.importJSON ../tools/web-editor-driver/playwright/package-lock.json).packages."node_modules/playwright-core".version;
|
||||||
|
{
|
||||||
|
env = {
|
||||||
|
PLAYWRIGHT_BROWSERS_PATH = pkgs.playwright-driver.browsers-chromium;
|
||||||
|
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = "true";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
))
|
||||||
|
];
|
||||||
|
|
||||||
|
libs = lib.concatMap (feature: feature.libs or [ ]) features;
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = libs ++ lib.concatMap (feature: feature.packages or [ ]) features;
|
||||||
|
env = lib.mergeAttrsList (map (feature: feature.env or { }) features) // {
|
||||||
|
LD_LIBRARY_PATH = lib.makeLibraryPath libs;
|
||||||
|
};
|
||||||
|
}
|
||||||
Generated
-97
@@ -1,97 +0,0 @@
|
|||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-compat": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1733328505,
|
|
||||||
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
|
|
||||||
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
|
||||||
"revCount": 69,
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1731533236,
|
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1754214453,
|
|
||||||
"narHash": "sha256-Q/I2xJn/j1wpkGhWkQnm20nShYnG7TI99foDBpXm1SY=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "5b09dc45f24cf32316283e62aec81ffee3c3e376",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": "nixpkgs",
|
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rust-overlay": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1753238793,
|
|
||||||
"narHash": "sha256-jmQeEpgX+++MEgrcikcwoSiI7vDZWLP0gci7XiWb9uQ=",
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"rev": "0ad7ab4ca8e83febf147197e65c006dff60623ab",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
||||||
-166
@@ -1,166 +0,0 @@
|
|||||||
# This is a helper file for people using NixOS as their operating system.
|
|
||||||
# If you don't know what this file does, you can safely ignore it.
|
|
||||||
# This file defines the reproducible development environment for the project.
|
|
||||||
#
|
|
||||||
# Development Environment:
|
|
||||||
# - Provides all necessary tools for Rust/Wasm development
|
|
||||||
# - Includes dependencies for desktop app development
|
|
||||||
# - Sets up profiling and debugging tools
|
|
||||||
# - Configures mold as the default linker for faster builds
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# - Development shell: `nix develop .nix` from the project root
|
|
||||||
# - Run in dev shell with direnv: add `use flake` to .envrc
|
|
||||||
{
|
|
||||||
description = "Development environment and build configuration";
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
||||||
rust-overlay = {
|
|
||||||
url = "github:oxalica/rust-overlay";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
|
|
||||||
# This is used to provide a identical development shell at `shell.nix` for users that do not use flakes
|
|
||||||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { nixpkgs, rust-overlay, flake-utils, ... }:
|
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
|
||||||
let
|
|
||||||
overlays = [ (import rust-overlay) ];
|
|
||||||
pkgs = import nixpkgs {
|
|
||||||
inherit system overlays;
|
|
||||||
};
|
|
||||||
|
|
||||||
rustExtensions = [ "rust-src" "rust-analyzer" "clippy" "cargo" ];
|
|
||||||
rust = pkgs.rust-bin.stable.latest.default.override {
|
|
||||||
targets = [ "wasm32-unknown-unknown" ];
|
|
||||||
extensions = rustExtensions;
|
|
||||||
};
|
|
||||||
|
|
||||||
rustGPUToolchainPkg = pkgs.rust-bin.nightly."2025-06-23".default.override {
|
|
||||||
extensions = rustExtensions ++ [ "rustc-dev" "llvm-tools" ];
|
|
||||||
};
|
|
||||||
rustGPUToolchainRustPlatform = pkgs.makeRustPlatform {
|
|
||||||
cargo = rustGPUToolchainPkg;
|
|
||||||
rustc = rustGPUToolchainPkg;
|
|
||||||
};
|
|
||||||
rustc_codegen_spirv = rustGPUToolchainRustPlatform.buildRustPackage (finalAttrs: {
|
|
||||||
pname = "rustc_codegen_spirv";
|
|
||||||
version = "0-unstable-2025-08-04";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "Rust-GPU";
|
|
||||||
repo = "rust-gpu";
|
|
||||||
rev = "c12f216121820580731440ee79ebc7403d6ea04f";
|
|
||||||
hash = "sha256-rG1cZvOV0vYb1dETOzzbJ0asYdE039UZImobXZfKIno=";
|
|
||||||
};
|
|
||||||
cargoHash = "sha256-AEigcEc5wiBd3zLqWN/2HSbkfOVFneAqNvg9HsouZf4=";
|
|
||||||
cargoBuildFlags = [ "-p" "rustc_codegen_spirv" "--features=use-compiled-tools" "--no-default-features" ];
|
|
||||||
doCheck = false;
|
|
||||||
});
|
|
||||||
rustGpuCargo = pkgs.writeShellScriptBin "cargo" ''
|
|
||||||
#!${pkgs.lib.getExe pkgs.bash}
|
|
||||||
|
|
||||||
filtered_args=()
|
|
||||||
for arg in "$@"; do
|
|
||||||
case "$arg" in
|
|
||||||
+nightly|+nightly-*) ;;
|
|
||||||
*) filtered_args+=("$arg") ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
exec ${rustGPUToolchainPkg}/bin/cargo ${"\${filtered_args[@]}"}
|
|
||||||
'';
|
|
||||||
rustGpuPathOverride = "${rustGpuCargo}/bin:${rustGPUToolchainPkg}/bin";
|
|
||||||
|
|
||||||
libcef = pkgs.libcef.overrideAttrs (finalAttrs: previousAttrs: {
|
|
||||||
version = "139.0.17";
|
|
||||||
gitRevision = "6c347eb";
|
|
||||||
chromiumVersion = "139.0.7258.31";
|
|
||||||
srcHash = "sha256-kRMO8DP4El1qytDsAZBdHvR9AAHXce90nPdyfJailBg=";
|
|
||||||
|
|
||||||
__intentionallyOverridingVersion = true;
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
strip $out/lib/*
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
libcefPath = pkgs.runCommand "libcef-path" {} ''
|
|
||||||
mkdir -p $out
|
|
||||||
|
|
||||||
ln -s ${libcef}/include $out/include
|
|
||||||
find ${libcef}/lib -type f -name "*" -exec ln -s {} $out/ \;
|
|
||||||
find ${libcef}/libexec -type f -name "*" -exec ln -s {} $out/ \;
|
|
||||||
cp -r ${libcef}/share/cef/* $out/
|
|
||||||
|
|
||||||
echo '${builtins.toJSON {
|
|
||||||
type = "minimal";
|
|
||||||
name = builtins.baseNameOf libcef.src.url;
|
|
||||||
sha1 = "";
|
|
||||||
}}' > $out/archive.json
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Shared build inputs - system libraries that need to be in LD_LIBRARY_PATH
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
# System libraries
|
|
||||||
wayland
|
|
||||||
openssl
|
|
||||||
vulkan-loader
|
|
||||||
libraw
|
|
||||||
libGL
|
|
||||||
|
|
||||||
# X11 libraries, not needed on wayland! Remove when x11 is finally dead
|
|
||||||
libxkbcommon
|
|
||||||
xorg.libXcursor
|
|
||||||
xorg.libxcb
|
|
||||||
xorg.libX11
|
|
||||||
];
|
|
||||||
|
|
||||||
# Development tools that don't need to be in LD_LIBRARY_PATH
|
|
||||||
buildTools = [
|
|
||||||
rust
|
|
||||||
pkgs.nodejs
|
|
||||||
pkgs.nodePackages.npm
|
|
||||||
pkgs.binaryen
|
|
||||||
pkgs.wasm-bindgen-cli
|
|
||||||
pkgs.wasm-pack
|
|
||||||
pkgs.pkg-config
|
|
||||||
pkgs.git
|
|
||||||
pkgs.cargo-about
|
|
||||||
|
|
||||||
# Linker
|
|
||||||
pkgs.mold
|
|
||||||
];
|
|
||||||
# Development tools that don't need to be in LD_LIBRARY_PATH
|
|
||||||
devTools = with pkgs; [
|
|
||||||
cargo-watch
|
|
||||||
cargo-nextest
|
|
||||||
cargo-expand
|
|
||||||
|
|
||||||
# Profiling tools
|
|
||||||
gnuplot
|
|
||||||
samply
|
|
||||||
cargo-flamegraph
|
|
||||||
];
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# Development shell configuration
|
|
||||||
devShells.default = pkgs.mkShell {
|
|
||||||
packages = buildInputs ++ buildTools ++ devTools;
|
|
||||||
|
|
||||||
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}:${libcefPath}";
|
|
||||||
CEF_PATH = libcefPath;
|
|
||||||
XDG_DATA_DIRS="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
|
|
||||||
|
|
||||||
RUST_GPU_PATH_OVERRIDE = rustGpuPathOverride;
|
|
||||||
RUSTC_CODEGEN_SPIRV_PATH = "${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
|
|
||||||
|
|
||||||
shellHook = ''
|
|
||||||
alias cargo='mold --run cargo'
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{ info, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
brandingTar = pkgs.fetchurl (
|
||||||
|
let
|
||||||
|
lockContent = builtins.readFile "${info.src}/.branding";
|
||||||
|
lines = builtins.filter (s: s != [ ]) (builtins.split "\n" lockContent);
|
||||||
|
url = builtins.elemAt lines 0;
|
||||||
|
hash = builtins.elemAt lines 1;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
url = url;
|
||||||
|
sha256 = hash;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
pkgs.runCommand "${info.pname}-branding" { } ''
|
||||||
|
mkdir -p $out
|
||||||
|
tar -xvf ${brandingTar} -C $out --strip-components 1
|
||||||
|
''
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
deps,
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
graphite ? self.packages.${system}.graphite,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
bundle =
|
||||||
|
{
|
||||||
|
archive ? false,
|
||||||
|
compression ? null,
|
||||||
|
passthru ? { },
|
||||||
|
}:
|
||||||
|
(
|
||||||
|
let
|
||||||
|
tar = if compression == null then archive else true;
|
||||||
|
nameArchiveSuffix = if tar then ".tar" else "";
|
||||||
|
nameCompressionSuffix = if compression == null then "" else "." + compression;
|
||||||
|
name = "graphite-bundle${nameArchiveSuffix}${nameCompressionSuffix}";
|
||||||
|
build = ''
|
||||||
|
mkdir -p out
|
||||||
|
mkdir -p out/bin
|
||||||
|
cp ${graphite}/bin/graphite out/bin/graphite
|
||||||
|
chmod -v +w out/bin/graphite
|
||||||
|
patchelf \
|
||||||
|
--set-rpath '$ORIGIN/../lib:$ORIGIN/../lib/cef' \
|
||||||
|
--set-interpreter '/lib64/ld-linux-x86-64.so.2' \
|
||||||
|
--remove-needed libGL.so \
|
||||||
|
out/bin/graphite
|
||||||
|
cp -r ${graphite}/share out/share
|
||||||
|
mkdir -p out/lib/cef
|
||||||
|
mkdir -p ./cef
|
||||||
|
tar -xvf ${self.packages.${system}.graphite-cef.src} -C ./cef --strip-components=1
|
||||||
|
cp -r ./cef/Release/* out/lib/cef/
|
||||||
|
cp -r ./cef/Resources/* out/lib/cef/
|
||||||
|
find "out/lib/cef/locales" -type f ! -name 'en-US*' -delete
|
||||||
|
${pkgs.bintools}/bin/strip out/lib/cef/*.so*
|
||||||
|
'';
|
||||||
|
install =
|
||||||
|
if tar then
|
||||||
|
''
|
||||||
|
cd out
|
||||||
|
tar -c \
|
||||||
|
--sort=name \
|
||||||
|
--mtime='@1' --clamp-mtime \
|
||||||
|
--owner=0 --group=0 --numeric-owner \
|
||||||
|
--mode='u=rwX,go=rX' \
|
||||||
|
--format=posix \
|
||||||
|
--pax-option=delete=atime,delete=ctime \
|
||||||
|
--no-acls --no-xattrs --no-selinux \
|
||||||
|
* ${
|
||||||
|
if compression == "xz" then
|
||||||
|
"| xz "
|
||||||
|
else if compression == "gz" then
|
||||||
|
"| gzip -n "
|
||||||
|
else
|
||||||
|
""
|
||||||
|
}> $out
|
||||||
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r out/* $out/
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
|
||||||
|
pkgs.runCommand name
|
||||||
|
{
|
||||||
|
inherit passthru;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
${build}
|
||||||
|
${install}
|
||||||
|
''
|
||||||
|
);
|
||||||
|
in
|
||||||
|
bundle {
|
||||||
|
passthru = {
|
||||||
|
tar = bundle {
|
||||||
|
archive = true;
|
||||||
|
passthru = {
|
||||||
|
gz = bundle {
|
||||||
|
compression = "gz";
|
||||||
|
};
|
||||||
|
xz = bundle {
|
||||||
|
compression = "xz";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = "151.3.24+g2384915+chromium-151.0.7922.174";
|
||||||
|
hashes = {
|
||||||
|
aarch64-linux = "sha256-R5ZbnDallYvdbW/bP+M2DzjRfWWRTvY2q63hSIHNxZs=";
|
||||||
|
x86_64-linux = "sha256-21PEP9rOi37krw8AUSARbWlzqp2Ot3AsBhe635voaE4=";
|
||||||
|
};
|
||||||
|
|
||||||
|
selectSystem =
|
||||||
|
attrs:
|
||||||
|
attrs.${pkgs.stdenv.hostPlatform.system}
|
||||||
|
or (throw "Unsupported system ${pkgs.stdenv.hostPlatform.system}");
|
||||||
|
|
||||||
|
url = "https://cef-builds.spotifycdn.com/cef_binary_${version}_${
|
||||||
|
selectSystem {
|
||||||
|
aarch64-linux = "linuxarm64";
|
||||||
|
x86_64-linux = "linux64";
|
||||||
|
}
|
||||||
|
}_minimal.tar.bz2";
|
||||||
|
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
inherit url;
|
||||||
|
hash = selectSystem hashes;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.cef-binary.overrideAttrs {
|
||||||
|
version = builtins.head (builtins.split "\\+" version);
|
||||||
|
inherit src;
|
||||||
|
postInstall = ''
|
||||||
|
rm -r $out/* $out/.* || true
|
||||||
|
strip ./Release/*.so*
|
||||||
|
mkdir $out/lib
|
||||||
|
mv ./Release/* $out/lib/
|
||||||
|
find "./Resources/locales" -maxdepth 1 -type f ! -name 'en-US.pak' -delete
|
||||||
|
mv ./Resources/* $out/lib/
|
||||||
|
mv ./include $out/lib/
|
||||||
|
|
||||||
|
cat ./CREDITS.html | ${pkgs.xz}/bin/xz -9 -e -c > $out/lib/CREDITS.html.xz
|
||||||
|
|
||||||
|
echo '${
|
||||||
|
builtins.toJSON {
|
||||||
|
type = "minimal";
|
||||||
|
name = builtins.baseNameOf url;
|
||||||
|
sha1 = "";
|
||||||
|
}
|
||||||
|
}' > $out/lib/archive.json
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
graphite-bundle ? self.packages.${system}.graphite-bundle,
|
||||||
|
}:
|
||||||
|
|
||||||
|
(pkgs.formats.json { }).generate "art.graphite.Graphite.json" {
|
||||||
|
app-id = "art.graphite.Graphite";
|
||||||
|
runtime = "org.freedesktop.Platform";
|
||||||
|
runtime-version = "25.08";
|
||||||
|
sdk = "org.freedesktop.Sdk";
|
||||||
|
command = "graphite";
|
||||||
|
finish-args = [
|
||||||
|
"--device=dri"
|
||||||
|
"--share=ipc"
|
||||||
|
"--socket=wayland"
|
||||||
|
"--socket=fallback-x11"
|
||||||
|
"--share=network"
|
||||||
|
];
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
name = "app";
|
||||||
|
buildsystem = "simple";
|
||||||
|
build-commands = [
|
||||||
|
"mkdir -p /app"
|
||||||
|
"cp -r ./* /app/"
|
||||||
|
"chmod +x /app/bin/*"
|
||||||
|
];
|
||||||
|
sources = [
|
||||||
|
{
|
||||||
|
type = "archive";
|
||||||
|
path = graphite-bundle.tar;
|
||||||
|
strip-components = 0;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
info,
|
||||||
|
deps,
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
(deps.crane.lib.overrideToolchain (_: deps.rustGPU.toolchain)).buildPackage {
|
||||||
|
pname = "graphite-raster-nodes-shaders";
|
||||||
|
inherit (info) version src;
|
||||||
|
|
||||||
|
inherit (self.packages.${system}.graphite) cargoVendorDir cargoArtifacts;
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
env = deps.rustGPU.env;
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
cargo build -r -p raster-nodes-shaders
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
cp target/spirv-builder/spirv-unknown-naga-wgsl/release/deps/raster_nodes_shaders_entrypoint.wgsl $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
{
|
||||||
|
info,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
deps,
|
||||||
|
system,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
dev ? false,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
branding = self.packages.${system}.graphite-branding;
|
||||||
|
libs = [
|
||||||
|
pkgs.wayland
|
||||||
|
pkgs.vulkan-loader
|
||||||
|
pkgs.libGL
|
||||||
|
pkgs.openssl
|
||||||
|
pkgs.libraw
|
||||||
|
self.packages.${system}.graphite-cef
|
||||||
|
# X11 Support
|
||||||
|
pkgs.libxkbcommon
|
||||||
|
pkgs.libXcursor
|
||||||
|
pkgs.libxcb
|
||||||
|
pkgs.libX11
|
||||||
|
];
|
||||||
|
|
||||||
|
common = {
|
||||||
|
inherit (info) pname version src;
|
||||||
|
cargoVendorDir = deps.crane.lib.vendorCargoDepsFlatten (
|
||||||
|
deps.crane.lib.vendorMultipleCargoDeps {
|
||||||
|
inherit (deps.crane.lib.findCargoFiles (deps.crane.lib.cleanCargoSource info.src)) cargoConfigs;
|
||||||
|
cargoLockList = [
|
||||||
|
"${info.src}/Cargo.lock"
|
||||||
|
"${deps.rustGPU.toolchain.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
buildInputs = libs;
|
||||||
|
strictDeps = true;
|
||||||
|
doCheck = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoArtifacts = deps.crane.lib.buildDepsOnly (
|
||||||
|
common
|
||||||
|
// {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.pkg-config
|
||||||
|
pkgs.lld
|
||||||
|
];
|
||||||
|
env.CEF_PATH = "${self.packages.${system}.graphite-cef}/lib";
|
||||||
|
buildPhase =
|
||||||
|
let
|
||||||
|
profile = if dev then "dev" else "release";
|
||||||
|
in
|
||||||
|
''
|
||||||
|
cargo check --profile ${profile} --locked -p graphite-desktop-platform-linux
|
||||||
|
cargo build --profile ${profile} --locked -p graphite-desktop-platform-linux
|
||||||
|
|
||||||
|
cargo check --profile ${profile} --target wasm32-unknown-unknown --locked -p graphite-wasm-wrapper --no-default-features --features native
|
||||||
|
cargo build --profile ${profile} --target wasm32-unknown-unknown --locked -p graphite-wasm-wrapper --no-default-features --features native
|
||||||
|
|
||||||
|
cargo check --locked -p third-party-licenses --features desktop
|
||||||
|
cargo build --locked -p third-party-licenses --features desktop
|
||||||
|
|
||||||
|
cargo check --profile ${profile} --locked -p graphite-desktop-bundle
|
||||||
|
cargo build --profile ${profile} --locked -p graphite-desktop-bundle
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
|
||||||
|
deps.crane.lib.buildPackage (
|
||||||
|
common
|
||||||
|
// {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
|
||||||
|
buildInputs = libs;
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.pkg-config
|
||||||
|
pkgs.lld
|
||||||
|
pkgs.nodejs
|
||||||
|
pkgs.binaryen
|
||||||
|
pkgs.wasm-bindgen-cli_0_2_121
|
||||||
|
pkgs.cargo-about
|
||||||
|
pkgs.removeReferencesTo
|
||||||
|
pkgs.importNpmLock.npmConfigHook
|
||||||
|
];
|
||||||
|
|
||||||
|
npmDeps = pkgs.importNpmLock {
|
||||||
|
npmRoot = "${info.src}/frontend";
|
||||||
|
};
|
||||||
|
npmRoot = "frontend";
|
||||||
|
makeCacheWritable = true;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
RASTER_NODES_SHADER_PATH = self.packages.${system}.graphite-raster-nodes-shaders;
|
||||||
|
GRAPHITE_GIT_COMMIT_HASH = self.rev or "unknown";
|
||||||
|
GRAPHITE_GIT_COMMIT_DATE = self.lastModified or "unknown";
|
||||||
|
CEF_PATH = "${self.packages.${system}.graphite-cef}/lib";
|
||||||
|
};
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
mkdir branding
|
||||||
|
cp -r ${branding}/* branding
|
||||||
|
cp ${info.src}/.branding branding/.branding
|
||||||
|
'';
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
# Prevent `cargo-run`'s frontend setup from trying to update npm dependencies
|
||||||
|
touch -r frontend/package-lock.json -d '+1 year' frontend/node_modules/.install-timestamp
|
||||||
|
|
||||||
|
export HOME="$TMPDIR"
|
||||||
|
''
|
||||||
|
+ (
|
||||||
|
if self ? rev then
|
||||||
|
''
|
||||||
|
export GRAPHITE_GIT_COMMIT_DATE="$(date -u -d "@$GRAPHITE_GIT_COMMIT_DATE" +"%Y-%m-%dT%H:%M:%SZ")"
|
||||||
|
''
|
||||||
|
else
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
buildPhaseCargoCommand = "cargo run build desktop${if dev then " debug" else ""}";
|
||||||
|
|
||||||
|
doNotPostBuildInstallCargoBinaries = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp target/${if dev then "debug" else "release"}/graphite $out/bin/graphite
|
||||||
|
|
||||||
|
mkdir -p $out/share/applications
|
||||||
|
cp $src/desktop/assets/*.desktop $out/share/applications/
|
||||||
|
|
||||||
|
mkdir -p $out/share/icons/hicolor/scalable/apps
|
||||||
|
cp ${branding}/app-icons/graphite.svg $out/share/icons/hicolor/scalable/apps/art.graphite.Graphite.svg
|
||||||
|
mkdir -p $out/share/icons/hicolor/512x512/apps
|
||||||
|
cp ${branding}/app-icons/graphite-512.png $out/share/icons/hicolor/512x512/apps/art.graphite.Graphite.png
|
||||||
|
mkdir -p $out/share/icons/hicolor/256x256/apps
|
||||||
|
cp ${branding}/app-icons/graphite-256.png $out/share/icons/hicolor/256x256/apps/art.graphite.Graphite.png
|
||||||
|
mkdir -p $out/share/icons/hicolor/128x128/apps
|
||||||
|
cp ${branding}/app-icons/graphite-128.png $out/share/icons/hicolor/128x128/apps/art.graphite.Graphite.png
|
||||||
|
'';
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
remove-references-to -t "${common.cargoVendorDir}" $out/bin/graphite
|
||||||
|
|
||||||
|
patchelf \
|
||||||
|
--set-rpath "${pkgs.lib.makeLibraryPath libs}" \
|
||||||
|
--add-needed libGL.so \
|
||||||
|
--add-needed libEGL.so \
|
||||||
|
$out/bin/graphite
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.deps = cargoArtifacts;
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# This is a helper file for people using NixOS as their operating system.
|
|
||||||
# If you don't know what this file does, you can safely ignore it.
|
|
||||||
|
|
||||||
# If you are using Nix as your package manager, you can run 'nix-shell .nix'
|
|
||||||
# in the root directory of the project and Nix will open a bash shell
|
|
||||||
# with all the packages needed to build and run Graphite installed.
|
|
||||||
# A shell.nix file is used in the Nix ecosystem to define a development
|
|
||||||
# environment with specific dependencies. When you enter a Nix shell using
|
|
||||||
# this file, it ensures that all the specified tools and libraries are
|
|
||||||
# available regardless of the host system's configuration. This provides
|
|
||||||
# a reproducible development environment across different machines and developers.
|
|
||||||
|
|
||||||
# You can enter the Nix shell and run Graphite like normal with:
|
|
||||||
# > npm start
|
|
||||||
# Or you can run it like this without needing to first enter the Nix shell:
|
|
||||||
# > nix-shell .nix --command "npm start"
|
|
||||||
|
|
||||||
# Uses flake compat to provide a development shell that is identical to the one defined in the flake
|
|
||||||
(import
|
|
||||||
(
|
|
||||||
let
|
|
||||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
|
||||||
nodeName = lock.nodes.root.inputs.flake-compat;
|
|
||||||
in
|
|
||||||
fetchTarball {
|
|
||||||
url = lock.nodes.${nodeName}.locked.url;
|
|
||||||
sha256 = lock.nodes.${nodeName}.locked.narHash;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
{ src = ./.; }
|
|
||||||
).shellNix
|
|
||||||
Vendored
+3
-1
@@ -6,14 +6,16 @@
|
|||||||
"tamasfe.even-better-toml",
|
"tamasfe.even-better-toml",
|
||||||
// Web
|
// Web
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
"svelte.svelte-vscode",
|
"svelte.svelte-vscode",
|
||||||
"vitaliymaz.vscode-svg-previewer",
|
"vitaliymaz.vscode-svg-previewer",
|
||||||
// Code quality
|
// Code quality
|
||||||
"wayou.vscode-todo-highlight",
|
"wayou.vscode-todo-highlight",
|
||||||
"streetsidesoftware.code-spell-checker",
|
"streetsidesoftware.code-spell-checker",
|
||||||
// Helpful
|
// Git
|
||||||
"mhutchie.git-graph",
|
"mhutchie.git-graph",
|
||||||
"qezhu.gitlink",
|
"qezhu.gitlink",
|
||||||
|
// Helpful
|
||||||
"wmaurer.change-case"
|
"wmaurer.change-case"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Vendored
+26
-10
@@ -26,34 +26,50 @@
|
|||||||
// Configured in `.prettierrc`
|
// Configured in `.prettierrc`
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
},
|
},
|
||||||
|
// Website: don't format Zola/Tera-templated HTML on save
|
||||||
|
"[html]": {
|
||||||
|
"editor.formatOnSave": false
|
||||||
|
},
|
||||||
// Handlebars: don't save on format
|
// Handlebars: don't save on format
|
||||||
// (`about.hbs` is used by Cargo About to encode license information)
|
// (`about.hbs` is used by Cargo About to encode license information)
|
||||||
"[handlebars]": {
|
"[handlebars]": {
|
||||||
"editor.formatOnSave": false
|
"editor.formatOnSave": false
|
||||||
},
|
},
|
||||||
// Rust Analyzer config
|
// Rust Analyzer config
|
||||||
|
"rust-analyzer.check.command": "clippy",
|
||||||
"rust-analyzer.cargo.allTargets": false,
|
"rust-analyzer.cargo.allTargets": false,
|
||||||
"rust-analyzer.procMacro.ignored": {
|
"rust-analyzer.procMacro.ignored": {
|
||||||
"serde_derive": ["Serialize", "Deserialize"],
|
"serde_derive": ["Serialize", "Deserialize"]
|
||||||
"specta_macros": ["Type"] // Disabled because of: https://github.com/specta-rs/specta/issues/387
|
|
||||||
},
|
},
|
||||||
// ESLint config
|
// ESLint config
|
||||||
"eslint.format.enable": true,
|
"eslint.format.enable": true,
|
||||||
"eslint.workingDirectories": ["./frontend", "./website"],
|
"eslint.workingDirectories": ["./frontend", "./website"],
|
||||||
"eslint.validate": ["javascript", "typescript", "svelte"],
|
"eslint.validate": ["javascript", "typescript", "svelte"],
|
||||||
// Svelte config
|
// Git Graph config
|
||||||
"svelte.plugin.svelte.compilerWarnings": {
|
"git-graph.repository.fetchAndPrune": true,
|
||||||
"css-unused-selector": "ignore", // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
"git-graph.repository.showRemoteHeads": false,
|
||||||
"vite-plugin-svelte-css-no-scopable-elements": "ignore", // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
"git-graph.repository.commits.fetchAvatars": true,
|
||||||
"a11y-no-static-element-interactions": "ignore", // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
// VS Code Git config
|
||||||
"a11y-no-noninteractive-element-interactions": "ignore", // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
"git.autofetch": true,
|
||||||
"a11y-click-events-have-key-events": "ignore" // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
"git.enableStatusBarSync": false,
|
||||||
|
"git.showActionButton": {
|
||||||
|
"sync": false
|
||||||
},
|
},
|
||||||
|
// CSpell config
|
||||||
|
"cSpell.language": "en-US",
|
||||||
|
"cSpell.logLevel": "Information",
|
||||||
|
"cSpell.allowCompoundWords": true,
|
||||||
|
// Other extensions config
|
||||||
|
"evenBetterToml.formatter.alignComments": false,
|
||||||
|
"package-json-upgrade.ignorePatterns": ["source-sans-pro"],
|
||||||
// VS Code config
|
// VS Code config
|
||||||
"html.format.wrapLineLength": 200,
|
"html.format.wrapLineLength": 200,
|
||||||
"files.eol": "\n",
|
"files.eol": "\n",
|
||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true,
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.graphite": "json"
|
"*.graphite": "json"
|
||||||
}
|
},
|
||||||
|
"editor.renderWhitespace": "boundary",
|
||||||
|
"editor.minimap.markSectionHeaderRegex": "// ===+\\n\\s*//\\s*(?<label>[^\\n]{1,18})[^\\n]*(\\n\\s*//[^\\n]*)*\\n\\s*// ===+",
|
||||||
|
"git.addAICoAuthor": "off"
|
||||||
}
|
}
|
||||||
Generated
+2593
-2101
File diff suppressed because it is too large.
Load diff
+143
-80
@@ -2,60 +2,71 @@
|
|||||||
members = [
|
members = [
|
||||||
"desktop",
|
"desktop",
|
||||||
"desktop/wrapper",
|
"desktop/wrapper",
|
||||||
|
"desktop/ui",
|
||||||
"desktop/embedded-resources",
|
"desktop/embedded-resources",
|
||||||
|
"desktop/bundle",
|
||||||
|
"desktop/platform/linux",
|
||||||
|
"desktop/platform/mac",
|
||||||
|
"desktop/platform/win",
|
||||||
|
"document/format",
|
||||||
|
"document/graph-storage",
|
||||||
|
"document/container",
|
||||||
"editor",
|
"editor",
|
||||||
"frontend/wasm",
|
"frontend/wrapper",
|
||||||
"libraries/dyn-any",
|
"libraries/dyn-any",
|
||||||
"libraries/path-bool",
|
|
||||||
"libraries/math-parser",
|
"libraries/math-parser",
|
||||||
"node-graph/gapplication-io",
|
"libraries/ipsum",
|
||||||
"node-graph/gbrush",
|
"libraries/snapping",
|
||||||
"node-graph/gcore",
|
"libraries/wgpu-sync",
|
||||||
"node-graph/gcore-shaders",
|
"libraries/control-protocol",
|
||||||
"node-graph/gmath-nodes",
|
"node-graph/libraries/graphene-hash",
|
||||||
"node-graph/gpath-bool",
|
"node-graph/libraries/*",
|
||||||
|
"node-graph/nodes/*",
|
||||||
|
"node-graph/nodes/raster/shaders",
|
||||||
|
"node-graph/nodes/raster/shaders/entrypoint",
|
||||||
"node-graph/graph-craft",
|
"node-graph/graph-craft",
|
||||||
"node-graph/graphene-cli",
|
"node-graph/graphene-cli",
|
||||||
"node-graph/graster-nodes",
|
"node-graph/nodes/gstd",
|
||||||
"node-graph/graster-nodes/shaders",
|
|
||||||
"node-graph/graster-nodes/shaders/entrypoint",
|
|
||||||
"node-graph/gstd",
|
|
||||||
"node-graph/gsvg-renderer",
|
|
||||||
"node-graph/interpreted-executor",
|
"node-graph/interpreted-executor",
|
||||||
"node-graph/node-macro",
|
"node-graph/node-macro",
|
||||||
"node-graph/preprocessor",
|
"node-graph/preprocessor",
|
||||||
"node-graph/wgpu-executor",
|
|
||||||
"proc-macros",
|
"proc-macros",
|
||||||
|
"tools/cargo-run",
|
||||||
|
"tools/cargo-run/internal/*",
|
||||||
|
"tools/crate-hierarchy-viz",
|
||||||
|
"tools/third-party-licenses",
|
||||||
|
"tools/editor-message-tree",
|
||||||
|
"tools/node-docs",
|
||||||
|
"tools/web-editor-driver",
|
||||||
]
|
]
|
||||||
default-members = [
|
default-members = [
|
||||||
"desktop",
|
|
||||||
"desktop/wrapper",
|
|
||||||
"editor",
|
"editor",
|
||||||
"frontend/wasm",
|
"frontend/wrapper",
|
||||||
"libraries/dyn-any",
|
"libraries/dyn-any",
|
||||||
"libraries/path-bool",
|
|
||||||
"libraries/math-parser",
|
"libraries/math-parser",
|
||||||
"node-graph/gapplication-io",
|
"libraries/ipsum",
|
||||||
"node-graph/gbrush",
|
"libraries/snapping",
|
||||||
"node-graph/gcore",
|
|
||||||
"node-graph/gcore-shaders",
|
|
||||||
"node-graph/graster-nodes/shaders",
|
|
||||||
"node-graph/gmath-nodes",
|
|
||||||
"node-graph/gpath-bool",
|
|
||||||
"node-graph/graph-craft",
|
"node-graph/graph-craft",
|
||||||
"node-graph/graphene-cli",
|
|
||||||
"node-graph/graster-nodes",
|
|
||||||
"node-graph/gstd",
|
|
||||||
"node-graph/gsvg-renderer",
|
|
||||||
"node-graph/interpreted-executor",
|
"node-graph/interpreted-executor",
|
||||||
"node-graph/node-macro",
|
"node-graph/node-macro",
|
||||||
"node-graph/preprocessor",
|
"node-graph/preprocessor",
|
||||||
"node-graph/wgpu-executor",
|
# blocked by https://github.com/rust-lang/cargo/issues/16000
|
||||||
# blocked by https://github.com/rust-lang/cargo/issues/15890
|
|
||||||
# "proc-macros",
|
# "proc-macros",
|
||||||
|
"tools/cargo-run",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
[workspace.package]
|
||||||
|
rust-version = "1.98"
|
||||||
|
edition = "2024"
|
||||||
|
authors = ["Graphite Authors <[email protected]>"]
|
||||||
|
homepage = "https://graphite.art"
|
||||||
|
repository = "https://github.com/GraphiteEditor/Graphite"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
version = "0.0.0"
|
||||||
|
readme = "README.md"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
# Local dependencies
|
# Local dependencies
|
||||||
dyn-any = { path = "libraries/dyn-any", features = [
|
dyn-any = { path = "libraries/dyn-any", features = [
|
||||||
@@ -65,56 +76,86 @@ dyn-any = { path = "libraries/dyn-any", features = [
|
|||||||
"log-bad-types",
|
"log-bad-types",
|
||||||
"rc",
|
"rc",
|
||||||
] }
|
] }
|
||||||
|
graphene-hash = { path = "node-graph/libraries/graphene-hash", features = ["derive"] }
|
||||||
preprocessor = { path = "node-graph/preprocessor" }
|
preprocessor = { path = "node-graph/preprocessor" }
|
||||||
math-parser = { path = "libraries/math-parser" }
|
math-parser = { path = "libraries/math-parser" }
|
||||||
path-bool = { path = "libraries/path-bool" }
|
graphene-application-io = { path = "node-graph/libraries/application-io" }
|
||||||
graphene-application-io = { path = "node-graph/gapplication-io" }
|
graphene-resource = { path = "node-graph/libraries/resources" }
|
||||||
graphene-brush = { path = "node-graph/gbrush" }
|
graphene-animation = { path = "node-graph/libraries/animation" }
|
||||||
graphene-core = { path = "node-graph/gcore" }
|
core-types = { path = "node-graph/libraries/core-types" }
|
||||||
graphene-core-shaders = { path = "node-graph/gcore-shaders" }
|
no-std-types = { path = "node-graph/libraries/no-std-types" }
|
||||||
graphene-math-nodes = { path = "node-graph/gmath-nodes" }
|
raster-types = { path = "node-graph/libraries/raster-types" }
|
||||||
graphene-path-bool = { path = "node-graph/gpath-bool" }
|
vector-types = { path = "node-graph/libraries/vector-types" }
|
||||||
|
graphic-types = { path = "node-graph/libraries/graphic-types" }
|
||||||
|
brush-types = { path = "node-graph/libraries/brush-types" }
|
||||||
|
rendering = { path = "node-graph/libraries/rendering" }
|
||||||
|
brush-nodes = { path = "node-graph/nodes/brush" }
|
||||||
|
blending-nodes = { path = "node-graph/nodes/blending" }
|
||||||
|
graphene-core = { path = "node-graph/nodes/gcore" }
|
||||||
|
graphic-nodes = { path = "node-graph/nodes/graphic" }
|
||||||
|
text-nodes = { path = "node-graph/nodes/text" }
|
||||||
|
transform-nodes = { path = "node-graph/nodes/transform" }
|
||||||
|
vector-nodes = { path = "node-graph/nodes/vector" }
|
||||||
|
repeat-nodes = { path = "node-graph/nodes/repeat" }
|
||||||
|
vectorize-nodes = { path = "node-graph/nodes/vectorize" }
|
||||||
|
vtrace = { path = "../vtrace/vtrace" }
|
||||||
|
math-nodes = { path = "node-graph/nodes/math" }
|
||||||
|
path-bool-nodes = { path = "node-graph/nodes/path-bool" }
|
||||||
graph-craft = { path = "node-graph/graph-craft" }
|
graph-craft = { path = "node-graph/graph-craft" }
|
||||||
graphene-raster-nodes = { path = "node-graph/graster-nodes" }
|
document-format = { path = "document/format" }
|
||||||
graphene-std = { path = "node-graph/gstd" }
|
document-graph-storage = { path = "document/graph-storage", default-features = false }
|
||||||
graphene-svg-renderer = { path = "node-graph/gsvg-renderer" }
|
document-container = { path = "document/container" }
|
||||||
|
raster-nodes = { path = "node-graph/nodes/raster" }
|
||||||
|
graphene-std = { path = "node-graph/nodes/gstd" }
|
||||||
interpreted-executor = { path = "node-graph/interpreted-executor" }
|
interpreted-executor = { path = "node-graph/interpreted-executor" }
|
||||||
node-macro = { path = "node-graph/node-macro" }
|
node-macro = { path = "node-graph/node-macro" }
|
||||||
wgpu-executor = { path = "node-graph/wgpu-executor" }
|
wgpu-executor = { path = "node-graph/libraries/wgpu-executor" }
|
||||||
|
wgpu-sync = { path = "libraries/wgpu-sync" }
|
||||||
graphite-proc-macros = { path = "proc-macros" }
|
graphite-proc-macros = { path = "proc-macros" }
|
||||||
|
graphite-editor = { path = "editor" }
|
||||||
|
control-protocol = { path = "libraries/control-protocol" }
|
||||||
|
graphene-canvas-utils = { path = "node-graph/libraries/canvas-utils" }
|
||||||
|
ipsum = { path = "libraries/ipsum" }
|
||||||
|
snapping = { path = "libraries/snapping" }
|
||||||
|
|
||||||
# Workspace dependencies
|
# Workspace dependencies
|
||||||
rustc-hash = "2.0"
|
rustc-hash = "2.0"
|
||||||
bytemuck = { version = "1.13", features = ["derive", "min_const_generics"] }
|
bytemuck = { version = "1.13", features = ["derive", "min_const_generics"] }
|
||||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
postcard = { version = "1.1", default-features = false, features = ["use-std"] }
|
||||||
|
serde_bytes = "0.11"
|
||||||
serde-wasm-bindgen = "0.6"
|
serde-wasm-bindgen = "0.6"
|
||||||
reqwest = { version = "0.12", features = ["blocking", "rustls-tls", "json"] }
|
reqwest = { version = "0.13", features = ["blocking", "json"] }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
env_logger = "0.11"
|
env_logger = "0.11"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
bitflags = { version = "2.4", features = ["serde"] }
|
bitflags = { version = "2.4", features = ["serde"] }
|
||||||
ctor = "0.2"
|
ctor = "0.2"
|
||||||
convert_case = "0.8"
|
convert_case = "0.12"
|
||||||
|
titlecase = "3.6"
|
||||||
|
fancy-regex = "0.18.0"
|
||||||
|
unicode-segmentation = "1.13.2"
|
||||||
|
indoc = "2.0.5"
|
||||||
derivative = "2.2"
|
derivative = "2.2"
|
||||||
thiserror = "2"
|
thiserror = "2"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
proc-macro2 = { version = "1", features = ["span-locations"] }
|
proc-macro2 = { version = "1", features = ["span-locations"] }
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
ron = "0.11"
|
ron = "0.12"
|
||||||
fastnoise-lite = "1.1"
|
fastnoise-lite = "1.1"
|
||||||
wgpu = { version = "25.0", features = [
|
wgpu = { version = "29.0", features = [
|
||||||
# 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
|
||||||
"fragile-send-sync-non-atomic-wasm",
|
"fragile-send-sync-non-atomic-wasm",
|
||||||
"spirv",
|
"spirv",
|
||||||
"strict_asserts",
|
"strict_asserts",
|
||||||
] }
|
] }
|
||||||
once_cell = "1.13" # Remove when `core::cell::LazyCell` (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>) is stabilized in Rust 1.80 and we bump our MSRV
|
once_cell = "1.13" # Remove and replace with `core::cell::LazyCell` (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>)
|
||||||
wasm-bindgen = "=0.2.100" # NOTICE: ensure this stays in sync with the `wasm-bindgen-cli` version in `website/content/volunteer/guide/project-setup/_index.md`. We pin this version because wasm-bindgen upgrades may break various things.
|
wasm-bindgen = "=0.2.121" # NOTICE: keep in sync with the `wasm-bindgen-cli` version pinned in `.github/workflows/build.yml`, `.devcontainer/devcontainer.json`, `.nix/dev.nix`, `.nix/pkgs/graphite.nix`, and `tools/cargo-run/src/requirements.rs`. We pin this version because wasm-bindgen upgrades may break various things.
|
||||||
wasm-bindgen-futures = "0.4"
|
wasm-bindgen-futures = "0.4"
|
||||||
js-sys = "=0.3.77"
|
js-sys = "=0.3.98"
|
||||||
web-sys = { version = "=0.3.77", features = [
|
web-sys = { version = "=0.3.98", features = [
|
||||||
"Document",
|
"Document",
|
||||||
"DomRect",
|
"DomRect",
|
||||||
"Element",
|
"Element",
|
||||||
@@ -132,38 +173,52 @@ web-sys = { version = "=0.3.77", features = [
|
|||||||
"HtmlImageElement",
|
"HtmlImageElement",
|
||||||
"ImageBitmapRenderingContext",
|
"ImageBitmapRenderingContext",
|
||||||
] }
|
] }
|
||||||
winit = { git = "https://github.com/rust-windowing/winit.git", rev = "66283a79bddd034c45fb0e72c84fa5cd4e5f82fb" }
|
winit = "0.31.0-beta.2"
|
||||||
|
keyboard-types = "0.8"
|
||||||
url = "2.5"
|
url = "2.5"
|
||||||
tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt"] }
|
tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt", "rt-multi-thread"] }
|
||||||
vello = { git = "https://github.com/linebender/vello.git", rev = "87cc5bee6d3a34d15017dbbb58634ddc7f33ff9b" } # TODO switch back to stable when a release is made
|
# Linebender ecosystem (BEGIN)
|
||||||
vello_encoding = { git = "https://github.com/linebender/vello.git", rev = "87cc5bee6d3a34d15017dbbb58634ddc7f33ff9b" } # TODO switch back to stable when a release is made
|
kurbo = { version = "0.13", features = ["serde"] }
|
||||||
resvg = "0.45"
|
vello = "0.10"
|
||||||
usvg = "0.45"
|
vello_encoding = "0.10"
|
||||||
|
usvg = "0.47"
|
||||||
|
simplecss = "0.2"
|
||||||
|
parley = { version = "0.9", default-features = false, features = ["std"] }
|
||||||
|
skrifa = "0.42"
|
||||||
|
polycool = "0.4"
|
||||||
|
color = "0.3"
|
||||||
|
# Linebender ecosystem (END)
|
||||||
rand = { version = "0.9", default-features = false, features = ["std_rng"] }
|
rand = { version = "0.9", default-features = false, features = ["std_rng"] }
|
||||||
rand_chacha = "0.9"
|
rand_chacha = "0.9"
|
||||||
glam = { version = "0.29", default-features = false, features = [
|
glam = { version = "0.33", default-features = false, features = [
|
||||||
"nostd-libm",
|
"nostd-libm",
|
||||||
"scalar-math",
|
"scalar-math",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
"debug-glam-assert",
|
||||||
|
"all-types",
|
||||||
] }
|
] }
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
|
blake3 = "1.5"
|
||||||
|
mmap-io = { version = "0.9", features = ["hugepages"] }
|
||||||
image = { version = "0.25", default-features = false, features = [
|
image = { version = "0.25", default-features = false, features = [
|
||||||
"png",
|
"png",
|
||||||
"jpeg",
|
"jpeg",
|
||||||
"bmp",
|
"bmp",
|
||||||
|
"gif",
|
||||||
|
"webp",
|
||||||
|
"tiff",
|
||||||
|
"ico",
|
||||||
|
"tga",
|
||||||
|
"hdr",
|
||||||
|
"exr",
|
||||||
|
"serde",
|
||||||
] }
|
] }
|
||||||
parley = "0.5"
|
|
||||||
skrifa = "0.36"
|
|
||||||
pretty_assertions = "1.4"
|
pretty_assertions = "1.4"
|
||||||
fern = { version = "0.7", features = ["colored"] }
|
fern = { version = "0.7", features = ["colored"] }
|
||||||
num_enum = { version = "0.7", default-features = false }
|
num_enum = { version = "0.7", default-features = false }
|
||||||
num-derive = "0.4"
|
num-derive = "0.4"
|
||||||
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
|
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
|
||||||
specta = { version = "2.0.0-rc.22", features = [
|
tsify = { version = "0.5", default-features = false, features = ["js"] }
|
||||||
"glam",
|
|
||||||
"derive",
|
|
||||||
# "typescript",
|
|
||||||
] }
|
|
||||||
syn = { version = "2.0", default-features = false, features = [
|
syn = { version = "2.0", default-features = false, features = [
|
||||||
"full",
|
"full",
|
||||||
"derive",
|
"derive",
|
||||||
@@ -175,28 +230,36 @@ syn = { version = "2.0", default-features = false, features = [
|
|||||||
"extra-traits",
|
"extra-traits",
|
||||||
"proc-macro",
|
"proc-macro",
|
||||||
] }
|
] }
|
||||||
kurbo = { version = "0.11", features = ["serde"] }
|
|
||||||
lyon_geom = "1.0"
|
lyon_geom = "1.0"
|
||||||
|
delaunator = "1.0"
|
||||||
petgraph = { version = "0.7", default-features = false, features = ["graphmap"] }
|
petgraph = { version = "0.7", default-features = false, features = ["graphmap"] }
|
||||||
half = { version = "2.4", default-features = false, features = ["bytemuck"] }
|
half = { version = "2.4", default-features = false, features = ["bytemuck"] }
|
||||||
tinyvec = { version = "1", features = ["std"] }
|
tinyvec = { version = "1", features = ["std"] }
|
||||||
criterion = { version = "0.7", features = ["html_reports"] }
|
criterion = { version = "0.7", features = ["html_reports"] }
|
||||||
iai-callgrind = { version = "0.16" }
|
gungraun = { version = "0.18" }
|
||||||
ndarray = "0.16"
|
ndarray = "0.16"
|
||||||
strum = { version = "0.27", features = ["derive"] }
|
strum = { version = "0.27", features = ["derive"] }
|
||||||
dirs = "6.0"
|
dirs = "6.0"
|
||||||
cef = "=139.0.1"
|
cef = "151"
|
||||||
cef-dll-sys = "=139.0.1"
|
cef-dll-sys = "151"
|
||||||
include_dir = "0.7"
|
include_dir = "0.7"
|
||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
rfd = "0.15"
|
rfd = "0.17"
|
||||||
open = "5.3"
|
open = "5.3"
|
||||||
poly-cool = "0.3"
|
|
||||||
spin = "0.10"
|
spin = "0.10"
|
||||||
clap = "4.5"
|
clap = "4.5"
|
||||||
spirv-std = { git = "https://github.com/rust-gpu/rust-gpu", rev = "c12f216121820580731440ee79ebc7403d6ea04f", features = ["bytemuck"] }
|
|
||||||
cargo-gpu = { git = "https://github.com/rust-gpu/cargo-gpu", rev = "f969528e87baa17a7d48eecf4a6fcfdcaaf30566" }
|
# Ensure these are kept in sync with .nix/deps/rust-gpu.nix
|
||||||
|
spirv-std = { version = "0.10.0", features = ["bytemuck"] }
|
||||||
|
cargo-gpu-install = { version = "0.10.0", default-features = false }
|
||||||
|
|
||||||
|
qrcodegen = "1.8"
|
||||||
|
lzma-rust2 = { version = "0.16", default-features = false, features = ["std", "encoder", "optimization", "xz"] }
|
||||||
|
scraper = "0.25"
|
||||||
|
linesweeper = "0.4"
|
||||||
|
smallvec = "1.13.2"
|
||||||
|
zip = { version = "8", default-features = false }
|
||||||
|
|
||||||
[workspace.lints.rust]
|
[workspace.lints.rust]
|
||||||
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
|
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
|
||||||
@@ -205,22 +268,22 @@ unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spir
|
|||||||
opt-level = 1
|
opt-level = 1
|
||||||
|
|
||||||
[profile.dev.package]
|
[profile.dev.package]
|
||||||
graphite-editor = { opt-level = 1 }
|
no-std-types = { opt-level = 1 }
|
||||||
graphene-core-shaders = { opt-level = 1 }
|
core-types= { opt-level = 1 }
|
||||||
graphene-core = { opt-level = 1 }
|
|
||||||
graphene-std = { opt-level = 1 }
|
|
||||||
interpreted-executor = { opt-level = 1 } # This is a mitigation for https://github.com/rustwasm/wasm-pack/issues/981 which is needed because the node_registry function is too large
|
interpreted-executor = { opt-level = 1 } # This is a mitigation for https://github.com/rustwasm/wasm-pack/issues/981 which is needed because the node_registry function is too large
|
||||||
graphite-proc-macros = { opt-level = 1 }
|
graphite-proc-macros = { opt-level = 1 }
|
||||||
image = { opt-level = 2 }
|
image = { opt-level = 2 }
|
||||||
rustc-hash = { opt-level = 3 }
|
rustc-hash = { opt-level = 3 }
|
||||||
serde_derive = { opt-level = 1 }
|
serde_derive = { opt-level = 1 }
|
||||||
specta-macros = { opt-level = 1 }
|
|
||||||
syn = { opt-level = 1 }
|
syn = { opt-level = 1 }
|
||||||
|
node-macro = { opt-level = 2 }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "thin"
|
lto = "thin"
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[profile.profiling]
|
[patch.crates-io]
|
||||||
inherits = "release"
|
winit = { git = "https://github.com/timon-schelling/winit", branch = "graphite" }
|
||||||
debug = true
|
rfd = { git = "https://github.com/timon-schelling/rfd.git", branch = "graphite" } # TODO: Remove this once https://github.com/PolyMeilex/rfd/pull/317 is merged and released
|
||||||
|
cef = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite-151" }
|
||||||
|
cef-dll-sys = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite-151" }
|
||||||
File renamed without changes.
+19
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) Graphite contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
-201
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<a href="https://graphite.rs/">
|
<a href="https://graphite.art/">
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/9366c148-4405-484f-909a-9a3526eb9209">
|
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/9366c148-4405-484f-909a-9a3526eb9209">
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/791508ab-bcd5-4e31-a3b9-1187cfd7a2f6">
|
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/791508ab-bcd5-4e31-a3b9-1187cfd7a2f6">
|
||||||
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
# Your procedural toolbox for 2D content creation
|
# Your procedural toolbox for 2D content creation
|
||||||
|
|
||||||
**Graphite is a free, open source vector and raster graphics engine, [available now](https://editor.graphite.rs) in alpha. Get creative with a fully nondestructive editing workflow that combines layer-based compositing with node-based generative design.**
|
**Graphite is a free, open source vector and raster graphics engine, [available now](https://editor.graphite.art) in alpha. Get creative with a fully nondestructive editing workflow that combines layer-based compositing with node-based generative design.**
|
||||||
|
|
||||||
Having begun life as a vector editor, Graphite continues evolving into a generalized, all-in-one graphics toolbox that's built more like a game engine than a conventional creative app. The editor's tools wrap its node graph core, providing user-friendly workflows for vector, raster, and beyond. Photo editing, motion graphics, digital painting, desktop publishing, and VFX compositing are additional competencies on the planned [roadmap](https://graphite.rs/features/#roadmap) making Graphite into a highly versatile content creation tool.
|
Having begun life as a vector editor, Graphite continues evolving into a generalized, all-in-one graphics toolbox that's built more like a game engine than a conventional creative app. The editor's tools wrap its node graph core, providing user-friendly workflows for vector, raster, and beyond. Photo editing, motion graphics, digital painting, desktop publishing, and VFX compositing are additional competencies on the planned [roadmap](https://graphite.art/features/#roadmap) making Graphite into a highly versatile content creation tool.
|
||||||
|
|
||||||
Learn more from the [website](https://graphite.rs/), subscribe to the [newsletter](https://graphite.rs/#newsletter), consider [volunteering](https://graphite.rs/volunteer/) or [donating](https://graphite.rs/donate/), and remember to give this repository a ⭐!
|
Learn more from the [website](https://graphite.art/), subscribe to the [newsletter](https://graphite.art/#newsletter), consider [volunteering](https://graphite.art/volunteer/) or [donating](https://graphite.art/donate/), and remember to give this repository a ⭐!
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<a href="https://discord.graphite.rs/">
|
<a href="https://discord.graphite.art/">
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/ad185fac-3b48-446d-863c-2bcb0724abee">
|
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/ad185fac-3b48-446d-863c-2bcb0724abee">
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/aa23f503-f3bf-444a-9080-8eaa19fa2fa8">
|
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/aa23f503-f3bf-444a-9080-8eaa19fa2fa8">
|
||||||
@@ -62,7 +62,7 @@ https://github.com/user-attachments/assets/f4604aea-e8f1-45ce-9218-46ddc666f11d
|
|||||||
|
|
||||||
## Support our mission ❤️
|
## Support our mission ❤️
|
||||||
|
|
||||||
Graphite is 100% community built and funded. Please become a part of keeping the project alive and thriving with a [donation](https://graphite.rs/donate/) if you share a belief in our **mission**:
|
Graphite is 100% community built and funded. Please become a part of keeping the project alive and thriving with a [donation](https://graphite.art/donate/) if you share a belief in our **mission**:
|
||||||
|
|
||||||
> Graphite strives to unshackle the creativity of every budding artist and seasoned professional by building the best comprehensive art and design tool that's accessible to all.
|
> Graphite strives to unshackle the creativity of every budding artist and seasoned professional by building the best comprehensive art and design tool that's accessible to all.
|
||||||
>
|
>
|
||||||
@@ -78,6 +78,8 @@ Graphite is 100% community built and funded. Please become a part of keeping the
|
|||||||
|
|
||||||
## Contributing/building the code
|
## Contributing/building the code
|
||||||
|
|
||||||
Are you a graphics programmer or Rust developer? Graphite aims to be one of the most approachable projects for putting your engineering skills to use in the world of open source. See [instructions here](https://graphite.rs/volunteer/guide/) for setting up the project and getting started.
|
Are you a graphics programmer or Rust developer? Graphite aims to be one of the most approachable projects for putting your engineering skills to use in the world of open source. See [instructions here](https://graphite.art/volunteer/guide/) for setting up the project and getting started.
|
||||||
|
|
||||||
*By submitting code for inclusion in the project, you are agreeing to license your changes under the Apache 2.0 license, and that you have the authority to do so. Some directories may have other licenses, like dual-licensed MIT/Apache 2.0, and code submissions to those directories mean you agree to the applicable license(s).*
|
## License
|
||||||
|
|
||||||
|
Graphite's source code is dual-licensed under your choice of either the [MIT license](LICENSE-MIT) or the [Apache License 2.0](LICENSE-APACHE), at your option, unless otherwise noted within the repository. By submitting code for inclusion in the project, you agree to license your contributions under both licenses, and that you have the authority to do so.
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
{{!
|
|
||||||
Be careful to prevent auto-formatting from breaking this file's indentation.
|
|
||||||
Replace this file with JSON output once this is resolved: https://github.com/EmbarkStudios/cargo-about/issues/73
|
|
||||||
|
|
||||||
The `GENERATED_BY_CARGO_ABOUT` prefix is a JS labeled statement
|
|
||||||
(<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label>)
|
|
||||||
used so the reader of the generated file can verify the file does indeed start with that string,
|
|
||||||
while remaining valid JS for subsequent parsing.
|
|
||||||
}}
|
|
||||||
GENERATED_BY_CARGO_ABOUT: [
|
|
||||||
{{#each licenses}}
|
|
||||||
{
|
|
||||||
licenseName: `{{name}}`,
|
|
||||||
licenseText: `{{text}}`,
|
|
||||||
packages: [
|
|
||||||
{{#each used_by}}
|
|
||||||
{
|
|
||||||
name: `{{crate.name}}`,
|
|
||||||
version: `{{crate.version}}`,
|
|
||||||
author: `{{crate.authors}}`,
|
|
||||||
repository: `{{crate.repository}}`,
|
|
||||||
},
|
|
||||||
{{/each}}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{{/each}}
|
|
||||||
]
|
|
||||||
+1
-2
@@ -1,4 +1,5 @@
|
|||||||
accepted = [
|
accepted = [
|
||||||
|
"0BSD", # Keep this list in sync with those in `/deny.toml`
|
||||||
"Apache-2.0 WITH LLVM-exception", # Keep this list in sync with those in `/deny.toml`
|
"Apache-2.0 WITH LLVM-exception", # Keep this list in sync with those in `/deny.toml`
|
||||||
"Apache-2.0", # Keep this list in sync with those in `/deny.toml`
|
"Apache-2.0", # Keep this list in sync with those in `/deny.toml`
|
||||||
"BSD-2-Clause", # Keep this list in sync with those in `/deny.toml`
|
"BSD-2-Clause", # Keep this list in sync with those in `/deny.toml`
|
||||||
@@ -21,8 +22,6 @@ accepted = [
|
|||||||
workarounds = ["ring"]
|
workarounds = ["ring"]
|
||||||
ignore-build-dependencies = true
|
ignore-build-dependencies = true
|
||||||
ignore-dev-dependencies = true
|
ignore-dev-dependencies = true
|
||||||
# Clearly Defined's API would occasionally (every few months) return errors for at least a full day (maybe some weird rate limiting?), but we can just disable to perform local checking (see #1653)
|
|
||||||
no-clearly-defined = true
|
|
||||||
|
|
||||||
# https://raw.githubusercontent.com/briansmith/webpki/main/LICENSE
|
# https://raw.githubusercontent.com/briansmith/webpki/main/LICENSE
|
||||||
# is the ISC license but test code within the repo is BSD-3-Clause, but is not compiled into the crate when we use it
|
# is the ISC license but test code within the repo is BSD-3-Clause, but is not compiled into the crate when we use it
|
||||||
|
|||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[10316247453530667000,{"inputs":[{"Node":{"node_id":9079109751490757000,"output_index":0}},{"Node":{"node_id":1250460246919467000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":false,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7954638344846060000,{"inputs":[{"Node":{"node_id":5991296268862790000,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.1875,"green":0.0,"blue":0.0,"alpha":0.203125}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.19140625,"green":0.0,"blue":0.0,"alpha":0.203125}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17021405646895729000,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":1.0,"green":0.31764707,"blue":0.15686275,"alpha":1.0}],[0.5,{"red":1.0,"green":0.5686275,"blue":0.25490198,"alpha":1.0}],[1.0,{"red":1.0,"green":0.7294118,"blue":0.16078432,"alpha":1.0}]]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_math_nodes::GradientValueNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[8366826746721323000,{"inputs":[{"Node":{"node_id":5591755359500854000,"output_index":0}},{"Node":{"node_id":13846904447064916285,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"imLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[26023588519449590,{"inputs":[{"Node":{"node_id":4002029424845293600,"output_index":0}},{"Value":{"tagged_value":{"Color":{"red":0.94750905,"green":0.5567761,"blue":0.06654528,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.94750905,"green":0.5567761,"blue":0.06654528,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true},{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Linear"},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[0.0,-92.53735521402166,92.53735521402166,0.0,9.606221358397944,-69.72678572415595]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[213744308682803360,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"List":{"Concrete":{"name":"graphic_types::graphic::Graphic"}}}},"exposed":true}},{"Node":{"node_id":10463288500489480000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[366962978353611840,{"inputs":[{"Node":{"node_id":8366826746721323000,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Union"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[799182088624980700,{"inputs":[{"Node":{"node_id":7386572856931342000,"output_index":0}},{"Value":{"tagged_value":{"Number":100.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"math_nodes::DivideNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1250460246919467000,{"inputs":[{"Node":{"node_id":4742778578215475000,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Union"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplicationLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[10507084483235320484,{"inputs":[{"Node":{"node_id":9157963288496356916,"output_index":0}},{"Node":{"node_id":1396768435017101055,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4741515246389989284,{"inputs":[{"Node":{"node_id":14255588039347536657,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.2435565297001,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4105329493214975815,{"inputs":[{"Node":{"node_id":12931264630175648107,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.24355652969916,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[57904581517036791,{"inputs":[{"Node":{"node_id":9393309733761233513,"output_index":0}},{"Node":{"node_id":15300421479077882117,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[70804263053697201,{"inputs":[{"Node":{"node_id":13942787566051910019,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[3.410605131648481e-13,3.410605131648481e-13]},"exposed":false}},{"Value":{"tagged_value":{"Number":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1268.999999999999,634.9999999999992]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[194878846429432339,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"Item":{"Concrete":{"name":"vector_types::vector::vector_types::Vector"}}}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4],"remove":[],"delta":[[1,[671.7691453623979,420.00000000000006]],[2,[559.8076211353317,450.0000000000001]],[3,[410.5255888325765,410.0]],[4,[522.4871130596428,380.00000000000006]]]},"segments":{"add":[1,2,3,4],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4]],"end_point":[[1,2],[2,3],[3,4],[4,1]],"handle_primary":[[1,[0.0,0.0]],[2,[0.0,0.0]],[3,[0.0,0.0]],[4,[0.0,0.0]]],"handle_end":[[1,[0.0,0.0]],[2,[0.0,0.0]],[3,[0.0,0.0]],[4,[0.0,0.0]]]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"vector_types::vector::vector_modification::VectorModification"}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"vector_nodes::vector_modification_nodes::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplicLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":12241147352993594415,"output_index":0}}],"nodes":[[4388711862172196665,{"inputs":[],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::std_nodes::MandelbrotNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[3606681156406984991,{"inputs":[{"Node":{"node_id":6323350524796370485,"output_index":0}},{"Value":{"tagged_value":{"GradientStops":[[0.3237704918032787,{"red":1.0,"green":0.0,"blue":1.0,"alpha":0.1}],[0.5655737704918032,{"red":0.8901961,"green":0.8117647,"blue":0.39215687,"alpha":1.0}],[0.8155737704918032,{"red":0.0,"green":1.0,"blue":1.0,"alpha":0.5}]]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::gradient_map::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[6029481207635803402,{"inputs":[{"Node":{"node_id":4388711862172196665,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1000.0,1000.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7624113397561636853,{"inputs":[{"Value":{"tagged_value":{"Graphic":{"element":[],"transform":[],"alpha_blending":[],"source_node_id":[]}},"exposed":true}},{"Node":{"node_id":3606681156406984991,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":12241147352993594415,"output_index":0}}],"nodes":[[80924370013313595,{"inputs":[{"Node":{"node_id":6029481207635803402,"output_index":0}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.06469504,"green":0.0,"blue":0.0755814,"alpha":1.0,"linear":true},{"red":0.016644126,"green":0.13212071,"blue":0.62523156,"alpha":1.0,"linear":true},{"red":1.0,"green":0.8708812,"blue":0.3485102,"alpha":1.0,"linear":true},{"red":0.30054384,"green":0.8468733,"blue":0.8468733,"alpha":0.01,"linear":true}],"position":[0.0,0.12704918032786883,0.5,1.0],"midpoint":[0.5,0.5,0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"raster_nodes::adjustments::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3606681156406984991,{"inputs":[{"Node":{"node_id":6323350524796370485,"output_index":0}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":0.04631017,"green":0.0,"blue":0.0076861563,"alpha":1.0,"linear":true},{"red":0.83939683,"green":0.7249875,"blue":0.27055356,"alpha":1.0,"linear":true},{"red":0.025397457,"green":0.3485102,"blue":0.3485102,"alpha":1.0,"linear":true},{"red":0.01102731,"green":0.09231063,"blue":0.09231063,"alpha":1.0,"linear":true}],"position":[0.0,0.3237704918032787,0.5655737704918032,0.8155737704918032,1.0],"midpoint":[0.5,0.5,0.5,0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"raster_nodes::adjustments::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4388711862172196665,{"inputs":[],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"raster_nodes::std_nodes::MandelbrotNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[6029481207635803402,{"inputs":[{"Node":{"node_id":4388711862172196665,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Number":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1000.0,1000.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[6323350524796370485,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"Integer":0},"exposed":false}},{"Value":{"tagged_value":{"Number":35.0},"exposed":false}},{"Value":{"tagged_value":{"NoiseType":"OpenSimplex2"},"exposed":false}},{"Value":{"tagged_value":{"DomainWarpType":"OpenSimplex2"},"exposed":false}},{"Value":{"tagged_value":{"Number":100.0},"exposed":false}},{"Value":{"tagged_value":{"FractalType":"PingPong"},"exposed":false}},{"Value":{"tagged_value":{"Integer":3},"exposed":false}},{"Value":{"tagged_value":{"Number":2.0},"exposed":false}},{"Value":{"tagged_value":{"Number":0.5},"exposed":false}},{"Value":{"tagged_value":{"Number":0.0},"exposed":false}},{"Value":{"tagged_value":{"Number":2.0},"exposed":false}},{"Value":{"tagged_value":{"CellularDistanceFunction":"Hybrid"},"exposed":false}},{"Value":{"tagged_value":{"CellularReturnType":"CellValue"},"exposed":false}},{"Value":{"tagged_value":{"Number":1.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"raster_nodes::std_nodes::NoisePatternNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[6565638614909771142,{"inputs":[{"Node":{"node_id":7624113397561636853,"output_index":0}},{"Node":{"node_id":80924370013313595,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"GeLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[13353438235848911576,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[6379137305818664393,18442321214082298093,18118267825025549699,6351696498298648253,17863574903157697896,4691860614575868200,301778328144628917,10625296323957562985,533731991408535384,13357220652574593654,15992617814592812350],"remove":[],"delta":[[18118267825025549699,[642.0740740740741,0.0]],[6379137305818664393,[625.4814814814813,0.0]],[18442321214082298093,[565.6296296296297,122.96296296296298]],[17863574903157697896,[606.8148151308641,95.19407372365433]],[6351696498298648253,[646.8148148148149,0.0]],[10625296323957562985,[473.4814814814815,272.5925925925926]],[13357220652574593654,[574.2222222222222,108.44444444444449]],[301778328144628917,[493.5149940383244,200.29629629629628]],[15992617814592812350,[621.0370370370368,0.0]],[4691860614575868200,[528.2962962962963,283.8518518518518]],[533731991408535384,[501.6296296296296,175.40740740740742]]]},"segments":{"add":[13662059715350867364,3384102572540409881,12035095010819582754,10146665273368938971,318560030360358929,8462655819889292900,3303411878775644985,8661113083384527971,2035327810332855521,11346538709718766144,3710133387837274291],"remove":[],"start_point":[[318560030360358929,17863574903157697896],[11346538709718766144,13357220652574593654],[13662059715350867364,6379137305818664393],[3710133387837274291,15992617814592812350],[12035095010819582754,18118267825025549699],[2035327810332855521,533731991408535384],[3303411878775644985,301778328144628917],[8661113083384527971,10625296323957562985],[10146665273368938971,6351696498298648253],[3384102572540409881,18442321214082298093],[8462655819889292900,4691860614575868200]],"end_point":[[11346538709718766144,15992617814592812350],[3303411878775644985,10625296323957562985],[8661113083384527971,533731991408535384],[3384102572540409881,18118267825025549699],[12035095010819582754,6351696498298648253],[2035327810332855521,13357220652574593654],[8462655819889292900,301778328144628917],[318560030360358929,4691860614575868200],[10146665273368938971,17863574903157697896],[13662059715350867364,18442321214082298093],[3710133387837274291,6379137305818664393]],"handle_primary":[[11346538709718766144,[9.925839724176626,-9.951533978271286]],[8462655819889292900,[0.0,0.0]],[12035095010819582754,[0.0,0.0]],[2035327810332855521,[42.96296296296293,-41.7777777777778]],[8661113083384527971,[0.2962962962963047,0.2962962962963047]],[3303411878775644985,[0.0,0.0]],[10146665273368938971,[0.0,0.0]],[318560030360358929,[-46.95465552079859,46.40007297527743]],[3384102572540409881,[0.0,0.0]],[3710133387837274291,[0.0,0.0]],[13662059715350867364,[0.0,0.0]]],"handle_end":[[8661113083384527971,[-42.34888386913234,41.180638796880466]],[12035095010819582754,[0.0,0.0]],[2035327810332855521,[-8.299214014278164,8.32069754812484]],[3303411878775644985,[-6.2222222222222285,-40.59259259259261]],[11346538709718766144,[1.1377781018271662,63.71555518874077]],[318560030360358929,[-97.48148148148152,-81.18518518518522]],[10146665273368938971,[48.16592595101224,-47.597037061827145]],[8462655819889292900,[-21.74426522093495,47.99999999999997]],[3710133387837274291,[0.0,0.0]],[13662059715350867364,[68.68148181185177,-54.8859262904691]],[3384102572540409881,[0.5807410754567854,77.36888852918523]]],"stroke":[[8661113083384527971,0],[2035327810332855521,0],[13662059715350867364,0],[12035095010819582754,0],[11346538709718766144,0],[318560030360358929,0],[8462655819889292900,0],[3710133387837274291,0],[3303411878775644985,0],[10146665273368938971,0],[3384102572540409881,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[[{"ty":"End","segment":12035095010819582754},{"ty":"Primary","segment":10146665273368938971}],[{"ty":"Primary","segment":11346538709718766144},{"ty":"End","segment":2035327810332855521}],[{"ty":"End","segment":10146665273368938971},{"ty":"Primary","segment":318560030360358929}],[{"ty":"End","segment":8661113083384527971},{"ty":"Primary","segment":2035327810332855521}]],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[57390435731316553,{"inputs":[{"Node":{"node_id":8460565235419043665,"output_index":0}},{"Node":{"node_id":13838011362258067867,"output_index":0}},{"Value":{"tagged_value":{"Number":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[140396870212231820,{"inputs":[{"Node":{"node_id":18095952297474762348,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Intersect"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[294265135510952894,{"inputs":[{"Node":{"node_id":11264395591110193456,"output_index":0}},{"Value":{"tagged_value":{"Color":{"red":0.83076996,"green":0.32314324,"blue":0.027320892,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.6938719,"green":0.048171822,"blue":0.028426038,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Linear"},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[20.0,0.0,0.0,20.0,-10.0,0.0]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[392274448837115448,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"List":{"Concrete":{"name":"graphic_types::artboard::Artboard"}}}},"exposed":true}},{"Node":{"node_id":6787585796949551500,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1536.0,768.0]},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.8549927,"green":0.71569365,"blue":0.48514998,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Fn":[{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},{"Generic":"T"}]},"import_index":1}},{"Import":{"import_type":{"Item":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}}},"import_index":2}},{"Import":{"import_type":{"Item":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}}},"import_index":3}},{"Import":{"import_type":{"Item":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}}},"import_index":4}},{"Import":{"import_type":{"Item":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}}},"import_index":5}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::artboard::CreateArtboardNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":1,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Import":{"import_type":{"Fn":[{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},{"List":{"Concrete":{"nameLine truncated
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[17154757625902243313,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.23529412,"green":0.23529412,"blue":0.24313726,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":1670.79570439},"exposed":false}},{"Value":{"tagged_value":{"F64":24.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[11731553664207576737,{"inputs":[{"Node":{"node_id":757876048866560520,"output_index":0}},{"Value":{"tagged_value":{"F64":48.900000000000006},"exposed":false}},{"Node":{"node_id":7828034197076821310,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::JitterPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[14158287945315818946,{"inputs":[{"Node":{"node_id":16943732999059587742,"output_index":0}},{"Node":{"node_id":14577956936089455769,"output_index":0}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.6181095265062186,3.496297826945966]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2288754089236120499,{"inputs":[{"Node":{"node_id":14158287945315818946,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::SplineNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7828034197076821310,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":3}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_math_nodes::ToU32Node"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"F64":4000.0},"exposed":false}},{"Value":{"tagged_value":{"F64":500.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.99607843,"green":0.827451,"blue":0.65882355,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[239716716021064150,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"List":{"Concrete":{"name":"graphic_types::graphic::Graphic"}}}},"exposed":true}},{"Node":{"node_id":7711570794020903773,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1801066723091712434,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"red":0.036889445,"green":0.038204364,"blue":0.043735027,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Number":1744.31393592},"exposed":false}},{"Value":{"tagged_value":{"Number":63.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"Number":4000.0},"exposed":false}},{"Value":{"tagged_value":{"Number":500.0},"exposed":false}},{"Value":{"tagged_value":{"BoxCorners":[0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"vector_nodes::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"red":0.9911022,"green":0.6514057,"blue":0.39157256,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Linear"},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[1.0,0.0,0.0,1.0,0.0,0.0]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2288754089236120499,{"inputs":[{"Node":{"node_id":1415828794531Line truncated
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[665049002420596400,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"delta":[[1,[-103.55555555555554,126.66666666666664]],[18,[145.77777777777777,-97.7777777777778]],[12,[199.5555555555555,10.666666666666629]],[22,[71.11111111111109,-201.7777777777778]],[19,[90.66666666666664,-129.33333333333334]],[4,[18.66666666666663,157.77777777777771]],[15,[111.11111111111114,-60.888888888888914]],[17,[123.99999999999994,-84.00000000000003]],[11,[136.88888888888886,39.111111111111086]],[20,[128.4444444444444,-142.22222222222223]],[16,[159.5555555555555,-75.55555555555557]],[5,[66.22222222222223,152.88888888888886]],[24,[57.77777777777777,-129.33333333333334]],[33,[-78.22222222222223,75.55555555555554]],[10,[216.4444444444444,72.4444444444444]],[8,[252.4444444444444,124.88888888888886]],[9,[156.4444444444444,97.33333333333331]],[3,[45.77777777777777,145.33333333333331]],[32,[9.333333333333314,38.66666666666663]],[28,[39.111111111111086,-58.22222222222226]],[7,[229.33333333333331,152.4444444444444]],[26,[22.66666666666663,-81.33333333333337]],[31,[-53.33333333333337,13.777777777777771]],[27,[-11.111111111111144,-72.00000000000003]],[14,[183.11111111111103,-19.111111111111143]],[6,[123.99999999999994,148.4444444444444]],[23,[19.555555555555543,-139.55555555555557]],[30,[-9.333333333333371,0.0]],[29,[-32.888888888888914,-14.666666666666686]],[25,[0.8888888888888573,-94.66666666666669]],[34,[-5.333333333333371,99.11111111111109]],[21,[76.0,-202.22222222222223]],[2,[-67.55555555555554,158.22222222222217]],[13,[153.77777777777777,-1.3333333333333712]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"start_point":[[7,7],[3,3],[8,8],[10,10],[13,13],[11,11],[31,31],[25,25],[18,18],[34,34],[27,27],[12,12],[22,22],[19,19],[32,32],[5,5],[3Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[169695252050218443,{"inputs":[{"Node":{"node_id":13907401402762847509,"output_index":0}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.75,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.01,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.7734375,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.01,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Radial"},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[31.55635094002563,-2.7755575615628914e-17,2.7755575615628914e-17,31.55635094002563,-0.225779263556106,34.981204988590605]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[655907162126315400,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"Item":{"Concrete":{"name":"vector_types::vector::vector_types::Vector"}}}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11],"remove":[],"delta":[[1,[416.0,270.9999999999999]],[2,[587.0,291.9999999999999]],[3,[373.0,372.9999999999999]],[4,[484.0,446.9999999999999]],[5,[639.0,438.9999999999999]],[6,[495.0,533.9999999999999]],[7,[304.0,611.9999999999999]],[8,[475.0,671.9999999999999]],[9,[750.0,703.9999999999999]],[10,[455.0,824.9999999999999]],[11,[186.0,824.9999999999999]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]],"end_point":[[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9],[9,10],[10,11]],"handle_primary":[[1,[0.0,0.0]],[2,[0.0,0.0]],[3,[0.0,0.0]],[4,[0.0,0.0]],[5,[0.0,0.0]],[6,[0.0,0.0]],[7,[0.0,0.0]],[8,[0.0,0.0]],[9,[0.0,0.0]],[10,[0.0,0.0]]],"handle_end":Line truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[10127467043900015225,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2],"remove":[],"delta":[[2,[644.0,726.6666666666666]],[1,[258.00000000000006,994.6666666666664]]]},"segments":{"add":[1],"remove":[],"start_point":[[1,1]],"end_point":[[1,2]],"handle_primary":[[1,[0.0,0.0]]],"handle_end":[[1,[-328.66666666666674,129.33333333333337]]],"stroke":[[1,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"graphene_core::table::Table<graphene_core::vector::vector_types::Vector>","alias":null}},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"graphene_core::vector::vector_modification::VectorModification","alias":null}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::vector::vector_modification::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[15961046538654083626,{"inputs":[{"Node":{"node_id":1889157037801767612,"output_index":0}},{"Node":{"node_id":4332145463108161926,"output_index":0}},{"Value":{"tagged_value":{"F64":0.5},"exposed":false}},{"Value":{"tagged_value":{"F64":10.0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::CopyToPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17378885078543074499,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8],"remove":[],"delta":[[1,[823.2222222222221,660.4444444444445]],[8,[746.0000000000001,842.9999999999999]],[2,[745.5,826.0]],[3,[707.5,1026.5]],[6,[725.7777777777779,1026.370370370371]],[4,[709.5555555555554,1026.6666666666667]],[5,[740.4444444444443,857.1111111111111]],[7,[727.5555555555554,1026.6666666666663]]]},"segments":{"add":[1,2,3,4,5,6,7,8],"remove":[],"start_point":[[4,4],[3,3],[1,1],[2,2],[7,7],[5,5],[8,8],[6,6]],"end_point":[[4,5],[8,1],[5,6],[7,8],[6,7],[2,3],[3,4],[1,2]],"handle_primary":[[4,[0.0,0.0]],[7,[0.0,0.0]],[1,[0.0,0.0]],[2,[-24.5,85.0]],[6,[0.0,0.0]],[8,[17.33333333333337,-84.99999999999989]],[5,[0.0,0.0]],[3,[0.0,0.0]]],"handle_end":[[5,[-7.555555555555884,-59.25925925925992]],[8,[1.772016460905547,0.9591220850479658]],[2,[0.0,0.0]],[4,[-23.11111111111109,90.44444444444456]],[7,[-26.8034437596026,131.4399645903585]],[1,[24.5,-85.0]],[6,[0.0,0.0]],[3,[0.0,0.0]]],"stroke":[[3,0],[5,0],[2,0],[4,0Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[1378578509112405,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"Item":{"Concrete":{"name":"vector_types::vector::vector_types::Vector"}}}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5],"remove":[],"delta":[[1,[602.6886145404666,50.91906721536352]],[2,[599.5281207133061,50.3923182441701]],[3,[590.4855967078191,66.80932784636488]],[4,[594.6410608139003,75.57872275567746]],[5,[593.3924706599604,60.59564090839812]]]},"segments":{"add":[1,2,3,4,5],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4],[5,5]],"end_point":[[1,2],[2,3],[3,4],[4,5],[5,1]],"handle_primary":[[1,[0.0,0.0]],[2,[-1.843621399176982,0.5267489711934203]],[3,[1.9314128943758533,7.3257125438195345]],[4,[0.0,0.0]],[5,[1.248590153939972,-3.9798811156835896]]],"handle_end":[[1,[1.843621399176982,-0.5267489711934203]],[2,[-2.7532629181224593,-10.4429315732828]],[3,[0.0,0.0]],[4,[-1.704168058538812,5.432035686592322]],[5,[-4.379820149367788,0.9754610577655498]]]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"vector_types::vector::vector_modification::VectorModification"}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"vector_nodes::vector_modification_nodes::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[172538270105470471,{"inputs":[{"Node":{"node_id":9276497172451351253,"output_index":0}},{"Value":{"tagged_value":{"Color":{"red":0.78353786,"green":0.6038274,"blue":0.33245158,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.78353786,"green":0.6038274,"blue":0.33245158,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Linear"},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[2.170365521878466,0.0,0.0,2.170365521878466,604.9565968314213,108.54930650815425]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[314278016428495768,{"inputs":[{"Node":{"node_id":6282972142629473139,"output_index":0}},{"Node":{"node_id":5020096817747898028,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[202,{"inputs":[{"Node":{"node_id":206,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[404,{"inputs":[{"Node":{"node_id":402,"output_index":0}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.24313726,"green":0.18431373,"blue":0.19215687,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":2.0},"exposed":false}},{"Value":{"tagged_value":{"StrokeAlign":"Center"},"exposed":false}},{"Value":{"tagged_value":{"StrokeCap":"Butt"},"exposed":false}},{"Value":{"tagged_value":{"StrokeJoin":"Miter"},"exposed":false}},{"Value":{"tagged_value":{"F64":4.0},"exposed":false}},{"Value":{"tagged_value":{"PaintOrder":"StrokeAbove"},"exposed":false}},{"Value":{"tagged_value":{"VecF64":[]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::StrokeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[93,{"inputs":[{"Node":{"node_id":94,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[851.1666666666667,668.5377104806669]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[39.677869315599935,39.67786931560005]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[155,{"inputs":[{"Node":{"node_id":159,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}},"exposed":false}}],"call_argument":{"ConcretLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[74,{"inputs":[{"Node":{"node_id":75,"output_index":0}},{"Node":{"node_id":81,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[75,{"inputs":[{"Node":{"node_id":76,"output_index":0}},{"Node":{"node_id":161,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_Line truncated
|
||||||
@@ -39,9 +39,10 @@ db-urls = ["https://github.com/rustsec/advisory-db"]
|
|||||||
# A list of advisory IDs to ignore. Note that ignored advisories will still
|
# A list of advisory IDs to ignore. Note that ignored advisories will still
|
||||||
# output a note when they are encountered.
|
# output a note when they are encountered.
|
||||||
ignore = [
|
ignore = [
|
||||||
"RUSTSEC-2024-0370", # Unmaintained but still fully functional crate `proc-macro-error`
|
"RUSTSEC-2024-0388", # Unmaintained `derivative`, used directly by graphite-editor and graphite-desktop
|
||||||
"RUSTSEC-2024-0388", # Unmaintained but still fully functional crate `derivative`
|
"RUSTSEC-2024-0436", # Unmaintained `paste`, pulled in by dependencies `metal` and `wgpu-hal`
|
||||||
"RUSTSEC-2024-0436", # Unmaintained but still fully functional crate `paste`
|
"RUSTSEC-2025-0134", # Unmaintained `rustls-pemfile`, pulled in by build dependency `download-cef`
|
||||||
|
"RUSTSEC-2025-0141", # Unmaintained `bincode`, pulled in by dev dependency `gungraun`
|
||||||
]
|
]
|
||||||
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
|
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
|
||||||
# lower than the range specified will be ignored. Note that ignored advisories
|
# lower than the range specified will be ignored. Note that ignored advisories
|
||||||
@@ -62,6 +63,7 @@ ignore = [
|
|||||||
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
|
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
|
||||||
#
|
#
|
||||||
allow = [
|
allow = [
|
||||||
|
"0BSD", # Keep this list in sync with those in `/about.toml`
|
||||||
"Apache-2.0 WITH LLVM-exception", # Keep this list in sync with those in `/about.toml`
|
"Apache-2.0 WITH LLVM-exception", # Keep this list in sync with those in `/about.toml`
|
||||||
"Apache-2.0", # Keep this list in sync with those in `/about.toml`
|
"Apache-2.0", # Keep this list in sync with those in `/about.toml`
|
||||||
"BSD-2-Clause", # Keep this list in sync with those in `/about.toml`
|
"BSD-2-Clause", # Keep this list in sync with those in `/about.toml`
|
||||||
@@ -185,7 +187,7 @@ allow-git = []
|
|||||||
|
|
||||||
[sources.allow-org]
|
[sources.allow-org]
|
||||||
# 1 or more github.com organizations to allow git sources for
|
# 1 or more github.com organizations to allow git sources for
|
||||||
github = ["linebender", "Rust-GPU", "specta-rs"]
|
github = ["linebender", "Rust-GPU"]
|
||||||
# 1 or more gitlab.com organizations to allow git sources for
|
# 1 or more gitlab.com organizations to allow git sources for
|
||||||
#gitlab = [""]
|
#gitlab = [""]
|
||||||
# 1 or more bitbucket.org organizations to allow git sources for
|
# 1 or more bitbucket.org organizations to allow git sources for
|
||||||
|
|||||||
+42
-35
@@ -1,36 +1,43 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-desktop"
|
name = "graphite-desktop"
|
||||||
version = "0.1.0"
|
|
||||||
description = "Graphite Desktop"
|
description = "Graphite Desktop"
|
||||||
authors = ["Graphite Authors <[email protected]>"]
|
version.workspace = true
|
||||||
license = "Apache-2.0"
|
license.workspace = true
|
||||||
repository = ""
|
authors.workspace = true
|
||||||
edition = "2024"
|
edition.workspace = true
|
||||||
rust-version = "1.87"
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "graphite"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["recommended", "embedded_resources"]
|
default = ["recommended", "embedded_resources"]
|
||||||
recommended = ["gpu", "accelerated_paint"]
|
recommended = ["gpu", "accelerated_paint"]
|
||||||
embedded_resources = ["dep:graphite-desktop-embedded-resources"]
|
embedded_resources = ["graphite-desktop-ui/embedded_resources"]
|
||||||
gpu = ["graphite-desktop-wrapper/gpu"]
|
gpu = ["graphite-desktop-wrapper/gpu"]
|
||||||
|
accelerated_paint = ["graphite-desktop-ui/accelerated_paint"]
|
||||||
# Hardware acceleration features
|
|
||||||
accelerated_paint = ["accelerated_paint_dmabuf", "accelerated_paint_d3d11", "accelerated_paint_iosurface"]
|
|
||||||
accelerated_paint_dmabuf = ["libc", "ash"]
|
|
||||||
accelerated_paint_d3d11 = ["windows", "ash"]
|
|
||||||
accelerated_paint_iosurface = ["objc2-io-surface", "objc2-metal", "core-foundation"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Local dependencies
|
# Local dependencies
|
||||||
graphite-desktop-wrapper = { path = "wrapper" }
|
graphite-desktop-wrapper = { path = "wrapper" }
|
||||||
graphite-desktop-embedded-resources = { path = "embedded-resources", optional = true }
|
graphite-desktop-ui = { path = "ui" }
|
||||||
|
|
||||||
wgpu = { workspace = true }
|
wgpu = { workspace = true }
|
||||||
winit = { workspace = true, features = [ "serde" ] }
|
winit = { workspace = true, features = [
|
||||||
|
"wayland-csd-adwaita-notitlebar",
|
||||||
|
"serde",
|
||||||
|
] }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
cef = { workspace = true }
|
tokio = { workspace = true }
|
||||||
cef-dll-sys = { workspace = true }
|
|
||||||
tracing-subscriber = { workspace = true }
|
tracing-subscriber = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
dirs = { workspace = true }
|
dirs = { workspace = true }
|
||||||
@@ -41,33 +48,33 @@ vello = { workspace = true }
|
|||||||
derivative = { workspace = true }
|
derivative = { workspace = true }
|
||||||
rfd = { workspace = true }
|
rfd = { workspace = true }
|
||||||
open = { workspace = true }
|
open = { workspace = true }
|
||||||
rand = { workspace = true, features = ["thread_rng"] }
|
lzma-rust2 = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
url = { workspace = true }
|
||||||
# Hardware acceleration dependencies
|
rand = { workspace = true, features = ["thread_rng"] }
|
||||||
ash = { version = "0.38", optional = true }
|
clap = { workspace = true, features = ["derive"] }
|
||||||
|
interprocess = "2.4.2"
|
||||||
|
fd-lock = "4.0.4"
|
||||||
|
ctrlc = "3.5.1"
|
||||||
|
|
||||||
# Windows-specific dependencies
|
# Windows-specific dependencies
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
windows = { version = "0.58.0", features = [
|
windows = { version = "0.62.2", features = [
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
"Win32_Graphics_Direct3D11",
|
|
||||||
"Win32_Graphics_Direct3D12",
|
|
||||||
"Win32_Graphics_Dxgi",
|
|
||||||
"Win32_Graphics_Dxgi_Common",
|
|
||||||
"Win32_Graphics_Dwm",
|
"Win32_Graphics_Dwm",
|
||||||
"Win32_Graphics_Gdi",
|
"Win32_Graphics_Gdi",
|
||||||
"Win32_System_LibraryLoader",
|
"Win32_System_LibraryLoader",
|
||||||
|
"Win32_System_Com",
|
||||||
|
"Win32_System_Console",
|
||||||
"Win32_UI_Controls",
|
"Win32_UI_Controls",
|
||||||
"Win32_UI_WindowsAndMessaging",
|
"Win32_UI_WindowsAndMessaging",
|
||||||
], optional = true }
|
"Win32_UI_HiDpi",
|
||||||
|
"Win32_UI_Shell",
|
||||||
|
] }
|
||||||
|
|
||||||
# macOS-specific dependencies
|
# macOS-specific dependencies
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
objc2-io-surface = { version = "0.3", optional = true }
|
objc2 = { version = "0.6.1", default-features = false }
|
||||||
objc2-metal = { version = "0.3", optional = true }
|
objc2-foundation = { version = "0.3.2", default-features = false }
|
||||||
core-foundation = { version = "0.9", optional = true }
|
objc2-app-kit = { version = "0.3.2", default-features = false }
|
||||||
|
muda = { git = "https://github.com/timon-schelling/muda.git", rev = "e5bc28bbd6781b18afbfc237981f9ef47eddf863", default-features = false }
|
||||||
# Linux-specific dependencies
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
|
||||||
libc = { version = "0.2", optional = true }
|
|
||||||
+3
-3
@@ -2,10 +2,10 @@
|
|||||||
Name=Graphite
|
Name=Graphite
|
||||||
GenericName=Vector & Raster Graphics Editor
|
GenericName=Vector & Raster Graphics Editor
|
||||||
Comment=Open-source vector & raster graphics editor. Featuring node based procedural nondestructive editing workflow.
|
Comment=Open-source vector & raster graphics editor. Featuring node based procedural nondestructive editing workflow.
|
||||||
Exec=graphite-editor
|
Exec=graphite
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Icon=graphite-icon-color
|
Icon=art.graphite.Graphite
|
||||||
Categories=Graphics;VectorGraphics;RasterGraphics;
|
Categories=Graphics;VectorGraphics;RasterGraphics;
|
||||||
Keywords=graphite;editor;vector;raster;procedural;design;
|
Keywords=graphite;editor;vector;raster;procedural;design;
|
||||||
StartupWMClass=rs.graphite.GraphiteEditor
|
StartupWMClass=art.graphite.Graphite
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 84 KiB |
@@ -1,9 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024">
|
|
||||||
<path fill="#ffffff" d="M.0007 659.5456c.0027 11.3936.0161 22.786.0834 34.1805.069 11.996.207 23.99.533 35.983.708 26.133 2.246 52.494 6.892 78.337 4.712 26.218 12.404 50.618 24.528 74.438 11.918 23.413 27.489 44.837 46.066 63.413 18.576 18.577 40.001 34.149 63.413 46.066 23.82 12.125 48.22 19.816 74.438 24.529 25.843 4.645 52.204 6.183 78.337 6.892 11.993.325 23.987.463 35.983.532 14.243.084 28.483.084 42.726.084h278c14.243 0 28.483 0 42.726-.084 11.996-.069 23.99-.207 35.983-.532 26.134-.709 52.494-2.247 78.338-6.892 26.217-4.713 50.617-12.404 74.437-24.529 23.413-11.917 44.837-27.489 63.414-46.066 18.576-18.576 34.148-40 46.065-63.413 12.125-23.82 19.816-48.22 24.529-74.438 4.645-25.843 6.183-52.204 6.892-78.337.325-11.993.463-23.987.532-35.983.084-14.243.084-28.483.084-42.726V373c0-14.243 0-28.483-.084-42.726-.069-11.996-.207-23.99-.532-35.983-.709-26.133-2.247-52.494-6.892-78.337-4.713-26.218-12.404-50.618-24.529-74.438-11.917-23.412-27.489-44.837-46.065-63.413-18.577-18.577-40.001-34.149-63.414-46.066-23.82-12.124-48.22-19.816-74.437-24.528-25.844-4.646-52.204-6.184-78.338-6.893-11.993-.325-23.987-.463-35.983-.532C679.483 0 665.243 0 651 0c0 0-275.1519-.002-286.5455.0007-11.3936.0027-22.7861.0161-34.1805.0834-11.996.069-23.99.207-35.983.532-26.133.709-52.494 2.247-78.337 6.893-26.218 4.712-50.618 12.404-74.438 24.528-23.412 11.917-44.837 27.489-63.413 46.066-18.577 18.576-34.148 40.001-46.066 63.413-12.124 23.82-19.816 48.22-24.528 74.438-4.646 25.843-6.184 52.204-6.892 78.337-.326 11.993-.464 23.987-.533 35.983C0 344.517 0 358.757 0 373"/>
|
|
||||||
<path fill="#f1decd" d="m789.9503 428.9507-135.005-233.833c-5.642-8.618-15.035-14.043-25.327-14.632h-270.01c-10.292.589-19.685 6.014-25.327 14.632l-135.036 233.833c-4.619 9.207-4.619 20.026 0 29.233l135.036 233.864c5.642 8.618 15.035 14.043 25.327 14.601h270.01c10.292-.558 19.685-5.983 25.327-14.601l135.036-233.864c4.588-9.207 4.588-20.026-.031-29.233Z"/>
|
|
||||||
<path fill="#3ea8ff" d="m693.8813 243.5087-42.346-73.315h-235.879l200.818 346.301 176.979-100.502-99.572-172.484Z"/>
|
|
||||||
<path fill="#2180ce" d="m552.5523 325.0697-89.373-154.876h-121.148l-37.355 51.832 106.609 184.605 95.604 165.664 142.383-79.732-96.72-167.493Z"/>
|
|
||||||
<path fill="#deba92" d="m800.4283 428.0827-166.532 81.282 205.53 312.542-38.998-393.824Z"/>
|
|
||||||
<path fill="#d49b64" d="m653.4263 499.7547-141.298 81.592 290.098 176.111-148.8-257.703Z"/>
|
|
||||||
<path fill="#473a3a" d="m870.2712 818.8377-.217-2.139c-2.666-29.109-34.565-376.278-34.658-377.766-.713-8.804-3.317-17.36-7.595-25.079-.093-.279-.217-.527-.341-.775l-.186-.465-.093.093-.062-.031.124-.062-36.58-63.364-102.889-178.25c-11.098-19.189-31.558-31-53.723-31h-278.969c-22.134 0-42.594 11.811-53.692 31l-139.5 241.583c-11.067 19.189-11.067 42.811 0 62l139.5 241.583c11.067 19.189 31.527 31 53.692 31h278.969c11.966-.093 23.653-3.689 33.635-10.292l119.629 85.808c-21.607-6.758-43.958-10.757-66.557-11.873-56.141-2.697-220.72-.868-407.402 14.353-76.601 6.231-112.809 24.428-108.593 27.993 10.819 9.238 23.622 12.896 87.42 12.648 56.792-.186 222.115 5.921 272.056 8.99 35.371 2.201 72.571 8.928 99.324 9.207 28.52-.372 56.947-2.542 85.188-6.51 42.594-5.859 99.076-17.67 112.065-33.387 6.851-6.51 10.354-15.841 9.455-25.265Zm-522.939-603.446c5.177-7.905 13.795-12.896 23.25-13.423h247.969c9.424.527 18.011 5.487 23.219 13.361l103.106 178.591c-15.469 16.12-28.892 34.1-39.959 53.506l-76.7869 8.525-45.787 62.248c-22.351-.124-44.64 2.542-66.34 7.874l-174.003-301.413 5.332-9.269Zm23.25 469.774c-9.455-.527-18.073-5.518-23.25-13.423l-124-214.737c-4.247-8.432-4.247-18.414 0-26.846l82.863-143.468 184.76 320.044.124-.062c2.139 3.844 5.084 7.161 8.649 9.765l95.883 68.758-225.029-.031Zm361.956 21.917-179.49-128.743c19.809-4.309 40.021-6.479 60.295-6.479l45.7871-62.217 76.787-8.525c10.106-17.546 22.103-33.945 35.712-48.949l21.793 219.79c-25.792-2.759-50.406 11.439-60.884 35.123Zm-325.841-87.482c4.619 7.223 2.48 16.802-4.712 21.421-7.223 4.619-16.802 2.48-21.421-4.712-.248-.372-.465-.775-.682-1.178l-108.5-187.891c-4.619-7.223-2.48-16.802 4.712-21.421 7.223-4.619 16.802-2.48 21.421 4.712.248.372.465.775.682 1.178l108.5 187.891Z"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 4.1 KiB |
@@ -0,0 +1,22 @@
|
|||||||
|
[package]
|
||||||
|
name = "graphite-desktop-bundle"
|
||||||
|
description = "Graphite Desktop Bundle"
|
||||||
|
version.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
cef-dll-sys = { workspace = true }
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
|
serde = { workspace = true }
|
||||||
|
plist = { version = "*" }
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("cargo:rerun-if-env-changed=CARGO_PROFILE");
|
||||||
|
println!("cargo:rerun-if-env-changed=PROFILE");
|
||||||
|
let profile = std::env::var("CARGO_PROFILE").or_else(|_| std::env::var("PROFILE")).unwrap();
|
||||||
|
println!("cargo:rustc-env=CARGO_PROFILE={profile}");
|
||||||
|
|
||||||
|
println!("cargo:rerun-if-env-changed=DEP_CEF_DLL_WRAPPER_CEF_DIR");
|
||||||
|
let cef_dir = std::env::var("DEP_CEF_DLL_WRAPPER_CEF_DIR").unwrap();
|
||||||
|
println!("cargo:rustc-env=CEF_PATH={cef_dir}");
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
#![cfg_attr(target_os = "linux", allow(unused))] // TODO: Remove this when bundling for linux is implemented
|
||||||
|
|
||||||
|
use std::error::Error;
|
||||||
|
use std::fs;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::process::{Command, Stdio};
|
||||||
|
|
||||||
|
pub(crate) const APP_NAME: &str = "Graphite";
|
||||||
|
pub(crate) const APP_BIN: &str = "graphite";
|
||||||
|
|
||||||
|
pub(crate) fn workspace_path() -> PathBuf {
|
||||||
|
PathBuf::from(env!("CARGO_WORKSPACE_DIR"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn profile_name() -> &'static str {
|
||||||
|
let mut profile = env!("CARGO_PROFILE");
|
||||||
|
if profile == "debug" {
|
||||||
|
profile = "dev";
|
||||||
|
}
|
||||||
|
profile
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn profile_path() -> PathBuf {
|
||||||
|
workspace_path().join(format!("target/{}", env!("CARGO_PROFILE")))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn cef_path() -> PathBuf {
|
||||||
|
PathBuf::from(env!("CEF_PATH"))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn build_bin(package: &str, bin: Option<&str>, features: Option<&str>) -> Result<PathBuf, Box<dyn Error>> {
|
||||||
|
let mut args = vec!["build", "--package", package, "--profile", profile_name()];
|
||||||
|
if let Some(bin) = bin {
|
||||||
|
args.push("--bin");
|
||||||
|
args.push(bin);
|
||||||
|
}
|
||||||
|
if let Some(features) = features {
|
||||||
|
args.push("--features");
|
||||||
|
args.push(features);
|
||||||
|
}
|
||||||
|
run_command("cargo", &args)?;
|
||||||
|
let profile_path = profile_path();
|
||||||
|
let mut bin_path = if let Some(bin) = bin { profile_path.join(bin) } else { profile_path.join(APP_BIN) };
|
||||||
|
if cfg!(target_os = "windows") {
|
||||||
|
bin_path.set_extension("exe");
|
||||||
|
}
|
||||||
|
Ok(bin_path)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn run_command(program: &str, args: &[&str]) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let status = Command::new(program).args(args).stdout(Stdio::inherit()).stderr(Stdio::inherit()).status()?;
|
||||||
|
if !status.success() {
|
||||||
|
return Err(format!("Command '{}' with args {:?} failed with status: {}", program, args, status).into());
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn clean_dir(dir: &Path) {
|
||||||
|
if dir.exists() {
|
||||||
|
fs::remove_dir_all(dir).unwrap();
|
||||||
|
}
|
||||||
|
fs::create_dir_all(dir).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn copy_dir(src: &Path, dst: &Path) {
|
||||||
|
fs::create_dir_all(dst).unwrap();
|
||||||
|
for entry in fs::read_dir(src).unwrap() {
|
||||||
|
let entry = entry.unwrap();
|
||||||
|
let dst_path = dst.join(entry.file_name());
|
||||||
|
if entry.file_type().unwrap().is_dir() {
|
||||||
|
copy_dir(&entry.path(), &dst_path);
|
||||||
|
} else {
|
||||||
|
fs::copy(entry.path(), &dst_path).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
use crate::common::*;
|
||||||
|
|
||||||
|
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let app_bin = build_bin("graphite-desktop-platform-linux", None, None)?;
|
||||||
|
|
||||||
|
// TODO: Implement bundling for linux
|
||||||
|
|
||||||
|
// TODO: Consider adding more useful cli
|
||||||
|
let args: Vec<String> = std::env::args().collect();
|
||||||
|
if let Some(pos) = args.iter().position(|a| a == "open") {
|
||||||
|
let extra_args: Vec<&str> = args[pos + 1..].iter().map(|s| s.as_str()).collect();
|
||||||
|
run_command(&app_bin.to_string_lossy(), &extra_args).expect("failed to open app");
|
||||||
|
} else {
|
||||||
|
eprintln!("Binary built and placed at {}", app_bin.to_string_lossy());
|
||||||
|
eprintln!("Bundling for Linux is not yet implemented.");
|
||||||
|
eprintln!("You can still start the app with the `open` subcommand. `cargo run -p graphite-desktop-bundle -- open`");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
use std::error::Error;
|
||||||
|
use std::fs;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use crate::common::*;
|
||||||
|
|
||||||
|
const APP_ID: &str = "art.graphite.Graphite";
|
||||||
|
|
||||||
|
const ICONS_FILE_NAME: &str = "graphite.icns";
|
||||||
|
|
||||||
|
const EXEC_PATH: &str = "Contents/MacOS";
|
||||||
|
const FRAMEWORKS_PATH: &str = "Contents/Frameworks";
|
||||||
|
const RESOURCES_PATH: &str = "Contents/Resources";
|
||||||
|
const CEF_FRAMEWORK: &str = "Chromium Embedded Framework.framework";
|
||||||
|
const GRAPHITE_DOCUMENT_TYPE: &str = "art.graphite.document";
|
||||||
|
const GRAPHITE_FILE_EXTENSION: &str = "graphite";
|
||||||
|
const GRAPHITE_MIME_TYPE: &str = "application/graphite+json";
|
||||||
|
|
||||||
|
pub fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
let app_bin = build_bin("graphite-desktop-platform-mac", None, Some("main"))?;
|
||||||
|
let helper_bin = build_bin("graphite-desktop-platform-mac", Some("helper"), Some("helper"))?;
|
||||||
|
|
||||||
|
let profile_path = profile_path();
|
||||||
|
let app_dir = bundle(&profile_path, &app_bin, &helper_bin);
|
||||||
|
|
||||||
|
// TODO: Consider adding more useful cli
|
||||||
|
let args: Vec<String> = std::env::args().collect();
|
||||||
|
if let Some(pos) = args.iter().position(|a| a == "open") {
|
||||||
|
let executable = app_dir.join(EXEC_PATH).join(APP_NAME);
|
||||||
|
let extra_args: Vec<&str> = args[pos + 1..].iter().map(|s| s.as_str()).collect();
|
||||||
|
run_command(&executable.to_string_lossy(), &extra_args).expect("failed to open app");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bundle(out_dir: &Path, app_bin: &Path, helper_bin: &Path) -> PathBuf {
|
||||||
|
let app_dir = out_dir.join(APP_NAME).with_extension("app");
|
||||||
|
|
||||||
|
clean_dir(&app_dir);
|
||||||
|
|
||||||
|
create_app(&app_dir, APP_ID, APP_NAME, app_bin, false);
|
||||||
|
|
||||||
|
for helper_type in [None, Some("GPU"), Some("Renderer")] {
|
||||||
|
let helper_id_suffix = helper_type.map(|t| format!(".{t}")).unwrap_or_default();
|
||||||
|
let helper_id = format!("{APP_ID}.helper{helper_id_suffix}");
|
||||||
|
let helper_name_suffix = helper_type.map(|t| format!(" ({t})")).unwrap_or_default();
|
||||||
|
let helper_name = format!("{APP_NAME} Helper{helper_name_suffix}");
|
||||||
|
let helper_app_dir = app_dir.join(FRAMEWORKS_PATH).join(&helper_name).with_extension("app");
|
||||||
|
create_app(&helper_app_dir, &helper_id, &helper_name, helper_bin, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_dir(&cef_path().join(CEF_FRAMEWORK), &app_dir.join(FRAMEWORKS_PATH).join(CEF_FRAMEWORK));
|
||||||
|
|
||||||
|
let resource_dir = app_dir.join(RESOURCES_PATH);
|
||||||
|
fs::create_dir_all(&resource_dir).expect("failed to create app resource dir");
|
||||||
|
|
||||||
|
let icon_file = workspace_path().join("branding/app-icons").join(ICONS_FILE_NAME);
|
||||||
|
fs::copy(icon_file, resource_dir.join(ICONS_FILE_NAME)).expect("failed to copy icon file");
|
||||||
|
|
||||||
|
app_dir
|
||||||
|
}
|
||||||
|
|
||||||
|
fn create_app(app_dir: &Path, id: &str, name: &str, bin: &Path, is_helper: bool) {
|
||||||
|
fs::create_dir_all(app_dir.join(EXEC_PATH)).unwrap();
|
||||||
|
|
||||||
|
let app_contents_dir: &Path = &app_dir.join("Contents");
|
||||||
|
create_info_plist(app_contents_dir, id, name, is_helper).unwrap();
|
||||||
|
fs::copy(bin, app_dir.join(EXEC_PATH).join(name)).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn create_info_plist(dir: &Path, id: &str, exec_name: &str, is_helper: bool) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let info = InfoPlist {
|
||||||
|
cf_bundle_name: exec_name.to_string(),
|
||||||
|
cf_bundle_identifier: id.to_string(),
|
||||||
|
cf_bundle_display_name: exec_name.to_string(),
|
||||||
|
cf_bundle_executable: exec_name.to_string(),
|
||||||
|
cf_bundle_icon_file: if is_helper { None } else { Some(ICONS_FILE_NAME.to_string()) },
|
||||||
|
cf_bundle_info_dictionary_version: "6.0".to_string(),
|
||||||
|
cf_bundle_package_type: "APPL".to_string(),
|
||||||
|
cf_bundle_signature: "????".to_string(),
|
||||||
|
cf_bundle_version: "0.0.0".to_string(),
|
||||||
|
cf_bundle_short_version_string: "0.0".to_string(),
|
||||||
|
cf_bundle_development_region: "en".to_string(),
|
||||||
|
ls_environment: [("MallocNanoZone".to_string(), "0".to_string())].iter().cloned().collect(),
|
||||||
|
ls_file_quarantine_enabled: true,
|
||||||
|
ls_minimum_system_version: "11.0".to_string(),
|
||||||
|
ls_ui_element: if is_helper { Some("1".to_string()) } else { None },
|
||||||
|
ns_supports_automatic_graphics_switching: true,
|
||||||
|
cf_bundle_document_types: (!is_helper).then(document_types),
|
||||||
|
ut_exported_type_declarations: (!is_helper).then(exported_type_declarations),
|
||||||
|
};
|
||||||
|
|
||||||
|
let plist_file = dir.join("Info.plist");
|
||||||
|
plist::to_file_xml(plist_file, &info)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn document_types() -> Vec<DocumentType> {
|
||||||
|
vec![
|
||||||
|
DocumentType {
|
||||||
|
cf_bundle_type_name: "Graphite Document".to_string(),
|
||||||
|
cf_bundle_type_role: "Editor".to_string(),
|
||||||
|
cf_bundle_type_extensions: Some(vec![GRAPHITE_FILE_EXTENSION.to_string()]),
|
||||||
|
cf_bundle_type_icon_file: Some(ICONS_FILE_NAME.to_string()),
|
||||||
|
ls_handler_rank: Some("Owner".to_string()),
|
||||||
|
ls_item_content_types: vec![GRAPHITE_DOCUMENT_TYPE.to_string()],
|
||||||
|
},
|
||||||
|
DocumentType {
|
||||||
|
cf_bundle_type_name: "SVG Image".to_string(),
|
||||||
|
cf_bundle_type_role: "Editor".to_string(),
|
||||||
|
cf_bundle_type_extensions: Some(vec!["svg".to_string()]),
|
||||||
|
cf_bundle_type_icon_file: None,
|
||||||
|
ls_handler_rank: Some("Alternate".to_string()),
|
||||||
|
ls_item_content_types: vec!["public.svg-image".to_string()],
|
||||||
|
},
|
||||||
|
DocumentType {
|
||||||
|
cf_bundle_type_name: "Image".to_string(),
|
||||||
|
cf_bundle_type_role: "Editor".to_string(),
|
||||||
|
cf_bundle_type_extensions: None,
|
||||||
|
cf_bundle_type_icon_file: None,
|
||||||
|
ls_handler_rank: Some("Alternate".to_string()),
|
||||||
|
ls_item_content_types: vec!["public.image".to_string()],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exported_type_declarations() -> Vec<ExportedTypeDeclaration> {
|
||||||
|
vec![ExportedTypeDeclaration {
|
||||||
|
ut_type_identifier: GRAPHITE_DOCUMENT_TYPE.to_string(),
|
||||||
|
ut_type_description: "Graphite Document".to_string(),
|
||||||
|
ut_type_conforms_to: vec!["public.json".to_string()],
|
||||||
|
ut_type_tag_specification: TypeTagSpecification {
|
||||||
|
public_filename_extension: vec![GRAPHITE_FILE_EXTENSION.to_string()],
|
||||||
|
public_mime_type: GRAPHITE_MIME_TYPE.to_string(),
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize)]
|
||||||
|
struct InfoPlist {
|
||||||
|
#[serde(rename = "CFBundleName")]
|
||||||
|
cf_bundle_name: String,
|
||||||
|
#[serde(rename = "CFBundleIdentifier")]
|
||||||
|
cf_bundle_identifier: String,
|
||||||
|
#[serde(rename = "CFBundleDisplayName")]
|
||||||
|
cf_bundle_display_name: String,
|
||||||
|
#[serde(rename = "CFBundleExecutable")]
|
||||||
|
cf_bundle_executable: String,
|
||||||
|
#[serde(rename = "CFBundleIconFile")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
cf_bundle_icon_file: Option<String>,
|
||||||
|
#[serde(rename = "CFBundleInfoDictionaryVersion")]
|
||||||
|
cf_bundle_info_dictionary_version: String,
|
||||||
|
#[serde(rename = "CFBundlePackageType")]
|
||||||
|
cf_bundle_package_type: String,
|
||||||
|
#[serde(rename = "CFBundleSignature")]
|
||||||
|
cf_bundle_signature: String,
|
||||||
|
#[serde(rename = "CFBundleVersion")]
|
||||||
|
cf_bundle_version: String,
|
||||||
|
#[serde(rename = "CFBundleShortVersionString")]
|
||||||
|
cf_bundle_short_version_string: String,
|
||||||
|
#[serde(rename = "CFBundleDevelopmentRegion")]
|
||||||
|
cf_bundle_development_region: String,
|
||||||
|
#[serde(rename = "LSEnvironment")]
|
||||||
|
ls_environment: HashMap<String, String>,
|
||||||
|
#[serde(rename = "LSFileQuarantineEnabled")]
|
||||||
|
ls_file_quarantine_enabled: bool,
|
||||||
|
#[serde(rename = "LSMinimumSystemVersion")]
|
||||||
|
ls_minimum_system_version: String,
|
||||||
|
#[serde(rename = "LSUIElement")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
ls_ui_element: Option<String>,
|
||||||
|
#[serde(rename = "NSSupportsAutomaticGraphicsSwitching")]
|
||||||
|
ns_supports_automatic_graphics_switching: bool,
|
||||||
|
#[serde(rename = "CFBundleDocumentTypes")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
cf_bundle_document_types: Option<Vec<DocumentType>>,
|
||||||
|
#[serde(rename = "UTExportedTypeDeclarations")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
ut_exported_type_declarations: Option<Vec<ExportedTypeDeclaration>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize)]
|
||||||
|
struct DocumentType {
|
||||||
|
#[serde(rename = "CFBundleTypeName")]
|
||||||
|
cf_bundle_type_name: String,
|
||||||
|
#[serde(rename = "CFBundleTypeRole")]
|
||||||
|
cf_bundle_type_role: String,
|
||||||
|
#[serde(rename = "CFBundleTypeExtensions")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
cf_bundle_type_extensions: Option<Vec<String>>,
|
||||||
|
#[serde(rename = "CFBundleTypeIconFile")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
cf_bundle_type_icon_file: Option<String>,
|
||||||
|
#[serde(rename = "LSHandlerRank")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
ls_handler_rank: Option<String>,
|
||||||
|
#[serde(rename = "LSItemContentTypes")]
|
||||||
|
ls_item_content_types: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize)]
|
||||||
|
struct ExportedTypeDeclaration {
|
||||||
|
#[serde(rename = "UTTypeIdentifier")]
|
||||||
|
ut_type_identifier: String,
|
||||||
|
#[serde(rename = "UTTypeDescription")]
|
||||||
|
ut_type_description: String,
|
||||||
|
#[serde(rename = "UTTypeConformsTo")]
|
||||||
|
ut_type_conforms_to: Vec<String>,
|
||||||
|
#[serde(rename = "UTTypeTagSpecification")]
|
||||||
|
ut_type_tag_specification: TypeTagSpecification,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize)]
|
||||||
|
struct TypeTagSpecification {
|
||||||
|
#[serde(rename = "public.filename-extension")]
|
||||||
|
public_filename_extension: Vec<String>,
|
||||||
|
#[serde(rename = "public.mime-type")]
|
||||||
|
public_mime_type: String,
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
mod common;
|
||||||
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
mod linux;
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
mod mac;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
mod win;
|
||||||
|
|
||||||
|
// Avoid incorrect warnings about an unused dependency (this crate sets `DEP_CEF_DLL_WRAPPER_CEF_DIR` which is used in `build.rs`)
|
||||||
|
use cef_dll_sys as _;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
linux::main().unwrap();
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
mac::main().unwrap();
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
win::main().unwrap();
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
use std::error::Error;
|
||||||
|
use std::fs;
|
||||||
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
|
use crate::common::*;
|
||||||
|
|
||||||
|
const EXECUTABLE: &str = "Graphite.exe";
|
||||||
|
|
||||||
|
pub fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
let app_bin = build_bin("graphite-desktop-platform-win", None, None)?;
|
||||||
|
|
||||||
|
let executable = bundle(&profile_path(), &app_bin);
|
||||||
|
|
||||||
|
// TODO: Consider adding more useful cli
|
||||||
|
let args: Vec<String> = std::env::args().collect();
|
||||||
|
if let Some(pos) = args.iter().position(|a| a == "open") {
|
||||||
|
let extra_args: Vec<&str> = args[pos + 1..].iter().map(|s| s.as_str()).collect();
|
||||||
|
run_command(&executable.to_string_lossy(), &extra_args).expect("failed to open app")
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bundle(out_dir: &Path, app_bin: &Path) -> PathBuf {
|
||||||
|
let app_dir = out_dir.join(APP_NAME);
|
||||||
|
|
||||||
|
clean_dir(&app_dir);
|
||||||
|
|
||||||
|
copy_dir(&cef_path(), &app_dir);
|
||||||
|
|
||||||
|
if let Err(e) = remove_unnecessary_cef_files(&app_dir) {
|
||||||
|
eprintln!("Failed to remove unnecessary CEF files: {}", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
let bin_path = app_dir.join(EXECUTABLE);
|
||||||
|
fs::copy(app_bin, &bin_path).unwrap();
|
||||||
|
|
||||||
|
bin_path
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remove_unnecessary_cef_files(app_dir: &Path) -> Result<(), Box<dyn Error>> {
|
||||||
|
fs::remove_dir_all(app_dir.join("cmake"))?;
|
||||||
|
fs::remove_dir_all(app_dir.join("include"))?;
|
||||||
|
fs::remove_dir_all(app_dir.join("libcef_dll"))?;
|
||||||
|
|
||||||
|
for entry in fs::read_dir(app_dir.join("locales"))? {
|
||||||
|
let path = entry?.path();
|
||||||
|
if path.is_file() && path.file_name() != Some("en-US.pak".as_ref()) {
|
||||||
|
fs::remove_file(path)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fs::remove_file(app_dir.join("archive.json"))?;
|
||||||
|
fs::remove_file(app_dir.join("CMakeLists.txt"))?;
|
||||||
|
fs::remove_file(app_dir.join("bootstrapc.exe"))?;
|
||||||
|
fs::remove_file(app_dir.join("bootstrap.exe"))?;
|
||||||
|
fs::remove_file(app_dir.join("libcef.lib"))?;
|
||||||
|
fs::remove_file(app_dir.join("CREDITS.html"))?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-desktop-embedded-resources"
|
name = "graphite-desktop-embedded-resources"
|
||||||
version = "0.1.0"
|
|
||||||
description = "Graphite Desktop Embedded Resources"
|
description = "Graphite Desktop Embedded Resources"
|
||||||
authors = ["Graphite Authors <[email protected]>"]
|
version.workspace = true
|
||||||
license = "Apache-2.0"
|
license.workspace = true
|
||||||
repository = ""
|
authors.workspace = true
|
||||||
edition = "2024"
|
edition.workspace = true
|
||||||
rust-version = "1.87"
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
include_dir = { workspace = true }
|
include_dir = { workspace = true }
|
||||||
|
|||||||
@@ -1,16 +1,31 @@
|
|||||||
const RESOURCES: &str = "../../frontend/dist";
|
const EMBEDDED_RESOURCES_ENV: &str = "EMBEDDED_RESOURCES";
|
||||||
|
const DEFAULT_RESOURCES_DIR: &str = "../../frontend/dist";
|
||||||
|
|
||||||
// Check if the directory `RESOURCES` exists and sets the embedded_resources cfg accordingly
|
|
||||||
// Absolute path of `RESOURCES` available via the `EMBEDDED_RESOURCES` environment variable
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let crate_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
let mut embedded_resources: Option<String> = None;
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={RESOURCES}");
|
println!("cargo:rerun-if-env-changed={EMBEDDED_RESOURCES_ENV}");
|
||||||
if let Ok(resources) = crate_dir.join(RESOURCES).canonicalize()
|
if let Ok(embedded_resources_env) = std::env::var(EMBEDDED_RESOURCES_ENV)
|
||||||
|
&& std::path::PathBuf::from(&embedded_resources_env).exists()
|
||||||
|
{
|
||||||
|
embedded_resources = Some(embedded_resources_env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if embedded_resources.is_none() {
|
||||||
|
// Check if the directory `DEFAULT_RESOURCES_DIR` exists and sets the embedded_resources cfg accordingly
|
||||||
|
// Absolute path of `DEFAULT_RESOURCES_DIR` available via the `EMBEDDED_RESOURCES` environment variable
|
||||||
|
let crate_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||||
|
println!("cargo:rerun-if-changed={DEFAULT_RESOURCES_DIR}");
|
||||||
|
if let Ok(resources) = crate_dir.join(DEFAULT_RESOURCES_DIR).canonicalize()
|
||||||
&& resources.exists()
|
&& resources.exists()
|
||||||
{
|
{
|
||||||
|
embedded_resources = Some(resources.to_string_lossy().to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(embedded_resources) = embedded_resources {
|
||||||
println!("cargo:rustc-cfg=embedded_resources");
|
println!("cargo:rustc-cfg=embedded_resources");
|
||||||
println!("cargo:rustc-env=EMBEDDED_RESOURCES={}", resources.to_string_lossy());
|
println!("cargo:rustc-env={EMBEDDED_RESOURCES_ENV}={embedded_resources}");
|
||||||
} else {
|
} else {
|
||||||
println!("cargo:warning=Resource directory does not exist. Resources will not be embedded. Did you forget to build the frontend?");
|
println!("cargo:warning=Resource directory does not exist. Resources will not be embedded. Did you forget to build the frontend?");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
[package]
|
||||||
|
name = "graphite-desktop-platform-linux"
|
||||||
|
description = "Graphite Desktop Platform Linux"
|
||||||
|
version.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "graphite"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
graphite-desktop = { path = "../.." }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() -> std::process::ExitCode {
|
||||||
|
graphite_desktop::start()
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
[package]
|
||||||
|
name = "graphite-desktop-platform-mac"
|
||||||
|
description = "Graphite Desktop Platform Mac"
|
||||||
|
version.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[features]
|
||||||
|
main = ["dep:graphite-desktop"]
|
||||||
|
helper = ["dep:graphite-desktop-ui"]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "graphite"
|
||||||
|
path = "src/main.rs"
|
||||||
|
required-features = ["main"]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "helper"
|
||||||
|
path = "src/helper.rs"
|
||||||
|
required-features = ["helper"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
graphite-desktop = { path = "../..", optional = true }
|
||||||
|
graphite-desktop-ui = { path = "../../ui", optional = true }
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() -> std::process::ExitCode {
|
||||||
|
graphite_desktop_ui::run_helper()
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fn main() -> std::process::ExitCode {
|
||||||
|
graphite_desktop::start()
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
[package]
|
||||||
|
name = "graphite-desktop-platform-win"
|
||||||
|
description = "Graphite Desktop Platform Windows"
|
||||||
|
version.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "graphite"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
graphite-desktop = { path = "../.." }
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "windows")'.build-dependencies]
|
||||||
|
winres = "0.1"
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
fn main() {
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
{
|
||||||
|
let mut res = winres::WindowsResource::new();
|
||||||
|
|
||||||
|
res.set_icon("../../../branding/app-icons/graphite.ico");
|
||||||
|
|
||||||
|
res.set_language(0x0409); // English (US)
|
||||||
|
|
||||||
|
// TODO: Replace with actual version
|
||||||
|
res.set_version_info(winres::VersionInfo::FILEVERSION, {
|
||||||
|
const MAJOR: u64 = 0;
|
||||||
|
const MINOR: u64 = 0;
|
||||||
|
const PATCH: u64 = 0;
|
||||||
|
const RELEASE: u64 = 0;
|
||||||
|
(MAJOR << 48) | (MINOR << 32) | (PATCH << 16) | RELEASE
|
||||||
|
});
|
||||||
|
res.set("FileVersion", "0.0.0.0");
|
||||||
|
res.set("ProductVersion", "0.0.0.0");
|
||||||
|
|
||||||
|
res.set("OriginalFilename", "Graphite.exe");
|
||||||
|
|
||||||
|
res.set("FileDescription", "Graphite");
|
||||||
|
res.set("ProductName", "Graphite");
|
||||||
|
|
||||||
|
// TODO: Pull this year from the Git commit date
|
||||||
|
res.set("LegalCopyright", "Copyright © 2026 Graphite Labs, LLC");
|
||||||
|
res.set("CompanyName", "Graphite Labs, LLC");
|
||||||
|
|
||||||
|
res.compile().expect("Failed to compile Windows resources");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#![windows_subsystem = "windows"]
|
||||||
|
fn main() -> std::process::ExitCode {
|
||||||
|
graphite_desktop::start()
|
||||||
|
}
|
||||||
+512
-198
@@ -1,88 +1,208 @@
|
|||||||
|
use rand::Rng;
|
||||||
use rfd::AsyncFileDialog;
|
use rfd::AsyncFileDialog;
|
||||||
|
use std::fs;
|
||||||
|
use std::io::Read;
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::mpsc::Receiver;
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::{Receiver, SyncSender};
|
||||||
use std::sync::mpsc::SyncSender;
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::{Duration, Instant};
|
||||||
use std::time::Instant;
|
|
||||||
use winit::application::ApplicationHandler;
|
use winit::application::ApplicationHandler;
|
||||||
use winit::event::WindowEvent;
|
use winit::data_transfer::{DataTransferSendBuilder, TypeHint};
|
||||||
use winit::event_loop::ActiveEventLoop;
|
use winit::dpi::PhysicalSize;
|
||||||
use winit::event_loop::ControlFlow;
|
use winit::event::{ElementState, MouseButton, StartCause, WindowEvent};
|
||||||
use winit::window::Window;
|
use winit::event_loop::run_on_demand::EventLoopExtRunOnDemand;
|
||||||
|
use winit::event_loop::{ActiveEventLoop, AsyncRequestSerial, ControlFlow, DndAction, EventLoop};
|
||||||
use winit::window::WindowId;
|
use winit::window::WindowId;
|
||||||
|
|
||||||
use crate::cef;
|
use crate::dirs;
|
||||||
use crate::consts::CEF_MESSAGE_LOOP_MAX_ITERATIONS;
|
|
||||||
use crate::event::{AppEvent, AppEventScheduler};
|
use crate::event::{AppEvent, AppEventScheduler};
|
||||||
use crate::native_window;
|
use crate::input::InputState;
|
||||||
use crate::persist::PersistentData;
|
use crate::persist;
|
||||||
use crate::render::GraphicsState;
|
use crate::preferences;
|
||||||
use graphite_desktop_wrapper::messages::{DesktopFrontendMessage, DesktopWrapperMessage, Platform};
|
use crate::render::{RenderError, RenderState};
|
||||||
use graphite_desktop_wrapper::{DesktopWrapper, NodeGraphExecutionResult, WgpuContext, serialize_frontend_messages};
|
use crate::ui::{InputEvent, UiCommand, UiInstance};
|
||||||
|
use crate::window::Window;
|
||||||
|
use crate::wrapper::messages::{DesktopFrontendMessage, DesktopWrapperMessage, IngestAction, Preferences};
|
||||||
|
use crate::wrapper::{DesktopWrapper, FolderStore, MmapResourceStorage, NodeGraphExecutionResult, WgpuContext, serialize_frontend_messages};
|
||||||
|
|
||||||
pub(crate) struct App {
|
pub(crate) struct App {
|
||||||
cef_context: Box<dyn cef::CefContext>,
|
render_state: Option<RenderState>,
|
||||||
window: Option<Arc<dyn Window>>,
|
|
||||||
native_window: native_window::NativeWindowHandle,
|
|
||||||
cef_schedule: Option<Instant>,
|
|
||||||
cef_window_size_sender: Sender<cef::WindowSize>,
|
|
||||||
graphics_state: Option<GraphicsState>,
|
|
||||||
wgpu_context: WgpuContext,
|
wgpu_context: WgpuContext,
|
||||||
|
window: Option<Window>,
|
||||||
|
window_scale: f64,
|
||||||
|
window_size: PhysicalSize<u32>,
|
||||||
|
window_maximized: bool,
|
||||||
|
window_fullscreen: bool,
|
||||||
|
window_pending_drag: bool,
|
||||||
|
pending_dnd_fetch: Option<AsyncRequestSerial>,
|
||||||
|
pending_clipboard_fetch: Option<AsyncRequestSerial>,
|
||||||
|
input_state: InputState,
|
||||||
|
ui_scale: f64,
|
||||||
app_event_receiver: Receiver<AppEvent>,
|
app_event_receiver: Receiver<AppEvent>,
|
||||||
app_event_scheduler: AppEventScheduler,
|
app_event_scheduler: AppEventScheduler,
|
||||||
desktop_wrapper: DesktopWrapper,
|
desktop_wrapper: DesktopWrapper,
|
||||||
last_ui_update: Instant,
|
ui: UiInstance,
|
||||||
avg_frame_time: f32,
|
ui_frame_received: bool,
|
||||||
start_render_sender: SyncSender<()>,
|
start_render_sender: SyncSender<()>,
|
||||||
web_communication_initialized: bool,
|
web_communication_initialized: bool,
|
||||||
web_communication_startup_buffer: Vec<Vec<u8>>,
|
web_communication_startup_buffer: Vec<Vec<u8>>,
|
||||||
persistent_data: PersistentData,
|
preferences: Preferences,
|
||||||
|
launch_documents: Option<Vec<PathBuf>>,
|
||||||
|
startup_time: Option<Instant>,
|
||||||
|
exiting: Arc<AtomicBool>,
|
||||||
|
exit_reason: ExitReason,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
|
pub(crate) fn init() {
|
||||||
|
Window::init();
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
cef_context: Box<dyn cef::CefContext>,
|
ui: UiInstance,
|
||||||
window_size_sender: Sender<cef::WindowSize>,
|
|
||||||
wgpu_context: WgpuContext,
|
wgpu_context: WgpuContext,
|
||||||
app_event_receiver: Receiver<AppEvent>,
|
app_event_receiver: Receiver<AppEvent>,
|
||||||
app_event_scheduler: AppEventScheduler,
|
app_event_scheduler: AppEventScheduler,
|
||||||
|
preferences: Preferences,
|
||||||
|
launch_documents: Vec<PathBuf>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let ctrlc_app_event_scheduler = app_event_scheduler.clone();
|
||||||
|
ctrlc::set_handler(move || {
|
||||||
|
tracing::info!("Termination signal received, exiting...");
|
||||||
|
ctrlc_app_event_scheduler.schedule(AppEvent::Exit);
|
||||||
|
})
|
||||||
|
.expect("Error setting Ctrl-C handler");
|
||||||
|
|
||||||
|
let exiting = Arc::new(AtomicBool::new(false));
|
||||||
|
|
||||||
let rendering_app_event_scheduler = app_event_scheduler.clone();
|
let rendering_app_event_scheduler = app_event_scheduler.clone();
|
||||||
let (start_render_sender, start_render_receiver) = std::sync::mpsc::sync_channel(1);
|
let (start_render_sender, start_render_receiver) = std::sync::mpsc::sync_channel(1);
|
||||||
|
let exiting_clone = exiting.clone();
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
|
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||||
loop {
|
loop {
|
||||||
let result = futures::executor::block_on(DesktopWrapper::execute_node_graph());
|
let result = runtime.block_on(DesktopWrapper::execute_node_graph());
|
||||||
rendering_app_event_scheduler.schedule(AppEvent::NodeGraphExecutionResult(result));
|
rendering_app_event_scheduler.schedule(AppEvent::NodeGraphExecutionResult(result));
|
||||||
let _ = start_render_receiver.recv();
|
let _ = start_render_receiver.recv_timeout(Duration::from_millis(10));
|
||||||
|
if exiting_clone.load(Ordering::Relaxed) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut persistent_data = PersistentData::default();
|
let resource_storage = MmapResourceStorage::new(dirs::app_resources_dir()).expect("Failed to initialize on-disk resource storage");
|
||||||
persistent_data.load_from_disk();
|
|
||||||
|
// Wake the winit event loop when an editor future completes.
|
||||||
|
let wake_scheduler = app_event_scheduler.clone();
|
||||||
|
let wake = Arc::new(move || {
|
||||||
|
wake_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::Wake));
|
||||||
|
});
|
||||||
|
let desktop_wrapper = DesktopWrapper::new(
|
||||||
|
rand::rng().random(),
|
||||||
|
Arc::new(resource_storage),
|
||||||
|
Arc::new(FolderStore::new(dirs::app_autosave_documents_dir())),
|
||||||
|
wgpu_context.clone(),
|
||||||
|
wake,
|
||||||
|
);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
cef_context,
|
render_state: None,
|
||||||
window: None,
|
|
||||||
cef_schedule: Some(Instant::now()),
|
|
||||||
graphics_state: None,
|
|
||||||
cef_window_size_sender: window_size_sender,
|
|
||||||
wgpu_context,
|
wgpu_context,
|
||||||
|
window: None,
|
||||||
|
window_scale: 1.,
|
||||||
|
window_size: PhysicalSize { width: 0, height: 0 },
|
||||||
|
window_maximized: false,
|
||||||
|
window_fullscreen: false,
|
||||||
|
window_pending_drag: false,
|
||||||
|
pending_dnd_fetch: None,
|
||||||
|
pending_clipboard_fetch: None,
|
||||||
|
input_state: InputState::new(),
|
||||||
|
ui_scale: 1.,
|
||||||
app_event_receiver,
|
app_event_receiver,
|
||||||
app_event_scheduler,
|
app_event_scheduler,
|
||||||
desktop_wrapper: DesktopWrapper::new(),
|
desktop_wrapper,
|
||||||
last_ui_update: Instant::now(),
|
ui,
|
||||||
avg_frame_time: 0.,
|
ui_frame_received: false,
|
||||||
start_render_sender,
|
start_render_sender,
|
||||||
web_communication_initialized: false,
|
web_communication_initialized: false,
|
||||||
web_communication_startup_buffer: Vec::new(),
|
web_communication_startup_buffer: Vec::new(),
|
||||||
persistent_data,
|
preferences,
|
||||||
native_window: Default::default(),
|
launch_documents: Some(launch_documents),
|
||||||
|
startup_time: None,
|
||||||
|
exiting,
|
||||||
|
exit_reason: ExitReason::Shutdown,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_desktop_frontend_message(&mut self, message: DesktopFrontendMessage) {
|
pub(crate) fn run(mut self, mut event_loop: EventLoop) -> ExitReason {
|
||||||
|
event_loop.run_app_on_demand(&mut self).unwrap();
|
||||||
|
self.exit_reason
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exit(&mut self, reason: Option<ExitReason>) {
|
||||||
|
if self.exiting.swap(true, Ordering::Relaxed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let _ = self.start_render_sender.send(());
|
||||||
|
if let Some(reason) = reason {
|
||||||
|
self.exit_reason = reason;
|
||||||
|
}
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::Exit);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn resize(&mut self) {
|
||||||
|
let Some(window) = &self.window else {
|
||||||
|
tracing::error!("Resize failed due to missing window");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
let maximized = window.is_maximized();
|
||||||
|
if maximized != self.window_maximized {
|
||||||
|
self.window_maximized = maximized;
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::UpdateMaximized { maximized }));
|
||||||
|
}
|
||||||
|
|
||||||
|
let fullscreen = window.is_fullscreen();
|
||||||
|
if fullscreen != self.window_fullscreen {
|
||||||
|
self.window_fullscreen = fullscreen;
|
||||||
|
self.app_event_scheduler
|
||||||
|
.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::UpdateFullscreen { fullscreen }));
|
||||||
|
}
|
||||||
|
|
||||||
|
let size = window.surface_size();
|
||||||
|
let scale = window.scale_factor() * self.ui_scale;
|
||||||
|
let is_new_size = size != self.window_size;
|
||||||
|
let is_new_scale = scale != self.window_scale;
|
||||||
|
|
||||||
|
if !is_new_size && !is_new_scale {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_new_size {
|
||||||
|
self.ui.send(UiCommand::Resized {
|
||||||
|
width: size.width,
|
||||||
|
height: size.height,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if is_new_scale {
|
||||||
|
self.ui.send(UiCommand::ScaleChanged(scale));
|
||||||
|
}
|
||||||
|
|
||||||
|
self.ui.send(UiCommand::Refresh);
|
||||||
|
|
||||||
|
if let Some(render_state) = &mut self.render_state {
|
||||||
|
render_state.resize(size.width, size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.request_redraw();
|
||||||
|
|
||||||
|
self.window_size = size;
|
||||||
|
self.window_scale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_desktop_frontend_message(&mut self, message: DesktopFrontendMessage, responses: &mut Vec<DesktopWrapperMessage>) {
|
||||||
match message {
|
match message {
|
||||||
DesktopFrontendMessage::ToWeb(messages) => {
|
DesktopFrontendMessage::ToWeb(messages) => {
|
||||||
let Some(bytes) = serialize_frontend_messages(messages) else {
|
let Some(bytes) = serialize_frontend_messages(messages) else {
|
||||||
@@ -91,22 +211,31 @@ impl App {
|
|||||||
};
|
};
|
||||||
self.send_or_queue_web_message(bytes);
|
self.send_or_queue_web_message(bytes);
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::OpenFileDialog { title, filters, context } => {
|
DesktopFrontendMessage::OpenFileDialog { title, options, action } => {
|
||||||
let app_event_scheduler = self.app_event_scheduler.clone();
|
let app_event_scheduler = self.app_event_scheduler.clone();
|
||||||
let _ = thread::spawn(move || {
|
let _ = thread::spawn(move || {
|
||||||
let mut dialog = AsyncFileDialog::new().set_title(title);
|
let mut dialog = AsyncFileDialog::new().set_title(title);
|
||||||
for filter in filters {
|
for filter in options.filters {
|
||||||
dialog = dialog.add_filter(filter.name, &filter.extensions);
|
dialog = dialog.add_filter(filter.name, &filter.extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
let show_dialog = async move { dialog.pick_file().await.map(|f| f.path().to_path_buf()) };
|
let handles = if options.multiple {
|
||||||
|
futures::executor::block_on(dialog.pick_files()).unwrap_or_default()
|
||||||
|
} else {
|
||||||
|
futures::executor::block_on(dialog.pick_file()).into_iter().collect()
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(path) = futures::executor::block_on(show_dialog)
|
for handle in handles {
|
||||||
&& let Ok(content) = std::fs::read(&path)
|
let path = handle.path().to_path_buf();
|
||||||
{
|
match fs::read(&path) {
|
||||||
let message = DesktopWrapperMessage::OpenFileDialogResult { path, content, context };
|
Ok(content) => {
|
||||||
|
let action = action.clone();
|
||||||
|
let message = DesktopWrapperMessage::IngestFile { path, content, action };
|
||||||
app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
}
|
}
|
||||||
|
Err(e) => tracing::error!("Failed to read file {}: {}", path.display(), e),
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::SaveFileDialog {
|
DesktopFrontendMessage::SaveFileDialog {
|
||||||
@@ -135,7 +264,7 @@ impl App {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::WriteFile { path, content } => {
|
DesktopFrontendMessage::WriteFile { path, content } => {
|
||||||
if let Err(e) = std::fs::write(&path, content) {
|
if let Err(e) = fs::write(&path, content) {
|
||||||
tracing::error!("Failed to write file {}: {}", path.display(), e);
|
tracing::error!("Failed to write file {}: {}", path.display(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,102 +275,142 @@ impl App {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::UpdateViewportBounds { x, y, width, height } => {
|
DesktopFrontendMessage::UpdateViewportPhysicalBounds { x, y, width, height } => {
|
||||||
if let Some(graphics_state) = &mut self.graphics_state
|
self.input_state.set_viewport_info(x, y, width, height, self.window_scale);
|
||||||
|
|
||||||
|
if let Some(render_state) = &mut self.render_state
|
||||||
&& let Some(window) = &self.window
|
&& let Some(window) = &self.window
|
||||||
{
|
{
|
||||||
let window_size = window.surface_size();
|
let window_size = window.surface_size();
|
||||||
|
|
||||||
let viewport_offset_x = x / window_size.width as f32;
|
let viewport_offset_x = x / window_size.width as f64;
|
||||||
let viewport_offset_y = y / window_size.height as f32;
|
let viewport_offset_y = y / window_size.height as f64;
|
||||||
graphics_state.set_viewport_offset([viewport_offset_x, viewport_offset_y]);
|
render_state.set_viewport_offset([viewport_offset_x as f32, viewport_offset_y as f32]);
|
||||||
|
|
||||||
let viewport_scale_x = if width != 0.0 { window_size.width as f32 / width } else { 1.0 };
|
let viewport_scale_x = if width != 0. { window_size.width as f64 / width } else { 1. };
|
||||||
let viewport_scale_y = if height != 0.0 { window_size.height as f32 / height } else { 1.0 };
|
let viewport_scale_y = if height != 0. { window_size.height as f64 / height } else { 1. };
|
||||||
graphics_state.set_viewport_scale([viewport_scale_x, viewport_scale_y]);
|
render_state.set_viewport_scale([viewport_scale_x as f32, viewport_scale_y as f32]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DesktopFrontendMessage::WindowUpdateDirectInput { enabled } => {
|
||||||
|
self.input_state.set_direct_input(enabled);
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::UpdateUIScale { scale } => {
|
||||||
|
self.ui_scale = scale;
|
||||||
|
self.resize();
|
||||||
|
}
|
||||||
DesktopFrontendMessage::UpdateOverlays(scene) => {
|
DesktopFrontendMessage::UpdateOverlays(scene) => {
|
||||||
if let Some(graphics_state) = &mut self.graphics_state {
|
if let Some(render_state) = &mut self.render_state {
|
||||||
graphics_state.set_overlays_scene(scene);
|
render_state.set_overlays_scene(scene);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
DesktopFrontendMessage::UpdateWindowState { maximized, minimized } => {
|
|
||||||
if let Some(window) = &self.window {
|
if let Some(window) = &self.window {
|
||||||
window.set_maximized(maximized);
|
window.request_redraw();
|
||||||
window.set_minimized(minimized);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::DragWindow => {
|
DesktopFrontendMessage::PersistenceWriteState { state } => {
|
||||||
if let Some(window) = &self.window {
|
persist::write_state(state);
|
||||||
let _ = window.drag_window();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::CloseWindow => {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::CloseWindow);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceWriteDocument { id, document } => {
|
|
||||||
self.persistent_data.write_document(id, document);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceDeleteDocument { id } => {
|
|
||||||
self.persistent_data.delete_document(&id);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceUpdateCurrentDocument { id } => {
|
|
||||||
self.persistent_data.set_current_document(id);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceUpdateDocumentsList { ids } => {
|
|
||||||
self.persistent_data.set_document_order(ids);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceLoadCurrentDocument => {
|
|
||||||
if let Some((id, document)) = self.persistent_data.current_document() {
|
|
||||||
let message = DesktopWrapperMessage::LoadDocument {
|
|
||||||
id,
|
|
||||||
document,
|
|
||||||
to_front: false,
|
|
||||||
select_after_open: true,
|
|
||||||
};
|
|
||||||
self.dispatch_desktop_wrapper_message(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceLoadRemainingDocuments => {
|
|
||||||
for (id, document) in self.persistent_data.documents_before_current().into_iter().rev() {
|
|
||||||
let message = DesktopWrapperMessage::LoadDocument {
|
|
||||||
id,
|
|
||||||
document,
|
|
||||||
to_front: true,
|
|
||||||
select_after_open: false,
|
|
||||||
};
|
|
||||||
self.dispatch_desktop_wrapper_message(message);
|
|
||||||
}
|
|
||||||
for (id, document) in self.persistent_data.documents_after_current() {
|
|
||||||
let message = DesktopWrapperMessage::LoadDocument {
|
|
||||||
id,
|
|
||||||
document,
|
|
||||||
to_front: false,
|
|
||||||
select_after_open: false,
|
|
||||||
};
|
|
||||||
self.dispatch_desktop_wrapper_message(message);
|
|
||||||
}
|
|
||||||
if let Some(id) = self.persistent_data.current_document_id() {
|
|
||||||
let message = DesktopWrapperMessage::SelectDocument { id };
|
|
||||||
self.dispatch_desktop_wrapper_message(message);
|
|
||||||
}
|
}
|
||||||
|
DesktopFrontendMessage::PersistenceReadState => {
|
||||||
|
responses.push(DesktopWrapperMessage::LoadPersistedState { state: persist::read_state() });
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::PersistenceWritePreferences { preferences } => {
|
DesktopFrontendMessage::PersistenceWritePreferences { preferences } => {
|
||||||
self.persistent_data.write_preferences(preferences);
|
preferences::write(preferences);
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::PersistenceLoadPreferences => {
|
DesktopFrontendMessage::PersistenceLoadPreferences => {
|
||||||
if let Some(preferences) = self.persistent_data.load_preferences() {
|
let preferences = preferences::read();
|
||||||
let message = DesktopWrapperMessage::LoadPreferences { preferences };
|
let message = DesktopWrapperMessage::LoadPreferences { preferences };
|
||||||
self.dispatch_desktop_wrapper_message(message);
|
responses.push(message);
|
||||||
}
|
}
|
||||||
|
DesktopFrontendMessage::OpenLaunchDocuments => {
|
||||||
|
let Some(launch_documents) = std::mem::take(&mut self.launch_documents) else {
|
||||||
|
tracing::error!("OpenLaunchDocuments should only be sent once");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::OpenFiles(launch_documents));
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::UpdateMenu { entries } => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.update_menu(entries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::ClipboardRead => {
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::ClipboardRead);
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::ClipboardWrite { content } => {
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::ClipboardWrite { content });
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::PointerLock => {
|
||||||
|
self.input_state.lock_pointer();
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.start_pointer_lock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowClose => {
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::Exit);
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowMinimize => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.minimize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowMaximize => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.toggle_maximize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowFullscreen => {
|
||||||
|
if let Some(window) = &mut self.window {
|
||||||
|
window.toggle_fullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowDrag => {
|
||||||
|
self.window_pending_drag = true;
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowFocus => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowHide => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowHideOthers => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.hide_others();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowShowAll => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.show_all();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::Restart => {
|
||||||
|
self.exit(Some(ExitReason::Restart));
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::LoadThirdPartyLicenses => {
|
||||||
|
let compressed = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/third-party-licenses.txt.xz"));
|
||||||
|
let mut reader = lzma_rust2::XzReader::new(compressed.as_slice(), false);
|
||||||
|
let mut text = String::new();
|
||||||
|
if let Err(e) = reader.read_to_string(&mut text) {
|
||||||
|
tracing::error!("Failed to decompress third-party licenses: {e}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let message = DesktopWrapperMessage::LoadThirdPartyLicenses { text };
|
||||||
|
responses.push(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_desktop_frontend_messages(&mut self, messages: Vec<DesktopFrontendMessage>) {
|
fn handle_desktop_frontend_messages(&mut self, messages: Vec<DesktopFrontendMessage>) {
|
||||||
|
let mut responses = Vec::new();
|
||||||
for message in messages {
|
for message in messages {
|
||||||
self.handle_desktop_frontend_message(message);
|
self.handle_desktop_frontend_message(message, &mut responses);
|
||||||
|
}
|
||||||
|
for message in responses {
|
||||||
|
self.dispatch_desktop_wrapper_message(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +421,7 @@ impl App {
|
|||||||
|
|
||||||
fn send_or_queue_web_message(&mut self, message: Vec<u8>) {
|
fn send_or_queue_web_message(&mut self, message: Vec<u8>) {
|
||||||
if self.web_communication_initialized {
|
if self.web_communication_initialized {
|
||||||
self.cef_context.send_web_message(message);
|
self.ui.send(UiCommand::Message(message));
|
||||||
} else {
|
} else {
|
||||||
self.web_communication_startup_buffer.push(message);
|
self.web_communication_startup_buffer.push(message);
|
||||||
}
|
}
|
||||||
@@ -263,7 +432,7 @@ impl App {
|
|||||||
AppEvent::WebCommunicationInitialized => {
|
AppEvent::WebCommunicationInitialized => {
|
||||||
self.web_communication_initialized = true;
|
self.web_communication_initialized = true;
|
||||||
for message in self.web_communication_startup_buffer.drain(..) {
|
for message in self.web_communication_startup_buffer.drain(..) {
|
||||||
self.cef_context.send_web_message(message);
|
self.ui.send(UiCommand::Message(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppEvent::DesktopWrapperMessage(message) => self.dispatch_desktop_wrapper_message(message),
|
AppEvent::DesktopWrapperMessage(message) => self.dispatch_desktop_wrapper_message(message),
|
||||||
@@ -271,69 +440,119 @@ impl App {
|
|||||||
NodeGraphExecutionResult::HasRun(texture) => {
|
NodeGraphExecutionResult::HasRun(texture) => {
|
||||||
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::PollNodeGraphEvaluation);
|
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::PollNodeGraphEvaluation);
|
||||||
if let Some(texture) = texture
|
if let Some(texture) = texture
|
||||||
&& let Some(graphics_state) = self.graphics_state.as_mut()
|
&& let Some(render_state) = self.render_state.as_mut()
|
||||||
&& let Some(window) = self.window.as_ref()
|
&& let Some(window) = self.window.as_ref()
|
||||||
{
|
{
|
||||||
graphics_state.bind_viewport_texture(texture);
|
render_state.bind_viewport_texture(texture);
|
||||||
window.request_redraw();
|
window.request_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NodeGraphExecutionResult::NotRun => {}
|
NodeGraphExecutionResult::NotRun => {}
|
||||||
},
|
},
|
||||||
AppEvent::UiUpdate(texture) => {
|
AppEvent::UiUpdate(texture) => {
|
||||||
if let Some(graphics_state) = self.graphics_state.as_mut() {
|
if let Some(render_state) = self.render_state.as_mut() {
|
||||||
graphics_state.resize(texture.width(), texture.height());
|
render_state.bind_ui_texture(texture);
|
||||||
graphics_state.bind_ui_texture(texture);
|
|
||||||
let elapsed = self.last_ui_update.elapsed().as_secs_f32();
|
|
||||||
self.last_ui_update = Instant::now();
|
|
||||||
if elapsed < 0.5 {
|
|
||||||
self.avg_frame_time = (self.avg_frame_time * 3. + elapsed) / 4.;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if let Some(window) = &self.window {
|
if let Some(window) = &self.window {
|
||||||
window.request_redraw();
|
window.request_redraw();
|
||||||
}
|
}
|
||||||
}
|
if !self.ui_frame_received {
|
||||||
AppEvent::ScheduleBrowserWork(instant) => {
|
self.ui_frame_received = true;
|
||||||
if instant <= Instant::now() {
|
|
||||||
self.cef_context.work();
|
|
||||||
} else {
|
|
||||||
self.cef_schedule = Some(instant);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppEvent::CloseWindow => {
|
AppEvent::ClipboardRead => {
|
||||||
// TODO: Implement graceful shutdown
|
let result = event_loop.clipboard().and_then(|id| {
|
||||||
|
let Some(id) = id else { return Ok(None) };
|
||||||
|
let data_transfer = event_loop.data_transfer(id)?;
|
||||||
|
if !data_transfer.has_type(&TypeHint::Plaintext) {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
event_loop.fetch_data_transfer(id, &TypeHint::Plaintext).map(Some)
|
||||||
|
});
|
||||||
|
match result {
|
||||||
|
Ok(Some(serial)) => self.pending_clipboard_fetch = Some(serial),
|
||||||
|
Ok(None) => self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::ClipboardReadResult { content: None }),
|
||||||
|
Err(e) => {
|
||||||
|
tracing::error!("Failed to read from clipboard: {e}");
|
||||||
|
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::ClipboardReadResult { content: None });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppEvent::ClipboardWrite { content } => {
|
||||||
|
let send_data = DataTransferSendBuilder::new(content)
|
||||||
|
.with_type(TypeHint::Plaintext, |content: &String, _| Some(content.clone()))
|
||||||
|
.build();
|
||||||
|
if let Err(e) = event_loop.set_clipboard(send_data) {
|
||||||
|
tracing::error!("Failed to write to clipboard: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppEvent::CursorChange(cursor) => {
|
||||||
|
if let Some(window) = &mut self.window {
|
||||||
|
window.set_cursor(event_loop, cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppEvent::Exit => {
|
||||||
tracing::info!("Exiting main event loop");
|
tracing::info!("Exiting main event loop");
|
||||||
event_loop.exit();
|
event_loop.exit();
|
||||||
}
|
}
|
||||||
|
AppEvent::UiCrashed => {
|
||||||
|
tracing::error!("UI process crashed, exiting.");
|
||||||
|
self.exit(Some(ExitReason::Shutdown));
|
||||||
|
}
|
||||||
|
AppEvent::OpenFiles(paths) => {
|
||||||
|
// Accumulate launch documents until OpenLaunchDocuments message is received
|
||||||
|
if let Some(launch_documents) = &mut self.launch_documents {
|
||||||
|
launch_documents.extend(paths);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if paths.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let app_event_scheduler = self.app_event_scheduler.clone();
|
||||||
|
let _ = thread::spawn(move || {
|
||||||
|
for path in paths {
|
||||||
|
tracing::info!("Opening file: {}", path.display());
|
||||||
|
if let Ok(content) = fs::read(&path) {
|
||||||
|
let message = DesktopWrapperMessage::IngestFile {
|
||||||
|
path,
|
||||||
|
content,
|
||||||
|
action: IngestAction::Open,
|
||||||
|
};
|
||||||
|
app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
} else {
|
||||||
|
tracing::error!("Failed to read file: {}", path.display());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
AppEvent::MenuEvent { id } => {
|
||||||
|
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::MenuEvent { id });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ApplicationHandler for App {
|
impl ApplicationHandler for App {
|
||||||
fn can_create_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) {
|
fn can_create_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) {
|
||||||
let window_attributes = self.native_window.build(event_loop);
|
let window = Window::new(event_loop, self.app_event_scheduler.clone());
|
||||||
|
|
||||||
let window: Arc<dyn Window> = Arc::from(event_loop.create_window(window_attributes).unwrap());
|
|
||||||
|
|
||||||
self.native_window.setup(window.as_ref());
|
|
||||||
|
|
||||||
let graphics_state = GraphicsState::new(window.clone(), self.wgpu_context.clone());
|
|
||||||
|
|
||||||
self.window = Some(window);
|
self.window = Some(window);
|
||||||
self.graphics_state = Some(graphics_state);
|
|
||||||
|
|
||||||
tracing::info!("Winit window created and ready");
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
let present_mode = None;
|
||||||
self.desktop_wrapper.init(self.wgpu_context.clone());
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
let platform = Platform::Windows;
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let platform = Platform::Mac;
|
let present_mode = if !self.preferences.vsync { Some(wgpu::PresentMode::Immediate) } else { None };
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
let platform = Platform::Linux;
|
let render_state = RenderState::new(self.window.as_ref().unwrap(), self.wgpu_context.clone(), present_mode);
|
||||||
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::UpdatePlatform(platform));
|
self.render_state = Some(render_state);
|
||||||
|
|
||||||
|
if let Some(window) = &self.window.as_ref() {
|
||||||
|
window.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
self.resize();
|
||||||
|
|
||||||
|
self.startup_time = Some(Instant::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn proxy_wake_up(&mut self, event_loop: &dyn ActiveEventLoop) {
|
fn proxy_wake_up(&mut self, event_loop: &dyn ActiveEventLoop) {
|
||||||
@@ -343,38 +562,105 @@ impl ApplicationHandler for App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn window_event(&mut self, event_loop: &dyn ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {
|
fn window_event(&mut self, event_loop: &dyn ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {
|
||||||
self.cef_context.handle_window_event(&event);
|
// Handle pointer lock release
|
||||||
|
if let WindowEvent::PointerButton {
|
||||||
|
state: ElementState::Released,
|
||||||
|
button,
|
||||||
|
..
|
||||||
|
} = &event && button.clone().mouse_button() == Some(MouseButton::Left)
|
||||||
|
&& let Some(pointer_lock_position) = self.input_state.unlock_pointer()
|
||||||
|
{
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.end_pointer_lock();
|
||||||
|
}
|
||||||
|
self.ui.send(UiCommand::Input(
|
||||||
|
InputEvent::pointer().position(pointer_lock_position).moved().modifiers(self.input_state.modifiers()).build(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
self.input_state.process(
|
||||||
|
&event,
|
||||||
|
|message| self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::Input(message))),
|
||||||
|
|input| self.ui.send(UiCommand::Input(input)),
|
||||||
|
);
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::CloseRequested => {
|
WindowEvent::CloseRequested => {
|
||||||
self.app_event_scheduler.schedule(AppEvent::CloseWindow);
|
self.app_event_scheduler.schedule(AppEvent::Exit);
|
||||||
}
|
}
|
||||||
WindowEvent::SurfaceResized(size) => {
|
WindowEvent::SurfaceResized(_) | WindowEvent::ScaleFactorChanged { .. } => {
|
||||||
let _ = self.cef_window_size_sender.send(size.into());
|
self.resize();
|
||||||
self.cef_context.notify_of_resize();
|
|
||||||
}
|
}
|
||||||
WindowEvent::RedrawRequested => {
|
WindowEvent::RedrawRequested => {
|
||||||
let Some(ref mut graphics_state) = self.graphics_state else { return };
|
#[cfg(target_os = "macos")]
|
||||||
// Only rerender once we have a new UI texture to display
|
self.resize();
|
||||||
|
|
||||||
|
let Some(render_state) = &mut self.render_state else { return };
|
||||||
if let Some(window) = &self.window {
|
if let Some(window) = &self.window {
|
||||||
match graphics_state.render(window.as_ref()) {
|
if !window.can_render() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
match render_state.render(window) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(wgpu::SurfaceError::Lost) => {
|
Err(RenderError::OutdatedUITextureError) => {
|
||||||
|
self.ui.send(UiCommand::Refresh);
|
||||||
|
}
|
||||||
|
Err(RenderError::SurfaceLost) => {
|
||||||
tracing::warn!("lost surface");
|
tracing::warn!("lost surface");
|
||||||
}
|
}
|
||||||
Err(wgpu::SurfaceError::OutOfMemory) => {
|
Err(other) => tracing::error!("Render error: {:?}", other),
|
||||||
event_loop.exit();
|
|
||||||
}
|
|
||||||
Err(e) => tracing::error!("{:?}", e),
|
|
||||||
}
|
}
|
||||||
let _ = self.start_render_sender.try_send(());
|
let _ = self.start_render_sender.try_send(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !self.ui_frame_received
|
||||||
|
&& !self.preferences.disable_ui_acceleration
|
||||||
|
&& self.web_communication_initialized
|
||||||
|
&& let Some(startup_time) = self.startup_time
|
||||||
|
&& startup_time.elapsed() > Duration::from_secs(3)
|
||||||
|
{
|
||||||
|
tracing::error!("UI acceleration not working, exiting.");
|
||||||
|
self.exit(Some(ExitReason::UiAccelerationFailure));
|
||||||
}
|
}
|
||||||
WindowEvent::DragDropped { paths, .. } => {
|
}
|
||||||
for path in paths {
|
WindowEvent::DragEntered { id, .. } => {
|
||||||
match std::fs::read(&path) {
|
let accepts = event_loop.data_transfer(id).is_ok_and(|data_transfer| data_transfer.has_type(&TypeHint::UriList));
|
||||||
|
let actions: &[DndAction] = if accepts { &[DndAction::Copy] } else { &[] };
|
||||||
|
if let Err(e) = event_loop.set_valid_dnd_actions(id, actions) {
|
||||||
|
tracing::error!("Failed to set valid drag and drop actions: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WindowEvent::DragDropped { id, .. } => match event_loop.fetch_data_transfer(id, &TypeHint::UriList) {
|
||||||
|
Ok(serial) => self.pending_dnd_fetch = Some(serial),
|
||||||
|
Err(e) => tracing::error!("Failed to fetch dropped data: {e}"),
|
||||||
|
},
|
||||||
|
WindowEvent::DataTransferReceived { serial, ref value, .. } if self.pending_clipboard_fetch == Some(serial) => match value.try_as_string() {
|
||||||
Ok(content) => {
|
Ok(content) => {
|
||||||
let message = DesktopWrapperMessage::OpenFile { path, content };
|
self.pending_clipboard_fetch = None;
|
||||||
|
let message = DesktopWrapperMessage::ClipboardReadResult { content: Some(content) };
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
}
|
||||||
|
Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => {}
|
||||||
|
Err(e) => {
|
||||||
|
self.pending_clipboard_fetch = None;
|
||||||
|
tracing::error!("Failed to read from clipboard: {e}");
|
||||||
|
let message = DesktopWrapperMessage::ClipboardReadResult { content: None };
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
WindowEvent::DataTransferReceived { serial, ref value, .. } if self.pending_dnd_fetch == Some(serial) => match value.try_as_uris() {
|
||||||
|
Ok(uris) => {
|
||||||
|
self.pending_dnd_fetch = None;
|
||||||
|
let paths = uris.iter().filter_map(|uri| url::Url::parse(uri).ok()?.to_file_path().ok());
|
||||||
|
for path in paths {
|
||||||
|
match fs::read(&path) {
|
||||||
|
Ok(content) => {
|
||||||
|
let message = DesktopWrapperMessage::IngestFile {
|
||||||
|
path,
|
||||||
|
content,
|
||||||
|
action: IngestAction::Import,
|
||||||
|
};
|
||||||
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@@ -384,30 +670,58 @@ impl ApplicationHandler for App {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => {}
|
||||||
|
Err(e) => {
|
||||||
|
self.pending_dnd_fetch = None;
|
||||||
|
tracing::error!("Failed to read dropped data: {e}");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
WindowEvent::PointerMoved { .. } | WindowEvent::PointerLeft { position: Some(_), .. } | WindowEvent::PointerEntered { .. }
|
||||||
|
if !self.input_state.pointer_locked() && self.window_pending_drag =>
|
||||||
|
{
|
||||||
|
self.window_pending_drag = false;
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.start_drag();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify cef of possible input events
|
WindowEvent::PointerButton {
|
||||||
self.cef_context.work();
|
button,
|
||||||
|
state: ElementState::Released,
|
||||||
|
..
|
||||||
|
} if button.clone().mouse_button() == Some(MouseButton::Left) => {
|
||||||
|
self.window_pending_drag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn device_event(&mut self, _event_loop: &dyn ActiveEventLoop, _device_id: Option<winit::event::DeviceId>, event: winit::event::DeviceEvent) {
|
||||||
|
if self.input_state.pointer_locked()
|
||||||
|
&& let winit::event::DeviceEvent::PointerMotion { delta: (x, y) } = event
|
||||||
|
{
|
||||||
|
let message = DesktopWrapperMessage::PointerLockMove { x, y };
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_events(&mut self, _event_loop: &dyn ActiveEventLoop, cause: winit::event::StartCause) {
|
||||||
|
if let StartCause::ResumeTimeReached { .. } = cause
|
||||||
|
&& let Some(window) = &self.window
|
||||||
|
{
|
||||||
|
window.request_redraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn about_to_wait(&mut self, event_loop: &dyn ActiveEventLoop) {
|
fn about_to_wait(&mut self, event_loop: &dyn ActiveEventLoop) {
|
||||||
// Set a timeout in case we miss any cef schedule requests
|
event_loop.set_control_flow(ControlFlow::WaitUntil(Instant::now() + Duration::from_millis(10)));
|
||||||
let timeout = Instant::now() + Duration::from_millis(10);
|
|
||||||
let wait_until = timeout.min(self.cef_schedule.unwrap_or(timeout));
|
|
||||||
if let Some(schedule) = self.cef_schedule
|
|
||||||
&& schedule < Instant::now()
|
|
||||||
{
|
|
||||||
self.cef_schedule = None;
|
|
||||||
// Poll cef message loop multiple times to avoid message loop starvation
|
|
||||||
for _ in 0..CEF_MESSAGE_LOOP_MAX_ITERATIONS {
|
|
||||||
self.cef_context.work();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(window) = &self.window.as_ref() {
|
|
||||||
window.request_redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
event_loop.set_control_flow(ControlFlow::WaitUntil(wait_until));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) enum ExitReason {
|
||||||
|
Shutdown,
|
||||||
|
Restart,
|
||||||
|
UiAccelerationFailure,
|
||||||
|
}
|
||||||
@@ -1,255 +0,0 @@
|
|||||||
//! CEF (Chromium Embedded Framework) integration for Graphite Desktop
|
|
||||||
//!
|
|
||||||
//! This module provides CEF browser integration with hardware-accelerated texture sharing.
|
|
||||||
//!
|
|
||||||
//! # Hardware Acceleration
|
|
||||||
//!
|
|
||||||
//! The texture import system supports platform-specific hardware acceleration:
|
|
||||||
//!
|
|
||||||
//! - **Linux**: DMA-BUF via Vulkan external memory (`accelerated_paint_dmabuf` feature)
|
|
||||||
//! - **Windows**: D3D11 shared textures via either Vulkan or D3D12 interop (`accelerated_paint_d3d11` feature)
|
|
||||||
//! - **macOS**: IOSurface via Metal/Vulkan interop (`accelerated_paint_iosurface` feature)
|
|
||||||
//!
|
|
||||||
//! The system gracefully falls back to CPU textures when hardware acceleration is unavailable.
|
|
||||||
|
|
||||||
use crate::event::{AppEvent, AppEventScheduler};
|
|
||||||
use crate::render::FrameBufferRef;
|
|
||||||
use graphite_desktop_wrapper::{WgpuContext, deserialize_editor_message};
|
|
||||||
use std::fs::File;
|
|
||||||
use std::io::{Cursor, Read};
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::sync::mpsc::Receiver;
|
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
use std::time::Instant;
|
|
||||||
|
|
||||||
mod consts;
|
|
||||||
mod context;
|
|
||||||
mod dirs;
|
|
||||||
mod input;
|
|
||||||
mod internal;
|
|
||||||
mod ipc;
|
|
||||||
mod platform;
|
|
||||||
mod utility;
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
mod texture_import;
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
use texture_import::SharedTextureHandle;
|
|
||||||
|
|
||||||
pub(crate) use context::{CefContext, CefContextBuilder, InitError};
|
|
||||||
|
|
||||||
pub(crate) trait CefEventHandler: Clone + Send + Sync + 'static {
|
|
||||||
fn window_size(&self) -> WindowSize;
|
|
||||||
fn draw<'a>(&self, frame_buffer: FrameBufferRef<'a>);
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
fn draw_gpu(&self, shared_texture: SharedTextureHandle);
|
|
||||||
fn load_resource(&self, path: PathBuf) -> Option<Resource>;
|
|
||||||
/// Schedule the main event loop to run the CEF event loop after the timeout.
|
|
||||||
/// See [`_cef_browser_process_handler_t::on_schedule_message_pump_work`] for more documentation.
|
|
||||||
fn schedule_cef_message_loop_work(&self, scheduled_time: Instant);
|
|
||||||
fn initialized_web_communication(&self);
|
|
||||||
fn receive_web_message(&self, message: &[u8]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
|
||||||
pub(crate) struct WindowSize {
|
|
||||||
pub(crate) width: usize,
|
|
||||||
pub(crate) height: usize,
|
|
||||||
}
|
|
||||||
impl WindowSize {
|
|
||||||
pub(crate) fn new(width: usize, height: usize) -> Self {
|
|
||||||
Self { width, height }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<winit::dpi::PhysicalSize<u32>> for WindowSize {
|
|
||||||
fn from(size: winit::dpi::PhysicalSize<u32>) -> Self {
|
|
||||||
Self::new(size.width as usize, size.height as usize)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub(crate) struct Resource {
|
|
||||||
pub(crate) reader: ResourceReader,
|
|
||||||
pub(crate) mimetype: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[expect(dead_code)]
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub(crate) enum ResourceReader {
|
|
||||||
Embedded(Cursor<&'static [u8]>),
|
|
||||||
File(Arc<File>),
|
|
||||||
}
|
|
||||||
impl Read for ResourceReader {
|
|
||||||
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
|
||||||
match self {
|
|
||||||
ResourceReader::Embedded(cursor) => cursor.read(buf),
|
|
||||||
ResourceReader::File(file) => file.as_ref().read(buf),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub(crate) struct CefHandler {
|
|
||||||
wgpu_context: WgpuContext,
|
|
||||||
app_event_scheduler: AppEventScheduler,
|
|
||||||
window_size_receiver: Arc<Mutex<WindowSizeReceiver>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CefHandler {
|
|
||||||
pub(crate) fn new(wgpu_context: WgpuContext, app_event_scheduler: AppEventScheduler, window_size_receiver: Receiver<WindowSize>) -> Self {
|
|
||||||
Self {
|
|
||||||
wgpu_context,
|
|
||||||
app_event_scheduler,
|
|
||||||
window_size_receiver: Arc::new(Mutex::new(WindowSizeReceiver::new(window_size_receiver))),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CefEventHandler for CefHandler {
|
|
||||||
fn window_size(&self) -> WindowSize {
|
|
||||||
let Ok(mut guard) = self.window_size_receiver.lock() else {
|
|
||||||
tracing::error!("Failed to lock window_size_receiver");
|
|
||||||
return WindowSize::new(1, 1);
|
|
||||||
};
|
|
||||||
let WindowSizeReceiver { receiver, window_size } = &mut *guard;
|
|
||||||
for new_window_size in receiver.try_iter() {
|
|
||||||
*window_size = new_window_size;
|
|
||||||
}
|
|
||||||
*window_size
|
|
||||||
}
|
|
||||||
fn draw<'a>(&self, frame_buffer: FrameBufferRef<'a>) {
|
|
||||||
let width = frame_buffer.width() as u32;
|
|
||||||
let height = frame_buffer.height() as u32;
|
|
||||||
let texture = self.wgpu_context.device.create_texture(&wgpu::TextureDescriptor {
|
|
||||||
label: Some("CEF Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: wgpu::TextureFormat::Bgra8UnormSrgb,
|
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
|
|
||||||
view_formats: &[],
|
|
||||||
});
|
|
||||||
self.wgpu_context.queue.write_texture(
|
|
||||||
wgpu::TexelCopyTextureInfo {
|
|
||||||
texture: &texture,
|
|
||||||
mip_level: 0,
|
|
||||||
origin: wgpu::Origin3d::ZERO,
|
|
||||||
aspect: wgpu::TextureAspect::All,
|
|
||||||
},
|
|
||||||
frame_buffer.buffer(),
|
|
||||||
wgpu::TexelCopyBufferLayout {
|
|
||||||
offset: 0,
|
|
||||||
bytes_per_row: Some(4 * width),
|
|
||||||
rows_per_image: Some(height),
|
|
||||||
},
|
|
||||||
wgpu::Extent3d {
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::UiUpdate(texture));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
fn draw_gpu(&self, shared_texture: SharedTextureHandle) {
|
|
||||||
match shared_texture.import_texture(&self.wgpu_context.device) {
|
|
||||||
Ok(texture) => {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::UiUpdate(texture));
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!("Failed to import shared texture: {}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn load_resource(&self, path: PathBuf) -> Option<Resource> {
|
|
||||||
let path = if path.as_os_str().is_empty() { PathBuf::from("index.html") } else { path };
|
|
||||||
|
|
||||||
let mimetype = match path.extension().and_then(|s| s.to_str()).unwrap_or("") {
|
|
||||||
"html" => Some("text/html".to_string()),
|
|
||||||
"css" => Some("text/css".to_string()),
|
|
||||||
"txt" => Some("text/plain".to_string()),
|
|
||||||
"wasm" => Some("application/wasm".to_string()),
|
|
||||||
"js" => Some("application/javascript".to_string()),
|
|
||||||
"png" => Some("image/png".to_string()),
|
|
||||||
"jpg" | "jpeg" => Some("image/jpeg".to_string()),
|
|
||||||
"svg" => Some("image/svg+xml".to_string()),
|
|
||||||
"xml" => Some("application/xml".to_string()),
|
|
||||||
"json" => Some("application/json".to_string()),
|
|
||||||
"ico" => Some("image/x-icon".to_string()),
|
|
||||||
"woff" => Some("font/woff".to_string()),
|
|
||||||
"woff2" => Some("font/woff2".to_string()),
|
|
||||||
"ttf" => Some("font/ttf".to_string()),
|
|
||||||
"otf" => Some("font/otf".to_string()),
|
|
||||||
"webmanifest" => Some("application/manifest+json".to_string()),
|
|
||||||
"graphite" => Some("application/graphite+json".to_string()),
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[cfg(feature = "embedded_resources")]
|
|
||||||
{
|
|
||||||
if let Some(resources) = &graphite_desktop_embedded_resources::EMBEDDED_RESOURCES
|
|
||||||
&& let Some(file) = resources.get_file(&path)
|
|
||||||
{
|
|
||||||
return Some(Resource {
|
|
||||||
reader: ResourceReader::Embedded(Cursor::new(file.contents())),
|
|
||||||
mimetype,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "embedded_resources"))]
|
|
||||||
{
|
|
||||||
use std::path::Path;
|
|
||||||
let asset_path_env = std::env::var("GRAPHITE_RESOURCES").ok()?;
|
|
||||||
let asset_path = Path::new(&asset_path_env);
|
|
||||||
let file_path = asset_path.join(path.strip_prefix("/").unwrap_or(&path));
|
|
||||||
if file_path.exists() && file_path.is_file() {
|
|
||||||
if let Ok(file) = std::fs::File::open(file_path) {
|
|
||||||
return Some(Resource {
|
|
||||||
reader: ResourceReader::File(file.into()),
|
|
||||||
mimetype,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn schedule_cef_message_loop_work(&self, scheduled_time: std::time::Instant) {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::ScheduleBrowserWork(scheduled_time));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn initialized_web_communication(&self) {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::WebCommunicationInitialized);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn receive_web_message(&self, message: &[u8]) {
|
|
||||||
let Some(desktop_wrapper_message) = deserialize_editor_message(message) else {
|
|
||||||
tracing::error!("Failed to deserialize web message");
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(desktop_wrapper_message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct WindowSizeReceiver {
|
|
||||||
window_size: WindowSize,
|
|
||||||
receiver: Receiver<WindowSize>,
|
|
||||||
}
|
|
||||||
impl WindowSizeReceiver {
|
|
||||||
fn new(window_size_receiver: Receiver<WindowSize>) -> Self {
|
|
||||||
Self {
|
|
||||||
window_size: WindowSize { width: 1, height: 1 },
|
|
||||||
receiver: window_size_receiver,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
pub(crate) const RESOURCE_SCHEME: &str = "resources";
|
|
||||||
pub(crate) const RESOURCE_DOMAIN: &str = "resources";
|
|
||||||
|
|
||||||
pub(crate) const SCROLL_LINE_HEIGHT: usize = 40;
|
|
||||||
pub(crate) const SCROLL_LINE_WIDTH: usize = 40;
|
|
||||||
pub(crate) const SCROLL_SPEED_X: f32 = 3.0;
|
|
||||||
pub(crate) const SCROLL_SPEED_Y: f32 = 3.0;
|
|
||||||
|
|
||||||
pub(crate) const MULTICLICK_TIMEOUT: Duration = Duration::from_millis(500);
|
|
||||||
pub(crate) const MULTICLICK_ALLOWED_TRAVEL: usize = 4;
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
mod multithreaded;
|
|
||||||
mod singlethreaded;
|
|
||||||
|
|
||||||
mod builder;
|
|
||||||
pub(crate) use builder::{CefContextBuilder, InitError};
|
|
||||||
|
|
||||||
pub(crate) trait CefContext {
|
|
||||||
fn work(&mut self);
|
|
||||||
|
|
||||||
fn handle_window_event(&mut self, event: &winit::event::WindowEvent);
|
|
||||||
|
|
||||||
fn notify_of_resize(&self);
|
|
||||||
|
|
||||||
fn send_web_message(&self, message: Vec<u8>);
|
|
||||||
}
|
|
||||||
@@ -1,201 +0,0 @@
|
|||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use cef::args::Args;
|
|
||||||
use cef::sys::{CEF_API_VERSION_LAST, cef_resultcode_t};
|
|
||||||
use cef::{
|
|
||||||
App, BrowserSettings, CefString, Client, DictionaryValue, ImplCommandLine, ImplRequestContext, RenderHandler, RequestContextSettings, SchemeHandlerFactory, Settings, WindowInfo, api_hash,
|
|
||||||
browser_host_create_browser_sync, execute_process,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::CefContext;
|
|
||||||
use super::singlethreaded::SingleThreadedCefContext;
|
|
||||||
use crate::cef::CefEventHandler;
|
|
||||||
use crate::cef::consts::{RESOURCE_DOMAIN, RESOURCE_SCHEME};
|
|
||||||
use crate::cef::dirs::create_instance_dir;
|
|
||||||
use crate::cef::input::InputState;
|
|
||||||
use crate::cef::internal::{BrowserProcessAppImpl, BrowserProcessClientImpl, RenderHandlerImpl, RenderProcessAppImpl, SchemeHandlerFactoryImpl};
|
|
||||||
|
|
||||||
pub(crate) struct CefContextBuilder<H: CefEventHandler> {
|
|
||||||
pub(crate) args: Args,
|
|
||||||
pub(crate) is_sub_process: bool,
|
|
||||||
_marker: std::marker::PhantomData<H>,
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl<H: CefEventHandler> Send for CefContextBuilder<H> {}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> CefContextBuilder<H> {
|
|
||||||
pub(crate) fn new() -> Self {
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
let _loader = {
|
|
||||||
let loader = library_loader::LibraryLoader::new(&std::env::current_exe().unwrap(), false);
|
|
||||||
assert!(loader.load());
|
|
||||||
loader
|
|
||||||
};
|
|
||||||
let _ = api_hash(CEF_API_VERSION_LAST, 0);
|
|
||||||
|
|
||||||
let args = Args::new();
|
|
||||||
let cmd = args.as_cmd_line().unwrap();
|
|
||||||
let switch = CefString::from("type");
|
|
||||||
let is_sub_process = cmd.has_switch(Some(&switch)) == 1;
|
|
||||||
|
|
||||||
Self {
|
|
||||||
args,
|
|
||||||
is_sub_process,
|
|
||||||
_marker: std::marker::PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn is_sub_process(&self) -> bool {
|
|
||||||
self.is_sub_process
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn execute_sub_process(&self) -> SetupError {
|
|
||||||
let cmd = self.args.as_cmd_line().unwrap();
|
|
||||||
let switch = CefString::from("type");
|
|
||||||
let process_type = CefString::from(&cmd.switch_value(Some(&switch)));
|
|
||||||
let mut app = RenderProcessAppImpl::<H>::app();
|
|
||||||
let ret = execute_process(Some(self.args.as_main_args()), Some(&mut app), std::ptr::null_mut());
|
|
||||||
if ret >= 0 {
|
|
||||||
SetupError::SubprocessFailed(process_type.to_string())
|
|
||||||
} else {
|
|
||||||
SetupError::Subprocess
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
pub(crate) fn initialize(self, event_handler: H) -> Result<impl CefContext, InitError> {
|
|
||||||
let instance_dir = create_instance_dir();
|
|
||||||
|
|
||||||
let settings = Settings {
|
|
||||||
windowless_rendering_enabled: 1,
|
|
||||||
multi_threaded_message_loop: 0,
|
|
||||||
external_message_pump: 1,
|
|
||||||
root_cache_path: instance_dir.to_str().map(CefString::from).unwrap(),
|
|
||||||
cache_path: CefString::from(""),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
self.initialize_inner(&event_handler, settings)?;
|
|
||||||
|
|
||||||
create_browser(event_handler, instance_dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
pub(crate) fn initialize(self, event_handler: H) -> Result<impl CefContext, InitError> {
|
|
||||||
let instance_dir = create_instance_dir();
|
|
||||||
|
|
||||||
let settings = Settings {
|
|
||||||
windowless_rendering_enabled: 1,
|
|
||||||
multi_threaded_message_loop: 1,
|
|
||||||
root_cache_path: instance_dir.to_str().map(CefString::from).unwrap(),
|
|
||||||
cache_path: CefString::from(""),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
self.initialize_inner(&event_handler, settings)?;
|
|
||||||
|
|
||||||
super::multithreaded::run_on_ui_thread(move || match create_browser(event_handler, instance_dir) {
|
|
||||||
Ok(context) => {
|
|
||||||
super::multithreaded::CONTEXT.with(|b| {
|
|
||||||
*b.borrow_mut() = Some(context);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!("Failed to initialize CEF context: {:?}", e);
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Ok(super::multithreaded::MultiThreadedCefContextProxy)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn initialize_inner(self, event_handler: &H, settings: Settings) -> Result<(), InitError> {
|
|
||||||
// Attention! Wrapping this in an extra App is necessary, otherwise the program still compiles but segfaults
|
|
||||||
let mut cef_app = App::new(BrowserProcessAppImpl::new(event_handler.clone()));
|
|
||||||
|
|
||||||
let result = cef::initialize(Some(self.args.as_main_args()), Some(&settings), Some(&mut cef_app), std::ptr::null_mut());
|
|
||||||
if result != 1 {
|
|
||||||
let cef_exit_code = cef::get_exit_code() as u32;
|
|
||||||
if cef_exit_code == cef_resultcode_t::CEF_RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED as u32 {
|
|
||||||
return Err(InitError::AlreadyRunning);
|
|
||||||
}
|
|
||||||
return Err(InitError::InitializationFailed(cef_exit_code));
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_browser<H: CefEventHandler>(event_handler: H, instance_dir: PathBuf) -> Result<SingleThreadedCefContext, InitError> {
|
|
||||||
let render_handler = RenderHandler::new(RenderHandlerImpl::new(event_handler.clone()));
|
|
||||||
let mut client = Client::new(BrowserProcessClientImpl::new(render_handler, event_handler.clone()));
|
|
||||||
|
|
||||||
let window_info = WindowInfo {
|
|
||||||
windowless_rendering_enabled: 1,
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
shared_texture_enabled: if crate::cef::platform::should_enable_hardware_acceleration() { 1 } else { 0 },
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let settings = BrowserSettings {
|
|
||||||
windowless_frame_rate: crate::consts::CEF_WINDOWLESS_FRAME_RATE,
|
|
||||||
background_color: 0x0,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let Some(mut incognito_request_context) = cef::request_context_create_context(
|
|
||||||
Some(&RequestContextSettings {
|
|
||||||
persist_session_cookies: 0,
|
|
||||||
cache_path: CefString::from(""),
|
|
||||||
..Default::default()
|
|
||||||
}),
|
|
||||||
Option::<&mut cef::RequestContextHandler>::None,
|
|
||||||
) else {
|
|
||||||
return Err(InitError::RequestContextCreationFailed);
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut scheme_handler_factory = SchemeHandlerFactory::new(SchemeHandlerFactoryImpl::new(event_handler.clone()));
|
|
||||||
incognito_request_context.clear_scheme_handler_factories();
|
|
||||||
incognito_request_context.register_scheme_handler_factory(Some(&CefString::from(RESOURCE_SCHEME)), Some(&CefString::from(RESOURCE_DOMAIN)), Some(&mut scheme_handler_factory));
|
|
||||||
|
|
||||||
let url = CefString::from(format!("{RESOURCE_SCHEME}://{RESOURCE_DOMAIN}/").as_str());
|
|
||||||
|
|
||||||
let browser = browser_host_create_browser_sync(
|
|
||||||
Some(&window_info),
|
|
||||||
Some(&mut client),
|
|
||||||
Some(&url),
|
|
||||||
Some(&settings),
|
|
||||||
Option::<&mut DictionaryValue>::None,
|
|
||||||
Some(&mut incognito_request_context),
|
|
||||||
);
|
|
||||||
|
|
||||||
if let Some(browser) = browser {
|
|
||||||
Ok(SingleThreadedCefContext {
|
|
||||||
browser,
|
|
||||||
input_state: InputState::default(),
|
|
||||||
instance_dir,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
tracing::error!("Failed to create browser");
|
|
||||||
Err(InitError::BrowserCreationFailed)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
|
||||||
pub(crate) enum SetupError {
|
|
||||||
#[error("This is the sub process should exit immediately")]
|
|
||||||
Subprocess,
|
|
||||||
#[error("Subprocess returned non zero exit code")]
|
|
||||||
SubprocessFailed(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
|
||||||
pub(crate) enum InitError {
|
|
||||||
#[error("Initialization failed")]
|
|
||||||
InitializationFailed(u32),
|
|
||||||
#[error("Browser creation failed")]
|
|
||||||
BrowserCreationFailed,
|
|
||||||
#[error("Request context creation failed")]
|
|
||||||
RequestContextCreationFailed,
|
|
||||||
#[error("Another instance is already running")]
|
|
||||||
AlreadyRunning,
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
use cef::sys::cef_thread_id_t;
|
|
||||||
use cef::{Task, ThreadId, post_task};
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use winit::event::WindowEvent;
|
|
||||||
|
|
||||||
use crate::cef::internal::task::ClosureTask;
|
|
||||||
|
|
||||||
use super::CefContext;
|
|
||||||
use super::singlethreaded::SingleThreadedCefContext;
|
|
||||||
|
|
||||||
thread_local! {
|
|
||||||
pub(super) static CONTEXT: RefCell<Option<SingleThreadedCefContext>> = const { RefCell::new(None) };
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) struct MultiThreadedCefContextProxy;
|
|
||||||
|
|
||||||
impl CefContext for MultiThreadedCefContextProxy {
|
|
||||||
fn work(&mut self) {
|
|
||||||
// CEF handles its own message loop in multi-threaded mode
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_window_event(&mut self, event: &WindowEvent) {
|
|
||||||
let event_clone = event.clone();
|
|
||||||
run_on_ui_thread(move || {
|
|
||||||
CONTEXT.with(|b| {
|
|
||||||
if let Some(context) = b.borrow_mut().as_mut() {
|
|
||||||
context.handle_window_event(&event_clone);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn notify_of_resize(&self) {
|
|
||||||
run_on_ui_thread(move || {
|
|
||||||
CONTEXT.with(|b| {
|
|
||||||
if let Some(context) = b.borrow_mut().as_mut() {
|
|
||||||
context.notify_of_resize();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn send_web_message(&self, message: Vec<u8>) {
|
|
||||||
run_on_ui_thread(move || {
|
|
||||||
CONTEXT.with(|b| {
|
|
||||||
if let Some(context) = b.borrow_mut().as_mut() {
|
|
||||||
context.send_web_message(message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for MultiThreadedCefContextProxy {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
cef::shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn run_on_ui_thread<F>(closure: F)
|
|
||||||
where
|
|
||||||
F: FnOnce() + Send + 'static,
|
|
||||||
{
|
|
||||||
let closure_task = ClosureTask::new(closure);
|
|
||||||
let mut task = Task::new(closure_task);
|
|
||||||
post_task(ThreadId::from(cef_thread_id_t::TID_UI), Some(&mut task));
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
use cef::{Browser, ImplBrowser, ImplBrowserHost};
|
|
||||||
use winit::event::WindowEvent;
|
|
||||||
|
|
||||||
use crate::cef::input;
|
|
||||||
use crate::cef::input::InputState;
|
|
||||||
use crate::cef::ipc::{MessageType, SendMessage};
|
|
||||||
|
|
||||||
use super::CefContext;
|
|
||||||
|
|
||||||
pub(super) struct SingleThreadedCefContext {
|
|
||||||
pub(super) browser: Browser,
|
|
||||||
pub(super) input_state: InputState,
|
|
||||||
pub(super) instance_dir: std::path::PathBuf,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CefContext for SingleThreadedCefContext {
|
|
||||||
fn work(&mut self) {
|
|
||||||
cef::do_message_loop_work();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_window_event(&mut self, event: &WindowEvent) {
|
|
||||||
input::handle_window_event(&self.browser, &mut self.input_state, event)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn notify_of_resize(&self) {
|
|
||||||
self.browser.host().unwrap().was_resized();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn send_web_message(&self, message: Vec<u8>) {
|
|
||||||
self.send_message(MessageType::SendToJS, &message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for SingleThreadedCefContext {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
cef::shutdown();
|
|
||||||
std::fs::remove_dir_all(&self.instance_dir).expect("Failed to remove CEF cache directory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SendMessage for SingleThreadedCefContext {
|
|
||||||
fn send_message(&self, message_type: MessageType, message: &[u8]) {
|
|
||||||
let Some(frame) = self.browser.main_frame() else {
|
|
||||||
tracing::error!("Main frame is not available, cannot send message");
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
frame.send_message(message_type, message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use crate::dirs::{ensure_dir_exists, graphite_data_dir};
|
|
||||||
|
|
||||||
static CEF_DIR_NAME: &str = "browser";
|
|
||||||
|
|
||||||
pub(crate) fn create_instance_dir() -> PathBuf {
|
|
||||||
let instance_id: String = (0..32).map(|_| format!("{:x}", rand::random::<u8>() % 16)).collect();
|
|
||||||
let path = graphite_data_dir().join(CEF_DIR_NAME).join(instance_id);
|
|
||||||
ensure_dir_exists(&path);
|
|
||||||
path
|
|
||||||
}
|
|
||||||
@@ -1,352 +0,0 @@
|
|||||||
use cef::sys::{cef_event_flags_t, cef_key_event_type_t, cef_mouse_button_type_t};
|
|
||||||
use cef::{Browser, ImplBrowser, ImplBrowserHost, KeyEvent, KeyEventType, MouseEvent};
|
|
||||||
use std::time::Instant;
|
|
||||||
use winit::dpi::PhysicalPosition;
|
|
||||||
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, WindowEvent};
|
|
||||||
|
|
||||||
mod keymap;
|
|
||||||
use keymap::{ToNativeKeycode, ToVKBits};
|
|
||||||
|
|
||||||
use super::consts::{MULTICLICK_ALLOWED_TRAVEL, MULTICLICK_TIMEOUT, SCROLL_LINE_HEIGHT, SCROLL_LINE_WIDTH, SCROLL_SPEED_X, SCROLL_SPEED_Y};
|
|
||||||
|
|
||||||
pub(crate) fn handle_window_event(browser: &Browser, input_state: &mut InputState, event: &WindowEvent) {
|
|
||||||
match event {
|
|
||||||
WindowEvent::PointerMoved { position, .. } => {
|
|
||||||
input_state.cursor_move(position);
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
host.send_mouse_move_event(Some(&input_state.into()), 0);
|
|
||||||
}
|
|
||||||
WindowEvent::PointerButton { state, button, .. } => {
|
|
||||||
let mouse_button = match button {
|
|
||||||
ButtonSource::Mouse(mouse_button) => mouse_button,
|
|
||||||
_ => {
|
|
||||||
return; // TODO: Handle touch input
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let cef_click_count = input_state.mouse_input(mouse_button, state).into();
|
|
||||||
let cef_mouse_up = match state {
|
|
||||||
ElementState::Pressed => 0,
|
|
||||||
ElementState::Released => 1,
|
|
||||||
};
|
|
||||||
let cef_button = match mouse_button {
|
|
||||||
MouseButton::Left => cef::MouseButtonType::from(cef_mouse_button_type_t::MBT_LEFT),
|
|
||||||
MouseButton::Right => cef::MouseButtonType::from(cef_mouse_button_type_t::MBT_RIGHT),
|
|
||||||
MouseButton::Middle => cef::MouseButtonType::from(cef_mouse_button_type_t::MBT_MIDDLE),
|
|
||||||
_ => return, //TODO: Handle Forward and Back button
|
|
||||||
};
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
host.send_mouse_click_event(Some(&input_state.into()), cef_button, cef_mouse_up, cef_click_count);
|
|
||||||
}
|
|
||||||
WindowEvent::MouseWheel { delta, phase: _, device_id: _, .. } => {
|
|
||||||
let mouse_event = input_state.into();
|
|
||||||
let (mut delta_x, mut delta_y) = match delta {
|
|
||||||
MouseScrollDelta::LineDelta(x, y) => (x * SCROLL_LINE_WIDTH as f32, y * SCROLL_LINE_HEIGHT as f32),
|
|
||||||
MouseScrollDelta::PixelDelta(physical_position) => (physical_position.x as f32, physical_position.y as f32),
|
|
||||||
};
|
|
||||||
delta_x *= SCROLL_SPEED_X;
|
|
||||||
delta_y *= SCROLL_SPEED_Y;
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
host.send_mouse_wheel_event(Some(&mouse_event), delta_x as i32, delta_y as i32);
|
|
||||||
}
|
|
||||||
WindowEvent::ModifiersChanged(modifiers) => {
|
|
||||||
input_state.modifiers_changed(&modifiers.state());
|
|
||||||
}
|
|
||||||
WindowEvent::KeyboardInput { device_id: _, event, is_synthetic: _ } => {
|
|
||||||
let (named_key, character) = match &event.logical_key {
|
|
||||||
winit::keyboard::Key::Named(named_key) => (
|
|
||||||
Some(named_key),
|
|
||||||
match named_key {
|
|
||||||
winit::keyboard::NamedKey::Enter => Some('\u{000d}'),
|
|
||||||
_ => None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
winit::keyboard::Key::Character(str) => {
|
|
||||||
let char = str.chars().next().unwrap_or('\0');
|
|
||||||
(None, Some(char))
|
|
||||||
}
|
|
||||||
_ => return,
|
|
||||||
};
|
|
||||||
|
|
||||||
let native_key_code = event.physical_key.to_native_keycode();
|
|
||||||
|
|
||||||
let modifiers = input_state.cef_modifiers(&event.location, event.repeat).raw();
|
|
||||||
|
|
||||||
let mut key_event = KeyEvent {
|
|
||||||
size: size_of::<KeyEvent>(),
|
|
||||||
modifiers,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(named_key) = named_key {
|
|
||||||
key_event.windows_key_code = named_key.to_vk_bits();
|
|
||||||
} else if let Some(char) = character {
|
|
||||||
key_event.windows_key_code = char.to_vk_bits();
|
|
||||||
}
|
|
||||||
|
|
||||||
key_event.native_key_code = native_key_code;
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else {
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
match event.state {
|
|
||||||
ElementState::Pressed => {
|
|
||||||
key_event.type_ = KeyEventType::from(cef_key_event_type_t::KEYEVENT_RAWKEYDOWN);
|
|
||||||
host.send_key_event(Some(&key_event));
|
|
||||||
|
|
||||||
if let Some(char) = character {
|
|
||||||
let mut char_key_event = KeyEvent {
|
|
||||||
size: size_of::<KeyEvent>(),
|
|
||||||
modifiers,
|
|
||||||
is_system_key: 0,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
let mut buf = [0; 2];
|
|
||||||
char.encode_utf16(&mut buf);
|
|
||||||
char_key_event.windows_key_code = buf[0] as i32;
|
|
||||||
char_key_event.character = buf[0];
|
|
||||||
char_key_event.native_key_code = native_key_code;
|
|
||||||
let mut buf = [0; 2];
|
|
||||||
char.to_lowercase().next().unwrap().encode_utf16(&mut buf);
|
|
||||||
char_key_event.unmodified_character = buf[0];
|
|
||||||
char_key_event.type_ = KeyEventType::from(cef_key_event_type_t::KEYEVENT_CHAR);
|
|
||||||
host.send_key_event(Some(&char_key_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ElementState::Released => {
|
|
||||||
key_event.type_ = KeyEventType::from(cef_key_event_type_t::KEYEVENT_KEYUP);
|
|
||||||
host.send_key_event(Some(&key_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub(crate) struct InputState {
|
|
||||||
modifiers: winit::keyboard::ModifiersState,
|
|
||||||
mouse_position: MousePosition,
|
|
||||||
mouse_state: MouseState,
|
|
||||||
mouse_click_tracker: ClickTracker,
|
|
||||||
}
|
|
||||||
impl InputState {
|
|
||||||
fn modifiers_changed(&mut self, modifiers: &winit::keyboard::ModifiersState) {
|
|
||||||
self.modifiers = *modifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cursor_move(&mut self, position: &PhysicalPosition<f64>) {
|
|
||||||
self.mouse_position = position.into();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mouse_input(&mut self, button: &MouseButton, state: &ElementState) -> ClickCount {
|
|
||||||
self.mouse_state.update(button, state);
|
|
||||||
self.mouse_click_tracker.input(button, state, &self.mouse_position)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cef_modifiers(&self, location: &winit::keyboard::KeyLocation, is_repeat: bool) -> CefModifiers {
|
|
||||||
CefModifiers::new(self, location, is_repeat)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cef_modifiers_mouse_event(&self) -> CefModifiers {
|
|
||||||
self.cef_modifiers(&winit::keyboard::KeyLocation::Standard, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<InputState> for CefModifiers {
|
|
||||||
fn from(val: InputState) -> Self {
|
|
||||||
CefModifiers::new(&val, &winit::keyboard::KeyLocation::Standard, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<&InputState> for MouseEvent {
|
|
||||||
fn from(val: &InputState) -> Self {
|
|
||||||
MouseEvent {
|
|
||||||
x: val.mouse_position.x as i32,
|
|
||||||
y: val.mouse_position.y as i32,
|
|
||||||
modifiers: val.cef_modifiers_mouse_event().raw(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<&mut InputState> for MouseEvent {
|
|
||||||
fn from(val: &mut InputState) -> Self {
|
|
||||||
MouseEvent {
|
|
||||||
x: val.mouse_position.x as i32,
|
|
||||||
y: val.mouse_position.y as i32,
|
|
||||||
modifiers: val.cef_modifiers_mouse_event().raw(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
|
||||||
pub(crate) struct MousePosition {
|
|
||||||
x: usize,
|
|
||||||
y: usize,
|
|
||||||
}
|
|
||||||
impl From<&PhysicalPosition<f64>> for MousePosition {
|
|
||||||
fn from(position: &PhysicalPosition<f64>) -> Self {
|
|
||||||
Self {
|
|
||||||
x: position.x as usize,
|
|
||||||
y: position.y as usize,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
|
||||||
pub(crate) struct MouseState {
|
|
||||||
left: bool,
|
|
||||||
right: bool,
|
|
||||||
middle: bool,
|
|
||||||
}
|
|
||||||
impl MouseState {
|
|
||||||
pub(crate) fn update(&mut self, button: &MouseButton, state: &ElementState) {
|
|
||||||
match state {
|
|
||||||
ElementState::Pressed => match button {
|
|
||||||
MouseButton::Left => self.left = true,
|
|
||||||
MouseButton::Right => self.right = true,
|
|
||||||
MouseButton::Middle => self.middle = true,
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
ElementState::Released => match button {
|
|
||||||
MouseButton::Left => self.left = false,
|
|
||||||
MouseButton::Right => self.right = false,
|
|
||||||
MouseButton::Middle => self.middle = false,
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct ClickTracker {
|
|
||||||
left: Option<ClickRecord>,
|
|
||||||
middle: Option<ClickRecord>,
|
|
||||||
right: Option<ClickRecord>,
|
|
||||||
}
|
|
||||||
impl ClickTracker {
|
|
||||||
fn input(&mut self, button: &MouseButton, state: &ElementState, position: &MousePosition) -> ClickCount {
|
|
||||||
let record = match button {
|
|
||||||
MouseButton::Left => &mut self.left,
|
|
||||||
MouseButton::Right => &mut self.right,
|
|
||||||
MouseButton::Middle => &mut self.middle,
|
|
||||||
_ => return ClickCount::Single,
|
|
||||||
};
|
|
||||||
|
|
||||||
let now = Instant::now();
|
|
||||||
|
|
||||||
let Some(record) = record else {
|
|
||||||
*record = Some(ClickRecord {
|
|
||||||
time: now,
|
|
||||||
position: position.clone(),
|
|
||||||
down_count: ClickCount::Single,
|
|
||||||
up_count: ClickCount::Single,
|
|
||||||
});
|
|
||||||
return ClickCount::Single;
|
|
||||||
};
|
|
||||||
|
|
||||||
let dx = position.x.abs_diff(record.position.x);
|
|
||||||
let dy = position.y.abs_diff(record.position.y);
|
|
||||||
let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
|
|
||||||
let within_time = now.saturating_duration_since(record.time) <= MULTICLICK_TIMEOUT;
|
|
||||||
|
|
||||||
let count = if within_time && within_dist { ClickCount::Double } else { ClickCount::Single };
|
|
||||||
|
|
||||||
*record = match state {
|
|
||||||
ElementState::Pressed => ClickRecord {
|
|
||||||
time: now,
|
|
||||||
position: position.clone(),
|
|
||||||
down_count: count.clone(),
|
|
||||||
up_count: record.up_count.clone(),
|
|
||||||
},
|
|
||||||
ElementState::Released => ClickRecord {
|
|
||||||
time: now,
|
|
||||||
position: position.clone(),
|
|
||||||
down_count: record.down_count.clone(),
|
|
||||||
up_count: count.clone(),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
enum ClickCount {
|
|
||||||
Single,
|
|
||||||
Double,
|
|
||||||
}
|
|
||||||
impl Default for ClickCount {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Single
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<ClickCount> for i32 {
|
|
||||||
fn from(count: ClickCount) -> i32 {
|
|
||||||
match count {
|
|
||||||
ClickCount::Single => 1,
|
|
||||||
ClickCount::Double => 2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ClickRecord {
|
|
||||||
time: Instant,
|
|
||||||
position: MousePosition,
|
|
||||||
down_count: ClickCount,
|
|
||||||
up_count: ClickCount,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CefModifiers(u32);
|
|
||||||
impl CefModifiers {
|
|
||||||
fn new(input_state: &InputState, location: &winit::keyboard::KeyLocation, is_repeat: bool) -> Self {
|
|
||||||
let mut inner = 0;
|
|
||||||
|
|
||||||
if input_state.modifiers.shift_key() {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_SHIFT_DOWN as u32;
|
|
||||||
}
|
|
||||||
if input_state.modifiers.control_key() {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_CONTROL_DOWN as u32;
|
|
||||||
}
|
|
||||||
if input_state.modifiers.alt_key() {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_ALT_DOWN as u32;
|
|
||||||
}
|
|
||||||
if input_state.modifiers.meta_key() {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_COMMAND_DOWN as u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
if input_state.mouse_state.left {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_LEFT_MOUSE_BUTTON as u32;
|
|
||||||
}
|
|
||||||
if input_state.mouse_state.right {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_RIGHT_MOUSE_BUTTON as u32;
|
|
||||||
}
|
|
||||||
if input_state.mouse_state.middle {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_MIDDLE_MOUSE_BUTTON as u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_repeat {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_IS_REPEAT as u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
inner |= match location {
|
|
||||||
winit::keyboard::KeyLocation::Left => cef_event_flags_t::EVENTFLAG_IS_LEFT as u32,
|
|
||||||
winit::keyboard::KeyLocation::Right => cef_event_flags_t::EVENTFLAG_IS_RIGHT as u32,
|
|
||||||
winit::keyboard::KeyLocation::Numpad => cef_event_flags_t::EVENTFLAG_IS_KEY_PAD as u32,
|
|
||||||
winit::keyboard::KeyLocation::Standard => 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
Self(inner)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn raw(&self) -> u32 {
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
#[cfg(target_os = "linux")]
|
|
||||||
use std::env;
|
|
||||||
|
|
||||||
use cef::rc::{Rc, RcImpl};
|
|
||||||
use cef::sys::{_cef_app_t, cef_base_ref_counted_t};
|
|
||||||
use cef::{BrowserProcessHandler, CefString, ImplApp, ImplCommandLine, SchemeRegistrar, WrapApp};
|
|
||||||
|
|
||||||
use super::browser_process_handler::BrowserProcessHandlerImpl;
|
|
||||||
use super::scheme_handler_factory::SchemeHandlerFactoryImpl;
|
|
||||||
use crate::cef::CefEventHandler;
|
|
||||||
|
|
||||||
pub(crate) struct BrowserProcessAppImpl<H: CefEventHandler> {
|
|
||||||
object: *mut RcImpl<_cef_app_t, Self>,
|
|
||||||
event_handler: H,
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler + Clone> BrowserProcessAppImpl<H> {
|
|
||||||
pub(crate) fn new(event_handler: H) -> Self {
|
|
||||||
Self {
|
|
||||||
object: std::ptr::null_mut(),
|
|
||||||
event_handler,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler + Clone> ImplApp for BrowserProcessAppImpl<H> {
|
|
||||||
fn browser_process_handler(&self) -> Option<BrowserProcessHandler> {
|
|
||||||
Some(BrowserProcessHandler::new(BrowserProcessHandlerImpl::new(self.event_handler.clone())))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn on_register_custom_schemes(&self, registrar: Option<&mut SchemeRegistrar>) {
|
|
||||||
SchemeHandlerFactoryImpl::<H>::register_schemes(registrar);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn on_before_command_line_processing(&self, _process_type: Option<&cef::CefString>, command_line: Option<&mut cef::CommandLine>) {
|
|
||||||
if let Some(cmd) = command_line {
|
|
||||||
#[cfg(not(feature = "accelerated_paint"))]
|
|
||||||
{
|
|
||||||
// Disable GPU acceleration when accelerated_paint feature is not enabled
|
|
||||||
cmd.append_switch(Some(&CefString::from("disable-gpu")));
|
|
||||||
cmd.append_switch(Some(&CefString::from("disable-gpu-compositing")));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
{
|
|
||||||
// Enable GPU acceleration switches for better performance
|
|
||||||
cmd.append_switch(Some(&CefString::from("enable-gpu-rasterization")));
|
|
||||||
cmd.append_switch(Some(&CefString::from("enable-accelerated-2d-canvas")));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(all(feature = "accelerated_paint", target_os = "linux"))]
|
|
||||||
{
|
|
||||||
// Use Vulkan for accelerated painting
|
|
||||||
cmd.append_switch_with_value(Some(&CefString::from("use-angle")), Some(&CefString::from("vulkan")));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tell CEF to use Wayland if available
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
{
|
|
||||||
let use_wayland = env::var("WAYLAND_DISPLAY")
|
|
||||||
.ok()
|
|
||||||
.filter(|var| !var.is_empty())
|
|
||||||
.or_else(|| env::var("WAYLAND_SOCKET").ok())
|
|
||||||
.filter(|var| !var.is_empty())
|
|
||||||
.is_some();
|
|
||||||
if use_wayland {
|
|
||||||
cmd.append_switch_with_value(Some(&CefString::from("ozone-platform")), Some(&CefString::from("wayland")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_raw(&self) -> *mut _cef_app_t {
|
|
||||||
self.object.cast()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler + Clone> Clone for BrowserProcessAppImpl<H> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
unsafe {
|
|
||||||
let rc_impl = &mut *self.object;
|
|
||||||
rc_impl.interface.add_ref();
|
|
||||||
}
|
|
||||||
Self {
|
|
||||||
object: self.object,
|
|
||||||
event_handler: self.event_handler.clone(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> Rc for BrowserProcessAppImpl<H> {
|
|
||||||
fn as_base(&self) -> &cef_base_ref_counted_t {
|
|
||||||
unsafe {
|
|
||||||
let base = &*self.object;
|
|
||||||
std::mem::transmute(&base.cef_object)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler + Clone> WrapApp for BrowserProcessAppImpl<H> {
|
|
||||||
fn wrap_rc(&mut self, object: *mut RcImpl<_cef_app_t, Self>) {
|
|
||||||
self.object = object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
use cef::rc::{Rc, RcImpl};
|
|
||||||
use cef::sys::{_cef_client_t, cef_base_ref_counted_t};
|
|
||||||
use cef::{ImplClient, LifeSpanHandler, RenderHandler, WrapClient};
|
|
||||||
|
|
||||||
use crate::cef::CefEventHandler;
|
|
||||||
use crate::cef::ipc::{MessageType, UnpackMessage, UnpackedMessage};
|
|
||||||
|
|
||||||
use super::browser_process_life_span_handler::BrowserProcessLifeSpanHandlerImpl;
|
|
||||||
|
|
||||||
pub(crate) struct BrowserProcessClientImpl<H: CefEventHandler> {
|
|
||||||
object: *mut RcImpl<_cef_client_t, Self>,
|
|
||||||
render_handler: RenderHandler,
|
|
||||||
event_handler: H,
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> BrowserProcessClientImpl<H> {
|
|
||||||
pub(crate) fn new(render_handler: RenderHandler, event_handler: H) -> Self {
|
|
||||||
Self {
|
|
||||||
object: std::ptr::null_mut(),
|
|
||||||
render_handler,
|
|
||||||
event_handler,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> ImplClient for BrowserProcessClientImpl<H> {
|
|
||||||
fn on_process_message_received(
|
|
||||||
&self,
|
|
||||||
_browser: Option<&mut cef::Browser>,
|
|
||||||
_frame: Option<&mut cef::Frame>,
|
|
||||||
_source_process: cef::ProcessId,
|
|
||||||
message: Option<&mut cef::ProcessMessage>,
|
|
||||||
) -> ::std::os::raw::c_int {
|
|
||||||
let unpacked_message = unsafe { message.and_then(|m| m.unpack()) };
|
|
||||||
match unpacked_message {
|
|
||||||
Some(UnpackedMessage {
|
|
||||||
message_type: MessageType::Initialized,
|
|
||||||
data: _,
|
|
||||||
}) => self.event_handler.initialized_web_communication(),
|
|
||||||
Some(UnpackedMessage {
|
|
||||||
message_type: MessageType::SendToNative,
|
|
||||||
data,
|
|
||||||
}) => self.event_handler.receive_web_message(data),
|
|
||||||
|
|
||||||
_ => {
|
|
||||||
tracing::error!("Unexpected message type received in browser process");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_handler(&self) -> Option<RenderHandler> {
|
|
||||||
Some(self.render_handler.clone())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn life_span_handler(&self) -> Option<cef::LifeSpanHandler> {
|
|
||||||
Some(LifeSpanHandler::new(BrowserProcessLifeSpanHandlerImpl::new()))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_raw(&self) -> *mut _cef_client_t {
|
|
||||||
self.object.cast()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> Clone for BrowserProcessClientImpl<H> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
unsafe {
|
|
||||||
let rc_impl = &mut *self.object;
|
|
||||||
rc_impl.interface.add_ref();
|
|
||||||
}
|
|
||||||
Self {
|
|
||||||
object: self.object,
|
|
||||||
render_handler: self.render_handler.clone(),
|
|
||||||
event_handler: self.event_handler.clone(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> Rc for BrowserProcessClientImpl<H> {
|
|
||||||
fn as_base(&self) -> &cef_base_ref_counted_t {
|
|
||||||
unsafe {
|
|
||||||
let base = &*self.object;
|
|
||||||
std::mem::transmute(&base.cef_object)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> WrapClient for BrowserProcessClientImpl<H> {
|
|
||||||
fn wrap_rc(&mut self, object: *mut RcImpl<_cef_client_t, Self>) {
|
|
||||||
self.object = object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
use cef::rc::{Rc, RcImpl};
|
|
||||||
use cef::sys::{_cef_render_handler_t, cef_base_ref_counted_t};
|
|
||||||
use cef::{Browser, ImplRenderHandler, PaintElementType, Rect, WrapRenderHandler};
|
|
||||||
|
|
||||||
use crate::cef::CefEventHandler;
|
|
||||||
use crate::render::FrameBufferRef;
|
|
||||||
|
|
||||||
pub(crate) struct RenderHandlerImpl<H: CefEventHandler> {
|
|
||||||
object: *mut RcImpl<_cef_render_handler_t, Self>,
|
|
||||||
event_handler: H,
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> RenderHandlerImpl<H> {
|
|
||||||
pub(crate) fn new(event_handler: H) -> Self {
|
|
||||||
Self {
|
|
||||||
object: std::ptr::null_mut(),
|
|
||||||
event_handler,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> ImplRenderHandler for RenderHandlerImpl<H> {
|
|
||||||
fn view_rect(&self, _browser: Option<&mut Browser>, rect: Option<&mut Rect>) {
|
|
||||||
if let Some(rect) = rect {
|
|
||||||
let view = self.event_handler.window_size();
|
|
||||||
*rect = Rect {
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
width: view.width as i32,
|
|
||||||
height: view.height as i32,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn on_paint(
|
|
||||||
&self,
|
|
||||||
_browser: Option<&mut Browser>,
|
|
||||||
_type_: PaintElementType,
|
|
||||||
_dirty_rect_count: usize,
|
|
||||||
_dirty_rects: Option<&Rect>,
|
|
||||||
buffer: *const u8,
|
|
||||||
width: ::std::os::raw::c_int,
|
|
||||||
height: ::std::os::raw::c_int,
|
|
||||||
) {
|
|
||||||
let buffer_size = (width * height * 4) as usize;
|
|
||||||
let buffer_slice = unsafe { std::slice::from_raw_parts(buffer, buffer_size) };
|
|
||||||
let frame_buffer = FrameBufferRef::new(buffer_slice, width as usize, height as usize).expect("Failed to create frame buffer");
|
|
||||||
|
|
||||||
self.event_handler.draw(frame_buffer)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
fn on_accelerated_paint(&self, _browser: Option<&mut Browser>, type_: PaintElementType, _dirty_rect_count: usize, _dirty_rects: Option<&Rect>, info: Option<&cef::AcceleratedPaintInfo>) {
|
|
||||||
use crate::cef::texture_import::shared_texture_handle::SharedTextureHandle;
|
|
||||||
|
|
||||||
if type_ != PaintElementType::default() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let shared_handle = SharedTextureHandle::new(info.unwrap());
|
|
||||||
if let SharedTextureHandle::Unsupported = shared_handle {
|
|
||||||
tracing::error!("Platform does not support accelerated painting");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.event_handler.draw_gpu(shared_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_raw(&self) -> *mut _cef_render_handler_t {
|
|
||||||
self.object.cast()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> Clone for RenderHandlerImpl<H> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
unsafe {
|
|
||||||
let rc_impl = &mut *self.object;
|
|
||||||
rc_impl.interface.add_ref();
|
|
||||||
}
|
|
||||||
Self {
|
|
||||||
object: self.object,
|
|
||||||
event_handler: self.event_handler.clone(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> Rc for RenderHandlerImpl<H> {
|
|
||||||
fn as_base(&self) -> &cef_base_ref_counted_t {
|
|
||||||
unsafe {
|
|
||||||
let base = &*self.object;
|
|
||||||
std::mem::transmute(&base.cef_object)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> WrapRenderHandler for RenderHandlerImpl<H> {
|
|
||||||
fn wrap_rc(&mut self, object: *mut RcImpl<_cef_render_handler_t, Self>) {
|
|
||||||
self.object = object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
//! Common utilities and traits for texture import across platforms
|
|
||||||
|
|
||||||
use crate::cef::texture_import::*;
|
|
||||||
use ash::vk;
|
|
||||||
use cef::sys::cef_color_type_t;
|
|
||||||
use wgpu::Device;
|
|
||||||
|
|
||||||
/// Common format conversion utilities
|
|
||||||
pub mod format {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
/// Convert CEF color type to wgpu texture format
|
|
||||||
pub fn cef_to_wgpu(format: cef_color_type_t) -> Result<wgpu::TextureFormat, TextureImportError> {
|
|
||||||
match format {
|
|
||||||
cef_color_type_t::CEF_COLOR_TYPE_BGRA_8888 => Ok(wgpu::TextureFormat::Bgra8UnormSrgb),
|
|
||||||
cef_color_type_t::CEF_COLOR_TYPE_RGBA_8888 => Ok(wgpu::TextureFormat::Rgba8UnormSrgb),
|
|
||||||
_ => Err(TextureImportError::UnsupportedFormat { format }),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
/// Convert CEF color type to Vulkan format
|
|
||||||
pub fn cef_to_vulkan(format: cef_color_type_t) -> Result<vk::Format, TextureImportError> {
|
|
||||||
match format {
|
|
||||||
cef_color_type_t::CEF_COLOR_TYPE_BGRA_8888 => Ok(vk::Format::B8G8R8A8_UNORM),
|
|
||||||
cef_color_type_t::CEF_COLOR_TYPE_RGBA_8888 => Ok(vk::Format::R8G8B8A8_UNORM),
|
|
||||||
_ => Err(TextureImportError::UnsupportedFormat { format }),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Common texture creation utilities
|
|
||||||
pub mod texture {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
/// Create a fallback CPU texture with the given dimensions and format
|
|
||||||
pub fn create_fallback(device: &Device, width: u32, height: u32, format: cef_color_type_t, label: &str) -> TextureImportResult {
|
|
||||||
let wgpu_format = format::cef_to_wgpu(format)?;
|
|
||||||
|
|
||||||
let texture = device.create_texture(&wgpu::TextureDescriptor {
|
|
||||||
label: Some(label),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: wgpu_format,
|
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
|
|
||||||
view_formats: &[],
|
|
||||||
});
|
|
||||||
|
|
||||||
tracing::warn!(
|
|
||||||
"Using fallback CPU texture for CEF rendering ({}x{}, {:?}) - hardware acceleration failed or unavailable. Consider checking GPU driver support.",
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
format
|
|
||||||
);
|
|
||||||
Ok(texture)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Common Vulkan utilities
|
|
||||||
pub mod vulkan {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
/// Find a suitable memory type index for Vulkan allocation
|
|
||||||
pub fn find_memory_type_index(type_filter: u32, properties: vk::MemoryPropertyFlags, mem_properties: &vk::PhysicalDeviceMemoryProperties) -> Option<u32> {
|
|
||||||
(0..mem_properties.memory_type_count).find(|&i| (type_filter & (1 << i)) != 0 && mem_properties.memory_types[i as usize].property_flags.contains(properties))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if the wgpu device is using Vulkan backend
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
pub fn is_vulkan_backend(device: &Device) -> bool {
|
|
||||||
use wgpu::hal::api;
|
|
||||||
let mut is_vulkan = false;
|
|
||||||
unsafe {
|
|
||||||
device.as_hal::<api::Vulkan, _, _>(|device| {
|
|
||||||
is_vulkan = device.is_some();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
is_vulkan
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if the wgpu device is using D3D12 backend
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
pub fn is_d3d12_backend(device: &Device) -> bool {
|
|
||||||
use wgpu::hal::api;
|
|
||||||
let mut is_d3d12 = false;
|
|
||||||
unsafe {
|
|
||||||
device.as_hal::<api::Dx12, _, _>(|device| {
|
|
||||||
is_d3d12 = device.is_some();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
is_d3d12
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,289 +0,0 @@
|
|||||||
//! Windows D3D11 shared texture import implementation
|
|
||||||
|
|
||||||
use super::common::{format, texture, vulkan};
|
|
||||||
use super::{TextureImportError, TextureImportResult, TextureImporter};
|
|
||||||
use ash::vk;
|
|
||||||
use cef::{AcceleratedPaintInfo, sys::cef_color_type_t};
|
|
||||||
use std::os::raw::c_void;
|
|
||||||
use wgpu::hal::api;
|
|
||||||
|
|
||||||
pub struct D3D11Importer {
|
|
||||||
pub handle: *mut c_void,
|
|
||||||
pub format: cef_color_type_t,
|
|
||||||
pub width: u32,
|
|
||||||
pub height: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TextureImporter for D3D11Importer {
|
|
||||||
fn new(info: &AcceleratedPaintInfo) -> Self {
|
|
||||||
Self {
|
|
||||||
handle: info.shared_texture_handle,
|
|
||||||
format: *info.format.as_ref(),
|
|
||||||
width: info.extra.coded_size.width as u32,
|
|
||||||
height: info.extra.coded_size.height as u32,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn import_to_wgpu(&self, device: &wgpu::Device) -> TextureImportResult {
|
|
||||||
// Try hardware acceleration first
|
|
||||||
if self.supports_hardware_acceleration(device) {
|
|
||||||
// Try D3D12 first (most efficient on Windows)
|
|
||||||
if vulkan::is_d3d12_backend(device) {
|
|
||||||
match self.import_via_d3d12(device) {
|
|
||||||
Ok(texture) => {
|
|
||||||
tracing::info!("Successfully imported D3D11 shared texture via D3D12");
|
|
||||||
return Ok(texture);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::warn!("Failed to import D3D11 via D3D12: {}, trying Vulkan fallback", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try Vulkan as fallback
|
|
||||||
if vulkan::is_vulkan_backend(device) {
|
|
||||||
match self.import_via_vulkan(device) {
|
|
||||||
Ok(texture) => {
|
|
||||||
tracing::info!("Successfully imported D3D11 shared texture via Vulkan");
|
|
||||||
return Ok(texture);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::warn!("Failed to import D3D11 via Vulkan: {}, falling back to CPU texture", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback to CPU texture
|
|
||||||
texture::create_fallback(device, self.width, self.height, self.format, "CEF D3D11 Texture (fallback)")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn supports_hardware_acceleration(&self, device: &wgpu::Device) -> bool {
|
|
||||||
// Check if handle is valid
|
|
||||||
if self.handle.is_null() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if wgpu is using D3D12 or Vulkan backend
|
|
||||||
vulkan::is_d3d12_backend(device) || vulkan::is_vulkan_backend(device)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl D3D11Importer {
|
|
||||||
fn import_via_d3d12(&self, device: &wgpu::Device) -> TextureImportResult {
|
|
||||||
// Get wgpu's D3D12 device
|
|
||||||
use wgpu::hal::api;
|
|
||||||
let hal_texture = unsafe {
|
|
||||||
device.as_hal::<api::Dx12, _, _>(|device| {
|
|
||||||
let Some(device) = device else {
|
|
||||||
return Err(TextureImportError::HardwareUnavailable {
|
|
||||||
reason: "Device is not using D3D12 backend".to_string(),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Import D3D11 shared handle directly into D3D12 resource
|
|
||||||
let d3d12_resource = self.import_d3d11_handle_to_d3d12(device)?;
|
|
||||||
|
|
||||||
// Wrap D3D12 resource in wgpu-hal texture
|
|
||||||
let hal_texture = <api::Dx12 as wgpu::hal::Api>::Device::texture_from_raw(
|
|
||||||
d3d12_resource,
|
|
||||||
format::cef_to_wgpu(self.format)?,
|
|
||||||
wgpu::TextureDimension::D2,
|
|
||||||
wgpu::Extent3d {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
1, // mip_level_count
|
|
||||||
1, // sample_count
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(hal_texture)
|
|
||||||
})
|
|
||||||
}?;
|
|
||||||
|
|
||||||
// Import hal texture into wgpu
|
|
||||||
let texture = unsafe {
|
|
||||||
device.create_texture_from_hal::<api::Dx12>(
|
|
||||||
hal_texture,
|
|
||||||
&wgpu::TextureDescriptor {
|
|
||||||
label: Some("CEF D3D11→D3D12 Shared Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: format::cef_to_wgpu(self.format)?,
|
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING,
|
|
||||||
view_formats: &[],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(texture)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn import_via_vulkan(&self, device: &wgpu::Device) -> TextureImportResult {
|
|
||||||
// Get wgpu's Vulkan instance and device
|
|
||||||
use wgpu::{TextureUses, wgc::api::Vulkan};
|
|
||||||
let hal_texture = unsafe {
|
|
||||||
device.as_hal::<api::Vulkan, _, _>(|device| {
|
|
||||||
let Some(device) = device else {
|
|
||||||
return Err(TextureImportError::HardwareUnavailable {
|
|
||||||
reason: "Device is not using Vulkan backend".to_string(),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Import D3D11 shared handle into Vulkan
|
|
||||||
let vk_image = self.import_d3d11_handle_to_vulkan(device)?;
|
|
||||||
|
|
||||||
// Wrap VkImage in wgpu-hal texture
|
|
||||||
let hal_texture = <api::Vulkan as wgpu::hal::Api>::Device::texture_from_raw(
|
|
||||||
vk_image,
|
|
||||||
&wgpu::hal::TextureDescriptor {
|
|
||||||
label: Some("CEF D3D11 Shared Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: format::cef_to_wgpu(self.format)?,
|
|
||||||
usage: TextureUses::COPY_DST | TextureUses::RESOURCE,
|
|
||||||
memory_flags: wgpu::hal::MemoryFlags::empty(),
|
|
||||||
view_formats: vec![],
|
|
||||||
},
|
|
||||||
None, // drop_callback
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(hal_texture)
|
|
||||||
})
|
|
||||||
}?;
|
|
||||||
|
|
||||||
// Import hal texture into wgpu
|
|
||||||
let texture = unsafe {
|
|
||||||
device.create_texture_from_hal::<Vulkan>(
|
|
||||||
hal_texture,
|
|
||||||
&wgpu::TextureDescriptor {
|
|
||||||
label: Some("CEF D3D11 Shared Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: format::cef_to_wgpu(self.format)?,
|
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING,
|
|
||||||
view_formats: &[],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(texture)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn import_d3d11_handle_to_vulkan(&self, hal_device: &<api::Vulkan as wgpu::hal::Api>::Device) -> Result<vk::Image, TextureImportError> {
|
|
||||||
// Get raw Vulkan handles
|
|
||||||
let device = hal_device.raw_device();
|
|
||||||
let _instance = hal_device.shared_instance().raw_instance();
|
|
||||||
|
|
||||||
// Validate dimensions
|
|
||||||
if self.width == 0 || self.height == 0 {
|
|
||||||
return Err(TextureImportError::InvalidHandle("Invalid D3D11 texture dimensions".to_string()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create external memory image info
|
|
||||||
let mut external_memory_info = vk::ExternalMemoryImageCreateInfo::default().handle_types(vk::ExternalMemoryHandleTypeFlags::D3D11_TEXTURE);
|
|
||||||
|
|
||||||
// Create image create info
|
|
||||||
let image_create_info = vk::ImageCreateInfo::default()
|
|
||||||
.image_type(vk::ImageType::TYPE_2D)
|
|
||||||
.format(format::cef_to_vulkan(self.format)?)
|
|
||||||
.extent(vk::Extent3D {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth: 1,
|
|
||||||
})
|
|
||||||
.mip_levels(1)
|
|
||||||
.array_layers(1)
|
|
||||||
.samples(vk::SampleCountFlags::TYPE_1)
|
|
||||||
.tiling(vk::ImageTiling::OPTIMAL)
|
|
||||||
.usage(vk::ImageUsageFlags::SAMPLED | vk::ImageUsageFlags::COLOR_ATTACHMENT)
|
|
||||||
.sharing_mode(vk::SharingMode::EXCLUSIVE)
|
|
||||||
.push_next(&mut external_memory_info);
|
|
||||||
|
|
||||||
// Create the image
|
|
||||||
let image = unsafe {
|
|
||||||
device.create_image(&image_create_info, None).map_err(|e| TextureImportError::VulkanError {
|
|
||||||
operation: format!("Failed to create Vulkan image: {:?}", e),
|
|
||||||
})?
|
|
||||||
};
|
|
||||||
|
|
||||||
// Get memory requirements
|
|
||||||
let memory_requirements = unsafe { device.get_image_memory_requirements(image) };
|
|
||||||
|
|
||||||
// Import D3D11 handle
|
|
||||||
let mut import_memory_win32 = vk::ImportMemoryWin32HandleInfoKHR::default()
|
|
||||||
.handle_type(vk::ExternalMemoryHandleTypeFlags::D3D11_TEXTURE)
|
|
||||||
.handle(self.handle as isize);
|
|
||||||
|
|
||||||
// Find a suitable memory type
|
|
||||||
let memory_properties = unsafe { hal_device.shared_instance().raw_instance().get_physical_device_memory_properties(hal_device.raw_physical_device()) };
|
|
||||||
|
|
||||||
let memory_type_index =
|
|
||||||
vulkan::find_memory_type_index(memory_requirements.memory_type_bits, vk::MemoryPropertyFlags::empty(), &memory_properties).ok_or_else(|| TextureImportError::VulkanError {
|
|
||||||
operation: "Failed to find suitable memory type for D3D11 texture".to_string(),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let allocate_info = vk::MemoryAllocateInfo::default()
|
|
||||||
.allocation_size(memory_requirements.size)
|
|
||||||
.memory_type_index(memory_type_index)
|
|
||||||
.push_next(&mut import_memory_win32);
|
|
||||||
|
|
||||||
let device_memory = unsafe {
|
|
||||||
device.allocate_memory(&allocate_info, None).map_err(|e| TextureImportError::VulkanError {
|
|
||||||
operation: format!("Failed to allocate memory for D3D11 texture: {:?}", e),
|
|
||||||
})?
|
|
||||||
};
|
|
||||||
|
|
||||||
// Bind memory to image
|
|
||||||
unsafe {
|
|
||||||
device.bind_image_memory(image, device_memory, 0).map_err(|e| TextureImportError::VulkanError {
|
|
||||||
operation: format!("Failed to bind memory to image: {:?}", e),
|
|
||||||
})?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(image)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn import_d3d11_handle_to_d3d12(&self, hal_device: &<wgpu::hal::api::Dx12 as wgpu::hal::Api>::Device) -> Result<windows::Win32::Graphics::Direct3D12::ID3D12Resource, TextureImportError> {
|
|
||||||
use windows::Win32::Graphics::Direct3D12::*;
|
|
||||||
|
|
||||||
// Get D3D12 device from wgpu-hal
|
|
||||||
let d3d12_device = hal_device.raw_device();
|
|
||||||
|
|
||||||
// Validate dimensions
|
|
||||||
if self.width == 0 || self.height == 0 {
|
|
||||||
return Err(TextureImportError::InvalidHandle("Invalid D3D11 texture dimensions".to_string()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open D3D11 shared handle on D3D12 device
|
|
||||||
unsafe {
|
|
||||||
let mut shared_resource: Option<ID3D12Resource> = None;
|
|
||||||
d3d12_device
|
|
||||||
.OpenSharedHandle(windows::Win32::Foundation::HANDLE(self.handle), &mut shared_resource)
|
|
||||||
.map_err(|e| TextureImportError::PlatformError {
|
|
||||||
message: format!("Failed to open D3D11 shared handle on D3D12: {:?}", e),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
shared_resource.ok_or_else(|| TextureImportError::InvalidHandle("Failed to get D3D12 resource from shared handle".to_string()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,273 +0,0 @@
|
|||||||
//! Linux DMA-BUF texture import implementation
|
|
||||||
|
|
||||||
use super::common::{format, texture, vulkan};
|
|
||||||
use super::{TextureImportError, TextureImportResult, TextureImporter};
|
|
||||||
use ash::vk;
|
|
||||||
use cef::{AcceleratedPaintInfo, sys::cef_color_type_t};
|
|
||||||
use wgpu::hal::api;
|
|
||||||
|
|
||||||
pub(crate) struct DmaBufImporter {
|
|
||||||
fds: Vec<std::os::fd::RawFd>,
|
|
||||||
format: cef_color_type_t,
|
|
||||||
modifier: u64,
|
|
||||||
width: u32,
|
|
||||||
height: u32,
|
|
||||||
strides: Vec<u32>,
|
|
||||||
offsets: Vec<u32>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TextureImporter for DmaBufImporter {
|
|
||||||
fn new(info: &AcceleratedPaintInfo) -> Self {
|
|
||||||
Self {
|
|
||||||
fds: extract_fds_from_info(info),
|
|
||||||
format: *info.format.as_ref(),
|
|
||||||
modifier: info.modifier,
|
|
||||||
width: info.extra.coded_size.width as u32,
|
|
||||||
height: info.extra.coded_size.height as u32,
|
|
||||||
strides: extract_strides_from_info(info),
|
|
||||||
offsets: extract_offsets_from_info(info),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn import_to_wgpu(&self, device: &wgpu::Device) -> TextureImportResult {
|
|
||||||
// Try hardware acceleration first
|
|
||||||
if self.supports_hardware_acceleration(device) {
|
|
||||||
match self.import_via_vulkan(device) {
|
|
||||||
Ok(texture) => {
|
|
||||||
tracing::info!("Successfully imported DMA-BUF texture via Vulkan");
|
|
||||||
return Ok(texture);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::warn!("Failed to import DMA-BUF via Vulkan: {}, falling back to CPU texture", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback to CPU texture
|
|
||||||
texture::create_fallback(device, self.width, self.height, self.format, "CEF DMA-BUF Texture (fallback)")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn supports_hardware_acceleration(&self, device: &wgpu::Device) -> bool {
|
|
||||||
// Check if we have valid file descriptors
|
|
||||||
if self.fds.is_empty() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for &fd in &self.fds {
|
|
||||||
if fd < 0 {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Check if file descriptor is valid
|
|
||||||
let flags = unsafe { libc::fcntl(fd, libc::F_GETFD) };
|
|
||||||
if flags == -1 {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if wgpu is using Vulkan backend
|
|
||||||
vulkan::is_vulkan_backend(device)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DmaBufImporter {
|
|
||||||
fn import_via_vulkan(&self, device: &wgpu::Device) -> TextureImportResult {
|
|
||||||
// Get wgpu's Vulkan instance and device
|
|
||||||
use wgpu::{TextureUses, wgc::api::Vulkan};
|
|
||||||
let hal_texture = unsafe {
|
|
||||||
device.as_hal::<api::Vulkan, _, _>(|device| {
|
|
||||||
let Some(device) = device else {
|
|
||||||
return Err(TextureImportError::HardwareUnavailable {
|
|
||||||
reason: "Device is not using Vulkan backend".to_string(),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create VkImage from DMA-BUF using external memory
|
|
||||||
let vk_image = self.create_vulkan_image_from_dmabuf(device)?;
|
|
||||||
|
|
||||||
// Wrap VkImage in wgpu-hal texture
|
|
||||||
let hal_texture = <api::Vulkan as wgpu::hal::Api>::Device::texture_from_raw(
|
|
||||||
vk_image,
|
|
||||||
&wgpu::hal::TextureDescriptor {
|
|
||||||
label: Some("CEF DMA-BUF Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: format::cef_to_wgpu(self.format)?,
|
|
||||||
usage: TextureUses::COPY_DST | TextureUses::RESOURCE,
|
|
||||||
memory_flags: wgpu::hal::MemoryFlags::empty(),
|
|
||||||
view_formats: vec![],
|
|
||||||
},
|
|
||||||
None, // drop_callback
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(hal_texture)
|
|
||||||
})
|
|
||||||
}?;
|
|
||||||
|
|
||||||
// Import hal texture into wgpu
|
|
||||||
let texture = unsafe {
|
|
||||||
device.create_texture_from_hal::<Vulkan>(
|
|
||||||
hal_texture,
|
|
||||||
&wgpu::TextureDescriptor {
|
|
||||||
label: Some("CEF DMA-BUF Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: format::cef_to_wgpu(self.format)?,
|
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING,
|
|
||||||
view_formats: &[],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(texture)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_vulkan_image_from_dmabuf(&self, hal_device: &<api::Vulkan as wgpu::hal::Api>::Device) -> Result<vk::Image, TextureImportError> {
|
|
||||||
// Get raw Vulkan handles
|
|
||||||
let device = hal_device.raw_device();
|
|
||||||
let _instance = hal_device.shared_instance().raw_instance();
|
|
||||||
|
|
||||||
// Validate dimensions
|
|
||||||
if self.width == 0 || self.height == 0 {
|
|
||||||
return Err(TextureImportError::InvalidHandle("Invalid DMA-BUF dimensions".to_string()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create external memory image
|
|
||||||
let image_create_info = vk::ImageCreateInfo::default()
|
|
||||||
.image_type(vk::ImageType::TYPE_2D)
|
|
||||||
.format(format::cef_to_vulkan(self.format)?)
|
|
||||||
.extent(vk::Extent3D {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth: 1,
|
|
||||||
})
|
|
||||||
.mip_levels(1)
|
|
||||||
.array_layers(1)
|
|
||||||
.samples(vk::SampleCountFlags::TYPE_1)
|
|
||||||
.tiling(vk::ImageTiling::DRM_FORMAT_MODIFIER_EXT)
|
|
||||||
.usage(vk::ImageUsageFlags::SAMPLED | vk::ImageUsageFlags::COLOR_ATTACHMENT)
|
|
||||||
.sharing_mode(vk::SharingMode::EXCLUSIVE);
|
|
||||||
|
|
||||||
// Set up DRM format modifier
|
|
||||||
let plane_layouts = self.create_subresource_layouts()?;
|
|
||||||
let mut drm_format_modifier = vk::ImageDrmFormatModifierExplicitCreateInfoEXT::default()
|
|
||||||
.drm_format_modifier(self.modifier)
|
|
||||||
.plane_layouts(&plane_layouts);
|
|
||||||
|
|
||||||
let image_create_info = image_create_info.push_next(&mut drm_format_modifier);
|
|
||||||
|
|
||||||
// Create the image
|
|
||||||
let image = unsafe {
|
|
||||||
device.create_image(&image_create_info, None).map_err(|e| TextureImportError::VulkanError {
|
|
||||||
operation: format!("Failed to create Vulkan image: {e:?}"),
|
|
||||||
})?
|
|
||||||
};
|
|
||||||
|
|
||||||
// Import memory from DMA-BUF
|
|
||||||
let memory_requirements = unsafe { device.get_image_memory_requirements(image) };
|
|
||||||
|
|
||||||
// Duplicate the file descriptor to avoid ownership issues
|
|
||||||
let dup_fd = unsafe { libc::dup(self.fds[0]) };
|
|
||||||
if dup_fd == -1 {
|
|
||||||
return Err(TextureImportError::PlatformError {
|
|
||||||
message: "Failed to duplicate DMA-BUF file descriptor".to_string(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut import_memory_fd = vk::ImportMemoryFdInfoKHR::default().handle_type(vk::ExternalMemoryHandleTypeFlags::DMA_BUF_EXT).fd(dup_fd);
|
|
||||||
|
|
||||||
// Find a suitable memory type
|
|
||||||
let memory_properties = unsafe { hal_device.shared_instance().raw_instance().get_physical_device_memory_properties(hal_device.raw_physical_device()) };
|
|
||||||
|
|
||||||
let memory_type_index =
|
|
||||||
vulkan::find_memory_type_index(memory_requirements.memory_type_bits, vk::MemoryPropertyFlags::empty(), &memory_properties).ok_or_else(|| TextureImportError::VulkanError {
|
|
||||||
operation: "Failed to find suitable memory type for DMA-BUF".to_string(),
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let allocate_info = vk::MemoryAllocateInfo::default()
|
|
||||||
.allocation_size(memory_requirements.size)
|
|
||||||
.memory_type_index(memory_type_index)
|
|
||||||
.push_next(&mut import_memory_fd);
|
|
||||||
|
|
||||||
let device_memory = unsafe {
|
|
||||||
device.allocate_memory(&allocate_info, None).map_err(|e| TextureImportError::VulkanError {
|
|
||||||
operation: format!("Failed to allocate memory for DMA-BUF: {e:?}"),
|
|
||||||
})?
|
|
||||||
};
|
|
||||||
|
|
||||||
// Bind memory to image
|
|
||||||
unsafe {
|
|
||||||
device.bind_image_memory(image, device_memory, 0).map_err(|e| TextureImportError::VulkanError {
|
|
||||||
operation: format!("Failed to bind memory to image: {e:?}"),
|
|
||||||
})?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(image)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_subresource_layouts(&self) -> Result<Vec<vk::SubresourceLayout>, TextureImportError> {
|
|
||||||
let mut layouts = Vec::new();
|
|
||||||
|
|
||||||
for i in 0..self.fds.len() {
|
|
||||||
layouts.push(vk::SubresourceLayout {
|
|
||||||
offset: self.offsets.get(i).copied().unwrap_or(0) as u64,
|
|
||||||
size: 0, // Will be calculated by driver
|
|
||||||
row_pitch: self.strides.get(i).copied().unwrap_or(0) as u64,
|
|
||||||
array_pitch: 0,
|
|
||||||
depth_pitch: 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(layouts)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn extract_fds_from_info(info: &cef::AcceleratedPaintInfo) -> Vec<std::os::fd::RawFd> {
|
|
||||||
let plane_count = info.plane_count as usize;
|
|
||||||
let mut fds = Vec::with_capacity(plane_count);
|
|
||||||
|
|
||||||
for i in 0..plane_count {
|
|
||||||
if let Some(plane) = info.planes.get(i) {
|
|
||||||
fds.push(plane.fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fds
|
|
||||||
}
|
|
||||||
|
|
||||||
fn extract_strides_from_info(info: &cef::AcceleratedPaintInfo) -> Vec<u32> {
|
|
||||||
let plane_count = info.plane_count as usize;
|
|
||||||
let mut strides = Vec::with_capacity(plane_count);
|
|
||||||
|
|
||||||
for i in 0..plane_count {
|
|
||||||
if let Some(plane) = info.planes.get(i) {
|
|
||||||
strides.push(plane.stride);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
strides
|
|
||||||
}
|
|
||||||
|
|
||||||
fn extract_offsets_from_info(info: &cef::AcceleratedPaintInfo) -> Vec<u32> {
|
|
||||||
let plane_count = info.plane_count as usize;
|
|
||||||
let mut offsets = Vec::with_capacity(plane_count);
|
|
||||||
|
|
||||||
for i in 0..plane_count {
|
|
||||||
if let Some(plane) = info.planes.get(i) {
|
|
||||||
offsets.push(plane.offset as u32);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
offsets
|
|
||||||
}
|
|
||||||
@@ -1,182 +0,0 @@
|
|||||||
//! macOS IOSurface texture import implementation
|
|
||||||
|
|
||||||
use super::common::{format, texture};
|
|
||||||
use super::{TextureImportError, TextureImportResult, TextureImporter};
|
|
||||||
use cef::{AcceleratedPaintInfo, sys::cef_color_type_t};
|
|
||||||
use core_foundation::base::{CFType, TCFType};
|
|
||||||
use objc2_io_surface::{IOSurface, IOSurfaceRef};
|
|
||||||
use objc2_metal::{MTLDevice, MTLPixelFormat, MTLTexture, MTLTextureDescriptor, MTLTextureType, MTLTextureUsage};
|
|
||||||
use std::os::raw::c_void;
|
|
||||||
use wgpu::hal::api;
|
|
||||||
|
|
||||||
pub struct IOSurfaceImporter {
|
|
||||||
pub handle: *mut c_void,
|
|
||||||
pub format: cef_color_type_t,
|
|
||||||
pub width: u32,
|
|
||||||
pub height: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TextureImporter for IOSurfaceImporter {
|
|
||||||
fn new(info: &AcceleratedPaintInfo) -> Self {
|
|
||||||
Self {
|
|
||||||
handle: info.shared_texture_handle,
|
|
||||||
format: *info.format.as_ref(),
|
|
||||||
width: info.extra.coded_size.width as u32,
|
|
||||||
height: info.extra.coded_size.height as u32,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn import_to_wgpu(&self, device: &wgpu::Device) -> TextureImportResult {
|
|
||||||
// Try hardware acceleration first
|
|
||||||
if self.supports_hardware_acceleration(device) {
|
|
||||||
match self.import_via_metal(device) {
|
|
||||||
Ok(texture) => {
|
|
||||||
tracing::trace!("Successfully imported IOSurface texture via Metal");
|
|
||||||
return Ok(texture);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::warn!("Failed to import IOSurface via Metal: {}, falling back to CPU texture", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback to CPU texture
|
|
||||||
texture::create_fallback(device, self.width, self.height, self.format, "CEF IOSurface Texture (fallback)")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn supports_hardware_acceleration(&self, device: &wgpu::Device) -> bool {
|
|
||||||
// Check if handle is valid
|
|
||||||
if self.handle.is_null() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if wgpu is using Metal backend
|
|
||||||
self.is_metal_backend(device)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl IOSurfaceImporter {
|
|
||||||
fn import_via_metal(&self, device: &wgpu::Device) -> TextureImportResult {
|
|
||||||
// Get wgpu's Metal device
|
|
||||||
use wgpu::{hal::Api, wgc::api::Metal};
|
|
||||||
let hal_texture = unsafe {
|
|
||||||
device.as_hal::<api::Metal, _, _>(|device| {
|
|
||||||
let Some(device) = device else {
|
|
||||||
return Err(TextureImportError::HardwareUnavailable {
|
|
||||||
reason: "Device is not using Metal backend".to_string(),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Import IOSurface handle into Metal texture
|
|
||||||
let metal_texture = self.import_iosurface_to_metal(device)?;
|
|
||||||
|
|
||||||
// Wrap Metal texture in wgpu-hal texture
|
|
||||||
let hal_texture = <api::Metal as wgpu::hal::Api>::Device::texture_from_raw(
|
|
||||||
metal_texture,
|
|
||||||
&wgpu::hal::TextureDescriptor {
|
|
||||||
label: Some("CEF IOSurface Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: format::cef_to_wgpu(self.format)?,
|
|
||||||
usage: wgpu::hal::TextureUses::RESOURCE,
|
|
||||||
memory_flags: wgpu::hal::MemoryFlags::empty(),
|
|
||||||
view_formats: vec![],
|
|
||||||
},
|
|
||||||
None, // drop_callback
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(hal_texture)
|
|
||||||
})
|
|
||||||
}?;
|
|
||||||
|
|
||||||
// Import hal texture into wgpu
|
|
||||||
let texture = unsafe {
|
|
||||||
device.create_texture_from_hal::<Metal>(
|
|
||||||
hal_texture,
|
|
||||||
&wgpu::TextureDescriptor {
|
|
||||||
label: Some("CEF IOSurface Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: format::cef_to_wgpu(self.format)?,
|
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING,
|
|
||||||
view_formats: &[],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(texture)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn import_iosurface_to_metal(&self, hal_device: &<api::Metal as wgpu::hal::Api>::Device) -> Result<<api::Metal as wgpu::hal::Api>::Texture, TextureImportError> {
|
|
||||||
// Validate dimensions
|
|
||||||
if self.width == 0 || self.height == 0 {
|
|
||||||
return Err(TextureImportError::InvalidHandle("Invalid IOSurface texture dimensions".to_string()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert handle to IOSurface
|
|
||||||
let iosurface = unsafe {
|
|
||||||
let cf_type = CFType::wrap_under_get_rule(self.handle as IOSurfaceRef);
|
|
||||||
IOSurface::from(cf_type)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Get the Metal device from wgpu-hal
|
|
||||||
let metal_device = hal_device.raw_device();
|
|
||||||
|
|
||||||
// Convert CEF format to Metal pixel format
|
|
||||||
let metal_format = self.cef_to_metal_format(self.format)?;
|
|
||||||
|
|
||||||
// Create Metal texture descriptor
|
|
||||||
let texture_descriptor = MTLTextureDescriptor::new();
|
|
||||||
texture_descriptor.setTextureType(MTLTextureType::Type2D);
|
|
||||||
texture_descriptor.setPixelFormat(metal_format);
|
|
||||||
texture_descriptor.setWidth(self.width as usize);
|
|
||||||
texture_descriptor.setHeight(self.height as usize);
|
|
||||||
texture_descriptor.setDepth(1);
|
|
||||||
texture_descriptor.setMipmapLevelCount(1);
|
|
||||||
texture_descriptor.setSampleCount(1);
|
|
||||||
texture_descriptor.setUsage(MTLTextureUsage::ShaderRead);
|
|
||||||
|
|
||||||
// Create Metal texture from IOSurface
|
|
||||||
let metal_texture = unsafe { metal_device.newTextureWithDescriptor_iosurface_plane(&texture_descriptor, &iosurface, 0) };
|
|
||||||
|
|
||||||
let Some(metal_texture) = metal_texture else {
|
|
||||||
return Err(TextureImportError::PlatformError {
|
|
||||||
message: "Failed to create Metal texture from IOSurface".to_string(),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
tracing::trace!("Successfully created Metal texture from IOSurface");
|
|
||||||
Ok(metal_texture)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cef_to_metal_format(&self, format: cef_color_type_t) -> Result<MTLPixelFormat, TextureImportError> {
|
|
||||||
match format {
|
|
||||||
cef_color_type_t::CEF_COLOR_TYPE_BGRA_8888 => Ok(MTLPixelFormat::BGRA8Unorm_sRGB),
|
|
||||||
cef_color_type_t::CEF_COLOR_TYPE_RGBA_8888 => Ok(MTLPixelFormat::RGBA8Unorm_sRGB),
|
|
||||||
_ => Err(TextureImportError::UnsupportedFormat { format }),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_metal_backend(&self, device: &wgpu::Device) -> bool {
|
|
||||||
use wgpu::hal::api;
|
|
||||||
let mut is_metal = false;
|
|
||||||
unsafe {
|
|
||||||
device.as_hal::<api::Metal, _, _>(|device| {
|
|
||||||
is_metal = device.is_some();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
is_metal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
//! Unified texture import system for CEF hardware acceleration
|
|
||||||
//!
|
|
||||||
//! This module provides a platform-agnostic interface for importing shared textures
|
|
||||||
//! from CEF into wgpu, with automatic fallback to CPU textures when hardware
|
|
||||||
//! acceleration is not available.
|
|
||||||
//!
|
|
||||||
//! # Supported Platforms
|
|
||||||
//!
|
|
||||||
//! - **Linux**: DMA-BUF via Vulkan external memory
|
|
||||||
//! - **Windows**: D3D11 shared textures via Vulkan interop
|
|
||||||
//! - **macOS**: IOSurface via Metal native API
|
|
||||||
//!
|
|
||||||
//! # Usage
|
|
||||||
//!
|
|
||||||
//! ```no_run
|
|
||||||
//! // Import texture with automatic platform detection
|
|
||||||
//! let texture = shared_handle.import_texture(&device)?;
|
|
||||||
//! ```
|
|
||||||
//!
|
|
||||||
//! # Features
|
|
||||||
//!
|
|
||||||
//! - `accelerated_paint` - Base feature for texture import
|
|
||||||
//! - `accelerated_paint_dmabuf` - Linux DMA-BUF support
|
|
||||||
//! - `accelerated_paint_d3d11` - Windows D3D11 support
|
|
||||||
//! - `accelerated_paint_iosurface` - macOS IOSurface support
|
|
||||||
|
|
||||||
pub(crate) mod common;
|
|
||||||
|
|
||||||
pub(crate) mod shared_texture_handle;
|
|
||||||
pub(crate) use shared_texture_handle::SharedTextureHandle;
|
|
||||||
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
pub(crate) mod dmabuf;
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
pub(crate) mod d3d11;
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
pub(crate) mod iosurface;
|
|
||||||
|
|
||||||
/// Result type for texture import operations
|
|
||||||
pub type TextureImportResult = Result<wgpu::Texture, TextureImportError>;
|
|
||||||
|
|
||||||
/// Errors that can occur during texture import
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
|
||||||
pub enum TextureImportError {
|
|
||||||
#[error("Invalid texture handle: {0}")]
|
|
||||||
InvalidHandle(String),
|
|
||||||
|
|
||||||
#[error("Unsupported texture format: {format:?}")]
|
|
||||||
UnsupportedFormat { format: cef::sys::cef_color_type_t },
|
|
||||||
|
|
||||||
#[error("Hardware acceleration not available: {reason}")]
|
|
||||||
HardwareUnavailable { reason: String },
|
|
||||||
|
|
||||||
#[error("Vulkan operation failed: {operation}")]
|
|
||||||
VulkanError { operation: String },
|
|
||||||
|
|
||||||
#[error("Platform-specific error: {message}")]
|
|
||||||
PlatformError { message: String },
|
|
||||||
|
|
||||||
#[error("Unsupported platform for texture import")]
|
|
||||||
UnsupportedPlatform,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Trait for platform-specific texture importers
|
|
||||||
pub trait TextureImporter {
|
|
||||||
fn new(info: &cef::AcceleratedPaintInfo) -> Self;
|
|
||||||
|
|
||||||
/// Import the texture into wgpu, with automatic fallback to CPU texture
|
|
||||||
fn import_to_wgpu(&self, device: &wgpu::Device) -> TextureImportResult;
|
|
||||||
|
|
||||||
/// Check if hardware acceleration is available for this texture
|
|
||||||
fn supports_hardware_acceleration(&self, device: &wgpu::Device) -> bool;
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
use cef::AcceleratedPaintInfo;
|
|
||||||
|
|
||||||
use super::{TextureImportError, TextureImportResult, TextureImporter};
|
|
||||||
|
|
||||||
pub(crate) enum SharedTextureHandle {
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
DmaBuf(super::dmabuf::DmaBufImporter),
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
D3D11(super::d3d11::D3D11Importer),
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
IOSurface(super::iosurface::IOSurfaceImporter),
|
|
||||||
Unsupported,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SharedTextureHandle {
|
|
||||||
pub(crate) fn new(info: &AcceleratedPaintInfo) -> Self {
|
|
||||||
// Extract DMA-BUF information
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
return Self::DmaBuf(super::dmabuf::DmaBufImporter::new(info));
|
|
||||||
|
|
||||||
// Extract D3D11 shared handle with texture metadata
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
return Self::D3D11(super::d3d11::D3D11Importer::new(info));
|
|
||||||
|
|
||||||
// Extract IOSurface handle with texture metadata
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
return Self::IOSurface(super::iosurface::IOSurfaceImporter::new(info));
|
|
||||||
|
|
||||||
#[allow(unreachable_code)]
|
|
||||||
Self::Unsupported
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Import a texture using the appropriate platform-specific importer
|
|
||||||
pub(crate) fn import_texture(self, device: &wgpu::Device) -> TextureImportResult {
|
|
||||||
match self {
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
SharedTextureHandle::DmaBuf(importer) => importer.import_to_wgpu(device),
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
SharedTextureHandle::D3D11(importer) => importer.import_to_wgpu(device),
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
SharedTextureHandle::IOSurface(importer) => importer.import_to_wgpu(device),
|
|
||||||
SharedTextureHandle::Unsupported => Err(TextureImportError::UnsupportedPlatform),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#[derive(clap::Parser)]
|
||||||
|
#[clap(name = "graphite", version)]
|
||||||
|
pub struct Cli {
|
||||||
|
#[arg(help = "Files to open on startup")]
|
||||||
|
pub files: Vec<std::path::PathBuf>,
|
||||||
|
|
||||||
|
#[arg(long, action = clap::ArgAction::SetTrue, help = "Disable hardware accelerated UI rendering")]
|
||||||
|
pub disable_ui_acceleration: bool,
|
||||||
|
}
|
||||||
+13
-10
@@ -1,11 +1,14 @@
|
|||||||
pub(crate) static APP_NAME: &str = "Graphite";
|
pub(crate) const APP_NAME: &str = "Graphite";
|
||||||
pub(crate) static APP_ID: &str = "rs.graphite.GraphiteEditor";
|
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||||
|
pub(crate) const APP_ID: &str = "art.graphite.Graphite";
|
||||||
|
|
||||||
pub(crate) static APP_DIRECTORY_NAME: &str = "graphite-editor";
|
#[cfg(target_os = "linux")]
|
||||||
pub(crate) static APP_STATE_FILE_NAME: &str = "state.ron";
|
pub(crate) const APP_DIRECTORY_NAME: &str = "graphite";
|
||||||
pub(crate) static APP_PREFERENCES_FILE_NAME: &str = "preferences.ron";
|
#[cfg(not(target_os = "linux"))]
|
||||||
pub(crate) static APP_DOCUMENTS_DIRECTORY_NAME: &str = "documents";
|
pub(crate) const APP_DIRECTORY_NAME: &str = "Graphite";
|
||||||
|
pub(crate) const APP_LOCK_FILE_NAME: &str = "instance.lock";
|
||||||
// CEF configuration constants
|
pub(crate) const APP_SOCKET_FILE_NAME: &str = "instance.sock";
|
||||||
pub(crate) const CEF_WINDOWLESS_FRAME_RATE: i32 = 60;
|
pub(crate) const APP_STATE_FILE_NAME: &str = "state.ron";
|
||||||
pub(crate) const CEF_MESSAGE_LOOP_MAX_ITERATIONS: usize = 10;
|
pub(crate) const APP_PREFERENCES_FILE_NAME: &str = "preferences.ron";
|
||||||
|
pub(crate) const APP_DOCUMENTS_DIRECTORY_NAME: &str = "documents";
|
||||||
|
pub(crate) const APP_RESOURCES_DIRECTORY_NAME: &str = "resources";
|
||||||
+39
-6
@@ -1,22 +1,55 @@
|
|||||||
use std::fs::create_dir_all;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::consts::{APP_DIRECTORY_NAME, APP_DOCUMENTS_DIRECTORY_NAME};
|
use crate::consts::{APP_DIRECTORY_NAME, APP_DOCUMENTS_DIRECTORY_NAME, APP_RESOURCES_DIRECTORY_NAME};
|
||||||
|
|
||||||
pub(crate) fn ensure_dir_exists(path: &PathBuf) {
|
pub(crate) fn ensure_dir_exists(path: &PathBuf) {
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
create_dir_all(path).unwrap_or_else(|_| panic!("Failed to create directory at {path:?}"));
|
fs::create_dir_all(path).unwrap_or_else(|_| panic!("Failed to create directory at {path:?}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn graphite_data_dir() -> PathBuf {
|
pub(crate) fn clear_dir(path: &PathBuf) {
|
||||||
|
let Ok(entries) = fs::read_dir(path) else {
|
||||||
|
tracing::error!("Failed to read directory at {path:?}");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
for entry in entries.flatten() {
|
||||||
|
let entry_path = entry.path();
|
||||||
|
if entry_path.is_dir() {
|
||||||
|
if let Err(e) = fs::remove_dir_all(&entry_path) {
|
||||||
|
tracing::error!("Failed to remove directory at {:?}: {}", entry_path, e);
|
||||||
|
}
|
||||||
|
} else if entry_path.is_file()
|
||||||
|
&& let Err(e) = fs::remove_file(&entry_path)
|
||||||
|
{
|
||||||
|
tracing::error!("Failed to remove file at {:?}: {}", entry_path, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn app_data_dir() -> PathBuf {
|
||||||
let path = dirs::data_dir().expect("Failed to get data directory").join(APP_DIRECTORY_NAME);
|
let path = dirs::data_dir().expect("Failed to get data directory").join(APP_DIRECTORY_NAME);
|
||||||
ensure_dir_exists(&path);
|
ensure_dir_exists(&path);
|
||||||
path
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn graphite_autosave_documents_dir() -> PathBuf {
|
pub(crate) fn app_autosave_documents_dir() -> PathBuf {
|
||||||
let path = graphite_data_dir().join(APP_DOCUMENTS_DIRECTORY_NAME);
|
let path = app_data_dir().join(APP_DOCUMENTS_DIRECTORY_NAME);
|
||||||
ensure_dir_exists(&path);
|
ensure_dir_exists(&path);
|
||||||
path
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn app_resources_dir() -> PathBuf {
|
||||||
|
let path = app_data_dir().join(APP_RESOURCES_DIRECTORY_NAME);
|
||||||
|
ensure_dir_exists(&path);
|
||||||
|
path
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this cleanup code for the old "browser" CEF directory
|
||||||
|
pub(crate) fn delete_old_cef_browser_directory() {
|
||||||
|
let old_browser_dir = crate::dirs::app_data_dir().join("browser");
|
||||||
|
if old_browser_dir.is_dir() {
|
||||||
|
let _ = std::fs::remove_dir_all(&old_browser_dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
-4
@@ -1,13 +1,24 @@
|
|||||||
use graphite_desktop_wrapper::NodeGraphExecutionResult;
|
use crate::ui::Cursor;
|
||||||
use graphite_desktop_wrapper::messages::DesktopWrapperMessage;
|
use crate::wrapper::NodeGraphExecutionResult;
|
||||||
|
use crate::wrapper::messages::DesktopWrapperMessage;
|
||||||
|
|
||||||
pub(crate) enum AppEvent {
|
pub(crate) enum AppEvent {
|
||||||
UiUpdate(wgpu::Texture),
|
UiUpdate(wgpu::Texture),
|
||||||
ScheduleBrowserWork(std::time::Instant),
|
CursorChange(Cursor),
|
||||||
WebCommunicationInitialized,
|
WebCommunicationInitialized,
|
||||||
DesktopWrapperMessage(DesktopWrapperMessage),
|
DesktopWrapperMessage(DesktopWrapperMessage),
|
||||||
NodeGraphExecutionResult(NodeGraphExecutionResult),
|
NodeGraphExecutionResult(NodeGraphExecutionResult),
|
||||||
CloseWindow,
|
ClipboardRead,
|
||||||
|
ClipboardWrite {
|
||||||
|
content: String,
|
||||||
|
},
|
||||||
|
Exit,
|
||||||
|
UiCrashed,
|
||||||
|
OpenFiles(Vec<std::path::PathBuf>),
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
MenuEvent {
|
||||||
|
id: String,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
use crate::wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures};
|
||||||
|
|
||||||
|
pub(super) async fn create_wgpu_context() -> WgpuContext {
|
||||||
|
let mut wgpu_context_builder = WgpuContextBuilder::new().with_features(WgpuFeatures::IMMEDIATES);
|
||||||
|
|
||||||
|
// TODO: make this configurable via cli flags instead
|
||||||
|
if let Some(index) = std::env::var("GRAPHITE_WGPU_ADAPTER").ok().and_then(|s| s.parse().ok()) {
|
||||||
|
tracing::info!("Overriding WGPU adapter selection with adapter index {index}");
|
||||||
|
wgpu_context_builder = wgpu_context_builder.with_selection(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: add a cli flag to list adapters and exit instead of always printing
|
||||||
|
println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await);
|
||||||
|
|
||||||
|
let wgpu_context = wgpu_context_builder.build().await.expect("Failed to create WGPU context");
|
||||||
|
|
||||||
|
// TODO: add a cli flag to list adapters and exit instead of always printing
|
||||||
|
println!("Using WGPU adapter: {:?}", wgpu_context.adapter.get_info());
|
||||||
|
|
||||||
|
wgpu_context
|
||||||
|
}
|
||||||
@@ -0,0 +1,455 @@
|
|||||||
|
use std::collections::VecDeque;
|
||||||
|
use std::time::{Duration, Instant};
|
||||||
|
use winit::dpi::PhysicalPosition;
|
||||||
|
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, PointerSource, TabletToolData, TabletToolKind, WindowEvent};
|
||||||
|
use winit::keyboard::ModifiersState;
|
||||||
|
|
||||||
|
use crate::ui::{InputEvent, MULTICLICK_ALLOWED_TRAVEL, MULTICLICK_TIMEOUT, PINCH_ZOOM_SPEED, SCROLL_LINE_HEIGHT, SCROLL_LINE_WIDTH, SCROLL_SPEED_X, SCROLL_SPEED_Y};
|
||||||
|
use crate::wrapper::messages::{EditorPointerState, InputMessage, ModifierKeys, MouseKeys, ScrollDelta};
|
||||||
|
|
||||||
|
// Marks input event as observe-only, meaning it should not result in any input messages being send by the frontend.
|
||||||
|
// And should instead be ignored by frontend input processing and only be used to update the UI state (hover, cursor).
|
||||||
|
// TODO(Timon): Remove and find a less hacky solution
|
||||||
|
trait ObserveOnlyExt {
|
||||||
|
fn observe_only(self) -> Self;
|
||||||
|
}
|
||||||
|
impl ObserveOnlyExt for crate::ui::InputEventBuilder {
|
||||||
|
fn observe_only(self) -> Self {
|
||||||
|
self.num_lock(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) struct InputState {
|
||||||
|
start: Instant,
|
||||||
|
viewport_info: Option<ViewportInfo>,
|
||||||
|
direct_input: bool,
|
||||||
|
modifiers: ModifiersState,
|
||||||
|
pointer_position: PhysicalPosition<f64>,
|
||||||
|
pointer_state: PointerState,
|
||||||
|
click_tracker: ClickTracker,
|
||||||
|
shake_tracker: ShakeTracker,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InputState {
|
||||||
|
pub(crate) fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
start: Instant::now(),
|
||||||
|
viewport_info: None,
|
||||||
|
direct_input: false,
|
||||||
|
modifiers: ModifiersState::default(),
|
||||||
|
pointer_position: PhysicalPosition::default(),
|
||||||
|
pointer_state: PointerState::Hover { route: Route::Ui },
|
||||||
|
click_tracker: ClickTracker::default(),
|
||||||
|
shake_tracker: ShakeTracker::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn set_viewport_info(&mut self, x: f64, y: f64, width: f64, height: f64, scale: f64) {
|
||||||
|
self.viewport_info = Some(ViewportInfo { x, y, width, height, scale });
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn set_direct_input(&mut self, enabled: bool) {
|
||||||
|
self.direct_input = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn lock_pointer(&mut self) {
|
||||||
|
self.pointer_state = match self.pointer_state {
|
||||||
|
PointerState::Hover { route } => PointerState::Locked {
|
||||||
|
route,
|
||||||
|
keys: MouseKeys::empty(),
|
||||||
|
position: self.pointer_position,
|
||||||
|
},
|
||||||
|
PointerState::Stroke { route, keys } | PointerState::Locked { route, keys, .. } => PointerState::Locked {
|
||||||
|
route,
|
||||||
|
keys,
|
||||||
|
position: self.pointer_position,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn unlock_pointer(&mut self) -> Option<PhysicalPosition<f64>> {
|
||||||
|
let PointerState::Locked {
|
||||||
|
route: resume,
|
||||||
|
keys,
|
||||||
|
position: restore,
|
||||||
|
} = self.pointer_state
|
||||||
|
else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
self.pointer_position = restore;
|
||||||
|
self.pointer_state = match keys.is_empty() {
|
||||||
|
true => PointerState::Hover { route: Route::Ui },
|
||||||
|
false => PointerState::Stroke { route: resume, keys },
|
||||||
|
};
|
||||||
|
Some(restore)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn pointer_locked(&self) -> bool {
|
||||||
|
matches!(self.pointer_state, PointerState::Locked { .. })
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn modifiers(&self) -> ModifiersState {
|
||||||
|
self.modifiers
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn process(&mut self, event: &WindowEvent, mut editor_callback: impl FnMut(InputMessage), mut ui_callback: impl FnMut(InputEvent)) {
|
||||||
|
match event {
|
||||||
|
WindowEvent::PointerMoved { position, source, .. } => {
|
||||||
|
self.pointer_position = *position;
|
||||||
|
|
||||||
|
let route = match self.pointer_state {
|
||||||
|
PointerState::Hover { .. } => {
|
||||||
|
let next = self.route(*position);
|
||||||
|
self.pointer_state = PointerState::Hover { route: next };
|
||||||
|
next
|
||||||
|
}
|
||||||
|
PointerState::Stroke { route, .. } => route,
|
||||||
|
PointerState::Locked { keys, route: resume, .. } => match keys.is_empty() {
|
||||||
|
true => Route::Ui,
|
||||||
|
false => resume,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
match route {
|
||||||
|
Route::Ui => ui_callback(InputEvent::pointer().position(*position).moved().modifiers(self.modifiers).build()),
|
||||||
|
Route::Editor => {
|
||||||
|
if !self.pointer_locked() {
|
||||||
|
ui_callback(InputEvent::pointer().position(*position).moved().modifiers(self.modifiers).observe_only().build());
|
||||||
|
}
|
||||||
|
let editor_mouse_state = match source {
|
||||||
|
PointerSource::TabletTool { kind, data } => self.tablet_pointer_state(kind, data),
|
||||||
|
_ => self.pointer_state(),
|
||||||
|
};
|
||||||
|
let modifier_keys = self.modifier_keys();
|
||||||
|
if self.shake_tracker.detect(*position, self.start.elapsed()) {
|
||||||
|
editor_callback(InputMessage::PointerShake { editor_mouse_state, modifier_keys });
|
||||||
|
}
|
||||||
|
editor_callback(InputMessage::PointerMove { editor_mouse_state, modifier_keys });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WindowEvent::PointerEntered { position, .. } => {
|
||||||
|
self.pointer_position = *position;
|
||||||
|
ui_callback(InputEvent::pointer().position(*position).entered().modifiers(self.modifiers).build())
|
||||||
|
}
|
||||||
|
WindowEvent::PointerLeft { position: Some(position), .. } => {
|
||||||
|
self.pointer_position = *position;
|
||||||
|
ui_callback(InputEvent::pointer().position(*position).exited().modifiers(self.modifiers).build())
|
||||||
|
}
|
||||||
|
WindowEvent::PointerLeft { position: None, .. } => ui_callback(InputEvent::pointer().exited().modifiers(self.modifiers).build()),
|
||||||
|
WindowEvent::PointerButton { state, button, position, .. } => {
|
||||||
|
self.pointer_position = *position;
|
||||||
|
|
||||||
|
let mouse_button = button.clone().mouse_button();
|
||||||
|
let keys = match mouse_button {
|
||||||
|
Some(MouseButton::Left) => MouseKeys::LEFT,
|
||||||
|
Some(MouseButton::Right) => MouseKeys::RIGHT,
|
||||||
|
Some(MouseButton::Middle) => MouseKeys::MIDDLE,
|
||||||
|
Some(MouseButton::Back) => MouseKeys::BACK,
|
||||||
|
Some(MouseButton::Forward) => MouseKeys::FORWARD,
|
||||||
|
_ => MouseKeys::NONE,
|
||||||
|
};
|
||||||
|
|
||||||
|
let (pointer, route) = match self.pointer_state {
|
||||||
|
PointerState::Hover { route } => match (state.is_pressed(), keys.is_empty()) {
|
||||||
|
(true, false) => {
|
||||||
|
let route = self.route(*position);
|
||||||
|
(PointerState::Stroke { route, keys }, route)
|
||||||
|
}
|
||||||
|
(true, true) => (PointerState::Hover { route }, self.route(*position)),
|
||||||
|
(false, _) => (PointerState::Hover { route }, route),
|
||||||
|
},
|
||||||
|
PointerState::Stroke { route, keys: mut held } => {
|
||||||
|
match state.is_pressed() {
|
||||||
|
true => held.insert(keys),
|
||||||
|
false => held.remove(keys),
|
||||||
|
}
|
||||||
|
match held.is_empty() {
|
||||||
|
true => (PointerState::Hover { route }, route),
|
||||||
|
false => (PointerState::Stroke { route, keys: held }, route),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PointerState::Locked { route, keys: mut held, position } => {
|
||||||
|
let resume = if state.is_pressed() && held.is_empty() { Route::Ui } else { route };
|
||||||
|
match state.is_pressed() {
|
||||||
|
true => held.insert(keys),
|
||||||
|
false => held.remove(keys),
|
||||||
|
}
|
||||||
|
(PointerState::Locked { route: resume, keys: held, position }, Route::Ui)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.pointer_state = pointer;
|
||||||
|
|
||||||
|
let count = mouse_button.map_or(1, |button| self.click_tracker.input(*position, button, *state));
|
||||||
|
|
||||||
|
let back_or_forward = matches!(mouse_button, Some(MouseButton::Back | MouseButton::Forward));
|
||||||
|
let pointer = InputEvent::pointer().position(*position);
|
||||||
|
let input = match state {
|
||||||
|
ElementState::Pressed => pointer.pressed(button.clone(), count),
|
||||||
|
ElementState::Released => pointer.released(button.clone(), count),
|
||||||
|
}
|
||||||
|
.modifiers(self.modifiers);
|
||||||
|
if self.pointer_locked() || keys.is_empty() || !(back_or_forward || route == Route::Editor) {
|
||||||
|
ui_callback(input.build());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if route == Route::Editor {
|
||||||
|
ui_callback(input.observe_only().build());
|
||||||
|
}
|
||||||
|
|
||||||
|
let editor_mouse_state = match button {
|
||||||
|
ButtonSource::TabletTool { kind, data, .. } => self.tablet_pointer_state(kind, data),
|
||||||
|
_ => self.pointer_state(),
|
||||||
|
};
|
||||||
|
let modifier_keys = self.modifier_keys();
|
||||||
|
match state {
|
||||||
|
ElementState::Pressed => editor_callback(InputMessage::PointerDown { editor_mouse_state, modifier_keys }),
|
||||||
|
ElementState::Released if count % 2 == 0 => {
|
||||||
|
editor_callback(InputMessage::PointerUp { editor_mouse_state, modifier_keys });
|
||||||
|
editor_callback(InputMessage::DoubleClick {
|
||||||
|
editor_mouse_state: EditorPointerState {
|
||||||
|
mouse_keys: keys,
|
||||||
|
..editor_mouse_state
|
||||||
|
},
|
||||||
|
modifier_keys,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ElementState::Released => editor_callback(InputMessage::PointerUp { editor_mouse_state, modifier_keys }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WindowEvent::MouseWheel { delta, .. } => {
|
||||||
|
if self.pointer_locked() || self.ui_captures(self.pointer_position) {
|
||||||
|
let input = match delta {
|
||||||
|
MouseScrollDelta::LineDelta(x, y) => InputEvent::pointer().scrolled_lines(f64::from(*x), f64::from(*y)),
|
||||||
|
MouseScrollDelta::PixelDelta(position) => InputEvent::pointer().scrolled_pixels(position.x, position.y),
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
ui_callback(input.modifiers(self.modifiers).build());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let (x, y) = match delta {
|
||||||
|
MouseScrollDelta::LineDelta(x, y) => (f64::from(*x) * SCROLL_LINE_WIDTH, f64::from(*y) * SCROLL_LINE_HEIGHT),
|
||||||
|
MouseScrollDelta::PixelDelta(position) => (position.x, position.y),
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
|
||||||
|
let scroll_delta = ScrollDelta::new(-x * SCROLL_SPEED_X, -y * SCROLL_SPEED_Y, 0.);
|
||||||
|
|
||||||
|
editor_callback(InputMessage::WheelScroll {
|
||||||
|
editor_mouse_state: EditorPointerState { scroll_delta, ..self.pointer_state() },
|
||||||
|
modifier_keys: self.modifier_keys(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
WindowEvent::PinchGesture { delta, .. } => {
|
||||||
|
if self.pointer_locked() || self.ui_captures(self.pointer_position) || !delta.is_normal() {
|
||||||
|
ui_callback(InputEvent::pointer().zoomed(*delta).modifiers(self.modifiers).build());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: This is a temporary solution to handle pinch gestures, we should handle pinch gestures editor-side instead.
|
||||||
|
let scroll_delta = ScrollDelta::new(0., -delta * PINCH_ZOOM_SPEED, 0.);
|
||||||
|
editor_callback(InputMessage::WheelScroll {
|
||||||
|
editor_mouse_state: EditorPointerState { scroll_delta, ..self.pointer_state() },
|
||||||
|
modifier_keys: self.modifier_keys() | ModifierKeys::CONTROL,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
WindowEvent::ModifiersChanged(modifiers) => {
|
||||||
|
self.modifiers = modifiers.state();
|
||||||
|
}
|
||||||
|
WindowEvent::KeyboardInput { event, .. } => ui_callback(InputEvent::key(event).modifiers(self.modifiers).build()),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn scale(&self) -> f64 {
|
||||||
|
self.viewport_info.as_ref().map_or(1., |info| info.scale)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ui_captures(&self, position: PhysicalPosition<f64>) -> bool {
|
||||||
|
!self.direct_input || !self.viewport_info.as_ref().is_some_and(|info| info.contains(position))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn route(&self, position: PhysicalPosition<f64>) -> Route {
|
||||||
|
if self.ui_captures(position) { Route::Ui } else { Route::Editor }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pointer_keys(&self) -> MouseKeys {
|
||||||
|
match self.pointer_state {
|
||||||
|
PointerState::Hover { .. } => MouseKeys::empty(),
|
||||||
|
PointerState::Stroke { keys, .. } | PointerState::Locked { keys, .. } => keys,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pointer_state(&self) -> EditorPointerState {
|
||||||
|
EditorPointerState {
|
||||||
|
editor_position: (self.pointer_position.x / self.scale(), self.pointer_position.y / self.scale()).into(),
|
||||||
|
mouse_keys: self.pointer_keys(),
|
||||||
|
time: Some(self.start.elapsed().as_secs_f64() * 1000.),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn tablet_pointer_state(&self, kind: &TabletToolKind, data: &TabletToolData) -> EditorPointerState {
|
||||||
|
EditorPointerState {
|
||||||
|
pressure: data.force.map(|force| force.normalized(None)),
|
||||||
|
tilt: data.clone().tilt().map(|tilt| (f64::from(tilt.x), f64::from(tilt.y)).into()),
|
||||||
|
twist: data.twist.map(f64::from),
|
||||||
|
wheel: data.tangential_force.map(f64::from),
|
||||||
|
eraser: matches!(kind, TabletToolKind::Eraser),
|
||||||
|
..self.pointer_state()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn modifier_keys(&self) -> ModifierKeys {
|
||||||
|
let mut keys = ModifierKeys::empty();
|
||||||
|
keys.set(ModifierKeys::SHIFT, self.modifiers.shift_key());
|
||||||
|
keys.set(ModifierKeys::CONTROL, self.modifiers.control_key());
|
||||||
|
keys.set(ModifierKeys::ALT, self.modifiers.alt_key());
|
||||||
|
keys.set(ModifierKeys::META_OR_COMMAND, self.modifiers.meta_key());
|
||||||
|
keys
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
enum PointerState {
|
||||||
|
Hover { route: Route },
|
||||||
|
Stroke { route: Route, keys: MouseKeys },
|
||||||
|
Locked { route: Route, keys: MouseKeys, position: PhysicalPosition<f64> },
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, PartialEq)]
|
||||||
|
enum Route {
|
||||||
|
Ui,
|
||||||
|
Editor,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ViewportInfo {
|
||||||
|
x: f64,
|
||||||
|
y: f64,
|
||||||
|
width: f64,
|
||||||
|
height: f64,
|
||||||
|
scale: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ViewportInfo {
|
||||||
|
fn contains(&self, position: PhysicalPosition<f64>) -> bool {
|
||||||
|
position.x >= self.x && position.y >= self.y && position.x <= self.x + self.width && position.y <= self.y + self.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct ClickTracker {
|
||||||
|
left: ClickChains,
|
||||||
|
right: ClickChains,
|
||||||
|
middle: ClickChains,
|
||||||
|
back: ClickChains,
|
||||||
|
forward: ClickChains,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ClickTracker {
|
||||||
|
fn input(&mut self, position: PhysicalPosition<f64>, button: MouseButton, state: ElementState) -> u32 {
|
||||||
|
let position = (position.x as i32, position.y as i32);
|
||||||
|
let clicks = match button {
|
||||||
|
MouseButton::Left => &mut self.left,
|
||||||
|
MouseButton::Right => &mut self.right,
|
||||||
|
MouseButton::Middle => &mut self.middle,
|
||||||
|
MouseButton::Back => &mut self.back,
|
||||||
|
MouseButton::Forward => &mut self.forward,
|
||||||
|
_ => return 1,
|
||||||
|
};
|
||||||
|
let chain = match state {
|
||||||
|
ElementState::Pressed => &mut clicks.down,
|
||||||
|
ElementState::Released => &mut clicks.up,
|
||||||
|
};
|
||||||
|
|
||||||
|
let now = Instant::now();
|
||||||
|
let count = match chain {
|
||||||
|
Some(previous) => {
|
||||||
|
let within_time = now.saturating_duration_since(previous.time) <= MULTICLICK_TIMEOUT;
|
||||||
|
let dx = position.0.abs_diff(previous.position.0) as usize;
|
||||||
|
let dy = position.1.abs_diff(previous.position.1) as usize;
|
||||||
|
let within_distance = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
|
||||||
|
if within_time && within_distance { previous.count.saturating_add(1) } else { 1 }
|
||||||
|
}
|
||||||
|
None => 1,
|
||||||
|
};
|
||||||
|
*chain = Some(Click { time: now, position, count });
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct ClickChains {
|
||||||
|
down: Option<Click>,
|
||||||
|
up: Option<Click>,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Click {
|
||||||
|
time: Instant,
|
||||||
|
position: (i32, i32),
|
||||||
|
count: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct ShakeTracker {
|
||||||
|
samples: VecDeque<(PhysicalPosition<f64>, Duration)>,
|
||||||
|
last: Option<Duration>,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep heuristic and constants in sync with `detectShake` in `frontend/src/utility-functions/input.ts`.
|
||||||
|
impl ShakeTracker {
|
||||||
|
const SENSITIVITY_DIRECTION_CHANGES: usize = 3;
|
||||||
|
const SENSITIVITY_DISTANCE_TO_DISPLACEMENT_RATIO: f64 = 0.1;
|
||||||
|
const DETECTION_WINDOW: Duration = Duration::from_millis(500);
|
||||||
|
const DEBOUNCE: Duration = Duration::from_millis(1000);
|
||||||
|
|
||||||
|
fn detect(&mut self, position: PhysicalPosition<f64>, now: Duration) -> bool {
|
||||||
|
self.samples.push_back((position, now));
|
||||||
|
|
||||||
|
while self.samples.front().is_some_and(|&(_, time)| now.saturating_sub(time) > Self::DETECTION_WINDOW) {
|
||||||
|
self.samples.pop_front();
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.samples.len() <= 3 || self.last.is_some_and(|time| now.saturating_sub(time) <= Self::DEBOUNCE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut total_distance_squared = 0.;
|
||||||
|
for i in 1..self.samples.len() {
|
||||||
|
let (p1, _) = self.samples[i - 1];
|
||||||
|
let (p2, _) = self.samples[i];
|
||||||
|
total_distance_squared += (p2.x - p1.x).powi(2) + (p2.y - p1.y).powi(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut direction_changes = 0;
|
||||||
|
let mut average = PhysicalPosition::new(0., 0.);
|
||||||
|
let interior_count = self.samples.len() - 2;
|
||||||
|
for i in 0..interior_count {
|
||||||
|
let (p1, _) = self.samples[i];
|
||||||
|
let (p2, _) = self.samples[i + 1];
|
||||||
|
let (p3, _) = self.samples[i + 2];
|
||||||
|
|
||||||
|
let vector1 = (p2.x - p1.x, p2.y - p1.y);
|
||||||
|
let vector2 = (p3.x - p2.x, p3.y - p2.y);
|
||||||
|
if vector1.0 * vector2.0 + vector1.1 * vector2.1 < 0. {
|
||||||
|
direction_changes += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
average.x += p2.x;
|
||||||
|
average.y += p2.y;
|
||||||
|
}
|
||||||
|
average.x /= interior_count as f64;
|
||||||
|
average.y /= interior_count as f64;
|
||||||
|
|
||||||
|
let (last, _) = self.samples[self.samples.len() - 1];
|
||||||
|
let displacement_squared = (last.x - average.x).powi(2) + (last.y - average.y).powi(2);
|
||||||
|
|
||||||
|
if Self::SENSITIVITY_DISTANCE_TO_DISPLACEMENT_RATIO * total_distance_squared >= displacement_squared && direction_changes >= Self::SENSITIVITY_DIRECTION_CHANGES {
|
||||||
|
self.last = Some(now);
|
||||||
|
self.samples.clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
use crate::app::App;
|
||||||
|
use crate::cli::Cli;
|
||||||
|
use crate::consts::APP_LOCK_FILE_NAME;
|
||||||
|
use crate::event::{AppEvent, CreateAppEventSchedulerEventLoopExt};
|
||||||
|
use clap::Parser;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::process::ExitCode;
|
||||||
|
use tracing_subscriber::EnvFilter;
|
||||||
|
use ui::{Acceleration, UiConfig, UiContext, UiEvent, UiSetupResult};
|
||||||
|
use winit::event_loop::EventLoop;
|
||||||
|
|
||||||
|
pub(crate) use graphite_desktop_ui as ui;
|
||||||
|
pub(crate) use graphite_desktop_wrapper as wrapper;
|
||||||
|
|
||||||
|
mod app;
|
||||||
|
mod cli;
|
||||||
|
mod dirs;
|
||||||
|
mod event;
|
||||||
|
mod gpu_context;
|
||||||
|
mod input;
|
||||||
|
mod persist;
|
||||||
|
mod preferences;
|
||||||
|
mod render;
|
||||||
|
mod socket;
|
||||||
|
mod window;
|
||||||
|
|
||||||
|
pub(crate) mod consts;
|
||||||
|
|
||||||
|
pub fn start() -> ExitCode {
|
||||||
|
tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()).init();
|
||||||
|
|
||||||
|
let ui_context = match UiContext::setup() {
|
||||||
|
UiSetupResult::Ready(context) => context,
|
||||||
|
UiSetupResult::Helper(code) => return code,
|
||||||
|
UiSetupResult::Failed => {
|
||||||
|
tracing::error!("Failed to set up the UI runtime");
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let cli = Cli::parse();
|
||||||
|
|
||||||
|
let Ok(lock_file) = std::fs::OpenOptions::new()
|
||||||
|
.read(true)
|
||||||
|
.write(true)
|
||||||
|
.create(true)
|
||||||
|
.truncate(true)
|
||||||
|
.open(dirs::app_data_dir().join(APP_LOCK_FILE_NAME))
|
||||||
|
else {
|
||||||
|
tracing::error!("Failed to open lock file.");
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
};
|
||||||
|
let mut lock = fd_lock::RwLock::new(lock_file);
|
||||||
|
let lock = match lock.try_write() {
|
||||||
|
Ok(mut guard) => {
|
||||||
|
tracing::info!("Acquired application lock");
|
||||||
|
let _ = guard.set_len(0);
|
||||||
|
let _ = write!(guard, "{}", std::process::id());
|
||||||
|
let _ = guard.sync_all();
|
||||||
|
guard
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
tracing::error!("Another instance is already running, Exiting.");
|
||||||
|
if !cli.files.is_empty()
|
||||||
|
&& let Err(error) = socket::send(socket::Message::OpenFiles(cli.files))
|
||||||
|
{
|
||||||
|
tracing::error!("Failed to send socket message to running instance: {}", error);
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
}
|
||||||
|
return ExitCode::SUCCESS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
dirs::clear_dir(&ui::temp_dir_root());
|
||||||
|
|
||||||
|
// TODO: Eventually remove this cleanup code for the old "browser" CEF directory
|
||||||
|
dirs::delete_old_cef_browser_directory();
|
||||||
|
|
||||||
|
let mut prefs = preferences::read();
|
||||||
|
|
||||||
|
// Must be called before event loop initialization or native window integrations will break
|
||||||
|
App::init();
|
||||||
|
|
||||||
|
let wgpu_context = futures::executor::block_on(gpu_context::create_wgpu_context());
|
||||||
|
|
||||||
|
let event_loop = EventLoop::new().unwrap();
|
||||||
|
let (app_event_sender, app_event_receiver) = std::sync::mpsc::channel();
|
||||||
|
let app_event_scheduler = event_loop.create_app_event_scheduler(app_event_sender);
|
||||||
|
|
||||||
|
let _socket_handle = socket::start(app_event_scheduler.clone());
|
||||||
|
|
||||||
|
if cli.disable_ui_acceleration {
|
||||||
|
prefs.disable_ui_acceleration = true;
|
||||||
|
}
|
||||||
|
if prefs.disable_ui_acceleration {
|
||||||
|
println!("UI acceleration is disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
let acceleration = if prefs.disable_ui_acceleration { Acceleration::Disabled } else { Acceleration::Auto };
|
||||||
|
let ui_context = match ui_context.start(UiConfig { acceleration }) {
|
||||||
|
Ok(context) => context,
|
||||||
|
Err(error) => {
|
||||||
|
tracing::error!("Failed to start the UI runtime: {error}");
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let ui = match ui_context.instance(&wgpu_context.device, &wgpu_context.queue) {
|
||||||
|
Ok(ui) => ui,
|
||||||
|
Err(error) => {
|
||||||
|
tracing::error!("Failed to start the UI: {error}");
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
tracing::info!("UI runtime started successfully");
|
||||||
|
|
||||||
|
{
|
||||||
|
let ui = ui.clone();
|
||||||
|
let scheduler = app_event_scheduler.clone();
|
||||||
|
let spawned = std::thread::Builder::new().name("ui-events".to_string()).spawn(move || {
|
||||||
|
while let Some(event) = ui.recv() {
|
||||||
|
match event {
|
||||||
|
UiEvent::Ready => scheduler.schedule(AppEvent::WebCommunicationInitialized),
|
||||||
|
UiEvent::Frame(texture) => scheduler.schedule(AppEvent::UiUpdate(texture)),
|
||||||
|
UiEvent::Cursor(cursor) => scheduler.schedule(AppEvent::CursorChange(cursor)),
|
||||||
|
UiEvent::Message(message) => match wrapper::deserialize_editor_message(&message) {
|
||||||
|
Some(message) => scheduler.schedule(AppEvent::DesktopWrapperMessage(message)),
|
||||||
|
None => tracing::error!("Failed to deserialize web message"),
|
||||||
|
},
|
||||||
|
UiEvent::Failure(error) => {
|
||||||
|
tracing::error!("UI failure: {error}");
|
||||||
|
scheduler.schedule(AppEvent::UiCrashed);
|
||||||
|
}
|
||||||
|
UiEvent::Crashed => scheduler.schedule(AppEvent::UiCrashed),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if let Err(error) = spawned {
|
||||||
|
tracing::error!("Failed to spawn the UI event bridge thread: {error}");
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let app = App::new(ui.clone(), wgpu_context, app_event_receiver, app_event_scheduler, prefs, cli.files);
|
||||||
|
|
||||||
|
let exit_reason = app.run(event_loop);
|
||||||
|
|
||||||
|
// ui needs to be shutdown before restarting
|
||||||
|
ui.shutdown();
|
||||||
|
|
||||||
|
// If exiting due to a UI acceleration failure, update preferences to disable it for next launch
|
||||||
|
if matches!(exit_reason, app::ExitReason::UiAccelerationFailure) {
|
||||||
|
tracing::error!("Disabling UI acceleration");
|
||||||
|
preferences::modify(|prefs| {
|
||||||
|
prefs.disable_ui_acceleration = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Explicitly drop the instance lock
|
||||||
|
drop(lock);
|
||||||
|
|
||||||
|
match exit_reason {
|
||||||
|
app::ExitReason::Restart | app::ExitReason::UiAccelerationFailure => {
|
||||||
|
tracing::info!("Restarting application");
|
||||||
|
let mut command = std::process::Command::new(std::env::current_exe().unwrap());
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
let _ = std::os::unix::process::CommandExt::exec(&mut command);
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
tracing::error!("Failed to restart application");
|
||||||
|
#[cfg(not(target_family = "unix"))]
|
||||||
|
let _ = command.spawn();
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExitCode::SUCCESS
|
||||||
|
}
|
||||||
+2
-68
@@ -1,69 +1,3 @@
|
|||||||
use std::process::exit;
|
fn main() -> std::process::ExitCode {
|
||||||
use tracing_subscriber::EnvFilter;
|
graphite_desktop::start()
|
||||||
use winit::event_loop::EventLoop;
|
|
||||||
|
|
||||||
use graphite_desktop_wrapper::WgpuContext;
|
|
||||||
|
|
||||||
pub(crate) mod consts;
|
|
||||||
|
|
||||||
mod app;
|
|
||||||
mod cef;
|
|
||||||
mod dirs;
|
|
||||||
mod event;
|
|
||||||
mod native_window;
|
|
||||||
mod persist;
|
|
||||||
mod render;
|
|
||||||
|
|
||||||
use app::App;
|
|
||||||
use cef::CefHandler;
|
|
||||||
use event::CreateAppEventSchedulerEventLoopExt;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()).init();
|
|
||||||
|
|
||||||
let cef_context_builder = cef::CefContextBuilder::<CefHandler>::new();
|
|
||||||
|
|
||||||
if cef_context_builder.is_sub_process() {
|
|
||||||
// We are in a CEF subprocess
|
|
||||||
// This will block until the CEF subprocess quits
|
|
||||||
let error = cef_context_builder.execute_sub_process();
|
|
||||||
tracing::error!("Cef subprocess failed with error: {error}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let wgpu_context = futures::executor::block_on(WgpuContext::new()).unwrap();
|
|
||||||
|
|
||||||
let event_loop = EventLoop::new().unwrap();
|
|
||||||
let (app_event_sender, app_event_receiver) = std::sync::mpsc::channel();
|
|
||||||
let app_event_scheduler = event_loop.create_app_event_scheduler(app_event_sender);
|
|
||||||
|
|
||||||
let (window_size_sender, window_size_receiver) = std::sync::mpsc::channel();
|
|
||||||
|
|
||||||
let cef_handler = cef::CefHandler::new(wgpu_context.clone(), app_event_scheduler.clone(), window_size_receiver);
|
|
||||||
let cef_context = match cef_context_builder.initialize(cef_handler) {
|
|
||||||
Ok(c) => {
|
|
||||||
tracing::info!("CEF initialized successfully");
|
|
||||||
c
|
|
||||||
}
|
|
||||||
Err(cef::InitError::AlreadyRunning) => {
|
|
||||||
tracing::error!("Another instance is already running, Exiting.");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
Err(cef::InitError::InitializationFailed(code)) => {
|
|
||||||
tracing::error!("Cef initialization failed with code: {code}");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
Err(cef::InitError::BrowserCreationFailed) => {
|
|
||||||
tracing::error!("Failed to create CEF browser");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
Err(cef::InitError::RequestContextCreationFailed) => {
|
|
||||||
tracing::error!("Failed to create CEF request context");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut app = App::new(Box::new(cef_context), window_size_sender, wgpu_context, app_event_receiver, app_event_scheduler);
|
|
||||||
|
|
||||||
event_loop.run_app(&mut app).unwrap();
|
|
||||||
}
|
}
|
||||||
Loaded 100 of 1620 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user