BlueGit

ict rusty-teams

fix(linux): emoji draw on systems with a COLRv1-only emoji font

- Bundle the CBDT Noto Color Emoji 2.051 (OFL) on Linux only
- Vendored gpui-pre-wgpu: a bundled face replaces installed faces of the same family, so Fedora's COLRv1 face (blank in swash) no longer wins the fallback
- Reproduced on WSL with Fedora's Noto-COLRv1.ttf only: reaction and preview emoji blank before, drawn after (GitHub issue 8)
- Linux binary grows by about 10 MB

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-12 · 2 weeks ago

Hash
53a311dd86ad10c6cb8c1b9e3194549a8d55a58f
Parent
d3b234ef
20 files changed +14274 −0
Cargo.toml +1 −0
@@ -47,6 +47,7 @@ webview = { path = "crates/webview" }
47 47 [patch.crates-io]
48 48 gpui-base = { path = "vendor/gpui-base" }
49 49 gpui-component = { path = "vendor/gpui-component" }
50 gpui-pre-wgpu = { path = "vendor/gpui-pre-wgpu" }
50 51 webrtc-sys = { path = "vendor/webrtc-sys" }
51 52 libwebrtc = { path = "vendor/libwebrtc" }
52 53
@@ -47,6 +47,7 @@ webview = { path = "crates/webview" }
47[patch.crates-io]
47[patch.crates-io]
48gpui-base = { path = "vendor/gpui-base" }
48gpui-base = { path = "vendor/gpui-base" }
49gpui-component = { path = "vendor/gpui-component" }
49gpui-component = { path = "vendor/gpui-component" }
50gpui-pre-wgpu = { path = "vendor/gpui-pre-wgpu" }
50webrtc-sys = { path = "vendor/webrtc-sys" }
51webrtc-sys = { path = "vendor/webrtc-sys" }
51libwebrtc = { path = "vendor/libwebrtc" }
52libwebrtc = { path = "vendor/libwebrtc" }
52
53
crates/app-base/src/theme.rs +6 −0
@@ -22,6 +22,11 @@ const FONT_FILES: [&[u8]; 4] = [
22 22 include_bytes!("../../app/assets/fonts/GoogleSansFlex-Italic.ttf"),
23 23 ];
24 24
25 #[cfg(target_os = "linux")]
26 const PLATFORM_FONT_FILES: [&[u8]; 1] = [include_bytes!("../../app/assets/fonts/NotoColorEmoji.ttf")];
27 #[cfg(not(target_os = "linux"))]
28 const PLATFORM_FONT_FILES: [&[u8]; 0] = [];
29
25 30 const WHITE: u32 = 0xffffff;
26 31 const CLOSE_BUTTON_ICON: u32 = 0xffffff;
27 32
@@ -36,6 +41,7 @@ fn color_with_alpha(hex: u32) -> Hsla {
36 41 pub fn load_fonts(cx: &mut App) {
37 42 let fonts = FONT_FILES
38 43 .iter()
44 .chain(PLATFORM_FONT_FILES.iter())
39 45 .map(|bytes| Cow::Borrowed(*bytes))
40 46 .collect();
41 47 let _ = cx.text_system().add_fonts(fonts);
@@ -22,6 +22,11 @@ const FONT_FILES: [&[u8]; 4] = [
22 include_bytes!("../../app/assets/fonts/GoogleSansFlex-Italic.ttf"),
22 include_bytes!("../../app/assets/fonts/GoogleSansFlex-Italic.ttf"),
23];
23];
24
24
25#[cfg(target_os = "linux")]
26const PLATFORM_FONT_FILES: [&[u8]; 1] = [include_bytes!("../../app/assets/fonts/NotoColorEmoji.ttf")];
27#[cfg(not(target_os = "linux"))]
28const PLATFORM_FONT_FILES: [&[u8]; 0] = [];
29
25const WHITE: u32 = 0xffffff;
30const WHITE: u32 = 0xffffff;
26const CLOSE_BUTTON_ICON: u32 = 0xffffff;
31const CLOSE_BUTTON_ICON: u32 = 0xffffff;
27
32
@@ -36,6 +41,7 @@ fn color_with_alpha(hex: u32) -> Hsla {
36pub fn load_fonts(cx: &mut App) {
41pub fn load_fonts(cx: &mut App) {
37 let fonts = FONT_FILES
42 let fonts = FONT_FILES
38 .iter()
43 .iter()
44 .chain(PLATFORM_FONT_FILES.iter())
39 .map(|bytes| Cow::Borrowed(*bytes))
45 .map(|bytes| Cow::Borrowed(*bytes))
40 .collect();
46 .collect();
41 let _ = cx.text_system().add_fonts(fonts);
47 let _ = cx.text_system().add_fonts(fonts);
crates/app/assets/fonts/NotoColorEmoji-OFL.txt added +92 −0
@@ -0,0 +1,92 @@
1 This Font Software is licensed under the SIL Open Font License,
2 Version 1.1.
3
4 This license is copied below, and is also available with a FAQ at:
5 http://scripts.sil.org/OFL
6
7 -----------------------------------------------------------
8 SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9 -----------------------------------------------------------
10
11 PREAMBLE
12 The goals of the Open Font License (OFL) are to stimulate worldwide
13 development of collaborative font projects, to support the font
14 creation efforts of academic and linguistic communities, and to
15 provide a free and open framework in which fonts may be shared and
16 improved in partnership with others.
17
18 The OFL allows the licensed fonts to be used, studied, modified and
19 redistributed freely as long as they are not sold by themselves. The
20 fonts, including any derivative works, can be bundled, embedded,
21 redistributed and/or sold with any software provided that any reserved
22 names are not used by derivative works. The fonts and derivatives,
23 however, cannot be released under any other type of license. The
24 requirement for fonts to remain under this license does not apply to
25 any document created using the fonts or their derivatives.
26
27 DEFINITIONS
28 "Font Software" refers to the set of files released by the Copyright
29 Holder(s) under this license and clearly marked as such. This may
30 include source files, build scripts and documentation.
31
32 "Reserved Font Name" refers to any names specified as such after the
33 copyright statement(s).
34
35 "Original Version" refers to the collection of Font Software
36 components as distributed by the Copyright Holder(s).
37
38 "Modified Version" refers to any derivative made by adding to,
39 deleting, or substituting -- in part or in whole -- any of the
40 components of the Original Version, by changing formats or by porting
41 the Font Software to a new environment.
42
43 "Author" refers to any designer, engineer, programmer, technical
44 writer or other person who contributed to the Font Software.
45
46 PERMISSION & CONDITIONS
47 Permission is hereby granted, free of charge, to any person obtaining
48 a copy of the Font Software, to use, study, copy, merge, embed,
49 modify, redistribute, and sell modified and unmodified copies of the
50 Font Software, subject to the following conditions:
51
52 1) Neither the Font Software nor any of its individual components, in
53 Original or Modified Versions, may be sold by itself.
54
55 2) Original or Modified Versions of the Font Software may be bundled,
56 redistributed and/or sold with any software, provided that each copy
57 contains the above copyright notice and this license. These can be
58 included either as stand-alone text files, human-readable headers or
59 in the appropriate machine-readable metadata fields within text or
60 binary files as long as those fields can be easily viewed by the user.
61
62 3) No Modified Version of the Font Software may use the Reserved Font
63 Name(s) unless explicit written permission is granted by the
64 corresponding Copyright Holder. This restriction only applies to the
65 primary font name as presented to the users.
66
67 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68 Software shall not be used to promote, endorse or advertise any
69 Modified Version, except to acknowledge the contribution(s) of the
70 Copyright Holder(s) and the Author(s) or with their explicit written
71 permission.
72
73 5) The Font Software, modified or unmodified, in part or in whole,
74 must be distributed entirely under this license, and must not be
75 distributed under any other license. The requirement for fonts to
76 remain under this license does not apply to any document created using
77 the Font Software.
78
79 TERMINATION
80 This license becomes null and void if any of the above conditions are
81 not met.
82
83 DISCLAIMER
84 THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87 OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88 COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89 INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90 DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91 FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92 OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,92 @@
1This Font Software is licensed under the SIL Open Font License,
2Version 1.1.
3
4This license is copied below, and is also available with a FAQ at:
5http://scripts.sil.org/OFL
6
7-----------------------------------------------------------
8SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9-----------------------------------------------------------
10
11PREAMBLE
12The goals of the Open Font License (OFL) are to stimulate worldwide
13development of collaborative font projects, to support the font
14creation efforts of academic and linguistic communities, and to
15provide a free and open framework in which fonts may be shared and
16improved in partnership with others.
17
18The OFL allows the licensed fonts to be used, studied, modified and
19redistributed freely as long as they are not sold by themselves. The
20fonts, including any derivative works, can be bundled, embedded,
21redistributed and/or sold with any software provided that any reserved
22names are not used by derivative works. The fonts and derivatives,
23however, cannot be released under any other type of license. The
24requirement for fonts to remain under this license does not apply to
25any document created using the fonts or their derivatives.
26
27DEFINITIONS
28"Font Software" refers to the set of files released by the Copyright
29Holder(s) under this license and clearly marked as such. This may
30include source files, build scripts and documentation.
31
32"Reserved Font Name" refers to any names specified as such after the
33copyright statement(s).
34
35"Original Version" refers to the collection of Font Software
36components as distributed by the Copyright Holder(s).
37
38"Modified Version" refers to any derivative made by adding to,
39deleting, or substituting -- in part or in whole -- any of the
40components of the Original Version, by changing formats or by porting
41the Font Software to a new environment.
42
43"Author" refers to any designer, engineer, programmer, technical
44writer or other person who contributed to the Font Software.
45
46PERMISSION & CONDITIONS
47Permission is hereby granted, free of charge, to any person obtaining
48a copy of the Font Software, to use, study, copy, merge, embed,
49modify, redistribute, and sell modified and unmodified copies of the
50Font Software, subject to the following conditions:
51
521) Neither the Font Software nor any of its individual components, in
53Original or Modified Versions, may be sold by itself.
54
552) Original or Modified Versions of the Font Software may be bundled,
56redistributed and/or sold with any software, provided that each copy
57contains the above copyright notice and this license. These can be
58included either as stand-alone text files, human-readable headers or
59in the appropriate machine-readable metadata fields within text or
60binary files as long as those fields can be easily viewed by the user.
61
623) No Modified Version of the Font Software may use the Reserved Font
63Name(s) unless explicit written permission is granted by the
64corresponding Copyright Holder. This restriction only applies to the
65primary font name as presented to the users.
66
674) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68Software shall not be used to promote, endorse or advertise any
69Modified Version, except to acknowledge the contribution(s) of the
70Copyright Holder(s) and the Author(s) or with their explicit written
71permission.
72
735) The Font Software, modified or unmodified, in part or in whole,
74must be distributed entirely under this license, and must not be
75distributed under any other license. The requirement for fonts to
76remain under this license does not apply to any document created using
77the Font Software.
78
79TERMINATION
80This license becomes null and void if any of the above conditions are
81not met.
82
83DISCLAIMER
84THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92OTHER DEALINGS IN THE FONT SOFTWARE.
crates/app/assets/fonts/NotoColorEmoji.ttf added Binary file +0 −0

The contents of this binary file are not shown.

vendor/gpui-pre-wgpu/.cargo-ok added +1 −0
@@ -0,0 +1 @@
1 {"v":1}
@@ -0,0 +1 @@
1{"v":1}
vendor/gpui-pre-wgpu/Cargo.lock added +5732 −0
@@ -0,0 +1,5732 @@
1 # This file is automatically @generated by Cargo.
2 # It is not intended for manual editing.
3 version = 4
4
5 [[package]]
6 name = "accesskit"
7 version = "0.24.1"
8 source = "registry+https://github.com/rust-lang/crates.io-index"
9 checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320"
10 dependencies = [
11 "enumn",
12 "uuid",
13 ]
14
15 [[package]]
16 name = "addr2line"
17 version = "0.25.1"
18 source = "registry+https://github.com/rust-lang/crates.io-index"
19 checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
20 dependencies = [
21 "gimli",
22 ]
23
24 [[package]]
25 name = "adler2"
26 version = "2.0.1"
27 source = "registry+https://github.com/rust-lang/crates.io-index"
28 checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
29
30 [[package]]
31 name = "aho-corasick"
32 version = "1.1.3"
33 source = "registry+https://github.com/rust-lang/crates.io-index"
34 checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
35 dependencies = [
36 "memchr",
37 ]
38
39 [[package]]
40 name = "aligned"
41 version = "0.4.3"
42 source = "registry+https://github.com/rust-lang/crates.io-index"
43 checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"
44 dependencies = [
45 "as-slice",
46 ]
47
48 [[package]]
49 name = "aligned-vec"
50 version = "0.6.4"
51 source = "registry+https://github.com/rust-lang/crates.io-index"
52 checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"
53 dependencies = [
54 "equator",
55 ]
56
57 [[package]]
58 name = "alloca"
59 version = "0.4.0"
60 source = "registry+https://github.com/rust-lang/crates.io-index"
61 checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4"
62 dependencies = [
63 "cc",
64 ]
65
66 [[package]]
67 name = "allocator-api2"
68 version = "0.2.21"
69 source = "registry+https://github.com/rust-lang/crates.io-index"
70 checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
71
72 [[package]]
73 name = "android_system_properties"
74 version = "0.1.5"
75 source = "registry+https://github.com/rust-lang/crates.io-index"
76 checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
77 dependencies = [
78 "libc",
79 ]
80
81 [[package]]
82 name = "anes"
83 version = "0.1.6"
84 source = "registry+https://github.com/rust-lang/crates.io-index"
85 checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
86
87 [[package]]
88 name = "anstyle"
89 version = "1.0.13"
90 source = "registry+https://github.com/rust-lang/crates.io-index"
91 checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
92
93 [[package]]
94 name = "anyhow"
95 version = "1.0.104"
96 source = "registry+https://github.com/rust-lang/crates.io-index"
97 checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
98
99 [[package]]
100 name = "arbitrary"
101 version = "1.4.2"
102 source = "registry+https://github.com/rust-lang/crates.io-index"
103 checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
104
105 [[package]]
106 name = "arg_enum_proc_macro"
107 version = "0.3.4"
108 source = "registry+https://github.com/rust-lang/crates.io-index"
109 checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
110 dependencies = [
111 "proc-macro2",
112 "quote",
113 "syn 2.0.117",
114 ]
115
116 [[package]]
117 name = "arrayref"
118 version = "0.3.9"
119 source = "registry+https://github.com/rust-lang/crates.io-index"
120 checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"
121
122 [[package]]
123 name = "arrayvec"
124 version = "0.7.6"
125 source = "registry+https://github.com/rust-lang/crates.io-index"
126 checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
127
128 [[package]]
129 name = "as-slice"
130 version = "0.2.1"
131 source = "registry+https://github.com/rust-lang/crates.io-index"
132 checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
133 dependencies = [
134 "stable_deref_trait",
135 ]
136
137 [[package]]
138 name = "ash"
139 version = "0.38.0+1.3.281"
140 source = "registry+https://github.com/rust-lang/crates.io-index"
141 checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
142 dependencies = [
143 "libloading",
144 ]
145
146 [[package]]
147 name = "async-channel"
148 version = "2.5.0"
149 source = "registry+https://github.com/rust-lang/crates.io-index"
150 checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"
151 dependencies = [
152 "concurrent-queue",
153 "event-listener-strategy",
154 "futures-core",
155 "pin-project-lite",
156 ]
157
158 [[package]]
159 name = "async-compression"
160 version = "0.4.32"
161 source = "registry+https://github.com/rust-lang/crates.io-index"
162 checksum = "5a89bce6054c720275ac2432fbba080a66a2106a44a1b804553930ca6909f4e0"
163 dependencies = [
164 "compression-codecs",
165 "compression-core",
166 "futures-core",
167 "futures-io",
168 "pin-project-lite",
169 ]
170
171 [[package]]
172 name = "async-task"
173 version = "4.7.1"
174 source = "registry+https://github.com/rust-lang/crates.io-index"
175 checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
176
177 [[package]]
178 name = "atomic"
179 version = "0.5.3"
180 source = "registry+https://github.com/rust-lang/crates.io-index"
181 checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba"
182
183 [[package]]
184 name = "autocfg"
185 version = "1.5.0"
186 source = "registry+https://github.com/rust-lang/crates.io-index"
187 checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
188
189 [[package]]
190 name = "av-scenechange"
191 version = "0.14.1"
192 source = "registry+https://github.com/rust-lang/crates.io-index"
193 checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394"
194 dependencies = [
195 "aligned",
196 "anyhow",
197 "arg_enum_proc_macro",
198 "arrayvec",
199 "log",
200 "num-rational",
201 "num-traits",
202 "pastey",
203 "rayon",
204 "thiserror 2.0.17",
205 "v_frame",
206 "y4m",
207 ]
208
209 [[package]]
210 name = "av1-grain"
211 version = "0.2.4"
212 source = "registry+https://github.com/rust-lang/crates.io-index"
213 checksum = "4f3efb2ca85bc610acfa917b5aaa36f3fcbebed5b3182d7f877b02531c4b80c8"
214 dependencies = [
215 "anyhow",
216 "arrayvec",
217 "log",
218 "nom",
219 "num-rational",
220 "v_frame",
221 ]
222
223 [[package]]
224 name = "avif-serialize"
225 version = "0.8.6"
226 source = "registry+https://github.com/rust-lang/crates.io-index"
227 checksum = "47c8fbc0f831f4519fe8b810b6a7a91410ec83031b8233f730a0480029f6a23f"
228 dependencies = [
229 "arrayvec",
230 ]
231
232 [[package]]
233 name = "backtrace"
234 version = "0.3.76"
235 source = "registry+https://github.com/rust-lang/crates.io-index"
236 checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
237 dependencies = [
238 "addr2line",
239 "cfg-if",
240 "libc",
241 "miniz_oxide",
242 "object",
243 "rustc-demangle",
244 "windows-link 0.2.1",
245 ]
246
247 [[package]]
248 name = "base64"
249 version = "0.22.1"
250 source = "registry+https://github.com/rust-lang/crates.io-index"
251 checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
252
253 [[package]]
254 name = "bindgen"
255 version = "0.72.1"
256 source = "registry+https://github.com/rust-lang/crates.io-index"
257 checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
258 dependencies = [
259 "bitflags 2.13.1",
260 "cexpr",
261 "clang-sys",
262 "itertools 0.13.0",
263 "log",
264 "prettyplease",
265 "proc-macro2",
266 "quote",
267 "regex",
268 "rustc-hash 2.1.1",
269 "shlex 1.3.0",
270 "syn 2.0.117",
271 ]
272
273 [[package]]
274 name = "bit-set"
275 version = "0.8.0"
276 source = "registry+https://github.com/rust-lang/crates.io-index"
277 checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
278 dependencies = [
279 "bit-vec 0.8.0",
280 ]
281
282 [[package]]
283 name = "bit-set"
284 version = "0.9.1"
285 source = "registry+https://github.com/rust-lang/crates.io-index"
286 checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd"
287 dependencies = [
288 "bit-vec 0.9.1",
289 ]
290
291 [[package]]
292 name = "bit-vec"
293 version = "0.8.0"
294 source = "registry+https://github.com/rust-lang/crates.io-index"
295 checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
296
297 [[package]]
298 name = "bit-vec"
299 version = "0.9.1"
300 source = "registry+https://github.com/rust-lang/crates.io-index"
301 checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"
302
303 [[package]]
304 name = "bit_field"
305 version = "0.10.3"
306 source = "registry+https://github.com/rust-lang/crates.io-index"
307 checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
308
309 [[package]]
310 name = "bitflags"
311 version = "1.3.2"
312 source = "registry+https://github.com/rust-lang/crates.io-index"
313 checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
314
315 [[package]]
316 name = "bitflags"
317 version = "2.13.1"
318 source = "registry+https://github.com/rust-lang/crates.io-index"
319 checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
320
321 [[package]]
322 name = "bitstream-io"
323 version = "4.9.0"
324 source = "registry+https://github.com/rust-lang/crates.io-index"
325 checksum = "60d4bd9d1db2c6bdf285e223a7fa369d5ce98ec767dec949c6ca62863ce61757"
326 dependencies = [
327 "core2",
328 ]
329
330 [[package]]
331 name = "block"
332 version = "0.1.6"
333 source = "registry+https://github.com/rust-lang/crates.io-index"
334 checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
335
336 [[package]]
337 name = "block2"
338 version = "0.6.2"
339 source = "registry+https://github.com/rust-lang/crates.io-index"
340 checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
341 dependencies = [
342 "objc2",
343 ]
344
345 [[package]]
346 name = "built"
347 version = "0.8.0"
348 source = "registry+https://github.com/rust-lang/crates.io-index"
349 checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64"
350
351 [[package]]
352 name = "bumpalo"
353 version = "3.20.3"
354 source = "registry+https://github.com/rust-lang/crates.io-index"
355 checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
356
357 [[package]]
358 name = "bytemuck"
359 version = "1.24.0"
360 source = "registry+https://github.com/rust-lang/crates.io-index"
361 checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4"
362 dependencies = [
363 "bytemuck_derive",
364 ]
365
366 [[package]]
367 name = "bytemuck_derive"
368 version = "1.10.2"
369 source = "registry+https://github.com/rust-lang/crates.io-index"
370 checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff"
371 dependencies = [
372 "proc-macro2",
373 "quote",
374 "syn 2.0.117",
375 ]
376
377 [[package]]
378 name = "byteorder"
379 version = "1.5.0"
380 source = "registry+https://github.com/rust-lang/crates.io-index"
381 checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
382
383 [[package]]
384 name = "byteorder-lite"
385 version = "0.1.0"
386 source = "registry+https://github.com/rust-lang/crates.io-index"
387 checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
388
389 [[package]]
390 name = "bytes"
391 version = "1.11.1"
392 source = "registry+https://github.com/rust-lang/crates.io-index"
393 checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
394
395 [[package]]
396 name = "bzip2"
397 version = "0.6.1"
398 source = "registry+https://github.com/rust-lang/crates.io-index"
399 checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
400 dependencies = [
401 "libbz2-rs-sys",
402 ]
403
404 [[package]]
405 name = "c-enum"
406 version = "0.2.3"
407 source = "registry+https://github.com/rust-lang/crates.io-index"
408 checksum = "cd17eb909a8c6a894926bfcc3400a4bb0e732f5a57d37b1f14e8b29e329bace8"
409
410 [[package]]
411 name = "cast"
412 version = "0.3.0"
413 source = "registry+https://github.com/rust-lang/crates.io-index"
414 checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
415
416 [[package]]
417 name = "cc"
418 version = "1.4.3"
419 source = "registry+https://github.com/rust-lang/crates.io-index"
420 checksum = "509591b7bcd67f4ef775afad7662703b4935daaa6ec0e5605cfb1090b32a2b6d"
421 dependencies = [
422 "find-msvc-tools",
423 "jobserver",
424 "libc",
425 "shlex 2.0.1",
426 ]
427
428 [[package]]
429 name = "cexpr"
430 version = "0.6.0"
431 source = "registry+https://github.com/rust-lang/crates.io-index"
432 checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
433 dependencies = [
434 "nom",
435 ]
436
437 [[package]]
438 name = "cfg-if"
439 version = "1.0.4"
440 source = "registry+https://github.com/rust-lang/crates.io-index"
441 checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
442
443 [[package]]
444 name = "cfg_aliases"
445 version = "0.2.1"
446 source = "registry+https://github.com/rust-lang/crates.io-index"
447 checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
448
449 [[package]]
450 name = "cgl"
451 version = "0.3.2"
452 source = "registry+https://github.com/rust-lang/crates.io-index"
453 checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"
454 dependencies = [
455 "libc",
456 ]
457
458 [[package]]
459 name = "chrono"
460 version = "0.4.42"
461 source = "registry+https://github.com/rust-lang/crates.io-index"
462 checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"
463 dependencies = [
464 "iana-time-zone",
465 "js-sys",
466 "num-traits",
467 "serde",
468 "wasm-bindgen",
469 "windows-link 0.2.1",
470 ]
471
472 [[package]]
473 name = "ciborium"
474 version = "0.2.2"
475 source = "registry+https://github.com/rust-lang/crates.io-index"
476 checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e"
477 dependencies = [
478 "ciborium-io",
479 "ciborium-ll",
480 "serde",
481 ]
482
483 [[package]]
484 name = "ciborium-io"
485 version = "0.2.2"
486 source = "registry+https://github.com/rust-lang/crates.io-index"
487 checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
488
489 [[package]]
490 name = "ciborium-ll"
491 version = "0.2.2"
492 source = "registry+https://github.com/rust-lang/crates.io-index"
493 checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
494 dependencies = [
495 "ciborium-io",
496 "half",
497 ]
498
499 [[package]]
500 name = "clang-sys"
501 version = "1.8.1"
502 source = "registry+https://github.com/rust-lang/crates.io-index"
503 checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
504 dependencies = [
505 "glob",
506 "libc",
507 "libloading",
508 ]
509
510 [[package]]
511 name = "clap"
512 version = "4.5.49"
513 source = "registry+https://github.com/rust-lang/crates.io-index"
514 checksum = "f4512b90fa68d3a9932cea5184017c5d200f5921df706d45e853537dea51508f"
515 dependencies = [
516 "clap_builder",
517 ]
518
519 [[package]]
520 name = "clap_builder"
521 version = "4.5.49"
522 source = "registry+https://github.com/rust-lang/crates.io-index"
523 checksum = "0025e98baa12e766c67ba13ff4695a887a1eba19569aad00a472546795bd6730"
524 dependencies = [
525 "anstyle",
526 "clap_lex",
527 ]
528
529 [[package]]
530 name = "clap_lex"
531 version = "0.7.6"
532 source = "registry+https://github.com/rust-lang/crates.io-index"
533 checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
534
535 [[package]]
536 name = "cocoa"
537 version = "0.25.0"
538 source = "registry+https://github.com/rust-lang/crates.io-index"
539 checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c"
540 dependencies = [
541 "bitflags 1.3.2",
542 "block",
543 "cocoa-foundation",
544 "core-foundation 0.9.4",
545 "core-graphics 0.23.2",
546 "foreign-types",
547 "libc",
548 "objc",
549 ]
550
551 [[package]]
552 name = "cocoa-foundation"
553 version = "0.1.2"
554 source = "registry+https://github.com/rust-lang/crates.io-index"
555 checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7"
556 dependencies = [
557 "bitflags 1.3.2",
558 "block",
559 "core-foundation 0.9.4",
560 "core-graphics-types 0.1.3",
561 "libc",
562 "objc",
563 ]
564
565 [[package]]
566 name = "codespan-reporting"
567 version = "0.13.0"
568 source = "registry+https://github.com/rust-lang/crates.io-index"
569 checksum = "ba7a06c0b31fff5ff2e1e7d37dbf940864e2a974b336e1a2938d10af6e8fb283"
570 dependencies = [
571 "serde",
572 "termcolor",
573 "unicode-width",
574 ]
575
576 [[package]]
577 name = "color_quant"
578 version = "1.1.0"
579 source = "registry+https://github.com/rust-lang/crates.io-index"
580 checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
581
582 [[package]]
583 name = "compression-codecs"
584 version = "0.4.31"
585 source = "registry+https://github.com/rust-lang/crates.io-index"
586 checksum = "ef8a506ec4b81c460798f572caead636d57d3d7e940f998160f52bd254bf2d23"
587 dependencies = [
588 "bzip2",
589 "compression-core",
590 "flate2",
591 "memchr",
592 ]
593
594 [[package]]
595 name = "compression-core"
596 version = "0.4.29"
597 source = "registry+https://github.com/rust-lang/crates.io-index"
598 checksum = "e47641d3deaf41fb1538ac1f54735925e275eaf3bf4d55c81b137fba797e5cbb"
599
600 [[package]]
601 name = "concurrent-queue"
602 version = "2.5.0"
603 source = "registry+https://github.com/rust-lang/crates.io-index"
604 checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
605 dependencies = [
606 "crossbeam-utils",
607 ]
608
609 [[package]]
610 name = "convert_case"
611 version = "0.10.0"
612 source = "registry+https://github.com/rust-lang/crates.io-index"
613 checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9"
614 dependencies = [
615 "unicode-segmentation",
616 ]
617
618 [[package]]
619 name = "convert_case"
620 version = "0.11.0"
621 source = "registry+https://github.com/rust-lang/crates.io-index"
622 checksum = "affbf0190ed2caf063e3def54ff444b449371d55c58e513a95ab98eca50adb49"
623 dependencies = [
624 "unicode-segmentation",
625 ]
626
627 [[package]]
628 name = "core-foundation"
629 version = "0.9.4"
630 source = "registry+https://github.com/rust-lang/crates.io-index"
631 checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
632 dependencies = [
633 "core-foundation-sys",
634 "libc",
635 ]
636
637 [[package]]
638 name = "core-foundation"
639 version = "0.10.0"
640 source = "registry+https://github.com/rust-lang/crates.io-index"
641 checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63"
642 dependencies = [
643 "core-foundation-sys",
644 "libc",
645 ]
646
647 [[package]]
648 name = "core-foundation-sys"
649 version = "0.8.7"
650 source = "registry+https://github.com/rust-lang/crates.io-index"
651 checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
652
653 [[package]]
654 name = "core-graphics"
655 version = "0.23.2"
656 source = "registry+https://github.com/rust-lang/crates.io-index"
657 checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
658 dependencies = [
659 "bitflags 1.3.2",
660 "core-foundation 0.9.4",
661 "core-graphics-types 0.1.3",
662 "foreign-types",
663 "libc",
664 ]
665
666 [[package]]
667 name = "core-graphics"
668 version = "0.24.0"
669 source = "registry+https://github.com/rust-lang/crates.io-index"
670 checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1"
671 dependencies = [
672 "bitflags 2.13.1",
673 "core-foundation 0.10.0",
674 "core-graphics-types 0.2.0",
675 "foreign-types",
676 "libc",
677 ]
678
679 [[package]]
680 name = "core-graphics-helmer-fork"
681 version = "0.24.0"
682 source = "registry+https://github.com/rust-lang/crates.io-index"
683 checksum = "32eb7c354ae9f6d437a6039099ce7ecd049337a8109b23d73e48e8ffba8e9cd5"
684 dependencies = [
685 "bitflags 2.13.1",
686 "core-foundation 0.9.4",
687 "core-graphics-types 0.1.3",
688 "foreign-types",
689 "libc",
690 ]
691
692 [[package]]
693 name = "core-graphics-types"
694 version = "0.1.3"
695 source = "registry+https://github.com/rust-lang/crates.io-index"
696 checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
697 dependencies = [
698 "bitflags 1.3.2",
699 "core-foundation 0.9.4",
700 "libc",
701 ]
702
703 [[package]]
704 name = "core-graphics-types"
705 version = "0.2.0"
706 source = "registry+https://github.com/rust-lang/crates.io-index"
707 checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
708 dependencies = [
709 "bitflags 2.13.1",
710 "core-foundation 0.10.0",
711 "libc",
712 ]
713
714 [[package]]
715 name = "core-graphics2"
716 version = "0.5.2"
717 source = "registry+https://github.com/rust-lang/crates.io-index"
718 checksum = "4416167a69126e617f8d0a214af0e3c1dbdeffcb100ddf72dcd1a1ac9893c146"
719 dependencies = [
720 "bitflags 2.13.1",
721 "block",
722 "cfg-if",
723 "core-foundation 0.10.0",
724 "libc",
725 ]
726
727 [[package]]
728 name = "core-text"
729 version = "21.0.0"
730 source = "registry+https://github.com/rust-lang/crates.io-index"
731 checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130"
732 dependencies = [
733 "core-foundation 0.10.0",
734 "core-graphics 0.24.0",
735 "foreign-types",
736 "libc",
737 ]
738
739 [[package]]
740 name = "core-video"
741 version = "0.5.2"
742 source = "registry+https://github.com/rust-lang/crates.io-index"
743 checksum = "139679cc63eb9504bdbe37e37874b0247136177655f0008588781e90863afa62"
744 dependencies = [
745 "block",
746 "core-foundation 0.10.0",
747 "core-graphics2",
748 "io-surface",
749 "libc",
750 "metal",
751 ]
752
753 [[package]]
754 name = "core2"
755 version = "0.4.0"
756 source = "registry+https://github.com/rust-lang/crates.io-index"
757 checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505"
758 dependencies = [
759 "memchr",
760 ]
761
762 [[package]]
763 name = "core_maths"
764 version = "0.1.1"
765 source = "registry+https://github.com/rust-lang/crates.io-index"
766 checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"
767 dependencies = [
768 "libm",
769 ]
770
771 [[package]]
772 name = "cosmic-text"
773 version = "0.19.0"
774 source = "registry+https://github.com/rust-lang/crates.io-index"
775 checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73"
776 dependencies = [
777 "bitflags 2.13.1",
778 "fontdb",
779 "harfrust",
780 "linebender_resource_handle",
781 "log",
782 "rangemap",
783 "rustc-hash 2.1.1",
784 "self_cell",
785 "skrifa 0.40.0",
786 "smol_str",
787 "swash",
788 "sys-locale",
789 "unicode-bidi",
790 "unicode-linebreak",
791 "unicode-script",
792 "unicode-segmentation",
793 ]
794
795 [[package]]
796 name = "crc32fast"
797 version = "1.5.0"
798 source = "registry+https://github.com/rust-lang/crates.io-index"
799 checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
800 dependencies = [
801 "cfg-if",
802 ]
803
804 [[package]]
805 name = "criterion"
806 version = "0.8.2"
807 source = "registry+https://github.com/rust-lang/crates.io-index"
808 checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3"
809 dependencies = [
810 "alloca",
811 "anes",
812 "cast",
813 "ciborium",
814 "clap",
815 "criterion-plot",
816 "itertools 0.13.0",
817 "num-traits",
818 "oorandom",
819 "page_size",
820 "plotters",
821 "rayon",
822 "regex",
823 "serde",
824 "serde_json",
825 "tinytemplate",
826 "walkdir",
827 ]
828
829 [[package]]
830 name = "criterion-plot"
831 version = "0.8.2"
832 source = "registry+https://github.com/rust-lang/crates.io-index"
833 checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea"
834 dependencies = [
835 "cast",
836 "itertools 0.13.0",
837 ]
838
839 [[package]]
840 name = "crossbeam-deque"
841 version = "0.8.6"
842 source = "registry+https://github.com/rust-lang/crates.io-index"
843 checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
844 dependencies = [
845 "crossbeam-epoch",
846 "crossbeam-utils",
847 ]
848
849 [[package]]
850 name = "crossbeam-epoch"
851 version = "0.9.18"
852 source = "registry+https://github.com/rust-lang/crates.io-index"
853 checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
854 dependencies = [
855 "crossbeam-utils",
856 ]
857
858 [[package]]
859 name = "crossbeam-queue"
860 version = "0.3.12"
861 source = "registry+https://github.com/rust-lang/crates.io-index"
862 checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115"
863 dependencies = [
864 "crossbeam-utils",
865 ]
866
867 [[package]]
868 name = "crossbeam-utils"
869 version = "0.8.21"
870 source = "registry+https://github.com/rust-lang/crates.io-index"
871 checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
872
873 [[package]]
874 name = "crunchy"
875 version = "0.2.4"
876 source = "registry+https://github.com/rust-lang/crates.io-index"
877 checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
878
879 [[package]]
880 name = "ctor"
881 version = "1.0.12"
882 source = "registry+https://github.com/rust-lang/crates.io-index"
883 checksum = "2d83cb7e7a873830708d6b02a78cd36a592c6fa14bf267b68725103b85c0d77f"
884 dependencies = [
885 "link-section",
886 "linktime-proc-macro",
887 ]
888
889 [[package]]
890 name = "data-url"
891 version = "0.3.2"
892 source = "registry+https://github.com/rust-lang/crates.io-index"
893 checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"
894
895 [[package]]
896 name = "derive_more"
897 version = "2.1.1"
898 source = "registry+https://github.com/rust-lang/crates.io-index"
899 checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134"
900 dependencies = [
901 "derive_more-impl",
902 ]
903
904 [[package]]
905 name = "derive_more-impl"
906 version = "2.1.1"
907 source = "registry+https://github.com/rust-lang/crates.io-index"
908 checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb"
909 dependencies = [
910 "convert_case 0.10.0",
911 "proc-macro2",
912 "quote",
913 "rustc_version",
914 "syn 2.0.117",
915 "unicode-xid",
916 ]
917
918 [[package]]
919 name = "dirs"
920 version = "5.0.1"
921 source = "registry+https://github.com/rust-lang/crates.io-index"
922 checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
923 dependencies = [
924 "dirs-sys",
925 ]
926
927 [[package]]
928 name = "dirs-sys"
929 version = "0.4.1"
930 source = "registry+https://github.com/rust-lang/crates.io-index"
931 checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
932 dependencies = [
933 "libc",
934 "option-ext",
935 "redox_users",
936 "windows-sys 0.48.0",
937 ]
938
939 [[package]]
940 name = "dispatch"
941 version = "0.2.0"
942 source = "registry+https://github.com/rust-lang/crates.io-index"
943 checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
944
945 [[package]]
946 name = "dispatch2"
947 version = "0.3.1"
948 source = "registry+https://github.com/rust-lang/crates.io-index"
949 checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
950 dependencies = [
951 "bitflags 2.13.1",
952 "objc2",
953 ]
954
955 [[package]]
956 name = "displaydoc"
957 version = "0.2.5"
958 source = "registry+https://github.com/rust-lang/crates.io-index"
959 checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
960 dependencies = [
961 "proc-macro2",
962 "quote",
963 "syn 2.0.117",
964 ]
965
966 [[package]]
967 name = "dlib"
968 version = "0.5.3"
969 source = "registry+https://github.com/rust-lang/crates.io-index"
970 checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
971 dependencies = [
972 "libloading",
973 ]
974
975 [[package]]
976 name = "document-features"
977 version = "0.2.12"
978 source = "registry+https://github.com/rust-lang/crates.io-index"
979 checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"
980 dependencies = [
981 "litrs",
982 ]
983
984 [[package]]
985 name = "dwrote"
986 version = "0.11.5"
987 source = "registry+https://github.com/rust-lang/crates.io-index"
988 checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02"
989 dependencies = [
990 "lazy_static",
991 "libc",
992 "winapi",
993 "wio",
994 ]
995
996 [[package]]
997 name = "dyn-clone"
998 version = "1.0.20"
999 source = "registry+https://github.com/rust-lang/crates.io-index"
1000 checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
1001
1002 [[package]]
1003 name = "either"
1004 version = "1.15.0"
1005 source = "registry+https://github.com/rust-lang/crates.io-index"
1006 checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
1007
1008 [[package]]
1009 name = "enumn"
1010 version = "0.1.14"
1011 source = "registry+https://github.com/rust-lang/crates.io-index"
1012 checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38"
1013 dependencies = [
1014 "proc-macro2",
1015 "quote",
1016 "syn 2.0.117",
1017 ]
1018
1019 [[package]]
1020 name = "equator"
1021 version = "0.4.2"
1022 source = "registry+https://github.com/rust-lang/crates.io-index"
1023 checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc"
1024 dependencies = [
1025 "equator-macro",
1026 ]
1027
1028 [[package]]
1029 name = "equator-macro"
1030 version = "0.4.2"
1031 source = "registry+https://github.com/rust-lang/crates.io-index"
1032 checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3"
1033 dependencies = [
1034 "proc-macro2",
1035 "quote",
1036 "syn 2.0.117",
1037 ]
1038
1039 [[package]]
1040 name = "equivalent"
1041 version = "1.0.2"
1042 source = "registry+https://github.com/rust-lang/crates.io-index"
1043 checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
1044
1045 [[package]]
1046 name = "erased-serde"
1047 version = "0.4.9"
1048 source = "registry+https://github.com/rust-lang/crates.io-index"
1049 checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3"
1050 dependencies = [
1051 "serde",
1052 "serde_core",
1053 "typeid",
1054 ]
1055
1056 [[package]]
1057 name = "errno"
1058 version = "0.3.14"
1059 source = "registry+https://github.com/rust-lang/crates.io-index"
1060 checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
1061 dependencies = [
1062 "libc",
1063 "windows-sys 0.61.2",
1064 ]
1065
1066 [[package]]
1067 name = "etagere"
1068 version = "0.2.15"
1069 source = "registry+https://github.com/rust-lang/crates.io-index"
1070 checksum = "fc89bf99e5dc15954a60f707c1e09d7540e5cd9af85fa75caa0b510bc08c5342"
1071 dependencies = [
1072 "euclid",
1073 "svg_fmt",
1074 ]
1075
1076 [[package]]
1077 name = "euclid"
1078 version = "0.22.14"
1079 source = "registry+https://github.com/rust-lang/crates.io-index"
1080 checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06"
1081 dependencies = [
1082 "num-traits",
1083 ]
1084
1085 [[package]]
1086 name = "event-listener"
1087 version = "5.4.1"
1088 source = "registry+https://github.com/rust-lang/crates.io-index"
1089 checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"
1090 dependencies = [
1091 "concurrent-queue",
1092 "parking",
1093 "pin-project-lite",
1094 ]
1095
1096 [[package]]
1097 name = "event-listener-strategy"
1098 version = "0.5.4"
1099 source = "registry+https://github.com/rust-lang/crates.io-index"
1100 checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
1101 dependencies = [
1102 "event-listener",
1103 "pin-project-lite",
1104 ]
1105
1106 [[package]]
1107 name = "exr"
1108 version = "1.74.0"
1109 source = "registry+https://github.com/rust-lang/crates.io-index"
1110 checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be"
1111 dependencies = [
1112 "bit_field",
1113 "half",
1114 "lebe",
1115 "miniz_oxide",
1116 "rayon-core",
1117 "smallvec",
1118 "zune-inflate",
1119 ]
1120
1121 [[package]]
1122 name = "fastrand"
1123 version = "2.3.0"
1124 source = "registry+https://github.com/rust-lang/crates.io-index"
1125 checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
1126 dependencies = [
1127 "getrandom 0.2.16",
1128 ]
1129
1130 [[package]]
1131 name = "fax"
1132 version = "0.2.6"
1133 source = "registry+https://github.com/rust-lang/crates.io-index"
1134 checksum = "f05de7d48f37cd6730705cbca900770cab77a89f413d23e100ad7fad7795a0ab"
1135 dependencies = [
1136 "fax_derive",
1137 ]
1138
1139 [[package]]
1140 name = "fax_derive"
1141 version = "0.2.0"
1142 source = "registry+https://github.com/rust-lang/crates.io-index"
1143 checksum = "a0aca10fb742cb43f9e7bb8467c91aa9bcb8e3ffbc6a6f7389bb93ffc920577d"
1144 dependencies = [
1145 "proc-macro2",
1146 "quote",
1147 "syn 2.0.117",
1148 ]
1149
1150 [[package]]
1151 name = "fdeflate"
1152 version = "0.3.7"
1153 source = "registry+https://github.com/rust-lang/crates.io-index"
1154 checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
1155 dependencies = [
1156 "simd-adler32",
1157 ]
1158
1159 [[package]]
1160 name = "find-msvc-tools"
1161 version = "0.1.11"
1162 source = "registry+https://github.com/rust-lang/crates.io-index"
1163 checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
1164
1165 [[package]]
1166 name = "fixedbitset"
1167 version = "0.5.7"
1168 source = "registry+https://github.com/rust-lang/crates.io-index"
1169 checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
1170
1171 [[package]]
1172 name = "flate2"
1173 version = "1.1.8"
1174 source = "registry+https://github.com/rust-lang/crates.io-index"
1175 checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369"
1176 dependencies = [
1177 "crc32fast",
1178 "miniz_oxide",
1179 ]
1180
1181 [[package]]
1182 name = "float-cmp"
1183 version = "0.9.0"
1184 source = "registry+https://github.com/rust-lang/crates.io-index"
1185 checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
1186
1187 [[package]]
1188 name = "float-ord"
1189 version = "0.3.2"
1190 source = "registry+https://github.com/rust-lang/crates.io-index"
1191 checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d"
1192
1193 [[package]]
1194 name = "float_next_after"
1195 version = "1.0.0"
1196 source = "registry+https://github.com/rust-lang/crates.io-index"
1197 checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8"
1198
1199 [[package]]
1200 name = "flume"
1201 version = "0.12.0"
1202 source = "registry+https://github.com/rust-lang/crates.io-index"
1203 checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be"
1204 dependencies = [
1205 "fastrand",
1206 "futures-core",
1207 "futures-sink",
1208 "spin 0.9.8",
1209 ]
1210
1211 [[package]]
1212 name = "fnv"
1213 version = "1.0.7"
1214 source = "registry+https://github.com/rust-lang/crates.io-index"
1215 checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
1216
1217 [[package]]
1218 name = "foldhash"
1219 version = "0.1.5"
1220 source = "registry+https://github.com/rust-lang/crates.io-index"
1221 checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
1222
1223 [[package]]
1224 name = "foldhash"
1225 version = "0.2.0"
1226 source = "registry+https://github.com/rust-lang/crates.io-index"
1227 checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
1228
1229 [[package]]
1230 name = "font-types"
1231 version = "0.10.0"
1232 source = "registry+https://github.com/rust-lang/crates.io-index"
1233 checksum = "511e2c18a516c666d27867d2f9821f76e7d591f762e9fc41dd6cc5c90fe54b0b"
1234 dependencies = [
1235 "bytemuck",
1236 ]
1237
1238 [[package]]
1239 name = "font-types"
1240 version = "0.11.0"
1241 source = "registry+https://github.com/rust-lang/crates.io-index"
1242 checksum = "b1e4d2d0cf79d38430cc9dc9aadec84774bff2e1ba30ae2bf6c16cfce9385a23"
1243 dependencies = [
1244 "bytemuck",
1245 ]
1246
1247 [[package]]
1248 name = "fontconfig-parser"
1249 version = "0.5.8"
1250 source = "registry+https://github.com/rust-lang/crates.io-index"
1251 checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646"
1252 dependencies = [
1253 "roxmltree 0.20.0",
1254 ]
1255
1256 [[package]]
1257 name = "fontdb"
1258 version = "0.23.0"
1259 source = "registry+https://github.com/rust-lang/crates.io-index"
1260 checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905"
1261 dependencies = [
1262 "fontconfig-parser",
1263 "log",
1264 "memmap2",
1265 "slotmap",
1266 "tinyvec",
1267 "ttf-parser",
1268 ]
1269
1270 [[package]]
1271 name = "foreign-types"
1272 version = "0.5.0"
1273 source = "registry+https://github.com/rust-lang/crates.io-index"
1274 checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
1275 dependencies = [
1276 "foreign-types-macros",
1277 "foreign-types-shared",
1278 ]
1279
1280 [[package]]
1281 name = "foreign-types-macros"
1282 version = "0.2.3"
1283 source = "registry+https://github.com/rust-lang/crates.io-index"
1284 checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
1285 dependencies = [
1286 "proc-macro2",
1287 "quote",
1288 "syn 2.0.117",
1289 ]
1290
1291 [[package]]
1292 name = "foreign-types-shared"
1293 version = "0.3.1"
1294 source = "registry+https://github.com/rust-lang/crates.io-index"
1295 checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
1296
1297 [[package]]
1298 name = "form_urlencoded"
1299 version = "1.2.2"
1300 source = "registry+https://github.com/rust-lang/crates.io-index"
1301 checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
1302 dependencies = [
1303 "percent-encoding",
1304 ]
1305
1306 [[package]]
1307 name = "freetype-sys"
1308 version = "0.20.1"
1309 source = "registry+https://github.com/rust-lang/crates.io-index"
1310 checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134"
1311 dependencies = [
1312 "cc",
1313 "libc",
1314 "pkg-config",
1315 ]
1316
1317 [[package]]
1318 name = "futures"
1319 version = "0.3.34"
1320 source = "registry+https://github.com/rust-lang/crates.io-index"
1321 checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3"
1322 dependencies = [
1323 "futures-channel",
1324 "futures-core",
1325 "futures-executor",
1326 "futures-io",
1327 "futures-sink",
1328 "futures-task",
1329 "futures-util",
1330 ]
1331
1332 [[package]]
1333 name = "futures-channel"
1334 version = "0.3.34"
1335 source = "registry+https://github.com/rust-lang/crates.io-index"
1336 checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"
1337 dependencies = [
1338 "futures-core",
1339 "futures-sink",
1340 ]
1341
1342 [[package]]
1343 name = "futures-concurrency"
1344 version = "7.7.1"
1345 source = "registry+https://github.com/rust-lang/crates.io-index"
1346 checksum = "175cd8cca9e1d45b87f18ffa75088f2099e3c4fe5e2f83e42de112560bea8ea6"
1347 dependencies = [
1348 "fixedbitset",
1349 "futures-core",
1350 "futures-lite",
1351 "pin-project",
1352 "smallvec",
1353 ]
1354
1355 [[package]]
1356 name = "futures-core"
1357 version = "0.3.34"
1358 source = "registry+https://github.com/rust-lang/crates.io-index"
1359 checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
1360
1361 [[package]]
1362 name = "futures-executor"
1363 version = "0.3.34"
1364 source = "registry+https://github.com/rust-lang/crates.io-index"
1365 checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432"
1366 dependencies = [
1367 "futures-core",
1368 "futures-task",
1369 "futures-util",
1370 ]
1371
1372 [[package]]
1373 name = "futures-io"
1374 version = "0.3.34"
1375 source = "registry+https://github.com/rust-lang/crates.io-index"
1376 checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"
1377
1378 [[package]]
1379 name = "futures-lite"
1380 version = "2.6.1"
1381 source = "registry+https://github.com/rust-lang/crates.io-index"
1382 checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
1383 dependencies = [
1384 "fastrand",
1385 "futures-core",
1386 "futures-io",
1387 "parking",
1388 "pin-project-lite",
1389 ]
1390
1391 [[package]]
1392 name = "futures-macro"
1393 version = "0.3.34"
1394 source = "registry+https://github.com/rust-lang/crates.io-index"
1395 checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
1396 dependencies = [
1397 "proc-macro2",
1398 "quote",
1399 "syn 3.0.3",
1400 ]
1401
1402 [[package]]
1403 name = "futures-sink"
1404 version = "0.3.34"
1405 source = "registry+https://github.com/rust-lang/crates.io-index"
1406 checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
1407
1408 [[package]]
1409 name = "futures-task"
1410 version = "0.3.34"
1411 source = "registry+https://github.com/rust-lang/crates.io-index"
1412 checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
1413
1414 [[package]]
1415 name = "futures-util"
1416 version = "0.3.34"
1417 source = "registry+https://github.com/rust-lang/crates.io-index"
1418 checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
1419 dependencies = [
1420 "futures-channel",
1421 "futures-core",
1422 "futures-io",
1423 "futures-macro",
1424 "futures-sink",
1425 "futures-task",
1426 "memchr",
1427 "pin-project-lite",
1428 "slab",
1429 ]
1430
1431 [[package]]
1432 name = "getrandom"
1433 version = "0.2.16"
1434 source = "registry+https://github.com/rust-lang/crates.io-index"
1435 checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
1436 dependencies = [
1437 "cfg-if",
1438 "js-sys",
1439 "libc",
1440 "wasi",
1441 "wasm-bindgen",
1442 ]
1443
1444 [[package]]
1445 name = "getrandom"
1446 version = "0.3.4"
1447 source = "registry+https://github.com/rust-lang/crates.io-index"
1448 checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
1449 dependencies = [
1450 "cfg-if",
1451 "js-sys",
1452 "libc",
1453 "r-efi",
1454 "wasip2",
1455 "wasm-bindgen",
1456 ]
1457
1458 [[package]]
1459 name = "getrandom"
1460 version = "0.4.1"
1461 source = "registry+https://github.com/rust-lang/crates.io-index"
1462 checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
1463 dependencies = [
1464 "cfg-if",
1465 "libc",
1466 "r-efi",
1467 "wasip2",
1468 "wasip3",
1469 ]
1470
1471 [[package]]
1472 name = "gif"
1473 version = "0.14.2"
1474 source = "registry+https://github.com/rust-lang/crates.io-index"
1475 checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159"
1476 dependencies = [
1477 "color_quant",
1478 "weezl",
1479 ]
1480
1481 [[package]]
1482 name = "gimli"
1483 version = "0.32.3"
1484 source = "registry+https://github.com/rust-lang/crates.io-index"
1485 checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
1486
1487 [[package]]
1488 name = "gl_generator"
1489 version = "0.14.0"
1490 source = "registry+https://github.com/rust-lang/crates.io-index"
1491 checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"
1492 dependencies = [
1493 "khronos_api",
1494 "log",
1495 "xml-rs",
1496 ]
1497
1498 [[package]]
1499 name = "glob"
1500 version = "0.3.3"
1501 source = "registry+https://github.com/rust-lang/crates.io-index"
1502 checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
1503
1504 [[package]]
1505 name = "glow"
1506 version = "0.17.0"
1507 source = "registry+https://github.com/rust-lang/crates.io-index"
1508 checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5"
1509 dependencies = [
1510 "js-sys",
1511 "slotmap",
1512 "wasm-bindgen",
1513 "web-sys",
1514 ]
1515
1516 [[package]]
1517 name = "glutin_wgl_sys"
1518 version = "0.6.1"
1519 source = "registry+https://github.com/rust-lang/crates.io-index"
1520 checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e"
1521 dependencies = [
1522 "gl_generator",
1523 ]
1524
1525 [[package]]
1526 name = "gpu-allocator"
1527 version = "0.28.0"
1528 source = "registry+https://github.com/rust-lang/crates.io-index"
1529 checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795"
1530 dependencies = [
1531 "ash",
1532 "hashbrown 0.16.1",
1533 "log",
1534 "presser",
1535 "thiserror 2.0.17",
1536 "windows 0.62.2",
1537 ]
1538
1539 [[package]]
1540 name = "gpu-descriptor"
1541 version = "0.3.2"
1542 source = "registry+https://github.com/rust-lang/crates.io-index"
1543 checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
1544 dependencies = [
1545 "bitflags 2.13.1",
1546 "gpu-descriptor-types",
1547 "hashbrown 0.15.5",
1548 ]
1549
1550 [[package]]
1551 name = "gpu-descriptor-types"
1552 version = "0.2.0"
1553 source = "registry+https://github.com/rust-lang/crates.io-index"
1554 checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
1555 dependencies = [
1556 "bitflags 2.13.1",
1557 ]
1558
1559 [[package]]
1560 name = "gpui-pre"
1561 version = "0.3.8"
1562 source = "registry+https://github.com/rust-lang/crates.io-index"
1563 checksum = "d7f0bc3ebba070f8981b3f8e905a12f47d27794a30d029e59cdb9edf7a4b3360"
1564 dependencies = [
1565 "accesskit",
1566 "anyhow",
1567 "async-channel",
1568 "async-task",
1569 "backtrace",
1570 "bindgen",
1571 "bitflags 2.13.1",
1572 "chrono",
1573 "core-video",
1574 "criterion",
1575 "ctor",
1576 "derive_more",
1577 "etagere",
1578 "futures",
1579 "futures-concurrency",
1580 "getrandom 0.3.4",
1581 "gpui-pre-bench-metrics",
1582 "gpui-pre-collections",
1583 "gpui-pre-http-client",
1584 "gpui-pre-macros",
1585 "gpui-pre-refineable",
1586 "gpui-pre-scheduler",
1587 "gpui-pre-shared-string",
1588 "gpui-pre-sum-tree",
1589 "gpui-pre-util",
1590 "gpui-pre-util-macros",
1591 "hdrhistogram",
1592 "heapless",
1593 "image",
1594 "inventory",
1595 "itertools 0.14.0",
1596 "libc",
1597 "log",
1598 "lyon",
1599 "num_cpus",
1600 "objc2-core-foundation",
1601 "objc2-core-video",
1602 "parking",
1603 "parking_lot",
1604 "pin-project",
1605 "pollster 0.4.0",
1606 "postage",
1607 "profiling",
1608 "proptest",
1609 "rand 0.9.4",
1610 "raw-window-handle",
1611 "regex",
1612 "resvg",
1613 "schemars",
1614 "seahash",
1615 "serde",
1616 "serde_json",
1617 "slotmap",
1618 "smallvec",
1619 "spin 0.10.0",
1620 "strum",
1621 "taffy",
1622 "thiserror 2.0.17",
1623 "ttf-parser",
1624 "url",
1625 "usvg",
1626 "uuid",
1627 "waker-fn",
1628 "web-time",
1629 "windows 0.62.2",
1630 "zed-scap",
1631 ]
1632
1633 [[package]]
1634 name = "gpui-pre-bench-metrics"
1635 version = "0.3.8"
1636 source = "registry+https://github.com/rust-lang/crates.io-index"
1637 checksum = "627ecb377abdf6a0afeb9992e625e68c63458678968a02fb39d4cae700c60b6b"
1638 dependencies = [
1639 "anyhow",
1640 "criterion",
1641 "libc",
1642 "perf-event2",
1643 ]
1644
1645 [[package]]
1646 name = "gpui-pre-collections"
1647 version = "0.3.8"
1648 source = "registry+https://github.com/rust-lang/crates.io-index"
1649 checksum = "2c060863025dc3b8e90febad2d1f4ffd23a5d0dcedba39d3f6b7820ea2fdd3a0"
1650 dependencies = [
1651 "gpui-pre-util",
1652 "indexmap",
1653 "rustc-hash 2.1.1",
1654 ]
1655
1656 [[package]]
1657 name = "gpui-pre-derive-refineable"
1658 version = "0.3.8"
1659 source = "registry+https://github.com/rust-lang/crates.io-index"
1660 checksum = "bc834f30f5f49791e214f1fde01a009c7de91c9cd0a9f31dabfed130ba39e6cf"
1661 dependencies = [
1662 "proc-macro2",
1663 "quote",
1664 "syn 2.0.117",
1665 ]
1666
1667 [[package]]
1668 name = "gpui-pre-http-client"
1669 version = "0.3.8"
1670 source = "registry+https://github.com/rust-lang/crates.io-index"
1671 checksum = "5d2935cf82333da3f41774e5757837756408f01356197b41c817ad2666034453"
1672 dependencies = [
1673 "anyhow",
1674 "async-compression",
1675 "bytes",
1676 "derive_more",
1677 "futures",
1678 "http",
1679 "http-body",
1680 "log",
1681 "parking_lot",
1682 "serde",
1683 "serde_json",
1684 "serde_urlencoded",
1685 "url",
1686 ]
1687
1688 [[package]]
1689 name = "gpui-pre-macros"
1690 version = "0.3.8"
1691 source = "registry+https://github.com/rust-lang/crates.io-index"
1692 checksum = "d2ad26ca759364694cb55487bebff4c1b7dd6accab49990ff3cda6f7a818a9f4"
1693 dependencies = [
1694 "heck",
1695 "proc-macro-crate",
1696 "proc-macro2",
1697 "quote",
1698 "syn 2.0.117",
1699 ]
1700
1701 [[package]]
1702 name = "gpui-pre-perf"
1703 version = "0.3.8"
1704 source = "registry+https://github.com/rust-lang/crates.io-index"
1705 checksum = "2fcb288a506a476b6cbf97e6ec1cc0118db43f0ca91087588afa1c2d8cd4f842"
1706 dependencies = [
1707 "gpui-pre-collections",
1708 "serde",
1709 "serde_json",
1710 ]
1711
1712 [[package]]
1713 name = "gpui-pre-refineable"
1714 version = "0.3.8"
1715 source = "registry+https://github.com/rust-lang/crates.io-index"
1716 checksum = "4042345bb5bd3ecbc5d15b21ed128154f462a992058d7038cd397631f5462338"
1717 dependencies = [
1718 "gpui-pre-derive-refineable",
1719 ]
1720
1721 [[package]]
1722 name = "gpui-pre-scheduler"
1723 version = "0.3.8"
1724 source = "registry+https://github.com/rust-lang/crates.io-index"
1725 checksum = "f4acd73345bc3c09f1b98c1b21eb4459ad8336f89bb2edcef619e11c5a08456e"
1726 dependencies = [
1727 "async-task",
1728 "backtrace",
1729 "chrono",
1730 "flume",
1731 "futures",
1732 "parking_lot",
1733 "rand 0.9.4",
1734 "web-time",
1735 ]
1736
1737 [[package]]
1738 name = "gpui-pre-shared-string"
1739 version = "0.3.8"
1740 source = "registry+https://github.com/rust-lang/crates.io-index"
1741 checksum = "477529fd5aa90bff969785ee9a3938484d94aa5101cdf7b84719629c0345f98a"
1742 dependencies = [
1743 "schemars",
1744 "serde",
1745 "smol_str",
1746 ]
1747
1748 [[package]]
1749 name = "gpui-pre-sum-tree"
1750 version = "0.3.8"
1751 source = "registry+https://github.com/rust-lang/crates.io-index"
1752 checksum = "9ec0ec176d576b82aed716cf47185856b54ea9528caaf9d01787024689bfd824"
1753 dependencies = [
1754 "gpui-pre-ztracing",
1755 "heapless",
1756 "log",
1757 "rayon",
1758 "tracing",
1759 ]
1760
1761 [[package]]
1762 name = "gpui-pre-util"
1763 version = "0.3.8"
1764 source = "registry+https://github.com/rust-lang/crates.io-index"
1765 checksum = "e1635ae7d0b05400bfa211ddef6c67dc8d9f223c463022c2b3bf2c1c14c6044f"
1766 dependencies = [
1767 "anyhow",
1768 "log",
1769 "which",
1770 ]
1771
1772 [[package]]
1773 name = "gpui-pre-util-macros"
1774 version = "0.3.8"
1775 source = "registry+https://github.com/rust-lang/crates.io-index"
1776 checksum = "01486fce7722e5d7d7e7bb71c719dfdcc6ed917112bdc7c56d0556fdb60d10ab"
1777 dependencies = [
1778 "gpui-pre-perf",
1779 "quote",
1780 "syn 2.0.117",
1781 ]
1782
1783 [[package]]
1784 name = "gpui-pre-wgpu"
1785 version = "0.3.8"
1786 dependencies = [
1787 "anyhow",
1788 "bytemuck",
1789 "cosmic-text",
1790 "etagere",
1791 "gpui-pre",
1792 "gpui-pre-collections",
1793 "gpui-pre-util",
1794 "image",
1795 "itertools 0.14.0",
1796 "log",
1797 "parking_lot",
1798 "profiling",
1799 "raw-window-handle",
1800 "smallvec",
1801 "swash",
1802 "unicode-bidi",
1803 "unicode-segmentation",
1804 "web-sys",
1805 "wgpu",
1806 "zed-font-kit",
1807 ]
1808
1809 [[package]]
1810 name = "gpui-pre-zlog"
1811 version = "0.3.8"
1812 source = "registry+https://github.com/rust-lang/crates.io-index"
1813 checksum = "3bbe5b98630ef4bfed5a7105ec1062e78d571912bc491388f07ea22f2457c18b"
1814 dependencies = [
1815 "anyhow",
1816 "chrono",
1817 "gpui-pre-collections",
1818 "log",
1819 ]
1820
1821 [[package]]
1822 name = "gpui-pre-ztracing"
1823 version = "0.3.8"
1824 source = "registry+https://github.com/rust-lang/crates.io-index"
1825 checksum = "f806400f6bda1fdd9fc627e158c0e44fb0c4b7767582a3621efcf92f4a850db7"
1826 dependencies = [
1827 "gpui-pre-zlog",
1828 "gpui-pre-ztracing-macro",
1829 "tracing",
1830 "tracing-subscriber",
1831 ]
1832
1833 [[package]]
1834 name = "gpui-pre-ztracing-macro"
1835 version = "0.3.8"
1836 source = "registry+https://github.com/rust-lang/crates.io-index"
1837 checksum = "d337c9acf058238e45ce0570d8a5958439242889492f91ae2d8e324211a61ccd"
1838
1839 [[package]]
1840 name = "half"
1841 version = "2.7.1"
1842 source = "registry+https://github.com/rust-lang/crates.io-index"
1843 checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
1844 dependencies = [
1845 "cfg-if",
1846 "crunchy",
1847 "num-traits",
1848 "zerocopy",
1849 ]
1850
1851 [[package]]
1852 name = "harfrust"
1853 version = "0.5.0"
1854 source = "registry+https://github.com/rust-lang/crates.io-index"
1855 checksum = "4f9f40651a03bc0f7316bd75267ff5767e93017ef3cfffe76c6aa7252cc5a31c"
1856 dependencies = [
1857 "bitflags 2.13.1",
1858 "bytemuck",
1859 "core_maths",
1860 "read-fonts 0.37.0",
1861 "smallvec",
1862 ]
1863
1864 [[package]]
1865 name = "hash32"
1866 version = "0.3.1"
1867 source = "registry+https://github.com/rust-lang/crates.io-index"
1868 checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
1869 dependencies = [
1870 "byteorder",
1871 ]
1872
1873 [[package]]
1874 name = "hashbrown"
1875 version = "0.15.5"
1876 source = "registry+https://github.com/rust-lang/crates.io-index"
1877 checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
1878 dependencies = [
1879 "foldhash 0.1.5",
1880 ]
1881
1882 [[package]]
1883 name = "hashbrown"
1884 version = "0.16.1"
1885 source = "registry+https://github.com/rust-lang/crates.io-index"
1886 checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
1887 dependencies = [
1888 "allocator-api2",
1889 "equivalent",
1890 "foldhash 0.2.0",
1891 ]
1892
1893 [[package]]
1894 name = "hashbrown"
1895 version = "0.17.1"
1896 source = "registry+https://github.com/rust-lang/crates.io-index"
1897 checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
1898
1899 [[package]]
1900 name = "hdrhistogram"
1901 version = "7.5.4"
1902 source = "registry+https://github.com/rust-lang/crates.io-index"
1903 checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d"
1904 dependencies = [
1905 "byteorder",
1906 "num-traits",
1907 ]
1908
1909 [[package]]
1910 name = "heapless"
1911 version = "0.9.2"
1912 source = "registry+https://github.com/rust-lang/crates.io-index"
1913 checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed"
1914 dependencies = [
1915 "hash32",
1916 "stable_deref_trait",
1917 ]
1918
1919 [[package]]
1920 name = "heck"
1921 version = "0.5.0"
1922 source = "registry+https://github.com/rust-lang/crates.io-index"
1923 checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
1924
1925 [[package]]
1926 name = "hermit-abi"
1927 version = "0.5.2"
1928 source = "registry+https://github.com/rust-lang/crates.io-index"
1929 checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
1930
1931 [[package]]
1932 name = "hexf-parse"
1933 version = "0.2.1"
1934 source = "registry+https://github.com/rust-lang/crates.io-index"
1935 checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
1936
1937 [[package]]
1938 name = "http"
1939 version = "1.3.1"
1940 source = "registry+https://github.com/rust-lang/crates.io-index"
1941 checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
1942 dependencies = [
1943 "bytes",
1944 "fnv",
1945 "itoa",
1946 ]
1947
1948 [[package]]
1949 name = "http-body"
1950 version = "1.0.1"
1951 source = "registry+https://github.com/rust-lang/crates.io-index"
1952 checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
1953 dependencies = [
1954 "bytes",
1955 "http",
1956 ]
1957
1958 [[package]]
1959 name = "iana-time-zone"
1960 version = "0.1.64"
1961 source = "registry+https://github.com/rust-lang/crates.io-index"
1962 checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb"
1963 dependencies = [
1964 "android_system_properties",
1965 "core-foundation-sys",
1966 "iana-time-zone-haiku",
1967 "js-sys",
1968 "log",
1969 "wasm-bindgen",
1970 "windows-core 0.62.2",
1971 ]
1972
1973 [[package]]
1974 name = "iana-time-zone-haiku"
1975 version = "0.1.2"
1976 source = "registry+https://github.com/rust-lang/crates.io-index"
1977 checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
1978 dependencies = [
1979 "cc",
1980 ]
1981
1982 [[package]]
1983 name = "icu_collections"
1984 version = "2.3.0"
1985 source = "registry+https://github.com/rust-lang/crates.io-index"
1986 checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"
1987 dependencies = [
1988 "displaydoc",
1989 "potential_utf",
1990 "utf8_iter",
1991 "yoke",
1992 "zerofrom",
1993 "zerovec",
1994 ]
1995
1996 [[package]]
1997 name = "icu_locale_core"
1998 version = "2.3.0"
1999 source = "registry+https://github.com/rust-lang/crates.io-index"
2000 checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"
2001 dependencies = [
2002 "displaydoc",
2003 "litemap",
2004 "tinystr",
2005 "writeable",
2006 "zerovec",
2007 ]
2008
2009 [[package]]
2010 name = "icu_normalizer"
2011 version = "2.3.0"
2012 source = "registry+https://github.com/rust-lang/crates.io-index"
2013 checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f"
2014 dependencies = [
2015 "icu_collections",
2016 "icu_normalizer_data",
2017 "icu_properties",
2018 "icu_provider",
2019 "smallvec",
2020 "zerovec",
2021 ]
2022
2023 [[package]]
2024 name = "icu_normalizer_data"
2025 version = "2.3.0"
2026 source = "registry+https://github.com/rust-lang/crates.io-index"
2027 checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0"
2028
2029 [[package]]
2030 name = "icu_properties"
2031 version = "2.3.0"
2032 source = "registry+https://github.com/rust-lang/crates.io-index"
2033 checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148"
2034 dependencies = [
2035 "displaydoc",
2036 "icu_collections",
2037 "icu_locale_core",
2038 "icu_properties_data",
2039 "icu_provider",
2040 "zerotrie",
2041 "zerovec",
2042 ]
2043
2044 [[package]]
2045 name = "icu_properties_data"
2046 version = "2.3.0"
2047 source = "registry+https://github.com/rust-lang/crates.io-index"
2048 checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"
2049
2050 [[package]]
2051 name = "icu_provider"
2052 version = "2.3.0"
2053 source = "registry+https://github.com/rust-lang/crates.io-index"
2054 checksum = "92a7ed671a6aad807a8651a2e1782a6598fda9ce5185dd8158549e95a91c6428"
2055 dependencies = [
2056 "displaydoc",
2057 "icu_locale_core",
2058 "writeable",
2059 "yoke",
2060 "zerofrom",
2061 "zerotrie",
2062 "zerovec",
2063 ]
2064
2065 [[package]]
2066 name = "id-arena"
2067 version = "2.3.0"
2068 source = "registry+https://github.com/rust-lang/crates.io-index"
2069 checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
2070
2071 [[package]]
2072 name = "idna"
2073 version = "1.1.0"
2074 source = "registry+https://github.com/rust-lang/crates.io-index"
2075 checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
2076 dependencies = [
2077 "idna_adapter",
2078 "smallvec",
2079 "utf8_iter",
2080 ]
2081
2082 [[package]]
2083 name = "idna_adapter"
2084 version = "1.2.1"
2085 source = "registry+https://github.com/rust-lang/crates.io-index"
2086 checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
2087 dependencies = [
2088 "icu_normalizer",
2089 "icu_properties",
2090 ]
2091
2092 [[package]]
2093 name = "image"
2094 version = "0.25.10"
2095 source = "registry+https://github.com/rust-lang/crates.io-index"
2096 checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
2097 dependencies = [
2098 "bytemuck",
2099 "byteorder-lite",
2100 "color_quant",
2101 "exr",
2102 "gif",
2103 "image-webp",
2104 "moxcms",
2105 "num-traits",
2106 "png 0.18.0",
2107 "qoi",
2108 "ravif",
2109 "rayon",
2110 "tiff",
2111 "zune-core",
2112 "zune-jpeg",
2113 ]
2114
2115 [[package]]
2116 name = "image-webp"
2117 version = "0.2.4"
2118 source = "registry+https://github.com/rust-lang/crates.io-index"
2119 checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
2120 dependencies = [
2121 "byteorder-lite",
2122 "quick-error 2.0.1",
2123 ]
2124
2125 [[package]]
2126 name = "imagesize"
2127 version = "0.14.0"
2128 source = "registry+https://github.com/rust-lang/crates.io-index"
2129 checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c"
2130
2131 [[package]]
2132 name = "imgref"
2133 version = "1.12.0"
2134 source = "registry+https://github.com/rust-lang/crates.io-index"
2135 checksum = "e7c5cedc30da3a610cac6b4ba17597bdf7152cf974e8aab3afb3d54455e371c8"
2136
2137 [[package]]
2138 name = "indexmap"
2139 version = "2.14.0"
2140 source = "registry+https://github.com/rust-lang/crates.io-index"
2141 checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
2142 dependencies = [
2143 "equivalent",
2144 "hashbrown 0.17.1",
2145 "serde",
2146 "serde_core",
2147 ]
2148
2149 [[package]]
2150 name = "interpolate_name"
2151 version = "0.2.4"
2152 source = "registry+https://github.com/rust-lang/crates.io-index"
2153 checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
2154 dependencies = [
2155 "proc-macro2",
2156 "quote",
2157 "syn 2.0.117",
2158 ]
2159
2160 [[package]]
2161 name = "inventory"
2162 version = "0.3.21"
2163 source = "registry+https://github.com/rust-lang/crates.io-index"
2164 checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e"
2165 dependencies = [
2166 "rustversion",
2167 ]
2168
2169 [[package]]
2170 name = "io-surface"
2171 version = "0.16.1"
2172 source = "registry+https://github.com/rust-lang/crates.io-index"
2173 checksum = "554b8c5d64ec09a3a520fe58e4d48a73e00ff32899cdcbe32a4877afd4968b8e"
2174 dependencies = [
2175 "cgl",
2176 "core-foundation 0.10.0",
2177 "core-foundation-sys",
2178 "leaky-cow",
2179 ]
2180
2181 [[package]]
2182 name = "itertools"
2183 version = "0.13.0"
2184 source = "registry+https://github.com/rust-lang/crates.io-index"
2185 checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
2186 dependencies = [
2187 "either",
2188 ]
2189
2190 [[package]]
2191 name = "itertools"
2192 version = "0.14.0"
2193 source = "registry+https://github.com/rust-lang/crates.io-index"
2194 checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
2195 dependencies = [
2196 "either",
2197 ]
2198
2199 [[package]]
2200 name = "itoa"
2201 version = "1.0.18"
2202 source = "registry+https://github.com/rust-lang/crates.io-index"
2203 checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
2204
2205 [[package]]
2206 name = "jni-sys"
2207 version = "0.3.0"
2208 source = "registry+https://github.com/rust-lang/crates.io-index"
2209 checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
2210
2211 [[package]]
2212 name = "jobserver"
2213 version = "0.1.34"
2214 source = "registry+https://github.com/rust-lang/crates.io-index"
2215 checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
2216 dependencies = [
2217 "getrandom 0.3.4",
2218 "libc",
2219 ]
2220
2221 [[package]]
2222 name = "js-sys"
2223 version = "0.3.97"
2224 source = "registry+https://github.com/rust-lang/crates.io-index"
2225 checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf"
2226 dependencies = [
2227 "cfg-if",
2228 "futures-util",
2229 "once_cell",
2230 "wasm-bindgen",
2231 ]
2232
2233 [[package]]
2234 name = "khronos-egl"
2235 version = "6.0.0"
2236 source = "registry+https://github.com/rust-lang/crates.io-index"
2237 checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
2238 dependencies = [
2239 "libc",
2240 "libloading",
2241 "pkg-config",
2242 ]
2243
2244 [[package]]
2245 name = "khronos_api"
2246 version = "3.1.0"
2247 source = "registry+https://github.com/rust-lang/crates.io-index"
2248 checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
2249
2250 [[package]]
2251 name = "kurbo"
2252 version = "0.13.1"
2253 source = "registry+https://github.com/rust-lang/crates.io-index"
2254 checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2"
2255 dependencies = [
2256 "arrayvec",
2257 "euclid",
2258 "polycool",
2259 "smallvec",
2260 ]
2261
2262 [[package]]
2263 name = "lazy_static"
2264 version = "1.5.0"
2265 source = "registry+https://github.com/rust-lang/crates.io-index"
2266 checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
2267
2268 [[package]]
2269 name = "leak"
2270 version = "0.1.2"
2271 source = "registry+https://github.com/rust-lang/crates.io-index"
2272 checksum = "bd100e01f1154f2908dfa7d02219aeab25d0b9c7fa955164192e3245255a0c73"
2273
2274 [[package]]
2275 name = "leaky-cow"
2276 version = "0.1.1"
2277 source = "registry+https://github.com/rust-lang/crates.io-index"
2278 checksum = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc"
2279 dependencies = [
2280 "leak",
2281 ]
2282
2283 [[package]]
2284 name = "leb128fmt"
2285 version = "0.1.0"
2286 source = "registry+https://github.com/rust-lang/crates.io-index"
2287 checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
2288
2289 [[package]]
2290 name = "lebe"
2291 version = "0.5.3"
2292 source = "registry+https://github.com/rust-lang/crates.io-index"
2293 checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
2294
2295 [[package]]
2296 name = "libbz2-rs-sys"
2297 version = "0.2.2"
2298 source = "registry+https://github.com/rust-lang/crates.io-index"
2299 checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7"
2300
2301 [[package]]
2302 name = "libc"
2303 version = "0.2.186"
2304 source = "registry+https://github.com/rust-lang/crates.io-index"
2305 checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
2306
2307 [[package]]
2308 name = "libfuzzer-sys"
2309 version = "0.4.10"
2310 source = "registry+https://github.com/rust-lang/crates.io-index"
2311 checksum = "5037190e1f70cbeef565bd267599242926f724d3b8a9f510fd7e0b540cfa4404"
2312 dependencies = [
2313 "arbitrary",
2314 "cc",
2315 ]
2316
2317 [[package]]
2318 name = "libloading"
2319 version = "0.8.9"
2320 source = "registry+https://github.com/rust-lang/crates.io-index"
2321 checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
2322 dependencies = [
2323 "cfg-if",
2324 "windows-link 0.2.1",
2325 ]
2326
2327 [[package]]
2328 name = "libm"
2329 version = "0.2.16"
2330 source = "registry+https://github.com/rust-lang/crates.io-index"
2331 checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
2332
2333 [[package]]
2334 name = "libredox"
2335 version = "0.1.10"
2336 source = "registry+https://github.com/rust-lang/crates.io-index"
2337 checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
2338 dependencies = [
2339 "bitflags 2.13.1",
2340 "libc",
2341 ]
2342
2343 [[package]]
2344 name = "linebender_resource_handle"
2345 version = "0.1.1"
2346 source = "registry+https://github.com/rust-lang/crates.io-index"
2347 checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
2348
2349 [[package]]
2350 name = "link-section"
2351 version = "0.19.2"
2352 source = "registry+https://github.com/rust-lang/crates.io-index"
2353 checksum = "5ee1a0d6e252afe82e7bc2db42fba60e02ddf3b1accaf8cb21d96e34ba61f3d4"
2354
2355 [[package]]
2356 name = "linktime-proc-macro"
2357 version = "0.2.2"
2358 source = "registry+https://github.com/rust-lang/crates.io-index"
2359 checksum = "348d0075b1fc163b26d72a7f75fc5141daf2fd1bdf128d873cbaf6785d495bdf"
2360
2361 [[package]]
2362 name = "linux-raw-sys"
2363 version = "0.12.1"
2364 source = "registry+https://github.com/rust-lang/crates.io-index"
2365 checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
2366
2367 [[package]]
2368 name = "litemap"
2369 version = "0.8.0"
2370 source = "registry+https://github.com/rust-lang/crates.io-index"
2371 checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
2372
2373 [[package]]
2374 name = "litrs"
2375 version = "1.0.0"
2376 source = "registry+https://github.com/rust-lang/crates.io-index"
2377 checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
2378
2379 [[package]]
2380 name = "lock_api"
2381 version = "0.4.14"
2382 source = "registry+https://github.com/rust-lang/crates.io-index"
2383 checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
2384 dependencies = [
2385 "scopeguard",
2386 ]
2387
2388 [[package]]
2389 name = "log"
2390 version = "0.4.29"
2391 source = "registry+https://github.com/rust-lang/crates.io-index"
2392 checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
2393 dependencies = [
2394 "serde_core",
2395 "value-bag",
2396 ]
2397
2398 [[package]]
2399 name = "loop9"
2400 version = "0.1.5"
2401 source = "registry+https://github.com/rust-lang/crates.io-index"
2402 checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"
2403 dependencies = [
2404 "imgref",
2405 ]
2406
2407 [[package]]
2408 name = "lyon"
2409 version = "1.0.16"
2410 source = "registry+https://github.com/rust-lang/crates.io-index"
2411 checksum = "dbcb7d54d54c8937364c9d41902d066656817dce1e03a44e5533afebd1ef4352"
2412 dependencies = [
2413 "lyon_algorithms",
2414 "lyon_tessellation",
2415 ]
2416
2417 [[package]]
2418 name = "lyon_algorithms"
2419 version = "1.0.16"
2420 source = "registry+https://github.com/rust-lang/crates.io-index"
2421 checksum = "f4c0829e28c4f336396f250d850c3987e16ce6db057ffe047ce0dd54aab6b647"
2422 dependencies = [
2423 "lyon_path",
2424 "num-traits",
2425 ]
2426
2427 [[package]]
2428 name = "lyon_geom"
2429 version = "1.0.17"
2430 source = "registry+https://github.com/rust-lang/crates.io-index"
2431 checksum = "4e16770d760c7848b0c1c2d209101e408207a65168109509f8483837a36cf2e7"
2432 dependencies = [
2433 "arrayvec",
2434 "euclid",
2435 "num-traits",
2436 ]
2437
2438 [[package]]
2439 name = "lyon_path"
2440 version = "1.0.16"
2441 source = "registry+https://github.com/rust-lang/crates.io-index"
2442 checksum = "1aeca86bcfd632a15984ba029b539ffb811e0a70bf55e814ef8b0f54f506fdeb"
2443 dependencies = [
2444 "lyon_geom",
2445 "num-traits",
2446 ]
2447
2448 [[package]]
2449 name = "lyon_tessellation"
2450 version = "1.0.16"
2451 source = "registry+https://github.com/rust-lang/crates.io-index"
2452 checksum = "f3f586142e1280335b1bc89539f7c97dd80f08fc43e9ab1b74ef0a42b04aa353"
2453 dependencies = [
2454 "float_next_after",
2455 "lyon_path",
2456 "num-traits",
2457 ]
2458
2459 [[package]]
2460 name = "malloc_buf"
2461 version = "0.0.6"
2462 source = "registry+https://github.com/rust-lang/crates.io-index"
2463 checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
2464 dependencies = [
2465 "libc",
2466 ]
2467
2468 [[package]]
2469 name = "maybe-rayon"
2470 version = "0.1.1"
2471 source = "registry+https://github.com/rust-lang/crates.io-index"
2472 checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"
2473 dependencies = [
2474 "cfg-if",
2475 "rayon",
2476 ]
2477
2478 [[package]]
2479 name = "memchr"
2480 version = "2.8.3"
2481 source = "registry+https://github.com/rust-lang/crates.io-index"
2482 checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
2483
2484 [[package]]
2485 name = "memmap2"
2486 version = "0.9.8"
2487 source = "registry+https://github.com/rust-lang/crates.io-index"
2488 checksum = "843a98750cd611cc2965a8213b53b43e715f13c37a9e096c6408e69990961db7"
2489 dependencies = [
2490 "libc",
2491 ]
2492
2493 [[package]]
2494 name = "memoffset"
2495 version = "0.9.1"
2496 source = "registry+https://github.com/rust-lang/crates.io-index"
2497 checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
2498 dependencies = [
2499 "autocfg",
2500 ]
2501
2502 [[package]]
2503 name = "metal"
2504 version = "0.33.0"
2505 source = "registry+https://github.com/rust-lang/crates.io-index"
2506 checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15"
2507 dependencies = [
2508 "bitflags 2.13.1",
2509 "block",
2510 "core-graphics-types 0.2.0",
2511 "foreign-types",
2512 "log",
2513 "objc",
2514 "paste",
2515 ]
2516
2517 [[package]]
2518 name = "minimal-lexical"
2519 version = "0.2.1"
2520 source = "registry+https://github.com/rust-lang/crates.io-index"
2521 checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
2522
2523 [[package]]
2524 name = "miniz_oxide"
2525 version = "0.8.9"
2526 source = "registry+https://github.com/rust-lang/crates.io-index"
2527 checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
2528 dependencies = [
2529 "adler2",
2530 "simd-adler32",
2531 ]
2532
2533 [[package]]
2534 name = "moxcms"
2535 version = "0.8.1"
2536 source = "registry+https://github.com/rust-lang/crates.io-index"
2537 checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"
2538 dependencies = [
2539 "num-traits",
2540 "pxfm",
2541 ]
2542
2543 [[package]]
2544 name = "naga"
2545 version = "29.0.4"
2546 source = "registry+https://github.com/rust-lang/crates.io-index"
2547 checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df"
2548 dependencies = [
2549 "arrayvec",
2550 "bit-set 0.9.1",
2551 "bitflags 2.13.1",
2552 "cfg-if",
2553 "cfg_aliases",
2554 "codespan-reporting",
2555 "half",
2556 "hashbrown 0.16.1",
2557 "hexf-parse",
2558 "indexmap",
2559 "libm",
2560 "log",
2561 "num-traits",
2562 "once_cell",
2563 "rustc-hash 1.1.0",
2564 "spirv",
2565 "thiserror 2.0.17",
2566 "unicode-ident",
2567 ]
2568
2569 [[package]]
2570 name = "ndk-sys"
2571 version = "0.6.0+11769913"
2572 source = "registry+https://github.com/rust-lang/crates.io-index"
2573 checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"
2574 dependencies = [
2575 "jni-sys",
2576 ]
2577
2578 [[package]]
2579 name = "new_debug_unreachable"
2580 version = "1.0.6"
2581 source = "registry+https://github.com/rust-lang/crates.io-index"
2582 checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
2583
2584 [[package]]
2585 name = "nom"
2586 version = "7.1.3"
2587 source = "registry+https://github.com/rust-lang/crates.io-index"
2588 checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
2589 dependencies = [
2590 "memchr",
2591 "minimal-lexical",
2592 ]
2593
2594 [[package]]
2595 name = "noop_proc_macro"
2596 version = "0.3.0"
2597 source = "registry+https://github.com/rust-lang/crates.io-index"
2598 checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
2599
2600 [[package]]
2601 name = "ntapi"
2602 version = "0.4.1"
2603 source = "registry+https://github.com/rust-lang/crates.io-index"
2604 checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
2605 dependencies = [
2606 "winapi",
2607 ]
2608
2609 [[package]]
2610 name = "nu-ansi-term"
2611 version = "0.50.3"
2612 source = "registry+https://github.com/rust-lang/crates.io-index"
2613 checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
2614 dependencies = [
2615 "windows-sys 0.61.2",
2616 ]
2617
2618 [[package]]
2619 name = "num-bigint"
2620 version = "0.4.8"
2621 source = "registry+https://github.com/rust-lang/crates.io-index"
2622 checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367"
2623 dependencies = [
2624 "num-integer",
2625 "num-traits",
2626 ]
2627
2628 [[package]]
2629 name = "num-derive"
2630 version = "0.4.2"
2631 source = "registry+https://github.com/rust-lang/crates.io-index"
2632 checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
2633 dependencies = [
2634 "proc-macro2",
2635 "quote",
2636 "syn 2.0.117",
2637 ]
2638
2639 [[package]]
2640 name = "num-integer"
2641 version = "0.1.46"
2642 source = "registry+https://github.com/rust-lang/crates.io-index"
2643 checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
2644 dependencies = [
2645 "num-traits",
2646 ]
2647
2648 [[package]]
2649 name = "num-rational"
2650 version = "0.4.2"
2651 source = "registry+https://github.com/rust-lang/crates.io-index"
2652 checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
2653 dependencies = [
2654 "num-bigint",
2655 "num-integer",
2656 "num-traits",
2657 ]
2658
2659 [[package]]
2660 name = "num-traits"
2661 version = "0.2.19"
2662 source = "registry+https://github.com/rust-lang/crates.io-index"
2663 checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
2664 dependencies = [
2665 "autocfg",
2666 "libm",
2667 ]
2668
2669 [[package]]
2670 name = "num_cpus"
2671 version = "1.17.0"
2672 source = "registry+https://github.com/rust-lang/crates.io-index"
2673 checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
2674 dependencies = [
2675 "hermit-abi",
2676 "libc",
2677 ]
2678
2679 [[package]]
2680 name = "objc"
2681 version = "0.2.7"
2682 source = "registry+https://github.com/rust-lang/crates.io-index"
2683 checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
2684 dependencies = [
2685 "malloc_buf",
2686 "objc_exception",
2687 ]
2688
2689 [[package]]
2690 name = "objc-foundation"
2691 version = "0.1.1"
2692 source = "registry+https://github.com/rust-lang/crates.io-index"
2693 checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
2694 dependencies = [
2695 "block",
2696 "objc",
2697 "objc_id",
2698 ]
2699
2700 [[package]]
2701 name = "objc2"
2702 version = "0.6.3"
2703 source = "registry+https://github.com/rust-lang/crates.io-index"
2704 checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05"
2705 dependencies = [
2706 "objc2-encode",
2707 ]
2708
2709 [[package]]
2710 name = "objc2-core-foundation"
2711 version = "0.3.2"
2712 source = "registry+https://github.com/rust-lang/crates.io-index"
2713 checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
2714 dependencies = [
2715 "bitflags 2.13.1",
2716 "dispatch2",
2717 "objc2",
2718 ]
2719
2720 [[package]]
2721 name = "objc2-core-video"
2722 version = "0.3.2"
2723 source = "registry+https://github.com/rust-lang/crates.io-index"
2724 checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6"
2725 dependencies = [
2726 "objc2-core-foundation",
2727 ]
2728
2729 [[package]]
2730 name = "objc2-encode"
2731 version = "4.1.0"
2732 source = "registry+https://github.com/rust-lang/crates.io-index"
2733 checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
2734
2735 [[package]]
2736 name = "objc2-foundation"
2737 version = "0.3.2"
2738 source = "registry+https://github.com/rust-lang/crates.io-index"
2739 checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
2740 dependencies = [
2741 "bitflags 2.13.1",
2742 "objc2",
2743 "objc2-core-foundation",
2744 ]
2745
2746 [[package]]
2747 name = "objc2-metal"
2748 version = "0.3.2"
2749 source = "registry+https://github.com/rust-lang/crates.io-index"
2750 checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794"
2751 dependencies = [
2752 "bitflags 2.13.1",
2753 "block2",
2754 "objc2",
2755 "objc2-foundation",
2756 ]
2757
2758 [[package]]
2759 name = "objc2-quartz-core"
2760 version = "0.3.2"
2761 source = "registry+https://github.com/rust-lang/crates.io-index"
2762 checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
2763 dependencies = [
2764 "bitflags 2.13.1",
2765 "objc2",
2766 "objc2-core-foundation",
2767 "objc2-foundation",
2768 "objc2-metal",
2769 ]
2770
2771 [[package]]
2772 name = "objc_exception"
2773 version = "0.1.2"
2774 source = "registry+https://github.com/rust-lang/crates.io-index"
2775 checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
2776 dependencies = [
2777 "cc",
2778 ]
2779
2780 [[package]]
2781 name = "objc_id"
2782 version = "0.1.1"
2783 source = "registry+https://github.com/rust-lang/crates.io-index"
2784 checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
2785 dependencies = [
2786 "objc",
2787 ]
2788
2789 [[package]]
2790 name = "object"
2791 version = "0.37.3"
2792 source = "registry+https://github.com/rust-lang/crates.io-index"
2793 checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
2794 dependencies = [
2795 "memchr",
2796 ]
2797
2798 [[package]]
2799 name = "once_cell"
2800 version = "1.21.4"
2801 source = "registry+https://github.com/rust-lang/crates.io-index"
2802 checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
2803
2804 [[package]]
2805 name = "oorandom"
2806 version = "11.1.5"
2807 source = "registry+https://github.com/rust-lang/crates.io-index"
2808 checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
2809
2810 [[package]]
2811 name = "option-ext"
2812 version = "0.2.0"
2813 source = "registry+https://github.com/rust-lang/crates.io-index"
2814 checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
2815
2816 [[package]]
2817 name = "ordered-float"
2818 version = "5.5.0"
2819 source = "registry+https://github.com/rust-lang/crates.io-index"
2820 checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0"
2821 dependencies = [
2822 "num-traits",
2823 ]
2824
2825 [[package]]
2826 name = "page_size"
2827 version = "0.6.0"
2828 source = "registry+https://github.com/rust-lang/crates.io-index"
2829 checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da"
2830 dependencies = [
2831 "libc",
2832 "winapi",
2833 ]
2834
2835 [[package]]
2836 name = "parking"
2837 version = "2.2.1"
2838 source = "registry+https://github.com/rust-lang/crates.io-index"
2839 checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
2840
2841 [[package]]
2842 name = "parking_lot"
2843 version = "0.12.5"
2844 source = "registry+https://github.com/rust-lang/crates.io-index"
2845 checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
2846 dependencies = [
2847 "lock_api",
2848 "parking_lot_core",
2849 ]
2850
2851 [[package]]
2852 name = "parking_lot_core"
2853 version = "0.9.12"
2854 source = "registry+https://github.com/rust-lang/crates.io-index"
2855 checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
2856 dependencies = [
2857 "cfg-if",
2858 "libc",
2859 "redox_syscall",
2860 "smallvec",
2861 "windows-link 0.2.1",
2862 ]
2863
2864 [[package]]
2865 name = "paste"
2866 version = "1.0.15"
2867 source = "registry+https://github.com/rust-lang/crates.io-index"
2868 checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
2869
2870 [[package]]
2871 name = "pastey"
2872 version = "0.1.1"
2873 source = "registry+https://github.com/rust-lang/crates.io-index"
2874 checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
2875
2876 [[package]]
2877 name = "pathfinder_geometry"
2878 version = "0.5.1"
2879 source = "registry+https://github.com/rust-lang/crates.io-index"
2880 checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3"
2881 dependencies = [
2882 "log",
2883 "pathfinder_simd",
2884 ]
2885
2886 [[package]]
2887 name = "pathfinder_simd"
2888 version = "0.5.6"
2889 source = "registry+https://github.com/rust-lang/crates.io-index"
2890 checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777"
2891 dependencies = [
2892 "rustc_version",
2893 ]
2894
2895 [[package]]
2896 name = "percent-encoding"
2897 version = "2.3.2"
2898 source = "registry+https://github.com/rust-lang/crates.io-index"
2899 checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
2900
2901 [[package]]
2902 name = "perf-event-data"
2903 version = "0.1.8"
2904 source = "registry+https://github.com/rust-lang/crates.io-index"
2905 checksum = "575828d9d7d205188048eb1508560607a03d21eafdbba47b8cade1736c1c28e1"
2906 dependencies = [
2907 "bitflags 2.13.1",
2908 "c-enum",
2909 "perf-event-open-sys2",
2910 ]
2911
2912 [[package]]
2913 name = "perf-event-open-sys2"
2914 version = "5.0.6"
2915 source = "registry+https://github.com/rust-lang/crates.io-index"
2916 checksum = "d9c25955321465255e437600b54296983fab1feac2cd0c38958adeb26dbae49e"
2917 dependencies = [
2918 "libc",
2919 "memoffset",
2920 ]
2921
2922 [[package]]
2923 name = "perf-event2"
2924 version = "0.7.4"
2925 source = "registry+https://github.com/rust-lang/crates.io-index"
2926 checksum = "0939b8fad77dfaeb29ebbd35faaeaadbf833167f30975f1b8993bbba09ea0a0f"
2927 dependencies = [
2928 "bitflags 2.13.1",
2929 "c-enum",
2930 "libc",
2931 "memmap2",
2932 "perf-event-data",
2933 "perf-event-open-sys2",
2934 ]
2935
2936 [[package]]
2937 name = "pico-args"
2938 version = "0.5.0"
2939 source = "registry+https://github.com/rust-lang/crates.io-index"
2940 checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
2941
2942 [[package]]
2943 name = "pin-project"
2944 version = "1.1.10"
2945 source = "registry+https://github.com/rust-lang/crates.io-index"
2946 checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
2947 dependencies = [
2948 "pin-project-internal",
2949 ]
2950
2951 [[package]]
2952 name = "pin-project-internal"
2953 version = "1.1.10"
2954 source = "registry+https://github.com/rust-lang/crates.io-index"
2955 checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
2956 dependencies = [
2957 "proc-macro2",
2958 "quote",
2959 "syn 2.0.117",
2960 ]
2961
2962 [[package]]
2963 name = "pin-project-lite"
2964 version = "0.2.16"
2965 source = "registry+https://github.com/rust-lang/crates.io-index"
2966 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
2967
2968 [[package]]
2969 name = "pkg-config"
2970 version = "0.3.32"
2971 source = "registry+https://github.com/rust-lang/crates.io-index"
2972 checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
2973
2974 [[package]]
2975 name = "plotters"
2976 version = "0.3.7"
2977 source = "registry+https://github.com/rust-lang/crates.io-index"
2978 checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747"
2979 dependencies = [
2980 "num-traits",
2981 "plotters-backend",
2982 "plotters-svg",
2983 "wasm-bindgen",
2984 "web-sys",
2985 ]
2986
2987 [[package]]
2988 name = "plotters-backend"
2989 version = "0.3.7"
2990 source = "registry+https://github.com/rust-lang/crates.io-index"
2991 checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a"
2992
2993 [[package]]
2994 name = "plotters-svg"
2995 version = "0.3.7"
2996 source = "registry+https://github.com/rust-lang/crates.io-index"
2997 checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
2998 dependencies = [
2999 "plotters-backend",
3000 ]
3001
3002 [[package]]
3003 name = "png"
3004 version = "0.17.16"
3005 source = "registry+https://github.com/rust-lang/crates.io-index"
3006 checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"
3007 dependencies = [
3008 "bitflags 1.3.2",
3009 "crc32fast",
3010 "fdeflate",
3011 "flate2",
3012 "miniz_oxide",
3013 ]
3014
3015 [[package]]
3016 name = "png"
3017 version = "0.18.0"
3018 source = "registry+https://github.com/rust-lang/crates.io-index"
3019 checksum = "97baced388464909d42d89643fe4361939af9b7ce7a31ee32a168f832a70f2a0"
3020 dependencies = [
3021 "bitflags 2.13.1",
3022 "crc32fast",
3023 "fdeflate",
3024 "flate2",
3025 "miniz_oxide",
3026 ]
3027
3028 [[package]]
3029 name = "pollster"
3030 version = "0.2.5"
3031 source = "registry+https://github.com/rust-lang/crates.io-index"
3032 checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7"
3033
3034 [[package]]
3035 name = "pollster"
3036 version = "0.4.0"
3037 source = "registry+https://github.com/rust-lang/crates.io-index"
3038 checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3"
3039
3040 [[package]]
3041 name = "polycool"
3042 version = "0.4.0"
3043 source = "registry+https://github.com/rust-lang/crates.io-index"
3044 checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6"
3045 dependencies = [
3046 "arrayvec",
3047 ]
3048
3049 [[package]]
3050 name = "portable-atomic"
3051 version = "1.11.1"
3052 source = "registry+https://github.com/rust-lang/crates.io-index"
3053 checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
3054
3055 [[package]]
3056 name = "portable-atomic-util"
3057 version = "0.2.4"
3058 source = "registry+https://github.com/rust-lang/crates.io-index"
3059 checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
3060 dependencies = [
3061 "portable-atomic",
3062 ]
3063
3064 [[package]]
3065 name = "postage"
3066 version = "0.5.0"
3067 source = "registry+https://github.com/rust-lang/crates.io-index"
3068 checksum = "af3fb618632874fb76937c2361a7f22afd393c982a2165595407edc75b06d3c1"
3069 dependencies = [
3070 "atomic",
3071 "crossbeam-queue",
3072 "futures",
3073 "log",
3074 "parking_lot",
3075 "pin-project",
3076 "pollster 0.2.5",
3077 "static_assertions",
3078 "thiserror 1.0.69",
3079 ]
3080
3081 [[package]]
3082 name = "potential_utf"
3083 version = "0.1.3"
3084 source = "registry+https://github.com/rust-lang/crates.io-index"
3085 checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a"
3086 dependencies = [
3087 "zerovec",
3088 ]
3089
3090 [[package]]
3091 name = "ppv-lite86"
3092 version = "0.2.21"
3093 source = "registry+https://github.com/rust-lang/crates.io-index"
3094 checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
3095 dependencies = [
3096 "zerocopy",
3097 ]
3098
3099 [[package]]
3100 name = "presser"
3101 version = "0.3.1"
3102 source = "registry+https://github.com/rust-lang/crates.io-index"
3103 checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
3104
3105 [[package]]
3106 name = "prettyplease"
3107 version = "0.2.37"
3108 source = "registry+https://github.com/rust-lang/crates.io-index"
3109 checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
3110 dependencies = [
3111 "proc-macro2",
3112 "syn 2.0.117",
3113 ]
3114
3115 [[package]]
3116 name = "proc-macro-crate"
3117 version = "3.4.0"
3118 source = "registry+https://github.com/rust-lang/crates.io-index"
3119 checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983"
3120 dependencies = [
3121 "toml_edit",
3122 ]
3123
3124 [[package]]
3125 name = "proc-macro2"
3126 version = "1.0.107"
3127 source = "registry+https://github.com/rust-lang/crates.io-index"
3128 checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
3129 dependencies = [
3130 "unicode-ident",
3131 ]
3132
3133 [[package]]
3134 name = "profiling"
3135 version = "1.0.17"
3136 source = "registry+https://github.com/rust-lang/crates.io-index"
3137 checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773"
3138 dependencies = [
3139 "profiling-procmacros",
3140 ]
3141
3142 [[package]]
3143 name = "profiling-procmacros"
3144 version = "1.0.17"
3145 source = "registry+https://github.com/rust-lang/crates.io-index"
3146 checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b"
3147 dependencies = [
3148 "quote",
3149 "syn 2.0.117",
3150 ]
3151
3152 [[package]]
3153 name = "proptest"
3154 version = "1.11.0"
3155 source = "registry+https://github.com/rust-lang/crates.io-index"
3156 checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744"
3157 dependencies = [
3158 "bit-set 0.8.0",
3159 "bit-vec 0.8.0",
3160 "bitflags 2.13.1",
3161 "num-traits",
3162 "proptest-macro",
3163 "rand 0.9.4",
3164 "rand_chacha 0.9.0",
3165 "rand_xorshift",
3166 "regex-syntax",
3167 "rusty-fork",
3168 "tempfile",
3169 "unarray",
3170 ]
3171
3172 [[package]]
3173 name = "proptest-macro"
3174 version = "0.5.0"
3175 source = "registry+https://github.com/rust-lang/crates.io-index"
3176 checksum = "efaa288b896cb2b345da7b7f2110ab19e51565b83495b56fcec98a62f8b1f33e"
3177 dependencies = [
3178 "convert_case 0.11.0",
3179 "proc-macro2",
3180 "quote",
3181 "syn 2.0.117",
3182 ]
3183
3184 [[package]]
3185 name = "pxfm"
3186 version = "0.1.25"
3187 source = "registry+https://github.com/rust-lang/crates.io-index"
3188 checksum = "a3cbdf373972bf78df4d3b518d07003938e2c7d1fb5891e55f9cb6df57009d84"
3189 dependencies = [
3190 "num-traits",
3191 ]
3192
3193 [[package]]
3194 name = "qoi"
3195 version = "0.4.1"
3196 source = "registry+https://github.com/rust-lang/crates.io-index"
3197 checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
3198 dependencies = [
3199 "bytemuck",
3200 ]
3201
3202 [[package]]
3203 name = "quick-error"
3204 version = "1.2.3"
3205 source = "registry+https://github.com/rust-lang/crates.io-index"
3206 checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
3207
3208 [[package]]
3209 name = "quick-error"
3210 version = "2.0.1"
3211 source = "registry+https://github.com/rust-lang/crates.io-index"
3212 checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
3213
3214 [[package]]
3215 name = "quick-xml"
3216 version = "0.30.0"
3217 source = "registry+https://github.com/rust-lang/crates.io-index"
3218 checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
3219 dependencies = [
3220 "memchr",
3221 ]
3222
3223 [[package]]
3224 name = "quote"
3225 version = "1.0.47"
3226 source = "registry+https://github.com/rust-lang/crates.io-index"
3227 checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
3228 dependencies = [
3229 "proc-macro2",
3230 ]
3231
3232 [[package]]
3233 name = "r-efi"
3234 version = "5.3.0"
3235 source = "registry+https://github.com/rust-lang/crates.io-index"
3236 checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
3237
3238 [[package]]
3239 name = "rand"
3240 version = "0.8.6"
3241 source = "registry+https://github.com/rust-lang/crates.io-index"
3242 checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
3243 dependencies = [
3244 "libc",
3245 "rand_chacha 0.3.1",
3246 "rand_core 0.6.4",
3247 ]
3248
3249 [[package]]
3250 name = "rand"
3251 version = "0.9.4"
3252 source = "registry+https://github.com/rust-lang/crates.io-index"
3253 checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
3254 dependencies = [
3255 "rand_chacha 0.9.0",
3256 "rand_core 0.9.3",
3257 ]
3258
3259 [[package]]
3260 name = "rand_chacha"
3261 version = "0.3.1"
3262 source = "registry+https://github.com/rust-lang/crates.io-index"
3263 checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
3264 dependencies = [
3265 "ppv-lite86",
3266 "rand_core 0.6.4",
3267 ]
3268
3269 [[package]]
3270 name = "rand_chacha"
3271 version = "0.9.0"
3272 source = "registry+https://github.com/rust-lang/crates.io-index"
3273 checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
3274 dependencies = [
3275 "ppv-lite86",
3276 "rand_core 0.9.3",
3277 ]
3278
3279 [[package]]
3280 name = "rand_core"
3281 version = "0.6.4"
3282 source = "registry+https://github.com/rust-lang/crates.io-index"
3283 checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
3284 dependencies = [
3285 "getrandom 0.2.16",
3286 ]
3287
3288 [[package]]
3289 name = "rand_core"
3290 version = "0.9.3"
3291 source = "registry+https://github.com/rust-lang/crates.io-index"
3292 checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
3293 dependencies = [
3294 "getrandom 0.3.4",
3295 ]
3296
3297 [[package]]
3298 name = "rand_xorshift"
3299 version = "0.4.0"
3300 source = "registry+https://github.com/rust-lang/crates.io-index"
3301 checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a"
3302 dependencies = [
3303 "rand_core 0.9.3",
3304 ]
3305
3306 [[package]]
3307 name = "range-alloc"
3308 version = "0.1.4"
3309 source = "registry+https://github.com/rust-lang/crates.io-index"
3310 checksum = "c3d6831663a5098ea164f89cff59c6284e95f4e3c76ce9848d4529f5ccca9bde"
3311
3312 [[package]]
3313 name = "rangemap"
3314 version = "1.7.1"
3315 source = "registry+https://github.com/rust-lang/crates.io-index"
3316 checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68"
3317
3318 [[package]]
3319 name = "rav1e"
3320 version = "0.8.1"
3321 source = "registry+https://github.com/rust-lang/crates.io-index"
3322 checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"
3323 dependencies = [
3324 "aligned-vec",
3325 "arbitrary",
3326 "arg_enum_proc_macro",
3327 "arrayvec",
3328 "av-scenechange",
3329 "av1-grain",
3330 "bitstream-io",
3331 "built",
3332 "cfg-if",
3333 "interpolate_name",
3334 "itertools 0.14.0",
3335 "libc",
3336 "libfuzzer-sys",
3337 "log",
3338 "maybe-rayon",
3339 "new_debug_unreachable",
3340 "noop_proc_macro",
3341 "num-derive",
3342 "num-traits",
3343 "paste",
3344 "profiling",
3345 "rand 0.9.4",
3346 "rand_chacha 0.9.0",
3347 "simd_helpers",
3348 "thiserror 2.0.17",
3349 "v_frame",
3350 "wasm-bindgen",
3351 ]
3352
3353 [[package]]
3354 name = "ravif"
3355 version = "0.13.0"
3356 source = "registry+https://github.com/rust-lang/crates.io-index"
3357 checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45"
3358 dependencies = [
3359 "avif-serialize",
3360 "imgref",
3361 "loop9",
3362 "quick-error 2.0.1",
3363 "rav1e",
3364 "rayon",
3365 "rgb",
3366 ]
3367
3368 [[package]]
3369 name = "raw-window-handle"
3370 version = "0.6.2"
3371 source = "registry+https://github.com/rust-lang/crates.io-index"
3372 checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
3373
3374 [[package]]
3375 name = "raw-window-metal"
3376 version = "1.1.0"
3377 source = "registry+https://github.com/rust-lang/crates.io-index"
3378 checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135"
3379 dependencies = [
3380 "objc2",
3381 "objc2-core-foundation",
3382 "objc2-foundation",
3383 "objc2-quartz-core",
3384 ]
3385
3386 [[package]]
3387 name = "rayon"
3388 version = "1.11.0"
3389 source = "registry+https://github.com/rust-lang/crates.io-index"
3390 checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
3391 dependencies = [
3392 "either",
3393 "rayon-core",
3394 ]
3395
3396 [[package]]
3397 name = "rayon-core"
3398 version = "1.13.0"
3399 source = "registry+https://github.com/rust-lang/crates.io-index"
3400 checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
3401 dependencies = [
3402 "crossbeam-deque",
3403 "crossbeam-utils",
3404 ]
3405
3406 [[package]]
3407 name = "read-fonts"
3408 version = "0.35.0"
3409 source = "registry+https://github.com/rust-lang/crates.io-index"
3410 checksum = "6717cf23b488adf64b9d711329542ba34de147df262370221940dfabc2c91358"
3411 dependencies = [
3412 "bytemuck",
3413 "font-types 0.10.0",
3414 ]
3415
3416 [[package]]
3417 name = "read-fonts"
3418 version = "0.37.0"
3419 source = "registry+https://github.com/rust-lang/crates.io-index"
3420 checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5"
3421 dependencies = [
3422 "bytemuck",
3423 "core_maths",
3424 "font-types 0.11.0",
3425 ]
3426
3427 [[package]]
3428 name = "redox_syscall"
3429 version = "0.5.18"
3430 source = "registry+https://github.com/rust-lang/crates.io-index"
3431 checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
3432 dependencies = [
3433 "bitflags 2.13.1",
3434 ]
3435
3436 [[package]]
3437 name = "redox_users"
3438 version = "0.4.6"
3439 source = "registry+https://github.com/rust-lang/crates.io-index"
3440 checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
3441 dependencies = [
3442 "getrandom 0.2.16",
3443 "libredox",
3444 "thiserror 1.0.69",
3445 ]
3446
3447 [[package]]
3448 name = "ref-cast"
3449 version = "1.0.25"
3450 source = "registry+https://github.com/rust-lang/crates.io-index"
3451 checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d"
3452 dependencies = [
3453 "ref-cast-impl",
3454 ]
3455
3456 [[package]]
3457 name = "ref-cast-impl"
3458 version = "1.0.25"
3459 source = "registry+https://github.com/rust-lang/crates.io-index"
3460 checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
3461 dependencies = [
3462 "proc-macro2",
3463 "quote",
3464 "syn 2.0.117",
3465 ]
3466
3467 [[package]]
3468 name = "regex"
3469 version = "1.12.3"
3470 source = "registry+https://github.com/rust-lang/crates.io-index"
3471 checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
3472 dependencies = [
3473 "aho-corasick",
3474 "memchr",
3475 "regex-automata",
3476 "regex-syntax",
3477 ]
3478
3479 [[package]]
3480 name = "regex-automata"
3481 version = "0.4.18"
3482 source = "registry+https://github.com/rust-lang/crates.io-index"
3483 checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
3484 dependencies = [
3485 "aho-corasick",
3486 "memchr",
3487 "regex-syntax",
3488 ]
3489
3490 [[package]]
3491 name = "regex-syntax"
3492 version = "0.8.11"
3493 source = "registry+https://github.com/rust-lang/crates.io-index"
3494 checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
3495
3496 [[package]]
3497 name = "renderdoc-sys"
3498 version = "1.1.0"
3499 source = "registry+https://github.com/rust-lang/crates.io-index"
3500 checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
3501
3502 [[package]]
3503 name = "resvg"
3504 version = "0.46.0"
3505 source = "registry+https://github.com/rust-lang/crates.io-index"
3506 checksum = "b563218631706d614e23059436526d005b50ab5f2d506b55a17eb65c5eb83419"
3507 dependencies = [
3508 "gif",
3509 "image-webp",
3510 "log",
3511 "pico-args",
3512 "rgb",
3513 "svgtypes",
3514 "tiny-skia",
3515 "usvg",
3516 "zune-jpeg",
3517 ]
3518
3519 [[package]]
3520 name = "rgb"
3521 version = "0.8.52"
3522 source = "registry+https://github.com/rust-lang/crates.io-index"
3523 checksum = "0c6a884d2998352bb4daf0183589aec883f16a6da1f4dde84d8e2e9a5409a1ce"
3524 dependencies = [
3525 "bytemuck",
3526 ]
3527
3528 [[package]]
3529 name = "roxmltree"
3530 version = "0.20.0"
3531 source = "registry+https://github.com/rust-lang/crates.io-index"
3532 checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
3533
3534 [[package]]
3535 name = "roxmltree"
3536 version = "0.21.1"
3537 source = "registry+https://github.com/rust-lang/crates.io-index"
3538 checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb"
3539 dependencies = [
3540 "memchr",
3541 ]
3542
3543 [[package]]
3544 name = "rustc-demangle"
3545 version = "0.1.26"
3546 source = "registry+https://github.com/rust-lang/crates.io-index"
3547 checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
3548
3549 [[package]]
3550 name = "rustc-hash"
3551 version = "1.1.0"
3552 source = "registry+https://github.com/rust-lang/crates.io-index"
3553 checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
3554
3555 [[package]]
3556 name = "rustc-hash"
3557 version = "2.1.1"
3558 source = "registry+https://github.com/rust-lang/crates.io-index"
3559 checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
3560
3561 [[package]]
3562 name = "rustc_version"
3563 version = "0.4.1"
3564 source = "registry+https://github.com/rust-lang/crates.io-index"
3565 checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
3566 dependencies = [
3567 "semver",
3568 ]
3569
3570 [[package]]
3571 name = "rustix"
3572 version = "1.1.4"
3573 source = "registry+https://github.com/rust-lang/crates.io-index"
3574 checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
3575 dependencies = [
3576 "bitflags 2.13.1",
3577 "errno",
3578 "libc",
3579 "linux-raw-sys",
3580 "windows-sys 0.61.2",
3581 ]
3582
3583 [[package]]
3584 name = "rustversion"
3585 version = "1.0.22"
3586 source = "registry+https://github.com/rust-lang/crates.io-index"
3587 checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
3588
3589 [[package]]
3590 name = "rusty-fork"
3591 version = "0.3.1"
3592 source = "registry+https://github.com/rust-lang/crates.io-index"
3593 checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2"
3594 dependencies = [
3595 "fnv",
3596 "quick-error 1.2.3",
3597 "tempfile",
3598 "wait-timeout",
3599 ]
3600
3601 [[package]]
3602 name = "rustybuzz"
3603 version = "0.20.1"
3604 source = "registry+https://github.com/rust-lang/crates.io-index"
3605 checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702"
3606 dependencies = [
3607 "bitflags 2.13.1",
3608 "bytemuck",
3609 "core_maths",
3610 "log",
3611 "smallvec",
3612 "ttf-parser",
3613 "unicode-bidi-mirroring",
3614 "unicode-ccc",
3615 "unicode-properties",
3616 "unicode-script",
3617 ]
3618
3619 [[package]]
3620 name = "ryu"
3621 version = "1.0.23"
3622 source = "registry+https://github.com/rust-lang/crates.io-index"
3623 checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
3624
3625 [[package]]
3626 name = "same-file"
3627 version = "1.0.6"
3628 source = "registry+https://github.com/rust-lang/crates.io-index"
3629 checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
3630 dependencies = [
3631 "winapi-util",
3632 ]
3633
3634 [[package]]
3635 name = "schemars"
3636 version = "1.0.4"
3637 source = "registry+https://github.com/rust-lang/crates.io-index"
3638 checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
3639 dependencies = [
3640 "dyn-clone",
3641 "indexmap",
3642 "ref-cast",
3643 "schemars_derive",
3644 "serde",
3645 "serde_json",
3646 ]
3647
3648 [[package]]
3649 name = "schemars_derive"
3650 version = "1.0.4"
3651 source = "registry+https://github.com/rust-lang/crates.io-index"
3652 checksum = "33d020396d1d138dc19f1165df7545479dcd58d93810dc5d646a16e55abefa80"
3653 dependencies = [
3654 "proc-macro2",
3655 "quote",
3656 "serde_derive_internals",
3657 "syn 2.0.117",
3658 ]
3659
3660 [[package]]
3661 name = "scopeguard"
3662 version = "1.2.0"
3663 source = "registry+https://github.com/rust-lang/crates.io-index"
3664 checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
3665
3666 [[package]]
3667 name = "screencapturekit"
3668 version = "0.2.8"
3669 source = "registry+https://github.com/rust-lang/crates.io-index"
3670 checksum = "1a5eeeb57ac94960cfe5ff4c402be6585ae4c8d29a2cf41b276048c2e849d64e"
3671 dependencies = [
3672 "screencapturekit-sys",
3673 ]
3674
3675 [[package]]
3676 name = "screencapturekit-sys"
3677 version = "0.2.8"
3678 source = "registry+https://github.com/rust-lang/crates.io-index"
3679 checksum = "22411b57f7d49e7fe08025198813ee6fd65e1ee5eff4ebc7880c12c82bde4c60"
3680 dependencies = [
3681 "block",
3682 "dispatch",
3683 "objc",
3684 "objc-foundation",
3685 "objc_id",
3686 "once_cell",
3687 ]
3688
3689 [[package]]
3690 name = "seahash"
3691 version = "4.1.0"
3692 source = "registry+https://github.com/rust-lang/crates.io-index"
3693 checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
3694
3695 [[package]]
3696 name = "self_cell"
3697 version = "1.2.2"
3698 source = "registry+https://github.com/rust-lang/crates.io-index"
3699 checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89"
3700
3701 [[package]]
3702 name = "semver"
3703 version = "1.0.28"
3704 source = "registry+https://github.com/rust-lang/crates.io-index"
3705 checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
3706
3707 [[package]]
3708 name = "serde"
3709 version = "1.0.229"
3710 source = "registry+https://github.com/rust-lang/crates.io-index"
3711 checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
3712 dependencies = [
3713 "serde_core",
3714 "serde_derive",
3715 ]
3716
3717 [[package]]
3718 name = "serde_core"
3719 version = "1.0.229"
3720 source = "registry+https://github.com/rust-lang/crates.io-index"
3721 checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
3722 dependencies = [
3723 "serde_derive",
3724 ]
3725
3726 [[package]]
3727 name = "serde_derive"
3728 version = "1.0.229"
3729 source = "registry+https://github.com/rust-lang/crates.io-index"
3730 checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
3731 dependencies = [
3732 "proc-macro2",
3733 "quote",
3734 "syn 3.0.3",
3735 ]
3736
3737 [[package]]
3738 name = "serde_derive_internals"
3739 version = "0.29.1"
3740 source = "registry+https://github.com/rust-lang/crates.io-index"
3741 checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
3742 dependencies = [
3743 "proc-macro2",
3744 "quote",
3745 "syn 2.0.117",
3746 ]
3747
3748 [[package]]
3749 name = "serde_fmt"
3750 version = "1.0.3"
3751 source = "registry+https://github.com/rust-lang/crates.io-index"
3752 checksum = "e1d4ddca14104cd60529e8c7f7ba71a2c8acd8f7f5cfcdc2faf97eeb7c3010a4"
3753 dependencies = [
3754 "serde",
3755 ]
3756
3757 [[package]]
3758 name = "serde_json"
3759 version = "1.0.151"
3760 source = "registry+https://github.com/rust-lang/crates.io-index"
3761 checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
3762 dependencies = [
3763 "indexmap",
3764 "itoa",
3765 "memchr",
3766 "serde",
3767 "serde_core",
3768 "zmij",
3769 ]
3770
3771 [[package]]
3772 name = "serde_urlencoded"
3773 version = "0.7.1"
3774 source = "registry+https://github.com/rust-lang/crates.io-index"
3775 checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
3776 dependencies = [
3777 "form_urlencoded",
3778 "itoa",
3779 "ryu",
3780 "serde",
3781 ]
3782
3783 [[package]]
3784 name = "sha1_smol"
3785 version = "1.0.1"
3786 source = "registry+https://github.com/rust-lang/crates.io-index"
3787 checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
3788
3789 [[package]]
3790 name = "sharded-slab"
3791 version = "0.1.7"
3792 source = "registry+https://github.com/rust-lang/crates.io-index"
3793 checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
3794 dependencies = [
3795 "lazy_static",
3796 ]
3797
3798 [[package]]
3799 name = "shlex"
3800 version = "1.3.0"
3801 source = "registry+https://github.com/rust-lang/crates.io-index"
3802 checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
3803
3804 [[package]]
3805 name = "shlex"
3806 version = "2.0.1"
3807 source = "registry+https://github.com/rust-lang/crates.io-index"
3808 checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
3809
3810 [[package]]
3811 name = "simd-adler32"
3812 version = "0.3.7"
3813 source = "registry+https://github.com/rust-lang/crates.io-index"
3814 checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
3815
3816 [[package]]
3817 name = "simd_helpers"
3818 version = "0.1.0"
3819 source = "registry+https://github.com/rust-lang/crates.io-index"
3820 checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"
3821 dependencies = [
3822 "quote",
3823 ]
3824
3825 [[package]]
3826 name = "simplecss"
3827 version = "0.2.2"
3828 source = "registry+https://github.com/rust-lang/crates.io-index"
3829 checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c"
3830 dependencies = [
3831 "log",
3832 ]
3833
3834 [[package]]
3835 name = "siphasher"
3836 version = "1.0.1"
3837 source = "registry+https://github.com/rust-lang/crates.io-index"
3838 checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
3839
3840 [[package]]
3841 name = "skrifa"
3842 version = "0.37.0"
3843 source = "registry+https://github.com/rust-lang/crates.io-index"
3844 checksum = "8c31071dedf532758ecf3fed987cdb4bd9509f900e026ab684b4ecb81ea49841"
3845 dependencies = [
3846 "bytemuck",
3847 "read-fonts 0.35.0",
3848 ]
3849
3850 [[package]]
3851 name = "skrifa"
3852 version = "0.40.0"
3853 source = "registry+https://github.com/rust-lang/crates.io-index"
3854 checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac"
3855 dependencies = [
3856 "bytemuck",
3857 "read-fonts 0.37.0",
3858 ]
3859
3860 [[package]]
3861 name = "slab"
3862 version = "0.4.11"
3863 source = "registry+https://github.com/rust-lang/crates.io-index"
3864 checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
3865
3866 [[package]]
3867 name = "slotmap"
3868 version = "1.0.7"
3869 source = "registry+https://github.com/rust-lang/crates.io-index"
3870 checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a"
3871 dependencies = [
3872 "version_check",
3873 ]
3874
3875 [[package]]
3876 name = "smallvec"
3877 version = "1.16.1"
3878 source = "registry+https://github.com/rust-lang/crates.io-index"
3879 checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891"
3880
3881 [[package]]
3882 name = "smol_str"
3883 version = "0.3.6"
3884 source = "registry+https://github.com/rust-lang/crates.io-index"
3885 checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523"
3886 dependencies = [
3887 "serde_core",
3888 ]
3889
3890 [[package]]
3891 name = "spin"
3892 version = "0.9.8"
3893 source = "registry+https://github.com/rust-lang/crates.io-index"
3894 checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
3895 dependencies = [
3896 "lock_api",
3897 ]
3898
3899 [[package]]
3900 name = "spin"
3901 version = "0.10.0"
3902 source = "registry+https://github.com/rust-lang/crates.io-index"
3903 checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591"
3904 dependencies = [
3905 "lock_api",
3906 ]
3907
3908 [[package]]
3909 name = "spirv"
3910 version = "0.4.0+sdk-1.4.341.0"
3911 source = "registry+https://github.com/rust-lang/crates.io-index"
3912 checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f"
3913 dependencies = [
3914 "bitflags 2.13.1",
3915 ]
3916
3917 [[package]]
3918 name = "stable_deref_trait"
3919 version = "1.2.1"
3920 source = "registry+https://github.com/rust-lang/crates.io-index"
3921 checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
3922
3923 [[package]]
3924 name = "static_assertions"
3925 version = "1.1.0"
3926 source = "registry+https://github.com/rust-lang/crates.io-index"
3927 checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
3928
3929 [[package]]
3930 name = "strict-num"
3931 version = "0.1.1"
3932 source = "registry+https://github.com/rust-lang/crates.io-index"
3933 checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
3934 dependencies = [
3935 "float-cmp",
3936 ]
3937
3938 [[package]]
3939 name = "strum"
3940 version = "0.28.0"
3941 source = "registry+https://github.com/rust-lang/crates.io-index"
3942 checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd"
3943 dependencies = [
3944 "strum_macros",
3945 ]
3946
3947 [[package]]
3948 name = "strum_macros"
3949 version = "0.28.0"
3950 source = "registry+https://github.com/rust-lang/crates.io-index"
3951 checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664"
3952 dependencies = [
3953 "heck",
3954 "proc-macro2",
3955 "quote",
3956 "syn 2.0.117",
3957 ]
3958
3959 [[package]]
3960 name = "sval"
3961 version = "2.15.0"
3962 source = "registry+https://github.com/rust-lang/crates.io-index"
3963 checksum = "d94c4464e595f0284970fd9c7e9013804d035d4a61ab74b113242c874c05814d"
3964
3965 [[package]]
3966 name = "sval_buffer"
3967 version = "2.15.0"
3968 source = "registry+https://github.com/rust-lang/crates.io-index"
3969 checksum = "a0f46e34b20a39e6a2bf02b926983149b3af6609fd1ee8a6e63f6f340f3e2164"
3970 dependencies = [
3971 "sval",
3972 "sval_ref",
3973 ]
3974
3975 [[package]]
3976 name = "sval_dynamic"
3977 version = "2.15.0"
3978 source = "registry+https://github.com/rust-lang/crates.io-index"
3979 checksum = "03d0970e53c92ab5381d3b2db1828da8af945954d4234225f6dd9c3afbcef3f5"
3980 dependencies = [
3981 "sval",
3982 ]
3983
3984 [[package]]
3985 name = "sval_fmt"
3986 version = "2.15.0"
3987 source = "registry+https://github.com/rust-lang/crates.io-index"
3988 checksum = "43e5e6e1613e1e7fc2e1a9fdd709622e54c122ceb067a60d170d75efd491a839"
3989 dependencies = [
3990 "itoa",
3991 "ryu",
3992 "sval",
3993 ]
3994
3995 [[package]]
3996 name = "sval_json"
3997 version = "2.15.0"
3998 source = "registry+https://github.com/rust-lang/crates.io-index"
3999 checksum = "aec382f7bfa6e367b23c9611f129b94eb7daaf3d8fae45a8d0a0211eb4d4c8e6"
4000 dependencies = [
4001 "itoa",
4002 "ryu",
4003 "sval",
4004 ]
4005
4006 [[package]]
4007 name = "sval_nested"
4008 version = "2.15.0"
4009 source = "registry+https://github.com/rust-lang/crates.io-index"
4010 checksum = "3049d0f99ce6297f8f7d9953b35a0103b7584d8f638de40e64edb7105fa578ae"
4011 dependencies = [
4012 "sval",
4013 "sval_buffer",
4014 "sval_ref",
4015 ]
4016
4017 [[package]]
4018 name = "sval_ref"
4019 version = "2.15.0"
4020 source = "registry+https://github.com/rust-lang/crates.io-index"
4021 checksum = "f88913e77506085c0a8bf6912bb6558591a960faf5317df6c1d9b227224ca6e1"
4022 dependencies = [
4023 "sval",
4024 ]
4025
4026 [[package]]
4027 name = "sval_serde"
4028 version = "2.15.0"
4029 source = "registry+https://github.com/rust-lang/crates.io-index"
4030 checksum = "f579fd7254f4be6cd7b450034f856b78523404655848789c451bacc6aa8b387d"
4031 dependencies = [
4032 "serde_core",
4033 "sval",
4034 "sval_nested",
4035 ]
4036
4037 [[package]]
4038 name = "svg_fmt"
4039 version = "0.4.5"
4040 source = "registry+https://github.com/rust-lang/crates.io-index"
4041 checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb"
4042
4043 [[package]]
4044 name = "svgtypes"
4045 version = "0.16.1"
4046 source = "registry+https://github.com/rust-lang/crates.io-index"
4047 checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d"
4048 dependencies = [
4049 "kurbo",
4050 "siphasher",
4051 ]
4052
4053 [[package]]
4054 name = "swash"
4055 version = "0.2.6"
4056 source = "registry+https://github.com/rust-lang/crates.io-index"
4057 checksum = "47846491253e976bdd07d0f9cc24b7daf24720d11309302ccbbc6e6b6e53550a"
4058 dependencies = [
4059 "skrifa 0.37.0",
4060 "yazi",
4061 "zeno",
4062 ]
4063
4064 [[package]]
4065 name = "syn"
4066 version = "2.0.117"
4067 source = "registry+https://github.com/rust-lang/crates.io-index"
4068 checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
4069 dependencies = [
4070 "proc-macro2",
4071 "quote",
4072 "unicode-ident",
4073 ]
4074
4075 [[package]]
4076 name = "syn"
4077 version = "3.0.3"
4078 source = "registry+https://github.com/rust-lang/crates.io-index"
4079 checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
4080 dependencies = [
4081 "proc-macro2",
4082 "quote",
4083 "unicode-ident",
4084 ]
4085
4086 [[package]]
4087 name = "synstructure"
4088 version = "0.13.2"
4089 source = "registry+https://github.com/rust-lang/crates.io-index"
4090 checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
4091 dependencies = [
4092 "proc-macro2",
4093 "quote",
4094 "syn 2.0.117",
4095 ]
4096
4097 [[package]]
4098 name = "sys-locale"
4099 version = "0.3.2"
4100 source = "registry+https://github.com/rust-lang/crates.io-index"
4101 checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
4102 dependencies = [
4103 "libc",
4104 ]
4105
4106 [[package]]
4107 name = "sysinfo"
4108 version = "0.31.4"
4109 source = "registry+https://github.com/rust-lang/crates.io-index"
4110 checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be"
4111 dependencies = [
4112 "core-foundation-sys",
4113 "libc",
4114 "memchr",
4115 "ntapi",
4116 "rayon",
4117 "windows 0.57.0",
4118 ]
4119
4120 [[package]]
4121 name = "taffy"
4122 version = "0.13.0"
4123 source = "registry+https://github.com/rust-lang/crates.io-index"
4124 checksum = "c034e05f6ee85a12daa63863c2245797715075c70649947aa0da54f3f2ab1d0f"
4125 dependencies = [
4126 "arrayvec",
4127 "serde",
4128 "slotmap",
4129 "smallvec",
4130 ]
4131
4132 [[package]]
4133 name = "tao-core-video-sys"
4134 version = "0.2.0"
4135 source = "registry+https://github.com/rust-lang/crates.io-index"
4136 checksum = "271450eb289cb4d8d0720c6ce70c72c8c858c93dd61fc625881616752e6b98f6"
4137 dependencies = [
4138 "cfg-if",
4139 "core-foundation-sys",
4140 "libc",
4141 "objc",
4142 ]
4143
4144 [[package]]
4145 name = "tempfile"
4146 version = "3.27.0"
4147 source = "registry+https://github.com/rust-lang/crates.io-index"
4148 checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
4149 dependencies = [
4150 "fastrand",
4151 "getrandom 0.4.1",
4152 "once_cell",
4153 "rustix",
4154 "windows-sys 0.61.2",
4155 ]
4156
4157 [[package]]
4158 name = "termcolor"
4159 version = "1.4.1"
4160 source = "registry+https://github.com/rust-lang/crates.io-index"
4161 checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
4162 dependencies = [
4163 "winapi-util",
4164 ]
4165
4166 [[package]]
4167 name = "thiserror"
4168 version = "1.0.69"
4169 source = "registry+https://github.com/rust-lang/crates.io-index"
4170 checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
4171 dependencies = [
4172 "thiserror-impl 1.0.69",
4173 ]
4174
4175 [[package]]
4176 name = "thiserror"
4177 version = "2.0.17"
4178 source = "registry+https://github.com/rust-lang/crates.io-index"
4179 checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
4180 dependencies = [
4181 "thiserror-impl 2.0.17",
4182 ]
4183
4184 [[package]]
4185 name = "thiserror-impl"
4186 version = "1.0.69"
4187 source = "registry+https://github.com/rust-lang/crates.io-index"
4188 checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
4189 dependencies = [
4190 "proc-macro2",
4191 "quote",
4192 "syn 2.0.117",
4193 ]
4194
4195 [[package]]
4196 name = "thiserror-impl"
4197 version = "2.0.17"
4198 source = "registry+https://github.com/rust-lang/crates.io-index"
4199 checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
4200 dependencies = [
4201 "proc-macro2",
4202 "quote",
4203 "syn 2.0.117",
4204 ]
4205
4206 [[package]]
4207 name = "thread_local"
4208 version = "1.1.9"
4209 source = "registry+https://github.com/rust-lang/crates.io-index"
4210 checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
4211 dependencies = [
4212 "cfg-if",
4213 ]
4214
4215 [[package]]
4216 name = "tiff"
4217 version = "0.11.3"
4218 source = "registry+https://github.com/rust-lang/crates.io-index"
4219 checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"
4220 dependencies = [
4221 "fax",
4222 "flate2",
4223 "half",
4224 "quick-error 2.0.1",
4225 "weezl",
4226 "zune-jpeg",
4227 ]
4228
4229 [[package]]
4230 name = "tiny-skia"
4231 version = "0.11.4"
4232 source = "registry+https://github.com/rust-lang/crates.io-index"
4233 checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab"
4234 dependencies = [
4235 "arrayref",
4236 "arrayvec",
4237 "bytemuck",
4238 "cfg-if",
4239 "log",
4240 "png 0.17.16",
4241 "tiny-skia-path",
4242 ]
4243
4244 [[package]]
4245 name = "tiny-skia-path"
4246 version = "0.11.4"
4247 source = "registry+https://github.com/rust-lang/crates.io-index"
4248 checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93"
4249 dependencies = [
4250 "arrayref",
4251 "bytemuck",
4252 "strict-num",
4253 ]
4254
4255 [[package]]
4256 name = "tinystr"
4257 version = "0.8.4"
4258 source = "registry+https://github.com/rust-lang/crates.io-index"
4259 checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"
4260 dependencies = [
4261 "displaydoc",
4262 "zerovec",
4263 ]
4264
4265 [[package]]
4266 name = "tinytemplate"
4267 version = "1.2.1"
4268 source = "registry+https://github.com/rust-lang/crates.io-index"
4269 checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
4270 dependencies = [
4271 "serde",
4272 "serde_json",
4273 ]
4274
4275 [[package]]
4276 name = "tinyvec"
4277 version = "1.10.0"
4278 source = "registry+https://github.com/rust-lang/crates.io-index"
4279 checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"
4280 dependencies = [
4281 "tinyvec_macros",
4282 ]
4283
4284 [[package]]
4285 name = "tinyvec_macros"
4286 version = "0.1.1"
4287 source = "registry+https://github.com/rust-lang/crates.io-index"
4288 checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
4289
4290 [[package]]
4291 name = "toml_datetime"
4292 version = "0.7.3"
4293 source = "registry+https://github.com/rust-lang/crates.io-index"
4294 checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
4295 dependencies = [
4296 "serde_core",
4297 ]
4298
4299 [[package]]
4300 name = "toml_edit"
4301 version = "0.23.7"
4302 source = "registry+https://github.com/rust-lang/crates.io-index"
4303 checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d"
4304 dependencies = [
4305 "indexmap",
4306 "toml_datetime",
4307 "toml_parser",
4308 "winnow",
4309 ]
4310
4311 [[package]]
4312 name = "toml_parser"
4313 version = "1.0.4"
4314 source = "registry+https://github.com/rust-lang/crates.io-index"
4315 checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
4316 dependencies = [
4317 "winnow",
4318 ]
4319
4320 [[package]]
4321 name = "tracing"
4322 version = "0.1.43"
4323 source = "registry+https://github.com/rust-lang/crates.io-index"
4324 checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647"
4325 dependencies = [
4326 "pin-project-lite",
4327 "tracing-attributes",
4328 "tracing-core",
4329 ]
4330
4331 [[package]]
4332 name = "tracing-attributes"
4333 version = "0.1.31"
4334 source = "registry+https://github.com/rust-lang/crates.io-index"
4335 checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
4336 dependencies = [
4337 "proc-macro2",
4338 "quote",
4339 "syn 2.0.117",
4340 ]
4341
4342 [[package]]
4343 name = "tracing-core"
4344 version = "0.1.35"
4345 source = "registry+https://github.com/rust-lang/crates.io-index"
4346 checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
4347 dependencies = [
4348 "once_cell",
4349 "valuable",
4350 ]
4351
4352 [[package]]
4353 name = "tracing-log"
4354 version = "0.2.0"
4355 source = "registry+https://github.com/rust-lang/crates.io-index"
4356 checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
4357 dependencies = [
4358 "log",
4359 "once_cell",
4360 "tracing-core",
4361 ]
4362
4363 [[package]]
4364 name = "tracing-subscriber"
4365 version = "0.3.22"
4366 source = "registry+https://github.com/rust-lang/crates.io-index"
4367 checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
4368 dependencies = [
4369 "nu-ansi-term",
4370 "sharded-slab",
4371 "smallvec",
4372 "thread_local",
4373 "tracing-core",
4374 "tracing-log",
4375 ]
4376
4377 [[package]]
4378 name = "ttf-parser"
4379 version = "0.25.1"
4380 source = "registry+https://github.com/rust-lang/crates.io-index"
4381 checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
4382 dependencies = [
4383 "core_maths",
4384 ]
4385
4386 [[package]]
4387 name = "typeid"
4388 version = "1.0.3"
4389 source = "registry+https://github.com/rust-lang/crates.io-index"
4390 checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
4391
4392 [[package]]
4393 name = "unarray"
4394 version = "0.1.4"
4395 source = "registry+https://github.com/rust-lang/crates.io-index"
4396 checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94"
4397
4398 [[package]]
4399 name = "unicode-bidi"
4400 version = "0.3.18"
4401 source = "registry+https://github.com/rust-lang/crates.io-index"
4402 checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
4403
4404 [[package]]
4405 name = "unicode-bidi-mirroring"
4406 version = "0.4.0"
4407 source = "registry+https://github.com/rust-lang/crates.io-index"
4408 checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe"
4409
4410 [[package]]
4411 name = "unicode-ccc"
4412 version = "0.4.0"
4413 source = "registry+https://github.com/rust-lang/crates.io-index"
4414 checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e"
4415
4416 [[package]]
4417 name = "unicode-ident"
4418 version = "1.0.24"
4419 source = "registry+https://github.com/rust-lang/crates.io-index"
4420 checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
4421
4422 [[package]]
4423 name = "unicode-linebreak"
4424 version = "0.1.5"
4425 source = "registry+https://github.com/rust-lang/crates.io-index"
4426 checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
4427
4428 [[package]]
4429 name = "unicode-properties"
4430 version = "0.1.3"
4431 source = "registry+https://github.com/rust-lang/crates.io-index"
4432 checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
4433
4434 [[package]]
4435 name = "unicode-script"
4436 version = "0.5.8"
4437 source = "registry+https://github.com/rust-lang/crates.io-index"
4438 checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee"
4439
4440 [[package]]
4441 name = "unicode-segmentation"
4442 version = "1.13.3"
4443 source = "registry+https://github.com/rust-lang/crates.io-index"
4444 checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
4445
4446 [[package]]
4447 name = "unicode-vo"
4448 version = "0.1.0"
4449 source = "registry+https://github.com/rust-lang/crates.io-index"
4450 checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"
4451
4452 [[package]]
4453 name = "unicode-width"
4454 version = "0.2.2"
4455 source = "registry+https://github.com/rust-lang/crates.io-index"
4456 checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
4457
4458 [[package]]
4459 name = "unicode-xid"
4460 version = "0.2.6"
4461 source = "registry+https://github.com/rust-lang/crates.io-index"
4462 checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
4463
4464 [[package]]
4465 name = "url"
4466 version = "2.5.7"
4467 source = "registry+https://github.com/rust-lang/crates.io-index"
4468 checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
4469 dependencies = [
4470 "form_urlencoded",
4471 "idna",
4472 "percent-encoding",
4473 "serde",
4474 ]
4475
4476 [[package]]
4477 name = "usvg"
4478 version = "0.46.0"
4479 source = "registry+https://github.com/rust-lang/crates.io-index"
4480 checksum = "e419dff010bb12512b0ae9e3d2f318dfbdf0167fde7eb05465134d4e8756076f"
4481 dependencies = [
4482 "base64",
4483 "data-url",
4484 "flate2",
4485 "fontdb",
4486 "imagesize",
4487 "kurbo",
4488 "log",
4489 "pico-args",
4490 "roxmltree 0.21.1",
4491 "rustybuzz",
4492 "simplecss",
4493 "siphasher",
4494 "strict-num",
4495 "svgtypes",
4496 "tiny-skia-path",
4497 "unicode-bidi",
4498 "unicode-script",
4499 "unicode-vo",
4500 "xmlwriter",
4501 ]
4502
4503 [[package]]
4504 name = "utf8_iter"
4505 version = "1.0.4"
4506 source = "registry+https://github.com/rust-lang/crates.io-index"
4507 checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
4508
4509 [[package]]
4510 name = "uuid"
4511 version = "1.18.1"
4512 source = "registry+https://github.com/rust-lang/crates.io-index"
4513 checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
4514 dependencies = [
4515 "getrandom 0.3.4",
4516 "js-sys",
4517 "serde",
4518 "sha1_smol",
4519 "wasm-bindgen",
4520 ]
4521
4522 [[package]]
4523 name = "v_frame"
4524 version = "0.3.9"
4525 source = "registry+https://github.com/rust-lang/crates.io-index"
4526 checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"
4527 dependencies = [
4528 "aligned-vec",
4529 "num-traits",
4530 "wasm-bindgen",
4531 ]
4532
4533 [[package]]
4534 name = "valuable"
4535 version = "0.1.1"
4536 source = "registry+https://github.com/rust-lang/crates.io-index"
4537 checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
4538
4539 [[package]]
4540 name = "value-bag"
4541 version = "1.12.0"
4542 source = "registry+https://github.com/rust-lang/crates.io-index"
4543 checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0"
4544 dependencies = [
4545 "value-bag-serde1",
4546 "value-bag-sval2",
4547 ]
4548
4549 [[package]]
4550 name = "value-bag-serde1"
4551 version = "1.12.0"
4552 source = "registry+https://github.com/rust-lang/crates.io-index"
4553 checksum = "16530907bfe2999a1773ca5900a65101e092c70f642f25cc23ca0c43573262c5"
4554 dependencies = [
4555 "erased-serde",
4556 "serde_core",
4557 "serde_fmt",
4558 ]
4559
4560 [[package]]
4561 name = "value-bag-sval2"
4562 version = "1.12.0"
4563 source = "registry+https://github.com/rust-lang/crates.io-index"
4564 checksum = "d00ae130edd690eaa877e4f40605d534790d1cf1d651e7685bd6a144521b251f"
4565 dependencies = [
4566 "sval",
4567 "sval_buffer",
4568 "sval_dynamic",
4569 "sval_fmt",
4570 "sval_json",
4571 "sval_ref",
4572 "sval_serde",
4573 ]
4574
4575 [[package]]
4576 name = "version_check"
4577 version = "0.9.5"
4578 source = "registry+https://github.com/rust-lang/crates.io-index"
4579 checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
4580
4581 [[package]]
4582 name = "wait-timeout"
4583 version = "0.2.1"
4584 source = "registry+https://github.com/rust-lang/crates.io-index"
4585 checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"
4586 dependencies = [
4587 "libc",
4588 ]
4589
4590 [[package]]
4591 name = "waker-fn"
4592 version = "1.2.0"
4593 source = "registry+https://github.com/rust-lang/crates.io-index"
4594 checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7"
4595
4596 [[package]]
4597 name = "walkdir"
4598 version = "2.5.0"
4599 source = "registry+https://github.com/rust-lang/crates.io-index"
4600 checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
4601 dependencies = [
4602 "same-file",
4603 "winapi-util",
4604 ]
4605
4606 [[package]]
4607 name = "wasi"
4608 version = "0.11.1+wasi-snapshot-preview1"
4609 source = "registry+https://github.com/rust-lang/crates.io-index"
4610 checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
4611
4612 [[package]]
4613 name = "wasip2"
4614 version = "1.0.1+wasi-0.2.4"
4615 source = "registry+https://github.com/rust-lang/crates.io-index"
4616 checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
4617 dependencies = [
4618 "wit-bindgen 0.46.0",
4619 ]
4620
4621 [[package]]
4622 name = "wasip3"
4623 version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
4624 source = "registry+https://github.com/rust-lang/crates.io-index"
4625 checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
4626 dependencies = [
4627 "wit-bindgen 0.51.0",
4628 ]
4629
4630 [[package]]
4631 name = "wasm-bindgen"
4632 version = "0.2.120"
4633 source = "registry+https://github.com/rust-lang/crates.io-index"
4634 checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1"
4635 dependencies = [
4636 "cfg-if",
4637 "once_cell",
4638 "rustversion",
4639 "wasm-bindgen-macro",
4640 "wasm-bindgen-shared",
4641 ]
4642
4643 [[package]]
4644 name = "wasm-bindgen-futures"
4645 version = "0.4.70"
4646 source = "registry+https://github.com/rust-lang/crates.io-index"
4647 checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084"
4648 dependencies = [
4649 "js-sys",
4650 "wasm-bindgen",
4651 ]
4652
4653 [[package]]
4654 name = "wasm-bindgen-macro"
4655 version = "0.2.120"
4656 source = "registry+https://github.com/rust-lang/crates.io-index"
4657 checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103"
4658 dependencies = [
4659 "quote",
4660 "wasm-bindgen-macro-support",
4661 ]
4662
4663 [[package]]
4664 name = "wasm-bindgen-macro-support"
4665 version = "0.2.120"
4666 source = "registry+https://github.com/rust-lang/crates.io-index"
4667 checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41"
4668 dependencies = [
4669 "bumpalo",
4670 "proc-macro2",
4671 "quote",
4672 "syn 2.0.117",
4673 "wasm-bindgen-shared",
4674 ]
4675
4676 [[package]]
4677 name = "wasm-bindgen-shared"
4678 version = "0.2.120"
4679 source = "registry+https://github.com/rust-lang/crates.io-index"
4680 checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea"
4681 dependencies = [
4682 "unicode-ident",
4683 ]
4684
4685 [[package]]
4686 name = "wasm-encoder"
4687 version = "0.244.0"
4688 source = "registry+https://github.com/rust-lang/crates.io-index"
4689 checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
4690 dependencies = [
4691 "leb128fmt",
4692 "wasmparser",
4693 ]
4694
4695 [[package]]
4696 name = "wasm-metadata"
4697 version = "0.244.0"
4698 source = "registry+https://github.com/rust-lang/crates.io-index"
4699 checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
4700 dependencies = [
4701 "anyhow",
4702 "indexmap",
4703 "wasm-encoder",
4704 "wasmparser",
4705 ]
4706
4707 [[package]]
4708 name = "wasmparser"
4709 version = "0.244.0"
4710 source = "registry+https://github.com/rust-lang/crates.io-index"
4711 checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
4712 dependencies = [
4713 "bitflags 2.13.1",
4714 "hashbrown 0.15.5",
4715 "indexmap",
4716 "semver",
4717 ]
4718
4719 [[package]]
4720 name = "wayland-sys"
4721 version = "0.31.11"
4722 source = "registry+https://github.com/rust-lang/crates.io-index"
4723 checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be"
4724 dependencies = [
4725 "dlib",
4726 "log",
4727 "once_cell",
4728 "pkg-config",
4729 ]
4730
4731 [[package]]
4732 name = "web-sys"
4733 version = "0.3.97"
4734 source = "registry+https://github.com/rust-lang/crates.io-index"
4735 checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602"
4736 dependencies = [
4737 "js-sys",
4738 "wasm-bindgen",
4739 ]
4740
4741 [[package]]
4742 name = "web-time"
4743 version = "1.1.0"
4744 source = "registry+https://github.com/rust-lang/crates.io-index"
4745 checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
4746 dependencies = [
4747 "js-sys",
4748 "wasm-bindgen",
4749 ]
4750
4751 [[package]]
4752 name = "weezl"
4753 version = "0.1.10"
4754 source = "registry+https://github.com/rust-lang/crates.io-index"
4755 checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3"
4756
4757 [[package]]
4758 name = "wgpu"
4759 version = "29.0.4"
4760 source = "registry+https://github.com/rust-lang/crates.io-index"
4761 checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07"
4762 dependencies = [
4763 "arrayvec",
4764 "bitflags 2.13.1",
4765 "bytemuck",
4766 "cfg-if",
4767 "cfg_aliases",
4768 "document-features",
4769 "hashbrown 0.16.1",
4770 "js-sys",
4771 "log",
4772 "naga",
4773 "parking_lot",
4774 "portable-atomic",
4775 "profiling",
4776 "raw-window-handle",
4777 "smallvec",
4778 "static_assertions",
4779 "wasm-bindgen",
4780 "wasm-bindgen-futures",
4781 "web-sys",
4782 "wgpu-core",
4783 "wgpu-hal",
4784 "wgpu-types",
4785 ]
4786
4787 [[package]]
4788 name = "wgpu-core"
4789 version = "29.0.4"
4790 source = "registry+https://github.com/rust-lang/crates.io-index"
4791 checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7"
4792 dependencies = [
4793 "arrayvec",
4794 "bit-set 0.9.1",
4795 "bit-vec 0.9.1",
4796 "bitflags 2.13.1",
4797 "bytemuck",
4798 "cfg_aliases",
4799 "document-features",
4800 "hashbrown 0.16.1",
4801 "indexmap",
4802 "log",
4803 "naga",
4804 "once_cell",
4805 "parking_lot",
4806 "portable-atomic",
4807 "profiling",
4808 "raw-window-handle",
4809 "rustc-hash 1.1.0",
4810 "smallvec",
4811 "thiserror 2.0.17",
4812 "wgpu-core-deps-apple",
4813 "wgpu-core-deps-emscripten",
4814 "wgpu-core-deps-wasm",
4815 "wgpu-core-deps-windows-linux-android",
4816 "wgpu-hal",
4817 "wgpu-naga-bridge",
4818 "wgpu-types",
4819 ]
4820
4821 [[package]]
4822 name = "wgpu-core-deps-apple"
4823 version = "29.0.4"
4824 source = "registry+https://github.com/rust-lang/crates.io-index"
4825 checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3"
4826 dependencies = [
4827 "wgpu-hal",
4828 ]
4829
4830 [[package]]
4831 name = "wgpu-core-deps-emscripten"
4832 version = "29.0.4"
4833 source = "registry+https://github.com/rust-lang/crates.io-index"
4834 checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af"
4835 dependencies = [
4836 "wgpu-hal",
4837 ]
4838
4839 [[package]]
4840 name = "wgpu-core-deps-wasm"
4841 version = "29.0.4"
4842 source = "registry+https://github.com/rust-lang/crates.io-index"
4843 checksum = "af1fb1798be2a912497d4c224f72d39bb0cb34af50e8bcc29865bc339c943059"
4844 dependencies = [
4845 "wgpu-hal",
4846 ]
4847
4848 [[package]]
4849 name = "wgpu-core-deps-windows-linux-android"
4850 version = "29.0.4"
4851 source = "registry+https://github.com/rust-lang/crates.io-index"
4852 checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257"
4853 dependencies = [
4854 "wgpu-hal",
4855 ]
4856
4857 [[package]]
4858 name = "wgpu-hal"
4859 version = "29.0.4"
4860 source = "registry+https://github.com/rust-lang/crates.io-index"
4861 checksum = "97ace1c17727311c22a46e4e3faf56ea6de81af99dcc839bdfb54857b94d448d"
4862 dependencies = [
4863 "android_system_properties",
4864 "arrayvec",
4865 "ash",
4866 "bit-set 0.9.1",
4867 "bitflags 2.13.1",
4868 "block2",
4869 "bytemuck",
4870 "cfg-if",
4871 "cfg_aliases",
4872 "glow",
4873 "glutin_wgl_sys",
4874 "gpu-allocator",
4875 "gpu-descriptor",
4876 "hashbrown 0.16.1",
4877 "js-sys",
4878 "khronos-egl",
4879 "libc",
4880 "libloading",
4881 "log",
4882 "naga",
4883 "ndk-sys",
4884 "objc2",
4885 "objc2-core-foundation",
4886 "objc2-foundation",
4887 "objc2-metal",
4888 "objc2-quartz-core",
4889 "once_cell",
4890 "ordered-float",
4891 "parking_lot",
4892 "portable-atomic",
4893 "portable-atomic-util",
4894 "profiling",
4895 "range-alloc",
4896 "raw-window-handle",
4897 "raw-window-metal",
4898 "renderdoc-sys",
4899 "smallvec",
4900 "thiserror 2.0.17",
4901 "wasm-bindgen",
4902 "wayland-sys",
4903 "web-sys",
4904 "wgpu-naga-bridge",
4905 "wgpu-types",
4906 "windows 0.62.2",
4907 "windows-core 0.62.2",
4908 "windows-result 0.4.1",
4909 ]
4910
4911 [[package]]
4912 name = "wgpu-naga-bridge"
4913 version = "29.0.4"
4914 source = "registry+https://github.com/rust-lang/crates.io-index"
4915 checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161"
4916 dependencies = [
4917 "naga",
4918 "wgpu-types",
4919 ]
4920
4921 [[package]]
4922 name = "wgpu-types"
4923 version = "29.0.4"
4924 source = "registry+https://github.com/rust-lang/crates.io-index"
4925 checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5"
4926 dependencies = [
4927 "bitflags 2.13.1",
4928 "bytemuck",
4929 "js-sys",
4930 "log",
4931 "raw-window-handle",
4932 "web-sys",
4933 ]
4934
4935 [[package]]
4936 name = "which"
4937 version = "8.0.5"
4938 source = "registry+https://github.com/rust-lang/crates.io-index"
4939 checksum = "8f3ef584124b911bcc3875c2f1472e80f24361ceb789bd1c62b3e9a3df9ff43c"
4940 dependencies = [
4941 "libc",
4942 ]
4943
4944 [[package]]
4945 name = "winapi"
4946 version = "0.3.9"
4947 source = "registry+https://github.com/rust-lang/crates.io-index"
4948 checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
4949 dependencies = [
4950 "winapi-i686-pc-windows-gnu",
4951 "winapi-x86_64-pc-windows-gnu",
4952 ]
4953
4954 [[package]]
4955 name = "winapi-i686-pc-windows-gnu"
4956 version = "0.4.0"
4957 source = "registry+https://github.com/rust-lang/crates.io-index"
4958 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
4959
4960 [[package]]
4961 name = "winapi-util"
4962 version = "0.1.11"
4963 source = "registry+https://github.com/rust-lang/crates.io-index"
4964 checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
4965 dependencies = [
4966 "windows-sys 0.61.2",
4967 ]
4968
4969 [[package]]
4970 name = "winapi-x86_64-pc-windows-gnu"
4971 version = "0.4.0"
4972 source = "registry+https://github.com/rust-lang/crates.io-index"
4973 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
4974
4975 [[package]]
4976 name = "windows"
4977 version = "0.57.0"
4978 source = "registry+https://github.com/rust-lang/crates.io-index"
4979 checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
4980 dependencies = [
4981 "windows-core 0.57.0",
4982 "windows-targets 0.52.6",
4983 ]
4984
4985 [[package]]
4986 name = "windows"
4987 version = "0.61.3"
4988 source = "registry+https://github.com/rust-lang/crates.io-index"
4989 checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
4990 dependencies = [
4991 "windows-collections 0.2.0",
4992 "windows-core 0.61.2",
4993 "windows-future 0.2.1",
4994 "windows-link 0.1.3",
4995 "windows-numerics 0.2.0",
4996 ]
4997
4998 [[package]]
4999 name = "windows"
5000 version = "0.62.2"
5001 source = "registry+https://github.com/rust-lang/crates.io-index"
5002 checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
5003 dependencies = [
5004 "windows-collections 0.3.2",
5005 "windows-core 0.62.2",
5006 "windows-future 0.3.2",
5007 "windows-numerics 0.3.1",
5008 ]
5009
5010 [[package]]
5011 name = "windows-capture"
5012 version = "1.5.0"
5013 source = "registry+https://github.com/rust-lang/crates.io-index"
5014 checksum = "3a4df73e95feddb9ec1a7e9c2ca6323b8c97d5eeeff78d28f1eccdf19c882b24"
5015 dependencies = [
5016 "parking_lot",
5017 "rayon",
5018 "thiserror 2.0.17",
5019 "windows 0.61.3",
5020 "windows-future 0.2.1",
5021 ]
5022
5023 [[package]]
5024 name = "windows-collections"
5025 version = "0.2.0"
5026 source = "registry+https://github.com/rust-lang/crates.io-index"
5027 checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
5028 dependencies = [
5029 "windows-core 0.61.2",
5030 ]
5031
5032 [[package]]
5033 name = "windows-collections"
5034 version = "0.3.2"
5035 source = "registry+https://github.com/rust-lang/crates.io-index"
5036 checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
5037 dependencies = [
5038 "windows-core 0.62.2",
5039 ]
5040
5041 [[package]]
5042 name = "windows-core"
5043 version = "0.57.0"
5044 source = "registry+https://github.com/rust-lang/crates.io-index"
5045 checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
5046 dependencies = [
5047 "windows-implement 0.57.0",
5048 "windows-interface 0.57.0",
5049 "windows-result 0.1.2",
5050 "windows-targets 0.52.6",
5051 ]
5052
5053 [[package]]
5054 name = "windows-core"
5055 version = "0.61.2"
5056 source = "registry+https://github.com/rust-lang/crates.io-index"
5057 checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
5058 dependencies = [
5059 "windows-implement 0.60.2",
5060 "windows-interface 0.59.3",
5061 "windows-link 0.1.3",
5062 "windows-result 0.3.4",
5063 "windows-strings 0.4.2",
5064 ]
5065
5066 [[package]]
5067 name = "windows-core"
5068 version = "0.62.2"
5069 source = "registry+https://github.com/rust-lang/crates.io-index"
5070 checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
5071 dependencies = [
5072 "windows-implement 0.60.2",
5073 "windows-interface 0.59.3",
5074 "windows-link 0.2.1",
5075 "windows-result 0.4.1",
5076 "windows-strings 0.5.1",
5077 ]
5078
5079 [[package]]
5080 name = "windows-future"
5081 version = "0.2.1"
5082 source = "registry+https://github.com/rust-lang/crates.io-index"
5083 checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
5084 dependencies = [
5085 "windows-core 0.61.2",
5086 "windows-link 0.1.3",
5087 "windows-threading 0.1.0",
5088 ]
5089
5090 [[package]]
5091 name = "windows-future"
5092 version = "0.3.2"
5093 source = "registry+https://github.com/rust-lang/crates.io-index"
5094 checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
5095 dependencies = [
5096 "windows-core 0.62.2",
5097 "windows-link 0.2.1",
5098 "windows-threading 0.2.1",
5099 ]
5100
5101 [[package]]
5102 name = "windows-implement"
5103 version = "0.57.0"
5104 source = "registry+https://github.com/rust-lang/crates.io-index"
5105 checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
5106 dependencies = [
5107 "proc-macro2",
5108 "quote",
5109 "syn 2.0.117",
5110 ]
5111
5112 [[package]]
5113 name = "windows-implement"
5114 version = "0.60.2"
5115 source = "registry+https://github.com/rust-lang/crates.io-index"
5116 checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
5117 dependencies = [
5118 "proc-macro2",
5119 "quote",
5120 "syn 2.0.117",
5121 ]
5122
5123 [[package]]
5124 name = "windows-interface"
5125 version = "0.57.0"
5126 source = "registry+https://github.com/rust-lang/crates.io-index"
5127 checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
5128 dependencies = [
5129 "proc-macro2",
5130 "quote",
5131 "syn 2.0.117",
5132 ]
5133
5134 [[package]]
5135 name = "windows-interface"
5136 version = "0.59.3"
5137 source = "registry+https://github.com/rust-lang/crates.io-index"
5138 checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
5139 dependencies = [
5140 "proc-macro2",
5141 "quote",
5142 "syn 2.0.117",
5143 ]
5144
5145 [[package]]
5146 name = "windows-link"
5147 version = "0.1.3"
5148 source = "registry+https://github.com/rust-lang/crates.io-index"
5149 checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
5150
5151 [[package]]
5152 name = "windows-link"
5153 version = "0.2.1"
5154 source = "registry+https://github.com/rust-lang/crates.io-index"
5155 checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
5156
5157 [[package]]
5158 name = "windows-numerics"
5159 version = "0.2.0"
5160 source = "registry+https://github.com/rust-lang/crates.io-index"
5161 checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
5162 dependencies = [
5163 "windows-core 0.61.2",
5164 "windows-link 0.1.3",
5165 ]
5166
5167 [[package]]
5168 name = "windows-numerics"
5169 version = "0.3.1"
5170 source = "registry+https://github.com/rust-lang/crates.io-index"
5171 checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
5172 dependencies = [
5173 "windows-core 0.62.2",
5174 "windows-link 0.2.1",
5175 ]
5176
5177 [[package]]
5178 name = "windows-result"
5179 version = "0.1.2"
5180 source = "registry+https://github.com/rust-lang/crates.io-index"
5181 checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
5182 dependencies = [
5183 "windows-targets 0.52.6",
5184 ]
5185
5186 [[package]]
5187 name = "windows-result"
5188 version = "0.3.4"
5189 source = "registry+https://github.com/rust-lang/crates.io-index"
5190 checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
5191 dependencies = [
5192 "windows-link 0.1.3",
5193 ]
5194
5195 [[package]]
5196 name = "windows-result"
5197 version = "0.4.1"
5198 source = "registry+https://github.com/rust-lang/crates.io-index"
5199 checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
5200 dependencies = [
5201 "windows-link 0.2.1",
5202 ]
5203
5204 [[package]]
5205 name = "windows-strings"
5206 version = "0.4.2"
5207 source = "registry+https://github.com/rust-lang/crates.io-index"
5208 checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
5209 dependencies = [
5210 "windows-link 0.1.3",
5211 ]
5212
5213 [[package]]
5214 name = "windows-strings"
5215 version = "0.5.1"
5216 source = "registry+https://github.com/rust-lang/crates.io-index"
5217 checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
5218 dependencies = [
5219 "windows-link 0.2.1",
5220 ]
5221
5222 [[package]]
5223 name = "windows-sys"
5224 version = "0.48.0"
5225 source = "registry+https://github.com/rust-lang/crates.io-index"
5226 checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
5227 dependencies = [
5228 "windows-targets 0.48.5",
5229 ]
5230
5231 [[package]]
5232 name = "windows-sys"
5233 version = "0.61.2"
5234 source = "registry+https://github.com/rust-lang/crates.io-index"
5235 checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
5236 dependencies = [
5237 "windows-link 0.2.1",
5238 ]
5239
5240 [[package]]
5241 name = "windows-targets"
5242 version = "0.48.5"
5243 source = "registry+https://github.com/rust-lang/crates.io-index"
5244 checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
5245 dependencies = [
5246 "windows_aarch64_gnullvm 0.48.5",
5247 "windows_aarch64_msvc 0.48.5",
5248 "windows_i686_gnu 0.48.5",
5249 "windows_i686_msvc 0.48.5",
5250 "windows_x86_64_gnu 0.48.5",
5251 "windows_x86_64_gnullvm 0.48.5",
5252 "windows_x86_64_msvc 0.48.5",
5253 ]
5254
5255 [[package]]
5256 name = "windows-targets"
5257 version = "0.52.6"
5258 source = "registry+https://github.com/rust-lang/crates.io-index"
5259 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
5260 dependencies = [
5261 "windows_aarch64_gnullvm 0.52.6",
5262 "windows_aarch64_msvc 0.52.6",
5263 "windows_i686_gnu 0.52.6",
5264 "windows_i686_gnullvm",
5265 "windows_i686_msvc 0.52.6",
5266 "windows_x86_64_gnu 0.52.6",
5267 "windows_x86_64_gnullvm 0.52.6",
5268 "windows_x86_64_msvc 0.52.6",
5269 ]
5270
5271 [[package]]
5272 name = "windows-threading"
5273 version = "0.1.0"
5274 source = "registry+https://github.com/rust-lang/crates.io-index"
5275 checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
5276 dependencies = [
5277 "windows-link 0.1.3",
5278 ]
5279
5280 [[package]]
5281 name = "windows-threading"
5282 version = "0.2.1"
5283 source = "registry+https://github.com/rust-lang/crates.io-index"
5284 checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
5285 dependencies = [
5286 "windows-link 0.2.1",
5287 ]
5288
5289 [[package]]
5290 name = "windows_aarch64_gnullvm"
5291 version = "0.48.5"
5292 source = "registry+https://github.com/rust-lang/crates.io-index"
5293 checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
5294
5295 [[package]]
5296 name = "windows_aarch64_gnullvm"
5297 version = "0.52.6"
5298 source = "registry+https://github.com/rust-lang/crates.io-index"
5299 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
5300
5301 [[package]]
5302 name = "windows_aarch64_msvc"
5303 version = "0.48.5"
5304 source = "registry+https://github.com/rust-lang/crates.io-index"
5305 checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
5306
5307 [[package]]
5308 name = "windows_aarch64_msvc"
5309 version = "0.52.6"
5310 source = "registry+https://github.com/rust-lang/crates.io-index"
5311 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
5312
5313 [[package]]
5314 name = "windows_i686_gnu"
5315 version = "0.48.5"
5316 source = "registry+https://github.com/rust-lang/crates.io-index"
5317 checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
5318
5319 [[package]]
5320 name = "windows_i686_gnu"
5321 version = "0.52.6"
5322 source = "registry+https://github.com/rust-lang/crates.io-index"
5323 checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
5324
5325 [[package]]
5326 name = "windows_i686_gnullvm"
5327 version = "0.52.6"
5328 source = "registry+https://github.com/rust-lang/crates.io-index"
5329 checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
5330
5331 [[package]]
5332 name = "windows_i686_msvc"
5333 version = "0.48.5"
5334 source = "registry+https://github.com/rust-lang/crates.io-index"
5335 checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
5336
5337 [[package]]
5338 name = "windows_i686_msvc"
5339 version = "0.52.6"
5340 source = "registry+https://github.com/rust-lang/crates.io-index"
5341 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
5342
5343 [[package]]
5344 name = "windows_x86_64_gnu"
5345 version = "0.48.5"
5346 source = "registry+https://github.com/rust-lang/crates.io-index"
5347 checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
5348
5349 [[package]]
5350 name = "windows_x86_64_gnu"
5351 version = "0.52.6"
5352 source = "registry+https://github.com/rust-lang/crates.io-index"
5353 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
5354
5355 [[package]]
5356 name = "windows_x86_64_gnullvm"
5357 version = "0.48.5"
5358 source = "registry+https://github.com/rust-lang/crates.io-index"
5359 checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
5360
5361 [[package]]
5362 name = "windows_x86_64_gnullvm"
5363 version = "0.52.6"
5364 source = "registry+https://github.com/rust-lang/crates.io-index"
5365 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
5366
5367 [[package]]
5368 name = "windows_x86_64_msvc"
5369 version = "0.48.5"
5370 source = "registry+https://github.com/rust-lang/crates.io-index"
5371 checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
5372
5373 [[package]]
5374 name = "windows_x86_64_msvc"
5375 version = "0.52.6"
5376 source = "registry+https://github.com/rust-lang/crates.io-index"
5377 checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
5378
5379 [[package]]
5380 name = "winnow"
5381 version = "0.7.13"
5382 source = "registry+https://github.com/rust-lang/crates.io-index"
5383 checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
5384 dependencies = [
5385 "memchr",
5386 ]
5387
5388 [[package]]
5389 name = "wio"
5390 version = "0.2.2"
5391 source = "registry+https://github.com/rust-lang/crates.io-index"
5392 checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
5393 dependencies = [
5394 "winapi",
5395 ]
5396
5397 [[package]]
5398 name = "wit-bindgen"
5399 version = "0.46.0"
5400 source = "registry+https://github.com/rust-lang/crates.io-index"
5401 checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
5402
5403 [[package]]
5404 name = "wit-bindgen"
5405 version = "0.51.0"
5406 source = "registry+https://github.com/rust-lang/crates.io-index"
5407 checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
5408 dependencies = [
5409 "wit-bindgen-rust-macro",
5410 ]
5411
5412 [[package]]
5413 name = "wit-bindgen-core"
5414 version = "0.51.0"
5415 source = "registry+https://github.com/rust-lang/crates.io-index"
5416 checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
5417 dependencies = [
5418 "anyhow",
5419 "heck",
5420 "wit-parser",
5421 ]
5422
5423 [[package]]
5424 name = "wit-bindgen-rust"
5425 version = "0.51.0"
5426 source = "registry+https://github.com/rust-lang/crates.io-index"
5427 checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
5428 dependencies = [
5429 "anyhow",
5430 "heck",
5431 "indexmap",
5432 "prettyplease",
5433 "syn 2.0.117",
5434 "wasm-metadata",
5435 "wit-bindgen-core",
5436 "wit-component",
5437 ]
5438
5439 [[package]]
5440 name = "wit-bindgen-rust-macro"
5441 version = "0.51.0"
5442 source = "registry+https://github.com/rust-lang/crates.io-index"
5443 checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
5444 dependencies = [
5445 "anyhow",
5446 "prettyplease",
5447 "proc-macro2",
5448 "quote",
5449 "syn 2.0.117",
5450 "wit-bindgen-core",
5451 "wit-bindgen-rust",
5452 ]
5453
5454 [[package]]
5455 name = "wit-component"
5456 version = "0.244.0"
5457 source = "registry+https://github.com/rust-lang/crates.io-index"
5458 checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
5459 dependencies = [
5460 "anyhow",
5461 "bitflags 2.13.1",
5462 "indexmap",
5463 "log",
5464 "serde",
5465 "serde_derive",
5466 "serde_json",
5467 "wasm-encoder",
5468 "wasm-metadata",
5469 "wasmparser",
5470 "wit-parser",
5471 ]
5472
5473 [[package]]
5474 name = "wit-parser"
5475 version = "0.244.0"
5476 source = "registry+https://github.com/rust-lang/crates.io-index"
5477 checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
5478 dependencies = [
5479 "anyhow",
5480 "id-arena",
5481 "indexmap",
5482 "log",
5483 "semver",
5484 "serde",
5485 "serde_derive",
5486 "serde_json",
5487 "unicode-xid",
5488 "wasmparser",
5489 ]
5490
5491 [[package]]
5492 name = "writeable"
5493 version = "0.6.4"
5494 source = "registry+https://github.com/rust-lang/crates.io-index"
5495 checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
5496
5497 [[package]]
5498 name = "x11"
5499 version = "2.21.0"
5500 source = "registry+https://github.com/rust-lang/crates.io-index"
5501 checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e"
5502 dependencies = [
5503 "libc",
5504 "pkg-config",
5505 ]
5506
5507 [[package]]
5508 name = "xcb"
5509 version = "1.6.0"
5510 source = "registry+https://github.com/rust-lang/crates.io-index"
5511 checksum = "f07c123b796139bfe0603e654eaf08e132e52387ba95b252c78bad3640ba37ea"
5512 dependencies = [
5513 "bitflags 1.3.2",
5514 "libc",
5515 "quick-xml",
5516 "x11",
5517 ]
5518
5519 [[package]]
5520 name = "xml-rs"
5521 version = "0.8.28"
5522 source = "registry+https://github.com/rust-lang/crates.io-index"
5523 checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"
5524
5525 [[package]]
5526 name = "xmlwriter"
5527 version = "0.1.0"
5528 source = "registry+https://github.com/rust-lang/crates.io-index"
5529 checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
5530
5531 [[package]]
5532 name = "y4m"
5533 version = "0.8.0"
5534 source = "registry+https://github.com/rust-lang/crates.io-index"
5535 checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
5536
5537 [[package]]
5538 name = "yazi"
5539 version = "0.2.1"
5540 source = "registry+https://github.com/rust-lang/crates.io-index"
5541 checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5"
5542
5543 [[package]]
5544 name = "yeslogic-fontconfig-sys"
5545 version = "6.0.0"
5546 source = "registry+https://github.com/rust-lang/crates.io-index"
5547 checksum = "503a066b4c037c440169d995b869046827dbc71263f6e8f3be6d77d4f3229dbd"
5548 dependencies = [
5549 "dlib",
5550 "once_cell",
5551 "pkg-config",
5552 ]
5553
5554 [[package]]
5555 name = "yoke"
5556 version = "0.8.3"
5557 source = "registry+https://github.com/rust-lang/crates.io-index"
5558 checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
5559 dependencies = [
5560 "stable_deref_trait",
5561 "yoke-derive",
5562 "zerofrom",
5563 ]
5564
5565 [[package]]
5566 name = "yoke-derive"
5567 version = "0.8.2"
5568 source = "registry+https://github.com/rust-lang/crates.io-index"
5569 checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
5570 dependencies = [
5571 "proc-macro2",
5572 "quote",
5573 "syn 2.0.117",
5574 "synstructure",
5575 ]
5576
5577 [[package]]
5578 name = "zed-font-kit"
5579 version = "0.14.1-zed"
5580 source = "registry+https://github.com/rust-lang/crates.io-index"
5581 checksum = "a3898e450f36f852edda72e3f985c34426042c4951790b23b107f93394f9bff5"
5582 dependencies = [
5583 "bitflags 2.13.1",
5584 "byteorder",
5585 "core-foundation 0.10.0",
5586 "core-graphics 0.24.0",
5587 "core-text",
5588 "dirs",
5589 "dwrote",
5590 "float-ord",
5591 "freetype-sys",
5592 "lazy_static",
5593 "libc",
5594 "log",
5595 "pathfinder_geometry",
5596 "pathfinder_simd",
5597 "walkdir",
5598 "winapi",
5599 "yeslogic-fontconfig-sys",
5600 ]
5601
5602 [[package]]
5603 name = "zed-scap"
5604 version = "0.0.8-zed"
5605 source = "registry+https://github.com/rust-lang/crates.io-index"
5606 checksum = "b6b338d705ae33a43ca00287c11129303a7a0aa57b101b72a1c08c863f698ac8"
5607 dependencies = [
5608 "anyhow",
5609 "cocoa",
5610 "core-graphics-helmer-fork",
5611 "log",
5612 "objc",
5613 "rand 0.8.6",
5614 "screencapturekit",
5615 "screencapturekit-sys",
5616 "sysinfo",
5617 "tao-core-video-sys",
5618 "windows 0.61.3",
5619 "windows-capture",
5620 "x11",
5621 "xcb",
5622 ]
5623
5624 [[package]]
5625 name = "zeno"
5626 version = "0.3.3"
5627 source = "registry+https://github.com/rust-lang/crates.io-index"
5628 checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
5629
5630 [[package]]
5631 name = "zerocopy"
5632 version = "0.8.27"
5633 source = "registry+https://github.com/rust-lang/crates.io-index"
5634 checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
5635 dependencies = [
5636 "zerocopy-derive",
5637 ]
5638
5639 [[package]]
5640 name = "zerocopy-derive"
5641 version = "0.8.27"
5642 source = "registry+https://github.com/rust-lang/crates.io-index"
5643 checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
5644 dependencies = [
5645 "proc-macro2",
5646 "quote",
5647 "syn 2.0.117",
5648 ]
5649
5650 [[package]]
5651 name = "zerofrom"
5652 version = "0.1.6"
5653 source = "registry+https://github.com/rust-lang/crates.io-index"
5654 checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
5655 dependencies = [
5656 "zerofrom-derive",
5657 ]
5658
5659 [[package]]
5660 name = "zerofrom-derive"
5661 version = "0.1.6"
5662 source = "registry+https://github.com/rust-lang/crates.io-index"
5663 checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
5664 dependencies = [
5665 "proc-macro2",
5666 "quote",
5667 "syn 2.0.117",
5668 "synstructure",
5669 ]
5670
5671 [[package]]
5672 name = "zerotrie"
5673 version = "0.2.5"
5674 source = "registry+https://github.com/rust-lang/crates.io-index"
5675 checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"
5676 dependencies = [
5677 "displaydoc",
5678 "yoke",
5679 "zerofrom",
5680 ]
5681
5682 [[package]]
5683 name = "zerovec"
5684 version = "0.11.8"
5685 source = "registry+https://github.com/rust-lang/crates.io-index"
5686 checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"
5687 dependencies = [
5688 "yoke",
5689 "zerofrom",
5690 "zerovec-derive",
5691 ]
5692
5693 [[package]]
5694 name = "zerovec-derive"
5695 version = "0.11.5"
5696 source = "registry+https://github.com/rust-lang/crates.io-index"
5697 checksum = "9f212a141d820099d57ffafb9569be9617a6f27d3dc881fbee8fb56642f917a9"
5698 dependencies = [
5699 "proc-macro2",
5700 "quote",
5701 "syn 3.0.3",
5702 ]
5703
5704 [[package]]
5705 name = "zmij"
5706 version = "1.0.23"
5707 source = "registry+https://github.com/rust-lang/crates.io-index"
5708 checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
5709
5710 [[package]]
5711 name = "zune-core"
5712 version = "0.5.1"
5713 source = "registry+https://github.com/rust-lang/crates.io-index"
5714 checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9"
5715
5716 [[package]]
5717 name = "zune-inflate"
5718 version = "0.2.54"
5719 source = "registry+https://github.com/rust-lang/crates.io-index"
5720 checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
5721 dependencies = [
5722 "simd-adler32",
5723 ]
5724
5725 [[package]]
5726 name = "zune-jpeg"
5727 version = "0.5.15"
5728 source = "registry+https://github.com/rust-lang/crates.io-index"
5729 checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"
5730 dependencies = [
5731 "zune-core",
5732 ]
@@ -0,0 +1,5732 @@
1# This file is automatically @generated by Cargo.
2# It is not intended for manual editing.
3version = 4
4
5[[package]]
6name = "accesskit"
7version = "0.24.1"
8source = "registry+https://github.com/rust-lang/crates.io-index"
9checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320"
10dependencies = [
11 "enumn",
12 "uuid",
13]
14
15[[package]]
16name = "addr2line"
17version = "0.25.1"
18source = "registry+https://github.com/rust-lang/crates.io-index"
19checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
20dependencies = [
21 "gimli",
22]
23
24[[package]]
25name = "adler2"
26version = "2.0.1"
27source = "registry+https://github.com/rust-lang/crates.io-index"
28checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
29
30[[package]]
31name = "aho-corasick"
32version = "1.1.3"
33source = "registry+https://github.com/rust-lang/crates.io-index"
34checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
35dependencies = [
36 "memchr",
37]
38
39[[package]]
40name = "aligned"
41version = "0.4.3"
42source = "registry+https://github.com/rust-lang/crates.io-index"
43checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"
44dependencies = [
45 "as-slice",
46]
47
48[[package]]
49name = "aligned-vec"
50version = "0.6.4"
51source = "registry+https://github.com/rust-lang/crates.io-index"
52checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"
53dependencies = [
54 "equator",
55]
56
57[[package]]
58name = "alloca"
59version = "0.4.0"
60source = "registry+https://github.com/rust-lang/crates.io-index"
61checksum = "e5a7d05ea6aea7e9e64d25b9156ba2fee3fdd659e34e41063cd2fc7cd020d7f4"
62dependencies = [
63 "cc",
64]
65
66[[package]]
67name = "allocator-api2"
68version = "0.2.21"
69source = "registry+https://github.com/rust-lang/crates.io-index"
70checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
71
72[[package]]
73name = "android_system_properties"
74version = "0.1.5"
75source = "registry+https://github.com/rust-lang/crates.io-index"
76checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
77dependencies = [
78 "libc",
79]
80
81[[package]]
82name = "anes"
83version = "0.1.6"
84source = "registry+https://github.com/rust-lang/crates.io-index"
85checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
86
87[[package]]
88name = "anstyle"
89version = "1.0.13"
90source = "registry+https://github.com/rust-lang/crates.io-index"
91checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
92
93[[package]]
94name = "anyhow"
95version = "1.0.104"
96source = "registry+https://github.com/rust-lang/crates.io-index"
97checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
98
99[[package]]
100name = "arbitrary"
101version = "1.4.2"
102source = "registry+https://github.com/rust-lang/crates.io-index"
103checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
104
105[[package]]
106name = "arg_enum_proc_macro"
107version = "0.3.4"
108source = "registry+https://github.com/rust-lang/crates.io-index"
109checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
110dependencies = [
111 "proc-macro2",
112 "quote",
113 "syn 2.0.117",
114]
115
116[[package]]
117name = "arrayref"
118version = "0.3.9"
119source = "registry+https://github.com/rust-lang/crates.io-index"
120checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"
121
122[[package]]
123name = "arrayvec"
124version = "0.7.6"
125source = "registry+https://github.com/rust-lang/crates.io-index"
126checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
127
128[[package]]
129name = "as-slice"
130version = "0.2.1"
131source = "registry+https://github.com/rust-lang/crates.io-index"
132checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
133dependencies = [
134 "stable_deref_trait",
135]
136
137[[package]]
138name = "ash"
139version = "0.38.0+1.3.281"
140source = "registry+https://github.com/rust-lang/crates.io-index"
141checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
142dependencies = [
143 "libloading",
144]
145
146[[package]]
147name = "async-channel"
148version = "2.5.0"
149source = "registry+https://github.com/rust-lang/crates.io-index"
150checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"
151dependencies = [
152 "concurrent-queue",
153 "event-listener-strategy",
154 "futures-core",
155 "pin-project-lite",
156]
157
158[[package]]
159name = "async-compression"
160version = "0.4.32"
161source = "registry+https://github.com/rust-lang/crates.io-index"
162checksum = "5a89bce6054c720275ac2432fbba080a66a2106a44a1b804553930ca6909f4e0"
163dependencies = [
164 "compression-codecs",
165 "compression-core",
166 "futures-core",
167 "futures-io",
168 "pin-project-lite",
169]
170
171[[package]]
172name = "async-task"
173version = "4.7.1"
174source = "registry+https://github.com/rust-lang/crates.io-index"
175checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
176
177[[package]]
178name = "atomic"
179version = "0.5.3"
180source = "registry+https://github.com/rust-lang/crates.io-index"
181checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba"
182
183[[package]]
184name = "autocfg"
185version = "1.5.0"
186source = "registry+https://github.com/rust-lang/crates.io-index"
187checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
188
189[[package]]
190name = "av-scenechange"
191version = "0.14.1"
192source = "registry+https://github.com/rust-lang/crates.io-index"
193checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394"
194dependencies = [
195 "aligned",
196 "anyhow",
197 "arg_enum_proc_macro",
198 "arrayvec",
199 "log",
200 "num-rational",
201 "num-traits",
202 "pastey",
203 "rayon",
204 "thiserror 2.0.17",
205 "v_frame",
206 "y4m",
207]
208
209[[package]]
210name = "av1-grain"
211version = "0.2.4"
212source = "registry+https://github.com/rust-lang/crates.io-index"
213checksum = "4f3efb2ca85bc610acfa917b5aaa36f3fcbebed5b3182d7f877b02531c4b80c8"
214dependencies = [
215 "anyhow",
216 "arrayvec",
217 "log",
218 "nom",
219 "num-rational",
220 "v_frame",
221]
222
223[[package]]
224name = "avif-serialize"
225version = "0.8.6"
226source = "registry+https://github.com/rust-lang/crates.io-index"
227checksum = "47c8fbc0f831f4519fe8b810b6a7a91410ec83031b8233f730a0480029f6a23f"
228dependencies = [
229 "arrayvec",
230]
231
232[[package]]
233name = "backtrace"
234version = "0.3.76"
235source = "registry+https://github.com/rust-lang/crates.io-index"
236checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
237dependencies = [
238 "addr2line",
239 "cfg-if",
240 "libc",
241 "miniz_oxide",
242 "object",
243 "rustc-demangle",
244 "windows-link 0.2.1",
245]
246
247[[package]]
248name = "base64"
249version = "0.22.1"
250source = "registry+https://github.com/rust-lang/crates.io-index"
251checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
252
253[[package]]
254name = "bindgen"
255version = "0.72.1"
256source = "registry+https://github.com/rust-lang/crates.io-index"
257checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
258dependencies = [
259 "bitflags 2.13.1",
260 "cexpr",
261 "clang-sys",
262 "itertools 0.13.0",
263 "log",
264 "prettyplease",
265 "proc-macro2",
266 "quote",
267 "regex",
268 "rustc-hash 2.1.1",
269 "shlex 1.3.0",
270 "syn 2.0.117",
271]
272
273[[package]]
274name = "bit-set"
275version = "0.8.0"
276source = "registry+https://github.com/rust-lang/crates.io-index"
277checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
278dependencies = [
279 "bit-vec 0.8.0",
280]
281
282[[package]]
283name = "bit-set"
284version = "0.9.1"
285source = "registry+https://github.com/rust-lang/crates.io-index"
286checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd"
287dependencies = [
288 "bit-vec 0.9.1",
289]
290
291[[package]]
292name = "bit-vec"
293version = "0.8.0"
294source = "registry+https://github.com/rust-lang/crates.io-index"
295checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
296
297[[package]]
298name = "bit-vec"
299version = "0.9.1"
300source = "registry+https://github.com/rust-lang/crates.io-index"
301checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"
302
303[[package]]
304name = "bit_field"
305version = "0.10.3"
306source = "registry+https://github.com/rust-lang/crates.io-index"
307checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
308
309[[package]]
310name = "bitflags"
311version = "1.3.2"
312source = "registry+https://github.com/rust-lang/crates.io-index"
313checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
314
315[[package]]
316name = "bitflags"
317version = "2.13.1"
318source = "registry+https://github.com/rust-lang/crates.io-index"
319checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
320
321[[package]]
322name = "bitstream-io"
323version = "4.9.0"
324source = "registry+https://github.com/rust-lang/crates.io-index"
325checksum = "60d4bd9d1db2c6bdf285e223a7fa369d5ce98ec767dec949c6ca62863ce61757"
326dependencies = [
327 "core2",
328]
329
330[[package]]
331name = "block"
332version = "0.1.6"
333source = "registry+https://github.com/rust-lang/crates.io-index"
334checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
335
336[[package]]
337name = "block2"
338version = "0.6.2"
339source = "registry+https://github.com/rust-lang/crates.io-index"
340checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"
341dependencies = [
342 "objc2",
343]
344
345[[package]]
346name = "built"
347version = "0.8.0"
348source = "registry+https://github.com/rust-lang/crates.io-index"
349checksum = "f4ad8f11f288f48ca24471bbd51ac257aaeaaa07adae295591266b792902ae64"
350
351[[package]]
352name = "bumpalo"
353version = "3.20.3"
354source = "registry+https://github.com/rust-lang/crates.io-index"
355checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
356
357[[package]]
358name = "bytemuck"
359version = "1.24.0"
360source = "registry+https://github.com/rust-lang/crates.io-index"
361checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4"
362dependencies = [
363 "bytemuck_derive",
364]
365
366[[package]]
367name = "bytemuck_derive"
368version = "1.10.2"
369source = "registry+https://github.com/rust-lang/crates.io-index"
370checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff"
371dependencies = [
372 "proc-macro2",
373 "quote",
374 "syn 2.0.117",
375]
376
377[[package]]
378name = "byteorder"
379version = "1.5.0"
380source = "registry+https://github.com/rust-lang/crates.io-index"
381checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
382
383[[package]]
384name = "byteorder-lite"
385version = "0.1.0"
386source = "registry+https://github.com/rust-lang/crates.io-index"
387checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
388
389[[package]]
390name = "bytes"
391version = "1.11.1"
392source = "registry+https://github.com/rust-lang/crates.io-index"
393checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
394
395[[package]]
396name = "bzip2"
397version = "0.6.1"
398source = "registry+https://github.com/rust-lang/crates.io-index"
399checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
400dependencies = [
401 "libbz2-rs-sys",
402]
403
404[[package]]
405name = "c-enum"
406version = "0.2.3"
407source = "registry+https://github.com/rust-lang/crates.io-index"
408checksum = "cd17eb909a8c6a894926bfcc3400a4bb0e732f5a57d37b1f14e8b29e329bace8"
409
410[[package]]
411name = "cast"
412version = "0.3.0"
413source = "registry+https://github.com/rust-lang/crates.io-index"
414checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
415
416[[package]]
417name = "cc"
418version = "1.4.3"
419source = "registry+https://github.com/rust-lang/crates.io-index"
420checksum = "509591b7bcd67f4ef775afad7662703b4935daaa6ec0e5605cfb1090b32a2b6d"
421dependencies = [
422 "find-msvc-tools",
423 "jobserver",
424 "libc",
425 "shlex 2.0.1",
426]
427
428[[package]]
429name = "cexpr"
430version = "0.6.0"
431source = "registry+https://github.com/rust-lang/crates.io-index"
432checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
433dependencies = [
434 "nom",
435]
436
437[[package]]
438name = "cfg-if"
439version = "1.0.4"
440source = "registry+https://github.com/rust-lang/crates.io-index"
441checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
442
443[[package]]
444name = "cfg_aliases"
445version = "0.2.1"
446source = "registry+https://github.com/rust-lang/crates.io-index"
447checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
448
449[[package]]
450name = "cgl"
451version = "0.3.2"
452source = "registry+https://github.com/rust-lang/crates.io-index"
453checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"
454dependencies = [
455 "libc",
456]
457
458[[package]]
459name = "chrono"
460version = "0.4.42"
461source = "registry+https://github.com/rust-lang/crates.io-index"
462checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2"
463dependencies = [
464 "iana-time-zone",
465 "js-sys",
466 "num-traits",
467 "serde",
468 "wasm-bindgen",
469 "windows-link 0.2.1",
470]
471
472[[package]]
473name = "ciborium"
474version = "0.2.2"
475source = "registry+https://github.com/rust-lang/crates.io-index"
476checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e"
477dependencies = [
478 "ciborium-io",
479 "ciborium-ll",
480 "serde",
481]
482
483[[package]]
484name = "ciborium-io"
485version = "0.2.2"
486source = "registry+https://github.com/rust-lang/crates.io-index"
487checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
488
489[[package]]
490name = "ciborium-ll"
491version = "0.2.2"
492source = "registry+https://github.com/rust-lang/crates.io-index"
493checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
494dependencies = [
495 "ciborium-io",
496 "half",
497]
498
499[[package]]
500name = "clang-sys"
501version = "1.8.1"
502source = "registry+https://github.com/rust-lang/crates.io-index"
503checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
504dependencies = [
505 "glob",
506 "libc",
507 "libloading",
508]
509
510[[package]]
511name = "clap"
512version = "4.5.49"
513source = "registry+https://github.com/rust-lang/crates.io-index"
514checksum = "f4512b90fa68d3a9932cea5184017c5d200f5921df706d45e853537dea51508f"
515dependencies = [
516 "clap_builder",
517]
518
519[[package]]
520name = "clap_builder"
521version = "4.5.49"
522source = "registry+https://github.com/rust-lang/crates.io-index"
523checksum = "0025e98baa12e766c67ba13ff4695a887a1eba19569aad00a472546795bd6730"
524dependencies = [
525 "anstyle",
526 "clap_lex",
527]
528
529[[package]]
530name = "clap_lex"
531version = "0.7.6"
532source = "registry+https://github.com/rust-lang/crates.io-index"
533checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
534
535[[package]]
536name = "cocoa"
537version = "0.25.0"
538source = "registry+https://github.com/rust-lang/crates.io-index"
539checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c"
540dependencies = [
541 "bitflags 1.3.2",
542 "block",
543 "cocoa-foundation",
544 "core-foundation 0.9.4",
545 "core-graphics 0.23.2",
546 "foreign-types",
547 "libc",
548 "objc",
549]
550
551[[package]]
552name = "cocoa-foundation"
553version = "0.1.2"
554source = "registry+https://github.com/rust-lang/crates.io-index"
555checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7"
556dependencies = [
557 "bitflags 1.3.2",
558 "block",
559 "core-foundation 0.9.4",
560 "core-graphics-types 0.1.3",
561 "libc",
562 "objc",
563]
564
565[[package]]
566name = "codespan-reporting"
567version = "0.13.0"
568source = "registry+https://github.com/rust-lang/crates.io-index"
569checksum = "ba7a06c0b31fff5ff2e1e7d37dbf940864e2a974b336e1a2938d10af6e8fb283"
570dependencies = [
571 "serde",
572 "termcolor",
573 "unicode-width",
574]
575
576[[package]]
577name = "color_quant"
578version = "1.1.0"
579source = "registry+https://github.com/rust-lang/crates.io-index"
580checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
581
582[[package]]
583name = "compression-codecs"
584version = "0.4.31"
585source = "registry+https://github.com/rust-lang/crates.io-index"
586checksum = "ef8a506ec4b81c460798f572caead636d57d3d7e940f998160f52bd254bf2d23"
587dependencies = [
588 "bzip2",
589 "compression-core",
590 "flate2",
591 "memchr",
592]
593
594[[package]]
595name = "compression-core"
596version = "0.4.29"
597source = "registry+https://github.com/rust-lang/crates.io-index"
598checksum = "e47641d3deaf41fb1538ac1f54735925e275eaf3bf4d55c81b137fba797e5cbb"
599
600[[package]]
601name = "concurrent-queue"
602version = "2.5.0"
603source = "registry+https://github.com/rust-lang/crates.io-index"
604checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
605dependencies = [
606 "crossbeam-utils",
607]
608
609[[package]]
610name = "convert_case"
611version = "0.10.0"
612source = "registry+https://github.com/rust-lang/crates.io-index"
613checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9"
614dependencies = [
615 "unicode-segmentation",
616]
617
618[[package]]
619name = "convert_case"
620version = "0.11.0"
621source = "registry+https://github.com/rust-lang/crates.io-index"
622checksum = "affbf0190ed2caf063e3def54ff444b449371d55c58e513a95ab98eca50adb49"
623dependencies = [
624 "unicode-segmentation",
625]
626
627[[package]]
628name = "core-foundation"
629version = "0.9.4"
630source = "registry+https://github.com/rust-lang/crates.io-index"
631checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
632dependencies = [
633 "core-foundation-sys",
634 "libc",
635]
636
637[[package]]
638name = "core-foundation"
639version = "0.10.0"
640source = "registry+https://github.com/rust-lang/crates.io-index"
641checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63"
642dependencies = [
643 "core-foundation-sys",
644 "libc",
645]
646
647[[package]]
648name = "core-foundation-sys"
649version = "0.8.7"
650source = "registry+https://github.com/rust-lang/crates.io-index"
651checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
652
653[[package]]
654name = "core-graphics"
655version = "0.23.2"
656source = "registry+https://github.com/rust-lang/crates.io-index"
657checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
658dependencies = [
659 "bitflags 1.3.2",
660 "core-foundation 0.9.4",
661 "core-graphics-types 0.1.3",
662 "foreign-types",
663 "libc",
664]
665
666[[package]]
667name = "core-graphics"
668version = "0.24.0"
669source = "registry+https://github.com/rust-lang/crates.io-index"
670checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1"
671dependencies = [
672 "bitflags 2.13.1",
673 "core-foundation 0.10.0",
674 "core-graphics-types 0.2.0",
675 "foreign-types",
676 "libc",
677]
678
679[[package]]
680name = "core-graphics-helmer-fork"
681version = "0.24.0"
682source = "registry+https://github.com/rust-lang/crates.io-index"
683checksum = "32eb7c354ae9f6d437a6039099ce7ecd049337a8109b23d73e48e8ffba8e9cd5"
684dependencies = [
685 "bitflags 2.13.1",
686 "core-foundation 0.9.4",
687 "core-graphics-types 0.1.3",
688 "foreign-types",
689 "libc",
690]
691
692[[package]]
693name = "core-graphics-types"
694version = "0.1.3"
695source = "registry+https://github.com/rust-lang/crates.io-index"
696checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
697dependencies = [
698 "bitflags 1.3.2",
699 "core-foundation 0.9.4",
700 "libc",
701]
702
703[[package]]
704name = "core-graphics-types"
705version = "0.2.0"
706source = "registry+https://github.com/rust-lang/crates.io-index"
707checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
708dependencies = [
709 "bitflags 2.13.1",
710 "core-foundation 0.10.0",
711 "libc",
712]
713
714[[package]]
715name = "core-graphics2"
716version = "0.5.2"
717source = "registry+https://github.com/rust-lang/crates.io-index"
718checksum = "4416167a69126e617f8d0a214af0e3c1dbdeffcb100ddf72dcd1a1ac9893c146"
719dependencies = [
720 "bitflags 2.13.1",
721 "block",
722 "cfg-if",
723 "core-foundation 0.10.0",
724 "libc",
725]
726
727[[package]]
728name = "core-text"
729version = "21.0.0"
730source = "registry+https://github.com/rust-lang/crates.io-index"
731checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130"
732dependencies = [
733 "core-foundation 0.10.0",
734 "core-graphics 0.24.0",
735 "foreign-types",
736 "libc",
737]
738
739[[package]]
740name = "core-video"
741version = "0.5.2"
742source = "registry+https://github.com/rust-lang/crates.io-index"
743checksum = "139679cc63eb9504bdbe37e37874b0247136177655f0008588781e90863afa62"
744dependencies = [
745 "block",
746 "core-foundation 0.10.0",
747 "core-graphics2",
748 "io-surface",
749 "libc",
750 "metal",
751]
752
753[[package]]
754name = "core2"
755version = "0.4.0"
756source = "registry+https://github.com/rust-lang/crates.io-index"
757checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505"
758dependencies = [
759 "memchr",
760]
761
762[[package]]
763name = "core_maths"
764version = "0.1.1"
765source = "registry+https://github.com/rust-lang/crates.io-index"
766checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"
767dependencies = [
768 "libm",
769]
770
771[[package]]
772name = "cosmic-text"
773version = "0.19.0"
774source = "registry+https://github.com/rust-lang/crates.io-index"
775checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73"
776dependencies = [
777 "bitflags 2.13.1",
778 "fontdb",
779 "harfrust",
780 "linebender_resource_handle",
781 "log",
782 "rangemap",
783 "rustc-hash 2.1.1",
784 "self_cell",
785 "skrifa 0.40.0",
786 "smol_str",
787 "swash",
788 "sys-locale",
789 "unicode-bidi",
790 "unicode-linebreak",
791 "unicode-script",
792 "unicode-segmentation",
793]
794
795[[package]]
796name = "crc32fast"
797version = "1.5.0"
798source = "registry+https://github.com/rust-lang/crates.io-index"
799checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
800dependencies = [
801 "cfg-if",
802]
803
804[[package]]
805name = "criterion"
806version = "0.8.2"
807source = "registry+https://github.com/rust-lang/crates.io-index"
808checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3"
809dependencies = [
810 "alloca",
811 "anes",
812 "cast",
813 "ciborium",
814 "clap",
815 "criterion-plot",
816 "itertools 0.13.0",
817 "num-traits",
818 "oorandom",
819 "page_size",
820 "plotters",
821 "rayon",
822 "regex",
823 "serde",
824 "serde_json",
825 "tinytemplate",
826 "walkdir",
827]
828
829[[package]]
830name = "criterion-plot"
831version = "0.8.2"
832source = "registry+https://github.com/rust-lang/crates.io-index"
833checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea"
834dependencies = [
835 "cast",
836 "itertools 0.13.0",
837]
838
839[[package]]
840name = "crossbeam-deque"
841version = "0.8.6"
842source = "registry+https://github.com/rust-lang/crates.io-index"
843checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
844dependencies = [
845 "crossbeam-epoch",
846 "crossbeam-utils",
847]
848
849[[package]]
850name = "crossbeam-epoch"
851version = "0.9.18"
852source = "registry+https://github.com/rust-lang/crates.io-index"
853checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
854dependencies = [
855 "crossbeam-utils",
856]
857
858[[package]]
859name = "crossbeam-queue"
860version = "0.3.12"
861source = "registry+https://github.com/rust-lang/crates.io-index"
862checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115"
863dependencies = [
864 "crossbeam-utils",
865]
866
867[[package]]
868name = "crossbeam-utils"
869version = "0.8.21"
870source = "registry+https://github.com/rust-lang/crates.io-index"
871checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
872
873[[package]]
874name = "crunchy"
875version = "0.2.4"
876source = "registry+https://github.com/rust-lang/crates.io-index"
877checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
878
879[[package]]
880name = "ctor"
881version = "1.0.12"
882source = "registry+https://github.com/rust-lang/crates.io-index"
883checksum = "2d83cb7e7a873830708d6b02a78cd36a592c6fa14bf267b68725103b85c0d77f"
884dependencies = [
885 "link-section",
886 "linktime-proc-macro",
887]
888
889[[package]]
890name = "data-url"
891version = "0.3.2"
892source = "registry+https://github.com/rust-lang/crates.io-index"
893checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"
894
895[[package]]
896name = "derive_more"
897version = "2.1.1"
898source = "registry+https://github.com/rust-lang/crates.io-index"
899checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134"
900dependencies = [
901 "derive_more-impl",
902]
903
904[[package]]
905name = "derive_more-impl"
906version = "2.1.1"
907source = "registry+https://github.com/rust-lang/crates.io-index"
908checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb"
909dependencies = [
910 "convert_case 0.10.0",
911 "proc-macro2",
912 "quote",
913 "rustc_version",
914 "syn 2.0.117",
915 "unicode-xid",
916]
917
918[[package]]
919name = "dirs"
920version = "5.0.1"
921source = "registry+https://github.com/rust-lang/crates.io-index"
922checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
923dependencies = [
924 "dirs-sys",
925]
926
927[[package]]
928name = "dirs-sys"
929version = "0.4.1"
930source = "registry+https://github.com/rust-lang/crates.io-index"
931checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
932dependencies = [
933 "libc",
934 "option-ext",
935 "redox_users",
936 "windows-sys 0.48.0",
937]
938
939[[package]]
940name = "dispatch"
941version = "0.2.0"
942source = "registry+https://github.com/rust-lang/crates.io-index"
943checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
944
945[[package]]
946name = "dispatch2"
947version = "0.3.1"
948source = "registry+https://github.com/rust-lang/crates.io-index"
949checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"
950dependencies = [
951 "bitflags 2.13.1",
952 "objc2",
953]
954
955[[package]]
956name = "displaydoc"
957version = "0.2.5"
958source = "registry+https://github.com/rust-lang/crates.io-index"
959checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
960dependencies = [
961 "proc-macro2",
962 "quote",
963 "syn 2.0.117",
964]
965
966[[package]]
967name = "dlib"
968version = "0.5.3"
969source = "registry+https://github.com/rust-lang/crates.io-index"
970checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"
971dependencies = [
972 "libloading",
973]
974
975[[package]]
976name = "document-features"
977version = "0.2.12"
978source = "registry+https://github.com/rust-lang/crates.io-index"
979checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"
980dependencies = [
981 "litrs",
982]
983
984[[package]]
985name = "dwrote"
986version = "0.11.5"
987source = "registry+https://github.com/rust-lang/crates.io-index"
988checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02"
989dependencies = [
990 "lazy_static",
991 "libc",
992 "winapi",
993 "wio",
994]
995
996[[package]]
997name = "dyn-clone"
998version = "1.0.20"
999source = "registry+https://github.com/rust-lang/crates.io-index"
1000checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
1001
1002[[package]]
1003name = "either"
1004version = "1.15.0"
1005source = "registry+https://github.com/rust-lang/crates.io-index"
1006checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
1007
1008[[package]]
1009name = "enumn"
1010version = "0.1.14"
1011source = "registry+https://github.com/rust-lang/crates.io-index"
1012checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38"
1013dependencies = [
1014 "proc-macro2",
1015 "quote",
1016 "syn 2.0.117",
1017]
1018
1019[[package]]
1020name = "equator"
1021version = "0.4.2"
1022source = "registry+https://github.com/rust-lang/crates.io-index"
1023checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc"
1024dependencies = [
1025 "equator-macro",
1026]
1027
1028[[package]]
1029name = "equator-macro"
1030version = "0.4.2"
1031source = "registry+https://github.com/rust-lang/crates.io-index"
1032checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3"
1033dependencies = [
1034 "proc-macro2",
1035 "quote",
1036 "syn 2.0.117",
1037]
1038
1039[[package]]
1040name = "equivalent"
1041version = "1.0.2"
1042source = "registry+https://github.com/rust-lang/crates.io-index"
1043checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
1044
1045[[package]]
1046name = "erased-serde"
1047version = "0.4.9"
1048source = "registry+https://github.com/rust-lang/crates.io-index"
1049checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3"
1050dependencies = [
1051 "serde",
1052 "serde_core",
1053 "typeid",
1054]
1055
1056[[package]]
1057name = "errno"
1058version = "0.3.14"
1059source = "registry+https://github.com/rust-lang/crates.io-index"
1060checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
1061dependencies = [
1062 "libc",
1063 "windows-sys 0.61.2",
1064]
1065
1066[[package]]
1067name = "etagere"
1068version = "0.2.15"
1069source = "registry+https://github.com/rust-lang/crates.io-index"
1070checksum = "fc89bf99e5dc15954a60f707c1e09d7540e5cd9af85fa75caa0b510bc08c5342"
1071dependencies = [
1072 "euclid",
1073 "svg_fmt",
1074]
1075
1076[[package]]
1077name = "euclid"
1078version = "0.22.14"
1079source = "registry+https://github.com/rust-lang/crates.io-index"
1080checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06"
1081dependencies = [
1082 "num-traits",
1083]
1084
1085[[package]]
1086name = "event-listener"
1087version = "5.4.1"
1088source = "registry+https://github.com/rust-lang/crates.io-index"
1089checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"
1090dependencies = [
1091 "concurrent-queue",
1092 "parking",
1093 "pin-project-lite",
1094]
1095
1096[[package]]
1097name = "event-listener-strategy"
1098version = "0.5.4"
1099source = "registry+https://github.com/rust-lang/crates.io-index"
1100checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
1101dependencies = [
1102 "event-listener",
1103 "pin-project-lite",
1104]
1105
1106[[package]]
1107name = "exr"
1108version = "1.74.0"
1109source = "registry+https://github.com/rust-lang/crates.io-index"
1110checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be"
1111dependencies = [
1112 "bit_field",
1113 "half",
1114 "lebe",
1115 "miniz_oxide",
1116 "rayon-core",
1117 "smallvec",
1118 "zune-inflate",
1119]
1120
1121[[package]]
1122name = "fastrand"
1123version = "2.3.0"
1124source = "registry+https://github.com/rust-lang/crates.io-index"
1125checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
1126dependencies = [
1127 "getrandom 0.2.16",
1128]
1129
1130[[package]]
1131name = "fax"
1132version = "0.2.6"
1133source = "registry+https://github.com/rust-lang/crates.io-index"
1134checksum = "f05de7d48f37cd6730705cbca900770cab77a89f413d23e100ad7fad7795a0ab"
1135dependencies = [
1136 "fax_derive",
1137]
1138
1139[[package]]
1140name = "fax_derive"
1141version = "0.2.0"
1142source = "registry+https://github.com/rust-lang/crates.io-index"
1143checksum = "a0aca10fb742cb43f9e7bb8467c91aa9bcb8e3ffbc6a6f7389bb93ffc920577d"
1144dependencies = [
1145 "proc-macro2",
1146 "quote",
1147 "syn 2.0.117",
1148]
1149
1150[[package]]
1151name = "fdeflate"
1152version = "0.3.7"
1153source = "registry+https://github.com/rust-lang/crates.io-index"
1154checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
1155dependencies = [
1156 "simd-adler32",
1157]
1158
1159[[package]]
1160name = "find-msvc-tools"
1161version = "0.1.11"
1162source = "registry+https://github.com/rust-lang/crates.io-index"
1163checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890"
1164
1165[[package]]
1166name = "fixedbitset"
1167version = "0.5.7"
1168source = "registry+https://github.com/rust-lang/crates.io-index"
1169checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
1170
1171[[package]]
1172name = "flate2"
1173version = "1.1.8"
1174source = "registry+https://github.com/rust-lang/crates.io-index"
1175checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369"
1176dependencies = [
1177 "crc32fast",
1178 "miniz_oxide",
1179]
1180
1181[[package]]
1182name = "float-cmp"
1183version = "0.9.0"
1184source = "registry+https://github.com/rust-lang/crates.io-index"
1185checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
1186
1187[[package]]
1188name = "float-ord"
1189version = "0.3.2"
1190source = "registry+https://github.com/rust-lang/crates.io-index"
1191checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d"
1192
1193[[package]]
1194name = "float_next_after"
1195version = "1.0.0"
1196source = "registry+https://github.com/rust-lang/crates.io-index"
1197checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8"
1198
1199[[package]]
1200name = "flume"
1201version = "0.12.0"
1202source = "registry+https://github.com/rust-lang/crates.io-index"
1203checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be"
1204dependencies = [
1205 "fastrand",
1206 "futures-core",
1207 "futures-sink",
1208 "spin 0.9.8",
1209]
1210
1211[[package]]
1212name = "fnv"
1213version = "1.0.7"
1214source = "registry+https://github.com/rust-lang/crates.io-index"
1215checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
1216
1217[[package]]
1218name = "foldhash"
1219version = "0.1.5"
1220source = "registry+https://github.com/rust-lang/crates.io-index"
1221checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
1222
1223[[package]]
1224name = "foldhash"
1225version = "0.2.0"
1226source = "registry+https://github.com/rust-lang/crates.io-index"
1227checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
1228
1229[[package]]
1230name = "font-types"
1231version = "0.10.0"
1232source = "registry+https://github.com/rust-lang/crates.io-index"
1233checksum = "511e2c18a516c666d27867d2f9821f76e7d591f762e9fc41dd6cc5c90fe54b0b"
1234dependencies = [
1235 "bytemuck",
1236]
1237
1238[[package]]
1239name = "font-types"
1240version = "0.11.0"
1241source = "registry+https://github.com/rust-lang/crates.io-index"
1242checksum = "b1e4d2d0cf79d38430cc9dc9aadec84774bff2e1ba30ae2bf6c16cfce9385a23"
1243dependencies = [
1244 "bytemuck",
1245]
1246
1247[[package]]
1248name = "fontconfig-parser"
1249version = "0.5.8"
1250source = "registry+https://github.com/rust-lang/crates.io-index"
1251checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646"
1252dependencies = [
1253 "roxmltree 0.20.0",
1254]
1255
1256[[package]]
1257name = "fontdb"
1258version = "0.23.0"
1259source = "registry+https://github.com/rust-lang/crates.io-index"
1260checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905"
1261dependencies = [
1262 "fontconfig-parser",
1263 "log",
1264 "memmap2",
1265 "slotmap",
1266 "tinyvec",
1267 "ttf-parser",
1268]
1269
1270[[package]]
1271name = "foreign-types"
1272version = "0.5.0"
1273source = "registry+https://github.com/rust-lang/crates.io-index"
1274checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
1275dependencies = [
1276 "foreign-types-macros",
1277 "foreign-types-shared",
1278]
1279
1280[[package]]
1281name = "foreign-types-macros"
1282version = "0.2.3"
1283source = "registry+https://github.com/rust-lang/crates.io-index"
1284checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
1285dependencies = [
1286 "proc-macro2",
1287 "quote",
1288 "syn 2.0.117",
1289]
1290
1291[[package]]
1292name = "foreign-types-shared"
1293version = "0.3.1"
1294source = "registry+https://github.com/rust-lang/crates.io-index"
1295checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
1296
1297[[package]]
1298name = "form_urlencoded"
1299version = "1.2.2"
1300source = "registry+https://github.com/rust-lang/crates.io-index"
1301checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
1302dependencies = [
1303 "percent-encoding",
1304]
1305
1306[[package]]
1307name = "freetype-sys"
1308version = "0.20.1"
1309source = "registry+https://github.com/rust-lang/crates.io-index"
1310checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134"
1311dependencies = [
1312 "cc",
1313 "libc",
1314 "pkg-config",
1315]
1316
1317[[package]]
1318name = "futures"
1319version = "0.3.34"
1320source = "registry+https://github.com/rust-lang/crates.io-index"
1321checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3"
1322dependencies = [
1323 "futures-channel",
1324 "futures-core",
1325 "futures-executor",
1326 "futures-io",
1327 "futures-sink",
1328 "futures-task",
1329 "futures-util",
1330]
1331
1332[[package]]
1333name = "futures-channel"
1334version = "0.3.34"
1335source = "registry+https://github.com/rust-lang/crates.io-index"
1336checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"
1337dependencies = [
1338 "futures-core",
1339 "futures-sink",
1340]
1341
1342[[package]]
1343name = "futures-concurrency"
1344version = "7.7.1"
1345source = "registry+https://github.com/rust-lang/crates.io-index"
1346checksum = "175cd8cca9e1d45b87f18ffa75088f2099e3c4fe5e2f83e42de112560bea8ea6"
1347dependencies = [
1348 "fixedbitset",
1349 "futures-core",
1350 "futures-lite",
1351 "pin-project",
1352 "smallvec",
1353]
1354
1355[[package]]
1356name = "futures-core"
1357version = "0.3.34"
1358source = "registry+https://github.com/rust-lang/crates.io-index"
1359checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
1360
1361[[package]]
1362name = "futures-executor"
1363version = "0.3.34"
1364source = "registry+https://github.com/rust-lang/crates.io-index"
1365checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432"
1366dependencies = [
1367 "futures-core",
1368 "futures-task",
1369 "futures-util",
1370]
1371
1372[[package]]
1373name = "futures-io"
1374version = "0.3.34"
1375source = "registry+https://github.com/rust-lang/crates.io-index"
1376checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"
1377
1378[[package]]
1379name = "futures-lite"
1380version = "2.6.1"
1381source = "registry+https://github.com/rust-lang/crates.io-index"
1382checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
1383dependencies = [
1384 "fastrand",
1385 "futures-core",
1386 "futures-io",
1387 "parking",
1388 "pin-project-lite",
1389]
1390
1391[[package]]
1392name = "futures-macro"
1393version = "0.3.34"
1394source = "registry+https://github.com/rust-lang/crates.io-index"
1395checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
1396dependencies = [
1397 "proc-macro2",
1398 "quote",
1399 "syn 3.0.3",
1400]
1401
1402[[package]]
1403name = "futures-sink"
1404version = "0.3.34"
1405source = "registry+https://github.com/rust-lang/crates.io-index"
1406checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
1407
1408[[package]]
1409name = "futures-task"
1410version = "0.3.34"
1411source = "registry+https://github.com/rust-lang/crates.io-index"
1412checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
1413
1414[[package]]
1415name = "futures-util"
1416version = "0.3.34"
1417source = "registry+https://github.com/rust-lang/crates.io-index"
1418checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
1419dependencies = [
1420 "futures-channel",
1421 "futures-core",
1422 "futures-io",
1423 "futures-macro",
1424 "futures-sink",
1425 "futures-task",
1426 "memchr",
1427 "pin-project-lite",
1428 "slab",
1429]
1430
1431[[package]]
1432name = "getrandom"
1433version = "0.2.16"
1434source = "registry+https://github.com/rust-lang/crates.io-index"
1435checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
1436dependencies = [
1437 "cfg-if",
1438 "js-sys",
1439 "libc",
1440 "wasi",
1441 "wasm-bindgen",
1442]
1443
1444[[package]]
1445name = "getrandom"
1446version = "0.3.4"
1447source = "registry+https://github.com/rust-lang/crates.io-index"
1448checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
1449dependencies = [
1450 "cfg-if",
1451 "js-sys",
1452 "libc",
1453 "r-efi",
1454 "wasip2",
1455 "wasm-bindgen",
1456]
1457
1458[[package]]
1459name = "getrandom"
1460version = "0.4.1"
1461source = "registry+https://github.com/rust-lang/crates.io-index"
1462checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec"
1463dependencies = [
1464 "cfg-if",
1465 "libc",
1466 "r-efi",
1467 "wasip2",
1468 "wasip3",
1469]
1470
1471[[package]]
1472name = "gif"
1473version = "0.14.2"
1474source = "registry+https://github.com/rust-lang/crates.io-index"
1475checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159"
1476dependencies = [
1477 "color_quant",
1478 "weezl",
1479]
1480
1481[[package]]
1482name = "gimli"
1483version = "0.32.3"
1484source = "registry+https://github.com/rust-lang/crates.io-index"
1485checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
1486
1487[[package]]
1488name = "gl_generator"
1489version = "0.14.0"
1490source = "registry+https://github.com/rust-lang/crates.io-index"
1491checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"
1492dependencies = [
1493 "khronos_api",
1494 "log",
1495 "xml-rs",
1496]
1497
1498[[package]]
1499name = "glob"
1500version = "0.3.3"
1501source = "registry+https://github.com/rust-lang/crates.io-index"
1502checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
1503
1504[[package]]
1505name = "glow"
1506version = "0.17.0"
1507source = "registry+https://github.com/rust-lang/crates.io-index"
1508checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5"
1509dependencies = [
1510 "js-sys",
1511 "slotmap",
1512 "wasm-bindgen",
1513 "web-sys",
1514]
1515
1516[[package]]
1517name = "glutin_wgl_sys"
1518version = "0.6.1"
1519source = "registry+https://github.com/rust-lang/crates.io-index"
1520checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e"
1521dependencies = [
1522 "gl_generator",
1523]
1524
1525[[package]]
1526name = "gpu-allocator"
1527version = "0.28.0"
1528source = "registry+https://github.com/rust-lang/crates.io-index"
1529checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795"
1530dependencies = [
1531 "ash",
1532 "hashbrown 0.16.1",
1533 "log",
1534 "presser",
1535 "thiserror 2.0.17",
1536 "windows 0.62.2",
1537]
1538
1539[[package]]
1540name = "gpu-descriptor"
1541version = "0.3.2"
1542source = "registry+https://github.com/rust-lang/crates.io-index"
1543checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
1544dependencies = [
1545 "bitflags 2.13.1",
1546 "gpu-descriptor-types",
1547 "hashbrown 0.15.5",
1548]
1549
1550[[package]]
1551name = "gpu-descriptor-types"
1552version = "0.2.0"
1553source = "registry+https://github.com/rust-lang/crates.io-index"
1554checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
1555dependencies = [
1556 "bitflags 2.13.1",
1557]
1558
1559[[package]]
1560name = "gpui-pre"
1561version = "0.3.8"
1562source = "registry+https://github.com/rust-lang/crates.io-index"
1563checksum = "d7f0bc3ebba070f8981b3f8e905a12f47d27794a30d029e59cdb9edf7a4b3360"
1564dependencies = [
1565 "accesskit",
1566 "anyhow",
1567 "async-channel",
1568 "async-task",
1569 "backtrace",
1570 "bindgen",
1571 "bitflags 2.13.1",
1572 "chrono",
1573 "core-video",
1574 "criterion",
1575 "ctor",
1576 "derive_more",
1577 "etagere",
1578 "futures",
1579 "futures-concurrency",
1580 "getrandom 0.3.4",
1581 "gpui-pre-bench-metrics",
1582 "gpui-pre-collections",
1583 "gpui-pre-http-client",
1584 "gpui-pre-macros",
1585 "gpui-pre-refineable",
1586 "gpui-pre-scheduler",
1587 "gpui-pre-shared-string",
1588 "gpui-pre-sum-tree",
1589 "gpui-pre-util",
1590 "gpui-pre-util-macros",
1591 "hdrhistogram",
1592 "heapless",
1593 "image",
1594 "inventory",
1595 "itertools 0.14.0",
1596 "libc",
1597 "log",
1598 "lyon",
1599 "num_cpus",
1600 "objc2-core-foundation",
1601 "objc2-core-video",
1602 "parking",
1603 "parking_lot",
1604 "pin-project",
1605 "pollster 0.4.0",
1606 "postage",
1607 "profiling",
1608 "proptest",
1609 "rand 0.9.4",
1610 "raw-window-handle",
1611 "regex",
1612 "resvg",
1613 "schemars",
1614 "seahash",
1615 "serde",
1616 "serde_json",
1617 "slotmap",
1618 "smallvec",
1619 "spin 0.10.0",
1620 "strum",
1621 "taffy",
1622 "thiserror 2.0.17",
1623 "ttf-parser",
1624 "url",
1625 "usvg",
1626 "uuid",
1627 "waker-fn",
1628 "web-time",
1629 "windows 0.62.2",
1630 "zed-scap",
1631]
1632
1633[[package]]
1634name = "gpui-pre-bench-metrics"
1635version = "0.3.8"
1636source = "registry+https://github.com/rust-lang/crates.io-index"
1637checksum = "627ecb377abdf6a0afeb9992e625e68c63458678968a02fb39d4cae700c60b6b"
1638dependencies = [
1639 "anyhow",
1640 "criterion",
1641 "libc",
1642 "perf-event2",
1643]
1644
1645[[package]]
1646name = "gpui-pre-collections"
1647version = "0.3.8"
1648source = "registry+https://github.com/rust-lang/crates.io-index"
1649checksum = "2c060863025dc3b8e90febad2d1f4ffd23a5d0dcedba39d3f6b7820ea2fdd3a0"
1650dependencies = [
1651 "gpui-pre-util",
1652 "indexmap",
1653 "rustc-hash 2.1.1",
1654]
1655
1656[[package]]
1657name = "gpui-pre-derive-refineable"
1658version = "0.3.8"
1659source = "registry+https://github.com/rust-lang/crates.io-index"
1660checksum = "bc834f30f5f49791e214f1fde01a009c7de91c9cd0a9f31dabfed130ba39e6cf"
1661dependencies = [
1662 "proc-macro2",
1663 "quote",
1664 "syn 2.0.117",
1665]
1666
1667[[package]]
1668name = "gpui-pre-http-client"
1669version = "0.3.8"
1670source = "registry+https://github.com/rust-lang/crates.io-index"
1671checksum = "5d2935cf82333da3f41774e5757837756408f01356197b41c817ad2666034453"
1672dependencies = [
1673 "anyhow",
1674 "async-compression",
1675 "bytes",
1676 "derive_more",
1677 "futures",
1678 "http",
1679 "http-body",
1680 "log",
1681 "parking_lot",
1682 "serde",
1683 "serde_json",
1684 "serde_urlencoded",
1685 "url",
1686]
1687
1688[[package]]
1689name = "gpui-pre-macros"
1690version = "0.3.8"
1691source = "registry+https://github.com/rust-lang/crates.io-index"
1692checksum = "d2ad26ca759364694cb55487bebff4c1b7dd6accab49990ff3cda6f7a818a9f4"
1693dependencies = [
1694 "heck",
1695 "proc-macro-crate",
1696 "proc-macro2",
1697 "quote",
1698 "syn 2.0.117",
1699]
1700
1701[[package]]
1702name = "gpui-pre-perf"
1703version = "0.3.8"
1704source = "registry+https://github.com/rust-lang/crates.io-index"
1705checksum = "2fcb288a506a476b6cbf97e6ec1cc0118db43f0ca91087588afa1c2d8cd4f842"
1706dependencies = [
1707 "gpui-pre-collections",
1708 "serde",
1709 "serde_json",
1710]
1711
1712[[package]]
1713name = "gpui-pre-refineable"
1714version = "0.3.8"
1715source = "registry+https://github.com/rust-lang/crates.io-index"
1716checksum = "4042345bb5bd3ecbc5d15b21ed128154f462a992058d7038cd397631f5462338"
1717dependencies = [
1718 "gpui-pre-derive-refineable",
1719]
1720
1721[[package]]
1722name = "gpui-pre-scheduler"
1723version = "0.3.8"
1724source = "registry+https://github.com/rust-lang/crates.io-index"
1725checksum = "f4acd73345bc3c09f1b98c1b21eb4459ad8336f89bb2edcef619e11c5a08456e"
1726dependencies = [
1727 "async-task",
1728 "backtrace",
1729 "chrono",
1730 "flume",
1731 "futures",
1732 "parking_lot",
1733 "rand 0.9.4",
1734 "web-time",
1735]
1736
1737[[package]]
1738name = "gpui-pre-shared-string"
1739version = "0.3.8"
1740source = "registry+https://github.com/rust-lang/crates.io-index"
1741checksum = "477529fd5aa90bff969785ee9a3938484d94aa5101cdf7b84719629c0345f98a"
1742dependencies = [
1743 "schemars",
1744 "serde",
1745 "smol_str",
1746]
1747
1748[[package]]
1749name = "gpui-pre-sum-tree"
1750version = "0.3.8"
1751source = "registry+https://github.com/rust-lang/crates.io-index"
1752checksum = "9ec0ec176d576b82aed716cf47185856b54ea9528caaf9d01787024689bfd824"
1753dependencies = [
1754 "gpui-pre-ztracing",
1755 "heapless",
1756 "log",
1757 "rayon",
1758 "tracing",
1759]
1760
1761[[package]]
1762name = "gpui-pre-util"
1763version = "0.3.8"
1764source = "registry+https://github.com/rust-lang/crates.io-index"
1765checksum = "e1635ae7d0b05400bfa211ddef6c67dc8d9f223c463022c2b3bf2c1c14c6044f"
1766dependencies = [
1767 "anyhow",
1768 "log",
1769 "which",
1770]
1771
1772[[package]]
1773name = "gpui-pre-util-macros"
1774version = "0.3.8"
1775source = "registry+https://github.com/rust-lang/crates.io-index"
1776checksum = "01486fce7722e5d7d7e7bb71c719dfdcc6ed917112bdc7c56d0556fdb60d10ab"
1777dependencies = [
1778 "gpui-pre-perf",
1779 "quote",
1780 "syn 2.0.117",
1781]
1782
1783[[package]]
1784name = "gpui-pre-wgpu"
1785version = "0.3.8"
1786dependencies = [
1787 "anyhow",
1788 "bytemuck",
1789 "cosmic-text",
1790 "etagere",
1791 "gpui-pre",
1792 "gpui-pre-collections",
1793 "gpui-pre-util",
1794 "image",
1795 "itertools 0.14.0",
1796 "log",
1797 "parking_lot",
1798 "profiling",
1799 "raw-window-handle",
1800 "smallvec",
1801 "swash",
1802 "unicode-bidi",
1803 "unicode-segmentation",
1804 "web-sys",
1805 "wgpu",
1806 "zed-font-kit",
1807]
1808
1809[[package]]
1810name = "gpui-pre-zlog"
1811version = "0.3.8"
1812source = "registry+https://github.com/rust-lang/crates.io-index"
1813checksum = "3bbe5b98630ef4bfed5a7105ec1062e78d571912bc491388f07ea22f2457c18b"
1814dependencies = [
1815 "anyhow",
1816 "chrono",
1817 "gpui-pre-collections",
1818 "log",
1819]
1820
1821[[package]]
1822name = "gpui-pre-ztracing"
1823version = "0.3.8"
1824source = "registry+https://github.com/rust-lang/crates.io-index"
1825checksum = "f806400f6bda1fdd9fc627e158c0e44fb0c4b7767582a3621efcf92f4a850db7"
1826dependencies = [
1827 "gpui-pre-zlog",
1828 "gpui-pre-ztracing-macro",
1829 "tracing",
1830 "tracing-subscriber",
1831]
1832
1833[[package]]
1834name = "gpui-pre-ztracing-macro"
1835version = "0.3.8"
1836source = "registry+https://github.com/rust-lang/crates.io-index"
1837checksum = "d337c9acf058238e45ce0570d8a5958439242889492f91ae2d8e324211a61ccd"
1838
1839[[package]]
1840name = "half"
1841version = "2.7.1"
1842source = "registry+https://github.com/rust-lang/crates.io-index"
1843checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
1844dependencies = [
1845 "cfg-if",
1846 "crunchy",
1847 "num-traits",
1848 "zerocopy",
1849]
1850
1851[[package]]
1852name = "harfrust"
1853version = "0.5.0"
1854source = "registry+https://github.com/rust-lang/crates.io-index"
1855checksum = "4f9f40651a03bc0f7316bd75267ff5767e93017ef3cfffe76c6aa7252cc5a31c"
1856dependencies = [
1857 "bitflags 2.13.1",
1858 "bytemuck",
1859 "core_maths",
1860 "read-fonts 0.37.0",
1861 "smallvec",
1862]
1863
1864[[package]]
1865name = "hash32"
1866version = "0.3.1"
1867source = "registry+https://github.com/rust-lang/crates.io-index"
1868checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
1869dependencies = [
1870 "byteorder",
1871]
1872
1873[[package]]
1874name = "hashbrown"
1875version = "0.15.5"
1876source = "registry+https://github.com/rust-lang/crates.io-index"
1877checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
1878dependencies = [
1879 "foldhash 0.1.5",
1880]
1881
1882[[package]]
1883name = "hashbrown"
1884version = "0.16.1"
1885source = "registry+https://github.com/rust-lang/crates.io-index"
1886checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
1887dependencies = [
1888 "allocator-api2",
1889 "equivalent",
1890 "foldhash 0.2.0",
1891]
1892
1893[[package]]
1894name = "hashbrown"
1895version = "0.17.1"
1896source = "registry+https://github.com/rust-lang/crates.io-index"
1897checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
1898
1899[[package]]
1900name = "hdrhistogram"
1901version = "7.5.4"
1902source = "registry+https://github.com/rust-lang/crates.io-index"
1903checksum = "765c9198f173dd59ce26ff9f95ef0aafd0a0fe01fb9d72841bc5066a4c06511d"
1904dependencies = [
1905 "byteorder",
1906 "num-traits",
1907]
1908
1909[[package]]
1910name = "heapless"
1911version = "0.9.2"
1912source = "registry+https://github.com/rust-lang/crates.io-index"
1913checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed"
1914dependencies = [
1915 "hash32",
1916 "stable_deref_trait",
1917]
1918
1919[[package]]
1920name = "heck"
1921version = "0.5.0"
1922source = "registry+https://github.com/rust-lang/crates.io-index"
1923checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
1924
1925[[package]]
1926name = "hermit-abi"
1927version = "0.5.2"
1928source = "registry+https://github.com/rust-lang/crates.io-index"
1929checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
1930
1931[[package]]
1932name = "hexf-parse"
1933version = "0.2.1"
1934source = "registry+https://github.com/rust-lang/crates.io-index"
1935checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
1936
1937[[package]]
1938name = "http"
1939version = "1.3.1"
1940source = "registry+https://github.com/rust-lang/crates.io-index"
1941checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
1942dependencies = [
1943 "bytes",
1944 "fnv",
1945 "itoa",
1946]
1947
1948[[package]]
1949name = "http-body"
1950version = "1.0.1"
1951source = "registry+https://github.com/rust-lang/crates.io-index"
1952checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
1953dependencies = [
1954 "bytes",
1955 "http",
1956]
1957
1958[[package]]
1959name = "iana-time-zone"
1960version = "0.1.64"
1961source = "registry+https://github.com/rust-lang/crates.io-index"
1962checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb"
1963dependencies = [
1964 "android_system_properties",
1965 "core-foundation-sys",
1966 "iana-time-zone-haiku",
1967 "js-sys",
1968 "log",
1969 "wasm-bindgen",
1970 "windows-core 0.62.2",
1971]
1972
1973[[package]]
1974name = "iana-time-zone-haiku"
1975version = "0.1.2"
1976source = "registry+https://github.com/rust-lang/crates.io-index"
1977checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
1978dependencies = [
1979 "cc",
1980]
1981
1982[[package]]
1983name = "icu_collections"
1984version = "2.3.0"
1985source = "registry+https://github.com/rust-lang/crates.io-index"
1986checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513"
1987dependencies = [
1988 "displaydoc",
1989 "potential_utf",
1990 "utf8_iter",
1991 "yoke",
1992 "zerofrom",
1993 "zerovec",
1994]
1995
1996[[package]]
1997name = "icu_locale_core"
1998version = "2.3.0"
1999source = "registry+https://github.com/rust-lang/crates.io-index"
2000checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb"
2001dependencies = [
2002 "displaydoc",
2003 "litemap",
2004 "tinystr",
2005 "writeable",
2006 "zerovec",
2007]
2008
2009[[package]]
2010name = "icu_normalizer"
2011version = "2.3.0"
2012source = "registry+https://github.com/rust-lang/crates.io-index"
2013checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f"
2014dependencies = [
2015 "icu_collections",
2016 "icu_normalizer_data",
2017 "icu_properties",
2018 "icu_provider",
2019 "smallvec",
2020 "zerovec",
2021]
2022
2023[[package]]
2024name = "icu_normalizer_data"
2025version = "2.3.0"
2026source = "registry+https://github.com/rust-lang/crates.io-index"
2027checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0"
2028
2029[[package]]
2030name = "icu_properties"
2031version = "2.3.0"
2032source = "registry+https://github.com/rust-lang/crates.io-index"
2033checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148"
2034dependencies = [
2035 "displaydoc",
2036 "icu_collections",
2037 "icu_locale_core",
2038 "icu_properties_data",
2039 "icu_provider",
2040 "zerotrie",
2041 "zerovec",
2042]
2043
2044[[package]]
2045name = "icu_properties_data"
2046version = "2.3.0"
2047source = "registry+https://github.com/rust-lang/crates.io-index"
2048checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa"
2049
2050[[package]]
2051name = "icu_provider"
2052version = "2.3.0"
2053source = "registry+https://github.com/rust-lang/crates.io-index"
2054checksum = "92a7ed671a6aad807a8651a2e1782a6598fda9ce5185dd8158549e95a91c6428"
2055dependencies = [
2056 "displaydoc",
2057 "icu_locale_core",
2058 "writeable",
2059 "yoke",
2060 "zerofrom",
2061 "zerotrie",
2062 "zerovec",
2063]
2064
2065[[package]]
2066name = "id-arena"
2067version = "2.3.0"
2068source = "registry+https://github.com/rust-lang/crates.io-index"
2069checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
2070
2071[[package]]
2072name = "idna"
2073version = "1.1.0"
2074source = "registry+https://github.com/rust-lang/crates.io-index"
2075checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"
2076dependencies = [
2077 "idna_adapter",
2078 "smallvec",
2079 "utf8_iter",
2080]
2081
2082[[package]]
2083name = "idna_adapter"
2084version = "1.2.1"
2085source = "registry+https://github.com/rust-lang/crates.io-index"
2086checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"
2087dependencies = [
2088 "icu_normalizer",
2089 "icu_properties",
2090]
2091
2092[[package]]
2093name = "image"
2094version = "0.25.10"
2095source = "registry+https://github.com/rust-lang/crates.io-index"
2096checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
2097dependencies = [
2098 "bytemuck",
2099 "byteorder-lite",
2100 "color_quant",
2101 "exr",
2102 "gif",
2103 "image-webp",
2104 "moxcms",
2105 "num-traits",
2106 "png 0.18.0",
2107 "qoi",
2108 "ravif",
2109 "rayon",
2110 "tiff",
2111 "zune-core",
2112 "zune-jpeg",
2113]
2114
2115[[package]]
2116name = "image-webp"
2117version = "0.2.4"
2118source = "registry+https://github.com/rust-lang/crates.io-index"
2119checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
2120dependencies = [
2121 "byteorder-lite",
2122 "quick-error 2.0.1",
2123]
2124
2125[[package]]
2126name = "imagesize"
2127version = "0.14.0"
2128source = "registry+https://github.com/rust-lang/crates.io-index"
2129checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c"
2130
2131[[package]]
2132name = "imgref"
2133version = "1.12.0"
2134source = "registry+https://github.com/rust-lang/crates.io-index"
2135checksum = "e7c5cedc30da3a610cac6b4ba17597bdf7152cf974e8aab3afb3d54455e371c8"
2136
2137[[package]]
2138name = "indexmap"
2139version = "2.14.0"
2140source = "registry+https://github.com/rust-lang/crates.io-index"
2141checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
2142dependencies = [
2143 "equivalent",
2144 "hashbrown 0.17.1",
2145 "serde",
2146 "serde_core",
2147]
2148
2149[[package]]
2150name = "interpolate_name"
2151version = "0.2.4"
2152source = "registry+https://github.com/rust-lang/crates.io-index"
2153checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
2154dependencies = [
2155 "proc-macro2",
2156 "quote",
2157 "syn 2.0.117",
2158]
2159
2160[[package]]
2161name = "inventory"
2162version = "0.3.21"
2163source = "registry+https://github.com/rust-lang/crates.io-index"
2164checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e"
2165dependencies = [
2166 "rustversion",
2167]
2168
2169[[package]]
2170name = "io-surface"
2171version = "0.16.1"
2172source = "registry+https://github.com/rust-lang/crates.io-index"
2173checksum = "554b8c5d64ec09a3a520fe58e4d48a73e00ff32899cdcbe32a4877afd4968b8e"
2174dependencies = [
2175 "cgl",
2176 "core-foundation 0.10.0",
2177 "core-foundation-sys",
2178 "leaky-cow",
2179]
2180
2181[[package]]
2182name = "itertools"
2183version = "0.13.0"
2184source = "registry+https://github.com/rust-lang/crates.io-index"
2185checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
2186dependencies = [
2187 "either",
2188]
2189
2190[[package]]
2191name = "itertools"
2192version = "0.14.0"
2193source = "registry+https://github.com/rust-lang/crates.io-index"
2194checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
2195dependencies = [
2196 "either",
2197]
2198
2199[[package]]
2200name = "itoa"
2201version = "1.0.18"
2202source = "registry+https://github.com/rust-lang/crates.io-index"
2203checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
2204
2205[[package]]
2206name = "jni-sys"
2207version = "0.3.0"
2208source = "registry+https://github.com/rust-lang/crates.io-index"
2209checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
2210
2211[[package]]
2212name = "jobserver"
2213version = "0.1.34"
2214source = "registry+https://github.com/rust-lang/crates.io-index"
2215checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
2216dependencies = [
2217 "getrandom 0.3.4",
2218 "libc",
2219]
2220
2221[[package]]
2222name = "js-sys"
2223version = "0.3.97"
2224source = "registry+https://github.com/rust-lang/crates.io-index"
2225checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf"
2226dependencies = [
2227 "cfg-if",
2228 "futures-util",
2229 "once_cell",
2230 "wasm-bindgen",
2231]
2232
2233[[package]]
2234name = "khronos-egl"
2235version = "6.0.0"
2236source = "registry+https://github.com/rust-lang/crates.io-index"
2237checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
2238dependencies = [
2239 "libc",
2240 "libloading",
2241 "pkg-config",
2242]
2243
2244[[package]]
2245name = "khronos_api"
2246version = "3.1.0"
2247source = "registry+https://github.com/rust-lang/crates.io-index"
2248checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
2249
2250[[package]]
2251name = "kurbo"
2252version = "0.13.1"
2253source = "registry+https://github.com/rust-lang/crates.io-index"
2254checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2"
2255dependencies = [
2256 "arrayvec",
2257 "euclid",
2258 "polycool",
2259 "smallvec",
2260]
2261
2262[[package]]
2263name = "lazy_static"
2264version = "1.5.0"
2265source = "registry+https://github.com/rust-lang/crates.io-index"
2266checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
2267
2268[[package]]
2269name = "leak"
2270version = "0.1.2"
2271source = "registry+https://github.com/rust-lang/crates.io-index"
2272checksum = "bd100e01f1154f2908dfa7d02219aeab25d0b9c7fa955164192e3245255a0c73"
2273
2274[[package]]
2275name = "leaky-cow"
2276version = "0.1.1"
2277source = "registry+https://github.com/rust-lang/crates.io-index"
2278checksum = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc"
2279dependencies = [
2280 "leak",
2281]
2282
2283[[package]]
2284name = "leb128fmt"
2285version = "0.1.0"
2286source = "registry+https://github.com/rust-lang/crates.io-index"
2287checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
2288
2289[[package]]
2290name = "lebe"
2291version = "0.5.3"
2292source = "registry+https://github.com/rust-lang/crates.io-index"
2293checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
2294
2295[[package]]
2296name = "libbz2-rs-sys"
2297version = "0.2.2"
2298source = "registry+https://github.com/rust-lang/crates.io-index"
2299checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7"
2300
2301[[package]]
2302name = "libc"
2303version = "0.2.186"
2304source = "registry+https://github.com/rust-lang/crates.io-index"
2305checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
2306
2307[[package]]
2308name = "libfuzzer-sys"
2309version = "0.4.10"
2310source = "registry+https://github.com/rust-lang/crates.io-index"
2311checksum = "5037190e1f70cbeef565bd267599242926f724d3b8a9f510fd7e0b540cfa4404"
2312dependencies = [
2313 "arbitrary",
2314 "cc",
2315]
2316
2317[[package]]
2318name = "libloading"
2319version = "0.8.9"
2320source = "registry+https://github.com/rust-lang/crates.io-index"
2321checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
2322dependencies = [
2323 "cfg-if",
2324 "windows-link 0.2.1",
2325]
2326
2327[[package]]
2328name = "libm"
2329version = "0.2.16"
2330source = "registry+https://github.com/rust-lang/crates.io-index"
2331checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
2332
2333[[package]]
2334name = "libredox"
2335version = "0.1.10"
2336source = "registry+https://github.com/rust-lang/crates.io-index"
2337checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
2338dependencies = [
2339 "bitflags 2.13.1",
2340 "libc",
2341]
2342
2343[[package]]
2344name = "linebender_resource_handle"
2345version = "0.1.1"
2346source = "registry+https://github.com/rust-lang/crates.io-index"
2347checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
2348
2349[[package]]
2350name = "link-section"
2351version = "0.19.2"
2352source = "registry+https://github.com/rust-lang/crates.io-index"
2353checksum = "5ee1a0d6e252afe82e7bc2db42fba60e02ddf3b1accaf8cb21d96e34ba61f3d4"
2354
2355[[package]]
2356name = "linktime-proc-macro"
2357version = "0.2.2"
2358source = "registry+https://github.com/rust-lang/crates.io-index"
2359checksum = "348d0075b1fc163b26d72a7f75fc5141daf2fd1bdf128d873cbaf6785d495bdf"
2360
2361[[package]]
2362name = "linux-raw-sys"
2363version = "0.12.1"
2364source = "registry+https://github.com/rust-lang/crates.io-index"
2365checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
2366
2367[[package]]
2368name = "litemap"
2369version = "0.8.0"
2370source = "registry+https://github.com/rust-lang/crates.io-index"
2371checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
2372
2373[[package]]
2374name = "litrs"
2375version = "1.0.0"
2376source = "registry+https://github.com/rust-lang/crates.io-index"
2377checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
2378
2379[[package]]
2380name = "lock_api"
2381version = "0.4.14"
2382source = "registry+https://github.com/rust-lang/crates.io-index"
2383checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
2384dependencies = [
2385 "scopeguard",
2386]
2387
2388[[package]]
2389name = "log"
2390version = "0.4.29"
2391source = "registry+https://github.com/rust-lang/crates.io-index"
2392checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
2393dependencies = [
2394 "serde_core",
2395 "value-bag",
2396]
2397
2398[[package]]
2399name = "loop9"
2400version = "0.1.5"
2401source = "registry+https://github.com/rust-lang/crates.io-index"
2402checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"
2403dependencies = [
2404 "imgref",
2405]
2406
2407[[package]]
2408name = "lyon"
2409version = "1.0.16"
2410source = "registry+https://github.com/rust-lang/crates.io-index"
2411checksum = "dbcb7d54d54c8937364c9d41902d066656817dce1e03a44e5533afebd1ef4352"
2412dependencies = [
2413 "lyon_algorithms",
2414 "lyon_tessellation",
2415]
2416
2417[[package]]
2418name = "lyon_algorithms"
2419version = "1.0.16"
2420source = "registry+https://github.com/rust-lang/crates.io-index"
2421checksum = "f4c0829e28c4f336396f250d850c3987e16ce6db057ffe047ce0dd54aab6b647"
2422dependencies = [
2423 "lyon_path",
2424 "num-traits",
2425]
2426
2427[[package]]
2428name = "lyon_geom"
2429version = "1.0.17"
2430source = "registry+https://github.com/rust-lang/crates.io-index"
2431checksum = "4e16770d760c7848b0c1c2d209101e408207a65168109509f8483837a36cf2e7"
2432dependencies = [
2433 "arrayvec",
2434 "euclid",
2435 "num-traits",
2436]
2437
2438[[package]]
2439name = "lyon_path"
2440version = "1.0.16"
2441source = "registry+https://github.com/rust-lang/crates.io-index"
2442checksum = "1aeca86bcfd632a15984ba029b539ffb811e0a70bf55e814ef8b0f54f506fdeb"
2443dependencies = [
2444 "lyon_geom",
2445 "num-traits",
2446]
2447
2448[[package]]
2449name = "lyon_tessellation"
2450version = "1.0.16"
2451source = "registry+https://github.com/rust-lang/crates.io-index"
2452checksum = "f3f586142e1280335b1bc89539f7c97dd80f08fc43e9ab1b74ef0a42b04aa353"
2453dependencies = [
2454 "float_next_after",
2455 "lyon_path",
2456 "num-traits",
2457]
2458
2459[[package]]
2460name = "malloc_buf"
2461version = "0.0.6"
2462source = "registry+https://github.com/rust-lang/crates.io-index"
2463checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
2464dependencies = [
2465 "libc",
2466]
2467
2468[[package]]
2469name = "maybe-rayon"
2470version = "0.1.1"
2471source = "registry+https://github.com/rust-lang/crates.io-index"
2472checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"
2473dependencies = [
2474 "cfg-if",
2475 "rayon",
2476]
2477
2478[[package]]
2479name = "memchr"
2480version = "2.8.3"
2481source = "registry+https://github.com/rust-lang/crates.io-index"
2482checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
2483
2484[[package]]
2485name = "memmap2"
2486version = "0.9.8"
2487source = "registry+https://github.com/rust-lang/crates.io-index"
2488checksum = "843a98750cd611cc2965a8213b53b43e715f13c37a9e096c6408e69990961db7"
2489dependencies = [
2490 "libc",
2491]
2492
2493[[package]]
2494name = "memoffset"
2495version = "0.9.1"
2496source = "registry+https://github.com/rust-lang/crates.io-index"
2497checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
2498dependencies = [
2499 "autocfg",
2500]
2501
2502[[package]]
2503name = "metal"
2504version = "0.33.0"
2505source = "registry+https://github.com/rust-lang/crates.io-index"
2506checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15"
2507dependencies = [
2508 "bitflags 2.13.1",
2509 "block",
2510 "core-graphics-types 0.2.0",
2511 "foreign-types",
2512 "log",
2513 "objc",
2514 "paste",
2515]
2516
2517[[package]]
2518name = "minimal-lexical"
2519version = "0.2.1"
2520source = "registry+https://github.com/rust-lang/crates.io-index"
2521checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
2522
2523[[package]]
2524name = "miniz_oxide"
2525version = "0.8.9"
2526source = "registry+https://github.com/rust-lang/crates.io-index"
2527checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
2528dependencies = [
2529 "adler2",
2530 "simd-adler32",
2531]
2532
2533[[package]]
2534name = "moxcms"
2535version = "0.8.1"
2536source = "registry+https://github.com/rust-lang/crates.io-index"
2537checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"
2538dependencies = [
2539 "num-traits",
2540 "pxfm",
2541]
2542
2543[[package]]
2544name = "naga"
2545version = "29.0.4"
2546source = "registry+https://github.com/rust-lang/crates.io-index"
2547checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df"
2548dependencies = [
2549 "arrayvec",
2550 "bit-set 0.9.1",
2551 "bitflags 2.13.1",
2552 "cfg-if",
2553 "cfg_aliases",
2554 "codespan-reporting",
2555 "half",
2556 "hashbrown 0.16.1",
2557 "hexf-parse",
2558 "indexmap",
2559 "libm",
2560 "log",
2561 "num-traits",
2562 "once_cell",
2563 "rustc-hash 1.1.0",
2564 "spirv",
2565 "thiserror 2.0.17",
2566 "unicode-ident",
2567]
2568
2569[[package]]
2570name = "ndk-sys"
2571version = "0.6.0+11769913"
2572source = "registry+https://github.com/rust-lang/crates.io-index"
2573checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"
2574dependencies = [
2575 "jni-sys",
2576]
2577
2578[[package]]
2579name = "new_debug_unreachable"
2580version = "1.0.6"
2581source = "registry+https://github.com/rust-lang/crates.io-index"
2582checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
2583
2584[[package]]
2585name = "nom"
2586version = "7.1.3"
2587source = "registry+https://github.com/rust-lang/crates.io-index"
2588checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
2589dependencies = [
2590 "memchr",
2591 "minimal-lexical",
2592]
2593
2594[[package]]
2595name = "noop_proc_macro"
2596version = "0.3.0"
2597source = "registry+https://github.com/rust-lang/crates.io-index"
2598checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
2599
2600[[package]]
2601name = "ntapi"
2602version = "0.4.1"
2603source = "registry+https://github.com/rust-lang/crates.io-index"
2604checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
2605dependencies = [
2606 "winapi",
2607]
2608
2609[[package]]
2610name = "nu-ansi-term"
2611version = "0.50.3"
2612source = "registry+https://github.com/rust-lang/crates.io-index"
2613checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
2614dependencies = [
2615 "windows-sys 0.61.2",
2616]
2617
2618[[package]]
2619name = "num-bigint"
2620version = "0.4.8"
2621source = "registry+https://github.com/rust-lang/crates.io-index"
2622checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367"
2623dependencies = [
2624 "num-integer",
2625 "num-traits",
2626]
2627
2628[[package]]
2629name = "num-derive"
2630version = "0.4.2"
2631source = "registry+https://github.com/rust-lang/crates.io-index"
2632checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
2633dependencies = [
2634 "proc-macro2",
2635 "quote",
2636 "syn 2.0.117",
2637]
2638
2639[[package]]
2640name = "num-integer"
2641version = "0.1.46"
2642source = "registry+https://github.com/rust-lang/crates.io-index"
2643checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
2644dependencies = [
2645 "num-traits",
2646]
2647
2648[[package]]
2649name = "num-rational"
2650version = "0.4.2"
2651source = "registry+https://github.com/rust-lang/crates.io-index"
2652checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
2653dependencies = [
2654 "num-bigint",
2655 "num-integer",
2656 "num-traits",
2657]
2658
2659[[package]]
2660name = "num-traits"
2661version = "0.2.19"
2662source = "registry+https://github.com/rust-lang/crates.io-index"
2663checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
2664dependencies = [
2665 "autocfg",
2666 "libm",
2667]
2668
2669[[package]]
2670name = "num_cpus"
2671version = "1.17.0"
2672source = "registry+https://github.com/rust-lang/crates.io-index"
2673checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"
2674dependencies = [
2675 "hermit-abi",
2676 "libc",
2677]
2678
2679[[package]]
2680name = "objc"
2681version = "0.2.7"
2682source = "registry+https://github.com/rust-lang/crates.io-index"
2683checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
2684dependencies = [
2685 "malloc_buf",
2686 "objc_exception",
2687]
2688
2689[[package]]
2690name = "objc-foundation"
2691version = "0.1.1"
2692source = "registry+https://github.com/rust-lang/crates.io-index"
2693checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
2694dependencies = [
2695 "block",
2696 "objc",
2697 "objc_id",
2698]
2699
2700[[package]]
2701name = "objc2"
2702version = "0.6.3"
2703source = "registry+https://github.com/rust-lang/crates.io-index"
2704checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05"
2705dependencies = [
2706 "objc2-encode",
2707]
2708
2709[[package]]
2710name = "objc2-core-foundation"
2711version = "0.3.2"
2712source = "registry+https://github.com/rust-lang/crates.io-index"
2713checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
2714dependencies = [
2715 "bitflags 2.13.1",
2716 "dispatch2",
2717 "objc2",
2718]
2719
2720[[package]]
2721name = "objc2-core-video"
2722version = "0.3.2"
2723source = "registry+https://github.com/rust-lang/crates.io-index"
2724checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6"
2725dependencies = [
2726 "objc2-core-foundation",
2727]
2728
2729[[package]]
2730name = "objc2-encode"
2731version = "4.1.0"
2732source = "registry+https://github.com/rust-lang/crates.io-index"
2733checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
2734
2735[[package]]
2736name = "objc2-foundation"
2737version = "0.3.2"
2738source = "registry+https://github.com/rust-lang/crates.io-index"
2739checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"
2740dependencies = [
2741 "bitflags 2.13.1",
2742 "objc2",
2743 "objc2-core-foundation",
2744]
2745
2746[[package]]
2747name = "objc2-metal"
2748version = "0.3.2"
2749source = "registry+https://github.com/rust-lang/crates.io-index"
2750checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794"
2751dependencies = [
2752 "bitflags 2.13.1",
2753 "block2",
2754 "objc2",
2755 "objc2-foundation",
2756]
2757
2758[[package]]
2759name = "objc2-quartz-core"
2760version = "0.3.2"
2761source = "registry+https://github.com/rust-lang/crates.io-index"
2762checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"
2763dependencies = [
2764 "bitflags 2.13.1",
2765 "objc2",
2766 "objc2-core-foundation",
2767 "objc2-foundation",
2768 "objc2-metal",
2769]
2770
2771[[package]]
2772name = "objc_exception"
2773version = "0.1.2"
2774source = "registry+https://github.com/rust-lang/crates.io-index"
2775checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
2776dependencies = [
2777 "cc",
2778]
2779
2780[[package]]
2781name = "objc_id"
2782version = "0.1.1"
2783source = "registry+https://github.com/rust-lang/crates.io-index"
2784checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
2785dependencies = [
2786 "objc",
2787]
2788
2789[[package]]
2790name = "object"
2791version = "0.37.3"
2792source = "registry+https://github.com/rust-lang/crates.io-index"
2793checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
2794dependencies = [
2795 "memchr",
2796]
2797
2798[[package]]
2799name = "once_cell"
2800version = "1.21.4"
2801source = "registry+https://github.com/rust-lang/crates.io-index"
2802checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
2803
2804[[package]]
2805name = "oorandom"
2806version = "11.1.5"
2807source = "registry+https://github.com/rust-lang/crates.io-index"
2808checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
2809
2810[[package]]
2811name = "option-ext"
2812version = "0.2.0"
2813source = "registry+https://github.com/rust-lang/crates.io-index"
2814checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
2815
2816[[package]]
2817name = "ordered-float"
2818version = "5.5.0"
2819source = "registry+https://github.com/rust-lang/crates.io-index"
2820checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0"
2821dependencies = [
2822 "num-traits",
2823]
2824
2825[[package]]
2826name = "page_size"
2827version = "0.6.0"
2828source = "registry+https://github.com/rust-lang/crates.io-index"
2829checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da"
2830dependencies = [
2831 "libc",
2832 "winapi",
2833]
2834
2835[[package]]
2836name = "parking"
2837version = "2.2.1"
2838source = "registry+https://github.com/rust-lang/crates.io-index"
2839checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
2840
2841[[package]]
2842name = "parking_lot"
2843version = "0.12.5"
2844source = "registry+https://github.com/rust-lang/crates.io-index"
2845checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
2846dependencies = [
2847 "lock_api",
2848 "parking_lot_core",
2849]
2850
2851[[package]]
2852name = "parking_lot_core"
2853version = "0.9.12"
2854source = "registry+https://github.com/rust-lang/crates.io-index"
2855checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
2856dependencies = [
2857 "cfg-if",
2858 "libc",
2859 "redox_syscall",
2860 "smallvec",
2861 "windows-link 0.2.1",
2862]
2863
2864[[package]]
2865name = "paste"
2866version = "1.0.15"
2867source = "registry+https://github.com/rust-lang/crates.io-index"
2868checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
2869
2870[[package]]
2871name = "pastey"
2872version = "0.1.1"
2873source = "registry+https://github.com/rust-lang/crates.io-index"
2874checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
2875
2876[[package]]
2877name = "pathfinder_geometry"
2878version = "0.5.1"
2879source = "registry+https://github.com/rust-lang/crates.io-index"
2880checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3"
2881dependencies = [
2882 "log",
2883 "pathfinder_simd",
2884]
2885
2886[[package]]
2887name = "pathfinder_simd"
2888version = "0.5.6"
2889source = "registry+https://github.com/rust-lang/crates.io-index"
2890checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777"
2891dependencies = [
2892 "rustc_version",
2893]
2894
2895[[package]]
2896name = "percent-encoding"
2897version = "2.3.2"
2898source = "registry+https://github.com/rust-lang/crates.io-index"
2899checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
2900
2901[[package]]
2902name = "perf-event-data"
2903version = "0.1.8"
2904source = "registry+https://github.com/rust-lang/crates.io-index"
2905checksum = "575828d9d7d205188048eb1508560607a03d21eafdbba47b8cade1736c1c28e1"
2906dependencies = [
2907 "bitflags 2.13.1",
2908 "c-enum",
2909 "perf-event-open-sys2",
2910]
2911
2912[[package]]
2913name = "perf-event-open-sys2"
2914version = "5.0.6"
2915source = "registry+https://github.com/rust-lang/crates.io-index"
2916checksum = "d9c25955321465255e437600b54296983fab1feac2cd0c38958adeb26dbae49e"
2917dependencies = [
2918 "libc",
2919 "memoffset",
2920]
2921
2922[[package]]
2923name = "perf-event2"
2924version = "0.7.4"
2925source = "registry+https://github.com/rust-lang/crates.io-index"
2926checksum = "0939b8fad77dfaeb29ebbd35faaeaadbf833167f30975f1b8993bbba09ea0a0f"
2927dependencies = [
2928 "bitflags 2.13.1",
2929 "c-enum",
2930 "libc",
2931 "memmap2",
2932 "perf-event-data",
2933 "perf-event-open-sys2",
2934]
2935
2936[[package]]
2937name = "pico-args"
2938version = "0.5.0"
2939source = "registry+https://github.com/rust-lang/crates.io-index"
2940checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
2941
2942[[package]]
2943name = "pin-project"
2944version = "1.1.10"
2945source = "registry+https://github.com/rust-lang/crates.io-index"
2946checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
2947dependencies = [
2948 "pin-project-internal",
2949]
2950
2951[[package]]
2952name = "pin-project-internal"
2953version = "1.1.10"
2954source = "registry+https://github.com/rust-lang/crates.io-index"
2955checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
2956dependencies = [
2957 "proc-macro2",
2958 "quote",
2959 "syn 2.0.117",
2960]
2961
2962[[package]]
2963name = "pin-project-lite"
2964version = "0.2.16"
2965source = "registry+https://github.com/rust-lang/crates.io-index"
2966checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
2967
2968[[package]]
2969name = "pkg-config"
2970version = "0.3.32"
2971source = "registry+https://github.com/rust-lang/crates.io-index"
2972checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
2973
2974[[package]]
2975name = "plotters"
2976version = "0.3.7"
2977source = "registry+https://github.com/rust-lang/crates.io-index"
2978checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747"
2979dependencies = [
2980 "num-traits",
2981 "plotters-backend",
2982 "plotters-svg",
2983 "wasm-bindgen",
2984 "web-sys",
2985]
2986
2987[[package]]
2988name = "plotters-backend"
2989version = "0.3.7"
2990source = "registry+https://github.com/rust-lang/crates.io-index"
2991checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a"
2992
2993[[package]]
2994name = "plotters-svg"
2995version = "0.3.7"
2996source = "registry+https://github.com/rust-lang/crates.io-index"
2997checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
2998dependencies = [
2999 "plotters-backend",
3000]
3001
3002[[package]]
3003name = "png"
3004version = "0.17.16"
3005source = "registry+https://github.com/rust-lang/crates.io-index"
3006checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"
3007dependencies = [
3008 "bitflags 1.3.2",
3009 "crc32fast",
3010 "fdeflate",
3011 "flate2",
3012 "miniz_oxide",
3013]
3014
3015[[package]]
3016name = "png"
3017version = "0.18.0"
3018source = "registry+https://github.com/rust-lang/crates.io-index"
3019checksum = "97baced388464909d42d89643fe4361939af9b7ce7a31ee32a168f832a70f2a0"
3020dependencies = [
3021 "bitflags 2.13.1",
3022 "crc32fast",
3023 "fdeflate",
3024 "flate2",
3025 "miniz_oxide",
3026]
3027
3028[[package]]
3029name = "pollster"
3030version = "0.2.5"
3031source = "registry+https://github.com/rust-lang/crates.io-index"
3032checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7"
3033
3034[[package]]
3035name = "pollster"
3036version = "0.4.0"
3037source = "registry+https://github.com/rust-lang/crates.io-index"
3038checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3"
3039
3040[[package]]
3041name = "polycool"
3042version = "0.4.0"
3043source = "registry+https://github.com/rust-lang/crates.io-index"
3044checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6"
3045dependencies = [
3046 "arrayvec",
3047]
3048
3049[[package]]
3050name = "portable-atomic"
3051version = "1.11.1"
3052source = "registry+https://github.com/rust-lang/crates.io-index"
3053checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
3054
3055[[package]]
3056name = "portable-atomic-util"
3057version = "0.2.4"
3058source = "registry+https://github.com/rust-lang/crates.io-index"
3059checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
3060dependencies = [
3061 "portable-atomic",
3062]
3063
3064[[package]]
3065name = "postage"
3066version = "0.5.0"
3067source = "registry+https://github.com/rust-lang/crates.io-index"
3068checksum = "af3fb618632874fb76937c2361a7f22afd393c982a2165595407edc75b06d3c1"
3069dependencies = [
3070 "atomic",
3071 "crossbeam-queue",
3072 "futures",
3073 "log",
3074 "parking_lot",
3075 "pin-project",
3076 "pollster 0.2.5",
3077 "static_assertions",
3078 "thiserror 1.0.69",
3079]
3080
3081[[package]]
3082name = "potential_utf"
3083version = "0.1.3"
3084source = "registry+https://github.com/rust-lang/crates.io-index"
3085checksum = "84df19adbe5b5a0782edcab45899906947ab039ccf4573713735ee7de1e6b08a"
3086dependencies = [
3087 "zerovec",
3088]
3089
3090[[package]]
3091name = "ppv-lite86"
3092version = "0.2.21"
3093source = "registry+https://github.com/rust-lang/crates.io-index"
3094checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
3095dependencies = [
3096 "zerocopy",
3097]
3098
3099[[package]]
3100name = "presser"
3101version = "0.3.1"
3102source = "registry+https://github.com/rust-lang/crates.io-index"
3103checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
3104
3105[[package]]
3106name = "prettyplease"
3107version = "0.2.37"
3108source = "registry+https://github.com/rust-lang/crates.io-index"
3109checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
3110dependencies = [
3111 "proc-macro2",
3112 "syn 2.0.117",
3113]
3114
3115[[package]]
3116name = "proc-macro-crate"
3117version = "3.4.0"
3118source = "registry+https://github.com/rust-lang/crates.io-index"
3119checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983"
3120dependencies = [
3121 "toml_edit",
3122]
3123
3124[[package]]
3125name = "proc-macro2"
3126version = "1.0.107"
3127source = "registry+https://github.com/rust-lang/crates.io-index"
3128checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
3129dependencies = [
3130 "unicode-ident",
3131]
3132
3133[[package]]
3134name = "profiling"
3135version = "1.0.17"
3136source = "registry+https://github.com/rust-lang/crates.io-index"
3137checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773"
3138dependencies = [
3139 "profiling-procmacros",
3140]
3141
3142[[package]]
3143name = "profiling-procmacros"
3144version = "1.0.17"
3145source = "registry+https://github.com/rust-lang/crates.io-index"
3146checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b"
3147dependencies = [
3148 "quote",
3149 "syn 2.0.117",
3150]
3151
3152[[package]]
3153name = "proptest"
3154version = "1.11.0"
3155source = "registry+https://github.com/rust-lang/crates.io-index"
3156checksum = "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744"
3157dependencies = [
3158 "bit-set 0.8.0",
3159 "bit-vec 0.8.0",
3160 "bitflags 2.13.1",
3161 "num-traits",
3162 "proptest-macro",
3163 "rand 0.9.4",
3164 "rand_chacha 0.9.0",
3165 "rand_xorshift",
3166 "regex-syntax",
3167 "rusty-fork",
3168 "tempfile",
3169 "unarray",
3170]
3171
3172[[package]]
3173name = "proptest-macro"
3174version = "0.5.0"
3175source = "registry+https://github.com/rust-lang/crates.io-index"
3176checksum = "efaa288b896cb2b345da7b7f2110ab19e51565b83495b56fcec98a62f8b1f33e"
3177dependencies = [
3178 "convert_case 0.11.0",
3179 "proc-macro2",
3180 "quote",
3181 "syn 2.0.117",
3182]
3183
3184[[package]]
3185name = "pxfm"
3186version = "0.1.25"
3187source = "registry+https://github.com/rust-lang/crates.io-index"
3188checksum = "a3cbdf373972bf78df4d3b518d07003938e2c7d1fb5891e55f9cb6df57009d84"
3189dependencies = [
3190 "num-traits",
3191]
3192
3193[[package]]
3194name = "qoi"
3195version = "0.4.1"
3196source = "registry+https://github.com/rust-lang/crates.io-index"
3197checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
3198dependencies = [
3199 "bytemuck",
3200]
3201
3202[[package]]
3203name = "quick-error"
3204version = "1.2.3"
3205source = "registry+https://github.com/rust-lang/crates.io-index"
3206checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
3207
3208[[package]]
3209name = "quick-error"
3210version = "2.0.1"
3211source = "registry+https://github.com/rust-lang/crates.io-index"
3212checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
3213
3214[[package]]
3215name = "quick-xml"
3216version = "0.30.0"
3217source = "registry+https://github.com/rust-lang/crates.io-index"
3218checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
3219dependencies = [
3220 "memchr",
3221]
3222
3223[[package]]
3224name = "quote"
3225version = "1.0.47"
3226source = "registry+https://github.com/rust-lang/crates.io-index"
3227checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
3228dependencies = [
3229 "proc-macro2",
3230]
3231
3232[[package]]
3233name = "r-efi"
3234version = "5.3.0"
3235source = "registry+https://github.com/rust-lang/crates.io-index"
3236checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
3237
3238[[package]]
3239name = "rand"
3240version = "0.8.6"
3241source = "registry+https://github.com/rust-lang/crates.io-index"
3242checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
3243dependencies = [
3244 "libc",
3245 "rand_chacha 0.3.1",
3246 "rand_core 0.6.4",
3247]
3248
3249[[package]]
3250name = "rand"
3251version = "0.9.4"
3252source = "registry+https://github.com/rust-lang/crates.io-index"
3253checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
3254dependencies = [
3255 "rand_chacha 0.9.0",
3256 "rand_core 0.9.3",
3257]
3258
3259[[package]]
3260name = "rand_chacha"
3261version = "0.3.1"
3262source = "registry+https://github.com/rust-lang/crates.io-index"
3263checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
3264dependencies = [
3265 "ppv-lite86",
3266 "rand_core 0.6.4",
3267]
3268
3269[[package]]
3270name = "rand_chacha"
3271version = "0.9.0"
3272source = "registry+https://github.com/rust-lang/crates.io-index"
3273checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
3274dependencies = [
3275 "ppv-lite86",
3276 "rand_core 0.9.3",
3277]
3278
3279[[package]]
3280name = "rand_core"
3281version = "0.6.4"
3282source = "registry+https://github.com/rust-lang/crates.io-index"
3283checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
3284dependencies = [
3285 "getrandom 0.2.16",
3286]
3287
3288[[package]]
3289name = "rand_core"
3290version = "0.9.3"
3291source = "registry+https://github.com/rust-lang/crates.io-index"
3292checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
3293dependencies = [
3294 "getrandom 0.3.4",
3295]
3296
3297[[package]]
3298name = "rand_xorshift"
3299version = "0.4.0"
3300source = "registry+https://github.com/rust-lang/crates.io-index"
3301checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a"
3302dependencies = [
3303 "rand_core 0.9.3",
3304]
3305
3306[[package]]
3307name = "range-alloc"
3308version = "0.1.4"
3309source = "registry+https://github.com/rust-lang/crates.io-index"
3310checksum = "c3d6831663a5098ea164f89cff59c6284e95f4e3c76ce9848d4529f5ccca9bde"
3311
3312[[package]]
3313name = "rangemap"
3314version = "1.7.1"
3315source = "registry+https://github.com/rust-lang/crates.io-index"
3316checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68"
3317
3318[[package]]
3319name = "rav1e"
3320version = "0.8.1"
3321source = "registry+https://github.com/rust-lang/crates.io-index"
3322checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"
3323dependencies = [
3324 "aligned-vec",
3325 "arbitrary",
3326 "arg_enum_proc_macro",
3327 "arrayvec",
3328 "av-scenechange",
3329 "av1-grain",
3330 "bitstream-io",
3331 "built",
3332 "cfg-if",
3333 "interpolate_name",
3334 "itertools 0.14.0",
3335 "libc",
3336 "libfuzzer-sys",
3337 "log",
3338 "maybe-rayon",
3339 "new_debug_unreachable",
3340 "noop_proc_macro",
3341 "num-derive",
3342 "num-traits",
3343 "paste",
3344 "profiling",
3345 "rand 0.9.4",
3346 "rand_chacha 0.9.0",
3347 "simd_helpers",
3348 "thiserror 2.0.17",
3349 "v_frame",
3350 "wasm-bindgen",
3351]
3352
3353[[package]]
3354name = "ravif"
3355version = "0.13.0"
3356source = "registry+https://github.com/rust-lang/crates.io-index"
3357checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45"
3358dependencies = [
3359 "avif-serialize",
3360 "imgref",
3361 "loop9",
3362 "quick-error 2.0.1",
3363 "rav1e",
3364 "rayon",
3365 "rgb",
3366]
3367
3368[[package]]
3369name = "raw-window-handle"
3370version = "0.6.2"
3371source = "registry+https://github.com/rust-lang/crates.io-index"
3372checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
3373
3374[[package]]
3375name = "raw-window-metal"
3376version = "1.1.0"
3377source = "registry+https://github.com/rust-lang/crates.io-index"
3378checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135"
3379dependencies = [
3380 "objc2",
3381 "objc2-core-foundation",
3382 "objc2-foundation",
3383 "objc2-quartz-core",
3384]
3385
3386[[package]]
3387name = "rayon"
3388version = "1.11.0"
3389source = "registry+https://github.com/rust-lang/crates.io-index"
3390checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
3391dependencies = [
3392 "either",
3393 "rayon-core",
3394]
3395
3396[[package]]
3397name = "rayon-core"
3398version = "1.13.0"
3399source = "registry+https://github.com/rust-lang/crates.io-index"
3400checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
3401dependencies = [
3402 "crossbeam-deque",
3403 "crossbeam-utils",
3404]
3405
3406[[package]]
3407name = "read-fonts"
3408version = "0.35.0"
3409source = "registry+https://github.com/rust-lang/crates.io-index"
3410checksum = "6717cf23b488adf64b9d711329542ba34de147df262370221940dfabc2c91358"
3411dependencies = [
3412 "bytemuck",
3413 "font-types 0.10.0",
3414]
3415
3416[[package]]
3417name = "read-fonts"
3418version = "0.37.0"
3419source = "registry+https://github.com/rust-lang/crates.io-index"
3420checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5"
3421dependencies = [
3422 "bytemuck",
3423 "core_maths",
3424 "font-types 0.11.0",
3425]
3426
3427[[package]]
3428name = "redox_syscall"
3429version = "0.5.18"
3430source = "registry+https://github.com/rust-lang/crates.io-index"
3431checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
3432dependencies = [
3433 "bitflags 2.13.1",
3434]
3435
3436[[package]]
3437name = "redox_users"
3438version = "0.4.6"
3439source = "registry+https://github.com/rust-lang/crates.io-index"
3440checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
3441dependencies = [
3442 "getrandom 0.2.16",
3443 "libredox",
3444 "thiserror 1.0.69",
3445]
3446
3447[[package]]
3448name = "ref-cast"
3449version = "1.0.25"
3450source = "registry+https://github.com/rust-lang/crates.io-index"
3451checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d"
3452dependencies = [
3453 "ref-cast-impl",
3454]
3455
3456[[package]]
3457name = "ref-cast-impl"
3458version = "1.0.25"
3459source = "registry+https://github.com/rust-lang/crates.io-index"
3460checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
3461dependencies = [
3462 "proc-macro2",
3463 "quote",
3464 "syn 2.0.117",
3465]
3466
3467[[package]]
3468name = "regex"
3469version = "1.12.3"
3470source = "registry+https://github.com/rust-lang/crates.io-index"
3471checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
3472dependencies = [
3473 "aho-corasick",
3474 "memchr",
3475 "regex-automata",
3476 "regex-syntax",
3477]
3478
3479[[package]]
3480name = "regex-automata"
3481version = "0.4.18"
3482source = "registry+https://github.com/rust-lang/crates.io-index"
3483checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
3484dependencies = [
3485 "aho-corasick",
3486 "memchr",
3487 "regex-syntax",
3488]
3489
3490[[package]]
3491name = "regex-syntax"
3492version = "0.8.11"
3493source = "registry+https://github.com/rust-lang/crates.io-index"
3494checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
3495
3496[[package]]
3497name = "renderdoc-sys"
3498version = "1.1.0"
3499source = "registry+https://github.com/rust-lang/crates.io-index"
3500checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
3501
3502[[package]]
3503name = "resvg"
3504version = "0.46.0"
3505source = "registry+https://github.com/rust-lang/crates.io-index"
3506checksum = "b563218631706d614e23059436526d005b50ab5f2d506b55a17eb65c5eb83419"
3507dependencies = [
3508 "gif",
3509 "image-webp",
3510 "log",
3511 "pico-args",
3512 "rgb",
3513 "svgtypes",
3514 "tiny-skia",
3515 "usvg",
3516 "zune-jpeg",
3517]
3518
3519[[package]]
3520name = "rgb"
3521version = "0.8.52"
3522source = "registry+https://github.com/rust-lang/crates.io-index"
3523checksum = "0c6a884d2998352bb4daf0183589aec883f16a6da1f4dde84d8e2e9a5409a1ce"
3524dependencies = [
3525 "bytemuck",
3526]
3527
3528[[package]]
3529name = "roxmltree"
3530version = "0.20.0"
3531source = "registry+https://github.com/rust-lang/crates.io-index"
3532checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
3533
3534[[package]]
3535name = "roxmltree"
3536version = "0.21.1"
3537source = "registry+https://github.com/rust-lang/crates.io-index"
3538checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb"
3539dependencies = [
3540 "memchr",
3541]
3542
3543[[package]]
3544name = "rustc-demangle"
3545version = "0.1.26"
3546source = "registry+https://github.com/rust-lang/crates.io-index"
3547checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
3548
3549[[package]]
3550name = "rustc-hash"
3551version = "1.1.0"
3552source = "registry+https://github.com/rust-lang/crates.io-index"
3553checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
3554
3555[[package]]
3556name = "rustc-hash"
3557version = "2.1.1"
3558source = "registry+https://github.com/rust-lang/crates.io-index"
3559checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
3560
3561[[package]]
3562name = "rustc_version"
3563version = "0.4.1"
3564source = "registry+https://github.com/rust-lang/crates.io-index"
3565checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
3566dependencies = [
3567 "semver",
3568]
3569
3570[[package]]
3571name = "rustix"
3572version = "1.1.4"
3573source = "registry+https://github.com/rust-lang/crates.io-index"
3574checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
3575dependencies = [
3576 "bitflags 2.13.1",
3577 "errno",
3578 "libc",
3579 "linux-raw-sys",
3580 "windows-sys 0.61.2",
3581]
3582
3583[[package]]
3584name = "rustversion"
3585version = "1.0.22"
3586source = "registry+https://github.com/rust-lang/crates.io-index"
3587checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
3588
3589[[package]]
3590name = "rusty-fork"
3591version = "0.3.1"
3592source = "registry+https://github.com/rust-lang/crates.io-index"
3593checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2"
3594dependencies = [
3595 "fnv",
3596 "quick-error 1.2.3",
3597 "tempfile",
3598 "wait-timeout",
3599]
3600
3601[[package]]
3602name = "rustybuzz"
3603version = "0.20.1"
3604source = "registry+https://github.com/rust-lang/crates.io-index"
3605checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702"
3606dependencies = [
3607 "bitflags 2.13.1",
3608 "bytemuck",
3609 "core_maths",
3610 "log",
3611 "smallvec",
3612 "ttf-parser",
3613 "unicode-bidi-mirroring",
3614 "unicode-ccc",
3615 "unicode-properties",
3616 "unicode-script",
3617]
3618
3619[[package]]
3620name = "ryu"
3621version = "1.0.23"
3622source = "registry+https://github.com/rust-lang/crates.io-index"
3623checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
3624
3625[[package]]
3626name = "same-file"
3627version = "1.0.6"
3628source = "registry+https://github.com/rust-lang/crates.io-index"
3629checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
3630dependencies = [
3631 "winapi-util",
3632]
3633
3634[[package]]
3635name = "schemars"
3636version = "1.0.4"
3637source = "registry+https://github.com/rust-lang/crates.io-index"
3638checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
3639dependencies = [
3640 "dyn-clone",
3641 "indexmap",
3642 "ref-cast",
3643 "schemars_derive",
3644 "serde",
3645 "serde_json",
3646]
3647
3648[[package]]
3649name = "schemars_derive"
3650version = "1.0.4"
3651source = "registry+https://github.com/rust-lang/crates.io-index"
3652checksum = "33d020396d1d138dc19f1165df7545479dcd58d93810dc5d646a16e55abefa80"
3653dependencies = [
3654 "proc-macro2",
3655 "quote",
3656 "serde_derive_internals",
3657 "syn 2.0.117",
3658]
3659
3660[[package]]
3661name = "scopeguard"
3662version = "1.2.0"
3663source = "registry+https://github.com/rust-lang/crates.io-index"
3664checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
3665
3666[[package]]
3667name = "screencapturekit"
3668version = "0.2.8"
3669source = "registry+https://github.com/rust-lang/crates.io-index"
3670checksum = "1a5eeeb57ac94960cfe5ff4c402be6585ae4c8d29a2cf41b276048c2e849d64e"
3671dependencies = [
3672 "screencapturekit-sys",
3673]
3674
3675[[package]]
3676name = "screencapturekit-sys"
3677version = "0.2.8"
3678source = "registry+https://github.com/rust-lang/crates.io-index"
3679checksum = "22411b57f7d49e7fe08025198813ee6fd65e1ee5eff4ebc7880c12c82bde4c60"
3680dependencies = [
3681 "block",
3682 "dispatch",
3683 "objc",
3684 "objc-foundation",
3685 "objc_id",
3686 "once_cell",
3687]
3688
3689[[package]]
3690name = "seahash"
3691version = "4.1.0"
3692source = "registry+https://github.com/rust-lang/crates.io-index"
3693checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
3694
3695[[package]]
3696name = "self_cell"
3697version = "1.2.2"
3698source = "registry+https://github.com/rust-lang/crates.io-index"
3699checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89"
3700
3701[[package]]
3702name = "semver"
3703version = "1.0.28"
3704source = "registry+https://github.com/rust-lang/crates.io-index"
3705checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
3706
3707[[package]]
3708name = "serde"
3709version = "1.0.229"
3710source = "registry+https://github.com/rust-lang/crates.io-index"
3711checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
3712dependencies = [
3713 "serde_core",
3714 "serde_derive",
3715]
3716
3717[[package]]
3718name = "serde_core"
3719version = "1.0.229"
3720source = "registry+https://github.com/rust-lang/crates.io-index"
3721checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
3722dependencies = [
3723 "serde_derive",
3724]
3725
3726[[package]]
3727name = "serde_derive"
3728version = "1.0.229"
3729source = "registry+https://github.com/rust-lang/crates.io-index"
3730checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
3731dependencies = [
3732 "proc-macro2",
3733 "quote",
3734 "syn 3.0.3",
3735]
3736
3737[[package]]
3738name = "serde_derive_internals"
3739version = "0.29.1"
3740source = "registry+https://github.com/rust-lang/crates.io-index"
3741checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
3742dependencies = [
3743 "proc-macro2",
3744 "quote",
3745 "syn 2.0.117",
3746]
3747
3748[[package]]
3749name = "serde_fmt"
3750version = "1.0.3"
3751source = "registry+https://github.com/rust-lang/crates.io-index"
3752checksum = "e1d4ddca14104cd60529e8c7f7ba71a2c8acd8f7f5cfcdc2faf97eeb7c3010a4"
3753dependencies = [
3754 "serde",
3755]
3756
3757[[package]]
3758name = "serde_json"
3759version = "1.0.151"
3760source = "registry+https://github.com/rust-lang/crates.io-index"
3761checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
3762dependencies = [
3763 "indexmap",
3764 "itoa",
3765 "memchr",
3766 "serde",
3767 "serde_core",
3768 "zmij",
3769]
3770
3771[[package]]
3772name = "serde_urlencoded"
3773version = "0.7.1"
3774source = "registry+https://github.com/rust-lang/crates.io-index"
3775checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
3776dependencies = [
3777 "form_urlencoded",
3778 "itoa",
3779 "ryu",
3780 "serde",
3781]
3782
3783[[package]]
3784name = "sha1_smol"
3785version = "1.0.1"
3786source = "registry+https://github.com/rust-lang/crates.io-index"
3787checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
3788
3789[[package]]
3790name = "sharded-slab"
3791version = "0.1.7"
3792source = "registry+https://github.com/rust-lang/crates.io-index"
3793checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
3794dependencies = [
3795 "lazy_static",
3796]
3797
3798[[package]]
3799name = "shlex"
3800version = "1.3.0"
3801source = "registry+https://github.com/rust-lang/crates.io-index"
3802checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
3803
3804[[package]]
3805name = "shlex"
3806version = "2.0.1"
3807source = "registry+https://github.com/rust-lang/crates.io-index"
3808checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
3809
3810[[package]]
3811name = "simd-adler32"
3812version = "0.3.7"
3813source = "registry+https://github.com/rust-lang/crates.io-index"
3814checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
3815
3816[[package]]
3817name = "simd_helpers"
3818version = "0.1.0"
3819source = "registry+https://github.com/rust-lang/crates.io-index"
3820checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"
3821dependencies = [
3822 "quote",
3823]
3824
3825[[package]]
3826name = "simplecss"
3827version = "0.2.2"
3828source = "registry+https://github.com/rust-lang/crates.io-index"
3829checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c"
3830dependencies = [
3831 "log",
3832]
3833
3834[[package]]
3835name = "siphasher"
3836version = "1.0.1"
3837source = "registry+https://github.com/rust-lang/crates.io-index"
3838checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
3839
3840[[package]]
3841name = "skrifa"
3842version = "0.37.0"
3843source = "registry+https://github.com/rust-lang/crates.io-index"
3844checksum = "8c31071dedf532758ecf3fed987cdb4bd9509f900e026ab684b4ecb81ea49841"
3845dependencies = [
3846 "bytemuck",
3847 "read-fonts 0.35.0",
3848]
3849
3850[[package]]
3851name = "skrifa"
3852version = "0.40.0"
3853source = "registry+https://github.com/rust-lang/crates.io-index"
3854checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac"
3855dependencies = [
3856 "bytemuck",
3857 "read-fonts 0.37.0",
3858]
3859
3860[[package]]
3861name = "slab"
3862version = "0.4.11"
3863source = "registry+https://github.com/rust-lang/crates.io-index"
3864checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
3865
3866[[package]]
3867name = "slotmap"
3868version = "1.0.7"
3869source = "registry+https://github.com/rust-lang/crates.io-index"
3870checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a"
3871dependencies = [
3872 "version_check",
3873]
3874
3875[[package]]
3876name = "smallvec"
3877version = "1.16.1"
3878source = "registry+https://github.com/rust-lang/crates.io-index"
3879checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891"
3880
3881[[package]]
3882name = "smol_str"
3883version = "0.3.6"
3884source = "registry+https://github.com/rust-lang/crates.io-index"
3885checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523"
3886dependencies = [
3887 "serde_core",
3888]
3889
3890[[package]]
3891name = "spin"
3892version = "0.9.8"
3893source = "registry+https://github.com/rust-lang/crates.io-index"
3894checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
3895dependencies = [
3896 "lock_api",
3897]
3898
3899[[package]]
3900name = "spin"
3901version = "0.10.0"
3902source = "registry+https://github.com/rust-lang/crates.io-index"
3903checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591"
3904dependencies = [
3905 "lock_api",
3906]
3907
3908[[package]]
3909name = "spirv"
3910version = "0.4.0+sdk-1.4.341.0"
3911source = "registry+https://github.com/rust-lang/crates.io-index"
3912checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f"
3913dependencies = [
3914 "bitflags 2.13.1",
3915]
3916
3917[[package]]
3918name = "stable_deref_trait"
3919version = "1.2.1"
3920source = "registry+https://github.com/rust-lang/crates.io-index"
3921checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
3922
3923[[package]]
3924name = "static_assertions"
3925version = "1.1.0"
3926source = "registry+https://github.com/rust-lang/crates.io-index"
3927checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
3928
3929[[package]]
3930name = "strict-num"
3931version = "0.1.1"
3932source = "registry+https://github.com/rust-lang/crates.io-index"
3933checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
3934dependencies = [
3935 "float-cmp",
3936]
3937
3938[[package]]
3939name = "strum"
3940version = "0.28.0"
3941source = "registry+https://github.com/rust-lang/crates.io-index"
3942checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd"
3943dependencies = [
3944 "strum_macros",
3945]
3946
3947[[package]]
3948name = "strum_macros"
3949version = "0.28.0"
3950source = "registry+https://github.com/rust-lang/crates.io-index"
3951checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664"
3952dependencies = [
3953 "heck",
3954 "proc-macro2",
3955 "quote",
3956 "syn 2.0.117",
3957]
3958
3959[[package]]
3960name = "sval"
3961version = "2.15.0"
3962source = "registry+https://github.com/rust-lang/crates.io-index"
3963checksum = "d94c4464e595f0284970fd9c7e9013804d035d4a61ab74b113242c874c05814d"
3964
3965[[package]]
3966name = "sval_buffer"
3967version = "2.15.0"
3968source = "registry+https://github.com/rust-lang/crates.io-index"
3969checksum = "a0f46e34b20a39e6a2bf02b926983149b3af6609fd1ee8a6e63f6f340f3e2164"
3970dependencies = [
3971 "sval",
3972 "sval_ref",
3973]
3974
3975[[package]]
3976name = "sval_dynamic"
3977version = "2.15.0"
3978source = "registry+https://github.com/rust-lang/crates.io-index"
3979checksum = "03d0970e53c92ab5381d3b2db1828da8af945954d4234225f6dd9c3afbcef3f5"
3980dependencies = [
3981 "sval",
3982]
3983
3984[[package]]
3985name = "sval_fmt"
3986version = "2.15.0"
3987source = "registry+https://github.com/rust-lang/crates.io-index"
3988checksum = "43e5e6e1613e1e7fc2e1a9fdd709622e54c122ceb067a60d170d75efd491a839"
3989dependencies = [
3990 "itoa",
3991 "ryu",
3992 "sval",
3993]
3994
3995[[package]]
3996name = "sval_json"
3997version = "2.15.0"
3998source = "registry+https://github.com/rust-lang/crates.io-index"
3999checksum = "aec382f7bfa6e367b23c9611f129b94eb7daaf3d8fae45a8d0a0211eb4d4c8e6"
4000dependencies = [
4001 "itoa",
4002 "ryu",
4003 "sval",
4004]
4005
4006[[package]]
4007name = "sval_nested"
4008version = "2.15.0"
4009source = "registry+https://github.com/rust-lang/crates.io-index"
4010checksum = "3049d0f99ce6297f8f7d9953b35a0103b7584d8f638de40e64edb7105fa578ae"
4011dependencies = [
4012 "sval",
4013 "sval_buffer",
4014 "sval_ref",
4015]
4016
4017[[package]]
4018name = "sval_ref"
4019version = "2.15.0"
4020source = "registry+https://github.com/rust-lang/crates.io-index"
4021checksum = "f88913e77506085c0a8bf6912bb6558591a960faf5317df6c1d9b227224ca6e1"
4022dependencies = [
4023 "sval",
4024]
4025
4026[[package]]
4027name = "sval_serde"
4028version = "2.15.0"
4029source = "registry+https://github.com/rust-lang/crates.io-index"
4030checksum = "f579fd7254f4be6cd7b450034f856b78523404655848789c451bacc6aa8b387d"
4031dependencies = [
4032 "serde_core",
4033 "sval",
4034 "sval_nested",
4035]
4036
4037[[package]]
4038name = "svg_fmt"
4039version = "0.4.5"
4040source = "registry+https://github.com/rust-lang/crates.io-index"
4041checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb"
4042
4043[[package]]
4044name = "svgtypes"
4045version = "0.16.1"
4046source = "registry+https://github.com/rust-lang/crates.io-index"
4047checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d"
4048dependencies = [
4049 "kurbo",
4050 "siphasher",
4051]
4052
4053[[package]]
4054name = "swash"
4055version = "0.2.6"
4056source = "registry+https://github.com/rust-lang/crates.io-index"
4057checksum = "47846491253e976bdd07d0f9cc24b7daf24720d11309302ccbbc6e6b6e53550a"
4058dependencies = [
4059 "skrifa 0.37.0",
4060 "yazi",
4061 "zeno",
4062]
4063
4064[[package]]
4065name = "syn"
4066version = "2.0.117"
4067source = "registry+https://github.com/rust-lang/crates.io-index"
4068checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
4069dependencies = [
4070 "proc-macro2",
4071 "quote",
4072 "unicode-ident",
4073]
4074
4075[[package]]
4076name = "syn"
4077version = "3.0.3"
4078source = "registry+https://github.com/rust-lang/crates.io-index"
4079checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
4080dependencies = [
4081 "proc-macro2",
4082 "quote",
4083 "unicode-ident",
4084]
4085
4086[[package]]
4087name = "synstructure"
4088version = "0.13.2"
4089source = "registry+https://github.com/rust-lang/crates.io-index"
4090checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
4091dependencies = [
4092 "proc-macro2",
4093 "quote",
4094 "syn 2.0.117",
4095]
4096
4097[[package]]
4098name = "sys-locale"
4099version = "0.3.2"
4100source = "registry+https://github.com/rust-lang/crates.io-index"
4101checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
4102dependencies = [
4103 "libc",
4104]
4105
4106[[package]]
4107name = "sysinfo"
4108version = "0.31.4"
4109source = "registry+https://github.com/rust-lang/crates.io-index"
4110checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be"
4111dependencies = [
4112 "core-foundation-sys",
4113 "libc",
4114 "memchr",
4115 "ntapi",
4116 "rayon",
4117 "windows 0.57.0",
4118]
4119
4120[[package]]
4121name = "taffy"
4122version = "0.13.0"
4123source = "registry+https://github.com/rust-lang/crates.io-index"
4124checksum = "c034e05f6ee85a12daa63863c2245797715075c70649947aa0da54f3f2ab1d0f"
4125dependencies = [
4126 "arrayvec",
4127 "serde",
4128 "slotmap",
4129 "smallvec",
4130]
4131
4132[[package]]
4133name = "tao-core-video-sys"
4134version = "0.2.0"
4135source = "registry+https://github.com/rust-lang/crates.io-index"
4136checksum = "271450eb289cb4d8d0720c6ce70c72c8c858c93dd61fc625881616752e6b98f6"
4137dependencies = [
4138 "cfg-if",
4139 "core-foundation-sys",
4140 "libc",
4141 "objc",
4142]
4143
4144[[package]]
4145name = "tempfile"
4146version = "3.27.0"
4147source = "registry+https://github.com/rust-lang/crates.io-index"
4148checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
4149dependencies = [
4150 "fastrand",
4151 "getrandom 0.4.1",
4152 "once_cell",
4153 "rustix",
4154 "windows-sys 0.61.2",
4155]
4156
4157[[package]]
4158name = "termcolor"
4159version = "1.4.1"
4160source = "registry+https://github.com/rust-lang/crates.io-index"
4161checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
4162dependencies = [
4163 "winapi-util",
4164]
4165
4166[[package]]
4167name = "thiserror"
4168version = "1.0.69"
4169source = "registry+https://github.com/rust-lang/crates.io-index"
4170checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
4171dependencies = [
4172 "thiserror-impl 1.0.69",
4173]
4174
4175[[package]]
4176name = "thiserror"
4177version = "2.0.17"
4178source = "registry+https://github.com/rust-lang/crates.io-index"
4179checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
4180dependencies = [
4181 "thiserror-impl 2.0.17",
4182]
4183
4184[[package]]
4185name = "thiserror-impl"
4186version = "1.0.69"
4187source = "registry+https://github.com/rust-lang/crates.io-index"
4188checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
4189dependencies = [
4190 "proc-macro2",
4191 "quote",
4192 "syn 2.0.117",
4193]
4194
4195[[package]]
4196name = "thiserror-impl"
4197version = "2.0.17"
4198source = "registry+https://github.com/rust-lang/crates.io-index"
4199checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
4200dependencies = [
4201 "proc-macro2",
4202 "quote",
4203 "syn 2.0.117",
4204]
4205
4206[[package]]
4207name = "thread_local"
4208version = "1.1.9"
4209source = "registry+https://github.com/rust-lang/crates.io-index"
4210checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
4211dependencies = [
4212 "cfg-if",
4213]
4214
4215[[package]]
4216name = "tiff"
4217version = "0.11.3"
4218source = "registry+https://github.com/rust-lang/crates.io-index"
4219checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"
4220dependencies = [
4221 "fax",
4222 "flate2",
4223 "half",
4224 "quick-error 2.0.1",
4225 "weezl",
4226 "zune-jpeg",
4227]
4228
4229[[package]]
4230name = "tiny-skia"
4231version = "0.11.4"
4232source = "registry+https://github.com/rust-lang/crates.io-index"
4233checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab"
4234dependencies = [
4235 "arrayref",
4236 "arrayvec",
4237 "bytemuck",
4238 "cfg-if",
4239 "log",
4240 "png 0.17.16",
4241 "tiny-skia-path",
4242]
4243
4244[[package]]
4245name = "tiny-skia-path"
4246version = "0.11.4"
4247source = "registry+https://github.com/rust-lang/crates.io-index"
4248checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93"
4249dependencies = [
4250 "arrayref",
4251 "bytemuck",
4252 "strict-num",
4253]
4254
4255[[package]]
4256name = "tinystr"
4257version = "0.8.4"
4258source = "registry+https://github.com/rust-lang/crates.io-index"
4259checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643"
4260dependencies = [
4261 "displaydoc",
4262 "zerovec",
4263]
4264
4265[[package]]
4266name = "tinytemplate"
4267version = "1.2.1"
4268source = "registry+https://github.com/rust-lang/crates.io-index"
4269checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
4270dependencies = [
4271 "serde",
4272 "serde_json",
4273]
4274
4275[[package]]
4276name = "tinyvec"
4277version = "1.10.0"
4278source = "registry+https://github.com/rust-lang/crates.io-index"
4279checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"
4280dependencies = [
4281 "tinyvec_macros",
4282]
4283
4284[[package]]
4285name = "tinyvec_macros"
4286version = "0.1.1"
4287source = "registry+https://github.com/rust-lang/crates.io-index"
4288checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
4289
4290[[package]]
4291name = "toml_datetime"
4292version = "0.7.3"
4293source = "registry+https://github.com/rust-lang/crates.io-index"
4294checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533"
4295dependencies = [
4296 "serde_core",
4297]
4298
4299[[package]]
4300name = "toml_edit"
4301version = "0.23.7"
4302source = "registry+https://github.com/rust-lang/crates.io-index"
4303checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d"
4304dependencies = [
4305 "indexmap",
4306 "toml_datetime",
4307 "toml_parser",
4308 "winnow",
4309]
4310
4311[[package]]
4312name = "toml_parser"
4313version = "1.0.4"
4314source = "registry+https://github.com/rust-lang/crates.io-index"
4315checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
4316dependencies = [
4317 "winnow",
4318]
4319
4320[[package]]
4321name = "tracing"
4322version = "0.1.43"
4323source = "registry+https://github.com/rust-lang/crates.io-index"
4324checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647"
4325dependencies = [
4326 "pin-project-lite",
4327 "tracing-attributes",
4328 "tracing-core",
4329]
4330
4331[[package]]
4332name = "tracing-attributes"
4333version = "0.1.31"
4334source = "registry+https://github.com/rust-lang/crates.io-index"
4335checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
4336dependencies = [
4337 "proc-macro2",
4338 "quote",
4339 "syn 2.0.117",
4340]
4341
4342[[package]]
4343name = "tracing-core"
4344version = "0.1.35"
4345source = "registry+https://github.com/rust-lang/crates.io-index"
4346checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
4347dependencies = [
4348 "once_cell",
4349 "valuable",
4350]
4351
4352[[package]]
4353name = "tracing-log"
4354version = "0.2.0"
4355source = "registry+https://github.com/rust-lang/crates.io-index"
4356checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
4357dependencies = [
4358 "log",
4359 "once_cell",
4360 "tracing-core",
4361]
4362
4363[[package]]
4364name = "tracing-subscriber"
4365version = "0.3.22"
4366source = "registry+https://github.com/rust-lang/crates.io-index"
4367checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
4368dependencies = [
4369 "nu-ansi-term",
4370 "sharded-slab",
4371 "smallvec",
4372 "thread_local",
4373 "tracing-core",
4374 "tracing-log",
4375]
4376
4377[[package]]
4378name = "ttf-parser"
4379version = "0.25.1"
4380source = "registry+https://github.com/rust-lang/crates.io-index"
4381checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
4382dependencies = [
4383 "core_maths",
4384]
4385
4386[[package]]
4387name = "typeid"
4388version = "1.0.3"
4389source = "registry+https://github.com/rust-lang/crates.io-index"
4390checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
4391
4392[[package]]
4393name = "unarray"
4394version = "0.1.4"
4395source = "registry+https://github.com/rust-lang/crates.io-index"
4396checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94"
4397
4398[[package]]
4399name = "unicode-bidi"
4400version = "0.3.18"
4401source = "registry+https://github.com/rust-lang/crates.io-index"
4402checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
4403
4404[[package]]
4405name = "unicode-bidi-mirroring"
4406version = "0.4.0"
4407source = "registry+https://github.com/rust-lang/crates.io-index"
4408checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe"
4409
4410[[package]]
4411name = "unicode-ccc"
4412version = "0.4.0"
4413source = "registry+https://github.com/rust-lang/crates.io-index"
4414checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e"
4415
4416[[package]]
4417name = "unicode-ident"
4418version = "1.0.24"
4419source = "registry+https://github.com/rust-lang/crates.io-index"
4420checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
4421
4422[[package]]
4423name = "unicode-linebreak"
4424version = "0.1.5"
4425source = "registry+https://github.com/rust-lang/crates.io-index"
4426checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
4427
4428[[package]]
4429name = "unicode-properties"
4430version = "0.1.3"
4431source = "registry+https://github.com/rust-lang/crates.io-index"
4432checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
4433
4434[[package]]
4435name = "unicode-script"
4436version = "0.5.8"
4437source = "registry+https://github.com/rust-lang/crates.io-index"
4438checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee"
4439
4440[[package]]
4441name = "unicode-segmentation"
4442version = "1.13.3"
4443source = "registry+https://github.com/rust-lang/crates.io-index"
4444checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
4445
4446[[package]]
4447name = "unicode-vo"
4448version = "0.1.0"
4449source = "registry+https://github.com/rust-lang/crates.io-index"
4450checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"
4451
4452[[package]]
4453name = "unicode-width"
4454version = "0.2.2"
4455source = "registry+https://github.com/rust-lang/crates.io-index"
4456checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
4457
4458[[package]]
4459name = "unicode-xid"
4460version = "0.2.6"
4461source = "registry+https://github.com/rust-lang/crates.io-index"
4462checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
4463
4464[[package]]
4465name = "url"
4466version = "2.5.7"
4467source = "registry+https://github.com/rust-lang/crates.io-index"
4468checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b"
4469dependencies = [
4470 "form_urlencoded",
4471 "idna",
4472 "percent-encoding",
4473 "serde",
4474]
4475
4476[[package]]
4477name = "usvg"
4478version = "0.46.0"
4479source = "registry+https://github.com/rust-lang/crates.io-index"
4480checksum = "e419dff010bb12512b0ae9e3d2f318dfbdf0167fde7eb05465134d4e8756076f"
4481dependencies = [
4482 "base64",
4483 "data-url",
4484 "flate2",
4485 "fontdb",
4486 "imagesize",
4487 "kurbo",
4488 "log",
4489 "pico-args",
4490 "roxmltree 0.21.1",
4491 "rustybuzz",
4492 "simplecss",
4493 "siphasher",
4494 "strict-num",
4495 "svgtypes",
4496 "tiny-skia-path",
4497 "unicode-bidi",
4498 "unicode-script",
4499 "unicode-vo",
4500 "xmlwriter",
4501]
4502
4503[[package]]
4504name = "utf8_iter"
4505version = "1.0.4"
4506source = "registry+https://github.com/rust-lang/crates.io-index"
4507checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
4508
4509[[package]]
4510name = "uuid"
4511version = "1.18.1"
4512source = "registry+https://github.com/rust-lang/crates.io-index"
4513checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
4514dependencies = [
4515 "getrandom 0.3.4",
4516 "js-sys",
4517 "serde",
4518 "sha1_smol",
4519 "wasm-bindgen",
4520]
4521
4522[[package]]
4523name = "v_frame"
4524version = "0.3.9"
4525source = "registry+https://github.com/rust-lang/crates.io-index"
4526checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"
4527dependencies = [
4528 "aligned-vec",
4529 "num-traits",
4530 "wasm-bindgen",
4531]
4532
4533[[package]]
4534name = "valuable"
4535version = "0.1.1"
4536source = "registry+https://github.com/rust-lang/crates.io-index"
4537checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
4538
4539[[package]]
4540name = "value-bag"
4541version = "1.12.0"
4542source = "registry+https://github.com/rust-lang/crates.io-index"
4543checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0"
4544dependencies = [
4545 "value-bag-serde1",
4546 "value-bag-sval2",
4547]
4548
4549[[package]]
4550name = "value-bag-serde1"
4551version = "1.12.0"
4552source = "registry+https://github.com/rust-lang/crates.io-index"
4553checksum = "16530907bfe2999a1773ca5900a65101e092c70f642f25cc23ca0c43573262c5"
4554dependencies = [
4555 "erased-serde",
4556 "serde_core",
4557 "serde_fmt",
4558]
4559
4560[[package]]
4561name = "value-bag-sval2"
4562version = "1.12.0"
4563source = "registry+https://github.com/rust-lang/crates.io-index"
4564checksum = "d00ae130edd690eaa877e4f40605d534790d1cf1d651e7685bd6a144521b251f"
4565dependencies = [
4566 "sval",
4567 "sval_buffer",
4568 "sval_dynamic",
4569 "sval_fmt",
4570 "sval_json",
4571 "sval_ref",
4572 "sval_serde",
4573]
4574
4575[[package]]
4576name = "version_check"
4577version = "0.9.5"
4578source = "registry+https://github.com/rust-lang/crates.io-index"
4579checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
4580
4581[[package]]
4582name = "wait-timeout"
4583version = "0.2.1"
4584source = "registry+https://github.com/rust-lang/crates.io-index"
4585checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"
4586dependencies = [
4587 "libc",
4588]
4589
4590[[package]]
4591name = "waker-fn"
4592version = "1.2.0"
4593source = "registry+https://github.com/rust-lang/crates.io-index"
4594checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7"
4595
4596[[package]]
4597name = "walkdir"
4598version = "2.5.0"
4599source = "registry+https://github.com/rust-lang/crates.io-index"
4600checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
4601dependencies = [
4602 "same-file",
4603 "winapi-util",
4604]
4605
4606[[package]]
4607name = "wasi"
4608version = "0.11.1+wasi-snapshot-preview1"
4609source = "registry+https://github.com/rust-lang/crates.io-index"
4610checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
4611
4612[[package]]
4613name = "wasip2"
4614version = "1.0.1+wasi-0.2.4"
4615source = "registry+https://github.com/rust-lang/crates.io-index"
4616checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"
4617dependencies = [
4618 "wit-bindgen 0.46.0",
4619]
4620
4621[[package]]
4622name = "wasip3"
4623version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
4624source = "registry+https://github.com/rust-lang/crates.io-index"
4625checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
4626dependencies = [
4627 "wit-bindgen 0.51.0",
4628]
4629
4630[[package]]
4631name = "wasm-bindgen"
4632version = "0.2.120"
4633source = "registry+https://github.com/rust-lang/crates.io-index"
4634checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1"
4635dependencies = [
4636 "cfg-if",
4637 "once_cell",
4638 "rustversion",
4639 "wasm-bindgen-macro",
4640 "wasm-bindgen-shared",
4641]
4642
4643[[package]]
4644name = "wasm-bindgen-futures"
4645version = "0.4.70"
4646source = "registry+https://github.com/rust-lang/crates.io-index"
4647checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084"
4648dependencies = [
4649 "js-sys",
4650 "wasm-bindgen",
4651]
4652
4653[[package]]
4654name = "wasm-bindgen-macro"
4655version = "0.2.120"
4656source = "registry+https://github.com/rust-lang/crates.io-index"
4657checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103"
4658dependencies = [
4659 "quote",
4660 "wasm-bindgen-macro-support",
4661]
4662
4663[[package]]
4664name = "wasm-bindgen-macro-support"
4665version = "0.2.120"
4666source = "registry+https://github.com/rust-lang/crates.io-index"
4667checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41"
4668dependencies = [
4669 "bumpalo",
4670 "proc-macro2",
4671 "quote",
4672 "syn 2.0.117",
4673 "wasm-bindgen-shared",
4674]
4675
4676[[package]]
4677name = "wasm-bindgen-shared"
4678version = "0.2.120"
4679source = "registry+https://github.com/rust-lang/crates.io-index"
4680checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea"
4681dependencies = [
4682 "unicode-ident",
4683]
4684
4685[[package]]
4686name = "wasm-encoder"
4687version = "0.244.0"
4688source = "registry+https://github.com/rust-lang/crates.io-index"
4689checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319"
4690dependencies = [
4691 "leb128fmt",
4692 "wasmparser",
4693]
4694
4695[[package]]
4696name = "wasm-metadata"
4697version = "0.244.0"
4698source = "registry+https://github.com/rust-lang/crates.io-index"
4699checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909"
4700dependencies = [
4701 "anyhow",
4702 "indexmap",
4703 "wasm-encoder",
4704 "wasmparser",
4705]
4706
4707[[package]]
4708name = "wasmparser"
4709version = "0.244.0"
4710source = "registry+https://github.com/rust-lang/crates.io-index"
4711checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe"
4712dependencies = [
4713 "bitflags 2.13.1",
4714 "hashbrown 0.15.5",
4715 "indexmap",
4716 "semver",
4717]
4718
4719[[package]]
4720name = "wayland-sys"
4721version = "0.31.11"
4722source = "registry+https://github.com/rust-lang/crates.io-index"
4723checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be"
4724dependencies = [
4725 "dlib",
4726 "log",
4727 "once_cell",
4728 "pkg-config",
4729]
4730
4731[[package]]
4732name = "web-sys"
4733version = "0.3.97"
4734source = "registry+https://github.com/rust-lang/crates.io-index"
4735checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602"
4736dependencies = [
4737 "js-sys",
4738 "wasm-bindgen",
4739]
4740
4741[[package]]
4742name = "web-time"
4743version = "1.1.0"
4744source = "registry+https://github.com/rust-lang/crates.io-index"
4745checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
4746dependencies = [
4747 "js-sys",
4748 "wasm-bindgen",
4749]
4750
4751[[package]]
4752name = "weezl"
4753version = "0.1.10"
4754source = "registry+https://github.com/rust-lang/crates.io-index"
4755checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3"
4756
4757[[package]]
4758name = "wgpu"
4759version = "29.0.4"
4760source = "registry+https://github.com/rust-lang/crates.io-index"
4761checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07"
4762dependencies = [
4763 "arrayvec",
4764 "bitflags 2.13.1",
4765 "bytemuck",
4766 "cfg-if",
4767 "cfg_aliases",
4768 "document-features",
4769 "hashbrown 0.16.1",
4770 "js-sys",
4771 "log",
4772 "naga",
4773 "parking_lot",
4774 "portable-atomic",
4775 "profiling",
4776 "raw-window-handle",
4777 "smallvec",
4778 "static_assertions",
4779 "wasm-bindgen",
4780 "wasm-bindgen-futures",
4781 "web-sys",
4782 "wgpu-core",
4783 "wgpu-hal",
4784 "wgpu-types",
4785]
4786
4787[[package]]
4788name = "wgpu-core"
4789version = "29.0.4"
4790source = "registry+https://github.com/rust-lang/crates.io-index"
4791checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7"
4792dependencies = [
4793 "arrayvec",
4794 "bit-set 0.9.1",
4795 "bit-vec 0.9.1",
4796 "bitflags 2.13.1",
4797 "bytemuck",
4798 "cfg_aliases",
4799 "document-features",
4800 "hashbrown 0.16.1",
4801 "indexmap",
4802 "log",
4803 "naga",
4804 "once_cell",
4805 "parking_lot",
4806 "portable-atomic",
4807 "profiling",
4808 "raw-window-handle",
4809 "rustc-hash 1.1.0",
4810 "smallvec",
4811 "thiserror 2.0.17",
4812 "wgpu-core-deps-apple",
4813 "wgpu-core-deps-emscripten",
4814 "wgpu-core-deps-wasm",
4815 "wgpu-core-deps-windows-linux-android",
4816 "wgpu-hal",
4817 "wgpu-naga-bridge",
4818 "wgpu-types",
4819]
4820
4821[[package]]
4822name = "wgpu-core-deps-apple"
4823version = "29.0.4"
4824source = "registry+https://github.com/rust-lang/crates.io-index"
4825checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3"
4826dependencies = [
4827 "wgpu-hal",
4828]
4829
4830[[package]]
4831name = "wgpu-core-deps-emscripten"
4832version = "29.0.4"
4833source = "registry+https://github.com/rust-lang/crates.io-index"
4834checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af"
4835dependencies = [
4836 "wgpu-hal",
4837]
4838
4839[[package]]
4840name = "wgpu-core-deps-wasm"
4841version = "29.0.4"
4842source = "registry+https://github.com/rust-lang/crates.io-index"
4843checksum = "af1fb1798be2a912497d4c224f72d39bb0cb34af50e8bcc29865bc339c943059"
4844dependencies = [
4845 "wgpu-hal",
4846]
4847
4848[[package]]
4849name = "wgpu-core-deps-windows-linux-android"
4850version = "29.0.4"
4851source = "registry+https://github.com/rust-lang/crates.io-index"
4852checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257"
4853dependencies = [
4854 "wgpu-hal",
4855]
4856
4857[[package]]
4858name = "wgpu-hal"
4859version = "29.0.4"
4860source = "registry+https://github.com/rust-lang/crates.io-index"
4861checksum = "97ace1c17727311c22a46e4e3faf56ea6de81af99dcc839bdfb54857b94d448d"
4862dependencies = [
4863 "android_system_properties",
4864 "arrayvec",
4865 "ash",
4866 "bit-set 0.9.1",
4867 "bitflags 2.13.1",
4868 "block2",
4869 "bytemuck",
4870 "cfg-if",
4871 "cfg_aliases",
4872 "glow",
4873 "glutin_wgl_sys",
4874 "gpu-allocator",
4875 "gpu-descriptor",
4876 "hashbrown 0.16.1",
4877 "js-sys",
4878 "khronos-egl",
4879 "libc",
4880 "libloading",
4881 "log",
4882 "naga",
4883 "ndk-sys",
4884 "objc2",
4885 "objc2-core-foundation",
4886 "objc2-foundation",
4887 "objc2-metal",
4888 "objc2-quartz-core",
4889 "once_cell",
4890 "ordered-float",
4891 "parking_lot",
4892 "portable-atomic",
4893 "portable-atomic-util",
4894 "profiling",
4895 "range-alloc",
4896 "raw-window-handle",
4897 "raw-window-metal",
4898 "renderdoc-sys",
4899 "smallvec",
4900 "thiserror 2.0.17",
4901 "wasm-bindgen",
4902 "wayland-sys",
4903 "web-sys",
4904 "wgpu-naga-bridge",
4905 "wgpu-types",
4906 "windows 0.62.2",
4907 "windows-core 0.62.2",
4908 "windows-result 0.4.1",
4909]
4910
4911[[package]]
4912name = "wgpu-naga-bridge"
4913version = "29.0.4"
4914source = "registry+https://github.com/rust-lang/crates.io-index"
4915checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161"
4916dependencies = [
4917 "naga",
4918 "wgpu-types",
4919]
4920
4921[[package]]
4922name = "wgpu-types"
4923version = "29.0.4"
4924source = "registry+https://github.com/rust-lang/crates.io-index"
4925checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5"
4926dependencies = [
4927 "bitflags 2.13.1",
4928 "bytemuck",
4929 "js-sys",
4930 "log",
4931 "raw-window-handle",
4932 "web-sys",
4933]
4934
4935[[package]]
4936name = "which"
4937version = "8.0.5"
4938source = "registry+https://github.com/rust-lang/crates.io-index"
4939checksum = "8f3ef584124b911bcc3875c2f1472e80f24361ceb789bd1c62b3e9a3df9ff43c"
4940dependencies = [
4941 "libc",
4942]
4943
4944[[package]]
4945name = "winapi"
4946version = "0.3.9"
4947source = "registry+https://github.com/rust-lang/crates.io-index"
4948checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
4949dependencies = [
4950 "winapi-i686-pc-windows-gnu",
4951 "winapi-x86_64-pc-windows-gnu",
4952]
4953
4954[[package]]
4955name = "winapi-i686-pc-windows-gnu"
4956version = "0.4.0"
4957source = "registry+https://github.com/rust-lang/crates.io-index"
4958checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
4959
4960[[package]]
4961name = "winapi-util"
4962version = "0.1.11"
4963source = "registry+https://github.com/rust-lang/crates.io-index"
4964checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
4965dependencies = [
4966 "windows-sys 0.61.2",
4967]
4968
4969[[package]]
4970name = "winapi-x86_64-pc-windows-gnu"
4971version = "0.4.0"
4972source = "registry+https://github.com/rust-lang/crates.io-index"
4973checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
4974
4975[[package]]
4976name = "windows"
4977version = "0.57.0"
4978source = "registry+https://github.com/rust-lang/crates.io-index"
4979checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
4980dependencies = [
4981 "windows-core 0.57.0",
4982 "windows-targets 0.52.6",
4983]
4984
4985[[package]]
4986name = "windows"
4987version = "0.61.3"
4988source = "registry+https://github.com/rust-lang/crates.io-index"
4989checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
4990dependencies = [
4991 "windows-collections 0.2.0",
4992 "windows-core 0.61.2",
4993 "windows-future 0.2.1",
4994 "windows-link 0.1.3",
4995 "windows-numerics 0.2.0",
4996]
4997
4998[[package]]
4999name = "windows"
5000version = "0.62.2"
5001source = "registry+https://github.com/rust-lang/crates.io-index"
5002checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
5003dependencies = [
5004 "windows-collections 0.3.2",
5005 "windows-core 0.62.2",
5006 "windows-future 0.3.2",
5007 "windows-numerics 0.3.1",
5008]
5009
5010[[package]]
5011name = "windows-capture"
5012version = "1.5.0"
5013source = "registry+https://github.com/rust-lang/crates.io-index"
5014checksum = "3a4df73e95feddb9ec1a7e9c2ca6323b8c97d5eeeff78d28f1eccdf19c882b24"
5015dependencies = [
5016 "parking_lot",
5017 "rayon",
5018 "thiserror 2.0.17",
5019 "windows 0.61.3",
5020 "windows-future 0.2.1",
5021]
5022
5023[[package]]
5024name = "windows-collections"
5025version = "0.2.0"
5026source = "registry+https://github.com/rust-lang/crates.io-index"
5027checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
5028dependencies = [
5029 "windows-core 0.61.2",
5030]
5031
5032[[package]]
5033name = "windows-collections"
5034version = "0.3.2"
5035source = "registry+https://github.com/rust-lang/crates.io-index"
5036checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
5037dependencies = [
5038 "windows-core 0.62.2",
5039]
5040
5041[[package]]
5042name = "windows-core"
5043version = "0.57.0"
5044source = "registry+https://github.com/rust-lang/crates.io-index"
5045checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
5046dependencies = [
5047 "windows-implement 0.57.0",
5048 "windows-interface 0.57.0",
5049 "windows-result 0.1.2",
5050 "windows-targets 0.52.6",
5051]
5052
5053[[package]]
5054name = "windows-core"
5055version = "0.61.2"
5056source = "registry+https://github.com/rust-lang/crates.io-index"
5057checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
5058dependencies = [
5059 "windows-implement 0.60.2",
5060 "windows-interface 0.59.3",
5061 "windows-link 0.1.3",
5062 "windows-result 0.3.4",
5063 "windows-strings 0.4.2",
5064]
5065
5066[[package]]
5067name = "windows-core"
5068version = "0.62.2"
5069source = "registry+https://github.com/rust-lang/crates.io-index"
5070checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
5071dependencies = [
5072 "windows-implement 0.60.2",
5073 "windows-interface 0.59.3",
5074 "windows-link 0.2.1",
5075 "windows-result 0.4.1",
5076 "windows-strings 0.5.1",
5077]
5078
5079[[package]]
5080name = "windows-future"
5081version = "0.2.1"
5082source = "registry+https://github.com/rust-lang/crates.io-index"
5083checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
5084dependencies = [
5085 "windows-core 0.61.2",
5086 "windows-link 0.1.3",
5087 "windows-threading 0.1.0",
5088]
5089
5090[[package]]
5091name = "windows-future"
5092version = "0.3.2"
5093source = "registry+https://github.com/rust-lang/crates.io-index"
5094checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
5095dependencies = [
5096 "windows-core 0.62.2",
5097 "windows-link 0.2.1",
5098 "windows-threading 0.2.1",
5099]
5100
5101[[package]]
5102name = "windows-implement"
5103version = "0.57.0"
5104source = "registry+https://github.com/rust-lang/crates.io-index"
5105checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
5106dependencies = [
5107 "proc-macro2",
5108 "quote",
5109 "syn 2.0.117",
5110]
5111
5112[[package]]
5113name = "windows-implement"
5114version = "0.60.2"
5115source = "registry+https://github.com/rust-lang/crates.io-index"
5116checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
5117dependencies = [
5118 "proc-macro2",
5119 "quote",
5120 "syn 2.0.117",
5121]
5122
5123[[package]]
5124name = "windows-interface"
5125version = "0.57.0"
5126source = "registry+https://github.com/rust-lang/crates.io-index"
5127checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
5128dependencies = [
5129 "proc-macro2",
5130 "quote",
5131 "syn 2.0.117",
5132]
5133
5134[[package]]
5135name = "windows-interface"
5136version = "0.59.3"
5137source = "registry+https://github.com/rust-lang/crates.io-index"
5138checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
5139dependencies = [
5140 "proc-macro2",
5141 "quote",
5142 "syn 2.0.117",
5143]
5144
5145[[package]]
5146name = "windows-link"
5147version = "0.1.3"
5148source = "registry+https://github.com/rust-lang/crates.io-index"
5149checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
5150
5151[[package]]
5152name = "windows-link"
5153version = "0.2.1"
5154source = "registry+https://github.com/rust-lang/crates.io-index"
5155checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
5156
5157[[package]]
5158name = "windows-numerics"
5159version = "0.2.0"
5160source = "registry+https://github.com/rust-lang/crates.io-index"
5161checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
5162dependencies = [
5163 "windows-core 0.61.2",
5164 "windows-link 0.1.3",
5165]
5166
5167[[package]]
5168name = "windows-numerics"
5169version = "0.3.1"
5170source = "registry+https://github.com/rust-lang/crates.io-index"
5171checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
5172dependencies = [
5173 "windows-core 0.62.2",
5174 "windows-link 0.2.1",
5175]
5176
5177[[package]]
5178name = "windows-result"
5179version = "0.1.2"
5180source = "registry+https://github.com/rust-lang/crates.io-index"
5181checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
5182dependencies = [
5183 "windows-targets 0.52.6",
5184]
5185
5186[[package]]
5187name = "windows-result"
5188version = "0.3.4"
5189source = "registry+https://github.com/rust-lang/crates.io-index"
5190checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
5191dependencies = [
5192 "windows-link 0.1.3",
5193]
5194
5195[[package]]
5196name = "windows-result"
5197version = "0.4.1"
5198source = "registry+https://github.com/rust-lang/crates.io-index"
5199checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
5200dependencies = [
5201 "windows-link 0.2.1",
5202]
5203
5204[[package]]
5205name = "windows-strings"
5206version = "0.4.2"
5207source = "registry+https://github.com/rust-lang/crates.io-index"
5208checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
5209dependencies = [
5210 "windows-link 0.1.3",
5211]
5212
5213[[package]]
5214name = "windows-strings"
5215version = "0.5.1"
5216source = "registry+https://github.com/rust-lang/crates.io-index"
5217checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
5218dependencies = [
5219 "windows-link 0.2.1",
5220]
5221
5222[[package]]
5223name = "windows-sys"
5224version = "0.48.0"
5225source = "registry+https://github.com/rust-lang/crates.io-index"
5226checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
5227dependencies = [
5228 "windows-targets 0.48.5",
5229]
5230
5231[[package]]
5232name = "windows-sys"
5233version = "0.61.2"
5234source = "registry+https://github.com/rust-lang/crates.io-index"
5235checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
5236dependencies = [
5237 "windows-link 0.2.1",
5238]
5239
5240[[package]]
5241name = "windows-targets"
5242version = "0.48.5"
5243source = "registry+https://github.com/rust-lang/crates.io-index"
5244checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
5245dependencies = [
5246 "windows_aarch64_gnullvm 0.48.5",
5247 "windows_aarch64_msvc 0.48.5",
5248 "windows_i686_gnu 0.48.5",
5249 "windows_i686_msvc 0.48.5",
5250 "windows_x86_64_gnu 0.48.5",
5251 "windows_x86_64_gnullvm 0.48.5",
5252 "windows_x86_64_msvc 0.48.5",
5253]
5254
5255[[package]]
5256name = "windows-targets"
5257version = "0.52.6"
5258source = "registry+https://github.com/rust-lang/crates.io-index"
5259checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
5260dependencies = [
5261 "windows_aarch64_gnullvm 0.52.6",
5262 "windows_aarch64_msvc 0.52.6",
5263 "windows_i686_gnu 0.52.6",
5264 "windows_i686_gnullvm",
5265 "windows_i686_msvc 0.52.6",
5266 "windows_x86_64_gnu 0.52.6",
5267 "windows_x86_64_gnullvm 0.52.6",
5268 "windows_x86_64_msvc 0.52.6",
5269]
5270
5271[[package]]
5272name = "windows-threading"
5273version = "0.1.0"
5274source = "registry+https://github.com/rust-lang/crates.io-index"
5275checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
5276dependencies = [
5277 "windows-link 0.1.3",
5278]
5279
5280[[package]]
5281name = "windows-threading"
5282version = "0.2.1"
5283source = "registry+https://github.com/rust-lang/crates.io-index"
5284checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
5285dependencies = [
5286 "windows-link 0.2.1",
5287]
5288
5289[[package]]
5290name = "windows_aarch64_gnullvm"
5291version = "0.48.5"
5292source = "registry+https://github.com/rust-lang/crates.io-index"
5293checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
5294
5295[[package]]
5296name = "windows_aarch64_gnullvm"
5297version = "0.52.6"
5298source = "registry+https://github.com/rust-lang/crates.io-index"
5299checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
5300
5301[[package]]
5302name = "windows_aarch64_msvc"
5303version = "0.48.5"
5304source = "registry+https://github.com/rust-lang/crates.io-index"
5305checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
5306
5307[[package]]
5308name = "windows_aarch64_msvc"
5309version = "0.52.6"
5310source = "registry+https://github.com/rust-lang/crates.io-index"
5311checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
5312
5313[[package]]
5314name = "windows_i686_gnu"
5315version = "0.48.5"
5316source = "registry+https://github.com/rust-lang/crates.io-index"
5317checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
5318
5319[[package]]
5320name = "windows_i686_gnu"
5321version = "0.52.6"
5322source = "registry+https://github.com/rust-lang/crates.io-index"
5323checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
5324
5325[[package]]
5326name = "windows_i686_gnullvm"
5327version = "0.52.6"
5328source = "registry+https://github.com/rust-lang/crates.io-index"
5329checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
5330
5331[[package]]
5332name = "windows_i686_msvc"
5333version = "0.48.5"
5334source = "registry+https://github.com/rust-lang/crates.io-index"
5335checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
5336
5337[[package]]
5338name = "windows_i686_msvc"
5339version = "0.52.6"
5340source = "registry+https://github.com/rust-lang/crates.io-index"
5341checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
5342
5343[[package]]
5344name = "windows_x86_64_gnu"
5345version = "0.48.5"
5346source = "registry+https://github.com/rust-lang/crates.io-index"
5347checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
5348
5349[[package]]
5350name = "windows_x86_64_gnu"
5351version = "0.52.6"
5352source = "registry+https://github.com/rust-lang/crates.io-index"
5353checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
5354
5355[[package]]
5356name = "windows_x86_64_gnullvm"
5357version = "0.48.5"
5358source = "registry+https://github.com/rust-lang/crates.io-index"
5359checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
5360
5361[[package]]
5362name = "windows_x86_64_gnullvm"
5363version = "0.52.6"
5364source = "registry+https://github.com/rust-lang/crates.io-index"
5365checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
5366
5367[[package]]
5368name = "windows_x86_64_msvc"
5369version = "0.48.5"
5370source = "registry+https://github.com/rust-lang/crates.io-index"
5371checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
5372
5373[[package]]
5374name = "windows_x86_64_msvc"
5375version = "0.52.6"
5376source = "registry+https://github.com/rust-lang/crates.io-index"
5377checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
5378
5379[[package]]
5380name = "winnow"
5381version = "0.7.13"
5382source = "registry+https://github.com/rust-lang/crates.io-index"
5383checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf"
5384dependencies = [
5385 "memchr",
5386]
5387
5388[[package]]
5389name = "wio"
5390version = "0.2.2"
5391source = "registry+https://github.com/rust-lang/crates.io-index"
5392checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"
5393dependencies = [
5394 "winapi",
5395]
5396
5397[[package]]
5398name = "wit-bindgen"
5399version = "0.46.0"
5400source = "registry+https://github.com/rust-lang/crates.io-index"
5401checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
5402
5403[[package]]
5404name = "wit-bindgen"
5405version = "0.51.0"
5406source = "registry+https://github.com/rust-lang/crates.io-index"
5407checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"
5408dependencies = [
5409 "wit-bindgen-rust-macro",
5410]
5411
5412[[package]]
5413name = "wit-bindgen-core"
5414version = "0.51.0"
5415source = "registry+https://github.com/rust-lang/crates.io-index"
5416checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
5417dependencies = [
5418 "anyhow",
5419 "heck",
5420 "wit-parser",
5421]
5422
5423[[package]]
5424name = "wit-bindgen-rust"
5425version = "0.51.0"
5426source = "registry+https://github.com/rust-lang/crates.io-index"
5427checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
5428dependencies = [
5429 "anyhow",
5430 "heck",
5431 "indexmap",
5432 "prettyplease",
5433 "syn 2.0.117",
5434 "wasm-metadata",
5435 "wit-bindgen-core",
5436 "wit-component",
5437]
5438
5439[[package]]
5440name = "wit-bindgen-rust-macro"
5441version = "0.51.0"
5442source = "registry+https://github.com/rust-lang/crates.io-index"
5443checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a"
5444dependencies = [
5445 "anyhow",
5446 "prettyplease",
5447 "proc-macro2",
5448 "quote",
5449 "syn 2.0.117",
5450 "wit-bindgen-core",
5451 "wit-bindgen-rust",
5452]
5453
5454[[package]]
5455name = "wit-component"
5456version = "0.244.0"
5457source = "registry+https://github.com/rust-lang/crates.io-index"
5458checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2"
5459dependencies = [
5460 "anyhow",
5461 "bitflags 2.13.1",
5462 "indexmap",
5463 "log",
5464 "serde",
5465 "serde_derive",
5466 "serde_json",
5467 "wasm-encoder",
5468 "wasm-metadata",
5469 "wasmparser",
5470 "wit-parser",
5471]
5472
5473[[package]]
5474name = "wit-parser"
5475version = "0.244.0"
5476source = "registry+https://github.com/rust-lang/crates.io-index"
5477checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736"
5478dependencies = [
5479 "anyhow",
5480 "id-arena",
5481 "indexmap",
5482 "log",
5483 "semver",
5484 "serde",
5485 "serde_derive",
5486 "serde_json",
5487 "unicode-xid",
5488 "wasmparser",
5489]
5490
5491[[package]]
5492name = "writeable"
5493version = "0.6.4"
5494source = "registry+https://github.com/rust-lang/crates.io-index"
5495checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"
5496
5497[[package]]
5498name = "x11"
5499version = "2.21.0"
5500source = "registry+https://github.com/rust-lang/crates.io-index"
5501checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e"
5502dependencies = [
5503 "libc",
5504 "pkg-config",
5505]
5506
5507[[package]]
5508name = "xcb"
5509version = "1.6.0"
5510source = "registry+https://github.com/rust-lang/crates.io-index"
5511checksum = "f07c123b796139bfe0603e654eaf08e132e52387ba95b252c78bad3640ba37ea"
5512dependencies = [
5513 "bitflags 1.3.2",
5514 "libc",
5515 "quick-xml",
5516 "x11",
5517]
5518
5519[[package]]
5520name = "xml-rs"
5521version = "0.8.28"
5522source = "registry+https://github.com/rust-lang/crates.io-index"
5523checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"
5524
5525[[package]]
5526name = "xmlwriter"
5527version = "0.1.0"
5528source = "registry+https://github.com/rust-lang/crates.io-index"
5529checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
5530
5531[[package]]
5532name = "y4m"
5533version = "0.8.0"
5534source = "registry+https://github.com/rust-lang/crates.io-index"
5535checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
5536
5537[[package]]
5538name = "yazi"
5539version = "0.2.1"
5540source = "registry+https://github.com/rust-lang/crates.io-index"
5541checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5"
5542
5543[[package]]
5544name = "yeslogic-fontconfig-sys"
5545version = "6.0.0"
5546source = "registry+https://github.com/rust-lang/crates.io-index"
5547checksum = "503a066b4c037c440169d995b869046827dbc71263f6e8f3be6d77d4f3229dbd"
5548dependencies = [
5549 "dlib",
5550 "once_cell",
5551 "pkg-config",
5552]
5553
5554[[package]]
5555name = "yoke"
5556version = "0.8.3"
5557source = "registry+https://github.com/rust-lang/crates.io-index"
5558checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5"
5559dependencies = [
5560 "stable_deref_trait",
5561 "yoke-derive",
5562 "zerofrom",
5563]
5564
5565[[package]]
5566name = "yoke-derive"
5567version = "0.8.2"
5568source = "registry+https://github.com/rust-lang/crates.io-index"
5569checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
5570dependencies = [
5571 "proc-macro2",
5572 "quote",
5573 "syn 2.0.117",
5574 "synstructure",
5575]
5576
5577[[package]]
5578name = "zed-font-kit"
5579version = "0.14.1-zed"
5580source = "registry+https://github.com/rust-lang/crates.io-index"
5581checksum = "a3898e450f36f852edda72e3f985c34426042c4951790b23b107f93394f9bff5"
5582dependencies = [
5583 "bitflags 2.13.1",
5584 "byteorder",
5585 "core-foundation 0.10.0",
5586 "core-graphics 0.24.0",
5587 "core-text",
5588 "dirs",
5589 "dwrote",
5590 "float-ord",
5591 "freetype-sys",
5592 "lazy_static",
5593 "libc",
5594 "log",
5595 "pathfinder_geometry",
5596 "pathfinder_simd",
5597 "walkdir",
5598 "winapi",
5599 "yeslogic-fontconfig-sys",
5600]
5601
5602[[package]]
5603name = "zed-scap"
5604version = "0.0.8-zed"
5605source = "registry+https://github.com/rust-lang/crates.io-index"
5606checksum = "b6b338d705ae33a43ca00287c11129303a7a0aa57b101b72a1c08c863f698ac8"
5607dependencies = [
5608 "anyhow",
5609 "cocoa",
5610 "core-graphics-helmer-fork",
5611 "log",
5612 "objc",
5613 "rand 0.8.6",
5614 "screencapturekit",
5615 "screencapturekit-sys",
5616 "sysinfo",
5617 "tao-core-video-sys",
5618 "windows 0.61.3",
5619 "windows-capture",
5620 "x11",
5621 "xcb",
5622]
5623
5624[[package]]
5625name = "zeno"
5626version = "0.3.3"
5627source = "registry+https://github.com/rust-lang/crates.io-index"
5628checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
5629
5630[[package]]
5631name = "zerocopy"
5632version = "0.8.27"
5633source = "registry+https://github.com/rust-lang/crates.io-index"
5634checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
5635dependencies = [
5636 "zerocopy-derive",
5637]
5638
5639[[package]]
5640name = "zerocopy-derive"
5641version = "0.8.27"
5642source = "registry+https://github.com/rust-lang/crates.io-index"
5643checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
5644dependencies = [
5645 "proc-macro2",
5646 "quote",
5647 "syn 2.0.117",
5648]
5649
5650[[package]]
5651name = "zerofrom"
5652version = "0.1.6"
5653source = "registry+https://github.com/rust-lang/crates.io-index"
5654checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
5655dependencies = [
5656 "zerofrom-derive",
5657]
5658
5659[[package]]
5660name = "zerofrom-derive"
5661version = "0.1.6"
5662source = "registry+https://github.com/rust-lang/crates.io-index"
5663checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
5664dependencies = [
5665 "proc-macro2",
5666 "quote",
5667 "syn 2.0.117",
5668 "synstructure",
5669]
5670
5671[[package]]
5672name = "zerotrie"
5673version = "0.2.5"
5674source = "registry+https://github.com/rust-lang/crates.io-index"
5675checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"
5676dependencies = [
5677 "displaydoc",
5678 "yoke",
5679 "zerofrom",
5680]
5681
5682[[package]]
5683name = "zerovec"
5684version = "0.11.8"
5685source = "registry+https://github.com/rust-lang/crates.io-index"
5686checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8"
5687dependencies = [
5688 "yoke",
5689 "zerofrom",
5690 "zerovec-derive",
5691]
5692
5693[[package]]
5694name = "zerovec-derive"
5695version = "0.11.5"
5696source = "registry+https://github.com/rust-lang/crates.io-index"
5697checksum = "9f212a141d820099d57ffafb9569be9617a6f27d3dc881fbee8fb56642f917a9"
5698dependencies = [
5699 "proc-macro2",
5700 "quote",
5701 "syn 3.0.3",
5702]
5703
5704[[package]]
5705name = "zmij"
5706version = "1.0.23"
5707source = "registry+https://github.com/rust-lang/crates.io-index"
5708checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
5709
5710[[package]]
5711name = "zune-core"
5712version = "0.5.1"
5713source = "registry+https://github.com/rust-lang/crates.io-index"
5714checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9"
5715
5716[[package]]
5717name = "zune-inflate"
5718version = "0.2.54"
5719source = "registry+https://github.com/rust-lang/crates.io-index"
5720checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
5721dependencies = [
5722 "simd-adler32",
5723]
5724
5725[[package]]
5726name = "zune-jpeg"
5727version = "0.5.15"
5728source = "registry+https://github.com/rust-lang/crates.io-index"
5729checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"
5730dependencies = [
5731 "zune-core",
5732]
vendor/gpui-pre-wgpu/Cargo.toml added +175 −0
@@ -0,0 +1,175 @@
1 # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
2 #
3 # When uploading crates to the registry Cargo will automatically
4 # "normalize" Cargo.toml files for maximal compatibility
5 # with all versions of Cargo and also rewrite `path` dependencies
6 # to registry (e.g., crates.io) dependencies.
7 #
8 # If you are reading this file be aware that the original Cargo.toml
9 # will likely look very different (and much more reasonable).
10 # See Cargo.toml.orig for the original contents.
11
12 [package]
13 edition = "2024"
14 name = "gpui-pre-wgpu"
15 version = "0.3.8"
16 build = false
17 publish = true
18 autolib = false
19 autobins = false
20 autoexamples = false
21 autotests = false
22 autobenches = false
23 description = "Zed's `gpui_wgpu` crate (gpui-pre snapshot of zed@279fe07)"
24 readme = false
25 license = "Apache-2.0"
26 repository = "https://github.com/zed-industries/zed"
27 resolver = "2"
28
29 [package.metadata.gpui-pre]
30 zed-crate = "gpui_wgpu"
31 zed-version = "0.1.0"
32 zed-rev = "279fe070bb389b79652e52065b2f001edcc0b11b"
33
34 [features]
35 bench-support = [
36 "gpui/bench-support",
37 "dep:image",
38 ]
39 default = []
40 font-kit = ["dep:font-kit"]
41 test-support = [
42 "gpui/test-support",
43 "dep:image",
44 ]
45
46 [lib]
47 name = "gpui_wgpu"
48 path = "src/gpui_wgpu.rs"
49 doctest = false
50
51 [[bench]]
52 name = "layout_line"
53 path = "benches/layout_line.rs"
54 harness = false
55
56 [dependencies.anyhow]
57 version = "1.0.86"
58
59 [dependencies.bytemuck]
60 version = "1"
61
62 [dependencies.collections]
63 version = "=0.3.8"
64 package = "gpui-pre-collections"
65
66 [dependencies.cosmic-text]
67 version = "0.19.0"
68
69 [dependencies.etagere]
70 version = "0.2"
71
72 [dependencies.font-kit]
73 version = "0.14.1-zed"
74 optional = true
75 package = "zed-font-kit"
76
77 [dependencies.gpui]
78 version = "=0.3.8"
79 default-features = false
80 package = "gpui-pre"
81
82 [dependencies.gpui_util]
83 version = "=0.3.8"
84 package = "gpui-pre-util"
85
86 [dependencies.image]
87 version = "0.25.1"
88 features = [
89 "bmp",
90 "dds",
91 "exr",
92 "ff",
93 "gif",
94 "hdr",
95 "ico",
96 "jpeg",
97 "png",
98 "pnm",
99 "qoi",
100 "rayon",
101 "tga",
102 "tiff",
103 "webp",
104 ]
105 optional = true
106 default-features = false
107
108 [dependencies.itertools]
109 version = "0.14.0"
110
111 [dependencies.log]
112 version = "0.4.16"
113 features = [
114 "kv_unstable_serde",
115 "serde",
116 ]
117
118 [dependencies.parking_lot]
119 version = "0.12.1"
120
121 [dependencies.profiling]
122 version = "1"
123
124 [dependencies.raw-window-handle]
125 version = "0.6"
126
127 [dependencies.smallvec]
128 version = "1.6"
129 features = [
130 "union",
131 "const_new",
132 ]
133
134 [dependencies.swash]
135 version = "0.2.6"
136
137 [dependencies.unicode-bidi]
138 version = "0.3.18"
139 features = ["hardcoded-data"]
140 default-features = false
141
142 [dependencies.unicode-segmentation]
143 version = "1.10"
144
145 [dependencies.wgpu]
146 version = "29.0.4"
147
148 [target.'cfg(target_family = "wasm")'.dependencies.web-sys]
149 version = "0.3"
150 features = ["HtmlCanvasElement"]
151
152 [target.'cfg(target_family = "wasm")'.dependencies.wgpu]
153 version = "29.0.4"
154 features = ["webgl"]
155
156 [lints.clippy]
157 dbg_macro = "deny"
158 declare_interior_mutable_const = "deny"
159 disallowed_methods = "deny"
160 large_enum_variant = "allow"
161 let_underscore_future = "allow"
162 nonminimal_bool = "allow"
163 redundant_clone = "deny"
164 single_range_in_vec_init = "allow"
165 todo = "deny"
166 too_many_arguments = "allow"
167 type_complexity = "allow"
168
169 [lints.clippy.style]
170 level = "allow"
171 priority = -1
172
173 [lints.rust.unexpected_cfgs]
174 level = "allow"
175 priority = 0
@@ -0,0 +1,175 @@
1# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
2#
3# When uploading crates to the registry Cargo will automatically
4# "normalize" Cargo.toml files for maximal compatibility
5# with all versions of Cargo and also rewrite `path` dependencies
6# to registry (e.g., crates.io) dependencies.
7#
8# If you are reading this file be aware that the original Cargo.toml
9# will likely look very different (and much more reasonable).
10# See Cargo.toml.orig for the original contents.
11
12[package]
13edition = "2024"
14name = "gpui-pre-wgpu"
15version = "0.3.8"
16build = false
17publish = true
18autolib = false
19autobins = false
20autoexamples = false
21autotests = false
22autobenches = false
23description = "Zed's `gpui_wgpu` crate (gpui-pre snapshot of zed@279fe07)"
24readme = false
25license = "Apache-2.0"
26repository = "https://github.com/zed-industries/zed"
27resolver = "2"
28
29[package.metadata.gpui-pre]
30zed-crate = "gpui_wgpu"
31zed-version = "0.1.0"
32zed-rev = "279fe070bb389b79652e52065b2f001edcc0b11b"
33
34[features]
35bench-support = [
36 "gpui/bench-support",
37 "dep:image",
38]
39default = []
40font-kit = ["dep:font-kit"]
41test-support = [
42 "gpui/test-support",
43 "dep:image",
44]
45
46[lib]
47name = "gpui_wgpu"
48path = "src/gpui_wgpu.rs"
49doctest = false
50
51[[bench]]
52name = "layout_line"
53path = "benches/layout_line.rs"
54harness = false
55
56[dependencies.anyhow]
57version = "1.0.86"
58
59[dependencies.bytemuck]
60version = "1"
61
62[dependencies.collections]
63version = "=0.3.8"
64package = "gpui-pre-collections"
65
66[dependencies.cosmic-text]
67version = "0.19.0"
68
69[dependencies.etagere]
70version = "0.2"
71
72[dependencies.font-kit]
73version = "0.14.1-zed"
74optional = true
75package = "zed-font-kit"
76
77[dependencies.gpui]
78version = "=0.3.8"
79default-features = false
80package = "gpui-pre"
81
82[dependencies.gpui_util]
83version = "=0.3.8"
84package = "gpui-pre-util"
85
86[dependencies.image]
87version = "0.25.1"
88features = [
89 "bmp",
90 "dds",
91 "exr",
92 "ff",
93 "gif",
94 "hdr",
95 "ico",
96 "jpeg",
97 "png",
98 "pnm",
99 "qoi",
100 "rayon",
101 "tga",
102 "tiff",
103 "webp",
104]
105optional = true
106default-features = false
107
108[dependencies.itertools]
109version = "0.14.0"
110
111[dependencies.log]
112version = "0.4.16"
113features = [
114 "kv_unstable_serde",
115 "serde",
116]
117
118[dependencies.parking_lot]
119version = "0.12.1"
120
121[dependencies.profiling]
122version = "1"
123
124[dependencies.raw-window-handle]
125version = "0.6"
126
127[dependencies.smallvec]
128version = "1.6"
129features = [
130 "union",
131 "const_new",
132]
133
134[dependencies.swash]
135version = "0.2.6"
136
137[dependencies.unicode-bidi]
138version = "0.3.18"
139features = ["hardcoded-data"]
140default-features = false
141
142[dependencies.unicode-segmentation]
143version = "1.10"
144
145[dependencies.wgpu]
146version = "29.0.4"
147
148[target.'cfg(target_family = "wasm")'.dependencies.web-sys]
149version = "0.3"
150features = ["HtmlCanvasElement"]
151
152[target.'cfg(target_family = "wasm")'.dependencies.wgpu]
153version = "29.0.4"
154features = ["webgl"]
155
156[lints.clippy]
157dbg_macro = "deny"
158declare_interior_mutable_const = "deny"
159disallowed_methods = "deny"
160large_enum_variant = "allow"
161let_underscore_future = "allow"
162nonminimal_bool = "allow"
163redundant_clone = "deny"
164single_range_in_vec_init = "allow"
165todo = "deny"
166too_many_arguments = "allow"
167type_complexity = "allow"
168
169[lints.clippy.style]
170level = "allow"
171priority = -1
172
173[lints.rust.unexpected_cfgs]
174level = "allow"
175priority = 0
vendor/gpui-pre-wgpu/Cargo.toml.orig added +56 −0
@@ -0,0 +1,56 @@
1 [package]
2 name = "gpui-pre-wgpu"
3 version = "0.3.8"
4 edition = { workspace = true }
5 publish = true
6 license = "Apache-2.0"
7 description = "Zed's `gpui_wgpu` crate (gpui-pre snapshot of zed@279fe07)"
8 repository = "https://github.com/zed-industries/zed"
9
10 [package.metadata.gpui-pre]
11 zed-crate = "gpui_wgpu"
12 zed-version = "0.1.0"
13 zed-rev = "279fe070bb389b79652e52065b2f001edcc0b11b"
14
15 [lib]
16 path = "src/gpui_wgpu.rs"
17 doctest = false
18 name = "gpui_wgpu"
19
20 [features]
21 default = []
22 bench-support = ["gpui/bench-support", "dep:image"]
23 font-kit = ["dep:font-kit"]
24 test-support = ["gpui/test-support", "dep:image"]
25
26 [dependencies]
27 gpui = { workspace = true }
28 anyhow = { workspace = true }
29 bytemuck = "1"
30 collections = { workspace = true }
31 cosmic-text = "0.19.0"
32 etagere = { workspace = true }
33 itertools = { workspace = true }
34 image = { workspace = true, optional = true }
35 log = { workspace = true }
36 parking_lot = { workspace = true }
37 profiling = { workspace = true }
38 raw-window-handle = { workspace = true }
39 smallvec = { workspace = true }
40 swash = { workspace = true }
41 unicode-bidi = { workspace = true }
42 unicode-segmentation = { workspace = true }
43 gpui_util = { workspace = true }
44 wgpu = { workspace = true }
45 font-kit = { git = "https://github.com/zed-industries/font-kit", rev = "94b0f28166665e8fd2f53ff6d268a14955c82269", package = "zed-font-kit", version = "0.14.1-zed", optional = true }
46
47 [target.'cfg(target_family = "wasm")'.dependencies]
48 web-sys = { version = "0.3", features = ["HtmlCanvasElement"] }
49 wgpu = { workspace = true, features = ["webgl"] }
50
51 [lints]
52 workspace = true
53
54 [[bench]]
55 name = "layout_line"
56 harness = false
@@ -0,0 +1,56 @@
1[package]
2name = "gpui-pre-wgpu"
3version = "0.3.8"
4edition = { workspace = true }
5publish = true
6license = "Apache-2.0"
7description = "Zed's `gpui_wgpu` crate (gpui-pre snapshot of zed@279fe07)"
8repository = "https://github.com/zed-industries/zed"
9
10[package.metadata.gpui-pre]
11zed-crate = "gpui_wgpu"
12zed-version = "0.1.0"
13zed-rev = "279fe070bb389b79652e52065b2f001edcc0b11b"
14
15[lib]
16path = "src/gpui_wgpu.rs"
17doctest = false
18name = "gpui_wgpu"
19
20[features]
21default = []
22bench-support = ["gpui/bench-support", "dep:image"]
23font-kit = ["dep:font-kit"]
24test-support = ["gpui/test-support", "dep:image"]
25
26[dependencies]
27gpui = { workspace = true }
28anyhow = { workspace = true }
29bytemuck = "1"
30collections = { workspace = true }
31cosmic-text = "0.19.0"
32etagere = { workspace = true }
33itertools = { workspace = true }
34image = { workspace = true, optional = true }
35log = { workspace = true }
36parking_lot = { workspace = true }
37profiling = { workspace = true }
38raw-window-handle = { workspace = true }
39smallvec = { workspace = true }
40swash = { workspace = true }
41unicode-bidi = { workspace = true }
42unicode-segmentation = { workspace = true }
43gpui_util = { workspace = true }
44wgpu = { workspace = true }
45font-kit = { git = "https://github.com/zed-industries/font-kit", rev = "94b0f28166665e8fd2f53ff6d268a14955c82269", package = "zed-font-kit", version = "0.14.1-zed", optional = true }
46
47[target.'cfg(target_family = "wasm")'.dependencies]
48web-sys = { version = "0.3", features = ["HtmlCanvasElement"] }
49wgpu = { workspace = true, features = ["webgl"] }
50
51[lints]
52workspace = true
53
54[[bench]]
55name = "layout_line"
56harness = false
vendor/gpui-pre-wgpu/LICENSE-APACHE added +222 −0
@@ -0,0 +1,222 @@
1 Copyright 2022 - 2025 Zed Industries, Inc.
2
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17
18
19
20
21 Apache License
22 Version 2.0, January 2004
23 http://www.apache.org/licenses/
24
25
26 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
27
28
29 1. Definitions.
30
31
32 "License" shall mean the terms and conditions for use, reproduction,
33 and distribution as defined by Sections 1 through 9 of this document.
34
35
36 "Licensor" shall mean the copyright owner or entity authorized by
37 the copyright owner that is granting the License.
38
39
40 "Legal Entity" shall mean the union of the acting entity and all
41 other entities that control, are controlled by, or are under common
42 control with that entity. For the purposes of this definition,
43 "control" means (i) the power, direct or indirect, to cause the
44 direction or management of such entity, whether by contract or
45 otherwise, or (ii) ownership of fifty percent (50%) or more of the
46 outstanding shares, or (iii) beneficial ownership of such entity.
47
48
49 "You" (or "Your") shall mean an individual or Legal Entity
50 exercising permissions granted by this License.
51
52
53 "Source" form shall mean the preferred form for making modifications,
54 including but not limited to software source code, documentation
55 source, and configuration files.
56
57
58 "Object" form shall mean any form resulting from mechanical
59 transformation or translation of a Source form, including but
60 not limited to compiled object code, generated documentation,
61 and conversions to other media types.
62
63
64 "Work" shall mean the work of authorship, whether in Source or
65 Object form, made available under the License, as indicated by a
66 copyright notice that is included in or attached to the work
67 (an example is provided in the Appendix below).
68
69
70 "Derivative Works" shall mean any work, whether in Source or Object
71 form, that is based on (or derived from) the Work and for which the
72 editorial revisions, annotations, elaborations, or other modifications
73 represent, as a whole, an original work of authorship. For the purposes
74 of this License, Derivative Works shall not include works that remain
75 separable from, or merely link (or bind by name) to the interfaces of,
76 the Work and Derivative Works thereof.
77
78
79 "Contribution" shall mean any work of authorship, including
80 the original version of the Work and any modifications or additions
81 to that Work or Derivative Works thereof, that is intentionally
82 submitted to Licensor for inclusion in the Work by the copyright owner
83 or by an individual or Legal Entity authorized to submit on behalf of
84 the copyright owner. For the purposes of this definition, "submitted"
85 means any form of electronic, verbal, or written communication sent
86 to the Licensor or its representatives, including but not limited to
87 communication on electronic mailing lists, source code control systems,
88 and issue tracking systems that are managed by, or on behalf of, the
89 Licensor for the purpose of discussing and improving the Work, but
90 excluding communication that is conspicuously marked or otherwise
91 designated in writing by the copyright owner as "Not a Contribution."
92
93
94 "Contributor" shall mean Licensor and any individual or Legal Entity
95 on behalf of whom a Contribution has been received by Licensor and
96 subsequently incorporated within the Work.
97
98
99 2. Grant of Copyright License. Subject to the terms and conditions of
100 this License, each Contributor hereby grants to You a perpetual,
101 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
102 copyright license to reproduce, prepare Derivative Works of,
103 publicly display, publicly perform, sublicense, and distribute the
104 Work and such Derivative Works in Source or Object form.
105
106
107 3. Grant of Patent License. Subject to the terms and conditions of
108 this License, each Contributor hereby grants to You a perpetual,
109 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
110 (except as stated in this section) patent license to make, have made,
111 use, offer to sell, sell, import, and otherwise transfer the Work,
112 where such license applies only to those patent claims licensable
113 by such Contributor that are necessarily infringed by their
114 Contribution(s) alone or by combination of their Contribution(s)
115 with the Work to which such Contribution(s) was submitted. If You
116 institute patent litigation against any entity (including a
117 cross-claim or counterclaim in a lawsuit) alleging that the Work
118 or a Contribution incorporated within the Work constitutes direct
119 or contributory patent infringement, then any patent licenses
120 granted to You under this License for that Work shall terminate
121 as of the date such litigation is filed.
122
123
124 4. Redistribution. You may reproduce and distribute copies of the
125 Work or Derivative Works thereof in any medium, with or without
126 modifications, and in Source or Object form, provided that You
127 meet the following conditions:
128
129
130 (a) You must give any other recipients of the Work or
131 Derivative Works a copy of this License; and
132
133
134 (b) You must cause any modified files to carry prominent notices
135 stating that You changed the files; and
136
137
138 (c) You must retain, in the Source form of any Derivative Works
139 that You distribute, all copyright, patent, trademark, and
140 attribution notices from the Source form of the Work,
141 excluding those notices that do not pertain to any part of
142 the Derivative Works; and
143
144
145 (d) If the Work includes a "NOTICE" text file as part of its
146 distribution, then any Derivative Works that You distribute must
147 include a readable copy of the attribution notices contained
148 within such NOTICE file, excluding those notices that do not
149 pertain to any part of the Derivative Works, in at least one
150 of the following places: within a NOTICE text file distributed
151 as part of the Derivative Works; within the Source form or
152 documentation, if provided along with the Derivative Works; or,
153 within a display generated by the Derivative Works, if and
154 wherever such third-party notices normally appear. The contents
155 of the NOTICE file are for informational purposes only and
156 do not modify the License. You may add Your own attribution
157 notices within Derivative Works that You distribute, alongside
158 or as an addendum to the NOTICE text from the Work, provided
159 that such additional attribution notices cannot be construed
160 as modifying the License.
161
162
163 You may add Your own copyright statement to Your modifications and
164 may provide additional or different license terms and conditions
165 for use, reproduction, or distribution of Your modifications, or
166 for any such Derivative Works as a whole, provided Your use,
167 reproduction, and distribution of the Work otherwise complies with
168 the conditions stated in this License.
169
170
171 5. Submission of Contributions. Unless You explicitly state otherwise,
172 any Contribution intentionally submitted for inclusion in the Work
173 by You to the Licensor shall be under the terms and conditions of
174 this License, without any additional terms or conditions.
175 Notwithstanding the above, nothing herein shall supersede or modify
176 the terms of any separate license agreement you may have executed
177 with Licensor regarding such Contributions.
178
179
180 6. Trademarks. This License does not grant permission to use the trade
181 names, trademarks, service marks, or product names of the Licensor,
182 except as required for reasonable and customary use in describing the
183 origin of the Work and reproducing the content of the NOTICE file.
184
185
186 7. Disclaimer of Warranty. Unless required by applicable law or
187 agreed to in writing, Licensor provides the Work (and each
188 Contributor provides its Contributions) on an "AS IS" BASIS,
189 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
190 implied, including, without limitation, any warranties or conditions
191 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
192 PARTICULAR PURPOSE. You are solely responsible for determining the
193 appropriateness of using or redistributing the Work and assume any
194 risks associated with Your exercise of permissions under this License.
195
196
197 8. Limitation of Liability. In no event and under no legal theory,
198 whether in tort (including negligence), contract, or otherwise,
199 unless required by applicable law (such as deliberate and grossly
200 negligent acts) or agreed to in writing, shall any Contributor be
201 liable to You for damages, including any direct, indirect, special,
202 incidental, or consequential damages of any character arising as a
203 result of this License or out of the use or inability to use the
204 Work (including but not limited to damages for loss of goodwill,
205 work stoppage, computer failure or malfunction, or any and all
206 other commercial damages or losses), even if such Contributor
207 has been advised of the possibility of such damages.
208
209
210 9. Accepting Warranty or Additional Liability. While redistributing
211 the Work or Derivative Works thereof, You may choose to offer,
212 and charge a fee for, acceptance of support, warranty, indemnity,
213 or other liability obligations and/or rights consistent with this
214 License. However, in accepting such obligations, You may act only
215 on Your own behalf and on Your sole responsibility, not on behalf
216 of any other Contributor, and only if You agree to indemnify,
217 defend, and hold each Contributor harmless for any liability
218 incurred by, or claims asserted against, such Contributor by reason
219 of your accepting any such warranty or additional liability.
220
221
222 END OF TERMS AND CONDITIONS
@@ -0,0 +1,222 @@
1Copyright 2022 - 2025 Zed Industries, Inc.
2
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17
18
19
20
21Apache License
22 Version 2.0, January 2004
23 http://www.apache.org/licenses/
24
25
26 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
27
28
29 1. Definitions.
30
31
32 "License" shall mean the terms and conditions for use, reproduction,
33 and distribution as defined by Sections 1 through 9 of this document.
34
35
36 "Licensor" shall mean the copyright owner or entity authorized by
37 the copyright owner that is granting the License.
38
39
40 "Legal Entity" shall mean the union of the acting entity and all
41 other entities that control, are controlled by, or are under common
42 control with that entity. For the purposes of this definition,
43 "control" means (i) the power, direct or indirect, to cause the
44 direction or management of such entity, whether by contract or
45 otherwise, or (ii) ownership of fifty percent (50%) or more of the
46 outstanding shares, or (iii) beneficial ownership of such entity.
47
48
49 "You" (or "Your") shall mean an individual or Legal Entity
50 exercising permissions granted by this License.
51
52
53 "Source" form shall mean the preferred form for making modifications,
54 including but not limited to software source code, documentation
55 source, and configuration files.
56
57
58 "Object" form shall mean any form resulting from mechanical
59 transformation or translation of a Source form, including but
60 not limited to compiled object code, generated documentation,
61 and conversions to other media types.
62
63
64 "Work" shall mean the work of authorship, whether in Source or
65 Object form, made available under the License, as indicated by a
66 copyright notice that is included in or attached to the work
67 (an example is provided in the Appendix below).
68
69
70 "Derivative Works" shall mean any work, whether in Source or Object
71 form, that is based on (or derived from) the Work and for which the
72 editorial revisions, annotations, elaborations, or other modifications
73 represent, as a whole, an original work of authorship. For the purposes
74 of this License, Derivative Works shall not include works that remain
75 separable from, or merely link (or bind by name) to the interfaces of,
76 the Work and Derivative Works thereof.
77
78
79 "Contribution" shall mean any work of authorship, including
80 the original version of the Work and any modifications or additions
81 to that Work or Derivative Works thereof, that is intentionally
82 submitted to Licensor for inclusion in the Work by the copyright owner
83 or by an individual or Legal Entity authorized to submit on behalf of
84 the copyright owner. For the purposes of this definition, "submitted"
85 means any form of electronic, verbal, or written communication sent
86 to the Licensor or its representatives, including but not limited to
87 communication on electronic mailing lists, source code control systems,
88 and issue tracking systems that are managed by, or on behalf of, the
89 Licensor for the purpose of discussing and improving the Work, but
90 excluding communication that is conspicuously marked or otherwise
91 designated in writing by the copyright owner as "Not a Contribution."
92
93
94 "Contributor" shall mean Licensor and any individual or Legal Entity
95 on behalf of whom a Contribution has been received by Licensor and
96 subsequently incorporated within the Work.
97
98
99 2. Grant of Copyright License. Subject to the terms and conditions of
100 this License, each Contributor hereby grants to You a perpetual,
101 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
102 copyright license to reproduce, prepare Derivative Works of,
103 publicly display, publicly perform, sublicense, and distribute the
104 Work and such Derivative Works in Source or Object form.
105
106
107 3. Grant of Patent License. Subject to the terms and conditions of
108 this License, each Contributor hereby grants to You a perpetual,
109 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
110 (except as stated in this section) patent license to make, have made,
111 use, offer to sell, sell, import, and otherwise transfer the Work,
112 where such license applies only to those patent claims licensable
113 by such Contributor that are necessarily infringed by their
114 Contribution(s) alone or by combination of their Contribution(s)
115 with the Work to which such Contribution(s) was submitted. If You
116 institute patent litigation against any entity (including a
117 cross-claim or counterclaim in a lawsuit) alleging that the Work
118 or a Contribution incorporated within the Work constitutes direct
119 or contributory patent infringement, then any patent licenses
120 granted to You under this License for that Work shall terminate
121 as of the date such litigation is filed.
122
123
124 4. Redistribution. You may reproduce and distribute copies of the
125 Work or Derivative Works thereof in any medium, with or without
126 modifications, and in Source or Object form, provided that You
127 meet the following conditions:
128
129
130 (a) You must give any other recipients of the Work or
131 Derivative Works a copy of this License; and
132
133
134 (b) You must cause any modified files to carry prominent notices
135 stating that You changed the files; and
136
137
138 (c) You must retain, in the Source form of any Derivative Works
139 that You distribute, all copyright, patent, trademark, and
140 attribution notices from the Source form of the Work,
141 excluding those notices that do not pertain to any part of
142 the Derivative Works; and
143
144
145 (d) If the Work includes a "NOTICE" text file as part of its
146 distribution, then any Derivative Works that You distribute must
147 include a readable copy of the attribution notices contained
148 within such NOTICE file, excluding those notices that do not
149 pertain to any part of the Derivative Works, in at least one
150 of the following places: within a NOTICE text file distributed
151 as part of the Derivative Works; within the Source form or
152 documentation, if provided along with the Derivative Works; or,
153 within a display generated by the Derivative Works, if and
154 wherever such third-party notices normally appear. The contents
155 of the NOTICE file are for informational purposes only and
156 do not modify the License. You may add Your own attribution
157 notices within Derivative Works that You distribute, alongside
158 or as an addendum to the NOTICE text from the Work, provided
159 that such additional attribution notices cannot be construed
160 as modifying the License.
161
162
163 You may add Your own copyright statement to Your modifications and
164 may provide additional or different license terms and conditions
165 for use, reproduction, or distribution of Your modifications, or
166 for any such Derivative Works as a whole, provided Your use,
167 reproduction, and distribution of the Work otherwise complies with
168 the conditions stated in this License.
169
170
171 5. Submission of Contributions. Unless You explicitly state otherwise,
172 any Contribution intentionally submitted for inclusion in the Work
173 by You to the Licensor shall be under the terms and conditions of
174 this License, without any additional terms or conditions.
175 Notwithstanding the above, nothing herein shall supersede or modify
176 the terms of any separate license agreement you may have executed
177 with Licensor regarding such Contributions.
178
179
180 6. Trademarks. This License does not grant permission to use the trade
181 names, trademarks, service marks, or product names of the Licensor,
182 except as required for reasonable and customary use in describing the
183 origin of the Work and reproducing the content of the NOTICE file.
184
185
186 7. Disclaimer of Warranty. Unless required by applicable law or
187 agreed to in writing, Licensor provides the Work (and each
188 Contributor provides its Contributions) on an "AS IS" BASIS,
189 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
190 implied, including, without limitation, any warranties or conditions
191 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
192 PARTICULAR PURPOSE. You are solely responsible for determining the
193 appropriateness of using or redistributing the Work and assume any
194 risks associated with Your exercise of permissions under this License.
195
196
197 8. Limitation of Liability. In no event and under no legal theory,
198 whether in tort (including negligence), contract, or otherwise,
199 unless required by applicable law (such as deliberate and grossly
200 negligent acts) or agreed to in writing, shall any Contributor be
201 liable to You for damages, including any direct, indirect, special,
202 incidental, or consequential damages of any character arising as a
203 result of this License or out of the use or inability to use the
204 Work (including but not limited to damages for loss of goodwill,
205 work stoppage, computer failure or malfunction, or any and all
206 other commercial damages or losses), even if such Contributor
207 has been advised of the possibility of such damages.
208
209
210 9. Accepting Warranty or Additional Liability. While redistributing
211 the Work or Derivative Works thereof, You may choose to offer,
212 and charge a fee for, acceptance of support, warranty, indemnity,
213 or other liability obligations and/or rights consistent with this
214 License. However, in accepting such obligations, You may act only
215 on Your own behalf and on Your sole responsibility, not on behalf
216 of any other Contributor, and only if You agree to indemnify,
217 defend, and hold each Contributor harmless for any liability
218 incurred by, or claims asserted against, such Contributor by reason
219 of your accepting any such warranty or additional liability.
220
221
222 END OF TERMS AND CONDITIONS
vendor/gpui-pre-wgpu/PATCH.md added +9 −0
@@ -0,0 +1,9 @@
1 # gpui-pre-wgpu 0.3.8 patches
2
3 Upstream: crates.io `gpui-pre-wgpu 0.3.8`. Wired in via `[patch.crates-io]` in the root `Cargo.toml`.
4
5 ## Changed files
6
7 | File | Change | Why |
8 |---|---|---|
9 | `src/cosmic_text_system.rs` | `add_fonts` removes installed faces whose family a bundled face also has | Fedora ships Noto Color Emoji as COLRv1 only, which swash cannot draw; the bundled CBDT face of the same family must win the fallback (GitHub issue 8) |
@@ -0,0 +1,9 @@
1# gpui-pre-wgpu 0.3.8 patches
2
3Upstream: crates.io `gpui-pre-wgpu 0.3.8`. Wired in via `[patch.crates-io]` in the root `Cargo.toml`.
4
5## Changed files
6
7| File | Change | Why |
8|---|---|---|
9| `src/cosmic_text_system.rs` | `add_fonts` removes installed faces whose family a bundled face also has | Fedora ships Noto Color Emoji as COLRv1 only, which swash cannot draw; the bundled CBDT face of the same family must win the fallback (GitHub issue 8) |
vendor/gpui-pre-wgpu/benches/layout_line.rs added +104 −0
@@ -0,0 +1,104 @@
1 use criterion::{Criterion, criterion_group, criterion_main};
2 use gpui::{FontFallbacks, FontRun, PlatformTextSystem, font, px};
3 use gpui_wgpu::CosmicTextSystem;
4 use std::borrow::Cow;
5
6 const LILEX: &[u8] = include_bytes!("../../../assets/fonts/lilex/Lilex-Regular.ttf");
7 const IBM_PLEX: &[u8] =
8 include_bytes!("../../../assets/fonts/ibm-plex-sans/IBMPlexSans-Regular.ttf");
9
10 // ~4 000 chars of typical ASCII code text, as a single display line.
11 //
12 // `layout_line` is handed one line at a time, already split on `\n` by its
13 // callers, so the newlines are replaced rather than kept: leaving them in would
14 // make this measure the multi-paragraph path instead of the common one, since
15 // `\n` is itself a bidi paragraph separator.
16 fn code_text() -> String {
17 concat!(
18 " fn compute_run_spans(\n",
19 " text: &str,\n",
20 " run_offset: usize,\n",
21 " run_len: usize,\n",
22 " primary: FontId,\n",
23 " fallback_chain: &[(FontId, SharedString)],\n",
24 " covers: &impl Fn(FontId, char) -> bool,\n",
25 " ) -> SmallVec<[RunSpan; 4]> {\n",
26 " let mut spans = SmallVec::new();\n",
27 " let run_end = run_offset + run_len;\n",
28 " if run_end <= run_offset { return spans; }\n",
29 " let run_text = &text[run_offset..run_end];\n",
30 " let mut span_start = run_offset;\n",
31 " let mut span_slot: Option<usize> = None;\n",
32 " for (ch_idx, ch) in run_text.char_indices() {\n",
33 " let abs = run_offset + ch_idx;\n",
34 " let next = pick_covering_slot(ch, span_slot, primary, fallback_chain, covers);\n",
35 " if next == span_slot { continue; }\n",
36 " if abs > span_start {\n",
37 " spans.push(RunSpan { start: span_start, end: abs, slot: span_slot });\n",
38 " }\n",
39 " span_start = abs;\n",
40 " span_slot = next;\n",
41 " }\n",
42 " spans\n",
43 " }\n",
44 )
45 .repeat(8) // ~3 800 chars
46 .replace('\n', " ")
47 }
48
49 fn bench_layout_line(c: &mut Criterion) {
50 let system = CosmicTextSystem::new_without_system_fonts("Lilex");
51 system
52 .add_fonts(vec![Cow::Borrowed(LILEX), Cow::Borrowed(IBM_PLEX)])
53 .unwrap();
54
55 let font_id_no_fallback = system.font_id(&font("Lilex")).unwrap();
56
57 let font_id_with_fallback = {
58 let mut f = font("Lilex");
59 f.fallbacks = Some(FontFallbacks::from_fonts(vec!["IBM Plex Sans".to_string()]));
60 system.font_id(&f).unwrap()
61 };
62
63 let text = code_text();
64
65 // Same text, but with a bidi paragraph separator (U+001C) and RTL content
66 // forcing the per-paragraph shaping path.
67 let text_mixed_direction = text.clone() + "\u{001c}\u{05d0}\u{05d1}";
68 assert!(
69 !text.contains('\n'),
70 "fast-path corpus must contain no separator"
71 );
72
73 let runs_no_fallback = vec![FontRun {
74 len: text.len(),
75 font_id: font_id_no_fallback,
76 }];
77 let runs_with_fallback = vec![FontRun {
78 len: text.len(),
79 font_id: font_id_with_fallback,
80 }];
81 let runs_mixed_direction = vec![FontRun {
82 len: text_mixed_direction.len(),
83 font_id: font_id_no_fallback,
84 }];
85
86 let mut group = c.benchmark_group("layout_line");
87
88 group.bench_function("no_fallback", |b| {
89 b.iter(|| system.layout_line(&text, px(14.0), &runs_no_fallback))
90 });
91
92 group.bench_function("with_fallback_ascii", |b| {
93 b.iter(|| system.layout_line(&text, px(14.0), &runs_with_fallback))
94 });
95
96 group.bench_function("mixed_direction_paragraphs", |b| {
97 b.iter(|| system.layout_line(&text_mixed_direction, px(14.0), &runs_mixed_direction))
98 });
99
100 group.finish();
101 }
102
103 criterion_group!(benches, bench_layout_line);
104 criterion_main!(benches);
@@ -0,0 +1,104 @@
1use criterion::{Criterion, criterion_group, criterion_main};
2use gpui::{FontFallbacks, FontRun, PlatformTextSystem, font, px};
3use gpui_wgpu::CosmicTextSystem;
4use std::borrow::Cow;
5
6const LILEX: &[u8] = include_bytes!("../../../assets/fonts/lilex/Lilex-Regular.ttf");
7const IBM_PLEX: &[u8] =
8 include_bytes!("../../../assets/fonts/ibm-plex-sans/IBMPlexSans-Regular.ttf");
9
10// ~4 000 chars of typical ASCII code text, as a single display line.
11//
12// `layout_line` is handed one line at a time, already split on `\n` by its
13// callers, so the newlines are replaced rather than kept: leaving them in would
14// make this measure the multi-paragraph path instead of the common one, since
15// `\n` is itself a bidi paragraph separator.
16fn code_text() -> String {
17 concat!(
18 " fn compute_run_spans(\n",
19 " text: &str,\n",
20 " run_offset: usize,\n",
21 " run_len: usize,\n",
22 " primary: FontId,\n",
23 " fallback_chain: &[(FontId, SharedString)],\n",
24 " covers: &impl Fn(FontId, char) -> bool,\n",
25 " ) -> SmallVec<[RunSpan; 4]> {\n",
26 " let mut spans = SmallVec::new();\n",
27 " let run_end = run_offset + run_len;\n",
28 " if run_end <= run_offset { return spans; }\n",
29 " let run_text = &text[run_offset..run_end];\n",
30 " let mut span_start = run_offset;\n",
31 " let mut span_slot: Option<usize> = None;\n",
32 " for (ch_idx, ch) in run_text.char_indices() {\n",
33 " let abs = run_offset + ch_idx;\n",
34 " let next = pick_covering_slot(ch, span_slot, primary, fallback_chain, covers);\n",
35 " if next == span_slot { continue; }\n",
36 " if abs > span_start {\n",
37 " spans.push(RunSpan { start: span_start, end: abs, slot: span_slot });\n",
38 " }\n",
39 " span_start = abs;\n",
40 " span_slot = next;\n",
41 " }\n",
42 " spans\n",
43 " }\n",
44 )
45 .repeat(8) // ~3 800 chars
46 .replace('\n', " ")
47}
48
49fn bench_layout_line(c: &mut Criterion) {
50 let system = CosmicTextSystem::new_without_system_fonts("Lilex");
51 system
52 .add_fonts(vec![Cow::Borrowed(LILEX), Cow::Borrowed(IBM_PLEX)])
53 .unwrap();
54
55 let font_id_no_fallback = system.font_id(&font("Lilex")).unwrap();
56
57 let font_id_with_fallback = {
58 let mut f = font("Lilex");
59 f.fallbacks = Some(FontFallbacks::from_fonts(vec!["IBM Plex Sans".to_string()]));
60 system.font_id(&f).unwrap()
61 };
62
63 let text = code_text();
64
65 // Same text, but with a bidi paragraph separator (U+001C) and RTL content
66 // forcing the per-paragraph shaping path.
67 let text_mixed_direction = text.clone() + "\u{001c}\u{05d0}\u{05d1}";
68 assert!(
69 !text.contains('\n'),
70 "fast-path corpus must contain no separator"
71 );
72
73 let runs_no_fallback = vec![FontRun {
74 len: text.len(),
75 font_id: font_id_no_fallback,
76 }];
77 let runs_with_fallback = vec![FontRun {
78 len: text.len(),
79 font_id: font_id_with_fallback,
80 }];
81 let runs_mixed_direction = vec![FontRun {
82 len: text_mixed_direction.len(),
83 font_id: font_id_no_fallback,
84 }];
85
86 let mut group = c.benchmark_group("layout_line");
87
88 group.bench_function("no_fallback", |b| {
89 b.iter(|| system.layout_line(&text, px(14.0), &runs_no_fallback))
90 });
91
92 group.bench_function("with_fallback_ascii", |b| {
93 b.iter(|| system.layout_line(&text, px(14.0), &runs_with_fallback))
94 });
95
96 group.bench_function("mixed_direction_paragraphs", |b| {
97 b.iter(|| system.layout_line(&text_mixed_direction, px(14.0), &runs_mixed_direction))
98 });
99
100 group.finish();
101}
102
103criterion_group!(benches, bench_layout_line);
104criterion_main!(benches);
vendor/gpui-pre-wgpu/src/cosmic_text_system.rs added +1815 −0
@@ -0,0 +1,1815 @@
1 use anyhow::{Context as _, Ok, Result};
2 use collections::HashMap;
3 use cosmic_text::{
4 Attrs, AttrsList, Ellipsize, Family, Font as CosmicTextFont,
5 FontFeatures as CosmicFontFeatures, FontSystem, ShapeBuffer, ShapeLine, Stretch, Style, Weight,
6 };
7 use gpui::{
8 Bounds, DevicePixels, FallbackFontClass, Font, FontFallbacks, FontFeatures, FontId,
9 FontMetrics, FontRun, GlyphId, IsZero as _, LineLayout, MissingGlyph, MissingGlyphSink, Pixels,
10 PlatformTextSystem, RenderGlyphParams, SUBPIXEL_VARIANTS_X, SUBPIXEL_VARIANTS_Y, ShapedGlyph,
11 ShapedRun, SharedString, Size, TextRenderingMode, point, size,
12 };
13
14 use itertools::Itertools;
15 use parking_lot::RwLock;
16 use smallvec::SmallVec;
17 use std::{borrow::Cow, ops::Range, sync::Arc};
18 use swash::{
19 scale::{Render, ScaleContext, Source, StrikeWith},
20 zeno::{Format, Vector},
21 };
22 use unicode_segmentation::UnicodeSegmentation;
23
24 pub struct CosmicTextSystem(RwLock<CosmicTextSystemState>);
25
26 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
27 struct FontKey {
28 family: SharedString,
29 features: FontFeatures,
30 fallbacks: Option<FontFallbacks>,
31 }
32
33 impl FontKey {
34 fn new(family: SharedString, features: FontFeatures, fallbacks: Option<FontFallbacks>) -> Self {
35 Self {
36 family,
37 features,
38 fallbacks,
39 }
40 }
41 }
42
43 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
44 struct LoadedFontKey {
45 database_id: cosmic_text::fontdb::ID,
46 font: FontKey,
47 }
48
49 struct CosmicTextSystemState {
50 font_system: FontSystem,
51 scratch: ShapeBuffer,
52 swash_scale_context: ScaleContext,
53 pending_glyph_images: HashMap<RenderGlyphParams, swash::scale::image::Image>,
54 /// Contains all already loaded fonts, including all faces. Indexed by `FontId`.
55 loaded_fonts: Vec<LoadedFont>,
56 loaded_font_ids_by_key: HashMap<LoadedFontKey, FontId>,
57 /// Caches the `FontId`s associated with a specific family to avoid iterating the font database
58 /// for every font face in a family.
59 font_ids_by_family_cache: HashMap<FontKey, SmallVec<[FontId; 4]>>,
60 system_font_fallback: String,
61 missing_glyph_sink: Option<Arc<dyn MissingGlyphSink>>,
62 }
63
64 struct LoadedFont {
65 font: Arc<CosmicTextFont>,
66 features: CosmicFontFeatures,
67 is_known_emoji_font: bool,
68 /// resolved at load time so `layout_line` shares one chain across faces.
69 /// `Arc` keeps clone cheap on the per-run hot path.
70 user_fallback_chain: Arc<[(FontId, SharedString)]>,
71 }
72
73 struct FontMatchProperties {
74 primary_family_name: SharedString,
75 stretch: Stretch,
76 style: Style,
77 weight: Weight,
78 features: CosmicFontFeatures,
79 fallback_chain: Arc<[(FontId, SharedString)]>,
80 }
81
82 impl FontMatchProperties {
83 fn attributes<'a>(&'a self, font_id: FontId, family_name: &'a str) -> Attrs<'a> {
84 Attrs::new()
85 .metadata(font_id.0)
86 .family(Family::Name(family_name))
87 .stretch(self.stretch)
88 .style(self.style)
89 .weight(self.weight)
90 .font_features(self.features.clone())
91 }
92 }
93
94 impl CosmicTextSystem {
95 /// Returns the selected face's weight and style, which may differ from the request.
96 pub fn font_weight_and_style(
97 &self,
98 font_id: FontId,
99 ) -> Result<(gpui::FontWeight, gpui::FontStyle)> {
100 let state = self.0.read();
101 let font = state
102 .loaded_fonts
103 .get(font_id.0)
104 .context("invalid font ID")?;
105 let face = state
106 .font_system
107 .db()
108 .face(font.font.id())
109 .context("font face not found")?;
110 let style = match face.style {
111 cosmic_text::Style::Normal => gpui::FontStyle::Normal,
112 cosmic_text::Style::Italic => gpui::FontStyle::Italic,
113 cosmic_text::Style::Oblique => gpui::FontStyle::Oblique,
114 };
115 Ok((gpui::FontWeight(face.weight.0 as f32), style))
116 }
117
118 /// Builds reports for unresolved source indices after an outer text system
119 /// has applied its own fallback.
120 pub fn missing_glyphs(
121 &self,
122 text: &str,
123 font_runs: &[FontRun],
124 missing_text_indices: impl IntoIterator<Item = usize>,
125 ) -> Vec<MissingGlyph> {
126 self.0
127 .read()
128 .missing_glyphs(text, font_runs, missing_text_indices)
129 }
130
131 pub fn new(system_font_fallback: &str) -> Self {
132 let font_system = FontSystem::new();
133
134 Self(RwLock::new(CosmicTextSystemState {
135 font_system,
136 scratch: ShapeBuffer::default(),
137 swash_scale_context: ScaleContext::new(),
138 pending_glyph_images: HashMap::default(),
139 loaded_fonts: Vec::new(),
140 loaded_font_ids_by_key: HashMap::default(),
141 font_ids_by_family_cache: HashMap::default(),
142 system_font_fallback: system_font_fallback.to_string(),
143 missing_glyph_sink: None,
144 }))
145 }
146
147 pub fn new_without_system_fonts(system_font_fallback: &str) -> Self {
148 let font_system = FontSystem::new_with_locale_and_db(
149 "en-US".to_string(),
150 cosmic_text::fontdb::Database::new(),
151 );
152
153 Self(RwLock::new(CosmicTextSystemState {
154 font_system,
155 scratch: ShapeBuffer::default(),
156 swash_scale_context: ScaleContext::new(),
157 pending_glyph_images: HashMap::default(),
158 loaded_fonts: Vec::new(),
159 loaded_font_ids_by_key: HashMap::default(),
160 font_ids_by_family_cache: HashMap::default(),
161 system_font_fallback: system_font_fallback.to_string(),
162 missing_glyph_sink: None,
163 }))
164 }
165 }
166
167 impl PlatformTextSystem for CosmicTextSystem {
168 fn add_fonts(&self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {
169 self.0.write().add_fonts(fonts)
170 }
171
172 fn set_missing_glyph_sink(&self, sink: Option<Arc<dyn MissingGlyphSink>>) {
173 self.0.write().missing_glyph_sink = sink;
174 }
175
176 fn all_font_names(&self) -> Vec<String> {
177 let mut result = self
178 .0
179 .read()
180 .font_system
181 .db()
182 .faces()
183 .filter_map(|face| face.families.first().map(|family| family.0.clone()))
184 .collect_vec();
185 result.sort_unstable();
186 result.dedup();
187 result
188 }
189
190 fn font_id(&self, font: &Font) -> Result<FontId> {
191 let mut state = self.0.write();
192 let key = FontKey::new(
193 font.family.clone(),
194 font.features.clone(),
195 font.fallbacks.clone(),
196 );
197 let candidates = if let Some(font_ids) = state.font_ids_by_family_cache.get(&key) {
198 font_ids.as_slice()
199 } else {
200 let font_ids =
201 state.load_family(&font.family, &font.features, font.fallbacks.as_ref())?;
202 state.font_ids_by_family_cache.insert(key.clone(), font_ids);
203 state.font_ids_by_family_cache[&key].as_ref()
204 };
205
206 let ix = find_best_match(font, candidates, &state)?;
207
208 Ok(candidates[ix])
209 }
210
211 fn prewarm_fonts(&self, font_ids: &[FontId]) {
212 self.0.write().prewarm_fonts(font_ids);
213 }
214
215 fn font_metrics(&self, font_id: FontId) -> FontMetrics {
216 let metrics = self
217 .0
218 .read()
219 .loaded_font(font_id)
220 .font
221 .as_swash()
222 .metrics(&[]);
223
224 FontMetrics {
225 units_per_em: metrics.units_per_em as u32,
226 ascent: metrics.ascent,
227 descent: -metrics.descent,
228 line_gap: metrics.leading,
229 underline_position: metrics.underline_offset,
230 underline_thickness: metrics.stroke_size,
231 cap_height: metrics.cap_height,
232 x_height: metrics.x_height,
233 bounding_box: Bounds {
234 origin: point(0.0, 0.0),
235 size: size(metrics.max_width, metrics.ascent + metrics.descent),
236 },
237 }
238 }
239
240 fn typographic_bounds(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Bounds<f32>> {
241 let lock = self.0.read();
242 let glyph_metrics = lock.loaded_font(font_id).font.as_swash().glyph_metrics(&[]);
243 let glyph_id = glyph_id.0 as u16;
244 Ok(Bounds {
245 origin: point(0.0, 0.0),
246 size: size(
247 glyph_metrics.advance_width(glyph_id),
248 glyph_metrics.advance_height(glyph_id),
249 ),
250 })
251 }
252
253 fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Size<f32>> {
254 self.0.read().advance(font_id, glyph_id)
255 }
256
257 fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option<GlyphId> {
258 self.0.read().glyph_for_char(font_id, ch)
259 }
260
261 fn glyph_raster_bounds(&self, params: &RenderGlyphParams) -> Result<Bounds<DevicePixels>> {
262 self.0.write().raster_bounds(params)
263 }
264
265 fn rasterize_glyph(
266 &self,
267 params: &RenderGlyphParams,
268 raster_bounds: Bounds<DevicePixels>,
269 ) -> Result<(Size<DevicePixels>, Vec<u8>)> {
270 self.0.write().rasterize_glyph(params, raster_bounds)
271 }
272
273 fn layout_line(&self, text: &str, font_size: Pixels, runs: &[FontRun]) -> LineLayout {
274 self.0.write().layout_line(text, font_size, runs)
275 }
276
277 fn recommended_rendering_mode(
278 &self,
279 _font_id: FontId,
280 _font_size: Pixels,
281 ) -> TextRenderingMode {
282 TextRenderingMode::Subpixel
283 }
284 }
285
286 impl CosmicTextSystemState {
287 fn loaded_font(&self, font_id: FontId) -> &LoadedFont {
288 &self.loaded_fonts[font_id.0]
289 }
290
291 fn font_match_properties(&self, font_id: FontId) -> Option<FontMatchProperties> {
292 let loaded_font = self.loaded_font(font_id);
293 let Some(face) = self.font_system.db().face(loaded_font.font.id()) else {
294 log::warn!("font face not found in database for font_id {:?}", font_id);
295 return None;
296 };
297 let Some(first_family) = face.families.first() else {
298 log::warn!("font face has no family names for font_id {:?}", font_id);
299 return None;
300 };
301
302 Some(FontMatchProperties {
303 primary_family_name: first_family.0.clone().into(),
304 stretch: face.stretch,
305 style: face.style,
306 weight: face.weight,
307 features: loaded_font.features.clone(),
308 fallback_chain: Arc::clone(&loaded_font.user_fallback_chain),
309 })
310 }
311
312 fn prewarm_fonts(&mut self, font_ids: &[FontId]) {
313 for &font_id in font_ids {
314 let Some(properties) = self.font_match_properties(font_id) else {
315 continue;
316 };
317 let primary_attributes =
318 properties.attributes(font_id, &properties.primary_family_name);
319 self.font_system.get_font_matches(&primary_attributes);
320
321 for (fallback_id, fallback_name) in &*properties.fallback_chain {
322 let fallback_attributes = properties.attributes(*fallback_id, fallback_name);
323 self.font_system.get_font_matches(&fallback_attributes);
324 }
325 }
326 }
327
328 #[profiling::function]
329 fn add_fonts(&mut self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {
330 self.font_ids_by_family_cache.clear();
331 let db = self.font_system.db_mut();
332 let installed: std::collections::HashSet<_> = db.faces().map(|face| face.id).collect();
333 for bytes in fonts {
334 db.load_font_source(cosmic_text::fontdb::Source::Binary(Arc::new(bytes)));
335 }
336 // A bundled face replaces installed faces of the same family, so a system font the
337 // renderer cannot draw (COLRv1-only emoji) never wins the family lookup.
338 let bundled_families: std::collections::HashSet<String> = db
339 .faces()
340 .filter(|face| !installed.contains(&face.id))
341 .flat_map(|face| face.families.iter().map(|(name, _)| name.clone()))
342 .collect();
343 let shadowed: Vec<_> = db
344 .faces()
345 .filter(|face| installed.contains(&face.id))
346 .filter(|face| face.families.iter().any(|(name, _)| bundled_families.contains(name)))
347 .map(|face| face.id)
348 .collect();
349 for id in shadowed {
350 db.remove_face(id);
351 }
352 Ok(())
353 }
354
355 #[profiling::function]
356 fn load_family(
357 &mut self,
358 name: &str,
359 features: &FontFeatures,
360 fallbacks: Option<&FontFallbacks>,
361 ) -> Result<SmallVec<[FontId; 4]>> {
362 let loaded_font_key = FontKey::new(
363 SharedString::from(name.to_owned()),
364 features.clone(),
365 fallbacks.cloned(),
366 );
367
368 // recurse with `fallbacks = None` so a fallback family cannot pull in
369 // another chain. missing fallback families are dropped so a typo in
370 // settings still lets the primary family load.
371 let user_fallback_chain: Arc<[(FontId, SharedString)]> = match fallbacks {
372 Some(fallbacks) if !fallbacks.fallback_list().is_empty() => {
373 let mut chain: Vec<(FontId, SharedString)> = Vec::new();
374 for fallback_name in fallbacks.fallback_list() {
375 let fb_key = FontKey::new(
376 SharedString::from(fallback_name.clone()),
377 features.clone(),
378 None,
379 );
380 let fb_ids = if let Some(cached) = self.font_ids_by_family_cache.get(&fb_key) {
381 cached.clone()
382 } else {
383 let loaded = self.load_family(fallback_name, features, None)?;
384 self.font_ids_by_family_cache
385 .insert(fb_key.clone(), loaded.clone());
386 loaded
387 };
388 let Some(&fb_id) = fb_ids.first() else {
389 continue;
390 };
391 let db_id = self.loaded_fonts[fb_id.0].font.id();
392 if let Some(face) = self.font_system.db().face(db_id)
393 && let Some(family) = face.families.first()
394 {
395 chain.push((fb_id, SharedString::from(family.0.clone())));
396 }
397 }
398 Arc::from(chain)
399 }
400 _ => Arc::from(Vec::new()),
401 };
402
403 let name = gpui::font_name_with_fallbacks(name, &self.system_font_fallback);
404
405 let families = self
406 .font_system
407 .db()
408 .faces()
409 .filter(|face| face.families.iter().any(|family| *name == family.0))
410 .map(|face| (face.id, face.post_script_name.clone()))
411 .collect::<SmallVec<[_; 4]>>();
412
413 let cosmic_features = cosmic_font_features(features)?;
414
415 let mut loaded_font_ids = SmallVec::new();
416 for (database_id, postscript_name) in families {
417 let key = LoadedFontKey {
418 database_id,
419 font: loaded_font_key.clone(),
420 };
421 if let Some(&font_id) = self.loaded_font_ids_by_key.get(&key) {
422 self.loaded_fonts[font_id.0].user_fallback_chain = Arc::clone(&user_fallback_chain);
423 loaded_font_ids.push(font_id);
424 continue;
425 }
426
427 let font = self
428 .font_system
429 .get_font(database_id, cosmic_text::Weight::NORMAL)
430 .context("Could not load font")?;
431
432 // HACK: To let the storybook run and render Windows caption icons. We should actually do better font fallback.
433 let allowed_bad_font_names = [
434 "SegoeFluentIcons", // NOTE: Segoe fluent icons postscript name is inconsistent
435 "Segoe Fluent Icons",
436 ];
437
438 if font.as_swash().charmap().map('m') == 0
439 && !allowed_bad_font_names.contains(&postscript_name.as_str())
440 {
441 self.font_system.db_mut().remove_face(font.id());
442 continue;
443 };
444
445 let font_id = FontId(self.loaded_fonts.len());
446 loaded_font_ids.push(font_id);
447 self.loaded_fonts.push(LoadedFont {
448 font,
449 features: cosmic_features.clone(),
450 is_known_emoji_font: check_is_known_emoji_font(&postscript_name),
451 user_fallback_chain: Arc::clone(&user_fallback_chain),
452 });
453 self.loaded_font_ids_by_key.insert(key, font_id);
454 }
455
456 Ok(loaded_font_ids)
457 }
458
459 fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Size<f32>> {
460 let glyph_metrics = self.loaded_font(font_id).font.as_swash().glyph_metrics(&[]);
461 Ok(Size {
462 width: glyph_metrics.advance_width(glyph_id.0 as u16),
463 height: glyph_metrics.advance_height(glyph_id.0 as u16),
464 })
465 }
466
467 fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option<GlyphId> {
468 let glyph_id = self.loaded_font(font_id).font.as_swash().charmap().map(ch);
469 if glyph_id == 0 {
470 None
471 } else {
472 Some(GlyphId(glyph_id.into()))
473 }
474 }
475
476 fn raster_bounds(&mut self, params: &RenderGlyphParams) -> Result<Bounds<DevicePixels>> {
477 let image = self.render_glyph_image(params)?;
478 let bounds = Bounds {
479 origin: point(image.placement.left.into(), (-image.placement.top).into()),
480 size: size(image.placement.width.into(), image.placement.height.into()),
481 };
482 if !bounds.is_zero() {
483 self.pending_glyph_images.insert(params.clone(), image);
484 }
485 Ok(bounds)
486 }
487
488 #[profiling::function]
489 fn rasterize_glyph(
490 &mut self,
491 params: &RenderGlyphParams,
492 glyph_bounds: Bounds<DevicePixels>,
493 ) -> Result<(Size<DevicePixels>, Vec<u8>)> {
494 if glyph_bounds.size.width.0 == 0 || glyph_bounds.size.height.0 == 0 {
495 anyhow::bail!("glyph bounds are empty");
496 }
497
498 let mut image = match self.pending_glyph_images.remove(params) {
499 Some(image) => image,
500 None => self.render_glyph_image(params)?,
501 };
502 let bitmap_size = glyph_bounds.size;
503 match image.content {
504 swash::scale::image::Content::Color | swash::scale::image::Content::SubpixelMask => {
505 // Convert from RGBA to BGRA.
506 for pixel in image.data.chunks_exact_mut(4) {
507 pixel.swap(0, 2);
508 }
509 Ok((bitmap_size, image.data))
510 }
511 swash::scale::image::Content::Mask => {
512 if params.subpixel_rendering {
513 // We must always return RGBA data when subpixel rendering is requested.
514 let expanded = image.data.iter().flat_map(|&a| [a, a, a, a]).collect();
515 Ok((bitmap_size, expanded))
516 } else {
517 Ok((bitmap_size, image.data))
518 }
519 }
520 }
521 }
522
523 fn render_glyph_image(
524 &mut self,
525 params: &RenderGlyphParams,
526 ) -> Result<swash::scale::image::Image> {
527 let loaded_font = &self.loaded_fonts[params.font_id.0];
528 let font_ref = loaded_font.font.as_swash();
529 let pixel_size = f32::from(params.font_size);
530
531 let subpixel_offset = Vector::new(
532 params.subpixel_variant.x as f32 / SUBPIXEL_VARIANTS_X as f32 / params.scale_factor,
533 params.subpixel_variant.y as f32 / SUBPIXEL_VARIANTS_Y as f32 / params.scale_factor,
534 );
535
536 let mut scaler = self
537 .swash_scale_context
538 .builder(font_ref)
539 .size(pixel_size * params.scale_factor)
540 .hint(true)
541 .build();
542
543 let sources: &[Source] = if params.is_emoji {
544 &[
545 Source::ColorOutline(0),
546 Source::ColorBitmap(StrikeWith::BestFit),
547 Source::Outline,
548 ]
549 } else {
550 &[Source::Bitmap(StrikeWith::ExactSize), Source::Outline]
551 };
552
553 let mut renderer = Render::new(sources);
554 if params.subpixel_rendering {
555 // There seems to be a bug in Swash where the B and R values are swapped.
556 renderer
557 .format(Format::subpixel_bgra())
558 .offset(subpixel_offset);
559 } else {
560 renderer.format(Format::Alpha).offset(subpixel_offset);
561 }
562
563 let glyph_id: u16 = params.glyph_id.0.try_into()?;
564 renderer
565 .render(&mut scaler, glyph_id)
566 .with_context(|| format!("unable to render glyph via swash for {params:?}"))
567 }
568
569 /// This is used when cosmic_text has chosen a fallback font instead of using the requested
570 /// font, typically to handle some unicode characters. When this happens, `loaded_fonts` may not
571 /// yet have an entry for this fallback font, and so one is added.
572 ///
573 /// Note that callers shouldn't use this `FontId` somewhere that will retrieve the corresponding
574 /// `LoadedFont.features`, as it will have an arbitrarily chosen or empty value. The only
575 /// current use of this field is for the *input* of `layout_line`, and so it's fine to use
576 /// `font_id_for_cosmic_id` when computing the *output* of `layout_line`.
577 fn font_id_for_cosmic_id(&mut self, id: cosmic_text::fontdb::ID) -> Result<FontId> {
578 if let Some(ix) = self
579 .loaded_fonts
580 .iter()
581 .position(|loaded_font| loaded_font.font.id() == id)
582 {
583 Ok(FontId(ix))
584 } else {
585 let font = self
586 .font_system
587 .get_font(id, cosmic_text::Weight::NORMAL)
588 .context("failed to get fallback font from cosmic-text font system")?;
589 let face = self
590 .font_system
591 .db()
592 .face(id)
593 .context("fallback font face not found in cosmic-text database")?;
594
595 let font_id = FontId(self.loaded_fonts.len());
596 self.loaded_fonts.push(LoadedFont {
597 font,
598 features: CosmicFontFeatures::new(),
599 is_known_emoji_font: check_is_known_emoji_font(&face.post_script_name),
600 user_fallback_chain: Arc::from(Vec::new()),
601 });
602
603 Ok(font_id)
604 }
605 }
606
607 #[profiling::function]
608 fn layout_line(&mut self, text: &str, font_size: Pixels, font_runs: &[FontRun]) -> LineLayout {
609 if contains_paragraph_separator(text) {
610 self.layout_line_with_separators(text, font_size, font_runs)
611 } else {
612 self.layout_line_no_separators(text, font_size, font_runs)
613 }
614 }
615
616 fn layout_line_with_separators(
617 &mut self,
618 text: &str,
619 font_size: Pixels,
620 font_runs: &[FontRun],
621 ) -> LineLayout {
622 let mut layout = LineLayout {
623 font_size,
624 len: text.len(),
625 ..Default::default()
626 };
627 let mut paragraph_start = 0;
628
629 for (separator_start, separator) in text
630 .char_indices()
631 .filter(|(_, character)| is_paragraph_separator(*character))
632 {
633 let separator_end = separator_start + separator.len_utf8();
634 self.shape_segment(
635 text,
636 paragraph_start..separator_start,
637 font_size,
638 font_runs,
639 &mut layout,
640 );
641 self.shape_segment(
642 text,
643 separator_start..separator_end,
644 font_size,
645 font_runs,
646 &mut layout,
647 );
648 paragraph_start = separator_end;
649 }
650
651 self.shape_segment(
652 text,
653 paragraph_start..text.len(),
654 font_size,
655 font_runs,
656 &mut layout,
657 );
658
659 layout
660 }
661
662 fn shape_segment(
663 &mut self,
664 text: &str,
665 range: Range<usize>,
666 font_size: Pixels,
667 font_runs: &[FontRun],
668 layout: &mut LineLayout,
669 ) {
670 if range.is_empty() {
671 return;
672 }
673
674 let segment_font_runs = clip_font_runs(font_runs, range.clone());
675 let segment =
676 self.layout_line_no_separators(&text[range.clone()], font_size, &segment_font_runs);
677
678 let mut segment_runs = segment.runs;
679 for run in &mut segment_runs {
680 for glyph in &mut run.glyphs {
681 glyph.index += range.start;
682 glyph.position.x += layout.width;
683 }
684 }
685
686 for mut run in segment_runs {
687 if let Some(same_run) = layout
688 .runs
689 .last_mut()
690 .filter(|last| last.font_id == run.font_id)
691 {
692 same_run.glyphs.append(&mut run.glyphs);
693 } else {
694 layout.runs.push(run);
695 }
696 }
697
698 layout.width += segment.width;
699 layout.ascent = layout.ascent.max(segment.ascent);
700 layout.descent = layout.descent.max(segment.descent);
701 }
702
703 fn layout_line_no_separators(
704 &mut self,
705 text: &str,
706 font_size: Pixels,
707 font_runs: &[FontRun],
708 ) -> LineLayout {
709 let mut attrs_list = AttrsList::new(&Attrs::new());
710 let mut offs = 0;
711 for run in font_runs {
712 let run_end = offs + run.len;
713
714 let Some(properties) = self.font_match_properties(run.font_id) else {
715 offs = run_end;
716 continue;
717 };
718
719 let primary_attrs = properties.attributes(run.font_id, &properties.primary_family_name);
720 let fallback_attrs: SmallVec<[Attrs<'_>; 4]> = properties
721 .fallback_chain
722 .iter()
723 .map(|(font_id, family_name)| properties.attributes(*font_id, family_name))
724 .collect();
725
726 let spans = if properties.fallback_chain.is_empty() {
727 let mut spans = SmallVec::<[RunSpan; 4]>::new();
728 spans.push(RunSpan {
729 start: offs,
730 end: run_end,
731 slot: None,
732 font_id: run.font_id,
733 });
734 spans
735 } else {
736 let loaded_fonts = &self.loaded_fonts;
737 let covers = |id: FontId, ch: char| charmap_covers(loaded_fonts, id, ch);
738 compute_run_spans(
739 text,
740 offs,
741 run.len,
742 run.font_id,
743 &properties.fallback_chain,
744 &covers,
745 )
746 };
747
748 for span in spans {
749 let attrs = match span.slot {
750 None => &primary_attrs,
751 Some(ix) => &fallback_attrs[ix],
752 };
753 attrs_list.add_span(span.start..span.end, attrs);
754 }
755 offs = run_end;
756 }
757
758 let line = ShapeLine::new(
759 &mut self.font_system,
760 text,
761 &attrs_list,
762 cosmic_text::Shaping::Advanced,
763 4,
764 );
765 let mut layout_lines = Vec::with_capacity(1);
766 line.layout_to_buffer(
767 &mut self.scratch,
768 f32::from(font_size),
769 None, // We do our own wrapping
770 cosmic_text::Wrap::None,
771 Ellipsize::None,
772 None,
773 &mut layout_lines,
774 None,
775 cosmic_text::Hinting::Disabled,
776 );
777
778 let Some(layout) = layout_lines.first() else {
779 return LineLayout {
780 font_size,
781 width: Pixels::ZERO,
782 ascent: Pixels::ZERO,
783 descent: Pixels::ZERO,
784 runs: Vec::new(),
785 len: text.len(),
786 };
787 };
788
789 let missing_glyphs = self.missing_glyph_sink.as_ref().map(|_| {
790 self.missing_glyphs(
791 text,
792 font_runs,
793 layout
794 .glyphs
795 .iter()
796 .filter(|glyph| glyph.glyph_id == 0)
797 .map(|glyph| glyph.start),
798 )
799 });
800
801 let mut runs: Vec<ShapedRun> = Vec::new();
802 for glyph in &layout.glyphs {
803 let mut font_id = FontId(glyph.metadata);
804 let mut loaded_font = self.loaded_font(font_id);
805 if loaded_font.font.id() != glyph.font_id {
806 match self.font_id_for_cosmic_id(glyph.font_id) {
807 std::result::Result::Ok(resolved_id) => {
808 font_id = resolved_id;
809 loaded_font = self.loaded_font(font_id);
810 }
811 Err(error) => {
812 log::warn!(
813 "failed to resolve cosmic font id {:?}: {error:#}",
814 glyph.font_id
815 );
816 continue;
817 }
818 }
819 }
820 let is_emoji = loaded_font.is_known_emoji_font;
821
822 // HACK: Prevent crash caused by variation selectors.
823 if glyph.glyph_id == 3 && is_emoji {
824 continue;
825 }
826
827 let shaped_glyph = ShapedGlyph {
828 id: GlyphId(glyph.glyph_id as u32),
829 position: point(glyph.x.into(), glyph.y.into()),
830 index: glyph.start,
831 is_emoji,
832 };
833
834 if let Some(last_run) = runs
835 .last_mut()
836 .filter(|last_run| last_run.font_id == font_id)
837 {
838 last_run.glyphs.push(shaped_glyph);
839 } else {
840 runs.push(ShapedRun {
841 font_id,
842 glyphs: vec![shaped_glyph],
843 });
844 }
845 }
846
847 if let Some((sink, missing_glyphs)) = self.missing_glyph_sink.as_ref().zip(missing_glyphs) {
848 sink.report(missing_glyphs);
849 }
850
851 LineLayout {
852 font_size,
853 width: layout.w.into(),
854 ascent: layout.max_ascent.into(),
855 descent: layout.max_descent.into(),
856 runs,
857 len: text.len(),
858 }
859 }
860
861 fn missing_glyphs(
862 &self,
863 text: &str,
864 font_runs: &[FontRun],
865 missing_text_indices: impl IntoIterator<Item = usize>,
866 ) -> Vec<MissingGlyph> {
867 let mut missing_text_indices = missing_text_indices.into_iter().peekable();
868 if missing_text_indices.peek().is_none() {
869 return Vec::new();
870 }
871 let mut missing_text_indices = missing_text_indices.collect::<Vec<_>>();
872 missing_text_indices.sort_unstable();
873 missing_text_indices.dedup();
874
875 let mut font_run_index = 0;
876 let mut font_run_end = font_runs.first().map_or(0, |font_run| font_run.len);
877 let mut missing_glyphs = Vec::new();
878 let mut missing_index = 0;
879 for (grapheme_start, grapheme) in text.grapheme_indices(true) {
880 let grapheme_end = grapheme_start + grapheme.len();
881 while missing_text_indices
882 .get(missing_index)
883 .is_some_and(|text_index| *text_index < grapheme_start)
884 {
885 missing_index += 1;
886 }
887 let Some(&text_index) = missing_text_indices.get(missing_index) else {
888 break;
889 };
890 if text_index >= grapheme_end {
891 continue;
892 }
893
894 while font_run_end <= text_index && font_run_index + 1 < font_runs.len() {
895 font_run_index += 1;
896 let Some(font_run) = font_runs.get(font_run_index) else {
897 break;
898 };
899 font_run_end += font_run.len;
900 }
901 let font_class = self.fallback_font_class(
902 font_runs
903 .get(font_run_index)
904 .or_else(|| font_runs.last())
905 .map(|font_run| font_run.font_id),
906 );
907 missing_glyphs.push(MissingGlyph::new(grapheme.into(), font_class));
908 while missing_text_indices
909 .get(missing_index)
910 .is_some_and(|text_index| *text_index < grapheme_end)
911 {
912 missing_index += 1;
913 }
914 }
915 missing_glyphs
916 }
917
918 fn fallback_font_class(&self, font_id: Option<FontId>) -> FallbackFontClass {
919 let Some(font_id) = font_id else {
920 return FallbackFontClass::Proportional;
921 };
922 let loaded_font = self.loaded_font(font_id);
923 let is_monospace = self
924 .font_system
925 .db()
926 .face(loaded_font.font.id())
927 .is_some_and(|face| face.monospaced);
928 if is_monospace {
929 FallbackFontClass::Monospace
930 } else {
931 FallbackFontClass::Proportional
932 }
933 }
934 }
935
936 #[inline(always)]
937 fn is_paragraph_separator(character: char) -> bool {
938 unicode_bidi::bidi_class(character) == unicode_bidi::BidiClass::B
939 }
940
941 fn contains_paragraph_separator(text: &str) -> bool {
942 if text
943 .bytes()
944 .any(|byte| matches!(byte, b'\n' | b'\r' | 0x1c | 0x1d | 0x1e))
945 {
946 return true;
947 }
948
949 !text.is_ascii() && text.chars().any(is_paragraph_separator)
950 }
951
952 fn clip_font_runs(font_runs: &[FontRun], range: Range<usize>) -> SmallVec<[FontRun; 4]> {
953 let mut clipped = SmallVec::new();
954 let mut offs = 0;
955 for run in font_runs {
956 let run_start = offs;
957 offs += run.len;
958 if offs <= range.start {
959 continue;
960 }
961 if run_start >= range.end {
962 break;
963 }
964 let start = run_start.max(range.start);
965 let end = offs.min(range.end);
966 if start < end {
967 clipped.push(FontRun {
968 len: end - start,
969 font_id: run.font_id,
970 });
971 }
972 }
973 clipped
974 }
975
976 #[cfg(feature = "font-kit")]
977 fn find_best_match(
978 font: &Font,
979 candidates: &[FontId],
980 state: &CosmicTextSystemState,
981 ) -> Result<usize> {
982 let candidate_properties = candidates
983 .iter()
984 .map(|font_id| {
985 let database_id = state.loaded_font(*font_id).font.id();
986 let face_info = state
987 .font_system
988 .db()
989 .face(database_id)
990 .context("font face not found in database")?;
991 Ok(face_info_into_properties(face_info))
992 })
993 .collect::<Result<SmallVec<[_; 4]>>>()?;
994
995 let ix =
996 font_kit::matching::find_best_match(&candidate_properties, &font_into_properties(font))
997 .context("requested font family contains no font matching the other parameters")?;
998
999 Ok(ix)
1000 }
1001
1002 #[cfg(not(feature = "font-kit"))]
1003 fn find_best_match(
1004 font: &Font,
1005 candidates: &[FontId],
1006 state: &CosmicTextSystemState,
1007 ) -> Result<usize> {
1008 if candidates.is_empty() {
1009 anyhow::bail!("requested font family contains no font matching the other parameters");
1010 }
1011 if candidates.len() == 1 {
1012 return Ok(0);
1013 }
1014
1015 let target_weight = font.weight.0;
1016 let target_italic = matches!(
1017 font.style,
1018 gpui::FontStyle::Italic | gpui::FontStyle::Oblique
1019 );
1020
1021 let mut best_index = 0;
1022 let mut best_score = u32::MAX;
1023
1024 for (index, font_id) in candidates.iter().enumerate() {
1025 let database_id = state.loaded_font(*font_id).font.id();
1026 let face_info = state
1027 .font_system
1028 .db()
1029 .face(database_id)
1030 .context("font face not found in database")?;
1031
1032 let is_italic = matches!(
1033 face_info.style,
1034 cosmic_text::Style::Italic | cosmic_text::Style::Oblique
1035 );
1036 let style_penalty: u32 = if is_italic == target_italic { 0 } else { 1000 };
1037 let weight_diff = (face_info.weight.0 as i32 - target_weight as i32).unsigned_abs();
1038 let score = style_penalty + weight_diff;
1039
1040 if score < best_score {
1041 best_score = score;
1042 best_index = index;
1043 }
1044 }
1045
1046 Ok(best_index)
1047 }
1048
1049 /// one contiguous slice of a `FontRun` that maps to a single slot. `slot` is
1050 /// `None` for the primary font and `Some(ix)` for `fallback_chain[ix]`.
1051 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
1052 struct RunSpan {
1053 start: usize,
1054 end: usize,
1055 slot: Option<usize>,
1056 font_id: FontId,
1057 }
1058
1059 /// walks `text[run_offset..run_offset + run_len]` and groups codepoints into
1060 /// spans. inheriting codepoints stay in the current span so shaping clusters
1061 /// like emoji zwj sequences and combining marks are not torn apart.
1062 fn compute_run_spans(
1063 text: &str,
1064 run_offset: usize,
1065 run_len: usize,
1066 primary: FontId,
1067 fallback_chain: &[(FontId, SharedString)],
1068 covers: &impl Fn(FontId, char) -> bool,
1069 ) -> SmallVec<[RunSpan; 4]> {
1070 let mut spans = SmallVec::new();
1071 let run_end = run_offset + run_len;
1072 if run_end <= run_offset {
1073 return spans;
1074 }
1075 if fallback_chain.is_empty() {
1076 spans.push(RunSpan {
1077 start: run_offset,
1078 end: run_end,
1079 slot: None,
1080 font_id: primary,
1081 });
1082 return spans;
1083 }
1084 let run_text = &text[run_offset..run_end];
1085 let mut span_start = run_offset;
1086 let mut span_slot: Option<usize> = None;
1087 let mut span_font_id = primary;
1088 for (grapheme_idx, grapheme) in run_text.grapheme_indices(true) {
1089 let abs = run_offset + grapheme_idx;
1090 let ch = grapheme.chars().next().unwrap_or('\0');
1091 let next_slot = pick_covering_slot(ch, span_slot, primary, fallback_chain, covers);
1092 if next_slot == span_slot {
1093 continue;
1094 }
1095 if abs > span_start {
1096 spans.push(RunSpan {
1097 start: span_start,
1098 end: abs,
1099 slot: span_slot,
1100 font_id: span_font_id,
1101 });
1102 }
1103 span_start = abs;
1104 span_slot = next_slot;
1105 span_font_id = slot_font_id(next_slot, primary, fallback_chain);
1106 }
1107 if span_start < run_end {
1108 spans.push(RunSpan {
1109 start: span_start,
1110 end: run_end,
1111 slot: span_slot,
1112 font_id: span_font_id,
1113 });
1114 }
1115 spans
1116 }
1117
1118 fn slot_font_id(
1119 slot: Option<usize>,
1120 primary: FontId,
1121 fallback_chain: &[(FontId, SharedString)],
1122 ) -> FontId {
1123 match slot {
1124 None => primary,
1125 Some(ix) => fallback_chain[ix].0,
1126 }
1127 }
1128
1129 fn pick_covering_slot(
1130 ch: char,
1131 current: Option<usize>,
1132 primary: FontId,
1133 fallback_chain: &[(FontId, SharedString)],
1134 covers: &impl Fn(FontId, char) -> bool,
1135 ) -> Option<usize> {
1136 if (ch as u32) <= 0x7F {
1137 return None;
1138 }
1139 if covers(primary, ch) {
1140 return None;
1141 }
1142 let current_id = slot_font_id(current, primary, fallback_chain);
1143 if covers(current_id, ch) {
1144 return current;
1145 }
1146
1147 fallback_chain
1148 .iter()
1149 .position(|(fb_id, _)| covers(*fb_id, ch))
1150 }
1151
1152 fn charmap_covers(loaded_fonts: &[LoadedFont], id: FontId, ch: char) -> bool {
1153 loaded_fonts
1154 .get(id.0)
1155 .is_some_and(|loaded| loaded.font.as_swash().charmap().map(ch) != 0)
1156 }
1157
1158 fn cosmic_font_features(features: &FontFeatures) -> Result<CosmicFontFeatures> {
1159 let mut result = CosmicFontFeatures::new();
1160 for feature in features.0.iter() {
1161 let name_bytes: [u8; 4] = feature
1162 .0
1163 .as_bytes()
1164 .try_into()
1165 .context("Incorrect feature flag format")?;
1166
1167 let tag = cosmic_text::FeatureTag::new(&name_bytes);
1168
1169 result.set(tag, feature.1);
1170 }
1171 Ok(result)
1172 }
1173
1174 #[cfg(feature = "font-kit")]
1175 fn font_into_properties(font: &gpui::Font) -> font_kit::properties::Properties {
1176 font_kit::properties::Properties {
1177 style: match font.style {
1178 gpui::FontStyle::Normal => font_kit::properties::Style::Normal,
1179 gpui::FontStyle::Italic => font_kit::properties::Style::Italic,
1180 gpui::FontStyle::Oblique => font_kit::properties::Style::Oblique,
1181 },
1182 weight: font_kit::properties::Weight(font.weight.0),
1183 stretch: Default::default(),
1184 }
1185 }
1186
1187 #[cfg(feature = "font-kit")]
1188 fn face_info_into_properties(
1189 face_info: &cosmic_text::fontdb::FaceInfo,
1190 ) -> font_kit::properties::Properties {
1191 font_kit::properties::Properties {
1192 style: match face_info.style {
1193 cosmic_text::Style::Normal => font_kit::properties::Style::Normal,
1194 cosmic_text::Style::Italic => font_kit::properties::Style::Italic,
1195 cosmic_text::Style::Oblique => font_kit::properties::Style::Oblique,
1196 },
1197 weight: font_kit::properties::Weight(face_info.weight.0.into()),
1198 stretch: match face_info.stretch {
1199 cosmic_text::Stretch::Condensed => font_kit::properties::Stretch::CONDENSED,
1200 cosmic_text::Stretch::Expanded => font_kit::properties::Stretch::EXPANDED,
1201 cosmic_text::Stretch::ExtraCondensed => font_kit::properties::Stretch::EXTRA_CONDENSED,
1202 cosmic_text::Stretch::ExtraExpanded => font_kit::properties::Stretch::EXTRA_EXPANDED,
1203 cosmic_text::Stretch::Normal => font_kit::properties::Stretch::NORMAL,
1204 cosmic_text::Stretch::SemiCondensed => font_kit::properties::Stretch::SEMI_CONDENSED,
1205 cosmic_text::Stretch::SemiExpanded => font_kit::properties::Stretch::SEMI_EXPANDED,
1206 cosmic_text::Stretch::UltraCondensed => font_kit::properties::Stretch::ULTRA_CONDENSED,
1207 cosmic_text::Stretch::UltraExpanded => font_kit::properties::Stretch::ULTRA_EXPANDED,
1208 },
1209 }
1210 }
1211
1212 fn check_is_known_emoji_font(postscript_name: &str) -> bool {
1213 // TODO: Include other common emoji fonts
1214 postscript_name == "NotoColorEmoji"
1215 }
1216
1217 #[cfg(test)]
1218 mod tests {
1219 use super::*;
1220 #[cfg(feature = "test-support")]
1221 use std::{cell::RefCell, rc::Rc};
1222
1223 #[test]
1224 fn all_font_names_tracks_available_families() -> Result<()> {
1225 let text_system = gpui::TextSystem::new(Arc::new(
1226 CosmicTextSystem::new_without_system_fonts("IBM Plex Sans"),
1227 ));
1228 assert!(text_system.all_font_names().is_empty());
1229
1230 text_system.add_fonts(vec![Cow::Borrowed(include_bytes!(
1231 "../../../assets/fonts/lilex/Lilex-Regular.ttf"
1232 ))])?;
1233 assert_eq!(text_system.all_font_names(), ["Lilex"]);
1234
1235 text_system.add_fonts(vec![
1236 Cow::Borrowed(IBM_PLEX),
1237 Cow::Borrowed(include_bytes!("../../../assets/fonts/lilex/Lilex-Bold.ttf")),
1238 ])?;
1239 assert_eq!(text_system.all_font_names(), ["IBM Plex Sans", "Lilex"]);
1240 Ok(())
1241 }
1242
1243 fn fid(i: usize) -> FontId {
1244 FontId(i)
1245 }
1246
1247 fn chain(ids: &[usize]) -> SmallVec<[(FontId, SharedString); 4]> {
1248 ids.iter()
1249 .map(|&i| (fid(i), SharedString::from(format!("fb{i}"))))
1250 .collect()
1251 }
1252
1253 fn span(start: usize, end: usize, slot: Option<usize>, font_id: FontId) -> RunSpan {
1254 RunSpan {
1255 start,
1256 end,
1257 slot,
1258 font_id,
1259 }
1260 }
1261
1262 const IBM_PLEX: &[u8] =
1263 include_bytes!("../../../assets/fonts/ibm-plex-sans/IBMPlexSans-Regular.ttf");
1264 const LILEX: &[u8] = include_bytes!("../../../assets/fonts/lilex/Lilex-Regular.ttf");
1265
1266 /// Every code point of `Bidi_Class=B`, each of which starts a new bidi
1267 /// paragraph and so can split one line into mixed-direction paragraphs.
1268 const SEPARATORS: &[char] = &[
1269 '\u{000a}', '\u{000d}', '\u{001c}', '\u{001d}', '\u{001e}', '\u{0085}', '\u{2029}',
1270 ];
1271
1272 fn text_system() -> Result<CosmicTextSystem> {
1273 let text_system = CosmicTextSystem::new_without_system_fonts("IBM Plex Sans");
1274 text_system.add_fonts(vec![Cow::Borrowed(IBM_PLEX)])?;
1275 Ok(text_system)
1276 }
1277
1278 #[test]
1279 fn font_properties_describe_the_selected_face() -> Result<()> {
1280 let text_system = text_system()?;
1281 let regular = gpui::font("IBM Plex Sans");
1282 let regular_id = text_system.font_id(&regular)?;
1283 for (weight, style) in [
1284 (gpui::FontWeight::MEDIUM, gpui::FontStyle::Normal),
1285 (gpui::FontWeight::BOLD, gpui::FontStyle::Italic),
1286 (gpui::FontWeight::NORMAL, gpui::FontStyle::Oblique),
1287 ] {
1288 let requested = Font {
1289 weight,
1290 style,
1291 ..regular.clone()
1292 };
1293 let font_id = text_system.font_id(&requested)?;
1294 assert_eq!(font_id, regular_id);
1295 assert_eq!(
1296 text_system.font_weight_and_style(font_id)?,
1297 (gpui::FontWeight::NORMAL, gpui::FontStyle::Normal)
1298 );
1299 }
1300 Ok(())
1301 }
1302
1303 fn layout_text(text_system: &CosmicTextSystem, text: &str) -> Result<LineLayout> {
1304 let font_id = text_system.font_id(&gpui::font("IBM Plex Sans"))?;
1305 let runs = [FontRun {
1306 len: text.len(),
1307 font_id,
1308 }];
1309 Ok(text_system.layout_line(text, gpui::px(14.0), &runs))
1310 }
1311
1312 /// Mirrors the original crash: mixed-direction text reaching the shaper
1313 /// through `shape_text`, which only splits lines on `\n`.
1314 #[test]
1315 fn shape_text_with_mixed_direction_paragraphs() -> Result<()> {
1316 let platform_text_system = Arc::new(text_system()?);
1317 let text_system = Arc::new(gpui::TextSystem::new(platform_text_system));
1318 let window_text_system = gpui::WindowTextSystem::new(text_system);
1319
1320 let text: SharedString = "first line\n\u{05d0}\u{001c}A".into();
1321 let runs = [gpui::TextRun {
1322 len: text.len(),
1323 font: gpui::font("IBM Plex Sans"),
1324 ..Default::default()
1325 }];
1326
1327 let lines = window_text_system.shape_text(text, gpui::px(14.0), &runs, None, None)?;
1328
1329 assert_eq!(lines.len(), 2);
1330 assert_eq!(lines[1].len(), "\u{05d0}\u{001c}A".len());
1331 assert!(lines[1].width() > Pixels::ZERO);
1332 Ok(())
1333 }
1334
1335 #[cfg(feature = "test-support")]
1336 #[test]
1337 fn reports_graphemes_that_exhaust_font_fallback() -> Result<()> {
1338 let platform_text_system = Arc::new(text_system()?);
1339 let dispatcher = gpui::TestDispatcher::new(0);
1340 let cx =
1341 gpui::TestAppContext::build_with_text_system(dispatcher, None, platform_text_system);
1342 let observed = Rc::new(RefCell::new(Vec::new()));
1343 let _subscription = cx.update(|cx| {
1344 let observed = observed.clone();
1345 cx.on_missing_glyphs(move |missing_glyphs, _| {
1346 observed.borrow_mut().extend_from_slice(missing_glyphs);
1347 })
1348 });
1349 let text: SharedString = "界".into();
1350
1351 cx.update(|cx| {
1352 let text_system = gpui::WindowTextSystem::new(cx.text_system().clone());
1353 let runs = [gpui::TextRun {
1354 len: text.len(),
1355 font: gpui::font("IBM Plex Sans"),
1356 ..Default::default()
1357 }];
1358 text_system.shape_line(text, gpui::px(14.0), &runs, None);
1359 });
1360 cx.run_until_parked();
1361
1362 let observed = observed.borrow();
1363 assert_eq!(observed.len(), 1);
1364 assert_eq!(observed[0].grapheme(), "界");
1365 assert_eq!(
1366 observed[0].font_class(),
1367 gpui::FallbackFontClass::Proportional
1368 );
1369 Ok(())
1370 }
1371
1372 #[test]
1373 fn combines_missing_glyphs_from_one_grapheme() -> Result<()> {
1374 let text_system = text_system()?;
1375 let font_id = text_system.font_id(&gpui::font("IBM Plex Sans"))?;
1376 let text = "x\u{0301}";
1377 let runs = [FontRun {
1378 len: text.len(),
1379 font_id,
1380 }];
1381
1382 let missing_glyphs = text_system
1383 .0
1384 .read()
1385 .missing_glyphs(text, &runs, [0, "x".len()]);
1386
1387 assert_eq!(missing_glyphs.len(), 1);
1388 assert_eq!(missing_glyphs[0].grapheme(), text);
1389 Ok(())
1390 }
1391
1392 #[test]
1393 fn adding_fonts_invalidates_cached_line_layouts() -> Result<()> {
1394 let platform_text_system = Arc::new(text_system()?);
1395 let text_system = Arc::new(gpui::TextSystem::new(platform_text_system.clone()));
1396 let window_text_system = gpui::WindowTextSystem::new(text_system.clone());
1397 let text: SharedString = "cached text".into();
1398 let runs = [gpui::TextRun {
1399 len: text.len(),
1400 font: gpui::font("IBM Plex Sans"),
1401 ..Default::default()
1402 }];
1403
1404 let first_layout = window_text_system.shape_line(text.clone(), gpui::px(14.0), &runs, None);
1405 let cached_layout =
1406 window_text_system.shape_line(text.clone(), gpui::px(14.0), &runs, None);
1407 assert!(std::ptr::eq::<LineLayout>(
1408 &**first_layout,
1409 &**cached_layout
1410 ));
1411 let loaded_font_count = platform_text_system.0.read().loaded_fonts.len();
1412
1413 text_system.add_fonts(vec![Cow::Borrowed(LILEX)])?;
1414
1415 let refreshed_layout = window_text_system.shape_line(text, gpui::px(14.0), &runs, None);
1416 assert!(!std::ptr::eq::<LineLayout>(
1417 &**first_layout,
1418 &**refreshed_layout
1419 ));
1420 assert_eq!(
1421 platform_text_system.0.read().loaded_fonts.len(),
1422 loaded_font_count
1423 );
1424 Ok(())
1425 }
1426
1427 #[test]
1428 fn layout_line_with_mixed_direction_paragraphs() -> Result<()> {
1429 let text_system = text_system()?;
1430
1431 for separator in SEPARATORS {
1432 for text in [
1433 format!("\u{05d0}{separator}A"),
1434 format!("A{separator}\u{05d0}"),
1435 ] {
1436 let layout = layout_text(&text_system, &text)?;
1437
1438 assert_eq!(layout.len, text.len(), "{text:?}");
1439 assert!(layout.width > Pixels::ZERO, "{text:?}");
1440 assert!(
1441 layout.runs.iter().any(|run| !run.glyphs.is_empty()),
1442 "{text:?}"
1443 );
1444 }
1445 }
1446
1447 Ok(())
1448 }
1449
1450 #[test]
1451 fn layout_line_with_separators_at_line_edges() -> Result<()> {
1452 let text_system = text_system()?;
1453
1454 for text in [
1455 "\u{001c}",
1456 "\u{001c}\u{001c}",
1457 "\u{001c}\u{05d0}",
1458 "\u{05d0}\u{001c}",
1459 "\u{05d0}\u{001c}\u{001c}A",
1460 "\u{001c}\u{05d0}\u{001c}A\u{001c}",
1461 ] {
1462 let layout = layout_text(&text_system, text)?;
1463 assert_eq!(layout.len, text.len(), "{text:?}");
1464 }
1465
1466 Ok(())
1467 }
1468
1469 /// Glyph indices must stay absolute and positions ordered across segment
1470 /// boundaries, otherwise cursor placement and hit testing desync. Uses
1471 /// single-direction text so visual order matches logical order.
1472 #[test]
1473 fn layout_line_keeps_indices_and_positions_ordered_across_paragraphs() -> Result<()> {
1474 let text_system = text_system()?;
1475 let text = "ab\u{001c}cd\u{2029}ef";
1476 let layout = layout_text(&text_system, text)?;
1477
1478 let glyphs: Vec<_> = layout.runs.iter().flat_map(|run| &run.glyphs).collect();
1479 assert!(!glyphs.is_empty());
1480
1481 for glyph in &glyphs {
1482 assert!(glyph.index < text.len(), "{:?}", glyph.index);
1483 assert!(text.is_char_boundary(glyph.index), "{:?}", glyph.index);
1484 }
1485 for pair in glyphs.windows(2) {
1486 assert!(pair[0].index < pair[1].index);
1487 assert!(pair[0].position.x <= pair[1].position.x);
1488 }
1489
1490 // Every segment contributes width, so the whole line is wider than its
1491 // leading paragraph alone.
1492 assert!(layout.width > layout_text(&text_system, "ab")?.width);
1493 Ok(())
1494 }
1495
1496 /// A font run boundary that does not line up with a paragraph boundary must
1497 /// still be clipped to the right segments.
1498 #[test]
1499 fn layout_line_with_font_run_straddling_a_separator() -> Result<()> {
1500 let text_system = text_system()?;
1501 let font_id = text_system.font_id(&gpui::font("IBM Plex Sans"))?;
1502 let text = "ab\u{001c}\u{05d0}\u{05d1}";
1503
1504 // The run boundary falls inside the trailing RTL paragraph.
1505 let runs = [
1506 FontRun {
1507 len: "ab\u{001c}\u{05d0}".len(),
1508 font_id,
1509 },
1510 FontRun {
1511 len: "\u{05d1}".len(),
1512 font_id,
1513 },
1514 ];
1515 let layout = text_system.layout_line(text, gpui::px(14.0), &runs);
1516
1517 assert_eq!(layout.len, text.len());
1518 assert!(layout.width > Pixels::ZERO);
1519 Ok(())
1520 }
1521
1522 /// Lines with no separator take the fast path and must be shaped exactly as
1523 /// they were before paragraph splitting existed.
1524 #[test]
1525 fn layout_line_without_separators_takes_fast_path() -> Result<()> {
1526 let text_system = text_system()?;
1527
1528 for text in [
1529 "hello world",
1530 "\u{05d0}\u{05d1}\u{05d2}",
1531 "mixed \u{05d0}\u{05d1}",
1532 ] {
1533 assert!(!contains_paragraph_separator(text), "{text:?}");
1534 let layout = layout_text(&text_system, text)?;
1535 assert_eq!(layout.len, text.len(), "{text:?}");
1536 assert!(layout.width > Pixels::ZERO, "{text:?}");
1537 }
1538
1539 Ok(())
1540 }
1541
1542 /// cosmic-text sums word widths to get a line's width but accumulates glyph
1543 /// advances to position glyphs, so a trailing zero-advance glyph (here a
1544 /// zero-width space) can land a few ulps past the width. When that glyph is a
1545 /// wrap boundary, the row before it extends past the line's width, and hit
1546 /// testing in that sliver used to panic (ZED-BW8, ZED-75K, ZED-81Z).
1547 #[test]
1548 fn index_for_position_past_line_width() -> Result<()> {
1549 let text_system = Arc::new(gpui::TextSystem::new(Arc::new(text_system()?)));
1550 let window_text_system = gpui::WindowTextSystem::new(text_system);
1551 let text: SharedString = "Warning: this will delete files\u{200b}".into();
1552 let runs = [gpui::TextRun {
1553 len: text.len(),
1554 font: gpui::font("IBM Plex Sans"),
1555 ..Default::default()
1556 }];
1557 let lines =
1558 window_text_system.shape_text(text, gpui::px(14.), &runs, Some(gpui::px(4.)), None)?;
1559 let line = &lines[0];
1560 let width = line.unwrapped_layout.width;
1561 let boundary_glyph = |row: usize| {
1562 let boundary = line.wrap_boundaries()[row];
1563 &line.runs()[boundary.run_ix].glyphs[boundary.glyph_ix]
1564 };
1565 let row = (1..line.wrap_boundaries().len())
1566 .find(|row| boundary_glyph(*row).position.x > width)
1567 .expect("trailing zero-width space should be a wrap boundary past the line width");
1568 let row_start_x = f32::from(boundary_glyph(row - 1).position.x);
1569 let row_end = boundary_glyph(row);
1570
1571 let mut x = f32::from(width) - row_start_x;
1572 while x + row_start_x < f32::from(width) {
1573 x = x.next_up();
1574 }
1575 assert!(gpui::px(x + row_start_x) < row_end.position.x);
1576
1577 let line_height = gpui::px(20.);
1578 let position = gpui::point(gpui::px(x), line_height * row as f32 + gpui::px(1.));
1579 assert_eq!(
1580 line.index_for_position(position, line_height),
1581 Err(row_end.index)
1582 );
1583 Ok(())
1584 }
1585
1586 #[test]
1587 fn paragraph_separator_detection() {
1588 for separator in SEPARATORS {
1589 assert!(is_paragraph_separator(*separator), "{separator:?}");
1590 assert!(contains_paragraph_separator(&format!("a{separator}b")));
1591 }
1592
1593 for text in [
1594 "",
1595 "plain ascii",
1596 "\u{05d0}",
1597 "tab\there",
1598 "emoji \u{1f600}",
1599 ] {
1600 assert!(!contains_paragraph_separator(text), "{text:?}");
1601 }
1602 }
1603
1604 #[test]
1605 fn font_runs_are_clipped_to_segment() {
1606 let runs = [
1607 FontRun {
1608 len: 3,
1609 font_id: fid(1),
1610 },
1611 FontRun {
1612 len: 4,
1613 font_id: fid(2),
1614 },
1615 ];
1616
1617 assert_eq!(clip_font_runs(&runs, 0..7).as_slice(), &runs);
1618 assert_eq!(
1619 clip_font_runs(&runs, 2..5).as_slice(),
1620 &[
1621 FontRun {
1622 len: 1,
1623 font_id: fid(1)
1624 },
1625 FontRun {
1626 len: 2,
1627 font_id: fid(2)
1628 },
1629 ]
1630 );
1631 assert_eq!(
1632 clip_font_runs(&runs, 3..7).as_slice(),
1633 &[FontRun {
1634 len: 4,
1635 font_id: fid(2)
1636 }]
1637 );
1638 assert!(clip_font_runs(&runs, 5..5).is_empty());
1639 }
1640
1641 #[test]
1642 fn primary_wins_over_current_fallback_when_primary_covers() {
1643 let primary = fid(0);
1644 let fb = chain(&[1, 2]);
1645 let covers = |id: FontId, _: char| id == fid(0) || id == fid(1);
1646 assert_eq!(
1647 pick_covering_slot('a', Some(0), primary, &fb, &covers),
1648 None
1649 );
1650 }
1651
1652 #[test]
1653 fn primary_preferred_over_fallback_when_both_cover() {
1654 let primary = fid(0);
1655 let fb = chain(&[1]);
1656 let covers = |_: FontId, _: char| true;
1657 assert_eq!(pick_covering_slot('a', None, primary, &fb, &covers), None);
1658 }
1659
1660 #[test]
1661 fn falls_through_chain_in_order() {
1662 let primary = fid(0);
1663 let fb = chain(&[1, 2, 3]);
1664 // only fallback 2 at index 1 covers.
1665 let covers = |id: FontId, _: char| id == fid(2);
1666 assert_eq!(
1667 pick_covering_slot('字', None, primary, &fb, &covers),
1668 Some(1)
1669 );
1670 }
1671
1672 #[test]
1673 fn no_coverage_returns_primary() {
1674 let primary = fid(0);
1675 let fb = chain(&[1, 2]);
1676 let covers = |_: FontId, _: char| false;
1677 // nothing covers. return `None` so the `cosmic-text` built in script
1678 // fallback can take over during shaping.
1679 assert_eq!(
1680 pick_covering_slot('\u{1F600}', Some(1), primary, &fb, &covers),
1681 None
1682 );
1683 }
1684
1685 #[test]
1686 fn empty_chain_always_returns_primary() {
1687 let primary = fid(0);
1688 let fb: SmallVec<[(FontId, SharedString); 4]> = SmallVec::new();
1689 let covers = |_: FontId, _: char| false;
1690 assert_eq!(pick_covering_slot('a', None, primary, &fb, &covers), None);
1691 }
1692
1693 #[test]
1694 fn slot_font_id_resolution() {
1695 let primary = fid(7);
1696 let fb = chain(&[10, 20]);
1697 assert_eq!(slot_font_id(None, primary, &fb), fid(7));
1698 assert_eq!(slot_font_id(Some(0), primary, &fb), fid(10));
1699 assert_eq!(slot_font_id(Some(1), primary, &fb), fid(20));
1700 }
1701
1702 #[test]
1703 fn run_spans_with_no_chain_emit_one_primary_span() {
1704 let primary = fid(0);
1705 let fb: SmallVec<[(FontId, SharedString); 4]> = SmallVec::new();
1706 let covers = |_: FontId, _: char| false;
1707 let text = "hello";
1708 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1709 assert_eq!(spans.as_slice(), &[span(0, text.len(), None, primary)]);
1710 }
1711
1712 #[test]
1713 fn run_spans_use_byte_offsets_for_multibyte_chars() {
1714 let primary = fid(0);
1715 let fb = chain(&[1]);
1716 // primary covers ascii. fallback covers cjk.
1717 let covers = |id: FontId, ch: char| {
1718 if id == primary {
1719 ch.is_ascii()
1720 } else {
1721 !ch.is_ascii()
1722 }
1723 };
1724 let text = "a字b";
1725 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1726 // '字' is 3 bytes so split is at 1 then 4.
1727 assert_eq!(
1728 spans.as_slice(),
1729 &[
1730 span(0, 1, None, primary),
1731 span(1, 4, Some(0), fid(1)),
1732 span(4, 5, None, primary),
1733 ]
1734 );
1735 }
1736
1737 #[test]
1738 fn run_spans_respect_run_offset() {
1739 let primary = fid(0);
1740 let fb = chain(&[1]);
1741 let covers = |id: FontId, ch: char| {
1742 if id == primary {
1743 ch.is_ascii()
1744 } else {
1745 !ch.is_ascii()
1746 }
1747 };
1748 // outer text has a prefix that is not part of this run.
1749 let text = "xx字y";
1750 let run_offset = 2;
1751 let run_len = text.len() - run_offset;
1752 let spans = compute_run_spans(text, run_offset, run_len, primary, &fb, &covers);
1753 assert_eq!(
1754 spans.as_slice(),
1755 &[span(2, 5, Some(0), fid(1)), span(5, 6, None, primary)]
1756 );
1757 }
1758
1759 #[test]
1760 fn run_spans_keep_combining_marks_with_base_in_fallback() {
1761 let primary = fid(0);
1762 let fb = chain(&[1]);
1763 // primary covers ascii only. fallback covers the base char.
1764 // combining mark must stay in the fallback span even when fallback
1765 // does not advertise coverage of it.
1766 let covers = |id: FontId, ch: char| {
1767 if id == primary {
1768 ch.is_ascii()
1769 } else {
1770 ch == '\u{0905}'
1771 }
1772 };
1773 // \u{0905} devanagari short a + \u{0902} candrabindu mark.
1774 let text = "\u{0905}\u{0902}";
1775 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1776 assert_eq!(spans.as_slice(), &[span(0, text.len(), Some(0), fid(1))]);
1777 }
1778
1779 #[test]
1780 fn run_spans_keep_zwj_inside_emoji_cluster() {
1781 let primary = fid(0);
1782 let fb = chain(&[1]);
1783 // only fallback covers the emoji codepoints. zwj must not split.
1784 let covers = |id: FontId, ch: char| id == fid(1) && ch != '\u{200D}';
1785 // family zwj sequence woman zwj girl.
1786 let text = "\u{1F469}\u{200D}\u{1F467}";
1787 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1788 assert_eq!(spans.as_slice(), &[span(0, text.len(), Some(0), fid(1))]);
1789 }
1790
1791 #[test]
1792 fn run_spans_collapse_adjacent_same_slot() {
1793 let primary = fid(0);
1794 let fb = chain(&[1]);
1795 let covers = |id: FontId, ch: char| {
1796 if id == primary {
1797 ch.is_ascii()
1798 } else {
1799 !ch.is_ascii()
1800 }
1801 };
1802 let text = "字字字";
1803 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1804 assert_eq!(spans.as_slice(), &[span(0, text.len(), Some(0), fid(1))]);
1805 }
1806
1807 #[test]
1808 fn run_spans_empty_run_returns_no_spans() {
1809 let primary = fid(0);
1810 let fb = chain(&[1]);
1811 let covers = |_: FontId, _: char| true;
1812 let spans = compute_run_spans("anything", 3, 0, primary, &fb, &covers);
1813 assert!(spans.is_empty());
1814 }
1815 }
@@ -0,0 +1,1815 @@
1use anyhow::{Context as _, Ok, Result};
2use collections::HashMap;
3use cosmic_text::{
4 Attrs, AttrsList, Ellipsize, Family, Font as CosmicTextFont,
5 FontFeatures as CosmicFontFeatures, FontSystem, ShapeBuffer, ShapeLine, Stretch, Style, Weight,
6};
7use gpui::{
8 Bounds, DevicePixels, FallbackFontClass, Font, FontFallbacks, FontFeatures, FontId,
9 FontMetrics, FontRun, GlyphId, IsZero as _, LineLayout, MissingGlyph, MissingGlyphSink, Pixels,
10 PlatformTextSystem, RenderGlyphParams, SUBPIXEL_VARIANTS_X, SUBPIXEL_VARIANTS_Y, ShapedGlyph,
11 ShapedRun, SharedString, Size, TextRenderingMode, point, size,
12};
13
14use itertools::Itertools;
15use parking_lot::RwLock;
16use smallvec::SmallVec;
17use std::{borrow::Cow, ops::Range, sync::Arc};
18use swash::{
19 scale::{Render, ScaleContext, Source, StrikeWith},
20 zeno::{Format, Vector},
21};
22use unicode_segmentation::UnicodeSegmentation;
23
24pub struct CosmicTextSystem(RwLock<CosmicTextSystemState>);
25
26#[derive(Debug, Clone, PartialEq, Eq, Hash)]
27struct FontKey {
28 family: SharedString,
29 features: FontFeatures,
30 fallbacks: Option<FontFallbacks>,
31}
32
33impl FontKey {
34 fn new(family: SharedString, features: FontFeatures, fallbacks: Option<FontFallbacks>) -> Self {
35 Self {
36 family,
37 features,
38 fallbacks,
39 }
40 }
41}
42
43#[derive(Debug, Clone, PartialEq, Eq, Hash)]
44struct LoadedFontKey {
45 database_id: cosmic_text::fontdb::ID,
46 font: FontKey,
47}
48
49struct CosmicTextSystemState {
50 font_system: FontSystem,
51 scratch: ShapeBuffer,
52 swash_scale_context: ScaleContext,
53 pending_glyph_images: HashMap<RenderGlyphParams, swash::scale::image::Image>,
54 /// Contains all already loaded fonts, including all faces. Indexed by `FontId`.
55 loaded_fonts: Vec<LoadedFont>,
56 loaded_font_ids_by_key: HashMap<LoadedFontKey, FontId>,
57 /// Caches the `FontId`s associated with a specific family to avoid iterating the font database
58 /// for every font face in a family.
59 font_ids_by_family_cache: HashMap<FontKey, SmallVec<[FontId; 4]>>,
60 system_font_fallback: String,
61 missing_glyph_sink: Option<Arc<dyn MissingGlyphSink>>,
62}
63
64struct LoadedFont {
65 font: Arc<CosmicTextFont>,
66 features: CosmicFontFeatures,
67 is_known_emoji_font: bool,
68 /// resolved at load time so `layout_line` shares one chain across faces.
69 /// `Arc` keeps clone cheap on the per-run hot path.
70 user_fallback_chain: Arc<[(FontId, SharedString)]>,
71}
72
73struct FontMatchProperties {
74 primary_family_name: SharedString,
75 stretch: Stretch,
76 style: Style,
77 weight: Weight,
78 features: CosmicFontFeatures,
79 fallback_chain: Arc<[(FontId, SharedString)]>,
80}
81
82impl FontMatchProperties {
83 fn attributes<'a>(&'a self, font_id: FontId, family_name: &'a str) -> Attrs<'a> {
84 Attrs::new()
85 .metadata(font_id.0)
86 .family(Family::Name(family_name))
87 .stretch(self.stretch)
88 .style(self.style)
89 .weight(self.weight)
90 .font_features(self.features.clone())
91 }
92}
93
94impl CosmicTextSystem {
95 /// Returns the selected face's weight and style, which may differ from the request.
96 pub fn font_weight_and_style(
97 &self,
98 font_id: FontId,
99 ) -> Result<(gpui::FontWeight, gpui::FontStyle)> {
100 let state = self.0.read();
101 let font = state
102 .loaded_fonts
103 .get(font_id.0)
104 .context("invalid font ID")?;
105 let face = state
106 .font_system
107 .db()
108 .face(font.font.id())
109 .context("font face not found")?;
110 let style = match face.style {
111 cosmic_text::Style::Normal => gpui::FontStyle::Normal,
112 cosmic_text::Style::Italic => gpui::FontStyle::Italic,
113 cosmic_text::Style::Oblique => gpui::FontStyle::Oblique,
114 };
115 Ok((gpui::FontWeight(face.weight.0 as f32), style))
116 }
117
118 /// Builds reports for unresolved source indices after an outer text system
119 /// has applied its own fallback.
120 pub fn missing_glyphs(
121 &self,
122 text: &str,
123 font_runs: &[FontRun],
124 missing_text_indices: impl IntoIterator<Item = usize>,
125 ) -> Vec<MissingGlyph> {
126 self.0
127 .read()
128 .missing_glyphs(text, font_runs, missing_text_indices)
129 }
130
131 pub fn new(system_font_fallback: &str) -> Self {
132 let font_system = FontSystem::new();
133
134 Self(RwLock::new(CosmicTextSystemState {
135 font_system,
136 scratch: ShapeBuffer::default(),
137 swash_scale_context: ScaleContext::new(),
138 pending_glyph_images: HashMap::default(),
139 loaded_fonts: Vec::new(),
140 loaded_font_ids_by_key: HashMap::default(),
141 font_ids_by_family_cache: HashMap::default(),
142 system_font_fallback: system_font_fallback.to_string(),
143 missing_glyph_sink: None,
144 }))
145 }
146
147 pub fn new_without_system_fonts(system_font_fallback: &str) -> Self {
148 let font_system = FontSystem::new_with_locale_and_db(
149 "en-US".to_string(),
150 cosmic_text::fontdb::Database::new(),
151 );
152
153 Self(RwLock::new(CosmicTextSystemState {
154 font_system,
155 scratch: ShapeBuffer::default(),
156 swash_scale_context: ScaleContext::new(),
157 pending_glyph_images: HashMap::default(),
158 loaded_fonts: Vec::new(),
159 loaded_font_ids_by_key: HashMap::default(),
160 font_ids_by_family_cache: HashMap::default(),
161 system_font_fallback: system_font_fallback.to_string(),
162 missing_glyph_sink: None,
163 }))
164 }
165}
166
167impl PlatformTextSystem for CosmicTextSystem {
168 fn add_fonts(&self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {
169 self.0.write().add_fonts(fonts)
170 }
171
172 fn set_missing_glyph_sink(&self, sink: Option<Arc<dyn MissingGlyphSink>>) {
173 self.0.write().missing_glyph_sink = sink;
174 }
175
176 fn all_font_names(&self) -> Vec<String> {
177 let mut result = self
178 .0
179 .read()
180 .font_system
181 .db()
182 .faces()
183 .filter_map(|face| face.families.first().map(|family| family.0.clone()))
184 .collect_vec();
185 result.sort_unstable();
186 result.dedup();
187 result
188 }
189
190 fn font_id(&self, font: &Font) -> Result<FontId> {
191 let mut state = self.0.write();
192 let key = FontKey::new(
193 font.family.clone(),
194 font.features.clone(),
195 font.fallbacks.clone(),
196 );
197 let candidates = if let Some(font_ids) = state.font_ids_by_family_cache.get(&key) {
198 font_ids.as_slice()
199 } else {
200 let font_ids =
201 state.load_family(&font.family, &font.features, font.fallbacks.as_ref())?;
202 state.font_ids_by_family_cache.insert(key.clone(), font_ids);
203 state.font_ids_by_family_cache[&key].as_ref()
204 };
205
206 let ix = find_best_match(font, candidates, &state)?;
207
208 Ok(candidates[ix])
209 }
210
211 fn prewarm_fonts(&self, font_ids: &[FontId]) {
212 self.0.write().prewarm_fonts(font_ids);
213 }
214
215 fn font_metrics(&self, font_id: FontId) -> FontMetrics {
216 let metrics = self
217 .0
218 .read()
219 .loaded_font(font_id)
220 .font
221 .as_swash()
222 .metrics(&[]);
223
224 FontMetrics {
225 units_per_em: metrics.units_per_em as u32,
226 ascent: metrics.ascent,
227 descent: -metrics.descent,
228 line_gap: metrics.leading,
229 underline_position: metrics.underline_offset,
230 underline_thickness: metrics.stroke_size,
231 cap_height: metrics.cap_height,
232 x_height: metrics.x_height,
233 bounding_box: Bounds {
234 origin: point(0.0, 0.0),
235 size: size(metrics.max_width, metrics.ascent + metrics.descent),
236 },
237 }
238 }
239
240 fn typographic_bounds(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Bounds<f32>> {
241 let lock = self.0.read();
242 let glyph_metrics = lock.loaded_font(font_id).font.as_swash().glyph_metrics(&[]);
243 let glyph_id = glyph_id.0 as u16;
244 Ok(Bounds {
245 origin: point(0.0, 0.0),
246 size: size(
247 glyph_metrics.advance_width(glyph_id),
248 glyph_metrics.advance_height(glyph_id),
249 ),
250 })
251 }
252
253 fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Size<f32>> {
254 self.0.read().advance(font_id, glyph_id)
255 }
256
257 fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option<GlyphId> {
258 self.0.read().glyph_for_char(font_id, ch)
259 }
260
261 fn glyph_raster_bounds(&self, params: &RenderGlyphParams) -> Result<Bounds<DevicePixels>> {
262 self.0.write().raster_bounds(params)
263 }
264
265 fn rasterize_glyph(
266 &self,
267 params: &RenderGlyphParams,
268 raster_bounds: Bounds<DevicePixels>,
269 ) -> Result<(Size<DevicePixels>, Vec<u8>)> {
270 self.0.write().rasterize_glyph(params, raster_bounds)
271 }
272
273 fn layout_line(&self, text: &str, font_size: Pixels, runs: &[FontRun]) -> LineLayout {
274 self.0.write().layout_line(text, font_size, runs)
275 }
276
277 fn recommended_rendering_mode(
278 &self,
279 _font_id: FontId,
280 _font_size: Pixels,
281 ) -> TextRenderingMode {
282 TextRenderingMode::Subpixel
283 }
284}
285
286impl CosmicTextSystemState {
287 fn loaded_font(&self, font_id: FontId) -> &LoadedFont {
288 &self.loaded_fonts[font_id.0]
289 }
290
291 fn font_match_properties(&self, font_id: FontId) -> Option<FontMatchProperties> {
292 let loaded_font = self.loaded_font(font_id);
293 let Some(face) = self.font_system.db().face(loaded_font.font.id()) else {
294 log::warn!("font face not found in database for font_id {:?}", font_id);
295 return None;
296 };
297 let Some(first_family) = face.families.first() else {
298 log::warn!("font face has no family names for font_id {:?}", font_id);
299 return None;
300 };
301
302 Some(FontMatchProperties {
303 primary_family_name: first_family.0.clone().into(),
304 stretch: face.stretch,
305 style: face.style,
306 weight: face.weight,
307 features: loaded_font.features.clone(),
308 fallback_chain: Arc::clone(&loaded_font.user_fallback_chain),
309 })
310 }
311
312 fn prewarm_fonts(&mut self, font_ids: &[FontId]) {
313 for &font_id in font_ids {
314 let Some(properties) = self.font_match_properties(font_id) else {
315 continue;
316 };
317 let primary_attributes =
318 properties.attributes(font_id, &properties.primary_family_name);
319 self.font_system.get_font_matches(&primary_attributes);
320
321 for (fallback_id, fallback_name) in &*properties.fallback_chain {
322 let fallback_attributes = properties.attributes(*fallback_id, fallback_name);
323 self.font_system.get_font_matches(&fallback_attributes);
324 }
325 }
326 }
327
328 #[profiling::function]
329 fn add_fonts(&mut self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {
330 self.font_ids_by_family_cache.clear();
331 let db = self.font_system.db_mut();
332 let installed: std::collections::HashSet<_> = db.faces().map(|face| face.id).collect();
333 for bytes in fonts {
334 db.load_font_source(cosmic_text::fontdb::Source::Binary(Arc::new(bytes)));
335 }
336 // A bundled face replaces installed faces of the same family, so a system font the
337 // renderer cannot draw (COLRv1-only emoji) never wins the family lookup.
338 let bundled_families: std::collections::HashSet<String> = db
339 .faces()
340 .filter(|face| !installed.contains(&face.id))
341 .flat_map(|face| face.families.iter().map(|(name, _)| name.clone()))
342 .collect();
343 let shadowed: Vec<_> = db
344 .faces()
345 .filter(|face| installed.contains(&face.id))
346 .filter(|face| face.families.iter().any(|(name, _)| bundled_families.contains(name)))
347 .map(|face| face.id)
348 .collect();
349 for id in shadowed {
350 db.remove_face(id);
351 }
352 Ok(())
353 }
354
355 #[profiling::function]
356 fn load_family(
357 &mut self,
358 name: &str,
359 features: &FontFeatures,
360 fallbacks: Option<&FontFallbacks>,
361 ) -> Result<SmallVec<[FontId; 4]>> {
362 let loaded_font_key = FontKey::new(
363 SharedString::from(name.to_owned()),
364 features.clone(),
365 fallbacks.cloned(),
366 );
367
368 // recurse with `fallbacks = None` so a fallback family cannot pull in
369 // another chain. missing fallback families are dropped so a typo in
370 // settings still lets the primary family load.
371 let user_fallback_chain: Arc<[(FontId, SharedString)]> = match fallbacks {
372 Some(fallbacks) if !fallbacks.fallback_list().is_empty() => {
373 let mut chain: Vec<(FontId, SharedString)> = Vec::new();
374 for fallback_name in fallbacks.fallback_list() {
375 let fb_key = FontKey::new(
376 SharedString::from(fallback_name.clone()),
377 features.clone(),
378 None,
379 );
380 let fb_ids = if let Some(cached) = self.font_ids_by_family_cache.get(&fb_key) {
381 cached.clone()
382 } else {
383 let loaded = self.load_family(fallback_name, features, None)?;
384 self.font_ids_by_family_cache
385 .insert(fb_key.clone(), loaded.clone());
386 loaded
387 };
388 let Some(&fb_id) = fb_ids.first() else {
389 continue;
390 };
391 let db_id = self.loaded_fonts[fb_id.0].font.id();
392 if let Some(face) = self.font_system.db().face(db_id)
393 && let Some(family) = face.families.first()
394 {
395 chain.push((fb_id, SharedString::from(family.0.clone())));
396 }
397 }
398 Arc::from(chain)
399 }
400 _ => Arc::from(Vec::new()),
401 };
402
403 let name = gpui::font_name_with_fallbacks(name, &self.system_font_fallback);
404
405 let families = self
406 .font_system
407 .db()
408 .faces()
409 .filter(|face| face.families.iter().any(|family| *name == family.0))
410 .map(|face| (face.id, face.post_script_name.clone()))
411 .collect::<SmallVec<[_; 4]>>();
412
413 let cosmic_features = cosmic_font_features(features)?;
414
415 let mut loaded_font_ids = SmallVec::new();
416 for (database_id, postscript_name) in families {
417 let key = LoadedFontKey {
418 database_id,
419 font: loaded_font_key.clone(),
420 };
421 if let Some(&font_id) = self.loaded_font_ids_by_key.get(&key) {
422 self.loaded_fonts[font_id.0].user_fallback_chain = Arc::clone(&user_fallback_chain);
423 loaded_font_ids.push(font_id);
424 continue;
425 }
426
427 let font = self
428 .font_system
429 .get_font(database_id, cosmic_text::Weight::NORMAL)
430 .context("Could not load font")?;
431
432 // HACK: To let the storybook run and render Windows caption icons. We should actually do better font fallback.
433 let allowed_bad_font_names = [
434 "SegoeFluentIcons", // NOTE: Segoe fluent icons postscript name is inconsistent
435 "Segoe Fluent Icons",
436 ];
437
438 if font.as_swash().charmap().map('m') == 0
439 && !allowed_bad_font_names.contains(&postscript_name.as_str())
440 {
441 self.font_system.db_mut().remove_face(font.id());
442 continue;
443 };
444
445 let font_id = FontId(self.loaded_fonts.len());
446 loaded_font_ids.push(font_id);
447 self.loaded_fonts.push(LoadedFont {
448 font,
449 features: cosmic_features.clone(),
450 is_known_emoji_font: check_is_known_emoji_font(&postscript_name),
451 user_fallback_chain: Arc::clone(&user_fallback_chain),
452 });
453 self.loaded_font_ids_by_key.insert(key, font_id);
454 }
455
456 Ok(loaded_font_ids)
457 }
458
459 fn advance(&self, font_id: FontId, glyph_id: GlyphId) -> Result<Size<f32>> {
460 let glyph_metrics = self.loaded_font(font_id).font.as_swash().glyph_metrics(&[]);
461 Ok(Size {
462 width: glyph_metrics.advance_width(glyph_id.0 as u16),
463 height: glyph_metrics.advance_height(glyph_id.0 as u16),
464 })
465 }
466
467 fn glyph_for_char(&self, font_id: FontId, ch: char) -> Option<GlyphId> {
468 let glyph_id = self.loaded_font(font_id).font.as_swash().charmap().map(ch);
469 if glyph_id == 0 {
470 None
471 } else {
472 Some(GlyphId(glyph_id.into()))
473 }
474 }
475
476 fn raster_bounds(&mut self, params: &RenderGlyphParams) -> Result<Bounds<DevicePixels>> {
477 let image = self.render_glyph_image(params)?;
478 let bounds = Bounds {
479 origin: point(image.placement.left.into(), (-image.placement.top).into()),
480 size: size(image.placement.width.into(), image.placement.height.into()),
481 };
482 if !bounds.is_zero() {
483 self.pending_glyph_images.insert(params.clone(), image);
484 }
485 Ok(bounds)
486 }
487
488 #[profiling::function]
489 fn rasterize_glyph(
490 &mut self,
491 params: &RenderGlyphParams,
492 glyph_bounds: Bounds<DevicePixels>,
493 ) -> Result<(Size<DevicePixels>, Vec<u8>)> {
494 if glyph_bounds.size.width.0 == 0 || glyph_bounds.size.height.0 == 0 {
495 anyhow::bail!("glyph bounds are empty");
496 }
497
498 let mut image = match self.pending_glyph_images.remove(params) {
499 Some(image) => image,
500 None => self.render_glyph_image(params)?,
501 };
502 let bitmap_size = glyph_bounds.size;
503 match image.content {
504 swash::scale::image::Content::Color | swash::scale::image::Content::SubpixelMask => {
505 // Convert from RGBA to BGRA.
506 for pixel in image.data.chunks_exact_mut(4) {
507 pixel.swap(0, 2);
508 }
509 Ok((bitmap_size, image.data))
510 }
511 swash::scale::image::Content::Mask => {
512 if params.subpixel_rendering {
513 // We must always return RGBA data when subpixel rendering is requested.
514 let expanded = image.data.iter().flat_map(|&a| [a, a, a, a]).collect();
515 Ok((bitmap_size, expanded))
516 } else {
517 Ok((bitmap_size, image.data))
518 }
519 }
520 }
521 }
522
523 fn render_glyph_image(
524 &mut self,
525 params: &RenderGlyphParams,
526 ) -> Result<swash::scale::image::Image> {
527 let loaded_font = &self.loaded_fonts[params.font_id.0];
528 let font_ref = loaded_font.font.as_swash();
529 let pixel_size = f32::from(params.font_size);
530
531 let subpixel_offset = Vector::new(
532 params.subpixel_variant.x as f32 / SUBPIXEL_VARIANTS_X as f32 / params.scale_factor,
533 params.subpixel_variant.y as f32 / SUBPIXEL_VARIANTS_Y as f32 / params.scale_factor,
534 );
535
536 let mut scaler = self
537 .swash_scale_context
538 .builder(font_ref)
539 .size(pixel_size * params.scale_factor)
540 .hint(true)
541 .build();
542
543 let sources: &[Source] = if params.is_emoji {
544 &[
545 Source::ColorOutline(0),
546 Source::ColorBitmap(StrikeWith::BestFit),
547 Source::Outline,
548 ]
549 } else {
550 &[Source::Bitmap(StrikeWith::ExactSize), Source::Outline]
551 };
552
553 let mut renderer = Render::new(sources);
554 if params.subpixel_rendering {
555 // There seems to be a bug in Swash where the B and R values are swapped.
556 renderer
557 .format(Format::subpixel_bgra())
558 .offset(subpixel_offset);
559 } else {
560 renderer.format(Format::Alpha).offset(subpixel_offset);
561 }
562
563 let glyph_id: u16 = params.glyph_id.0.try_into()?;
564 renderer
565 .render(&mut scaler, glyph_id)
566 .with_context(|| format!("unable to render glyph via swash for {params:?}"))
567 }
568
569 /// This is used when cosmic_text has chosen a fallback font instead of using the requested
570 /// font, typically to handle some unicode characters. When this happens, `loaded_fonts` may not
571 /// yet have an entry for this fallback font, and so one is added.
572 ///
573 /// Note that callers shouldn't use this `FontId` somewhere that will retrieve the corresponding
574 /// `LoadedFont.features`, as it will have an arbitrarily chosen or empty value. The only
575 /// current use of this field is for the *input* of `layout_line`, and so it's fine to use
576 /// `font_id_for_cosmic_id` when computing the *output* of `layout_line`.
577 fn font_id_for_cosmic_id(&mut self, id: cosmic_text::fontdb::ID) -> Result<FontId> {
578 if let Some(ix) = self
579 .loaded_fonts
580 .iter()
581 .position(|loaded_font| loaded_font.font.id() == id)
582 {
583 Ok(FontId(ix))
584 } else {
585 let font = self
586 .font_system
587 .get_font(id, cosmic_text::Weight::NORMAL)
588 .context("failed to get fallback font from cosmic-text font system")?;
589 let face = self
590 .font_system
591 .db()
592 .face(id)
593 .context("fallback font face not found in cosmic-text database")?;
594
595 let font_id = FontId(self.loaded_fonts.len());
596 self.loaded_fonts.push(LoadedFont {
597 font,
598 features: CosmicFontFeatures::new(),
599 is_known_emoji_font: check_is_known_emoji_font(&face.post_script_name),
600 user_fallback_chain: Arc::from(Vec::new()),
601 });
602
603 Ok(font_id)
604 }
605 }
606
607 #[profiling::function]
608 fn layout_line(&mut self, text: &str, font_size: Pixels, font_runs: &[FontRun]) -> LineLayout {
609 if contains_paragraph_separator(text) {
610 self.layout_line_with_separators(text, font_size, font_runs)
611 } else {
612 self.layout_line_no_separators(text, font_size, font_runs)
613 }
614 }
615
616 fn layout_line_with_separators(
617 &mut self,
618 text: &str,
619 font_size: Pixels,
620 font_runs: &[FontRun],
621 ) -> LineLayout {
622 let mut layout = LineLayout {
623 font_size,
624 len: text.len(),
625 ..Default::default()
626 };
627 let mut paragraph_start = 0;
628
629 for (separator_start, separator) in text
630 .char_indices()
631 .filter(|(_, character)| is_paragraph_separator(*character))
632 {
633 let separator_end = separator_start + separator.len_utf8();
634 self.shape_segment(
635 text,
636 paragraph_start..separator_start,
637 font_size,
638 font_runs,
639 &mut layout,
640 );
641 self.shape_segment(
642 text,
643 separator_start..separator_end,
644 font_size,
645 font_runs,
646 &mut layout,
647 );
648 paragraph_start = separator_end;
649 }
650
651 self.shape_segment(
652 text,
653 paragraph_start..text.len(),
654 font_size,
655 font_runs,
656 &mut layout,
657 );
658
659 layout
660 }
661
662 fn shape_segment(
663 &mut self,
664 text: &str,
665 range: Range<usize>,
666 font_size: Pixels,
667 font_runs: &[FontRun],
668 layout: &mut LineLayout,
669 ) {
670 if range.is_empty() {
671 return;
672 }
673
674 let segment_font_runs = clip_font_runs(font_runs, range.clone());
675 let segment =
676 self.layout_line_no_separators(&text[range.clone()], font_size, &segment_font_runs);
677
678 let mut segment_runs = segment.runs;
679 for run in &mut segment_runs {
680 for glyph in &mut run.glyphs {
681 glyph.index += range.start;
682 glyph.position.x += layout.width;
683 }
684 }
685
686 for mut run in segment_runs {
687 if let Some(same_run) = layout
688 .runs
689 .last_mut()
690 .filter(|last| last.font_id == run.font_id)
691 {
692 same_run.glyphs.append(&mut run.glyphs);
693 } else {
694 layout.runs.push(run);
695 }
696 }
697
698 layout.width += segment.width;
699 layout.ascent = layout.ascent.max(segment.ascent);
700 layout.descent = layout.descent.max(segment.descent);
701 }
702
703 fn layout_line_no_separators(
704 &mut self,
705 text: &str,
706 font_size: Pixels,
707 font_runs: &[FontRun],
708 ) -> LineLayout {
709 let mut attrs_list = AttrsList::new(&Attrs::new());
710 let mut offs = 0;
711 for run in font_runs {
712 let run_end = offs + run.len;
713
714 let Some(properties) = self.font_match_properties(run.font_id) else {
715 offs = run_end;
716 continue;
717 };
718
719 let primary_attrs = properties.attributes(run.font_id, &properties.primary_family_name);
720 let fallback_attrs: SmallVec<[Attrs<'_>; 4]> = properties
721 .fallback_chain
722 .iter()
723 .map(|(font_id, family_name)| properties.attributes(*font_id, family_name))
724 .collect();
725
726 let spans = if properties.fallback_chain.is_empty() {
727 let mut spans = SmallVec::<[RunSpan; 4]>::new();
728 spans.push(RunSpan {
729 start: offs,
730 end: run_end,
731 slot: None,
732 font_id: run.font_id,
733 });
734 spans
735 } else {
736 let loaded_fonts = &self.loaded_fonts;
737 let covers = |id: FontId, ch: char| charmap_covers(loaded_fonts, id, ch);
738 compute_run_spans(
739 text,
740 offs,
741 run.len,
742 run.font_id,
743 &properties.fallback_chain,
744 &covers,
745 )
746 };
747
748 for span in spans {
749 let attrs = match span.slot {
750 None => &primary_attrs,
751 Some(ix) => &fallback_attrs[ix],
752 };
753 attrs_list.add_span(span.start..span.end, attrs);
754 }
755 offs = run_end;
756 }
757
758 let line = ShapeLine::new(
759 &mut self.font_system,
760 text,
761 &attrs_list,
762 cosmic_text::Shaping::Advanced,
763 4,
764 );
765 let mut layout_lines = Vec::with_capacity(1);
766 line.layout_to_buffer(
767 &mut self.scratch,
768 f32::from(font_size),
769 None, // We do our own wrapping
770 cosmic_text::Wrap::None,
771 Ellipsize::None,
772 None,
773 &mut layout_lines,
774 None,
775 cosmic_text::Hinting::Disabled,
776 );
777
778 let Some(layout) = layout_lines.first() else {
779 return LineLayout {
780 font_size,
781 width: Pixels::ZERO,
782 ascent: Pixels::ZERO,
783 descent: Pixels::ZERO,
784 runs: Vec::new(),
785 len: text.len(),
786 };
787 };
788
789 let missing_glyphs = self.missing_glyph_sink.as_ref().map(|_| {
790 self.missing_glyphs(
791 text,
792 font_runs,
793 layout
794 .glyphs
795 .iter()
796 .filter(|glyph| glyph.glyph_id == 0)
797 .map(|glyph| glyph.start),
798 )
799 });
800
801 let mut runs: Vec<ShapedRun> = Vec::new();
802 for glyph in &layout.glyphs {
803 let mut font_id = FontId(glyph.metadata);
804 let mut loaded_font = self.loaded_font(font_id);
805 if loaded_font.font.id() != glyph.font_id {
806 match self.font_id_for_cosmic_id(glyph.font_id) {
807 std::result::Result::Ok(resolved_id) => {
808 font_id = resolved_id;
809 loaded_font = self.loaded_font(font_id);
810 }
811 Err(error) => {
812 log::warn!(
813 "failed to resolve cosmic font id {:?}: {error:#}",
814 glyph.font_id
815 );
816 continue;
817 }
818 }
819 }
820 let is_emoji = loaded_font.is_known_emoji_font;
821
822 // HACK: Prevent crash caused by variation selectors.
823 if glyph.glyph_id == 3 && is_emoji {
824 continue;
825 }
826
827 let shaped_glyph = ShapedGlyph {
828 id: GlyphId(glyph.glyph_id as u32),
829 position: point(glyph.x.into(), glyph.y.into()),
830 index: glyph.start,
831 is_emoji,
832 };
833
834 if let Some(last_run) = runs
835 .last_mut()
836 .filter(|last_run| last_run.font_id == font_id)
837 {
838 last_run.glyphs.push(shaped_glyph);
839 } else {
840 runs.push(ShapedRun {
841 font_id,
842 glyphs: vec![shaped_glyph],
843 });
844 }
845 }
846
847 if let Some((sink, missing_glyphs)) = self.missing_glyph_sink.as_ref().zip(missing_glyphs) {
848 sink.report(missing_glyphs);
849 }
850
851 LineLayout {
852 font_size,
853 width: layout.w.into(),
854 ascent: layout.max_ascent.into(),
855 descent: layout.max_descent.into(),
856 runs,
857 len: text.len(),
858 }
859 }
860
861 fn missing_glyphs(
862 &self,
863 text: &str,
864 font_runs: &[FontRun],
865 missing_text_indices: impl IntoIterator<Item = usize>,
866 ) -> Vec<MissingGlyph> {
867 let mut missing_text_indices = missing_text_indices.into_iter().peekable();
868 if missing_text_indices.peek().is_none() {
869 return Vec::new();
870 }
871 let mut missing_text_indices = missing_text_indices.collect::<Vec<_>>();
872 missing_text_indices.sort_unstable();
873 missing_text_indices.dedup();
874
875 let mut font_run_index = 0;
876 let mut font_run_end = font_runs.first().map_or(0, |font_run| font_run.len);
877 let mut missing_glyphs = Vec::new();
878 let mut missing_index = 0;
879 for (grapheme_start, grapheme) in text.grapheme_indices(true) {
880 let grapheme_end = grapheme_start + grapheme.len();
881 while missing_text_indices
882 .get(missing_index)
883 .is_some_and(|text_index| *text_index < grapheme_start)
884 {
885 missing_index += 1;
886 }
887 let Some(&text_index) = missing_text_indices.get(missing_index) else {
888 break;
889 };
890 if text_index >= grapheme_end {
891 continue;
892 }
893
894 while font_run_end <= text_index && font_run_index + 1 < font_runs.len() {
895 font_run_index += 1;
896 let Some(font_run) = font_runs.get(font_run_index) else {
897 break;
898 };
899 font_run_end += font_run.len;
900 }
901 let font_class = self.fallback_font_class(
902 font_runs
903 .get(font_run_index)
904 .or_else(|| font_runs.last())
905 .map(|font_run| font_run.font_id),
906 );
907 missing_glyphs.push(MissingGlyph::new(grapheme.into(), font_class));
908 while missing_text_indices
909 .get(missing_index)
910 .is_some_and(|text_index| *text_index < grapheme_end)
911 {
912 missing_index += 1;
913 }
914 }
915 missing_glyphs
916 }
917
918 fn fallback_font_class(&self, font_id: Option<FontId>) -> FallbackFontClass {
919 let Some(font_id) = font_id else {
920 return FallbackFontClass::Proportional;
921 };
922 let loaded_font = self.loaded_font(font_id);
923 let is_monospace = self
924 .font_system
925 .db()
926 .face(loaded_font.font.id())
927 .is_some_and(|face| face.monospaced);
928 if is_monospace {
929 FallbackFontClass::Monospace
930 } else {
931 FallbackFontClass::Proportional
932 }
933 }
934}
935
936#[inline(always)]
937fn is_paragraph_separator(character: char) -> bool {
938 unicode_bidi::bidi_class(character) == unicode_bidi::BidiClass::B
939}
940
941fn contains_paragraph_separator(text: &str) -> bool {
942 if text
943 .bytes()
944 .any(|byte| matches!(byte, b'\n' | b'\r' | 0x1c | 0x1d | 0x1e))
945 {
946 return true;
947 }
948
949 !text.is_ascii() && text.chars().any(is_paragraph_separator)
950}
951
952fn clip_font_runs(font_runs: &[FontRun], range: Range<usize>) -> SmallVec<[FontRun; 4]> {
953 let mut clipped = SmallVec::new();
954 let mut offs = 0;
955 for run in font_runs {
956 let run_start = offs;
957 offs += run.len;
958 if offs <= range.start {
959 continue;
960 }
961 if run_start >= range.end {
962 break;
963 }
964 let start = run_start.max(range.start);
965 let end = offs.min(range.end);
966 if start < end {
967 clipped.push(FontRun {
968 len: end - start,
969 font_id: run.font_id,
970 });
971 }
972 }
973 clipped
974}
975
976#[cfg(feature = "font-kit")]
977fn find_best_match(
978 font: &Font,
979 candidates: &[FontId],
980 state: &CosmicTextSystemState,
981) -> Result<usize> {
982 let candidate_properties = candidates
983 .iter()
984 .map(|font_id| {
985 let database_id = state.loaded_font(*font_id).font.id();
986 let face_info = state
987 .font_system
988 .db()
989 .face(database_id)
990 .context("font face not found in database")?;
991 Ok(face_info_into_properties(face_info))
992 })
993 .collect::<Result<SmallVec<[_; 4]>>>()?;
994
995 let ix =
996 font_kit::matching::find_best_match(&candidate_properties, &font_into_properties(font))
997 .context("requested font family contains no font matching the other parameters")?;
998
999 Ok(ix)
1000}
1001
1002#[cfg(not(feature = "font-kit"))]
1003fn find_best_match(
1004 font: &Font,
1005 candidates: &[FontId],
1006 state: &CosmicTextSystemState,
1007) -> Result<usize> {
1008 if candidates.is_empty() {
1009 anyhow::bail!("requested font family contains no font matching the other parameters");
1010 }
1011 if candidates.len() == 1 {
1012 return Ok(0);
1013 }
1014
1015 let target_weight = font.weight.0;
1016 let target_italic = matches!(
1017 font.style,
1018 gpui::FontStyle::Italic | gpui::FontStyle::Oblique
1019 );
1020
1021 let mut best_index = 0;
1022 let mut best_score = u32::MAX;
1023
1024 for (index, font_id) in candidates.iter().enumerate() {
1025 let database_id = state.loaded_font(*font_id).font.id();
1026 let face_info = state
1027 .font_system
1028 .db()
1029 .face(database_id)
1030 .context("font face not found in database")?;
1031
1032 let is_italic = matches!(
1033 face_info.style,
1034 cosmic_text::Style::Italic | cosmic_text::Style::Oblique
1035 );
1036 let style_penalty: u32 = if is_italic == target_italic { 0 } else { 1000 };
1037 let weight_diff = (face_info.weight.0 as i32 - target_weight as i32).unsigned_abs();
1038 let score = style_penalty + weight_diff;
1039
1040 if score < best_score {
1041 best_score = score;
1042 best_index = index;
1043 }
1044 }
1045
1046 Ok(best_index)
1047}
1048
1049/// one contiguous slice of a `FontRun` that maps to a single slot. `slot` is
1050/// `None` for the primary font and `Some(ix)` for `fallback_chain[ix]`.
1051#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1052struct RunSpan {
1053 start: usize,
1054 end: usize,
1055 slot: Option<usize>,
1056 font_id: FontId,
1057}
1058
1059/// walks `text[run_offset..run_offset + run_len]` and groups codepoints into
1060/// spans. inheriting codepoints stay in the current span so shaping clusters
1061/// like emoji zwj sequences and combining marks are not torn apart.
1062fn compute_run_spans(
1063 text: &str,
1064 run_offset: usize,
1065 run_len: usize,
1066 primary: FontId,
1067 fallback_chain: &[(FontId, SharedString)],
1068 covers: &impl Fn(FontId, char) -> bool,
1069) -> SmallVec<[RunSpan; 4]> {
1070 let mut spans = SmallVec::new();
1071 let run_end = run_offset + run_len;
1072 if run_end <= run_offset {
1073 return spans;
1074 }
1075 if fallback_chain.is_empty() {
1076 spans.push(RunSpan {
1077 start: run_offset,
1078 end: run_end,
1079 slot: None,
1080 font_id: primary,
1081 });
1082 return spans;
1083 }
1084 let run_text = &text[run_offset..run_end];
1085 let mut span_start = run_offset;
1086 let mut span_slot: Option<usize> = None;
1087 let mut span_font_id = primary;
1088 for (grapheme_idx, grapheme) in run_text.grapheme_indices(true) {
1089 let abs = run_offset + grapheme_idx;
1090 let ch = grapheme.chars().next().unwrap_or('\0');
1091 let next_slot = pick_covering_slot(ch, span_slot, primary, fallback_chain, covers);
1092 if next_slot == span_slot {
1093 continue;
1094 }
1095 if abs > span_start {
1096 spans.push(RunSpan {
1097 start: span_start,
1098 end: abs,
1099 slot: span_slot,
1100 font_id: span_font_id,
1101 });
1102 }
1103 span_start = abs;
1104 span_slot = next_slot;
1105 span_font_id = slot_font_id(next_slot, primary, fallback_chain);
1106 }
1107 if span_start < run_end {
1108 spans.push(RunSpan {
1109 start: span_start,
1110 end: run_end,
1111 slot: span_slot,
1112 font_id: span_font_id,
1113 });
1114 }
1115 spans
1116}
1117
1118fn slot_font_id(
1119 slot: Option<usize>,
1120 primary: FontId,
1121 fallback_chain: &[(FontId, SharedString)],
1122) -> FontId {
1123 match slot {
1124 None => primary,
1125 Some(ix) => fallback_chain[ix].0,
1126 }
1127}
1128
1129fn pick_covering_slot(
1130 ch: char,
1131 current: Option<usize>,
1132 primary: FontId,
1133 fallback_chain: &[(FontId, SharedString)],
1134 covers: &impl Fn(FontId, char) -> bool,
1135) -> Option<usize> {
1136 if (ch as u32) <= 0x7F {
1137 return None;
1138 }
1139 if covers(primary, ch) {
1140 return None;
1141 }
1142 let current_id = slot_font_id(current, primary, fallback_chain);
1143 if covers(current_id, ch) {
1144 return current;
1145 }
1146
1147 fallback_chain
1148 .iter()
1149 .position(|(fb_id, _)| covers(*fb_id, ch))
1150}
1151
1152fn charmap_covers(loaded_fonts: &[LoadedFont], id: FontId, ch: char) -> bool {
1153 loaded_fonts
1154 .get(id.0)
1155 .is_some_and(|loaded| loaded.font.as_swash().charmap().map(ch) != 0)
1156}
1157
1158fn cosmic_font_features(features: &FontFeatures) -> Result<CosmicFontFeatures> {
1159 let mut result = CosmicFontFeatures::new();
1160 for feature in features.0.iter() {
1161 let name_bytes: [u8; 4] = feature
1162 .0
1163 .as_bytes()
1164 .try_into()
1165 .context("Incorrect feature flag format")?;
1166
1167 let tag = cosmic_text::FeatureTag::new(&name_bytes);
1168
1169 result.set(tag, feature.1);
1170 }
1171 Ok(result)
1172}
1173
1174#[cfg(feature = "font-kit")]
1175fn font_into_properties(font: &gpui::Font) -> font_kit::properties::Properties {
1176 font_kit::properties::Properties {
1177 style: match font.style {
1178 gpui::FontStyle::Normal => font_kit::properties::Style::Normal,
1179 gpui::FontStyle::Italic => font_kit::properties::Style::Italic,
1180 gpui::FontStyle::Oblique => font_kit::properties::Style::Oblique,
1181 },
1182 weight: font_kit::properties::Weight(font.weight.0),
1183 stretch: Default::default(),
1184 }
1185}
1186
1187#[cfg(feature = "font-kit")]
1188fn face_info_into_properties(
1189 face_info: &cosmic_text::fontdb::FaceInfo,
1190) -> font_kit::properties::Properties {
1191 font_kit::properties::Properties {
1192 style: match face_info.style {
1193 cosmic_text::Style::Normal => font_kit::properties::Style::Normal,
1194 cosmic_text::Style::Italic => font_kit::properties::Style::Italic,
1195 cosmic_text::Style::Oblique => font_kit::properties::Style::Oblique,
1196 },
1197 weight: font_kit::properties::Weight(face_info.weight.0.into()),
1198 stretch: match face_info.stretch {
1199 cosmic_text::Stretch::Condensed => font_kit::properties::Stretch::CONDENSED,
1200 cosmic_text::Stretch::Expanded => font_kit::properties::Stretch::EXPANDED,
1201 cosmic_text::Stretch::ExtraCondensed => font_kit::properties::Stretch::EXTRA_CONDENSED,
1202 cosmic_text::Stretch::ExtraExpanded => font_kit::properties::Stretch::EXTRA_EXPANDED,
1203 cosmic_text::Stretch::Normal => font_kit::properties::Stretch::NORMAL,
1204 cosmic_text::Stretch::SemiCondensed => font_kit::properties::Stretch::SEMI_CONDENSED,
1205 cosmic_text::Stretch::SemiExpanded => font_kit::properties::Stretch::SEMI_EXPANDED,
1206 cosmic_text::Stretch::UltraCondensed => font_kit::properties::Stretch::ULTRA_CONDENSED,
1207 cosmic_text::Stretch::UltraExpanded => font_kit::properties::Stretch::ULTRA_EXPANDED,
1208 },
1209 }
1210}
1211
1212fn check_is_known_emoji_font(postscript_name: &str) -> bool {
1213 // TODO: Include other common emoji fonts
1214 postscript_name == "NotoColorEmoji"
1215}
1216
1217#[cfg(test)]
1218mod tests {
1219 use super::*;
1220 #[cfg(feature = "test-support")]
1221 use std::{cell::RefCell, rc::Rc};
1222
1223 #[test]
1224 fn all_font_names_tracks_available_families() -> Result<()> {
1225 let text_system = gpui::TextSystem::new(Arc::new(
1226 CosmicTextSystem::new_without_system_fonts("IBM Plex Sans"),
1227 ));
1228 assert!(text_system.all_font_names().is_empty());
1229
1230 text_system.add_fonts(vec![Cow::Borrowed(include_bytes!(
1231 "../../../assets/fonts/lilex/Lilex-Regular.ttf"
1232 ))])?;
1233 assert_eq!(text_system.all_font_names(), ["Lilex"]);
1234
1235 text_system.add_fonts(vec![
1236 Cow::Borrowed(IBM_PLEX),
1237 Cow::Borrowed(include_bytes!("../../../assets/fonts/lilex/Lilex-Bold.ttf")),
1238 ])?;
1239 assert_eq!(text_system.all_font_names(), ["IBM Plex Sans", "Lilex"]);
1240 Ok(())
1241 }
1242
1243 fn fid(i: usize) -> FontId {
1244 FontId(i)
1245 }
1246
1247 fn chain(ids: &[usize]) -> SmallVec<[(FontId, SharedString); 4]> {
1248 ids.iter()
1249 .map(|&i| (fid(i), SharedString::from(format!("fb{i}"))))
1250 .collect()
1251 }
1252
1253 fn span(start: usize, end: usize, slot: Option<usize>, font_id: FontId) -> RunSpan {
1254 RunSpan {
1255 start,
1256 end,
1257 slot,
1258 font_id,
1259 }
1260 }
1261
1262 const IBM_PLEX: &[u8] =
1263 include_bytes!("../../../assets/fonts/ibm-plex-sans/IBMPlexSans-Regular.ttf");
1264 const LILEX: &[u8] = include_bytes!("../../../assets/fonts/lilex/Lilex-Regular.ttf");
1265
1266 /// Every code point of `Bidi_Class=B`, each of which starts a new bidi
1267 /// paragraph and so can split one line into mixed-direction paragraphs.
1268 const SEPARATORS: &[char] = &[
1269 '\u{000a}', '\u{000d}', '\u{001c}', '\u{001d}', '\u{001e}', '\u{0085}', '\u{2029}',
1270 ];
1271
1272 fn text_system() -> Result<CosmicTextSystem> {
1273 let text_system = CosmicTextSystem::new_without_system_fonts("IBM Plex Sans");
1274 text_system.add_fonts(vec![Cow::Borrowed(IBM_PLEX)])?;
1275 Ok(text_system)
1276 }
1277
1278 #[test]
1279 fn font_properties_describe_the_selected_face() -> Result<()> {
1280 let text_system = text_system()?;
1281 let regular = gpui::font("IBM Plex Sans");
1282 let regular_id = text_system.font_id(&regular)?;
1283 for (weight, style) in [
1284 (gpui::FontWeight::MEDIUM, gpui::FontStyle::Normal),
1285 (gpui::FontWeight::BOLD, gpui::FontStyle::Italic),
1286 (gpui::FontWeight::NORMAL, gpui::FontStyle::Oblique),
1287 ] {
1288 let requested = Font {
1289 weight,
1290 style,
1291 ..regular.clone()
1292 };
1293 let font_id = text_system.font_id(&requested)?;
1294 assert_eq!(font_id, regular_id);
1295 assert_eq!(
1296 text_system.font_weight_and_style(font_id)?,
1297 (gpui::FontWeight::NORMAL, gpui::FontStyle::Normal)
1298 );
1299 }
1300 Ok(())
1301 }
1302
1303 fn layout_text(text_system: &CosmicTextSystem, text: &str) -> Result<LineLayout> {
1304 let font_id = text_system.font_id(&gpui::font("IBM Plex Sans"))?;
1305 let runs = [FontRun {
1306 len: text.len(),
1307 font_id,
1308 }];
1309 Ok(text_system.layout_line(text, gpui::px(14.0), &runs))
1310 }
1311
1312 /// Mirrors the original crash: mixed-direction text reaching the shaper
1313 /// through `shape_text`, which only splits lines on `\n`.
1314 #[test]
1315 fn shape_text_with_mixed_direction_paragraphs() -> Result<()> {
1316 let platform_text_system = Arc::new(text_system()?);
1317 let text_system = Arc::new(gpui::TextSystem::new(platform_text_system));
1318 let window_text_system = gpui::WindowTextSystem::new(text_system);
1319
1320 let text: SharedString = "first line\n\u{05d0}\u{001c}A".into();
1321 let runs = [gpui::TextRun {
1322 len: text.len(),
1323 font: gpui::font("IBM Plex Sans"),
1324 ..Default::default()
1325 }];
1326
1327 let lines = window_text_system.shape_text(text, gpui::px(14.0), &runs, None, None)?;
1328
1329 assert_eq!(lines.len(), 2);
1330 assert_eq!(lines[1].len(), "\u{05d0}\u{001c}A".len());
1331 assert!(lines[1].width() > Pixels::ZERO);
1332 Ok(())
1333 }
1334
1335 #[cfg(feature = "test-support")]
1336 #[test]
1337 fn reports_graphemes_that_exhaust_font_fallback() -> Result<()> {
1338 let platform_text_system = Arc::new(text_system()?);
1339 let dispatcher = gpui::TestDispatcher::new(0);
1340 let cx =
1341 gpui::TestAppContext::build_with_text_system(dispatcher, None, platform_text_system);
1342 let observed = Rc::new(RefCell::new(Vec::new()));
1343 let _subscription = cx.update(|cx| {
1344 let observed = observed.clone();
1345 cx.on_missing_glyphs(move |missing_glyphs, _| {
1346 observed.borrow_mut().extend_from_slice(missing_glyphs);
1347 })
1348 });
1349 let text: SharedString = "界".into();
1350
1351 cx.update(|cx| {
1352 let text_system = gpui::WindowTextSystem::new(cx.text_system().clone());
1353 let runs = [gpui::TextRun {
1354 len: text.len(),
1355 font: gpui::font("IBM Plex Sans"),
1356 ..Default::default()
1357 }];
1358 text_system.shape_line(text, gpui::px(14.0), &runs, None);
1359 });
1360 cx.run_until_parked();
1361
1362 let observed = observed.borrow();
1363 assert_eq!(observed.len(), 1);
1364 assert_eq!(observed[0].grapheme(), "界");
1365 assert_eq!(
1366 observed[0].font_class(),
1367 gpui::FallbackFontClass::Proportional
1368 );
1369 Ok(())
1370 }
1371
1372 #[test]
1373 fn combines_missing_glyphs_from_one_grapheme() -> Result<()> {
1374 let text_system = text_system()?;
1375 let font_id = text_system.font_id(&gpui::font("IBM Plex Sans"))?;
1376 let text = "x\u{0301}";
1377 let runs = [FontRun {
1378 len: text.len(),
1379 font_id,
1380 }];
1381
1382 let missing_glyphs = text_system
1383 .0
1384 .read()
1385 .missing_glyphs(text, &runs, [0, "x".len()]);
1386
1387 assert_eq!(missing_glyphs.len(), 1);
1388 assert_eq!(missing_glyphs[0].grapheme(), text);
1389 Ok(())
1390 }
1391
1392 #[test]
1393 fn adding_fonts_invalidates_cached_line_layouts() -> Result<()> {
1394 let platform_text_system = Arc::new(text_system()?);
1395 let text_system = Arc::new(gpui::TextSystem::new(platform_text_system.clone()));
1396 let window_text_system = gpui::WindowTextSystem::new(text_system.clone());
1397 let text: SharedString = "cached text".into();
1398 let runs = [gpui::TextRun {
1399 len: text.len(),
1400 font: gpui::font("IBM Plex Sans"),
1401 ..Default::default()
1402 }];
1403
1404 let first_layout = window_text_system.shape_line(text.clone(), gpui::px(14.0), &runs, None);
1405 let cached_layout =
1406 window_text_system.shape_line(text.clone(), gpui::px(14.0), &runs, None);
1407 assert!(std::ptr::eq::<LineLayout>(
1408 &**first_layout,
1409 &**cached_layout
1410 ));
1411 let loaded_font_count = platform_text_system.0.read().loaded_fonts.len();
1412
1413 text_system.add_fonts(vec![Cow::Borrowed(LILEX)])?;
1414
1415 let refreshed_layout = window_text_system.shape_line(text, gpui::px(14.0), &runs, None);
1416 assert!(!std::ptr::eq::<LineLayout>(
1417 &**first_layout,
1418 &**refreshed_layout
1419 ));
1420 assert_eq!(
1421 platform_text_system.0.read().loaded_fonts.len(),
1422 loaded_font_count
1423 );
1424 Ok(())
1425 }
1426
1427 #[test]
1428 fn layout_line_with_mixed_direction_paragraphs() -> Result<()> {
1429 let text_system = text_system()?;
1430
1431 for separator in SEPARATORS {
1432 for text in [
1433 format!("\u{05d0}{separator}A"),
1434 format!("A{separator}\u{05d0}"),
1435 ] {
1436 let layout = layout_text(&text_system, &text)?;
1437
1438 assert_eq!(layout.len, text.len(), "{text:?}");
1439 assert!(layout.width > Pixels::ZERO, "{text:?}");
1440 assert!(
1441 layout.runs.iter().any(|run| !run.glyphs.is_empty()),
1442 "{text:?}"
1443 );
1444 }
1445 }
1446
1447 Ok(())
1448 }
1449
1450 #[test]
1451 fn layout_line_with_separators_at_line_edges() -> Result<()> {
1452 let text_system = text_system()?;
1453
1454 for text in [
1455 "\u{001c}",
1456 "\u{001c}\u{001c}",
1457 "\u{001c}\u{05d0}",
1458 "\u{05d0}\u{001c}",
1459 "\u{05d0}\u{001c}\u{001c}A",
1460 "\u{001c}\u{05d0}\u{001c}A\u{001c}",
1461 ] {
1462 let layout = layout_text(&text_system, text)?;
1463 assert_eq!(layout.len, text.len(), "{text:?}");
1464 }
1465
1466 Ok(())
1467 }
1468
1469 /// Glyph indices must stay absolute and positions ordered across segment
1470 /// boundaries, otherwise cursor placement and hit testing desync. Uses
1471 /// single-direction text so visual order matches logical order.
1472 #[test]
1473 fn layout_line_keeps_indices_and_positions_ordered_across_paragraphs() -> Result<()> {
1474 let text_system = text_system()?;
1475 let text = "ab\u{001c}cd\u{2029}ef";
1476 let layout = layout_text(&text_system, text)?;
1477
1478 let glyphs: Vec<_> = layout.runs.iter().flat_map(|run| &run.glyphs).collect();
1479 assert!(!glyphs.is_empty());
1480
1481 for glyph in &glyphs {
1482 assert!(glyph.index < text.len(), "{:?}", glyph.index);
1483 assert!(text.is_char_boundary(glyph.index), "{:?}", glyph.index);
1484 }
1485 for pair in glyphs.windows(2) {
1486 assert!(pair[0].index < pair[1].index);
1487 assert!(pair[0].position.x <= pair[1].position.x);
1488 }
1489
1490 // Every segment contributes width, so the whole line is wider than its
1491 // leading paragraph alone.
1492 assert!(layout.width > layout_text(&text_system, "ab")?.width);
1493 Ok(())
1494 }
1495
1496 /// A font run boundary that does not line up with a paragraph boundary must
1497 /// still be clipped to the right segments.
1498 #[test]
1499 fn layout_line_with_font_run_straddling_a_separator() -> Result<()> {
1500 let text_system = text_system()?;
1501 let font_id = text_system.font_id(&gpui::font("IBM Plex Sans"))?;
1502 let text = "ab\u{001c}\u{05d0}\u{05d1}";
1503
1504 // The run boundary falls inside the trailing RTL paragraph.
1505 let runs = [
1506 FontRun {
1507 len: "ab\u{001c}\u{05d0}".len(),
1508 font_id,
1509 },
1510 FontRun {
1511 len: "\u{05d1}".len(),
1512 font_id,
1513 },
1514 ];
1515 let layout = text_system.layout_line(text, gpui::px(14.0), &runs);
1516
1517 assert_eq!(layout.len, text.len());
1518 assert!(layout.width > Pixels::ZERO);
1519 Ok(())
1520 }
1521
1522 /// Lines with no separator take the fast path and must be shaped exactly as
1523 /// they were before paragraph splitting existed.
1524 #[test]
1525 fn layout_line_without_separators_takes_fast_path() -> Result<()> {
1526 let text_system = text_system()?;
1527
1528 for text in [
1529 "hello world",
1530 "\u{05d0}\u{05d1}\u{05d2}",
1531 "mixed \u{05d0}\u{05d1}",
1532 ] {
1533 assert!(!contains_paragraph_separator(text), "{text:?}");
1534 let layout = layout_text(&text_system, text)?;
1535 assert_eq!(layout.len, text.len(), "{text:?}");
1536 assert!(layout.width > Pixels::ZERO, "{text:?}");
1537 }
1538
1539 Ok(())
1540 }
1541
1542 /// cosmic-text sums word widths to get a line's width but accumulates glyph
1543 /// advances to position glyphs, so a trailing zero-advance glyph (here a
1544 /// zero-width space) can land a few ulps past the width. When that glyph is a
1545 /// wrap boundary, the row before it extends past the line's width, and hit
1546 /// testing in that sliver used to panic (ZED-BW8, ZED-75K, ZED-81Z).
1547 #[test]
1548 fn index_for_position_past_line_width() -> Result<()> {
1549 let text_system = Arc::new(gpui::TextSystem::new(Arc::new(text_system()?)));
1550 let window_text_system = gpui::WindowTextSystem::new(text_system);
1551 let text: SharedString = "Warning: this will delete files\u{200b}".into();
1552 let runs = [gpui::TextRun {
1553 len: text.len(),
1554 font: gpui::font("IBM Plex Sans"),
1555 ..Default::default()
1556 }];
1557 let lines =
1558 window_text_system.shape_text(text, gpui::px(14.), &runs, Some(gpui::px(4.)), None)?;
1559 let line = &lines[0];
1560 let width = line.unwrapped_layout.width;
1561 let boundary_glyph = |row: usize| {
1562 let boundary = line.wrap_boundaries()[row];
1563 &line.runs()[boundary.run_ix].glyphs[boundary.glyph_ix]
1564 };
1565 let row = (1..line.wrap_boundaries().len())
1566 .find(|row| boundary_glyph(*row).position.x > width)
1567 .expect("trailing zero-width space should be a wrap boundary past the line width");
1568 let row_start_x = f32::from(boundary_glyph(row - 1).position.x);
1569 let row_end = boundary_glyph(row);
1570
1571 let mut x = f32::from(width) - row_start_x;
1572 while x + row_start_x < f32::from(width) {
1573 x = x.next_up();
1574 }
1575 assert!(gpui::px(x + row_start_x) < row_end.position.x);
1576
1577 let line_height = gpui::px(20.);
1578 let position = gpui::point(gpui::px(x), line_height * row as f32 + gpui::px(1.));
1579 assert_eq!(
1580 line.index_for_position(position, line_height),
1581 Err(row_end.index)
1582 );
1583 Ok(())
1584 }
1585
1586 #[test]
1587 fn paragraph_separator_detection() {
1588 for separator in SEPARATORS {
1589 assert!(is_paragraph_separator(*separator), "{separator:?}");
1590 assert!(contains_paragraph_separator(&format!("a{separator}b")));
1591 }
1592
1593 for text in [
1594 "",
1595 "plain ascii",
1596 "\u{05d0}",
1597 "tab\there",
1598 "emoji \u{1f600}",
1599 ] {
1600 assert!(!contains_paragraph_separator(text), "{text:?}");
1601 }
1602 }
1603
1604 #[test]
1605 fn font_runs_are_clipped_to_segment() {
1606 let runs = [
1607 FontRun {
1608 len: 3,
1609 font_id: fid(1),
1610 },
1611 FontRun {
1612 len: 4,
1613 font_id: fid(2),
1614 },
1615 ];
1616
1617 assert_eq!(clip_font_runs(&runs, 0..7).as_slice(), &runs);
1618 assert_eq!(
1619 clip_font_runs(&runs, 2..5).as_slice(),
1620 &[
1621 FontRun {
1622 len: 1,
1623 font_id: fid(1)
1624 },
1625 FontRun {
1626 len: 2,
1627 font_id: fid(2)
1628 },
1629 ]
1630 );
1631 assert_eq!(
1632 clip_font_runs(&runs, 3..7).as_slice(),
1633 &[FontRun {
1634 len: 4,
1635 font_id: fid(2)
1636 }]
1637 );
1638 assert!(clip_font_runs(&runs, 5..5).is_empty());
1639 }
1640
1641 #[test]
1642 fn primary_wins_over_current_fallback_when_primary_covers() {
1643 let primary = fid(0);
1644 let fb = chain(&[1, 2]);
1645 let covers = |id: FontId, _: char| id == fid(0) || id == fid(1);
1646 assert_eq!(
1647 pick_covering_slot('a', Some(0), primary, &fb, &covers),
1648 None
1649 );
1650 }
1651
1652 #[test]
1653 fn primary_preferred_over_fallback_when_both_cover() {
1654 let primary = fid(0);
1655 let fb = chain(&[1]);
1656 let covers = |_: FontId, _: char| true;
1657 assert_eq!(pick_covering_slot('a', None, primary, &fb, &covers), None);
1658 }
1659
1660 #[test]
1661 fn falls_through_chain_in_order() {
1662 let primary = fid(0);
1663 let fb = chain(&[1, 2, 3]);
1664 // only fallback 2 at index 1 covers.
1665 let covers = |id: FontId, _: char| id == fid(2);
1666 assert_eq!(
1667 pick_covering_slot('字', None, primary, &fb, &covers),
1668 Some(1)
1669 );
1670 }
1671
1672 #[test]
1673 fn no_coverage_returns_primary() {
1674 let primary = fid(0);
1675 let fb = chain(&[1, 2]);
1676 let covers = |_: FontId, _: char| false;
1677 // nothing covers. return `None` so the `cosmic-text` built in script
1678 // fallback can take over during shaping.
1679 assert_eq!(
1680 pick_covering_slot('\u{1F600}', Some(1), primary, &fb, &covers),
1681 None
1682 );
1683 }
1684
1685 #[test]
1686 fn empty_chain_always_returns_primary() {
1687 let primary = fid(0);
1688 let fb: SmallVec<[(FontId, SharedString); 4]> = SmallVec::new();
1689 let covers = |_: FontId, _: char| false;
1690 assert_eq!(pick_covering_slot('a', None, primary, &fb, &covers), None);
1691 }
1692
1693 #[test]
1694 fn slot_font_id_resolution() {
1695 let primary = fid(7);
1696 let fb = chain(&[10, 20]);
1697 assert_eq!(slot_font_id(None, primary, &fb), fid(7));
1698 assert_eq!(slot_font_id(Some(0), primary, &fb), fid(10));
1699 assert_eq!(slot_font_id(Some(1), primary, &fb), fid(20));
1700 }
1701
1702 #[test]
1703 fn run_spans_with_no_chain_emit_one_primary_span() {
1704 let primary = fid(0);
1705 let fb: SmallVec<[(FontId, SharedString); 4]> = SmallVec::new();
1706 let covers = |_: FontId, _: char| false;
1707 let text = "hello";
1708 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1709 assert_eq!(spans.as_slice(), &[span(0, text.len(), None, primary)]);
1710 }
1711
1712 #[test]
1713 fn run_spans_use_byte_offsets_for_multibyte_chars() {
1714 let primary = fid(0);
1715 let fb = chain(&[1]);
1716 // primary covers ascii. fallback covers cjk.
1717 let covers = |id: FontId, ch: char| {
1718 if id == primary {
1719 ch.is_ascii()
1720 } else {
1721 !ch.is_ascii()
1722 }
1723 };
1724 let text = "a字b";
1725 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1726 // '字' is 3 bytes so split is at 1 then 4.
1727 assert_eq!(
1728 spans.as_slice(),
1729 &[
1730 span(0, 1, None, primary),
1731 span(1, 4, Some(0), fid(1)),
1732 span(4, 5, None, primary),
1733 ]
1734 );
1735 }
1736
1737 #[test]
1738 fn run_spans_respect_run_offset() {
1739 let primary = fid(0);
1740 let fb = chain(&[1]);
1741 let covers = |id: FontId, ch: char| {
1742 if id == primary {
1743 ch.is_ascii()
1744 } else {
1745 !ch.is_ascii()
1746 }
1747 };
1748 // outer text has a prefix that is not part of this run.
1749 let text = "xx字y";
1750 let run_offset = 2;
1751 let run_len = text.len() - run_offset;
1752 let spans = compute_run_spans(text, run_offset, run_len, primary, &fb, &covers);
1753 assert_eq!(
1754 spans.as_slice(),
1755 &[span(2, 5, Some(0), fid(1)), span(5, 6, None, primary)]
1756 );
1757 }
1758
1759 #[test]
1760 fn run_spans_keep_combining_marks_with_base_in_fallback() {
1761 let primary = fid(0);
1762 let fb = chain(&[1]);
1763 // primary covers ascii only. fallback covers the base char.
1764 // combining mark must stay in the fallback span even when fallback
1765 // does not advertise coverage of it.
1766 let covers = |id: FontId, ch: char| {
1767 if id == primary {
1768 ch.is_ascii()
1769 } else {
1770 ch == '\u{0905}'
1771 }
1772 };
1773 // \u{0905} devanagari short a + \u{0902} candrabindu mark.
1774 let text = "\u{0905}\u{0902}";
1775 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1776 assert_eq!(spans.as_slice(), &[span(0, text.len(), Some(0), fid(1))]);
1777 }
1778
1779 #[test]
1780 fn run_spans_keep_zwj_inside_emoji_cluster() {
1781 let primary = fid(0);
1782 let fb = chain(&[1]);
1783 // only fallback covers the emoji codepoints. zwj must not split.
1784 let covers = |id: FontId, ch: char| id == fid(1) && ch != '\u{200D}';
1785 // family zwj sequence woman zwj girl.
1786 let text = "\u{1F469}\u{200D}\u{1F467}";
1787 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1788 assert_eq!(spans.as_slice(), &[span(0, text.len(), Some(0), fid(1))]);
1789 }
1790
1791 #[test]
1792 fn run_spans_collapse_adjacent_same_slot() {
1793 let primary = fid(0);
1794 let fb = chain(&[1]);
1795 let covers = |id: FontId, ch: char| {
1796 if id == primary {
1797 ch.is_ascii()
1798 } else {
1799 !ch.is_ascii()
1800 }
1801 };
1802 let text = "字字字";
1803 let spans = compute_run_spans(text, 0, text.len(), primary, &fb, &covers);
1804 assert_eq!(spans.as_slice(), &[span(0, text.len(), Some(0), fid(1))]);
1805 }
1806
1807 #[test]
1808 fn run_spans_empty_run_returns_no_spans() {
1809 let primary = fid(0);
1810 let fb = chain(&[1]);
1811 let covers = |_: FontId, _: char| true;
1812 let spans = compute_run_spans("anything", 3, 0, primary, &fb, &covers);
1813 assert!(spans.is_empty());
1814 }
1815}
vendor/gpui-pre-wgpu/src/gpui_wgpu.rs added +15 −0
@@ -0,0 +1,15 @@
1 mod cosmic_text_system;
2 mod wgpu_atlas;
3 mod wgpu_context;
4 mod wgpu_renderer;
5
6 pub use cosmic_text_system::*;
7 pub use wgpu;
8 pub use wgpu_atlas::*;
9 pub use wgpu_context::*;
10 #[cfg(all(
11 not(target_family = "wasm"),
12 any(test, feature = "bench-support", feature = "test-support")
13 ))]
14 pub use wgpu_renderer::WgpuHeadlessRenderer;
15 pub use wgpu_renderer::{GpuContext, WgpuRenderer, WgpuSurfaceConfig};
@@ -0,0 +1,15 @@
1mod cosmic_text_system;
2mod wgpu_atlas;
3mod wgpu_context;
4mod wgpu_renderer;
5
6pub use cosmic_text_system::*;
7pub use wgpu;
8pub use wgpu_atlas::*;
9pub use wgpu_context::*;
10#[cfg(all(
11 not(target_family = "wasm"),
12 any(test, feature = "bench-support", feature = "test-support")
13))]
14pub use wgpu_renderer::WgpuHeadlessRenderer;
15pub use wgpu_renderer::{GpuContext, WgpuRenderer, WgpuSurfaceConfig};
vendor/gpui-pre-wgpu/src/shaders.wgsl added +1362 −0
@@ -0,0 +1,1362 @@
1 /* Functions useful for debugging:
2
3 // A heat map color for debugging (blue -> cyan -> green -> yellow -> red).
4 fn heat_map_color(value: f32, minValue: f32, maxValue: f32, position: vec2<f32>) -> vec4<f32> {
5 // Normalize value to 0-1 range
6 let t = clamp((value - minValue) / (maxValue - minValue), 0.0, 1.0);
7
8 // Heat map color calculation
9 let r = t * t;
10 let g = 4.0 * t * (1.0 - t);
11 let b = (1.0 - t) * (1.0 - t);
12 let heat_color = vec3<f32>(r, g, b);
13
14 // Create a checkerboard pattern (black and white)
15 let sum = floor(position.x / 3) + floor(position.y / 3);
16 let is_odd = fract(sum * 0.5); // 0.0 for even, 0.5 for odd
17 let checker_value = is_odd * 2.0; // 0.0 for even, 1.0 for odd
18 let checker_color = vec3<f32>(checker_value);
19
20 // Determine if value is in range (1.0 if in range, 0.0 if out of range)
21 let in_range = step(minValue, value) * step(value, maxValue);
22
23 // Mix checkerboard and heat map based on whether value is in range
24 let final_color = mix(checker_color, heat_color, in_range);
25
26 return vec4<f32>(final_color, 1.0);
27 }
28
29 */
30
31 // Contrast and gamma correction adapted from https://github.com/microsoft/terminal/blob/1283c0f5b99a2961673249fa77c6b986efb5086c/src/renderer/atlas/dwrite.hlsl
32 // Copyright (c) Microsoft Corporation.
33 // Licensed under the MIT license.
34 fn color_brightness(color: vec3<f32>) -> f32 {
35 // REC. 601 luminance coefficients for perceived brightness
36 return dot(color, vec3<f32>(0.30, 0.59, 0.11));
37 }
38
39 fn light_on_dark_contrast(enhancedContrast: f32, color: vec3<f32>) -> f32 {
40 let brightness = color_brightness(color);
41 let multiplier = saturate(4.0 * (0.75 - brightness));
42 return enhancedContrast * multiplier;
43 }
44
45 fn enhance_contrast(alpha: f32, k: f32) -> f32 {
46 return alpha * (k + 1.0) / (alpha * k + 1.0);
47 }
48
49 fn enhance_contrast3(alpha: vec3<f32>, k: f32) -> vec3<f32> {
50 return alpha * (k + 1.0) / (alpha * k + 1.0);
51 }
52
53 fn apply_alpha_correction(a: f32, b: f32, g: vec4<f32>) -> f32 {
54 let brightness_adjustment = g.x * b + g.y;
55 let correction = brightness_adjustment * a + (g.z * b + g.w);
56 return a + a * (1.0 - a) * correction;
57 }
58
59 fn apply_alpha_correction3(a: vec3<f32>, b: vec3<f32>, g: vec4<f32>) -> vec3<f32> {
60 let brightness_adjustment = g.x * b + g.y;
61 let correction = brightness_adjustment * a + (g.z * b + g.w);
62 return a + a * (1.0 - a) * correction;
63 }
64
65 fn apply_contrast_and_gamma_correction(sample: f32, color: vec3<f32>, enhanced_contrast_factor: f32, gamma_ratios: vec4<f32>) -> f32 {
66 let enhanced_contrast = light_on_dark_contrast(enhanced_contrast_factor, color);
67 let brightness = color_brightness(color);
68
69 let contrasted = enhance_contrast(sample, enhanced_contrast);
70 return apply_alpha_correction(contrasted, brightness, gamma_ratios);
71 }
72
73 fn apply_contrast_and_gamma_correction3(sample: vec3<f32>, color: vec3<f32>, enhanced_contrast_factor: f32, gamma_ratios: vec4<f32>) -> vec3<f32> {
74 let enhanced_contrast = light_on_dark_contrast(enhanced_contrast_factor, color);
75
76 let contrasted = enhance_contrast3(sample, enhanced_contrast);
77 return apply_alpha_correction3(contrasted, color, gamma_ratios);
78 }
79
80 struct GlobalParams {
81 viewport_size: vec2<f32>,
82 premultiplied_alpha: u32,
83 pad: u32,
84 }
85
86 struct GammaParams {
87 gamma_ratios: vec4<f32>,
88 grayscale_enhanced_contrast: f32,
89 subpixel_enhanced_contrast: f32,
90 is_bgr: u32,
91 pad: u32,
92 }
93
94 @group(0) @binding(0) var<uniform> globals: GlobalParams;
95 @group(0) @binding(1) var<uniform> gamma_params: GammaParams;
96 @group(2) @binding(0) var t_sprite: texture_2d<f32>;
97 @group(2) @binding(1) var s_sprite: sampler;
98
99 const M_PI_F: f32 = 3.1415926;
100 const GRAYSCALE_FACTORS: vec3<f32> = vec3<f32>(0.2126, 0.7152, 0.0722);
101
102 struct Bounds {
103 origin: vec2<f32>,
104 size: vec2<f32>,
105 }
106
107 struct Corners {
108 top_left: f32,
109 top_right: f32,
110 bottom_right: f32,
111 bottom_left: f32,
112 }
113
114 struct Edges {
115 top: f32,
116 right: f32,
117 bottom: f32,
118 left: f32,
119 }
120
121 struct Hsla {
122 h: f32,
123 s: f32,
124 l: f32,
125 a: f32,
126 }
127
128 struct LinearColorStop {
129 color: Hsla,
130 percentage: f32,
131 }
132
133 struct Background {
134 // 0u is Solid
135 // 1u is LinearGradient
136 // 2u is PatternSlash
137 // 3u is Checkerboard
138 tag: u32,
139 // 0u is sRGB linear color
140 // 1u is Oklab color
141 color_space: u32,
142 solid: Hsla,
143 gradient_angle_or_pattern_height: f32,
144 colors: array<LinearColorStop, 2>,
145 pad: u32,
146 }
147
148 struct AtlasTextureId {
149 index: u32,
150 kind: u32,
151 }
152
153 struct AtlasBounds {
154 origin: vec2<i32>,
155 size: vec2<i32>,
156 }
157
158 struct AtlasTile {
159 texture_id: AtlasTextureId,
160 tile_id: u32,
161 padding: u32,
162 bounds: AtlasBounds,
163 }
164
165 struct TransformationMatrix {
166 rotation_scale: mat2x2<f32>,
167 translation: vec2<f32>,
168 }
169
170 fn to_device_position_impl(position: vec2<f32>) -> vec4<f32> {
171 let device_position = position / globals.viewport_size * vec2<f32>(2.0, -2.0) + vec2<f32>(-1.0, 1.0);
172 return vec4<f32>(device_position, 0.0, 1.0);
173 }
174
175 fn to_device_position(unit_vertex: vec2<f32>, bounds: Bounds) -> vec4<f32> {
176 let position = unit_vertex * vec2<f32>(bounds.size) + bounds.origin;
177 return to_device_position_impl(position);
178 }
179
180 fn to_device_position_transformed(unit_vertex: vec2<f32>, bounds: Bounds, transform: TransformationMatrix) -> vec4<f32> {
181 let position = unit_vertex * vec2<f32>(bounds.size) + bounds.origin;
182 //Note: Rust side stores it as row-major, so transposing here
183 let transformed = transpose(transform.rotation_scale) * position + transform.translation;
184 return to_device_position_impl(transformed);
185 }
186
187 fn to_tile_position(unit_vertex: vec2<f32>, tile: AtlasTile) -> vec2<f32> {
188 let atlas_size = vec2<f32>(textureDimensions(t_sprite, 0));
189 return (vec2<f32>(tile.bounds.origin) + unit_vertex * vec2<f32>(tile.bounds.size)) / atlas_size;
190 }
191
192 fn distance_from_clip_rect_impl(position: vec2<f32>, clip_bounds: Bounds) -> vec4<f32> {
193 let tl = position - clip_bounds.origin;
194 let br = clip_bounds.origin + clip_bounds.size - position;
195 return vec4<f32>(tl.x, br.x, tl.y, br.y);
196 }
197
198 fn distance_from_clip_rect(unit_vertex: vec2<f32>, bounds: Bounds, clip_bounds: Bounds) -> vec4<f32> {
199 let position = unit_vertex * vec2<f32>(bounds.size) + bounds.origin;
200 return distance_from_clip_rect_impl(position, clip_bounds);
201 }
202
203 fn distance_from_clip_rect_transformed(unit_vertex: vec2<f32>, bounds: Bounds, clip_bounds: Bounds, transform: TransformationMatrix) -> vec4<f32> {
204 let position = unit_vertex * vec2<f32>(bounds.size) + bounds.origin;
205 let transformed = transpose(transform.rotation_scale) * position + transform.translation;
206 return distance_from_clip_rect_impl(transformed, clip_bounds);
207 }
208
209 // https://gamedev.stackexchange.com/questions/92015/optimized-linear-to-srgb-glsl
210 fn srgb_to_linear(srgb: vec3<f32>) -> vec3<f32> {
211 let cutoff = srgb < vec3<f32>(0.04045);
212 let higher = pow((srgb + vec3<f32>(0.055)) / vec3<f32>(1.055), vec3<f32>(2.4));
213 let lower = srgb / vec3<f32>(12.92);
214 return select(higher, lower, cutoff);
215 }
216
217 fn srgb_to_linear_component(a: f32) -> f32 {
218 let cutoff = a < 0.04045;
219 let higher = pow((a + 0.055) / 1.055, 2.4);
220 let lower = a / 12.92;
221 return select(higher, lower, cutoff);
222 }
223
224 fn linear_to_srgb(linear: vec3<f32>) -> vec3<f32> {
225 let cutoff = linear < vec3<f32>(0.0031308);
226 let higher = vec3<f32>(1.055) * pow(linear, vec3<f32>(1.0 / 2.4)) - vec3<f32>(0.055);
227 let lower = linear * vec3<f32>(12.92);
228 return select(higher, lower, cutoff);
229 }
230
231 /// Convert a linear color to sRGBA space.
232 fn linear_to_srgba(color: vec4<f32>) -> vec4<f32> {
233 return vec4<f32>(linear_to_srgb(color.rgb), color.a);
234 }
235
236 /// Convert a sRGBA color to linear space.
237 fn srgba_to_linear(color: vec4<f32>) -> vec4<f32> {
238 return vec4<f32>(srgb_to_linear(color.rgb), color.a);
239 }
240
241 /// Hsla to linear RGBA conversion.
242 fn hsla_to_rgba(hsla: Hsla) -> vec4<f32> {
243 let h = hsla.h * 6.0; // Now, it's an angle but scaled in [0, 6) range
244 let s = hsla.s;
245 let l = hsla.l;
246 let a = hsla.a;
247
248 let c = (1.0 - abs(2.0 * l - 1.0)) * s;
249 let x = c * (1.0 - abs(h % 2.0 - 1.0));
250 let m = l - c / 2.0;
251 var color = vec3<f32>(m);
252
253 if (h >= 0.0 && h < 1.0) {
254 color.r += c;
255 color.g += x;
256 } else if (h >= 1.0 && h < 2.0) {
257 color.r += x;
258 color.g += c;
259 } else if (h >= 2.0 && h < 3.0) {
260 color.g += c;
261 color.b += x;
262 } else if (h >= 3.0 && h < 4.0) {
263 color.g += x;
264 color.b += c;
265 } else if (h >= 4.0 && h < 5.0) {
266 color.r += x;
267 color.b += c;
268 } else {
269 color.r += c;
270 color.b += x;
271 }
272
273 return vec4<f32>(color, a);
274 }
275
276 /// Convert a linear sRGB to Oklab space.
277 /// Reference: https://bottosson.github.io/posts/oklab/#converting-from-linear-srgb-to-oklab
278 fn linear_srgb_to_oklab(color: vec4<f32>) -> vec4<f32> {
279 let l = 0.4122214708 * color.r + 0.5363325363 * color.g + 0.0514459929 * color.b;
280 let m = 0.2119034982 * color.r + 0.6806995451 * color.g + 0.1073969566 * color.b;
281 let s = 0.0883024619 * color.r + 0.2817188376 * color.g + 0.6299787005 * color.b;
282
283 let l_ = pow(l, 1.0 / 3.0);
284 let m_ = pow(m, 1.0 / 3.0);
285 let s_ = pow(s, 1.0 / 3.0);
286
287 return vec4<f32>(
288 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_,
289 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_,
290 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_,
291 color.a
292 );
293 }
294
295 /// Convert an Oklab color to linear sRGB space.
296 fn oklab_to_linear_srgb(color: vec4<f32>) -> vec4<f32> {
297 let l_ = color.r + 0.3963377774 * color.g + 0.2158037573 * color.b;
298 let m_ = color.r - 0.1055613458 * color.g - 0.0638541728 * color.b;
299 let s_ = color.r - 0.0894841775 * color.g - 1.2914855480 * color.b;
300
301 let l = l_ * l_ * l_;
302 let m = m_ * m_ * m_;
303 let s = s_ * s_ * s_;
304
305 return vec4<f32>(
306 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
307 -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
308 -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s,
309 color.a
310 );
311 }
312
313 fn over(below: vec4<f32>, above: vec4<f32>) -> vec4<f32> {
314 let alpha = above.a + below.a * (1.0 - above.a);
315 let color = (above.rgb * above.a + below.rgb * below.a * (1.0 - above.a)) / alpha;
316 return vec4<f32>(color, alpha);
317 }
318
319 // A standard gaussian function, used for weighting samples
320 fn gaussian(x: f32, sigma: f32) -> f32{
321 return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * M_PI_F) * sigma);
322 }
323
324 // This approximates the error function, needed for the gaussian integral
325 fn erf(v: vec2<f32>) -> vec2<f32> {
326 let s = sign(v);
327 let a = abs(v);
328 let r1 = 1.0 + (0.278393 + (0.230389 + (0.000972 + 0.078108 * a) * a) * a) * a;
329 let r2 = r1 * r1;
330 return s - s / (r2 * r2);
331 }
332
333 fn blur_along_x(x: f32, y: f32, sigma: f32, corner: f32, half_size: vec2<f32>) -> f32 {
334 let delta = min(half_size.y - corner - abs(y), 0.0);
335 let curved = half_size.x - corner + sqrt(max(0.0, corner * corner - delta * delta));
336 let integral = 0.5 + 0.5 * erf((x + vec2<f32>(-curved, curved)) * (sqrt(0.5) / sigma));
337 return integral.y - integral.x;
338 }
339
340 // Selects corner radius based on quadrant.
341 fn pick_corner_radius(center_to_point: vec2<f32>, radii: Corners) -> f32 {
342 if (center_to_point.x < 0.0) {
343 if (center_to_point.y < 0.0) {
344 return radii.top_left;
345 } else {
346 return radii.bottom_left;
347 }
348 } else {
349 if (center_to_point.y < 0.0) {
350 return radii.top_right;
351 } else {
352 return radii.bottom_right;
353 }
354 }
355 }
356
357 // Signed distance of the point to the quad's border - positive outside the
358 // border, and negative inside.
359 //
360 // See comments on similar code using `quad_sdf_impl` in `fs_quad` for
361 // explanation.
362 fn quad_sdf(point: vec2<f32>, bounds: Bounds, corner_radii: Corners) -> f32 {
363 let half_size = bounds.size / 2.0;
364 let center = bounds.origin + half_size;
365 let center_to_point = point - center;
366 let corner_radius = pick_corner_radius(center_to_point, corner_radii);
367 let corner_to_point = abs(center_to_point) - half_size;
368 let corner_center_to_point = corner_to_point + corner_radius;
369 return quad_sdf_impl(corner_center_to_point, corner_radius);
370 }
371
372 fn quad_sdf_impl(corner_center_to_point: vec2<f32>, corner_radius: f32) -> f32 {
373 if (corner_radius == 0.0) {
374 // Fast path for unrounded corners.
375 return max(corner_center_to_point.x, corner_center_to_point.y);
376 } else {
377 // Signed distance of the point from a quad that is inset by corner_radius.
378 // It is negative inside this quad, and positive outside.
379 let signed_distance_to_inset_quad =
380 // 0 inside the inset quad, and positive outside.
381 length(max(vec2<f32>(0.0), corner_center_to_point)) +
382 // 0 outside the inset quad, and negative inside.
383 min(0.0, max(corner_center_to_point.x, corner_center_to_point.y));
384
385 return signed_distance_to_inset_quad - corner_radius;
386 }
387 }
388
389 // Abstract away the final color transformation based on the
390 // target alpha compositing mode.
391 fn blend_color(color: vec4<f32>, alpha_factor: f32) -> vec4<f32> {
392 let alpha = color.a * alpha_factor;
393 let multiplier = select(1.0, alpha, globals.premultiplied_alpha != 0u);
394 return vec4<f32>(color.rgb * multiplier, alpha);
395 }
396
397
398 struct GradientColor {
399 solid: vec4<f32>,
400 color0: vec4<f32>,
401 color1: vec4<f32>,
402 }
403
404 fn prepare_gradient_color(tag: u32, color_space: u32,
405 solid: Hsla, colors: array<LinearColorStop, 2>) -> GradientColor {
406 var result = GradientColor();
407
408 if (tag == 0u || tag == 2u || tag == 3u) {
409 result.solid = hsla_to_rgba(solid);
410 } else if (tag == 1u) {
411 // The hsla_to_rgba is returns a linear sRGB color
412 result.color0 = hsla_to_rgba(colors[0].color);
413 result.color1 = hsla_to_rgba(colors[1].color);
414
415 // Prepare color space in vertex for avoid conversion
416 // in fragment shader for performance reasons
417 if (color_space == 0u) {
418 // sRGB
419 result.color0 = linear_to_srgba(result.color0);
420 result.color1 = linear_to_srgba(result.color1);
421 } else if (color_space == 1u) {
422 // Oklab
423 result.color0 = linear_srgb_to_oklab(result.color0);
424 result.color1 = linear_srgb_to_oklab(result.color1);
425 }
426 }
427
428 return result;
429 }
430
431 fn gradient_color(background: Background, position: vec2<f32>, bounds: Bounds,
432 solid_color: vec4<f32>, color0: vec4<f32>, color1: vec4<f32>) -> vec4<f32> {
433 var background_color = vec4<f32>(0.0);
434
435 switch (background.tag) {
436 default: {
437 return solid_color;
438 }
439 case 1u: {
440 // Linear gradient background.
441 // -90 degrees to match the CSS gradient angle.
442 let angle = background.gradient_angle_or_pattern_height;
443 let radians = (angle % 360.0 - 90.0) * M_PI_F / 180.0;
444 var direction = vec2<f32>(cos(radians), sin(radians));
445 let stop0_percentage = background.colors[0].percentage;
446 let stop1_percentage = background.colors[1].percentage;
447
448 // Expand the short side to be the same as the long side
449 if (bounds.size.x > bounds.size.y) {
450 direction.y *= bounds.size.y / bounds.size.x;
451 } else {
452 direction.x *= bounds.size.x / bounds.size.y;
453 }
454
455 // Get the t value for the linear gradient with the color stop percentages.
456 let half_size = bounds.size / 2.0;
457 let center = bounds.origin + half_size;
458 let center_to_point = position - center;
459 var t = dot(center_to_point, direction) / length(direction);
460 // Check the direct to determine the use x or y
461 if (abs(direction.x) > abs(direction.y)) {
462 t = (t + half_size.x) / bounds.size.x;
463 } else {
464 t = (t + half_size.y) / bounds.size.y;
465 }
466
467 // Adjust t based on the stop percentages
468 t = (t - stop0_percentage) / (stop1_percentage - stop0_percentage);
469 t = clamp(t, 0.0, 1.0);
470
471 switch (background.color_space) {
472 default: {
473 background_color = srgba_to_linear(mix(color0, color1, t));
474 }
475 case 1u: {
476 let oklab_color = mix(color0, color1, t);
477 background_color = oklab_to_linear_srgb(oklab_color);
478 }
479 }
480 }
481 case 2u: {
482 // pattern slash
483 let gradient_angle_or_pattern_height = background.gradient_angle_or_pattern_height;
484 let pattern_width = (gradient_angle_or_pattern_height / 65535.0f) / 255.0f;
485 let pattern_interval = (gradient_angle_or_pattern_height % 65535.0f) / 255.0f;
486 let pattern_height = pattern_width + pattern_interval;
487 let stripe_angle = M_PI_F / 4.0;
488 let pattern_period = pattern_height * sin(stripe_angle);
489 let rotation = mat2x2<f32>(
490 cos(stripe_angle), -sin(stripe_angle),
491 sin(stripe_angle), cos(stripe_angle)
492 );
493 let relative_position = position - bounds.origin;
494 let rotated_point = rotation * relative_position;
495 let pattern = rotated_point.x % pattern_period;
496 let distance = min(pattern, pattern_period - pattern) - pattern_period * (pattern_width / pattern_height) / 2.0f;
497 background_color = solid_color;
498 background_color.a *= saturate(0.5 - distance);
499 }
500 case 3u: {
501 // checkerboard
502 let size = background.gradient_angle_or_pattern_height;
503 let relative_position = position - bounds.origin;
504
505 let x_index = floor(relative_position.x / size);
506 let y_index = floor(relative_position.y / size);
507 let should_be_colored = (x_index + y_index) % 2.0;
508
509 background_color = solid_color;
510 background_color.a *= saturate(should_be_colored);
511 }
512 }
513
514 return background_color;
515 }
516
517 // --- quads --- //
518
519 struct Quad {
520 order: u32,
521 border_style: u32,
522 bounds: Bounds,
523 content_mask: Bounds,
524 background: Background,
525 border_color: Hsla,
526 corner_radii: Corners,
527 border_widths: Edges,
528 }
529
530 struct QuadVarying {
531 @builtin(position) position: vec4<f32>,
532 @location(0) @interpolate(flat) border_color: vec4<f32>,
533 @location(1) @interpolate(flat) quad_id: u32,
534 // TODO: use `clip_distance` once Naga supports it
535 @location(2) clip_distances: vec4<f32>,
536 @location(3) @interpolate(flat) background_solid: vec4<f32>,
537 @location(4) @interpolate(flat) background_color0: vec4<f32>,
538 @location(5) @interpolate(flat) background_color1: vec4<f32>,
539 }
540
541 @vertex
542 fn vs_quad(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> QuadVarying {
543 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
544 let quad = load_quad(instance_id);
545
546 var out = QuadVarying();
547 out.position = to_device_position(unit_vertex, quad.bounds);
548
549 let gradient = prepare_gradient_color(
550 quad.background.tag,
551 quad.background.color_space,
552 quad.background.solid,
553 quad.background.colors
554 );
555 out.background_solid = gradient.solid;
556 out.background_color0 = gradient.color0;
557 out.background_color1 = gradient.color1;
558 out.border_color = hsla_to_rgba(quad.border_color);
559 out.quad_id = instance_id;
560 out.clip_distances = distance_from_clip_rect(unit_vertex, quad.bounds, quad.content_mask);
561 return out;
562 }
563
564 @fragment
565 fn fs_quad(input: QuadVarying) -> @location(0) vec4<f32> {
566 // Alpha clip first, since we don't have `clip_distance`.
567 if (any(input.clip_distances < vec4<f32>(0.0))) {
568 return vec4<f32>(0.0);
569 }
570
571 let quad = load_quad(input.quad_id);
572
573 let background_color = gradient_color(quad.background, input.position.xy, quad.bounds,
574 input.background_solid, input.background_color0, input.background_color1);
575
576 let unrounded = quad.corner_radii.top_left == 0.0 &&
577 quad.corner_radii.bottom_left == 0.0 &&
578 quad.corner_radii.top_right == 0.0 &&
579 quad.corner_radii.bottom_right == 0.0;
580
581 // Fast path when the quad is not rounded and doesn't have any border
582 if (quad.border_widths.top == 0.0 &&
583 quad.border_widths.left == 0.0 &&
584 quad.border_widths.right == 0.0 &&
585 quad.border_widths.bottom == 0.0 &&
586 unrounded) {
587 return blend_color(background_color, 1.0);
588 }
589
590 let size = quad.bounds.size;
591 let half_size = size / 2.0;
592 let point = input.position.xy - quad.bounds.origin;
593 let center_to_point = point - half_size;
594
595 // Signed distance field threshold for inclusion of pixels. 0.5 is the
596 // minimum distance between the center of the pixel and the edge.
597 let antialias_threshold = 0.5;
598
599 // Radius of the nearest corner
600 let corner_radius = pick_corner_radius(center_to_point, quad.corner_radii);
601
602 // Width of the nearest borders
603 let border = vec2<f32>(
604 select(
605 quad.border_widths.right,
606 quad.border_widths.left,
607 center_to_point.x < 0.0),
608 select(
609 quad.border_widths.bottom,
610 quad.border_widths.top,
611 center_to_point.y < 0.0));
612
613 // 0-width borders are reduced so that `inner_sdf >= antialias_threshold`.
614 // The purpose of this is to not draw antialiasing pixels in this case.
615 let reduced_border =
616 vec2<f32>(select(border.x, -antialias_threshold, border.x == 0.0),
617 select(border.y, -antialias_threshold, border.y == 0.0));
618
619 // Vector from the corner of the quad bounds to the point, after mirroring
620 // the point into the bottom right quadrant. Both components are <= 0.
621 let corner_to_point = abs(center_to_point) - half_size;
622
623 // Vector from the point to the center of the rounded corner's circle, also
624 // mirrored into bottom right quadrant.
625 let corner_center_to_point = corner_to_point + corner_radius;
626
627 // Whether the nearest point on the border is rounded
628 let is_near_rounded_corner =
629 corner_center_to_point.x >= 0 &&
630 corner_center_to_point.y >= 0;
631
632 // Vector from straight border inner corner to point.
633 let straight_border_inner_corner_to_point = corner_to_point + reduced_border;
634
635 // Whether the point is beyond the inner edge of the straight border.
636 let is_beyond_inner_straight_border =
637 straight_border_inner_corner_to_point.x > 0 ||
638 straight_border_inner_corner_to_point.y > 0;
639
640 // Whether the point is far enough inside the quad, such that the pixels are
641 // not affected by the straight border.
642 let is_within_inner_straight_border =
643 straight_border_inner_corner_to_point.x < -antialias_threshold &&
644 straight_border_inner_corner_to_point.y < -antialias_threshold;
645
646 // Fast path for points that must be part of the background.
647 //
648 // This could be optimized further for large rounded corners by including
649 // points in an inscribed rectangle, or some other quick linear check.
650 // However, that might negatively impact performance in the case of
651 // reasonable sizes for rounded corners.
652 if (is_within_inner_straight_border && !is_near_rounded_corner) {
653 return blend_color(background_color, 1.0);
654 }
655
656 // Signed distance of the point to the outside edge of the quad's border. It
657 // is positive outside this edge, and negative inside.
658 let outer_sdf = quad_sdf_impl(corner_center_to_point, corner_radius);
659
660 // Approximate signed distance of the point to the inside edge of the quad's
661 // border. It is negative outside this edge (within the border), and
662 // positive inside.
663 //
664 // This is not always an accurate signed distance:
665 // * The rounded portions with varying border width use an approximation of
666 // nearest-point-on-ellipse.
667 // * When it is quickly known to be outside the edge, -1.0 is used.
668 var inner_sdf = 0.0;
669 if (corner_center_to_point.x <= 0 || corner_center_to_point.y <= 0) {
670 // Fast paths for straight borders.
671 inner_sdf = -max(straight_border_inner_corner_to_point.x,
672 straight_border_inner_corner_to_point.y);
673 } else if (is_beyond_inner_straight_border) {
674 // Fast path for points that must be outside the inner edge.
675 inner_sdf = -1.0;
676 } else if (reduced_border.x == reduced_border.y) {
677 // Fast path for circular inner edge.
678 inner_sdf = -(outer_sdf + reduced_border.x);
679 } else {
680 let ellipse_radii = max(vec2<f32>(0.0), corner_radius - reduced_border);
681 inner_sdf = quarter_ellipse_sdf(corner_center_to_point, ellipse_radii);
682 }
683
684 // Negative when inside the border
685 let border_sdf = max(inner_sdf, outer_sdf);
686
687 var color = background_color;
688 if (border_sdf < antialias_threshold) {
689 var border_color = input.border_color;
690
691 // Dashed border logic when border_style == 1
692 if (quad.border_style == 1) {
693 // Position along the perimeter in "dash space", where each dash
694 // period has length 1
695 var t = 0.0;
696
697 // Total number of dash periods, so that the dash spacing can be
698 // adjusted to evenly divide it
699 var max_t = 0.0;
700
701 // Border width is proportional to dash size. This is the behavior
702 // used by browsers, but also avoids dashes from different segments
703 // overlapping when dash size is smaller than the border width.
704 //
705 // Dash pattern: (2 * border width) dash, (1 * border width) gap
706 let dash_length_per_width = 2.0;
707 let dash_gap_per_width = 1.0;
708 let dash_period_per_width = dash_length_per_width + dash_gap_per_width;
709
710 // Since the dash size is determined by border width, the density of
711 // dashes varies. Multiplying a pixel distance by this returns a
712 // position in dash space - it has units (dash period / pixels). So
713 // a dash velocity of (1 / 10) is 1 dash every 10 pixels.
714 var dash_velocity = 0.0;
715
716 // Dividing this by the border width gives the dash velocity
717 let dv_numerator = 1.0 / dash_period_per_width;
718
719 if (unrounded) {
720 // When corners aren't rounded, the dashes are separately laid
721 // out on each straight line, rather than around the whole
722 // perimeter. This way each line starts and ends with a dash.
723 let is_horizontal =
724 corner_center_to_point.x <
725 corner_center_to_point.y;
726
727 // When applying dashed borders to just some, not all, the sides.
728 // The way we chose border widths above sometimes comes with a 0 width value.
729 // So we choose again to avoid division by zero.
730 // TODO: A better solution exists taking a look at the whole file.
731 // this does not fix single dashed borders at the corners
732 let dashed_border = vec2<f32>(
733 max(
734 quad.border_widths.bottom,
735 quad.border_widths.top,
736 ),
737 max(
738 quad.border_widths.right,
739 quad.border_widths.left,
740 )
741 );
742
743 let border_width = select(dashed_border.y, dashed_border.x, is_horizontal);
744 dash_velocity = dv_numerator / border_width;
745 t = select(point.y, point.x, is_horizontal) * dash_velocity;
746 max_t = select(size.y, size.x, is_horizontal) * dash_velocity;
747 } else {
748 // When corners are rounded, the dashes are laid out clockwise
749 // around the whole perimeter.
750
751 let r_tr = quad.corner_radii.top_right;
752 let r_br = quad.corner_radii.bottom_right;
753 let r_bl = quad.corner_radii.bottom_left;
754 let r_tl = quad.corner_radii.top_left;
755
756 let w_t = quad.border_widths.top;
757 let w_r = quad.border_widths.right;
758 let w_b = quad.border_widths.bottom;
759 let w_l = quad.border_widths.left;
760
761 // Straight side dash velocities
762 let dv_t = select(dv_numerator / w_t, 0.0, w_t <= 0.0);
763 let dv_r = select(dv_numerator / w_r, 0.0, w_r <= 0.0);
764 let dv_b = select(dv_numerator / w_b, 0.0, w_b <= 0.0);
765 let dv_l = select(dv_numerator / w_l, 0.0, w_l <= 0.0);
766
767 // Straight side lengths in dash space
768 let s_t = (size.x - r_tl - r_tr) * dv_t;
769 let s_r = (size.y - r_tr - r_br) * dv_r;
770 let s_b = (size.x - r_br - r_bl) * dv_b;
771 let s_l = (size.y - r_bl - r_tl) * dv_l;
772
773 let corner_dash_velocity_tr = corner_dash_velocity(dv_t, dv_r);
774 let corner_dash_velocity_br = corner_dash_velocity(dv_b, dv_r);
775 let corner_dash_velocity_bl = corner_dash_velocity(dv_b, dv_l);
776 let corner_dash_velocity_tl = corner_dash_velocity(dv_t, dv_l);
777
778 // Corner lengths in dash space
779 let c_tr = r_tr * (M_PI_F / 2.0) * corner_dash_velocity_tr;
780 let c_br = r_br * (M_PI_F / 2.0) * corner_dash_velocity_br;
781 let c_bl = r_bl * (M_PI_F / 2.0) * corner_dash_velocity_bl;
782 let c_tl = r_tl * (M_PI_F / 2.0) * corner_dash_velocity_tl;
783
784 // Cumulative dash space upto each segment
785 let upto_tr = s_t;
786 let upto_r = upto_tr + c_tr;
787 let upto_br = upto_r + s_r;
788 let upto_b = upto_br + c_br;
789 let upto_bl = upto_b + s_b;
790 let upto_l = upto_bl + c_bl;
791 let upto_tl = upto_l + s_l;
792 max_t = upto_tl + c_tl;
793
794 if (is_near_rounded_corner) {
795 let radians = atan2(corner_center_to_point.y,
796 corner_center_to_point.x);
797 let corner_t = radians * corner_radius;
798
799 if (center_to_point.x >= 0.0) {
800 if (center_to_point.y < 0.0) {
801 dash_velocity = corner_dash_velocity_tr;
802 // Subtracted because radians is pi/2 to 0 when
803 // going clockwise around the top right corner,
804 // since the y axis has been flipped
805 t = upto_r - corner_t * dash_velocity;
806 } else {
807 dash_velocity = corner_dash_velocity_br;
808 // Added because radians is 0 to pi/2 when going
809 // clockwise around the bottom-right corner
810 t = upto_br + corner_t * dash_velocity;
811 }
812 } else {
813 if (center_to_point.y >= 0.0) {
814 dash_velocity = corner_dash_velocity_bl;
815 // Subtracted because radians is pi/2 to 0 when
816 // going clockwise around the bottom-left corner,
817 // since the x axis has been flipped
818 t = upto_l - corner_t * dash_velocity;
819 } else {
820 dash_velocity = corner_dash_velocity_tl;
821 // Added because radians is 0 to pi/2 when going
822 // clockwise around the top-left corner, since both
823 // axis were flipped
824 t = upto_tl + corner_t * dash_velocity;
825 }
826 }
827 } else {
828 // Straight borders
829 let is_horizontal =
830 corner_center_to_point.x <
831 corner_center_to_point.y;
832 if (is_horizontal) {
833 if (center_to_point.y < 0.0) {
834 dash_velocity = dv_t;
835 t = (point.x - r_tl) * dash_velocity;
836 } else {
837 dash_velocity = dv_b;
838 t = upto_bl - (point.x - r_bl) * dash_velocity;
839 }
840 } else {
841 if (center_to_point.x < 0.0) {
842 dash_velocity = dv_l;
843 t = upto_tl - (point.y - r_tl) * dash_velocity;
844 } else {
845 dash_velocity = dv_r;
846 t = upto_r + (point.y - r_tr) * dash_velocity;
847 }
848 }
849 }
850 }
851
852 let dash_length = dash_length_per_width / dash_period_per_width;
853 let desired_dash_gap = dash_gap_per_width / dash_period_per_width;
854
855 // Straight borders should start and end with a dash, so max_t is
856 // reduced to cause this.
857 max_t -= select(0.0, dash_length, unrounded);
858 if (max_t >= 1.0) {
859 // Adjust dash gap to evenly divide max_t.
860 let dash_count = floor(max_t);
861 let dash_period = max_t / dash_count;
862 border_color.a *= dash_alpha(
863 t,
864 dash_period,
865 dash_length,
866 dash_velocity,
867 antialias_threshold);
868 } else if (unrounded) {
869 // When there isn't enough space for the full gap between the
870 // two start / end dashes of a straight border, reduce gap to
871 // make them fit.
872 let dash_gap = max_t - dash_length;
873 if (dash_gap > 0.0) {
874 let dash_period = dash_length + dash_gap;
875 border_color.a *= dash_alpha(
876 t,
877 dash_period,
878 dash_length,
879 dash_velocity,
880 antialias_threshold);
881 }
882 }
883 }
884
885 // Blend the border on top of the background and then linearly interpolate
886 // between the two as we slide inside the background.
887 let blended_border = over(background_color, border_color);
888 color = mix(background_color, blended_border,
889 saturate(antialias_threshold - inner_sdf));
890 }
891
892 return blend_color(color, saturate(antialias_threshold - outer_sdf));
893 }
894
895 // Returns the dash velocity of a corner given the dash velocity of the two
896 // sides, by returning the slower velocity (larger dashes).
897 //
898 // Since 0 is used for dash velocity when the border width is 0 (instead of
899 // +inf), this returns the other dash velocity in that case.
900 //
901 // An alternative to this might be to appropriately interpolate the dash
902 // velocity around the corner, but that seems overcomplicated.
903 fn corner_dash_velocity(dv1: f32, dv2: f32) -> f32 {
904 if (dv1 == 0.0) {
905 return dv2;
906 } else if (dv2 == 0.0) {
907 return dv1;
908 } else {
909 return min(dv1, dv2);
910 }
911 }
912
913 // Returns alpha used to render antialiased dashes.
914 // `t` is within the dash when `fmod(t, period) < length`.
915 fn dash_alpha(t: f32, period: f32, length: f32, dash_velocity: f32, antialias_threshold: f32) -> f32 {
916 let half_period = period / 2;
917 let half_length = length / 2;
918 // Value in [-half_period, half_period].
919 // The dash is in [-half_length, half_length].
920 let centered = fmod(t + half_period - half_length, period) - half_period;
921 // Signed distance for the dash, negative values are inside the dash.
922 let signed_distance = abs(centered) - half_length;
923 // Antialiased alpha based on the signed distance.
924 return saturate(antialias_threshold - signed_distance / dash_velocity);
925 }
926
927 // This approximates distance to the nearest point to a quarter ellipse in a way
928 // that is sufficient for anti-aliasing when the ellipse is not very eccentric.
929 // The components of `point` are expected to be positive.
930 //
931 // Negative on the outside and positive on the inside.
932 fn quarter_ellipse_sdf(point: vec2<f32>, radii: vec2<f32>) -> f32 {
933 // Scale the space to treat the ellipse like a unit circle.
934 let circle_vec = point / radii;
935 let unit_circle_sdf = length(circle_vec) - 1.0;
936 // Approximate up-scaling of the length by using the average of the radii.
937 //
938 // TODO: A better solution would be to use the gradient of the implicit
939 // function for an ellipse to approximate a scaling factor.
940 return unit_circle_sdf * (radii.x + radii.y) * -0.5;
941 }
942
943 // Modulus that has the same sign as `a`.
944 fn fmod(a: f32, b: f32) -> f32 {
945 return a - b * trunc(a / b);
946 }
947
948 // --- shadows --- //
949
950 struct Shadow {
951 order: u32,
952 blur_radius: f32,
953 // The shadow rect for drop shadows; the "hole" rect for inset shadows.
954 bounds: Bounds,
955 corner_radii: Corners,
956 content_mask: Bounds,
957 color: Hsla,
958 // Only consulted when `inset == 1u`: the element's own bounds, used as a rounded-rect
959 // clip so the shadow never escapes the element.
960 element_bounds: Bounds,
961 element_corner_radii: Corners,
962 // 0 = drop shadow, 1 = inset shadow.
963 inset: u32,
964 pad: u32, // align to 8 bytes
965 }
966
967 struct ShadowVarying {
968 @builtin(position) position: vec4<f32>,
969 @location(0) @interpolate(flat) color: vec4<f32>,
970 @location(1) @interpolate(flat) shadow_id: u32,
971 //TODO: use `clip_distance` once Naga supports it
972 @location(3) clip_distances: vec4<f32>,
973 }
974
975 @vertex
976 fn vs_shadow(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> ShadowVarying {
977 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
978 var shadow = load_shadow(instance_id);
979
980 var geometry: Bounds;
981 if (shadow.inset != 0u) {
982 geometry = shadow.element_bounds;
983 } else {
984 // Leave room for the gaussian tail outside the shadow rect.
985 let margin = 3.0 * shadow.blur_radius;
986 geometry = shadow.bounds;
987 geometry.origin -= vec2<f32>(margin);
988 geometry.size += 2.0 * vec2<f32>(margin);
989 }
990
991 var out = ShadowVarying();
992 out.position = to_device_position(unit_vertex, geometry);
993 out.color = hsla_to_rgba(shadow.color);
994 out.shadow_id = instance_id;
995 out.clip_distances = distance_from_clip_rect(unit_vertex, geometry, shadow.content_mask);
996 return out;
997 }
998
999 @fragment
1000 fn fs_shadow(input: ShadowVarying) -> @location(0) vec4<f32> {
1001 // Alpha clip first, since we don't have `clip_distance`.
1002 if (any(input.clip_distances < vec4<f32>(0.0))) {
1003 return vec4<f32>(0.0);
1004 }
1005
1006 let shadow = load_shadow(input.shadow_id);
1007 let half_size = shadow.bounds.size / 2.0;
1008 let center = shadow.bounds.origin + half_size;
1009 let center_to_point = input.position.xy - center;
1010
1011 let corner_radius = pick_corner_radius(center_to_point, shadow.corner_radii);
1012
1013 var alpha: f32;
1014 if (shadow.blur_radius == 0.0) {
1015 let distance = quad_sdf(input.position.xy, shadow.bounds, shadow.corner_radii);
1016 alpha = saturate(0.5 - distance);
1017 } else {
1018 // The signal is only non-zero in a limited range, so don't waste samples
1019 let low = center_to_point.y - half_size.y;
1020 let high = center_to_point.y + half_size.y;
1021 let start = clamp(-3.0 * shadow.blur_radius, low, high);
1022 let end = clamp(3.0 * shadow.blur_radius, low, high);
1023
1024 // Accumulate samples (we can get away with surprisingly few samples)
1025 let step = (end - start) / 4.0;
1026 var y = start + step * 0.5;
1027 alpha = 0.0;
1028 for (var i = 0; i < 4; i += 1) {
1029 let blur = blur_along_x(center_to_point.x, center_to_point.y - y,
1030 shadow.blur_radius, corner_radius, half_size);
1031 alpha += blur * gaussian(y, shadow.blur_radius) * step;
1032 y += step;
1033 }
1034 }
1035
1036 if (shadow.inset != 0u) {
1037 // The inset shadow is the complement of the (blurred) hole rect, clipped to the element.
1038 // `saturate(0.5 - d)` gives a 1-pixel antialiased edge: d <= -0.5 -> 1, d >= 0.5 -> 0.
1039 alpha = 1.0 - alpha;
1040 let element_distance = quad_sdf(input.position.xy, shadow.element_bounds,
1041 shadow.element_corner_radii);
1042 alpha *= saturate(0.5 - element_distance);
1043 }
1044
1045 return blend_color(input.color, alpha);
1046 }
1047
1048 // --- path rasterization --- //
1049
1050 struct PathRasterizationVertex {
1051 xy_position: vec2<f32>,
1052 st_position: vec2<f32>,
1053 color: Background,
1054 bounds: Bounds,
1055 }
1056
1057
1058
1059 struct PathRasterizationVarying {
1060 @builtin(position) position: vec4<f32>,
1061 @location(0) st_position: vec2<f32>,
1062 @location(1) @interpolate(flat) vertex_id: u32,
1063 //TODO: use `clip_distance` once Naga supports it
1064 @location(3) clip_distances: vec4<f32>,
1065 }
1066
1067 @vertex
1068 fn vs_path_rasterization(@builtin(vertex_index) vertex_id: u32) -> PathRasterizationVarying {
1069 let v = load_path_vertex(vertex_id);
1070
1071 var out = PathRasterizationVarying();
1072 out.position = to_device_position_impl(v.xy_position);
1073 out.st_position = v.st_position;
1074 out.vertex_id = vertex_id;
1075 out.clip_distances = distance_from_clip_rect_impl(v.xy_position, v.bounds);
1076 return out;
1077 }
1078
1079 @fragment
1080 fn fs_path_rasterization(input: PathRasterizationVarying) -> @location(0) vec4<f32> {
1081 let dx = dpdx(input.st_position);
1082 let dy = dpdy(input.st_position);
1083 if (any(input.clip_distances < vec4<f32>(0.0))) {
1084 return vec4<f32>(0.0);
1085 }
1086
1087 let v = load_path_vertex(input.vertex_id);
1088 let background = v.color;
1089 let bounds = v.bounds;
1090
1091 var alpha: f32;
1092 if (length(vec2<f32>(dx.x, dy.x)) < 0.001) {
1093 // If the gradient is too small, return a solid color.
1094 alpha = 1.0;
1095 } else {
1096 let gradient = 2.0 * input.st_position.xx * vec2<f32>(dx.x, dy.x) - vec2<f32>(dx.y, dy.y);
1097 let f = input.st_position.x * input.st_position.x - input.st_position.y;
1098 let distance = f / length(gradient);
1099 alpha = saturate(0.5 - distance);
1100 }
1101 let prepared_gradient = prepare_gradient_color(
1102 background.tag,
1103 background.color_space,
1104 background.solid,
1105 background.colors,
1106 );
1107 let color = gradient_color(background, input.position.xy, bounds,
1108 prepared_gradient.solid, prepared_gradient.color0, prepared_gradient.color1);
1109 return vec4<f32>(color.rgb * color.a * alpha, color.a * alpha);
1110 }
1111
1112 // --- paths --- //
1113
1114 struct PathSprite {
1115 bounds: Bounds,
1116 }
1117
1118
1119 struct PathVarying {
1120 @builtin(position) position: vec4<f32>,
1121 @location(0) texture_coords: vec2<f32>,
1122 }
1123
1124 @vertex
1125 fn vs_path(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> PathVarying {
1126 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1127 let sprite = load_path_sprite(instance_id);
1128 // Don't apply content mask because it was already accounted for when rasterizing the path.
1129 let device_position = to_device_position(unit_vertex, sprite.bounds);
1130 // For screen-space intermediate texture, convert screen position to texture coordinates
1131 let screen_position = sprite.bounds.origin + unit_vertex * sprite.bounds.size;
1132 let texture_coords = screen_position / globals.viewport_size;
1133
1134 var out = PathVarying();
1135 out.position = device_position;
1136 out.texture_coords = texture_coords;
1137
1138 return out;
1139 }
1140
1141 @fragment
1142 fn fs_path(input: PathVarying) -> @location(0) vec4<f32> {
1143 let sample = textureSample(t_sprite, s_sprite, input.texture_coords);
1144 return sample;
1145 }
1146
1147 // --- underlines --- //
1148
1149 struct Underline {
1150 order: u32,
1151 pad: u32,
1152 bounds: Bounds,
1153 content_mask: Bounds,
1154 color: Hsla,
1155 thickness: f32,
1156 wavy: u32,
1157 }
1158
1159
1160 struct UnderlineVarying {
1161 @builtin(position) position: vec4<f32>,
1162 @location(0) @interpolate(flat) color: vec4<f32>,
1163 @location(1) @interpolate(flat) underline_id: u32,
1164 //TODO: use `clip_distance` once Naga supports it
1165 @location(3) clip_distances: vec4<f32>,
1166 }
1167
1168 @vertex
1169 fn vs_underline(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> UnderlineVarying {
1170 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1171 let underline = load_underline(instance_id);
1172
1173 var out = UnderlineVarying();
1174 out.position = to_device_position(unit_vertex, underline.bounds);
1175 out.color = hsla_to_rgba(underline.color);
1176 out.underline_id = instance_id;
1177 out.clip_distances = distance_from_clip_rect(unit_vertex, underline.bounds, underline.content_mask);
1178 return out;
1179 }
1180
1181 @fragment
1182 fn fs_underline(input: UnderlineVarying) -> @location(0) vec4<f32> {
1183 const WAVE_FREQUENCY: f32 = 2.0;
1184 const WAVE_HEIGHT_RATIO: f32 = 0.8;
1185
1186 // Alpha clip first, since we don't have `clip_distance`.
1187 if (any(input.clip_distances < vec4<f32>(0.0))) {
1188 return vec4<f32>(0.0);
1189 }
1190
1191 let underline = load_underline(input.underline_id);
1192 if (underline.wavy == 0u)
1193 {
1194 return blend_color(input.color, input.color.a);
1195 }
1196
1197 let half_thickness = underline.thickness * 0.5;
1198
1199 let st = (input.position.xy - underline.bounds.origin) / underline.bounds.size.y - vec2<f32>(0.0, 0.5);
1200 let frequency = M_PI_F * WAVE_FREQUENCY * underline.thickness / underline.bounds.size.y;
1201 let amplitude = (underline.thickness * WAVE_HEIGHT_RATIO) / underline.bounds.size.y;
1202
1203 let sine = sin(st.x * frequency) * amplitude;
1204 let dSine = cos(st.x * frequency) * amplitude * frequency;
1205 let distance = (st.y - sine) / sqrt(1.0 + dSine * dSine);
1206 let distance_in_pixels = distance * underline.bounds.size.y;
1207 let distance_from_top_border = distance_in_pixels - half_thickness;
1208 let distance_from_bottom_border = distance_in_pixels + half_thickness;
1209 let alpha = saturate(0.5 - max(-distance_from_bottom_border, distance_from_top_border));
1210 return blend_color(input.color, alpha * input.color.a);
1211 }
1212
1213 // --- monochrome sprites --- //
1214
1215 struct MonochromeSprite {
1216 order: u32,
1217 pad: u32,
1218 bounds: Bounds,
1219 content_mask: Bounds,
1220 color: Hsla,
1221 tile: AtlasTile,
1222 transformation: TransformationMatrix,
1223 }
1224
1225
1226 struct MonoSpriteVarying {
1227 @builtin(position) position: vec4<f32>,
1228 @location(0) tile_position: vec2<f32>,
1229 @location(1) @interpolate(flat) color: vec4<f32>,
1230 @location(3) clip_distances: vec4<f32>,
1231 }
1232
1233 @vertex
1234 fn vs_mono_sprite(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> MonoSpriteVarying {
1235 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1236 let sprite = load_mono_sprite(instance_id);
1237
1238 var out = MonoSpriteVarying();
1239 out.position = to_device_position_transformed(unit_vertex, sprite.bounds, sprite.transformation);
1240
1241 out.tile_position = to_tile_position(unit_vertex, sprite.tile);
1242 out.color = hsla_to_rgba(sprite.color);
1243 out.clip_distances = distance_from_clip_rect_transformed(unit_vertex, sprite.bounds, sprite.content_mask, sprite.transformation);
1244 return out;
1245 }
1246
1247 @fragment
1248 fn fs_mono_sprite(input: MonoSpriteVarying) -> @location(0) vec4<f32> {
1249 let sample = textureSample(t_sprite, s_sprite, input.tile_position).r;
1250 let alpha_corrected = apply_contrast_and_gamma_correction(sample, input.color.rgb, gamma_params.grayscale_enhanced_contrast, gamma_params.gamma_ratios);
1251
1252 // Alpha clip after using the derivatives.
1253 if (any(input.clip_distances < vec4<f32>(0.0))) {
1254 return vec4<f32>(0.0);
1255 }
1256
1257 return blend_color(input.color, alpha_corrected);
1258 }
1259
1260 // --- polychrome sprites --- //
1261
1262 struct PolychromeSprite {
1263 order: u32,
1264 pad: u32,
1265 grayscale: u32,
1266 opacity: f32,
1267 bounds: Bounds,
1268 content_mask: Bounds,
1269 corner_radii: Corners,
1270 tile: AtlasTile,
1271 }
1272
1273
1274 struct PolySpriteVarying {
1275 @builtin(position) position: vec4<f32>,
1276 @location(0) tile_position: vec2<f32>,
1277 @location(1) @interpolate(flat) sprite_id: u32,
1278 @location(3) clip_distances: vec4<f32>,
1279 }
1280
1281 @vertex
1282 fn vs_poly_sprite(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> PolySpriteVarying {
1283 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1284 let sprite = load_poly_sprite(instance_id);
1285
1286 var out = PolySpriteVarying();
1287 out.position = to_device_position(unit_vertex, sprite.bounds);
1288 out.tile_position = to_tile_position(unit_vertex, sprite.tile);
1289 out.sprite_id = instance_id;
1290 out.clip_distances = distance_from_clip_rect(unit_vertex, sprite.bounds, sprite.content_mask);
1291 return out;
1292 }
1293
1294 @fragment
1295 fn fs_poly_sprite(input: PolySpriteVarying) -> @location(0) vec4<f32> {
1296 let sample = textureSample(t_sprite, s_sprite, input.tile_position);
1297 // Alpha clip after using the derivatives.
1298 if (any(input.clip_distances < vec4<f32>(0.0))) {
1299 return vec4<f32>(0.0);
1300 }
1301
1302 let sprite = load_poly_sprite(input.sprite_id);
1303 let distance = quad_sdf(input.position.xy, sprite.bounds, sprite.corner_radii);
1304
1305 var color = sample;
1306 if (sprite.grayscale != 0u) {
1307 let grayscale = dot(color.rgb, GRAYSCALE_FACTORS);
1308 color = vec4<f32>(vec3<f32>(grayscale), sample.a);
1309 }
1310 return blend_color(color, sprite.opacity * saturate(0.5 - distance));
1311 }
1312
1313 // --- surfaces --- //
1314
1315 struct SurfaceParams {
1316 bounds: Bounds,
1317 content_mask: Bounds,
1318 }
1319
1320 @group(1) @binding(0) var<uniform> surface_locals: SurfaceParams;
1321 @group(1) @binding(1) var t_y: texture_2d<f32>;
1322 @group(1) @binding(2) var t_cb_cr: texture_2d<f32>;
1323 @group(1) @binding(3) var s_surface: sampler;
1324
1325 const ycbcr_to_RGB = mat4x4<f32>(
1326 vec4<f32>( 1.0000f, 1.0000f, 1.0000f, 0.0),
1327 vec4<f32>( 0.0000f, -0.3441f, 1.7720f, 0.0),
1328 vec4<f32>( 1.4020f, -0.7141f, 0.0000f, 0.0),
1329 vec4<f32>(-0.7010f, 0.5291f, -0.8860f, 1.0),
1330 );
1331
1332 struct SurfaceVarying {
1333 @builtin(position) position: vec4<f32>,
1334 @location(0) texture_position: vec2<f32>,
1335 @location(3) clip_distances: vec4<f32>,
1336 }
1337
1338 @vertex
1339 fn vs_surface(@builtin(vertex_index) vertex_id: u32) -> SurfaceVarying {
1340 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1341
1342 var out = SurfaceVarying();
1343 out.position = to_device_position(unit_vertex, surface_locals.bounds);
1344 out.texture_position = unit_vertex;
1345 out.clip_distances = distance_from_clip_rect(unit_vertex, surface_locals.bounds, surface_locals.content_mask);
1346 return out;
1347 }
1348
1349 @fragment
1350 fn fs_surface(input: SurfaceVarying) -> @location(0) vec4<f32> {
1351 // Alpha clip after using the derivatives.
1352 if (any(input.clip_distances < vec4<f32>(0.0))) {
1353 return vec4<f32>(0.0);
1354 }
1355
1356 let y_cb_cr = vec4<f32>(
1357 textureSampleLevel(t_y, s_surface, input.texture_position, 0.0).r,
1358 textureSampleLevel(t_cb_cr, s_surface, input.texture_position, 0.0).rg,
1359 1.0);
1360
1361 return ycbcr_to_RGB * y_cb_cr;
1362 }
@@ -0,0 +1,1362 @@
1/* Functions useful for debugging:
2
3// A heat map color for debugging (blue -> cyan -> green -> yellow -> red).
4fn heat_map_color(value: f32, minValue: f32, maxValue: f32, position: vec2<f32>) -> vec4<f32> {
5 // Normalize value to 0-1 range
6 let t = clamp((value - minValue) / (maxValue - minValue), 0.0, 1.0);
7
8 // Heat map color calculation
9 let r = t * t;
10 let g = 4.0 * t * (1.0 - t);
11 let b = (1.0 - t) * (1.0 - t);
12 let heat_color = vec3<f32>(r, g, b);
13
14 // Create a checkerboard pattern (black and white)
15 let sum = floor(position.x / 3) + floor(position.y / 3);
16 let is_odd = fract(sum * 0.5); // 0.0 for even, 0.5 for odd
17 let checker_value = is_odd * 2.0; // 0.0 for even, 1.0 for odd
18 let checker_color = vec3<f32>(checker_value);
19
20 // Determine if value is in range (1.0 if in range, 0.0 if out of range)
21 let in_range = step(minValue, value) * step(value, maxValue);
22
23 // Mix checkerboard and heat map based on whether value is in range
24 let final_color = mix(checker_color, heat_color, in_range);
25
26 return vec4<f32>(final_color, 1.0);
27}
28
29*/
30
31// Contrast and gamma correction adapted from https://github.com/microsoft/terminal/blob/1283c0f5b99a2961673249fa77c6b986efb5086c/src/renderer/atlas/dwrite.hlsl
32// Copyright (c) Microsoft Corporation.
33// Licensed under the MIT license.
34fn color_brightness(color: vec3<f32>) -> f32 {
35 // REC. 601 luminance coefficients for perceived brightness
36 return dot(color, vec3<f32>(0.30, 0.59, 0.11));
37}
38
39fn light_on_dark_contrast(enhancedContrast: f32, color: vec3<f32>) -> f32 {
40 let brightness = color_brightness(color);
41 let multiplier = saturate(4.0 * (0.75 - brightness));
42 return enhancedContrast * multiplier;
43}
44
45fn enhance_contrast(alpha: f32, k: f32) -> f32 {
46 return alpha * (k + 1.0) / (alpha * k + 1.0);
47}
48
49fn enhance_contrast3(alpha: vec3<f32>, k: f32) -> vec3<f32> {
50 return alpha * (k + 1.0) / (alpha * k + 1.0);
51}
52
53fn apply_alpha_correction(a: f32, b: f32, g: vec4<f32>) -> f32 {
54 let brightness_adjustment = g.x * b + g.y;
55 let correction = brightness_adjustment * a + (g.z * b + g.w);
56 return a + a * (1.0 - a) * correction;
57}
58
59fn apply_alpha_correction3(a: vec3<f32>, b: vec3<f32>, g: vec4<f32>) -> vec3<f32> {
60 let brightness_adjustment = g.x * b + g.y;
61 let correction = brightness_adjustment * a + (g.z * b + g.w);
62 return a + a * (1.0 - a) * correction;
63}
64
65fn apply_contrast_and_gamma_correction(sample: f32, color: vec3<f32>, enhanced_contrast_factor: f32, gamma_ratios: vec4<f32>) -> f32 {
66 let enhanced_contrast = light_on_dark_contrast(enhanced_contrast_factor, color);
67 let brightness = color_brightness(color);
68
69 let contrasted = enhance_contrast(sample, enhanced_contrast);
70 return apply_alpha_correction(contrasted, brightness, gamma_ratios);
71}
72
73fn apply_contrast_and_gamma_correction3(sample: vec3<f32>, color: vec3<f32>, enhanced_contrast_factor: f32, gamma_ratios: vec4<f32>) -> vec3<f32> {
74 let enhanced_contrast = light_on_dark_contrast(enhanced_contrast_factor, color);
75
76 let contrasted = enhance_contrast3(sample, enhanced_contrast);
77 return apply_alpha_correction3(contrasted, color, gamma_ratios);
78}
79
80struct GlobalParams {
81 viewport_size: vec2<f32>,
82 premultiplied_alpha: u32,
83 pad: u32,
84}
85
86struct GammaParams {
87 gamma_ratios: vec4<f32>,
88 grayscale_enhanced_contrast: f32,
89 subpixel_enhanced_contrast: f32,
90 is_bgr: u32,
91 pad: u32,
92}
93
94@group(0) @binding(0) var<uniform> globals: GlobalParams;
95@group(0) @binding(1) var<uniform> gamma_params: GammaParams;
96@group(2) @binding(0) var t_sprite: texture_2d<f32>;
97@group(2) @binding(1) var s_sprite: sampler;
98
99const M_PI_F: f32 = 3.1415926;
100const GRAYSCALE_FACTORS: vec3<f32> = vec3<f32>(0.2126, 0.7152, 0.0722);
101
102struct Bounds {
103 origin: vec2<f32>,
104 size: vec2<f32>,
105}
106
107struct Corners {
108 top_left: f32,
109 top_right: f32,
110 bottom_right: f32,
111 bottom_left: f32,
112}
113
114struct Edges {
115 top: f32,
116 right: f32,
117 bottom: f32,
118 left: f32,
119}
120
121struct Hsla {
122 h: f32,
123 s: f32,
124 l: f32,
125 a: f32,
126}
127
128struct LinearColorStop {
129 color: Hsla,
130 percentage: f32,
131}
132
133struct Background {
134 // 0u is Solid
135 // 1u is LinearGradient
136 // 2u is PatternSlash
137 // 3u is Checkerboard
138 tag: u32,
139 // 0u is sRGB linear color
140 // 1u is Oklab color
141 color_space: u32,
142 solid: Hsla,
143 gradient_angle_or_pattern_height: f32,
144 colors: array<LinearColorStop, 2>,
145 pad: u32,
146}
147
148struct AtlasTextureId {
149 index: u32,
150 kind: u32,
151}
152
153struct AtlasBounds {
154 origin: vec2<i32>,
155 size: vec2<i32>,
156}
157
158struct AtlasTile {
159 texture_id: AtlasTextureId,
160 tile_id: u32,
161 padding: u32,
162 bounds: AtlasBounds,
163}
164
165struct TransformationMatrix {
166 rotation_scale: mat2x2<f32>,
167 translation: vec2<f32>,
168}
169
170fn to_device_position_impl(position: vec2<f32>) -> vec4<f32> {
171 let device_position = position / globals.viewport_size * vec2<f32>(2.0, -2.0) + vec2<f32>(-1.0, 1.0);
172 return vec4<f32>(device_position, 0.0, 1.0);
173}
174
175fn to_device_position(unit_vertex: vec2<f32>, bounds: Bounds) -> vec4<f32> {
176 let position = unit_vertex * vec2<f32>(bounds.size) + bounds.origin;
177 return to_device_position_impl(position);
178}
179
180fn to_device_position_transformed(unit_vertex: vec2<f32>, bounds: Bounds, transform: TransformationMatrix) -> vec4<f32> {
181 let position = unit_vertex * vec2<f32>(bounds.size) + bounds.origin;
182 //Note: Rust side stores it as row-major, so transposing here
183 let transformed = transpose(transform.rotation_scale) * position + transform.translation;
184 return to_device_position_impl(transformed);
185}
186
187fn to_tile_position(unit_vertex: vec2<f32>, tile: AtlasTile) -> vec2<f32> {
188 let atlas_size = vec2<f32>(textureDimensions(t_sprite, 0));
189 return (vec2<f32>(tile.bounds.origin) + unit_vertex * vec2<f32>(tile.bounds.size)) / atlas_size;
190}
191
192fn distance_from_clip_rect_impl(position: vec2<f32>, clip_bounds: Bounds) -> vec4<f32> {
193 let tl = position - clip_bounds.origin;
194 let br = clip_bounds.origin + clip_bounds.size - position;
195 return vec4<f32>(tl.x, br.x, tl.y, br.y);
196}
197
198fn distance_from_clip_rect(unit_vertex: vec2<f32>, bounds: Bounds, clip_bounds: Bounds) -> vec4<f32> {
199 let position = unit_vertex * vec2<f32>(bounds.size) + bounds.origin;
200 return distance_from_clip_rect_impl(position, clip_bounds);
201}
202
203fn distance_from_clip_rect_transformed(unit_vertex: vec2<f32>, bounds: Bounds, clip_bounds: Bounds, transform: TransformationMatrix) -> vec4<f32> {
204 let position = unit_vertex * vec2<f32>(bounds.size) + bounds.origin;
205 let transformed = transpose(transform.rotation_scale) * position + transform.translation;
206 return distance_from_clip_rect_impl(transformed, clip_bounds);
207}
208
209// https://gamedev.stackexchange.com/questions/92015/optimized-linear-to-srgb-glsl
210fn srgb_to_linear(srgb: vec3<f32>) -> vec3<f32> {
211 let cutoff = srgb < vec3<f32>(0.04045);
212 let higher = pow((srgb + vec3<f32>(0.055)) / vec3<f32>(1.055), vec3<f32>(2.4));
213 let lower = srgb / vec3<f32>(12.92);
214 return select(higher, lower, cutoff);
215}
216
217fn srgb_to_linear_component(a: f32) -> f32 {
218 let cutoff = a < 0.04045;
219 let higher = pow((a + 0.055) / 1.055, 2.4);
220 let lower = a / 12.92;
221 return select(higher, lower, cutoff);
222}
223
224fn linear_to_srgb(linear: vec3<f32>) -> vec3<f32> {
225 let cutoff = linear < vec3<f32>(0.0031308);
226 let higher = vec3<f32>(1.055) * pow(linear, vec3<f32>(1.0 / 2.4)) - vec3<f32>(0.055);
227 let lower = linear * vec3<f32>(12.92);
228 return select(higher, lower, cutoff);
229}
230
231/// Convert a linear color to sRGBA space.
232fn linear_to_srgba(color: vec4<f32>) -> vec4<f32> {
233 return vec4<f32>(linear_to_srgb(color.rgb), color.a);
234}
235
236/// Convert a sRGBA color to linear space.
237fn srgba_to_linear(color: vec4<f32>) -> vec4<f32> {
238 return vec4<f32>(srgb_to_linear(color.rgb), color.a);
239}
240
241/// Hsla to linear RGBA conversion.
242fn hsla_to_rgba(hsla: Hsla) -> vec4<f32> {
243 let h = hsla.h * 6.0; // Now, it's an angle but scaled in [0, 6) range
244 let s = hsla.s;
245 let l = hsla.l;
246 let a = hsla.a;
247
248 let c = (1.0 - abs(2.0 * l - 1.0)) * s;
249 let x = c * (1.0 - abs(h % 2.0 - 1.0));
250 let m = l - c / 2.0;
251 var color = vec3<f32>(m);
252
253 if (h >= 0.0 && h < 1.0) {
254 color.r += c;
255 color.g += x;
256 } else if (h >= 1.0 && h < 2.0) {
257 color.r += x;
258 color.g += c;
259 } else if (h >= 2.0 && h < 3.0) {
260 color.g += c;
261 color.b += x;
262 } else if (h >= 3.0 && h < 4.0) {
263 color.g += x;
264 color.b += c;
265 } else if (h >= 4.0 && h < 5.0) {
266 color.r += x;
267 color.b += c;
268 } else {
269 color.r += c;
270 color.b += x;
271 }
272
273 return vec4<f32>(color, a);
274}
275
276/// Convert a linear sRGB to Oklab space.
277/// Reference: https://bottosson.github.io/posts/oklab/#converting-from-linear-srgb-to-oklab
278fn linear_srgb_to_oklab(color: vec4<f32>) -> vec4<f32> {
279 let l = 0.4122214708 * color.r + 0.5363325363 * color.g + 0.0514459929 * color.b;
280 let m = 0.2119034982 * color.r + 0.6806995451 * color.g + 0.1073969566 * color.b;
281 let s = 0.0883024619 * color.r + 0.2817188376 * color.g + 0.6299787005 * color.b;
282
283 let l_ = pow(l, 1.0 / 3.0);
284 let m_ = pow(m, 1.0 / 3.0);
285 let s_ = pow(s, 1.0 / 3.0);
286
287 return vec4<f32>(
288 0.2104542553 * l_ + 0.7936177850 * m_ - 0.0040720468 * s_,
289 1.9779984951 * l_ - 2.4285922050 * m_ + 0.4505937099 * s_,
290 0.0259040371 * l_ + 0.7827717662 * m_ - 0.8086757660 * s_,
291 color.a
292 );
293}
294
295/// Convert an Oklab color to linear sRGB space.
296fn oklab_to_linear_srgb(color: vec4<f32>) -> vec4<f32> {
297 let l_ = color.r + 0.3963377774 * color.g + 0.2158037573 * color.b;
298 let m_ = color.r - 0.1055613458 * color.g - 0.0638541728 * color.b;
299 let s_ = color.r - 0.0894841775 * color.g - 1.2914855480 * color.b;
300
301 let l = l_ * l_ * l_;
302 let m = m_ * m_ * m_;
303 let s = s_ * s_ * s_;
304
305 return vec4<f32>(
306 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
307 -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
308 -0.0041960863 * l - 0.7034186147 * m + 1.7076147010 * s,
309 color.a
310 );
311}
312
313fn over(below: vec4<f32>, above: vec4<f32>) -> vec4<f32> {
314 let alpha = above.a + below.a * (1.0 - above.a);
315 let color = (above.rgb * above.a + below.rgb * below.a * (1.0 - above.a)) / alpha;
316 return vec4<f32>(color, alpha);
317}
318
319// A standard gaussian function, used for weighting samples
320fn gaussian(x: f32, sigma: f32) -> f32{
321 return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * M_PI_F) * sigma);
322}
323
324// This approximates the error function, needed for the gaussian integral
325fn erf(v: vec2<f32>) -> vec2<f32> {
326 let s = sign(v);
327 let a = abs(v);
328 let r1 = 1.0 + (0.278393 + (0.230389 + (0.000972 + 0.078108 * a) * a) * a) * a;
329 let r2 = r1 * r1;
330 return s - s / (r2 * r2);
331}
332
333fn blur_along_x(x: f32, y: f32, sigma: f32, corner: f32, half_size: vec2<f32>) -> f32 {
334 let delta = min(half_size.y - corner - abs(y), 0.0);
335 let curved = half_size.x - corner + sqrt(max(0.0, corner * corner - delta * delta));
336 let integral = 0.5 + 0.5 * erf((x + vec2<f32>(-curved, curved)) * (sqrt(0.5) / sigma));
337 return integral.y - integral.x;
338}
339
340// Selects corner radius based on quadrant.
341fn pick_corner_radius(center_to_point: vec2<f32>, radii: Corners) -> f32 {
342 if (center_to_point.x < 0.0) {
343 if (center_to_point.y < 0.0) {
344 return radii.top_left;
345 } else {
346 return radii.bottom_left;
347 }
348 } else {
349 if (center_to_point.y < 0.0) {
350 return radii.top_right;
351 } else {
352 return radii.bottom_right;
353 }
354 }
355}
356
357// Signed distance of the point to the quad's border - positive outside the
358// border, and negative inside.
359//
360// See comments on similar code using `quad_sdf_impl` in `fs_quad` for
361// explanation.
362fn quad_sdf(point: vec2<f32>, bounds: Bounds, corner_radii: Corners) -> f32 {
363 let half_size = bounds.size / 2.0;
364 let center = bounds.origin + half_size;
365 let center_to_point = point - center;
366 let corner_radius = pick_corner_radius(center_to_point, corner_radii);
367 let corner_to_point = abs(center_to_point) - half_size;
368 let corner_center_to_point = corner_to_point + corner_radius;
369 return quad_sdf_impl(corner_center_to_point, corner_radius);
370}
371
372fn quad_sdf_impl(corner_center_to_point: vec2<f32>, corner_radius: f32) -> f32 {
373 if (corner_radius == 0.0) {
374 // Fast path for unrounded corners.
375 return max(corner_center_to_point.x, corner_center_to_point.y);
376 } else {
377 // Signed distance of the point from a quad that is inset by corner_radius.
378 // It is negative inside this quad, and positive outside.
379 let signed_distance_to_inset_quad =
380 // 0 inside the inset quad, and positive outside.
381 length(max(vec2<f32>(0.0), corner_center_to_point)) +
382 // 0 outside the inset quad, and negative inside.
383 min(0.0, max(corner_center_to_point.x, corner_center_to_point.y));
384
385 return signed_distance_to_inset_quad - corner_radius;
386 }
387}
388
389// Abstract away the final color transformation based on the
390// target alpha compositing mode.
391fn blend_color(color: vec4<f32>, alpha_factor: f32) -> vec4<f32> {
392 let alpha = color.a * alpha_factor;
393 let multiplier = select(1.0, alpha, globals.premultiplied_alpha != 0u);
394 return vec4<f32>(color.rgb * multiplier, alpha);
395}
396
397
398struct GradientColor {
399 solid: vec4<f32>,
400 color0: vec4<f32>,
401 color1: vec4<f32>,
402}
403
404fn prepare_gradient_color(tag: u32, color_space: u32,
405 solid: Hsla, colors: array<LinearColorStop, 2>) -> GradientColor {
406 var result = GradientColor();
407
408 if (tag == 0u || tag == 2u || tag == 3u) {
409 result.solid = hsla_to_rgba(solid);
410 } else if (tag == 1u) {
411 // The hsla_to_rgba is returns a linear sRGB color
412 result.color0 = hsla_to_rgba(colors[0].color);
413 result.color1 = hsla_to_rgba(colors[1].color);
414
415 // Prepare color space in vertex for avoid conversion
416 // in fragment shader for performance reasons
417 if (color_space == 0u) {
418 // sRGB
419 result.color0 = linear_to_srgba(result.color0);
420 result.color1 = linear_to_srgba(result.color1);
421 } else if (color_space == 1u) {
422 // Oklab
423 result.color0 = linear_srgb_to_oklab(result.color0);
424 result.color1 = linear_srgb_to_oklab(result.color1);
425 }
426 }
427
428 return result;
429}
430
431fn gradient_color(background: Background, position: vec2<f32>, bounds: Bounds,
432 solid_color: vec4<f32>, color0: vec4<f32>, color1: vec4<f32>) -> vec4<f32> {
433 var background_color = vec4<f32>(0.0);
434
435 switch (background.tag) {
436 default: {
437 return solid_color;
438 }
439 case 1u: {
440 // Linear gradient background.
441 // -90 degrees to match the CSS gradient angle.
442 let angle = background.gradient_angle_or_pattern_height;
443 let radians = (angle % 360.0 - 90.0) * M_PI_F / 180.0;
444 var direction = vec2<f32>(cos(radians), sin(radians));
445 let stop0_percentage = background.colors[0].percentage;
446 let stop1_percentage = background.colors[1].percentage;
447
448 // Expand the short side to be the same as the long side
449 if (bounds.size.x > bounds.size.y) {
450 direction.y *= bounds.size.y / bounds.size.x;
451 } else {
452 direction.x *= bounds.size.x / bounds.size.y;
453 }
454
455 // Get the t value for the linear gradient with the color stop percentages.
456 let half_size = bounds.size / 2.0;
457 let center = bounds.origin + half_size;
458 let center_to_point = position - center;
459 var t = dot(center_to_point, direction) / length(direction);
460 // Check the direct to determine the use x or y
461 if (abs(direction.x) > abs(direction.y)) {
462 t = (t + half_size.x) / bounds.size.x;
463 } else {
464 t = (t + half_size.y) / bounds.size.y;
465 }
466
467 // Adjust t based on the stop percentages
468 t = (t - stop0_percentage) / (stop1_percentage - stop0_percentage);
469 t = clamp(t, 0.0, 1.0);
470
471 switch (background.color_space) {
472 default: {
473 background_color = srgba_to_linear(mix(color0, color1, t));
474 }
475 case 1u: {
476 let oklab_color = mix(color0, color1, t);
477 background_color = oklab_to_linear_srgb(oklab_color);
478 }
479 }
480 }
481 case 2u: {
482 // pattern slash
483 let gradient_angle_or_pattern_height = background.gradient_angle_or_pattern_height;
484 let pattern_width = (gradient_angle_or_pattern_height / 65535.0f) / 255.0f;
485 let pattern_interval = (gradient_angle_or_pattern_height % 65535.0f) / 255.0f;
486 let pattern_height = pattern_width + pattern_interval;
487 let stripe_angle = M_PI_F / 4.0;
488 let pattern_period = pattern_height * sin(stripe_angle);
489 let rotation = mat2x2<f32>(
490 cos(stripe_angle), -sin(stripe_angle),
491 sin(stripe_angle), cos(stripe_angle)
492 );
493 let relative_position = position - bounds.origin;
494 let rotated_point = rotation * relative_position;
495 let pattern = rotated_point.x % pattern_period;
496 let distance = min(pattern, pattern_period - pattern) - pattern_period * (pattern_width / pattern_height) / 2.0f;
497 background_color = solid_color;
498 background_color.a *= saturate(0.5 - distance);
499 }
500 case 3u: {
501 // checkerboard
502 let size = background.gradient_angle_or_pattern_height;
503 let relative_position = position - bounds.origin;
504
505 let x_index = floor(relative_position.x / size);
506 let y_index = floor(relative_position.y / size);
507 let should_be_colored = (x_index + y_index) % 2.0;
508
509 background_color = solid_color;
510 background_color.a *= saturate(should_be_colored);
511 }
512 }
513
514 return background_color;
515}
516
517// --- quads --- //
518
519struct Quad {
520 order: u32,
521 border_style: u32,
522 bounds: Bounds,
523 content_mask: Bounds,
524 background: Background,
525 border_color: Hsla,
526 corner_radii: Corners,
527 border_widths: Edges,
528}
529
530struct QuadVarying {
531 @builtin(position) position: vec4<f32>,
532 @location(0) @interpolate(flat) border_color: vec4<f32>,
533 @location(1) @interpolate(flat) quad_id: u32,
534 // TODO: use `clip_distance` once Naga supports it
535 @location(2) clip_distances: vec4<f32>,
536 @location(3) @interpolate(flat) background_solid: vec4<f32>,
537 @location(4) @interpolate(flat) background_color0: vec4<f32>,
538 @location(5) @interpolate(flat) background_color1: vec4<f32>,
539}
540
541@vertex
542fn vs_quad(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> QuadVarying {
543 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
544 let quad = load_quad(instance_id);
545
546 var out = QuadVarying();
547 out.position = to_device_position(unit_vertex, quad.bounds);
548
549 let gradient = prepare_gradient_color(
550 quad.background.tag,
551 quad.background.color_space,
552 quad.background.solid,
553 quad.background.colors
554 );
555 out.background_solid = gradient.solid;
556 out.background_color0 = gradient.color0;
557 out.background_color1 = gradient.color1;
558 out.border_color = hsla_to_rgba(quad.border_color);
559 out.quad_id = instance_id;
560 out.clip_distances = distance_from_clip_rect(unit_vertex, quad.bounds, quad.content_mask);
561 return out;
562}
563
564@fragment
565fn fs_quad(input: QuadVarying) -> @location(0) vec4<f32> {
566 // Alpha clip first, since we don't have `clip_distance`.
567 if (any(input.clip_distances < vec4<f32>(0.0))) {
568 return vec4<f32>(0.0);
569 }
570
571 let quad = load_quad(input.quad_id);
572
573 let background_color = gradient_color(quad.background, input.position.xy, quad.bounds,
574 input.background_solid, input.background_color0, input.background_color1);
575
576 let unrounded = quad.corner_radii.top_left == 0.0 &&
577 quad.corner_radii.bottom_left == 0.0 &&
578 quad.corner_radii.top_right == 0.0 &&
579 quad.corner_radii.bottom_right == 0.0;
580
581 // Fast path when the quad is not rounded and doesn't have any border
582 if (quad.border_widths.top == 0.0 &&
583 quad.border_widths.left == 0.0 &&
584 quad.border_widths.right == 0.0 &&
585 quad.border_widths.bottom == 0.0 &&
586 unrounded) {
587 return blend_color(background_color, 1.0);
588 }
589
590 let size = quad.bounds.size;
591 let half_size = size / 2.0;
592 let point = input.position.xy - quad.bounds.origin;
593 let center_to_point = point - half_size;
594
595 // Signed distance field threshold for inclusion of pixels. 0.5 is the
596 // minimum distance between the center of the pixel and the edge.
597 let antialias_threshold = 0.5;
598
599 // Radius of the nearest corner
600 let corner_radius = pick_corner_radius(center_to_point, quad.corner_radii);
601
602 // Width of the nearest borders
603 let border = vec2<f32>(
604 select(
605 quad.border_widths.right,
606 quad.border_widths.left,
607 center_to_point.x < 0.0),
608 select(
609 quad.border_widths.bottom,
610 quad.border_widths.top,
611 center_to_point.y < 0.0));
612
613 // 0-width borders are reduced so that `inner_sdf >= antialias_threshold`.
614 // The purpose of this is to not draw antialiasing pixels in this case.
615 let reduced_border =
616 vec2<f32>(select(border.x, -antialias_threshold, border.x == 0.0),
617 select(border.y, -antialias_threshold, border.y == 0.0));
618
619 // Vector from the corner of the quad bounds to the point, after mirroring
620 // the point into the bottom right quadrant. Both components are <= 0.
621 let corner_to_point = abs(center_to_point) - half_size;
622
623 // Vector from the point to the center of the rounded corner's circle, also
624 // mirrored into bottom right quadrant.
625 let corner_center_to_point = corner_to_point + corner_radius;
626
627 // Whether the nearest point on the border is rounded
628 let is_near_rounded_corner =
629 corner_center_to_point.x >= 0 &&
630 corner_center_to_point.y >= 0;
631
632 // Vector from straight border inner corner to point.
633 let straight_border_inner_corner_to_point = corner_to_point + reduced_border;
634
635 // Whether the point is beyond the inner edge of the straight border.
636 let is_beyond_inner_straight_border =
637 straight_border_inner_corner_to_point.x > 0 ||
638 straight_border_inner_corner_to_point.y > 0;
639
640 // Whether the point is far enough inside the quad, such that the pixels are
641 // not affected by the straight border.
642 let is_within_inner_straight_border =
643 straight_border_inner_corner_to_point.x < -antialias_threshold &&
644 straight_border_inner_corner_to_point.y < -antialias_threshold;
645
646 // Fast path for points that must be part of the background.
647 //
648 // This could be optimized further for large rounded corners by including
649 // points in an inscribed rectangle, or some other quick linear check.
650 // However, that might negatively impact performance in the case of
651 // reasonable sizes for rounded corners.
652 if (is_within_inner_straight_border && !is_near_rounded_corner) {
653 return blend_color(background_color, 1.0);
654 }
655
656 // Signed distance of the point to the outside edge of the quad's border. It
657 // is positive outside this edge, and negative inside.
658 let outer_sdf = quad_sdf_impl(corner_center_to_point, corner_radius);
659
660 // Approximate signed distance of the point to the inside edge of the quad's
661 // border. It is negative outside this edge (within the border), and
662 // positive inside.
663 //
664 // This is not always an accurate signed distance:
665 // * The rounded portions with varying border width use an approximation of
666 // nearest-point-on-ellipse.
667 // * When it is quickly known to be outside the edge, -1.0 is used.
668 var inner_sdf = 0.0;
669 if (corner_center_to_point.x <= 0 || corner_center_to_point.y <= 0) {
670 // Fast paths for straight borders.
671 inner_sdf = -max(straight_border_inner_corner_to_point.x,
672 straight_border_inner_corner_to_point.y);
673 } else if (is_beyond_inner_straight_border) {
674 // Fast path for points that must be outside the inner edge.
675 inner_sdf = -1.0;
676 } else if (reduced_border.x == reduced_border.y) {
677 // Fast path for circular inner edge.
678 inner_sdf = -(outer_sdf + reduced_border.x);
679 } else {
680 let ellipse_radii = max(vec2<f32>(0.0), corner_radius - reduced_border);
681 inner_sdf = quarter_ellipse_sdf(corner_center_to_point, ellipse_radii);
682 }
683
684 // Negative when inside the border
685 let border_sdf = max(inner_sdf, outer_sdf);
686
687 var color = background_color;
688 if (border_sdf < antialias_threshold) {
689 var border_color = input.border_color;
690
691 // Dashed border logic when border_style == 1
692 if (quad.border_style == 1) {
693 // Position along the perimeter in "dash space", where each dash
694 // period has length 1
695 var t = 0.0;
696
697 // Total number of dash periods, so that the dash spacing can be
698 // adjusted to evenly divide it
699 var max_t = 0.0;
700
701 // Border width is proportional to dash size. This is the behavior
702 // used by browsers, but also avoids dashes from different segments
703 // overlapping when dash size is smaller than the border width.
704 //
705 // Dash pattern: (2 * border width) dash, (1 * border width) gap
706 let dash_length_per_width = 2.0;
707 let dash_gap_per_width = 1.0;
708 let dash_period_per_width = dash_length_per_width + dash_gap_per_width;
709
710 // Since the dash size is determined by border width, the density of
711 // dashes varies. Multiplying a pixel distance by this returns a
712 // position in dash space - it has units (dash period / pixels). So
713 // a dash velocity of (1 / 10) is 1 dash every 10 pixels.
714 var dash_velocity = 0.0;
715
716 // Dividing this by the border width gives the dash velocity
717 let dv_numerator = 1.0 / dash_period_per_width;
718
719 if (unrounded) {
720 // When corners aren't rounded, the dashes are separately laid
721 // out on each straight line, rather than around the whole
722 // perimeter. This way each line starts and ends with a dash.
723 let is_horizontal =
724 corner_center_to_point.x <
725 corner_center_to_point.y;
726
727 // When applying dashed borders to just some, not all, the sides.
728 // The way we chose border widths above sometimes comes with a 0 width value.
729 // So we choose again to avoid division by zero.
730 // TODO: A better solution exists taking a look at the whole file.
731 // this does not fix single dashed borders at the corners
732 let dashed_border = vec2<f32>(
733 max(
734 quad.border_widths.bottom,
735 quad.border_widths.top,
736 ),
737 max(
738 quad.border_widths.right,
739 quad.border_widths.left,
740 )
741 );
742
743 let border_width = select(dashed_border.y, dashed_border.x, is_horizontal);
744 dash_velocity = dv_numerator / border_width;
745 t = select(point.y, point.x, is_horizontal) * dash_velocity;
746 max_t = select(size.y, size.x, is_horizontal) * dash_velocity;
747 } else {
748 // When corners are rounded, the dashes are laid out clockwise
749 // around the whole perimeter.
750
751 let r_tr = quad.corner_radii.top_right;
752 let r_br = quad.corner_radii.bottom_right;
753 let r_bl = quad.corner_radii.bottom_left;
754 let r_tl = quad.corner_radii.top_left;
755
756 let w_t = quad.border_widths.top;
757 let w_r = quad.border_widths.right;
758 let w_b = quad.border_widths.bottom;
759 let w_l = quad.border_widths.left;
760
761 // Straight side dash velocities
762 let dv_t = select(dv_numerator / w_t, 0.0, w_t <= 0.0);
763 let dv_r = select(dv_numerator / w_r, 0.0, w_r <= 0.0);
764 let dv_b = select(dv_numerator / w_b, 0.0, w_b <= 0.0);
765 let dv_l = select(dv_numerator / w_l, 0.0, w_l <= 0.0);
766
767 // Straight side lengths in dash space
768 let s_t = (size.x - r_tl - r_tr) * dv_t;
769 let s_r = (size.y - r_tr - r_br) * dv_r;
770 let s_b = (size.x - r_br - r_bl) * dv_b;
771 let s_l = (size.y - r_bl - r_tl) * dv_l;
772
773 let corner_dash_velocity_tr = corner_dash_velocity(dv_t, dv_r);
774 let corner_dash_velocity_br = corner_dash_velocity(dv_b, dv_r);
775 let corner_dash_velocity_bl = corner_dash_velocity(dv_b, dv_l);
776 let corner_dash_velocity_tl = corner_dash_velocity(dv_t, dv_l);
777
778 // Corner lengths in dash space
779 let c_tr = r_tr * (M_PI_F / 2.0) * corner_dash_velocity_tr;
780 let c_br = r_br * (M_PI_F / 2.0) * corner_dash_velocity_br;
781 let c_bl = r_bl * (M_PI_F / 2.0) * corner_dash_velocity_bl;
782 let c_tl = r_tl * (M_PI_F / 2.0) * corner_dash_velocity_tl;
783
784 // Cumulative dash space upto each segment
785 let upto_tr = s_t;
786 let upto_r = upto_tr + c_tr;
787 let upto_br = upto_r + s_r;
788 let upto_b = upto_br + c_br;
789 let upto_bl = upto_b + s_b;
790 let upto_l = upto_bl + c_bl;
791 let upto_tl = upto_l + s_l;
792 max_t = upto_tl + c_tl;
793
794 if (is_near_rounded_corner) {
795 let radians = atan2(corner_center_to_point.y,
796 corner_center_to_point.x);
797 let corner_t = radians * corner_radius;
798
799 if (center_to_point.x >= 0.0) {
800 if (center_to_point.y < 0.0) {
801 dash_velocity = corner_dash_velocity_tr;
802 // Subtracted because radians is pi/2 to 0 when
803 // going clockwise around the top right corner,
804 // since the y axis has been flipped
805 t = upto_r - corner_t * dash_velocity;
806 } else {
807 dash_velocity = corner_dash_velocity_br;
808 // Added because radians is 0 to pi/2 when going
809 // clockwise around the bottom-right corner
810 t = upto_br + corner_t * dash_velocity;
811 }
812 } else {
813 if (center_to_point.y >= 0.0) {
814 dash_velocity = corner_dash_velocity_bl;
815 // Subtracted because radians is pi/2 to 0 when
816 // going clockwise around the bottom-left corner,
817 // since the x axis has been flipped
818 t = upto_l - corner_t * dash_velocity;
819 } else {
820 dash_velocity = corner_dash_velocity_tl;
821 // Added because radians is 0 to pi/2 when going
822 // clockwise around the top-left corner, since both
823 // axis were flipped
824 t = upto_tl + corner_t * dash_velocity;
825 }
826 }
827 } else {
828 // Straight borders
829 let is_horizontal =
830 corner_center_to_point.x <
831 corner_center_to_point.y;
832 if (is_horizontal) {
833 if (center_to_point.y < 0.0) {
834 dash_velocity = dv_t;
835 t = (point.x - r_tl) * dash_velocity;
836 } else {
837 dash_velocity = dv_b;
838 t = upto_bl - (point.x - r_bl) * dash_velocity;
839 }
840 } else {
841 if (center_to_point.x < 0.0) {
842 dash_velocity = dv_l;
843 t = upto_tl - (point.y - r_tl) * dash_velocity;
844 } else {
845 dash_velocity = dv_r;
846 t = upto_r + (point.y - r_tr) * dash_velocity;
847 }
848 }
849 }
850 }
851
852 let dash_length = dash_length_per_width / dash_period_per_width;
853 let desired_dash_gap = dash_gap_per_width / dash_period_per_width;
854
855 // Straight borders should start and end with a dash, so max_t is
856 // reduced to cause this.
857 max_t -= select(0.0, dash_length, unrounded);
858 if (max_t >= 1.0) {
859 // Adjust dash gap to evenly divide max_t.
860 let dash_count = floor(max_t);
861 let dash_period = max_t / dash_count;
862 border_color.a *= dash_alpha(
863 t,
864 dash_period,
865 dash_length,
866 dash_velocity,
867 antialias_threshold);
868 } else if (unrounded) {
869 // When there isn't enough space for the full gap between the
870 // two start / end dashes of a straight border, reduce gap to
871 // make them fit.
872 let dash_gap = max_t - dash_length;
873 if (dash_gap > 0.0) {
874 let dash_period = dash_length + dash_gap;
875 border_color.a *= dash_alpha(
876 t,
877 dash_period,
878 dash_length,
879 dash_velocity,
880 antialias_threshold);
881 }
882 }
883 }
884
885 // Blend the border on top of the background and then linearly interpolate
886 // between the two as we slide inside the background.
887 let blended_border = over(background_color, border_color);
888 color = mix(background_color, blended_border,
889 saturate(antialias_threshold - inner_sdf));
890 }
891
892 return blend_color(color, saturate(antialias_threshold - outer_sdf));
893}
894
895// Returns the dash velocity of a corner given the dash velocity of the two
896// sides, by returning the slower velocity (larger dashes).
897//
898// Since 0 is used for dash velocity when the border width is 0 (instead of
899// +inf), this returns the other dash velocity in that case.
900//
901// An alternative to this might be to appropriately interpolate the dash
902// velocity around the corner, but that seems overcomplicated.
903fn corner_dash_velocity(dv1: f32, dv2: f32) -> f32 {
904 if (dv1 == 0.0) {
905 return dv2;
906 } else if (dv2 == 0.0) {
907 return dv1;
908 } else {
909 return min(dv1, dv2);
910 }
911}
912
913// Returns alpha used to render antialiased dashes.
914// `t` is within the dash when `fmod(t, period) < length`.
915fn dash_alpha(t: f32, period: f32, length: f32, dash_velocity: f32, antialias_threshold: f32) -> f32 {
916 let half_period = period / 2;
917 let half_length = length / 2;
918 // Value in [-half_period, half_period].
919 // The dash is in [-half_length, half_length].
920 let centered = fmod(t + half_period - half_length, period) - half_period;
921 // Signed distance for the dash, negative values are inside the dash.
922 let signed_distance = abs(centered) - half_length;
923 // Antialiased alpha based on the signed distance.
924 return saturate(antialias_threshold - signed_distance / dash_velocity);
925}
926
927// This approximates distance to the nearest point to a quarter ellipse in a way
928// that is sufficient for anti-aliasing when the ellipse is not very eccentric.
929// The components of `point` are expected to be positive.
930//
931// Negative on the outside and positive on the inside.
932fn quarter_ellipse_sdf(point: vec2<f32>, radii: vec2<f32>) -> f32 {
933 // Scale the space to treat the ellipse like a unit circle.
934 let circle_vec = point / radii;
935 let unit_circle_sdf = length(circle_vec) - 1.0;
936 // Approximate up-scaling of the length by using the average of the radii.
937 //
938 // TODO: A better solution would be to use the gradient of the implicit
939 // function for an ellipse to approximate a scaling factor.
940 return unit_circle_sdf * (radii.x + radii.y) * -0.5;
941}
942
943// Modulus that has the same sign as `a`.
944fn fmod(a: f32, b: f32) -> f32 {
945 return a - b * trunc(a / b);
946}
947
948// --- shadows --- //
949
950struct Shadow {
951 order: u32,
952 blur_radius: f32,
953 // The shadow rect for drop shadows; the "hole" rect for inset shadows.
954 bounds: Bounds,
955 corner_radii: Corners,
956 content_mask: Bounds,
957 color: Hsla,
958 // Only consulted when `inset == 1u`: the element's own bounds, used as a rounded-rect
959 // clip so the shadow never escapes the element.
960 element_bounds: Bounds,
961 element_corner_radii: Corners,
962 // 0 = drop shadow, 1 = inset shadow.
963 inset: u32,
964 pad: u32, // align to 8 bytes
965}
966
967struct ShadowVarying {
968 @builtin(position) position: vec4<f32>,
969 @location(0) @interpolate(flat) color: vec4<f32>,
970 @location(1) @interpolate(flat) shadow_id: u32,
971 //TODO: use `clip_distance` once Naga supports it
972 @location(3) clip_distances: vec4<f32>,
973}
974
975@vertex
976fn vs_shadow(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> ShadowVarying {
977 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
978 var shadow = load_shadow(instance_id);
979
980 var geometry: Bounds;
981 if (shadow.inset != 0u) {
982 geometry = shadow.element_bounds;
983 } else {
984 // Leave room for the gaussian tail outside the shadow rect.
985 let margin = 3.0 * shadow.blur_radius;
986 geometry = shadow.bounds;
987 geometry.origin -= vec2<f32>(margin);
988 geometry.size += 2.0 * vec2<f32>(margin);
989 }
990
991 var out = ShadowVarying();
992 out.position = to_device_position(unit_vertex, geometry);
993 out.color = hsla_to_rgba(shadow.color);
994 out.shadow_id = instance_id;
995 out.clip_distances = distance_from_clip_rect(unit_vertex, geometry, shadow.content_mask);
996 return out;
997}
998
999@fragment
1000fn fs_shadow(input: ShadowVarying) -> @location(0) vec4<f32> {
1001 // Alpha clip first, since we don't have `clip_distance`.
1002 if (any(input.clip_distances < vec4<f32>(0.0))) {
1003 return vec4<f32>(0.0);
1004 }
1005
1006 let shadow = load_shadow(input.shadow_id);
1007 let half_size = shadow.bounds.size / 2.0;
1008 let center = shadow.bounds.origin + half_size;
1009 let center_to_point = input.position.xy - center;
1010
1011 let corner_radius = pick_corner_radius(center_to_point, shadow.corner_radii);
1012
1013 var alpha: f32;
1014 if (shadow.blur_radius == 0.0) {
1015 let distance = quad_sdf(input.position.xy, shadow.bounds, shadow.corner_radii);
1016 alpha = saturate(0.5 - distance);
1017 } else {
1018 // The signal is only non-zero in a limited range, so don't waste samples
1019 let low = center_to_point.y - half_size.y;
1020 let high = center_to_point.y + half_size.y;
1021 let start = clamp(-3.0 * shadow.blur_radius, low, high);
1022 let end = clamp(3.0 * shadow.blur_radius, low, high);
1023
1024 // Accumulate samples (we can get away with surprisingly few samples)
1025 let step = (end - start) / 4.0;
1026 var y = start + step * 0.5;
1027 alpha = 0.0;
1028 for (var i = 0; i < 4; i += 1) {
1029 let blur = blur_along_x(center_to_point.x, center_to_point.y - y,
1030 shadow.blur_radius, corner_radius, half_size);
1031 alpha += blur * gaussian(y, shadow.blur_radius) * step;
1032 y += step;
1033 }
1034 }
1035
1036 if (shadow.inset != 0u) {
1037 // The inset shadow is the complement of the (blurred) hole rect, clipped to the element.
1038 // `saturate(0.5 - d)` gives a 1-pixel antialiased edge: d <= -0.5 -> 1, d >= 0.5 -> 0.
1039 alpha = 1.0 - alpha;
1040 let element_distance = quad_sdf(input.position.xy, shadow.element_bounds,
1041 shadow.element_corner_radii);
1042 alpha *= saturate(0.5 - element_distance);
1043 }
1044
1045 return blend_color(input.color, alpha);
1046}
1047
1048// --- path rasterization --- //
1049
1050struct PathRasterizationVertex {
1051 xy_position: vec2<f32>,
1052 st_position: vec2<f32>,
1053 color: Background,
1054 bounds: Bounds,
1055}
1056
1057
1058
1059struct PathRasterizationVarying {
1060 @builtin(position) position: vec4<f32>,
1061 @location(0) st_position: vec2<f32>,
1062 @location(1) @interpolate(flat) vertex_id: u32,
1063 //TODO: use `clip_distance` once Naga supports it
1064 @location(3) clip_distances: vec4<f32>,
1065}
1066
1067@vertex
1068fn vs_path_rasterization(@builtin(vertex_index) vertex_id: u32) -> PathRasterizationVarying {
1069 let v = load_path_vertex(vertex_id);
1070
1071 var out = PathRasterizationVarying();
1072 out.position = to_device_position_impl(v.xy_position);
1073 out.st_position = v.st_position;
1074 out.vertex_id = vertex_id;
1075 out.clip_distances = distance_from_clip_rect_impl(v.xy_position, v.bounds);
1076 return out;
1077}
1078
1079@fragment
1080fn fs_path_rasterization(input: PathRasterizationVarying) -> @location(0) vec4<f32> {
1081 let dx = dpdx(input.st_position);
1082 let dy = dpdy(input.st_position);
1083 if (any(input.clip_distances < vec4<f32>(0.0))) {
1084 return vec4<f32>(0.0);
1085 }
1086
1087 let v = load_path_vertex(input.vertex_id);
1088 let background = v.color;
1089 let bounds = v.bounds;
1090
1091 var alpha: f32;
1092 if (length(vec2<f32>(dx.x, dy.x)) < 0.001) {
1093 // If the gradient is too small, return a solid color.
1094 alpha = 1.0;
1095 } else {
1096 let gradient = 2.0 * input.st_position.xx * vec2<f32>(dx.x, dy.x) - vec2<f32>(dx.y, dy.y);
1097 let f = input.st_position.x * input.st_position.x - input.st_position.y;
1098 let distance = f / length(gradient);
1099 alpha = saturate(0.5 - distance);
1100 }
1101 let prepared_gradient = prepare_gradient_color(
1102 background.tag,
1103 background.color_space,
1104 background.solid,
1105 background.colors,
1106 );
1107 let color = gradient_color(background, input.position.xy, bounds,
1108 prepared_gradient.solid, prepared_gradient.color0, prepared_gradient.color1);
1109 return vec4<f32>(color.rgb * color.a * alpha, color.a * alpha);
1110}
1111
1112// --- paths --- //
1113
1114struct PathSprite {
1115 bounds: Bounds,
1116}
1117
1118
1119struct PathVarying {
1120 @builtin(position) position: vec4<f32>,
1121 @location(0) texture_coords: vec2<f32>,
1122}
1123
1124@vertex
1125fn vs_path(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> PathVarying {
1126 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1127 let sprite = load_path_sprite(instance_id);
1128 // Don't apply content mask because it was already accounted for when rasterizing the path.
1129 let device_position = to_device_position(unit_vertex, sprite.bounds);
1130 // For screen-space intermediate texture, convert screen position to texture coordinates
1131 let screen_position = sprite.bounds.origin + unit_vertex * sprite.bounds.size;
1132 let texture_coords = screen_position / globals.viewport_size;
1133
1134 var out = PathVarying();
1135 out.position = device_position;
1136 out.texture_coords = texture_coords;
1137
1138 return out;
1139}
1140
1141@fragment
1142fn fs_path(input: PathVarying) -> @location(0) vec4<f32> {
1143 let sample = textureSample(t_sprite, s_sprite, input.texture_coords);
1144 return sample;
1145}
1146
1147// --- underlines --- //
1148
1149struct Underline {
1150 order: u32,
1151 pad: u32,
1152 bounds: Bounds,
1153 content_mask: Bounds,
1154 color: Hsla,
1155 thickness: f32,
1156 wavy: u32,
1157}
1158
1159
1160struct UnderlineVarying {
1161 @builtin(position) position: vec4<f32>,
1162 @location(0) @interpolate(flat) color: vec4<f32>,
1163 @location(1) @interpolate(flat) underline_id: u32,
1164 //TODO: use `clip_distance` once Naga supports it
1165 @location(3) clip_distances: vec4<f32>,
1166}
1167
1168@vertex
1169fn vs_underline(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> UnderlineVarying {
1170 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1171 let underline = load_underline(instance_id);
1172
1173 var out = UnderlineVarying();
1174 out.position = to_device_position(unit_vertex, underline.bounds);
1175 out.color = hsla_to_rgba(underline.color);
1176 out.underline_id = instance_id;
1177 out.clip_distances = distance_from_clip_rect(unit_vertex, underline.bounds, underline.content_mask);
1178 return out;
1179}
1180
1181@fragment
1182fn fs_underline(input: UnderlineVarying) -> @location(0) vec4<f32> {
1183 const WAVE_FREQUENCY: f32 = 2.0;
1184 const WAVE_HEIGHT_RATIO: f32 = 0.8;
1185
1186 // Alpha clip first, since we don't have `clip_distance`.
1187 if (any(input.clip_distances < vec4<f32>(0.0))) {
1188 return vec4<f32>(0.0);
1189 }
1190
1191 let underline = load_underline(input.underline_id);
1192 if (underline.wavy == 0u)
1193 {
1194 return blend_color(input.color, input.color.a);
1195 }
1196
1197 let half_thickness = underline.thickness * 0.5;
1198
1199 let st = (input.position.xy - underline.bounds.origin) / underline.bounds.size.y - vec2<f32>(0.0, 0.5);
1200 let frequency = M_PI_F * WAVE_FREQUENCY * underline.thickness / underline.bounds.size.y;
1201 let amplitude = (underline.thickness * WAVE_HEIGHT_RATIO) / underline.bounds.size.y;
1202
1203 let sine = sin(st.x * frequency) * amplitude;
1204 let dSine = cos(st.x * frequency) * amplitude * frequency;
1205 let distance = (st.y - sine) / sqrt(1.0 + dSine * dSine);
1206 let distance_in_pixels = distance * underline.bounds.size.y;
1207 let distance_from_top_border = distance_in_pixels - half_thickness;
1208 let distance_from_bottom_border = distance_in_pixels + half_thickness;
1209 let alpha = saturate(0.5 - max(-distance_from_bottom_border, distance_from_top_border));
1210 return blend_color(input.color, alpha * input.color.a);
1211}
1212
1213// --- monochrome sprites --- //
1214
1215struct MonochromeSprite {
1216 order: u32,
1217 pad: u32,
1218 bounds: Bounds,
1219 content_mask: Bounds,
1220 color: Hsla,
1221 tile: AtlasTile,
1222 transformation: TransformationMatrix,
1223}
1224
1225
1226struct MonoSpriteVarying {
1227 @builtin(position) position: vec4<f32>,
1228 @location(0) tile_position: vec2<f32>,
1229 @location(1) @interpolate(flat) color: vec4<f32>,
1230 @location(3) clip_distances: vec4<f32>,
1231}
1232
1233@vertex
1234fn vs_mono_sprite(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> MonoSpriteVarying {
1235 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1236 let sprite = load_mono_sprite(instance_id);
1237
1238 var out = MonoSpriteVarying();
1239 out.position = to_device_position_transformed(unit_vertex, sprite.bounds, sprite.transformation);
1240
1241 out.tile_position = to_tile_position(unit_vertex, sprite.tile);
1242 out.color = hsla_to_rgba(sprite.color);
1243 out.clip_distances = distance_from_clip_rect_transformed(unit_vertex, sprite.bounds, sprite.content_mask, sprite.transformation);
1244 return out;
1245}
1246
1247@fragment
1248fn fs_mono_sprite(input: MonoSpriteVarying) -> @location(0) vec4<f32> {
1249 let sample = textureSample(t_sprite, s_sprite, input.tile_position).r;
1250 let alpha_corrected = apply_contrast_and_gamma_correction(sample, input.color.rgb, gamma_params.grayscale_enhanced_contrast, gamma_params.gamma_ratios);
1251
1252 // Alpha clip after using the derivatives.
1253 if (any(input.clip_distances < vec4<f32>(0.0))) {
1254 return vec4<f32>(0.0);
1255 }
1256
1257 return blend_color(input.color, alpha_corrected);
1258}
1259
1260// --- polychrome sprites --- //
1261
1262struct PolychromeSprite {
1263 order: u32,
1264 pad: u32,
1265 grayscale: u32,
1266 opacity: f32,
1267 bounds: Bounds,
1268 content_mask: Bounds,
1269 corner_radii: Corners,
1270 tile: AtlasTile,
1271}
1272
1273
1274struct PolySpriteVarying {
1275 @builtin(position) position: vec4<f32>,
1276 @location(0) tile_position: vec2<f32>,
1277 @location(1) @interpolate(flat) sprite_id: u32,
1278 @location(3) clip_distances: vec4<f32>,
1279}
1280
1281@vertex
1282fn vs_poly_sprite(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> PolySpriteVarying {
1283 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1284 let sprite = load_poly_sprite(instance_id);
1285
1286 var out = PolySpriteVarying();
1287 out.position = to_device_position(unit_vertex, sprite.bounds);
1288 out.tile_position = to_tile_position(unit_vertex, sprite.tile);
1289 out.sprite_id = instance_id;
1290 out.clip_distances = distance_from_clip_rect(unit_vertex, sprite.bounds, sprite.content_mask);
1291 return out;
1292}
1293
1294@fragment
1295fn fs_poly_sprite(input: PolySpriteVarying) -> @location(0) vec4<f32> {
1296 let sample = textureSample(t_sprite, s_sprite, input.tile_position);
1297 // Alpha clip after using the derivatives.
1298 if (any(input.clip_distances < vec4<f32>(0.0))) {
1299 return vec4<f32>(0.0);
1300 }
1301
1302 let sprite = load_poly_sprite(input.sprite_id);
1303 let distance = quad_sdf(input.position.xy, sprite.bounds, sprite.corner_radii);
1304
1305 var color = sample;
1306 if (sprite.grayscale != 0u) {
1307 let grayscale = dot(color.rgb, GRAYSCALE_FACTORS);
1308 color = vec4<f32>(vec3<f32>(grayscale), sample.a);
1309 }
1310 return blend_color(color, sprite.opacity * saturate(0.5 - distance));
1311}
1312
1313// --- surfaces --- //
1314
1315struct SurfaceParams {
1316 bounds: Bounds,
1317 content_mask: Bounds,
1318}
1319
1320@group(1) @binding(0) var<uniform> surface_locals: SurfaceParams;
1321@group(1) @binding(1) var t_y: texture_2d<f32>;
1322@group(1) @binding(2) var t_cb_cr: texture_2d<f32>;
1323@group(1) @binding(3) var s_surface: sampler;
1324
1325const ycbcr_to_RGB = mat4x4<f32>(
1326 vec4<f32>( 1.0000f, 1.0000f, 1.0000f, 0.0),
1327 vec4<f32>( 0.0000f, -0.3441f, 1.7720f, 0.0),
1328 vec4<f32>( 1.4020f, -0.7141f, 0.0000f, 0.0),
1329 vec4<f32>(-0.7010f, 0.5291f, -0.8860f, 1.0),
1330);
1331
1332struct SurfaceVarying {
1333 @builtin(position) position: vec4<f32>,
1334 @location(0) texture_position: vec2<f32>,
1335 @location(3) clip_distances: vec4<f32>,
1336}
1337
1338@vertex
1339fn vs_surface(@builtin(vertex_index) vertex_id: u32) -> SurfaceVarying {
1340 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
1341
1342 var out = SurfaceVarying();
1343 out.position = to_device_position(unit_vertex, surface_locals.bounds);
1344 out.texture_position = unit_vertex;
1345 out.clip_distances = distance_from_clip_rect(unit_vertex, surface_locals.bounds, surface_locals.content_mask);
1346 return out;
1347}
1348
1349@fragment
1350fn fs_surface(input: SurfaceVarying) -> @location(0) vec4<f32> {
1351 // Alpha clip after using the derivatives.
1352 if (any(input.clip_distances < vec4<f32>(0.0))) {
1353 return vec4<f32>(0.0);
1354 }
1355
1356 let y_cb_cr = vec4<f32>(
1357 textureSampleLevel(t_y, s_surface, input.texture_position, 0.0).r,
1358 textureSampleLevel(t_cb_cr, s_surface, input.texture_position, 0.0).rg,
1359 1.0);
1360
1361 return ycbcr_to_RGB * y_cb_cr;
1362}
vendor/gpui-pre-wgpu/src/shaders_storage.wgsl added +42 −0
@@ -0,0 +1,42 @@
1 // Storage-buffer instance transport. Concatenated after `shaders.wgsl` on backends
2 // with storage buffer support; `shaders_webgl.wgsl` is the WebGL2 counterpart that
3 // decodes the same records from a texture instead.
4 //
5 // All buffers share `@group(1) @binding(0)` because each pipeline binds only the
6 // buffer its own entry points read.
7
8 @group(1) @binding(0) var<storage, read> b_quads: array<Quad>;
9 @group(1) @binding(0) var<storage, read> b_shadows: array<Shadow>;
10 @group(1) @binding(0) var<storage, read> b_path_vertices: array<PathRasterizationVertex>;
11 @group(1) @binding(0) var<storage, read> b_path_sprites: array<PathSprite>;
12 @group(1) @binding(0) var<storage, read> b_underlines: array<Underline>;
13 @group(1) @binding(0) var<storage, read> b_mono_sprites: array<MonochromeSprite>;
14 @group(1) @binding(0) var<storage, read> b_poly_sprites: array<PolychromeSprite>;
15
16 fn load_quad(instance_id: u32) -> Quad {
17 return b_quads[instance_id];
18 }
19
20 fn load_shadow(instance_id: u32) -> Shadow {
21 return b_shadows[instance_id];
22 }
23
24 fn load_path_vertex(vertex_id: u32) -> PathRasterizationVertex {
25 return b_path_vertices[vertex_id];
26 }
27
28 fn load_path_sprite(instance_id: u32) -> PathSprite {
29 return b_path_sprites[instance_id];
30 }
31
32 fn load_underline(instance_id: u32) -> Underline {
33 return b_underlines[instance_id];
34 }
35
36 fn load_mono_sprite(instance_id: u32) -> MonochromeSprite {
37 return b_mono_sprites[instance_id];
38 }
39
40 fn load_poly_sprite(instance_id: u32) -> PolychromeSprite {
41 return b_poly_sprites[instance_id];
42 }
@@ -0,0 +1,42 @@
1// Storage-buffer instance transport. Concatenated after `shaders.wgsl` on backends
2// with storage buffer support; `shaders_webgl.wgsl` is the WebGL2 counterpart that
3// decodes the same records from a texture instead.
4//
5// All buffers share `@group(1) @binding(0)` because each pipeline binds only the
6// buffer its own entry points read.
7
8@group(1) @binding(0) var<storage, read> b_quads: array<Quad>;
9@group(1) @binding(0) var<storage, read> b_shadows: array<Shadow>;
10@group(1) @binding(0) var<storage, read> b_path_vertices: array<PathRasterizationVertex>;
11@group(1) @binding(0) var<storage, read> b_path_sprites: array<PathSprite>;
12@group(1) @binding(0) var<storage, read> b_underlines: array<Underline>;
13@group(1) @binding(0) var<storage, read> b_mono_sprites: array<MonochromeSprite>;
14@group(1) @binding(0) var<storage, read> b_poly_sprites: array<PolychromeSprite>;
15
16fn load_quad(instance_id: u32) -> Quad {
17 return b_quads[instance_id];
18}
19
20fn load_shadow(instance_id: u32) -> Shadow {
21 return b_shadows[instance_id];
22}
23
24fn load_path_vertex(vertex_id: u32) -> PathRasterizationVertex {
25 return b_path_vertices[vertex_id];
26}
27
28fn load_path_sprite(instance_id: u32) -> PathSprite {
29 return b_path_sprites[instance_id];
30}
31
32fn load_underline(instance_id: u32) -> Underline {
33 return b_underlines[instance_id];
34}
35
36fn load_mono_sprite(instance_id: u32) -> MonochromeSprite {
37 return b_mono_sprites[instance_id];
38}
39
40fn load_poly_sprite(instance_id: u32) -> PolychromeSprite {
41 return b_poly_sprites[instance_id];
42}
vendor/gpui-pre-wgpu/src/shaders_subpixel.wgsl added +56 −0
@@ -0,0 +1,56 @@
1 // --- subpixel sprites --- //
2
3 struct SubpixelSprite {
4 order: u32,
5 pad: u32,
6 bounds: Bounds,
7 content_mask: Bounds,
8 color: Hsla,
9 tile: AtlasTile,
10 transformation: TransformationMatrix,
11 }
12 @group(1) @binding(0) var<storage, read> b_subpixel_sprites: array<SubpixelSprite>;
13
14 struct SubpixelSpriteOutput {
15 @builtin(position) position: vec4<f32>,
16 @location(0) tile_position: vec2<f32>,
17 @location(1) @interpolate(flat) color: vec4<f32>,
18 @location(3) clip_distances: vec4<f32>,
19 }
20
21 struct SubpixelSpriteFragmentOutput {
22 @location(0) @blend_src(0) foreground: vec4<f32>,
23 @location(0) @blend_src(1) alpha: vec4<f32>,
24 }
25
26 @vertex
27 fn vs_subpixel_sprite(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> SubpixelSpriteOutput {
28 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
29 let sprite = b_subpixel_sprites[instance_id];
30
31 var out = SubpixelSpriteOutput();
32 out.position = to_device_position_transformed(unit_vertex, sprite.bounds, sprite.transformation);
33 out.tile_position = to_tile_position(unit_vertex, sprite.tile);
34 out.color = hsla_to_rgba(sprite.color);
35 out.clip_distances = distance_from_clip_rect_transformed(unit_vertex, sprite.bounds, sprite.content_mask, sprite.transformation);
36 return out;
37 }
38
39 @fragment
40 fn fs_subpixel_sprite(input: SubpixelSpriteOutput) -> SubpixelSpriteFragmentOutput {
41 var sample = textureSample(t_sprite, s_sprite, input.tile_position).rgb;
42 if (gamma_params.is_bgr != 0u) {
43 sample = sample.bgr;
44 }
45 let alpha_corrected = apply_contrast_and_gamma_correction3(sample, input.color.rgb, gamma_params.subpixel_enhanced_contrast, gamma_params.gamma_ratios);
46
47 // Alpha clip after using the derivatives.
48 if (any(input.clip_distances < vec4<f32>(0.0))) {
49 return SubpixelSpriteFragmentOutput(vec4<f32>(0.0), vec4<f32>(0.0));
50 }
51
52 var out = SubpixelSpriteFragmentOutput();
53 out.foreground = vec4<f32>(input.color.rgb, 1.0);
54 out.alpha = vec4<f32>(input.color.a * alpha_corrected, 1.0);
55 return out;
56 }
@@ -0,0 +1,56 @@
1// --- subpixel sprites --- //
2
3struct SubpixelSprite {
4 order: u32,
5 pad: u32,
6 bounds: Bounds,
7 content_mask: Bounds,
8 color: Hsla,
9 tile: AtlasTile,
10 transformation: TransformationMatrix,
11}
12@group(1) @binding(0) var<storage, read> b_subpixel_sprites: array<SubpixelSprite>;
13
14struct SubpixelSpriteOutput {
15 @builtin(position) position: vec4<f32>,
16 @location(0) tile_position: vec2<f32>,
17 @location(1) @interpolate(flat) color: vec4<f32>,
18 @location(3) clip_distances: vec4<f32>,
19}
20
21struct SubpixelSpriteFragmentOutput {
22 @location(0) @blend_src(0) foreground: vec4<f32>,
23 @location(0) @blend_src(1) alpha: vec4<f32>,
24}
25
26@vertex
27fn vs_subpixel_sprite(@builtin(vertex_index) vertex_id: u32, @builtin(instance_index) instance_id: u32) -> SubpixelSpriteOutput {
28 let unit_vertex = vec2<f32>(f32(vertex_id & 1u), 0.5 * f32(vertex_id & 2u));
29 let sprite = b_subpixel_sprites[instance_id];
30
31 var out = SubpixelSpriteOutput();
32 out.position = to_device_position_transformed(unit_vertex, sprite.bounds, sprite.transformation);
33 out.tile_position = to_tile_position(unit_vertex, sprite.tile);
34 out.color = hsla_to_rgba(sprite.color);
35 out.clip_distances = distance_from_clip_rect_transformed(unit_vertex, sprite.bounds, sprite.content_mask, sprite.transformation);
36 return out;
37}
38
39@fragment
40fn fs_subpixel_sprite(input: SubpixelSpriteOutput) -> SubpixelSpriteFragmentOutput {
41 var sample = textureSample(t_sprite, s_sprite, input.tile_position).rgb;
42 if (gamma_params.is_bgr != 0u) {
43 sample = sample.bgr;
44 }
45 let alpha_corrected = apply_contrast_and_gamma_correction3(sample, input.color.rgb, gamma_params.subpixel_enhanced_contrast, gamma_params.gamma_ratios);
46
47 // Alpha clip after using the derivatives.
48 if (any(input.clip_distances < vec4<f32>(0.0))) {
49 return SubpixelSpriteFragmentOutput(vec4<f32>(0.0), vec4<f32>(0.0));
50 }
51
52 var out = SubpixelSpriteFragmentOutput();
53 out.foreground = vec4<f32>(input.color.rgb, 1.0);
54 out.alpha = vec4<f32>(input.color.a * alpha_corrected, 1.0);
55 return out;
56}
vendor/gpui-pre-wgpu/src/shaders_webgl.wgsl added +262 −0
@@ -0,0 +1,262 @@
1 @group(1) @binding(0) var t_instances: texture_2d<u32>;
2
3 // Each texel of `t_instances` packs four 32-bit words of instance data. Most
4 // records are read strictly front to back through a cursor that keeps the
5 // most recently fetched texel and only touches the texture again when the next
6 // word crosses a texel boundary. This fetches each texel exactly once per
7 // record load instead of once per word. The `read_*` functions must therefore
8 // consume their words in struct declaration order; skipping or re-reading words
9 // would still return correct data (the cursor re-fetches whenever the texel
10 // index changes) but would forfeit the single-fetch-per-texel guarantee.
11 struct InstanceCursor {
12 word_index: u32,
13 texel_index: u32,
14 texel: vec4<u32>,
15 width: u32,
16 }
17
18 fn fetch_instance_texel(texel_index: u32, width: u32) -> vec4<u32> {
19 let coordinate = vec2<i32>(
20 i32(texel_index % width),
21 i32(texel_index / width),
22 );
23 return textureLoad(t_instances, coordinate, 0);
24 }
25
26 fn instance_cursor(word_index: u32) -> InstanceCursor {
27 let width = textureDimensions(t_instances).x;
28 let texel_index = word_index / 4u;
29 return InstanceCursor(
30 word_index,
31 texel_index,
32 fetch_instance_texel(texel_index, width),
33 width,
34 );
35 }
36
37 fn read_word(cursor: ptr<function, InstanceCursor>) -> u32 {
38 let word_index = (*cursor).word_index;
39 let texel_index = word_index / 4u;
40 if texel_index != (*cursor).texel_index {
41 (*cursor).texel = fetch_instance_texel(texel_index, (*cursor).width);
42 (*cursor).texel_index = texel_index;
43 }
44 (*cursor).word_index = word_index + 1u;
45 return (*cursor).texel[word_index % 4u];
46 }
47
48 fn read_f32(cursor: ptr<function, InstanceCursor>) -> f32 {
49 return bitcast<f32>(read_word(cursor));
50 }
51
52 fn read_i32(cursor: ptr<function, InstanceCursor>) -> i32 {
53 return bitcast<i32>(read_word(cursor));
54 }
55
56 fn read_vec2_f32(cursor: ptr<function, InstanceCursor>) -> vec2<f32> {
57 return vec2<f32>(read_f32(cursor), read_f32(cursor));
58 }
59
60 fn read_vec2_i32(cursor: ptr<function, InstanceCursor>) -> vec2<i32> {
61 return vec2<i32>(read_i32(cursor), read_i32(cursor));
62 }
63
64 fn read_hsla(cursor: ptr<function, InstanceCursor>) -> Hsla {
65 return Hsla(
66 read_f32(cursor),
67 read_f32(cursor),
68 read_f32(cursor),
69 read_f32(cursor),
70 );
71 }
72
73 fn read_bounds(cursor: ptr<function, InstanceCursor>) -> Bounds {
74 return Bounds(read_vec2_f32(cursor), read_vec2_f32(cursor));
75 }
76
77 fn read_corners(cursor: ptr<function, InstanceCursor>) -> Corners {
78 return Corners(
79 read_f32(cursor),
80 read_f32(cursor),
81 read_f32(cursor),
82 read_f32(cursor),
83 );
84 }
85
86 fn read_edges(cursor: ptr<function, InstanceCursor>) -> Edges {
87 return Edges(
88 read_f32(cursor),
89 read_f32(cursor),
90 read_f32(cursor),
91 read_f32(cursor),
92 );
93 }
94
95 fn read_color_stop(cursor: ptr<function, InstanceCursor>) -> LinearColorStop {
96 return LinearColorStop(read_hsla(cursor), read_f32(cursor));
97 }
98
99 fn read_background(cursor: ptr<function, InstanceCursor>) -> Background {
100 return Background(
101 read_word(cursor),
102 read_word(cursor),
103 read_hsla(cursor),
104 read_f32(cursor),
105 array<LinearColorStop, 2>(
106 read_color_stop(cursor),
107 read_color_stop(cursor),
108 ),
109 read_word(cursor),
110 );
111 }
112
113 fn read_atlas_tile(cursor: ptr<function, InstanceCursor>) -> AtlasTile {
114 return AtlasTile(
115 AtlasTextureId(
116 read_word(cursor),
117 read_word(cursor),
118 ),
119 read_word(cursor),
120 read_word(cursor),
121 AtlasBounds(
122 read_vec2_i32(cursor),
123 read_vec2_i32(cursor),
124 ),
125 );
126 }
127
128 fn read_transformation(cursor: ptr<function, InstanceCursor>) -> TransformationMatrix {
129 return TransformationMatrix(
130 mat2x2<f32>(
131 read_vec2_f32(cursor),
132 read_vec2_f32(cursor),
133 ),
134 read_vec2_f32(cursor),
135 );
136 }
137
138 fn load_quad(instance_id: u32) -> Quad {
139 // Keep this fixed-layout decoder explicit. Some WebGL shader compilers fail
140 // to optimize the cursor's branches and dynamic vector indexing for quads.
141 let first_texel_index = instance_id * 10u;
142 let width = textureDimensions(t_instances).x;
143 let texel0 = fetch_instance_texel(first_texel_index, width);
144 let texel1 = fetch_instance_texel(first_texel_index + 1u, width);
145 let texel2 = fetch_instance_texel(first_texel_index + 2u, width);
146 let texel3 = fetch_instance_texel(first_texel_index + 3u, width);
147 let texel4 = fetch_instance_texel(first_texel_index + 4u, width);
148 let texel5 = fetch_instance_texel(first_texel_index + 5u, width);
149 let texel6 = fetch_instance_texel(first_texel_index + 6u, width);
150 let texel7 = fetch_instance_texel(first_texel_index + 7u, width);
151 let texel8 = fetch_instance_texel(first_texel_index + 8u, width);
152 let texel9 = fetch_instance_texel(first_texel_index + 9u, width);
153
154 let values0 = bitcast<vec4<f32>>(texel0);
155 let values1 = bitcast<vec4<f32>>(texel1);
156 let values2 = bitcast<vec4<f32>>(texel2);
157 let values3 = bitcast<vec4<f32>>(texel3);
158 let values4 = bitcast<vec4<f32>>(texel4);
159 let values5 = bitcast<vec4<f32>>(texel5);
160 let values6 = bitcast<vec4<f32>>(texel6);
161 let values7 = bitcast<vec4<f32>>(texel7);
162 let values8 = bitcast<vec4<f32>>(texel8);
163 let values9 = bitcast<vec4<f32>>(texel9);
164
165 return Quad(
166 texel0.x,
167 texel0.y,
168 Bounds(values0.zw, values1.xy),
169 Bounds(values1.zw, values2.xy),
170 Background(
171 texel2.z,
172 texel2.w,
173 Hsla(values3.x, values3.y, values3.z, values3.w),
174 values4.x,
175 array<LinearColorStop, 2>(
176 LinearColorStop(
177 Hsla(values4.y, values4.z, values4.w, values5.x),
178 values5.y,
179 ),
180 LinearColorStop(
181 Hsla(values5.z, values5.w, values6.x, values6.y),
182 values6.z,
183 ),
184 ),
185 texel6.w,
186 ),
187 Hsla(values7.x, values7.y, values7.z, values7.w),
188 Corners(values8.x, values8.y, values8.z, values8.w),
189 Edges(values9.x, values9.y, values9.z, values9.w),
190 );
191 }
192
193 fn load_shadow(instance_id: u32) -> Shadow {
194 var cursor = instance_cursor(instance_id * 28u);
195 return Shadow(
196 read_word(&cursor),
197 read_f32(&cursor),
198 read_bounds(&cursor),
199 read_corners(&cursor),
200 read_bounds(&cursor),
201 read_hsla(&cursor),
202 read_bounds(&cursor),
203 read_corners(&cursor),
204 read_word(&cursor),
205 read_word(&cursor),
206 );
207 }
208
209 fn load_path_vertex(vertex_id: u32) -> PathRasterizationVertex {
210 var cursor = instance_cursor(vertex_id * 26u);
211 return PathRasterizationVertex(
212 read_vec2_f32(&cursor),
213 read_vec2_f32(&cursor),
214 read_background(&cursor),
215 read_bounds(&cursor),
216 );
217 }
218
219 fn load_path_sprite(instance_id: u32) -> PathSprite {
220 var cursor = instance_cursor(instance_id * 4u);
221 return PathSprite(read_bounds(&cursor));
222 }
223
224 fn load_underline(instance_id: u32) -> Underline {
225 var cursor = instance_cursor(instance_id * 16u);
226 return Underline(
227 read_word(&cursor),
228 read_word(&cursor),
229 read_bounds(&cursor),
230 read_bounds(&cursor),
231 read_hsla(&cursor),
232 read_f32(&cursor),
233 read_word(&cursor),
234 );
235 }
236
237 fn load_mono_sprite(instance_id: u32) -> MonochromeSprite {
238 var cursor = instance_cursor(instance_id * 28u);
239 return MonochromeSprite(
240 read_word(&cursor),
241 read_word(&cursor),
242 read_bounds(&cursor),
243 read_bounds(&cursor),
244 read_hsla(&cursor),
245 read_atlas_tile(&cursor),
246 read_transformation(&cursor),
247 );
248 }
249
250 fn load_poly_sprite(instance_id: u32) -> PolychromeSprite {
251 var cursor = instance_cursor(instance_id * 24u);
252 return PolychromeSprite(
253 read_word(&cursor),
254 read_word(&cursor),
255 read_word(&cursor),
256 read_f32(&cursor),
257 read_bounds(&cursor),
258 read_bounds(&cursor),
259 read_corners(&cursor),
260 read_atlas_tile(&cursor),
261 );
262 }
@@ -0,0 +1,262 @@
1@group(1) @binding(0) var t_instances: texture_2d<u32>;
2
3// Each texel of `t_instances` packs four 32-bit words of instance data. Most
4// records are read strictly front to back through a cursor that keeps the
5// most recently fetched texel and only touches the texture again when the next
6// word crosses a texel boundary. This fetches each texel exactly once per
7// record load instead of once per word. The `read_*` functions must therefore
8// consume their words in struct declaration order; skipping or re-reading words
9// would still return correct data (the cursor re-fetches whenever the texel
10// index changes) but would forfeit the single-fetch-per-texel guarantee.
11struct InstanceCursor {
12 word_index: u32,
13 texel_index: u32,
14 texel: vec4<u32>,
15 width: u32,
16}
17
18fn fetch_instance_texel(texel_index: u32, width: u32) -> vec4<u32> {
19 let coordinate = vec2<i32>(
20 i32(texel_index % width),
21 i32(texel_index / width),
22 );
23 return textureLoad(t_instances, coordinate, 0);
24}
25
26fn instance_cursor(word_index: u32) -> InstanceCursor {
27 let width = textureDimensions(t_instances).x;
28 let texel_index = word_index / 4u;
29 return InstanceCursor(
30 word_index,
31 texel_index,
32 fetch_instance_texel(texel_index, width),
33 width,
34 );
35}
36
37fn read_word(cursor: ptr<function, InstanceCursor>) -> u32 {
38 let word_index = (*cursor).word_index;
39 let texel_index = word_index / 4u;
40 if texel_index != (*cursor).texel_index {
41 (*cursor).texel = fetch_instance_texel(texel_index, (*cursor).width);
42 (*cursor).texel_index = texel_index;
43 }
44 (*cursor).word_index = word_index + 1u;
45 return (*cursor).texel[word_index % 4u];
46}
47
48fn read_f32(cursor: ptr<function, InstanceCursor>) -> f32 {
49 return bitcast<f32>(read_word(cursor));
50}
51
52fn read_i32(cursor: ptr<function, InstanceCursor>) -> i32 {
53 return bitcast<i32>(read_word(cursor));
54}
55
56fn read_vec2_f32(cursor: ptr<function, InstanceCursor>) -> vec2<f32> {
57 return vec2<f32>(read_f32(cursor), read_f32(cursor));
58}
59
60fn read_vec2_i32(cursor: ptr<function, InstanceCursor>) -> vec2<i32> {
61 return vec2<i32>(read_i32(cursor), read_i32(cursor));
62}
63
64fn read_hsla(cursor: ptr<function, InstanceCursor>) -> Hsla {
65 return Hsla(
66 read_f32(cursor),
67 read_f32(cursor),
68 read_f32(cursor),
69 read_f32(cursor),
70 );
71}
72
73fn read_bounds(cursor: ptr<function, InstanceCursor>) -> Bounds {
74 return Bounds(read_vec2_f32(cursor), read_vec2_f32(cursor));
75}
76
77fn read_corners(cursor: ptr<function, InstanceCursor>) -> Corners {
78 return Corners(
79 read_f32(cursor),
80 read_f32(cursor),
81 read_f32(cursor),
82 read_f32(cursor),
83 );
84}
85
86fn read_edges(cursor: ptr<function, InstanceCursor>) -> Edges {
87 return Edges(
88 read_f32(cursor),
89 read_f32(cursor),
90 read_f32(cursor),
91 read_f32(cursor),
92 );
93}
94
95fn read_color_stop(cursor: ptr<function, InstanceCursor>) -> LinearColorStop {
96 return LinearColorStop(read_hsla(cursor), read_f32(cursor));
97}
98
99fn read_background(cursor: ptr<function, InstanceCursor>) -> Background {
100 return Background(
101 read_word(cursor),
102 read_word(cursor),
103 read_hsla(cursor),
104 read_f32(cursor),
105 array<LinearColorStop, 2>(
106 read_color_stop(cursor),
107 read_color_stop(cursor),
108 ),
109 read_word(cursor),
110 );
111}
112
113fn read_atlas_tile(cursor: ptr<function, InstanceCursor>) -> AtlasTile {
114 return AtlasTile(
115 AtlasTextureId(
116 read_word(cursor),
117 read_word(cursor),
118 ),
119 read_word(cursor),
120 read_word(cursor),
121 AtlasBounds(
122 read_vec2_i32(cursor),
123 read_vec2_i32(cursor),
124 ),
125 );
126}
127
128fn read_transformation(cursor: ptr<function, InstanceCursor>) -> TransformationMatrix {
129 return TransformationMatrix(
130 mat2x2<f32>(
131 read_vec2_f32(cursor),
132 read_vec2_f32(cursor),
133 ),
134 read_vec2_f32(cursor),
135 );
136}
137
138fn load_quad(instance_id: u32) -> Quad {
139 // Keep this fixed-layout decoder explicit. Some WebGL shader compilers fail
140 // to optimize the cursor's branches and dynamic vector indexing for quads.
141 let first_texel_index = instance_id * 10u;
142 let width = textureDimensions(t_instances).x;
143 let texel0 = fetch_instance_texel(first_texel_index, width);
144 let texel1 = fetch_instance_texel(first_texel_index + 1u, width);
145 let texel2 = fetch_instance_texel(first_texel_index + 2u, width);
146 let texel3 = fetch_instance_texel(first_texel_index + 3u, width);
147 let texel4 = fetch_instance_texel(first_texel_index + 4u, width);
148 let texel5 = fetch_instance_texel(first_texel_index + 5u, width);
149 let texel6 = fetch_instance_texel(first_texel_index + 6u, width);
150 let texel7 = fetch_instance_texel(first_texel_index + 7u, width);
151 let texel8 = fetch_instance_texel(first_texel_index + 8u, width);
152 let texel9 = fetch_instance_texel(first_texel_index + 9u, width);
153
154 let values0 = bitcast<vec4<f32>>(texel0);
155 let values1 = bitcast<vec4<f32>>(texel1);
156 let values2 = bitcast<vec4<f32>>(texel2);
157 let values3 = bitcast<vec4<f32>>(texel3);
158 let values4 = bitcast<vec4<f32>>(texel4);
159 let values5 = bitcast<vec4<f32>>(texel5);
160 let values6 = bitcast<vec4<f32>>(texel6);
161 let values7 = bitcast<vec4<f32>>(texel7);
162 let values8 = bitcast<vec4<f32>>(texel8);
163 let values9 = bitcast<vec4<f32>>(texel9);
164
165 return Quad(
166 texel0.x,
167 texel0.y,
168 Bounds(values0.zw, values1.xy),
169 Bounds(values1.zw, values2.xy),
170 Background(
171 texel2.z,
172 texel2.w,
173 Hsla(values3.x, values3.y, values3.z, values3.w),
174 values4.x,
175 array<LinearColorStop, 2>(
176 LinearColorStop(
177 Hsla(values4.y, values4.z, values4.w, values5.x),
178 values5.y,
179 ),
180 LinearColorStop(
181 Hsla(values5.z, values5.w, values6.x, values6.y),
182 values6.z,
183 ),
184 ),
185 texel6.w,
186 ),
187 Hsla(values7.x, values7.y, values7.z, values7.w),
188 Corners(values8.x, values8.y, values8.z, values8.w),
189 Edges(values9.x, values9.y, values9.z, values9.w),
190 );
191}
192
193fn load_shadow(instance_id: u32) -> Shadow {
194 var cursor = instance_cursor(instance_id * 28u);
195 return Shadow(
196 read_word(&cursor),
197 read_f32(&cursor),
198 read_bounds(&cursor),
199 read_corners(&cursor),
200 read_bounds(&cursor),
201 read_hsla(&cursor),
202 read_bounds(&cursor),
203 read_corners(&cursor),
204 read_word(&cursor),
205 read_word(&cursor),
206 );
207}
208
209fn load_path_vertex(vertex_id: u32) -> PathRasterizationVertex {
210 var cursor = instance_cursor(vertex_id * 26u);
211 return PathRasterizationVertex(
212 read_vec2_f32(&cursor),
213 read_vec2_f32(&cursor),
214 read_background(&cursor),
215 read_bounds(&cursor),
216 );
217}
218
219fn load_path_sprite(instance_id: u32) -> PathSprite {
220 var cursor = instance_cursor(instance_id * 4u);
221 return PathSprite(read_bounds(&cursor));
222}
223
224fn load_underline(instance_id: u32) -> Underline {
225 var cursor = instance_cursor(instance_id * 16u);
226 return Underline(
227 read_word(&cursor),
228 read_word(&cursor),
229 read_bounds(&cursor),
230 read_bounds(&cursor),
231 read_hsla(&cursor),
232 read_f32(&cursor),
233 read_word(&cursor),
234 );
235}
236
237fn load_mono_sprite(instance_id: u32) -> MonochromeSprite {
238 var cursor = instance_cursor(instance_id * 28u);
239 return MonochromeSprite(
240 read_word(&cursor),
241 read_word(&cursor),
242 read_bounds(&cursor),
243 read_bounds(&cursor),
244 read_hsla(&cursor),
245 read_atlas_tile(&cursor),
246 read_transformation(&cursor),
247 );
248}
249
250fn load_poly_sprite(instance_id: u32) -> PolychromeSprite {
251 var cursor = instance_cursor(instance_id * 24u);
252 return PolychromeSprite(
253 read_word(&cursor),
254 read_word(&cursor),
255 read_word(&cursor),
256 read_f32(&cursor),
257 read_bounds(&cursor),
258 read_bounds(&cursor),
259 read_corners(&cursor),
260 read_atlas_tile(&cursor),
261 );
262}
vendor/gpui-pre-wgpu/src/wgpu_atlas.rs added +566 −0
@@ -0,0 +1,566 @@
1 use anyhow::{Context as _, Result};
2 use etagere::{BucketedAtlasAllocator, size2};
3 use gpui::{
4 AtlasBackend, AtlasKey, AtlasState, AtlasTextureId, AtlasTextureKind, AtlasTextureList,
5 AtlasTile, Bounds, DevicePixels, PlatformAtlas, Point, Size,
6 };
7 use parking_lot::Mutex;
8 use std::{borrow::Cow, ops, sync::Arc};
9
10 use crate::WgpuContext;
11
12 fn device_size_to_etagere(size: Size<DevicePixels>) -> etagere::Size {
13 size2(size.width.0, size.height.0)
14 }
15
16 fn etagere_point_to_device(point: etagere::Point) -> Point<DevicePixels> {
17 Point {
18 x: DevicePixels(point.x),
19 y: DevicePixels(point.y),
20 }
21 }
22
23 pub struct WgpuAtlas(Mutex<AtlasState<WgpuAtlasTextures>>);
24
25 struct PendingUpload {
26 id: AtlasTextureId,
27 bounds: Bounds<DevicePixels>,
28 data: Vec<u8>,
29 }
30
31 struct WgpuAtlasTextures {
32 device: Arc<wgpu::Device>,
33 queue: Arc<wgpu::Queue>,
34 max_texture_size: u32,
35 color_texture_format: wgpu::TextureFormat,
36 storage: WgpuAtlasStorage,
37 pending_uploads: Vec<PendingUpload>,
38 next_texture_generation: u64,
39 }
40
41 pub struct WgpuTextureInfo {
42 pub view: wgpu::TextureView,
43 /// Distinguishes new textures that reuse an [`AtlasTextureId`].
44 pub generation: u64,
45 }
46
47 impl WgpuAtlas {
48 pub fn new(
49 device: Arc<wgpu::Device>,
50 queue: Arc<wgpu::Queue>,
51 color_texture_format: wgpu::TextureFormat,
52 ) -> Self {
53 let max_texture_size = device.limits().max_texture_dimension_2d;
54 WgpuAtlas(Mutex::new(AtlasState::new(WgpuAtlasTextures {
55 device,
56 queue,
57 max_texture_size,
58 color_texture_format,
59 storage: WgpuAtlasStorage::default(),
60 pending_uploads: Vec::new(),
61 next_texture_generation: 0,
62 })))
63 }
64
65 pub fn from_context(context: &WgpuContext) -> Self {
66 Self::new(
67 context.device.clone(),
68 context.queue.clone(),
69 context.color_texture_format(),
70 )
71 }
72
73 pub fn before_frame(&self) {
74 let mut lock = self.0.lock();
75 lock.backend.flush_uploads();
76 }
77
78 /// Returns the view backing `id`, or `None` once every tile in it has been
79 /// removed. A scene can still reference such a texture when a cached view
80 /// replays a paint from before the image was dropped, so callers must skip
81 /// those sprites rather than assume the texture exists.
82 pub fn get_texture_info(&self, id: AtlasTextureId) -> Option<WgpuTextureInfo> {
83 let lock = self.0.lock();
84 let texture = lock.backend.storage.get(id)?;
85 Some(WgpuTextureInfo {
86 view: texture.view.clone(),
87 generation: texture.generation,
88 })
89 }
90
91 /// Clears all cached textures and tiles, forcing them to be recreated.
92 /// Use this for incremental recovery when the device is still valid.
93 pub fn clear(&self) {
94 self.0.lock().clear(|textures| {
95 textures.storage = WgpuAtlasStorage::default();
96 textures.pending_uploads.clear();
97 });
98 }
99
100 /// Handles device lost by clearing all textures and cached tiles.
101 /// The atlas will lazily recreate textures as needed on subsequent frames.
102 pub fn handle_device_lost(&self, context: &WgpuContext) {
103 self.0.lock().clear(|textures| {
104 textures.device = context.device.clone();
105 textures.queue = context.queue.clone();
106 textures.color_texture_format = context.color_texture_format();
107 textures.storage = WgpuAtlasStorage::default();
108 textures.pending_uploads.clear();
109 });
110 }
111 }
112
113 impl PlatformAtlas for WgpuAtlas {
114 fn get_or_insert_with<'a>(
115 &self,
116 key: AtlasKey,
117 build: &mut dyn FnMut() -> Result<Option<(Size<DevicePixels>, Cow<'a, [u8]>)>>,
118 ) -> Result<Option<AtlasTile>> {
119 self.0.lock().get_or_insert_with(key, build)
120 }
121
122 fn remove(&self, key: &AtlasKey) {
123 self.0.lock().remove(key);
124 }
125 }
126
127 impl AtlasBackend for WgpuAtlasTextures {
128 fn insert(
129 &mut self,
130 kind: AtlasTextureKind,
131 size: Size<DevicePixels>,
132 bytes: &[u8],
133 ) -> Result<AtlasTile> {
134 let tile = self.allocate(size, kind).context("failed to allocate")?;
135 self.upload_texture(tile.texture_id, tile.bounds, bytes);
136 Ok(tile)
137 }
138
139 fn remove(&mut self, tile: AtlasTile) {
140 let id = tile.texture_id;
141 let Some(texture_slot) = self.storage[id.kind].textures.get_mut(id.index as usize) else {
142 return;
143 };
144
145 if let Some(mut texture) = texture_slot.take() {
146 texture.allocator.deallocate(tile.tile_id.into());
147 texture.decrement_ref_count();
148 if texture.is_unreferenced() {
149 self.pending_uploads
150 .retain(|upload| upload.id != texture.id);
151 self.storage[id.kind]
152 .free_list
153 .push(texture.id.index as usize);
154 } else {
155 *texture_slot = Some(texture);
156 }
157 }
158 }
159 }
160
161 impl WgpuAtlasTextures {
162 fn allocate(
163 &mut self,
164 size: Size<DevicePixels>,
165 texture_kind: AtlasTextureKind,
166 ) -> Option<AtlasTile> {
167 {
168 let textures = &mut self.storage[texture_kind];
169
170 if let Some(tile) = textures
171 .iter_mut()
172 .rev()
173 .find_map(|texture| texture.allocate(size))
174 {
175 return Some(tile);
176 }
177 }
178
179 let texture = self.push_texture(size, texture_kind);
180 texture.allocate(size)
181 }
182
183 fn push_texture(
184 &mut self,
185 min_size: Size<DevicePixels>,
186 kind: AtlasTextureKind,
187 ) -> &mut WgpuAtlasTexture {
188 const DEFAULT_ATLAS_SIZE: Size<DevicePixels> = Size {
189 width: DevicePixels(1024),
190 height: DevicePixels(1024),
191 };
192 let max_texture_size = self.max_texture_size as i32;
193 let max_atlas_size = Size {
194 width: DevicePixels(max_texture_size),
195 height: DevicePixels(max_texture_size),
196 };
197
198 let size = min_size.min(&max_atlas_size).max(&DEFAULT_ATLAS_SIZE);
199 let format = match kind {
200 AtlasTextureKind::Monochrome => wgpu::TextureFormat::R8Unorm,
201 AtlasTextureKind::Subpixel | AtlasTextureKind::Polychrome => self.color_texture_format,
202 };
203
204 let texture = self.device.create_texture(&wgpu::TextureDescriptor {
205 label: Some("atlas"),
206 size: wgpu::Extent3d {
207 width: size.width.0 as u32,
208 height: size.height.0 as u32,
209 depth_or_array_layers: 1,
210 },
211 mip_level_count: 1,
212 sample_count: 1,
213 dimension: wgpu::TextureDimension::D2,
214 format,
215 usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
216 view_formats: &[],
217 });
218
219 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
220
221 let texture_list = &mut self.storage[kind];
222 let index = texture_list.free_list.pop();
223 let generation = self.next_texture_generation;
224 self.next_texture_generation = self.next_texture_generation.wrapping_add(1);
225
226 let atlas_texture = WgpuAtlasTexture {
227 id: AtlasTextureId {
228 index: index.unwrap_or(texture_list.textures.len()) as u32,
229 kind,
230 },
231 generation,
232 allocator: BucketedAtlasAllocator::new(device_size_to_etagere(size)),
233 format,
234 texture,
235 view,
236 live_atlas_keys: 0,
237 };
238
239 if let Some(ix) = index {
240 texture_list.textures[ix] = Some(atlas_texture);
241 texture_list
242 .textures
243 .get_mut(ix)
244 .and_then(|t| t.as_mut())
245 .expect("texture must exist")
246 } else {
247 texture_list.textures.push(Some(atlas_texture));
248 texture_list
249 .textures
250 .last_mut()
251 .and_then(|t| t.as_mut())
252 .expect("texture must exist")
253 }
254 }
255
256 fn upload_texture(&mut self, id: AtlasTextureId, bounds: Bounds<DevicePixels>, bytes: &[u8]) {
257 let data = self
258 .storage
259 .get(id)
260 .map(|texture| swizzle_upload_data(bytes, texture.format))
261 .unwrap_or_else(|| bytes.to_vec());
262
263 self.pending_uploads
264 .push(PendingUpload { id, bounds, data });
265 }
266
267 fn flush_uploads(&mut self) {
268 for upload in self.pending_uploads.drain(..) {
269 let Some(texture) = self.storage.get(upload.id) else {
270 continue;
271 };
272 let bytes_per_pixel = texture.bytes_per_pixel();
273
274 self.queue.write_texture(
275 wgpu::TexelCopyTextureInfo {
276 texture: &texture.texture,
277 mip_level: 0,
278 origin: wgpu::Origin3d {
279 x: upload.bounds.origin.x.0 as u32,
280 y: upload.bounds.origin.y.0 as u32,
281 z: 0,
282 },
283 aspect: wgpu::TextureAspect::All,
284 },
285 &upload.data,
286 wgpu::TexelCopyBufferLayout {
287 offset: 0,
288 bytes_per_row: Some(upload.bounds.size.width.0 as u32 * bytes_per_pixel as u32),
289 rows_per_image: None,
290 },
291 wgpu::Extent3d {
292 width: upload.bounds.size.width.0 as u32,
293 height: upload.bounds.size.height.0 as u32,
294 depth_or_array_layers: 1,
295 },
296 );
297 }
298 }
299 }
300
301 #[derive(Default)]
302 struct WgpuAtlasStorage {
303 monochrome_textures: AtlasTextureList<WgpuAtlasTexture>,
304 subpixel_textures: AtlasTextureList<WgpuAtlasTexture>,
305 polychrome_textures: AtlasTextureList<WgpuAtlasTexture>,
306 }
307
308 impl ops::Index<AtlasTextureKind> for WgpuAtlasStorage {
309 type Output = AtlasTextureList<WgpuAtlasTexture>;
310 fn index(&self, kind: AtlasTextureKind) -> &Self::Output {
311 match kind {
312 AtlasTextureKind::Monochrome => &self.monochrome_textures,
313 AtlasTextureKind::Subpixel => &self.subpixel_textures,
314 AtlasTextureKind::Polychrome => &self.polychrome_textures,
315 }
316 }
317 }
318
319 impl ops::IndexMut<AtlasTextureKind> for WgpuAtlasStorage {
320 fn index_mut(&mut self, kind: AtlasTextureKind) -> &mut Self::Output {
321 match kind {
322 AtlasTextureKind::Monochrome => &mut self.monochrome_textures,
323 AtlasTextureKind::Subpixel => &mut self.subpixel_textures,
324 AtlasTextureKind::Polychrome => &mut self.polychrome_textures,
325 }
326 }
327 }
328
329 impl WgpuAtlasStorage {
330 fn get(&self, id: AtlasTextureId) -> Option<&WgpuAtlasTexture> {
331 self[id.kind]
332 .textures
333 .get(id.index as usize)
334 .and_then(|t| t.as_ref())
335 }
336 }
337
338 struct WgpuAtlasTexture {
339 id: AtlasTextureId,
340 generation: u64,
341 allocator: BucketedAtlasAllocator,
342 texture: wgpu::Texture,
343 view: wgpu::TextureView,
344 format: wgpu::TextureFormat,
345 live_atlas_keys: u32,
346 }
347
348 impl WgpuAtlasTexture {
349 fn allocate(&mut self, size: Size<DevicePixels>) -> Option<AtlasTile> {
350 let allocation = self.allocator.allocate(device_size_to_etagere(size))?;
351 let tile = AtlasTile {
352 texture_id: self.id,
353 tile_id: allocation.id.into(),
354 padding: 0,
355 bounds: Bounds {
356 origin: etagere_point_to_device(allocation.rectangle.min),
357 size,
358 },
359 };
360 self.live_atlas_keys += 1;
361 Some(tile)
362 }
363
364 fn bytes_per_pixel(&self) -> u8 {
365 match self.format {
366 wgpu::TextureFormat::R8Unorm => 1,
367 wgpu::TextureFormat::Bgra8Unorm | wgpu::TextureFormat::Rgba8Unorm => 4,
368 _ => 4,
369 }
370 }
371
372 fn decrement_ref_count(&mut self) {
373 self.live_atlas_keys -= 1;
374 }
375
376 fn is_unreferenced(&self) -> bool {
377 self.live_atlas_keys == 0
378 }
379 }
380
381 fn swizzle_upload_data(bytes: &[u8], format: wgpu::TextureFormat) -> Vec<u8> {
382 match format {
383 wgpu::TextureFormat::Rgba8Unorm => {
384 let mut data = bytes.to_vec();
385 for pixel in data.chunks_exact_mut(4) {
386 pixel.swap(0, 2);
387 }
388 data
389 }
390 _ => bytes.to_vec(),
391 }
392 }
393
394 #[cfg(all(test, not(target_family = "wasm")))]
395 mod tests {
396 use super::*;
397 use gpui::block_on;
398 use gpui::{ImageId, RenderImageParams};
399 use std::sync::Arc;
400
401 fn test_device_and_queue() -> anyhow::Result<(Arc<wgpu::Device>, Arc<wgpu::Queue>)> {
402 block_on(async {
403 let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
404 backends: wgpu::Backends::all(),
405 flags: wgpu::InstanceFlags::default(),
406 backend_options: wgpu::BackendOptions::default(),
407 memory_budget_thresholds: wgpu::MemoryBudgetThresholds::default(),
408 display: None,
409 });
410 let adapter = instance
411 .request_adapter(&wgpu::RequestAdapterOptions {
412 power_preference: wgpu::PowerPreference::LowPower,
413 compatible_surface: None,
414 force_fallback_adapter: false,
415 })
416 .await
417 .map_err(|error| anyhow::anyhow!("failed to request adapter: {error}"))?;
418 let (device, queue) = adapter
419 .request_device(&wgpu::DeviceDescriptor {
420 label: Some("wgpu_atlas_test_device"),
421 required_features: wgpu::Features::empty(),
422 required_limits: wgpu::Limits::downlevel_defaults()
423 .using_resolution(adapter.limits())
424 .using_alignment(adapter.limits()),
425 memory_hints: wgpu::MemoryHints::MemoryUsage,
426 trace: wgpu::Trace::Off,
427 experimental_features: wgpu::ExperimentalFeatures::disabled(),
428 })
429 .await
430 .map_err(|error| anyhow::anyhow!("failed to request device: {error}"))?;
431 Ok((Arc::new(device), Arc::new(queue)))
432 })
433 }
434
435 #[test]
436 fn before_frame_skips_uploads_for_removed_texture() -> anyhow::Result<()> {
437 let (device, queue) = test_device_and_queue()?;
438
439 let atlas = WgpuAtlas::new(device, queue, wgpu::TextureFormat::Bgra8Unorm);
440 let key = AtlasKey::Image(RenderImageParams {
441 image_id: ImageId(1),
442 frame_index: 0,
443 });
444 let size = Size {
445 width: DevicePixels(1),
446 height: DevicePixels(1),
447 };
448 let mut build = || Ok(Some((size, Cow::Owned(vec![0, 0, 0, 255]))));
449
450 // Regression test: before the fix, this panicked in flush_uploads
451 atlas
452 .get_or_insert_with(key.clone(), &mut build)?
453 .expect("tile should be created");
454 atlas.remove(&key);
455 atlas.before_frame();
456 Ok(())
457 }
458
459 #[test]
460 fn remove_deallocates_tile_space_for_reuse() -> anyhow::Result<()> {
461 let (device, queue) = test_device_and_queue()?;
462 let atlas = WgpuAtlas::new(device, queue, wgpu::TextureFormat::Bgra8Unorm);
463
464 let small = Size {
465 width: DevicePixels(64),
466 height: DevicePixels(64),
467 };
468 let big = Size {
469 width: DevicePixels(700),
470 height: DevicePixels(700),
471 };
472
473 let make_key = |image_id: usize| {
474 AtlasKey::Image(RenderImageParams {
475 image_id: ImageId(image_id),
476 frame_index: 0,
477 })
478 };
479 let insert = |key: AtlasKey, size: Size<DevicePixels>| {
480 let byte_count = (size.width.0 as usize) * (size.height.0 as usize) * 4;
481 atlas
482 .get_or_insert_with(key, &mut || {
483 Ok(Some((size, Cow::Owned(vec![0u8; byte_count]))))
484 })
485 .expect("allocation should succeed")
486 .expect("callback returns Some")
487 };
488
489 let keeper_key = make_key(1);
490 let big_key_a = make_key(2);
491 let big_key_b = make_key(3);
492
493 let keeper_tile = insert(keeper_key, small);
494 let tile_a = insert(big_key_a.clone(), big);
495 assert_eq!(keeper_tile.texture_id, tile_a.texture_id);
496
497 atlas.remove(&big_key_a);
498 let tile_b = insert(big_key_b, big);
499 assert_eq!(tile_b.texture_id, keeper_tile.texture_id);
500 Ok(())
501 }
502
503 #[test]
504 fn reused_texture_id_has_new_generation() -> anyhow::Result<()> {
505 let (device, queue) = test_device_and_queue()?;
506 let atlas = WgpuAtlas::new(device, queue, wgpu::TextureFormat::Bgra8Unorm);
507 let size = Size {
508 width: DevicePixels(700),
509 height: DevicePixels(700),
510 };
511 let make_key = |image_id| {
512 AtlasKey::Image(RenderImageParams {
513 image_id: ImageId(image_id),
514 frame_index: 0,
515 })
516 };
517 let insert = |key: AtlasKey| {
518 atlas
519 .get_or_insert_with(key, &mut || {
520 Ok(Some((
521 size,
522 Cow::Owned(vec![0; size.width.0 as usize * size.height.0 as usize * 4]),
523 )))
524 })
525 .expect("allocation should succeed")
526 .expect("callback returns Some")
527 };
528
529 let first_key = make_key(1);
530 let first_tile = insert(first_key.clone());
531 let first_generation = atlas
532 .get_texture_info(first_tile.texture_id)
533 .context("first texture should exist")?
534 .generation;
535 atlas.remove(&first_key);
536 assert!(atlas.get_texture_info(first_tile.texture_id).is_none());
537
538 let second_tile = insert(make_key(2));
539 let second_generation = atlas
540 .get_texture_info(second_tile.texture_id)
541 .context("second texture should exist")?
542 .generation;
543
544 assert_eq!(second_tile.texture_id, first_tile.texture_id);
545 assert_ne!(second_generation, first_generation);
546 Ok(())
547 }
548
549 #[test]
550 fn swizzle_upload_data_preserves_bgra_uploads() {
551 let input = vec![0x10, 0x20, 0x30, 0x40];
552 assert_eq!(
553 swizzle_upload_data(&input, wgpu::TextureFormat::Bgra8Unorm),
554 input
555 );
556 }
557
558 #[test]
559 fn swizzle_upload_data_converts_bgra_to_rgba() {
560 let input = vec![0x10, 0x20, 0x30, 0x40, 0xAA, 0xBB, 0xCC, 0xDD];
561 assert_eq!(
562 swizzle_upload_data(&input, wgpu::TextureFormat::Rgba8Unorm),
563 vec![0x30, 0x20, 0x10, 0x40, 0xCC, 0xBB, 0xAA, 0xDD]
564 );
565 }
566 }
@@ -0,0 +1,566 @@
1use anyhow::{Context as _, Result};
2use etagere::{BucketedAtlasAllocator, size2};
3use gpui::{
4 AtlasBackend, AtlasKey, AtlasState, AtlasTextureId, AtlasTextureKind, AtlasTextureList,
5 AtlasTile, Bounds, DevicePixels, PlatformAtlas, Point, Size,
6};
7use parking_lot::Mutex;
8use std::{borrow::Cow, ops, sync::Arc};
9
10use crate::WgpuContext;
11
12fn device_size_to_etagere(size: Size<DevicePixels>) -> etagere::Size {
13 size2(size.width.0, size.height.0)
14}
15
16fn etagere_point_to_device(point: etagere::Point) -> Point<DevicePixels> {
17 Point {
18 x: DevicePixels(point.x),
19 y: DevicePixels(point.y),
20 }
21}
22
23pub struct WgpuAtlas(Mutex<AtlasState<WgpuAtlasTextures>>);
24
25struct PendingUpload {
26 id: AtlasTextureId,
27 bounds: Bounds<DevicePixels>,
28 data: Vec<u8>,
29}
30
31struct WgpuAtlasTextures {
32 device: Arc<wgpu::Device>,
33 queue: Arc<wgpu::Queue>,
34 max_texture_size: u32,
35 color_texture_format: wgpu::TextureFormat,
36 storage: WgpuAtlasStorage,
37 pending_uploads: Vec<PendingUpload>,
38 next_texture_generation: u64,
39}
40
41pub struct WgpuTextureInfo {
42 pub view: wgpu::TextureView,
43 /// Distinguishes new textures that reuse an [`AtlasTextureId`].
44 pub generation: u64,
45}
46
47impl WgpuAtlas {
48 pub fn new(
49 device: Arc<wgpu::Device>,
50 queue: Arc<wgpu::Queue>,
51 color_texture_format: wgpu::TextureFormat,
52 ) -> Self {
53 let max_texture_size = device.limits().max_texture_dimension_2d;
54 WgpuAtlas(Mutex::new(AtlasState::new(WgpuAtlasTextures {
55 device,
56 queue,
57 max_texture_size,
58 color_texture_format,
59 storage: WgpuAtlasStorage::default(),
60 pending_uploads: Vec::new(),
61 next_texture_generation: 0,
62 })))
63 }
64
65 pub fn from_context(context: &WgpuContext) -> Self {
66 Self::new(
67 context.device.clone(),
68 context.queue.clone(),
69 context.color_texture_format(),
70 )
71 }
72
73 pub fn before_frame(&self) {
74 let mut lock = self.0.lock();
75 lock.backend.flush_uploads();
76 }
77
78 /// Returns the view backing `id`, or `None` once every tile in it has been
79 /// removed. A scene can still reference such a texture when a cached view
80 /// replays a paint from before the image was dropped, so callers must skip
81 /// those sprites rather than assume the texture exists.
82 pub fn get_texture_info(&self, id: AtlasTextureId) -> Option<WgpuTextureInfo> {
83 let lock = self.0.lock();
84 let texture = lock.backend.storage.get(id)?;
85 Some(WgpuTextureInfo {
86 view: texture.view.clone(),
87 generation: texture.generation,
88 })
89 }
90
91 /// Clears all cached textures and tiles, forcing them to be recreated.
92 /// Use this for incremental recovery when the device is still valid.
93 pub fn clear(&self) {
94 self.0.lock().clear(|textures| {
95 textures.storage = WgpuAtlasStorage::default();
96 textures.pending_uploads.clear();
97 });
98 }
99
100 /// Handles device lost by clearing all textures and cached tiles.
101 /// The atlas will lazily recreate textures as needed on subsequent frames.
102 pub fn handle_device_lost(&self, context: &WgpuContext) {
103 self.0.lock().clear(|textures| {
104 textures.device = context.device.clone();
105 textures.queue = context.queue.clone();
106 textures.color_texture_format = context.color_texture_format();
107 textures.storage = WgpuAtlasStorage::default();
108 textures.pending_uploads.clear();
109 });
110 }
111}
112
113impl PlatformAtlas for WgpuAtlas {
114 fn get_or_insert_with<'a>(
115 &self,
116 key: AtlasKey,
117 build: &mut dyn FnMut() -> Result<Option<(Size<DevicePixels>, Cow<'a, [u8]>)>>,
118 ) -> Result<Option<AtlasTile>> {
119 self.0.lock().get_or_insert_with(key, build)
120 }
121
122 fn remove(&self, key: &AtlasKey) {
123 self.0.lock().remove(key);
124 }
125}
126
127impl AtlasBackend for WgpuAtlasTextures {
128 fn insert(
129 &mut self,
130 kind: AtlasTextureKind,
131 size: Size<DevicePixels>,
132 bytes: &[u8],
133 ) -> Result<AtlasTile> {
134 let tile = self.allocate(size, kind).context("failed to allocate")?;
135 self.upload_texture(tile.texture_id, tile.bounds, bytes);
136 Ok(tile)
137 }
138
139 fn remove(&mut self, tile: AtlasTile) {
140 let id = tile.texture_id;
141 let Some(texture_slot) = self.storage[id.kind].textures.get_mut(id.index as usize) else {
142 return;
143 };
144
145 if let Some(mut texture) = texture_slot.take() {
146 texture.allocator.deallocate(tile.tile_id.into());
147 texture.decrement_ref_count();
148 if texture.is_unreferenced() {
149 self.pending_uploads
150 .retain(|upload| upload.id != texture.id);
151 self.storage[id.kind]
152 .free_list
153 .push(texture.id.index as usize);
154 } else {
155 *texture_slot = Some(texture);
156 }
157 }
158 }
159}
160
161impl WgpuAtlasTextures {
162 fn allocate(
163 &mut self,
164 size: Size<DevicePixels>,
165 texture_kind: AtlasTextureKind,
166 ) -> Option<AtlasTile> {
167 {
168 let textures = &mut self.storage[texture_kind];
169
170 if let Some(tile) = textures
171 .iter_mut()
172 .rev()
173 .find_map(|texture| texture.allocate(size))
174 {
175 return Some(tile);
176 }
177 }
178
179 let texture = self.push_texture(size, texture_kind);
180 texture.allocate(size)
181 }
182
183 fn push_texture(
184 &mut self,
185 min_size: Size<DevicePixels>,
186 kind: AtlasTextureKind,
187 ) -> &mut WgpuAtlasTexture {
188 const DEFAULT_ATLAS_SIZE: Size<DevicePixels> = Size {
189 width: DevicePixels(1024),
190 height: DevicePixels(1024),
191 };
192 let max_texture_size = self.max_texture_size as i32;
193 let max_atlas_size = Size {
194 width: DevicePixels(max_texture_size),
195 height: DevicePixels(max_texture_size),
196 };
197
198 let size = min_size.min(&max_atlas_size).max(&DEFAULT_ATLAS_SIZE);
199 let format = match kind {
200 AtlasTextureKind::Monochrome => wgpu::TextureFormat::R8Unorm,
201 AtlasTextureKind::Subpixel | AtlasTextureKind::Polychrome => self.color_texture_format,
202 };
203
204 let texture = self.device.create_texture(&wgpu::TextureDescriptor {
205 label: Some("atlas"),
206 size: wgpu::Extent3d {
207 width: size.width.0 as u32,
208 height: size.height.0 as u32,
209 depth_or_array_layers: 1,
210 },
211 mip_level_count: 1,
212 sample_count: 1,
213 dimension: wgpu::TextureDimension::D2,
214 format,
215 usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
216 view_formats: &[],
217 });
218
219 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
220
221 let texture_list = &mut self.storage[kind];
222 let index = texture_list.free_list.pop();
223 let generation = self.next_texture_generation;
224 self.next_texture_generation = self.next_texture_generation.wrapping_add(1);
225
226 let atlas_texture = WgpuAtlasTexture {
227 id: AtlasTextureId {
228 index: index.unwrap_or(texture_list.textures.len()) as u32,
229 kind,
230 },
231 generation,
232 allocator: BucketedAtlasAllocator::new(device_size_to_etagere(size)),
233 format,
234 texture,
235 view,
236 live_atlas_keys: 0,
237 };
238
239 if let Some(ix) = index {
240 texture_list.textures[ix] = Some(atlas_texture);
241 texture_list
242 .textures
243 .get_mut(ix)
244 .and_then(|t| t.as_mut())
245 .expect("texture must exist")
246 } else {
247 texture_list.textures.push(Some(atlas_texture));
248 texture_list
249 .textures
250 .last_mut()
251 .and_then(|t| t.as_mut())
252 .expect("texture must exist")
253 }
254 }
255
256 fn upload_texture(&mut self, id: AtlasTextureId, bounds: Bounds<DevicePixels>, bytes: &[u8]) {
257 let data = self
258 .storage
259 .get(id)
260 .map(|texture| swizzle_upload_data(bytes, texture.format))
261 .unwrap_or_else(|| bytes.to_vec());
262
263 self.pending_uploads
264 .push(PendingUpload { id, bounds, data });
265 }
266
267 fn flush_uploads(&mut self) {
268 for upload in self.pending_uploads.drain(..) {
269 let Some(texture) = self.storage.get(upload.id) else {
270 continue;
271 };
272 let bytes_per_pixel = texture.bytes_per_pixel();
273
274 self.queue.write_texture(
275 wgpu::TexelCopyTextureInfo {
276 texture: &texture.texture,
277 mip_level: 0,
278 origin: wgpu::Origin3d {
279 x: upload.bounds.origin.x.0 as u32,
280 y: upload.bounds.origin.y.0 as u32,
281 z: 0,
282 },
283 aspect: wgpu::TextureAspect::All,
284 },
285 &upload.data,
286 wgpu::TexelCopyBufferLayout {
287 offset: 0,
288 bytes_per_row: Some(upload.bounds.size.width.0 as u32 * bytes_per_pixel as u32),
289 rows_per_image: None,
290 },
291 wgpu::Extent3d {
292 width: upload.bounds.size.width.0 as u32,
293 height: upload.bounds.size.height.0 as u32,
294 depth_or_array_layers: 1,
295 },
296 );
297 }
298 }
299}
300
301#[derive(Default)]
302struct WgpuAtlasStorage {
303 monochrome_textures: AtlasTextureList<WgpuAtlasTexture>,
304 subpixel_textures: AtlasTextureList<WgpuAtlasTexture>,
305 polychrome_textures: AtlasTextureList<WgpuAtlasTexture>,
306}
307
308impl ops::Index<AtlasTextureKind> for WgpuAtlasStorage {
309 type Output = AtlasTextureList<WgpuAtlasTexture>;
310 fn index(&self, kind: AtlasTextureKind) -> &Self::Output {
311 match kind {
312 AtlasTextureKind::Monochrome => &self.monochrome_textures,
313 AtlasTextureKind::Subpixel => &self.subpixel_textures,
314 AtlasTextureKind::Polychrome => &self.polychrome_textures,
315 }
316 }
317}
318
319impl ops::IndexMut<AtlasTextureKind> for WgpuAtlasStorage {
320 fn index_mut(&mut self, kind: AtlasTextureKind) -> &mut Self::Output {
321 match kind {
322 AtlasTextureKind::Monochrome => &mut self.monochrome_textures,
323 AtlasTextureKind::Subpixel => &mut self.subpixel_textures,
324 AtlasTextureKind::Polychrome => &mut self.polychrome_textures,
325 }
326 }
327}
328
329impl WgpuAtlasStorage {
330 fn get(&self, id: AtlasTextureId) -> Option<&WgpuAtlasTexture> {
331 self[id.kind]
332 .textures
333 .get(id.index as usize)
334 .and_then(|t| t.as_ref())
335 }
336}
337
338struct WgpuAtlasTexture {
339 id: AtlasTextureId,
340 generation: u64,
341 allocator: BucketedAtlasAllocator,
342 texture: wgpu::Texture,
343 view: wgpu::TextureView,
344 format: wgpu::TextureFormat,
345 live_atlas_keys: u32,
346}
347
348impl WgpuAtlasTexture {
349 fn allocate(&mut self, size: Size<DevicePixels>) -> Option<AtlasTile> {
350 let allocation = self.allocator.allocate(device_size_to_etagere(size))?;
351 let tile = AtlasTile {
352 texture_id: self.id,
353 tile_id: allocation.id.into(),
354 padding: 0,
355 bounds: Bounds {
356 origin: etagere_point_to_device(allocation.rectangle.min),
357 size,
358 },
359 };
360 self.live_atlas_keys += 1;
361 Some(tile)
362 }
363
364 fn bytes_per_pixel(&self) -> u8 {
365 match self.format {
366 wgpu::TextureFormat::R8Unorm => 1,
367 wgpu::TextureFormat::Bgra8Unorm | wgpu::TextureFormat::Rgba8Unorm => 4,
368 _ => 4,
369 }
370 }
371
372 fn decrement_ref_count(&mut self) {
373 self.live_atlas_keys -= 1;
374 }
375
376 fn is_unreferenced(&self) -> bool {
377 self.live_atlas_keys == 0
378 }
379}
380
381fn swizzle_upload_data(bytes: &[u8], format: wgpu::TextureFormat) -> Vec<u8> {
382 match format {
383 wgpu::TextureFormat::Rgba8Unorm => {
384 let mut data = bytes.to_vec();
385 for pixel in data.chunks_exact_mut(4) {
386 pixel.swap(0, 2);
387 }
388 data
389 }
390 _ => bytes.to_vec(),
391 }
392}
393
394#[cfg(all(test, not(target_family = "wasm")))]
395mod tests {
396 use super::*;
397 use gpui::block_on;
398 use gpui::{ImageId, RenderImageParams};
399 use std::sync::Arc;
400
401 fn test_device_and_queue() -> anyhow::Result<(Arc<wgpu::Device>, Arc<wgpu::Queue>)> {
402 block_on(async {
403 let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
404 backends: wgpu::Backends::all(),
405 flags: wgpu::InstanceFlags::default(),
406 backend_options: wgpu::BackendOptions::default(),
407 memory_budget_thresholds: wgpu::MemoryBudgetThresholds::default(),
408 display: None,
409 });
410 let adapter = instance
411 .request_adapter(&wgpu::RequestAdapterOptions {
412 power_preference: wgpu::PowerPreference::LowPower,
413 compatible_surface: None,
414 force_fallback_adapter: false,
415 })
416 .await
417 .map_err(|error| anyhow::anyhow!("failed to request adapter: {error}"))?;
418 let (device, queue) = adapter
419 .request_device(&wgpu::DeviceDescriptor {
420 label: Some("wgpu_atlas_test_device"),
421 required_features: wgpu::Features::empty(),
422 required_limits: wgpu::Limits::downlevel_defaults()
423 .using_resolution(adapter.limits())
424 .using_alignment(adapter.limits()),
425 memory_hints: wgpu::MemoryHints::MemoryUsage,
426 trace: wgpu::Trace::Off,
427 experimental_features: wgpu::ExperimentalFeatures::disabled(),
428 })
429 .await
430 .map_err(|error| anyhow::anyhow!("failed to request device: {error}"))?;
431 Ok((Arc::new(device), Arc::new(queue)))
432 })
433 }
434
435 #[test]
436 fn before_frame_skips_uploads_for_removed_texture() -> anyhow::Result<()> {
437 let (device, queue) = test_device_and_queue()?;
438
439 let atlas = WgpuAtlas::new(device, queue, wgpu::TextureFormat::Bgra8Unorm);
440 let key = AtlasKey::Image(RenderImageParams {
441 image_id: ImageId(1),
442 frame_index: 0,
443 });
444 let size = Size {
445 width: DevicePixels(1),
446 height: DevicePixels(1),
447 };
448 let mut build = || Ok(Some((size, Cow::Owned(vec![0, 0, 0, 255]))));
449
450 // Regression test: before the fix, this panicked in flush_uploads
451 atlas
452 .get_or_insert_with(key.clone(), &mut build)?
453 .expect("tile should be created");
454 atlas.remove(&key);
455 atlas.before_frame();
456 Ok(())
457 }
458
459 #[test]
460 fn remove_deallocates_tile_space_for_reuse() -> anyhow::Result<()> {
461 let (device, queue) = test_device_and_queue()?;
462 let atlas = WgpuAtlas::new(device, queue, wgpu::TextureFormat::Bgra8Unorm);
463
464 let small = Size {
465 width: DevicePixels(64),
466 height: DevicePixels(64),
467 };
468 let big = Size {
469 width: DevicePixels(700),
470 height: DevicePixels(700),
471 };
472
473 let make_key = |image_id: usize| {
474 AtlasKey::Image(RenderImageParams {
475 image_id: ImageId(image_id),
476 frame_index: 0,
477 })
478 };
479 let insert = |key: AtlasKey, size: Size<DevicePixels>| {
480 let byte_count = (size.width.0 as usize) * (size.height.0 as usize) * 4;
481 atlas
482 .get_or_insert_with(key, &mut || {
483 Ok(Some((size, Cow::Owned(vec![0u8; byte_count]))))
484 })
485 .expect("allocation should succeed")
486 .expect("callback returns Some")
487 };
488
489 let keeper_key = make_key(1);
490 let big_key_a = make_key(2);
491 let big_key_b = make_key(3);
492
493 let keeper_tile = insert(keeper_key, small);
494 let tile_a = insert(big_key_a.clone(), big);
495 assert_eq!(keeper_tile.texture_id, tile_a.texture_id);
496
497 atlas.remove(&big_key_a);
498 let tile_b = insert(big_key_b, big);
499 assert_eq!(tile_b.texture_id, keeper_tile.texture_id);
500 Ok(())
501 }
502
503 #[test]
504 fn reused_texture_id_has_new_generation() -> anyhow::Result<()> {
505 let (device, queue) = test_device_and_queue()?;
506 let atlas = WgpuAtlas::new(device, queue, wgpu::TextureFormat::Bgra8Unorm);
507 let size = Size {
508 width: DevicePixels(700),
509 height: DevicePixels(700),
510 };
511 let make_key = |image_id| {
512 AtlasKey::Image(RenderImageParams {
513 image_id: ImageId(image_id),
514 frame_index: 0,
515 })
516 };
517 let insert = |key: AtlasKey| {
518 atlas
519 .get_or_insert_with(key, &mut || {
520 Ok(Some((
521 size,
522 Cow::Owned(vec![0; size.width.0 as usize * size.height.0 as usize * 4]),
523 )))
524 })
525 .expect("allocation should succeed")
526 .expect("callback returns Some")
527 };
528
529 let first_key = make_key(1);
530 let first_tile = insert(first_key.clone());
531 let first_generation = atlas
532 .get_texture_info(first_tile.texture_id)
533 .context("first texture should exist")?
534 .generation;
535 atlas.remove(&first_key);
536 assert!(atlas.get_texture_info(first_tile.texture_id).is_none());
537
538 let second_tile = insert(make_key(2));
539 let second_generation = atlas
540 .get_texture_info(second_tile.texture_id)
541 .context("second texture should exist")?
542 .generation;
543
544 assert_eq!(second_tile.texture_id, first_tile.texture_id);
545 assert_ne!(second_generation, first_generation);
546 Ok(())
547 }
548
549 #[test]
550 fn swizzle_upload_data_preserves_bgra_uploads() {
551 let input = vec![0x10, 0x20, 0x30, 0x40];
552 assert_eq!(
553 swizzle_upload_data(&input, wgpu::TextureFormat::Bgra8Unorm),
554 input
555 );
556 }
557
558 #[test]
559 fn swizzle_upload_data_converts_bgra_to_rgba() {
560 let input = vec![0x10, 0x20, 0x30, 0x40, 0xAA, 0xBB, 0xCC, 0xDD];
561 assert_eq!(
562 swizzle_upload_data(&input, wgpu::TextureFormat::Rgba8Unorm),
563 vec![0x30, 0x20, 0x10, 0x40, 0xCC, 0xBB, 0xAA, 0xDD]
564 );
565 }
566}
vendor/gpui-pre-wgpu/src/wgpu_context.rs added +829 −0
@@ -0,0 +1,829 @@
1 #[cfg(not(target_family = "wasm"))]
2 use anyhow::Context as _;
3 #[cfg(not(target_family = "wasm"))]
4 use gpui_util::ResultExt;
5 use parking_lot::Mutex;
6 use std::sync::Arc;
7 use std::sync::atomic::{AtomicBool, Ordering};
8 use wgpu::TextureFormat;
9
10 #[derive(Clone)]
11 pub struct WgpuContext {
12 pub instance: wgpu::Instance,
13 pub adapter: wgpu::Adapter,
14 pub device: Arc<wgpu::Device>,
15 pub queue: Arc<wgpu::Queue>,
16 backend: WgpuBackend,
17 dual_source_blending: bool,
18 color_texture_format: wgpu::TextureFormat,
19 errors: Arc<DeviceErrorState>,
20 }
21
22 /// Errors reported by wgpu's device-wide callbacks.
23 ///
24 /// A device has exactly one lost callback and one uncaptured-error callback, so this
25 /// state is installed once per device and shared by every renderer using it. Renderers
26 /// keep their own handle so they can keep observing a loss after the context that
27 /// produced it has been dropped for recovery.
28 #[derive(Default)]
29 pub struct DeviceErrorState {
30 lost: AtomicBool,
31 last_error: Mutex<(u64, Option<String>)>,
32 }
33
34 impl DeviceErrorState {
35 fn install(device: &wgpu::Device) -> Arc<Self> {
36 let errors = Arc::new(Self::default());
37 device.set_device_lost_callback({
38 let errors = Arc::clone(&errors);
39 move |reason, message| {
40 log::error!("wgpu device lost: reason={reason:?}, message={message}");
41 if reason != wgpu::DeviceLostReason::Destroyed {
42 errors.lost.store(true, Ordering::Relaxed);
43 }
44 }
45 });
46 device.on_uncaptured_error(Arc::new({
47 let errors = Arc::clone(&errors);
48 move |error| errors.record(error.to_string())
49 }));
50 errors
51 }
52
53 /// Returns true if the GPU device was lost (e.g., due to driver crash, suspend/resume).
54 pub fn device_lost(&self) -> bool {
55 self.lost.load(Ordering::Relaxed)
56 }
57
58 fn record(&self, error: String) {
59 let mut last_error = self.last_error.lock();
60 last_error.0 = last_error.0.wrapping_add(1);
61 last_error.1 = Some(error);
62 }
63
64 /// Returns the latest error once per observer, without consuming shared state.
65 /// Start each observer at zero, including after switching devices, so errors
66 /// raised during construction are observed. Multiple errors between observations
67 /// coalesce into the latest error; this is not an error queue.
68 pub fn observe_error(&self, generation: &mut u64) -> Option<String> {
69 let last_error = self.last_error.lock();
70 if *generation == last_error.0 {
71 return None;
72 }
73 *generation = last_error.0;
74 last_error.1.clone()
75 }
76
77 /// The generation an observer should start from to see only errors raised after
78 /// this call, for a renderer joining a device other renderers already used.
79 pub fn current_generation(&self) -> u64 {
80 self.last_error.lock().0
81 }
82 }
83
84 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
85 pub enum WgpuBackend {
86 BrowserWebGpu,
87 Gl,
88 Native(wgpu::Backend),
89 }
90
91 #[cfg(target_family = "wasm")]
92 #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
93 pub enum WebBackendPreference {
94 #[default]
95 Auto,
96 WebGpu,
97 WebGl,
98 }
99
100 #[cfg(target_family = "wasm")]
101 pub struct PreparedWebGraphics {
102 pub context: WgpuContext,
103 pub surface: wgpu::Surface<'static>,
104 }
105
106 /// wgpu-core refuses to create a surface when neither the instance nor the surface
107 /// target carries a display handle, and `SurfaceTarget::Canvas` always passes `None`.
108 /// The WebGL2 backend never reads the handle (WebGPU bypasses wgpu-core entirely), so
109 /// a unit web display handle on the instance satisfies the check.
110 #[cfg(target_family = "wasm")]
111 #[derive(Debug)]
112 struct WebDisplaySource;
113
114 #[cfg(target_family = "wasm")]
115 impl raw_window_handle::HasDisplayHandle for WebDisplaySource {
116 fn display_handle(
117 &self,
118 ) -> Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
119 Ok(raw_window_handle::DisplayHandle::web())
120 }
121 }
122
123 #[derive(Clone, Copy)]
124 pub struct CompositorGpuHint {
125 pub vendor_id: u32,
126 pub device_id: u32,
127 }
128
129 impl WgpuContext {
130 #[cfg(not(target_family = "wasm"))]
131 pub fn new(
132 instance: wgpu::Instance,
133 surface: &wgpu::Surface<'_>,
134 compositor_gpu: Option<CompositorGpuHint>,
135 ) -> anyhow::Result<Self> {
136 Self::new_with_options(instance, surface, compositor_gpu, false)
137 }
138
139 #[cfg(not(target_family = "wasm"))]
140 pub fn new_rejecting_software(
141 instance: wgpu::Instance,
142 surface: &wgpu::Surface<'_>,
143 compositor_gpu: Option<CompositorGpuHint>,
144 ) -> anyhow::Result<Self> {
145 Self::new_with_options(instance, surface, compositor_gpu, true)
146 }
147
148 #[cfg(not(target_family = "wasm"))]
149 fn new_with_options(
150 instance: wgpu::Instance,
151 surface: &wgpu::Surface<'_>,
152 compositor_gpu: Option<CompositorGpuHint>,
153 reject_software: bool,
154 ) -> anyhow::Result<Self> {
155 let device_id_filter = Self::device_id_filter();
156
157 // Select an adapter by actually testing surface configuration with the real device.
158 // This is the only reliable way to determine compatibility on hybrid GPU systems.
159 let (adapter, device, queue, dual_source_blending, color_texture_format) =
160 gpui::block_on(Self::select_adapter_and_device(
161 &instance,
162 device_id_filter,
163 surface,
164 compositor_gpu.as_ref(),
165 reject_software,
166 ))?;
167
168 Ok(Self::from_native_adapter_and_device(
169 instance,
170 adapter,
171 device,
172 queue,
173 dual_source_blending,
174 color_texture_format,
175 ))
176 }
177
178 #[cfg(all(
179 not(target_family = "wasm"),
180 any(test, feature = "bench-support", feature = "test-support")
181 ))]
182 pub(crate) fn new_headless() -> anyhow::Result<(Self, wgpu::TextureFormat)> {
183 // Creating a device takes tens of milliseconds, and benchmarks create a headless
184 // renderer for every window they open, so the process shares one device until it
185 // is lost. A static rather than a thread-local: the cached device is never dropped,
186 // because wgpu's queue reads its own thread-locals on drop and would panic if
187 // dropped while a thread's thread-locals are being destroyed.
188 static HEADLESS: Mutex<Option<(WgpuContext, wgpu::TextureFormat)>> = Mutex::new(None);
189 let mut headless = HEADLESS.lock();
190 if let Some((context, format)) = headless.as_ref()
191 && !context.device_lost()
192 {
193 return Ok((context.clone(), *format));
194 }
195 let created = Self::create_headless()?;
196 *headless = Some(created.clone());
197 Ok(created)
198 }
199
200 #[cfg(all(
201 not(target_family = "wasm"),
202 any(test, feature = "bench-support", feature = "test-support")
203 ))]
204 fn create_headless() -> anyhow::Result<(Self, wgpu::TextureFormat)> {
205 let instance = Self::instance(None);
206 let device_id_filter = Self::device_id_filter();
207 let (adapter, device, queue, dual_source_blending, color_texture_format, target_format) =
208 gpui::block_on(async {
209 let mut adapters = instance.enumerate_adapters(wgpu::Backends::all()).await;
210 Self::sort_adapters(&mut adapters, device_id_filter, None);
211
212 for adapter in adapters {
213 let adapter_info = adapter.get_info();
214 let Some(target_format) = Self::headless_target_format(&adapter) else {
215 log::warn!(
216 "Adapter {:?} has no supported headless render target format",
217 adapter_info.name
218 );
219 continue;
220 };
221
222 match Self::create_device(&adapter).await {
223 Ok((device, queue, dual_source_blending, color_texture_format)) => {
224 #[cfg(feature = "bench-support")]
225 if adapter_info.device_type == wgpu::DeviceType::Cpu {
226 log::error!(
227 "Headless renderer selected software adapter {:?}; \
228 benchmark results measure CPU software rendering, not hardware GPU rendering",
229 adapter_info.name
230 );
231 }
232 return Ok((
233 adapter,
234 device,
235 queue,
236 dual_source_blending,
237 color_texture_format,
238 target_format,
239 ));
240 }
241 Err(error) => {
242 log::warn!(
243 "Failed to create a headless device for adapter {:?}: {error:#}",
244 adapter_info.name
245 );
246 }
247 }
248 }
249
250 anyhow::bail!("No usable headless GPU adapter found")
251 })?;
252
253 Ok((
254 Self::from_native_adapter_and_device(
255 instance,
256 adapter,
257 device,
258 queue,
259 dual_source_blending,
260 color_texture_format,
261 ),
262 target_format,
263 ))
264 }
265
266 #[cfg(all(
267 not(target_family = "wasm"),
268 any(test, feature = "bench-support", feature = "test-support")
269 ))]
270 /// Both candidates are 8-bit RGBA-ordered or BGRA-ordered formats: headless readback
271 /// copies rows as 4 bytes per pixel and only swizzles, so no other formats may be added
272 /// here without updating it.
273 fn headless_target_format(adapter: &wgpu::Adapter) -> Option<wgpu::TextureFormat> {
274 let required_usages =
275 wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC;
276 [
277 wgpu::TextureFormat::Rgba8Unorm,
278 wgpu::TextureFormat::Bgra8Unorm,
279 ]
280 .into_iter()
281 .find(|format| {
282 adapter
283 .get_texture_format_features(*format)
284 .allowed_usages
285 .contains(required_usages)
286 })
287 }
288
289 #[cfg(not(target_family = "wasm"))]
290 fn from_native_adapter_and_device(
291 instance: wgpu::Instance,
292 adapter: wgpu::Adapter,
293 device: wgpu::Device,
294 queue: wgpu::Queue,
295 dual_source_blending: bool,
296 color_texture_format: TextureFormat,
297 ) -> Self {
298 let errors = DeviceErrorState::install(&device);
299
300 log::info!(
301 "Selected GPU adapter: {:?} ({:?})",
302 adapter.get_info().name,
303 adapter.get_info().backend
304 );
305 let backend = WgpuBackend::Native(adapter.get_info().backend);
306
307 Self {
308 instance,
309 adapter,
310 device: Arc::new(device),
311 queue: Arc::new(queue),
312 backend,
313 dual_source_blending,
314 color_texture_format,
315 errors,
316 }
317 }
318
319 #[cfg(not(target_family = "wasm"))]
320 fn device_id_filter() -> Option<u32> {
321 match std::env::var("ZED_DEVICE_ID") {
322 Ok(value) => parse_pci_id(&value)
323 .context("Failed to parse device ID from `ZED_DEVICE_ID` environment variable")
324 .log_err(),
325 Err(std::env::VarError::NotPresent) => None,
326 error => {
327 error
328 .context("Failed to read value of `ZED_DEVICE_ID` environment variable")
329 .log_err();
330 None
331 }
332 }
333 }
334
335 #[cfg(target_family = "wasm")]
336 pub async fn new_web(
337 canvas: &web_sys::HtmlCanvasElement,
338 preference: WebBackendPreference,
339 ) -> anyhow::Result<PreparedWebGraphics> {
340 Self::new_web_with_backend(canvas, preference).await
341 }
342
343 #[cfg(target_family = "wasm")]
344 #[allow(clippy::arc_with_non_send_sync)]
345 async fn new_web_with_backend(
346 canvas: &web_sys::HtmlCanvasElement,
347 preference: WebBackendPreference,
348 ) -> anyhow::Result<PreparedWebGraphics> {
349 let backends = match preference {
350 WebBackendPreference::Auto => wgpu::Backends::BROWSER_WEBGPU | wgpu::Backends::GL,
351 WebBackendPreference::WebGpu => wgpu::Backends::BROWSER_WEBGPU,
352 WebBackendPreference::WebGl => wgpu::Backends::GL,
353 };
354 let descriptor = wgpu::InstanceDescriptor {
355 backends,
356 flags: wgpu::InstanceFlags::default(),
357 backend_options: wgpu::BackendOptions::default(),
358 memory_budget_thresholds: wgpu::MemoryBudgetThresholds::default(),
359 display: Some(Box::new(WebDisplaySource)),
360 };
361 let instance = if preference == WebBackendPreference::Auto {
362 wgpu::util::new_instance_with_webgpu_detection(descriptor).await
363 } else {
364 wgpu::Instance::new(descriptor)
365 };
366 let surface = instance
367 .create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))
368 .map_err(|error| {
369 anyhow::anyhow!("Failed to create browser graphics surface: {error}")
370 })?;
371
372 let adapter = instance
373 .request_adapter(&wgpu::RequestAdapterOptions {
374 power_preference: wgpu::PowerPreference::HighPerformance,
375 compatible_surface: Some(&surface),
376 force_fallback_adapter: false,
377 })
378 .await
379 .map_err(|error| {
380 anyhow::anyhow!(
381 "Failed to request a {preference:?} adapter compatible with the canvas: {error}"
382 )
383 })?;
384 let adapter_info = adapter.get_info();
385 let backend = match adapter_info.backend {
386 wgpu::Backend::BrowserWebGpu => WgpuBackend::BrowserWebGpu,
387 wgpu::Backend::Gl => WgpuBackend::Gl,
388 backend => {
389 anyhow::bail!(
390 "Browser graphics initialization selected unexpected backend {backend:?}"
391 )
392 }
393 };
394
395 let (device, queue, dual_source_blending, color_texture_format) =
396 Self::create_device(&adapter).await?;
397 let errors = DeviceErrorState::install(&device);
398 log::info!(
399 "Browser graphics initialized: requested={preference:?}, selected={backend:?}, \
400 adapter={:?}, limits={:?}, dual_source_blending={dual_source_blending}",
401 adapter_info.name,
402 device.limits(),
403 );
404
405 let context = Self {
406 instance,
407 adapter,
408 device: Arc::new(device),
409 queue: Arc::new(queue),
410 backend,
411 dual_source_blending,
412 color_texture_format,
413 errors,
414 };
415 Ok(PreparedWebGraphics { context, surface })
416 }
417
418 async fn create_device(
419 adapter: &wgpu::Adapter,
420 ) -> anyhow::Result<(wgpu::Device, wgpu::Queue, bool, TextureFormat)> {
421 let dual_source_blending = adapter
422 .features()
423 .contains(wgpu::Features::DUAL_SOURCE_BLENDING);
424
425 let mut required_features = wgpu::Features::empty();
426 if dual_source_blending {
427 required_features |= wgpu::Features::DUAL_SOURCE_BLENDING;
428 } else {
429 log::warn!(
430 "Dual-source blending not available on this GPU. \
431 Subpixel text antialiasing will be disabled."
432 );
433 }
434
435 let color_atlas_texture_format = Self::select_color_texture_format(adapter)?;
436 #[cfg(target_family = "wasm")]
437 let required_limits = if adapter.get_info().backend == wgpu::Backend::Gl {
438 wgpu::Limits::downlevel_webgl2_defaults()
439 .using_resolution(adapter.limits())
440 .using_alignment(adapter.limits())
441 } else {
442 wgpu::Limits::downlevel_defaults()
443 .using_resolution(adapter.limits())
444 .using_alignment(adapter.limits())
445 };
446 #[cfg(not(target_family = "wasm"))]
447 let required_limits = wgpu::Limits::downlevel_defaults()
448 .using_resolution(adapter.limits())
449 .using_alignment(adapter.limits());
450
451 let (device, queue) = adapter
452 .request_device(&wgpu::DeviceDescriptor {
453 label: Some("gpui_device"),
454 required_features,
455 required_limits,
456 memory_hints: wgpu::MemoryHints::MemoryUsage,
457 trace: wgpu::Trace::Off,
458 experimental_features: wgpu::ExperimentalFeatures::disabled(),
459 })
460 .await
461 .map_err(|e| anyhow::anyhow!("Failed to create wgpu device: {e}"))?;
462
463 Ok((
464 device,
465 queue,
466 dual_source_blending,
467 color_atlas_texture_format,
468 ))
469 }
470
471 #[cfg(not(target_family = "wasm"))]
472 pub fn instance(display: Option<Box<dyn wgpu::wgt::WgpuHasDisplayHandle>>) -> wgpu::Instance {
473 wgpu::Instance::new(wgpu::InstanceDescriptor {
474 backends: wgpu::Backends::VULKAN | wgpu::Backends::GL,
475 flags: wgpu::InstanceFlags::default(),
476 backend_options: wgpu::BackendOptions::default(),
477 memory_budget_thresholds: wgpu::MemoryBudgetThresholds::default(),
478 display,
479 })
480 }
481
482 pub fn check_compatible_with_surface(&self, surface: &wgpu::Surface<'_>) -> anyhow::Result<()> {
483 let caps = surface.get_capabilities(&self.adapter);
484 if caps.formats.is_empty() {
485 let info = self.adapter.get_info();
486 anyhow::bail!(
487 "Adapter {:?} (backend={:?}, device={:#06x}) is not compatible with the \
488 display surface for this window.",
489 info.name,
490 info.backend,
491 info.device,
492 );
493 }
494 Ok(())
495 }
496
497 /// Select an adapter and create a device, testing that the surface can actually be configured.
498 /// This is the only reliable way to determine compatibility on hybrid GPU systems, where
499 /// adapters may report surface compatibility via get_capabilities() but fail when actually
500 /// configuring (e.g., NVIDIA reporting Vulkan Wayland support but failing because the
501 /// Wayland compositor runs on the Intel GPU).
502 #[cfg(not(target_family = "wasm"))]
503 async fn select_adapter_and_device(
504 instance: &wgpu::Instance,
505 device_id_filter: Option<u32>,
506 surface: &wgpu::Surface<'_>,
507 compositor_gpu: Option<&CompositorGpuHint>,
508 reject_software: bool,
509 ) -> anyhow::Result<(
510 wgpu::Adapter,
511 wgpu::Device,
512 wgpu::Queue,
513 bool,
514 TextureFormat,
515 )> {
516 let mut adapters: Vec<_> = instance.enumerate_adapters(wgpu::Backends::all()).await;
517
518 if adapters.is_empty() {
519 anyhow::bail!("No GPU adapters found");
520 }
521
522 if let Some(device_id) = device_id_filter {
523 log::info!("ZED_DEVICE_ID filter: {:#06x}", device_id);
524 }
525
526 Self::sort_adapters(&mut adapters, device_id_filter, compositor_gpu);
527
528 // Log all available adapters (in sorted order)
529 log::info!("Found {} GPU adapter(s):", adapters.len());
530 for adapter in &adapters {
531 let info = adapter.get_info();
532 log::info!(
533 " - {} (vendor={:#06x}, device={:#06x}, backend={:?}, type={:?})",
534 info.name,
535 info.vendor,
536 info.device,
537 info.backend,
538 info.device_type,
539 );
540 }
541
542 // Test each adapter by creating a device and configuring the surface
543 for adapter in adapters {
544 let info = adapter.get_info();
545
546 if reject_software && info.device_type == wgpu::DeviceType::Cpu {
547 log::info!(
548 "Skipping software renderer: {} ({:?})",
549 info.name,
550 info.backend
551 );
552 continue;
553 }
554
555 log::info!("Testing adapter: {} ({:?})...", info.name, info.backend);
556
557 match Self::try_adapter_with_surface(&adapter, surface).await {
558 Ok((device, queue, dual_source_blending, color_atlas_texture_format)) => {
559 log::info!(
560 "Selected GPU (passed configuration test): {} ({:?})",
561 info.name,
562 info.backend
563 );
564 return Ok((
565 adapter,
566 device,
567 queue,
568 dual_source_blending,
569 color_atlas_texture_format,
570 ));
571 }
572 Err(e) => {
573 log::info!(
574 " Adapter {} ({:?}) failed: {}, trying next...",
575 info.name,
576 info.backend,
577 e
578 );
579 }
580 }
581 }
582
583 anyhow::bail!("No GPU adapter found that can configure the display surface")
584 }
585
586 /// Sort adapters into a single priority order. Tiers (from highest to lowest):
587 ///
588 /// 1. ZED_DEVICE_ID match — explicit user override
589 /// 2. Compositor GPU match — the GPU the display server is rendering on
590 /// 3. Device type (Discrete > Integrated > Other > Virtual > Cpu).
591 /// "Other" ranks above "Virtual" because OpenGL seems to count as "Other".
592 /// 4. Backend — prefer Vulkan/Metal/Dx12 over GL/etc.
593 #[cfg(not(target_family = "wasm"))]
594 fn sort_adapters(
595 adapters: &mut [wgpu::Adapter],
596 device_id_filter: Option<u32>,
597 compositor_gpu: Option<&CompositorGpuHint>,
598 ) {
599 adapters.sort_by_key(|adapter| {
600 let info = adapter.get_info();
601 // Backends like OpenGL report device=0 for all adapters, so
602 // device-based matching is only meaningful when non-zero.
603 let device_known = info.device != 0;
604 let user_override: u8 = match device_id_filter {
605 Some(id) if device_known && info.device == id => 0,
606 _ => 1,
607 };
608 let compositor_match: u8 = match compositor_gpu {
609 Some(hint)
610 if device_known
611 && info.vendor == hint.vendor_id
612 && info.device == hint.device_id =>
613 {
614 0
615 }
616 _ => 1,
617 };
618 let type_priority: u8 = match info.device_type {
619 wgpu::DeviceType::DiscreteGpu => 0,
620 wgpu::DeviceType::IntegratedGpu => 1,
621 wgpu::DeviceType::Other => 2,
622 wgpu::DeviceType::VirtualGpu => 3,
623 wgpu::DeviceType::Cpu => 4,
624 };
625 let backend_priority: u8 = match info.backend {
626 wgpu::Backend::Vulkan | wgpu::Backend::Metal | wgpu::Backend::Dx12 => 0,
627 _ => 1,
628 };
629
630 (
631 user_override,
632 compositor_match,
633 type_priority,
634 backend_priority,
635 )
636 });
637 }
638
639 /// Try to use an adapter with a surface by creating a device and testing configuration.
640 /// Returns the device and queue if successful, allowing them to be reused.
641 #[cfg(not(target_family = "wasm"))]
642 async fn try_adapter_with_surface(
643 adapter: &wgpu::Adapter,
644 surface: &wgpu::Surface<'_>,
645 ) -> anyhow::Result<(wgpu::Device, wgpu::Queue, bool, TextureFormat)> {
646 let caps = surface.get_capabilities(adapter);
647 if caps.formats.is_empty() {
648 anyhow::bail!("no compatible surface formats");
649 }
650 if caps.alpha_modes.is_empty() {
651 anyhow::bail!("no compatible alpha modes");
652 }
653
654 let (device, queue, dual_source_blending, color_atlas_texture_format) =
655 Self::create_device(adapter).await?;
656 let error_scope = device.push_error_scope(wgpu::ErrorFilter::Validation);
657
658 let test_config = wgpu::SurfaceConfiguration {
659 usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
660 format: caps.formats[0],
661 width: 64,
662 height: 64,
663 present_mode: wgpu::PresentMode::Fifo,
664 desired_maximum_frame_latency: 2,
665 alpha_mode: caps.alpha_modes[0],
666 view_formats: vec![],
667 };
668
669 surface.configure(&device, &test_config);
670
671 let error = error_scope.pop().await;
672 if let Some(e) = error {
673 anyhow::bail!("surface configuration failed: {e}");
674 }
675
676 Ok((
677 device,
678 queue,
679 dual_source_blending,
680 color_atlas_texture_format,
681 ))
682 }
683
684 fn select_color_texture_format(adapter: &wgpu::Adapter) -> anyhow::Result<wgpu::TextureFormat> {
685 let required_usages = wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST;
686 let bgra_features = adapter.get_texture_format_features(wgpu::TextureFormat::Bgra8Unorm);
687 let rgba_features = adapter.get_texture_format_features(wgpu::TextureFormat::Rgba8Unorm);
688 #[cfg(target_family = "wasm")]
689 if adapter.get_info().backend == wgpu::Backend::Gl
690 && rgba_features.allowed_usages.contains(required_usages)
691 {
692 return Ok(wgpu::TextureFormat::Rgba8Unorm);
693 }
694 if bgra_features.allowed_usages.contains(required_usages) {
695 return Ok(wgpu::TextureFormat::Bgra8Unorm);
696 }
697 if rgba_features.allowed_usages.contains(required_usages) {
698 let info = adapter.get_info();
699 log::warn!(
700 "Adapter {} ({:?}) does not support Bgra8Unorm atlas textures with usages {:?}; \
701 falling back to Rgba8Unorm atlas textures.",
702 info.name,
703 info.backend,
704 required_usages,
705 );
706 return Ok(wgpu::TextureFormat::Rgba8Unorm);
707 }
708
709 let info = adapter.get_info();
710 Err(anyhow::anyhow!(
711 "Adapter {} ({:?}, device={:#06x}) does not support a usable color atlas texture \
712 format with usages {:?}. Bgra8Unorm allowed usages: {:?}; \
713 Rgba8Unorm allowed usages: {:?}.",
714 info.name,
715 info.backend,
716 info.device,
717 required_usages,
718 bgra_features.allowed_usages,
719 rgba_features.allowed_usages,
720 ))
721 }
722 pub fn backend(&self) -> WgpuBackend {
723 self.backend
724 }
725
726 pub fn uses_webgl_instance_data(&self) -> bool {
727 matches!(self.backend, WgpuBackend::Gl) && cfg!(target_family = "wasm")
728 }
729
730 pub fn supports_dual_source_blending(&self) -> bool {
731 self.dual_source_blending
732 }
733
734 pub fn color_texture_format(&self) -> wgpu::TextureFormat {
735 self.color_texture_format
736 }
737
738 /// Returns true if the GPU device was lost (e.g., due to driver crash, suspend/resume).
739 /// When this returns true, the context should be recreated.
740 pub fn device_lost(&self) -> bool {
741 self.errors.device_lost()
742 }
743
744 /// The device-wide error state, shared with renderers on this device.
745 pub fn errors(&self) -> &Arc<DeviceErrorState> {
746 &self.errors
747 }
748 }
749
750 #[cfg(not(target_family = "wasm"))]
751 fn parse_pci_id(id: &str) -> anyhow::Result<u32> {
752 let mut id = id.trim();
753
754 if id.starts_with("0x") || id.starts_with("0X") {
755 id = &id[2..];
756 }
757 let is_hex_string = id.chars().all(|c| c.is_ascii_hexdigit());
758 let is_4_chars = id.len() == 4;
759 anyhow::ensure!(
760 is_4_chars && is_hex_string,
761 "Expected a 4 digit PCI ID in hexadecimal format"
762 );
763
764 u32::from_str_radix(id, 16).context("parsing PCI ID as hex")
765 }
766
767 #[cfg(test)]
768 mod tests {
769 use super::{DeviceErrorState, parse_pci_id};
770
771 #[test]
772 fn device_errors_are_observed_independently() {
773 let errors = DeviceErrorState::default();
774 let mut first = 0;
775 let mut second = 0;
776 assert_eq!(errors.observe_error(&mut first), None);
777 errors.record("first".into());
778 assert_eq!(errors.observe_error(&mut first).as_deref(), Some("first"));
779 assert_eq!(errors.observe_error(&mut first), None);
780 assert_eq!(errors.observe_error(&mut second).as_deref(), Some("first"));
781 assert_eq!(errors.observe_error(&mut second), None);
782
783 errors.record("second".into());
784 assert_eq!(errors.observe_error(&mut second).as_deref(), Some("second"));
785 assert_eq!(errors.observe_error(&mut first).as_deref(), Some("second"));
786 assert_eq!(errors.observe_error(&mut first), None);
787 assert_eq!(errors.observe_error(&mut second), None);
788 }
789
790 #[test]
791 fn device_errors_coalesce_and_new_observers_see_latest() {
792 let errors = DeviceErrorState::default();
793 errors.record("older".into());
794 errors.record("latest".into());
795 let mut generation = 0;
796 assert_eq!(
797 errors.observe_error(&mut generation).as_deref(),
798 Some("latest")
799 );
800 assert_eq!(errors.observe_error(&mut generation), None);
801
802 let replacement = DeviceErrorState::default();
803 replacement.record("replacement".into());
804 generation = 0;
805 assert_eq!(
806 replacement.observe_error(&mut generation).as_deref(),
807 Some("replacement")
808 );
809 assert_eq!(replacement.observe_error(&mut generation), None);
810 }
811
812 #[test]
813 fn test_parse_device_id() {
814 assert!(parse_pci_id("0xABCD").is_ok());
815 assert!(parse_pci_id("ABCD").is_ok());
816 assert!(parse_pci_id("abcd").is_ok());
817 assert!(parse_pci_id("1234").is_ok());
818 assert!(parse_pci_id("123").is_err());
819 assert_eq!(
820 parse_pci_id(&format!("{:x}", 0x1234)).unwrap(),
821 parse_pci_id(&format!("{:X}", 0x1234)).unwrap(),
822 );
823
824 assert_eq!(
825 parse_pci_id(&format!("{:#x}", 0x1234)).unwrap(),
826 parse_pci_id(&format!("{:#X}", 0x1234)).unwrap(),
827 );
828 }
829 }
@@ -0,0 +1,829 @@
1#[cfg(not(target_family = "wasm"))]
2use anyhow::Context as _;
3#[cfg(not(target_family = "wasm"))]
4use gpui_util::ResultExt;
5use parking_lot::Mutex;
6use std::sync::Arc;
7use std::sync::atomic::{AtomicBool, Ordering};
8use wgpu::TextureFormat;
9
10#[derive(Clone)]
11pub struct WgpuContext {
12 pub instance: wgpu::Instance,
13 pub adapter: wgpu::Adapter,
14 pub device: Arc<wgpu::Device>,
15 pub queue: Arc<wgpu::Queue>,
16 backend: WgpuBackend,
17 dual_source_blending: bool,
18 color_texture_format: wgpu::TextureFormat,
19 errors: Arc<DeviceErrorState>,
20}
21
22/// Errors reported by wgpu's device-wide callbacks.
23///
24/// A device has exactly one lost callback and one uncaptured-error callback, so this
25/// state is installed once per device and shared by every renderer using it. Renderers
26/// keep their own handle so they can keep observing a loss after the context that
27/// produced it has been dropped for recovery.
28#[derive(Default)]
29pub struct DeviceErrorState {
30 lost: AtomicBool,
31 last_error: Mutex<(u64, Option<String>)>,
32}
33
34impl DeviceErrorState {
35 fn install(device: &wgpu::Device) -> Arc<Self> {
36 let errors = Arc::new(Self::default());
37 device.set_device_lost_callback({
38 let errors = Arc::clone(&errors);
39 move |reason, message| {
40 log::error!("wgpu device lost: reason={reason:?}, message={message}");
41 if reason != wgpu::DeviceLostReason::Destroyed {
42 errors.lost.store(true, Ordering::Relaxed);
43 }
44 }
45 });
46 device.on_uncaptured_error(Arc::new({
47 let errors = Arc::clone(&errors);
48 move |error| errors.record(error.to_string())
49 }));
50 errors
51 }
52
53 /// Returns true if the GPU device was lost (e.g., due to driver crash, suspend/resume).
54 pub fn device_lost(&self) -> bool {
55 self.lost.load(Ordering::Relaxed)
56 }
57
58 fn record(&self, error: String) {
59 let mut last_error = self.last_error.lock();
60 last_error.0 = last_error.0.wrapping_add(1);
61 last_error.1 = Some(error);
62 }
63
64 /// Returns the latest error once per observer, without consuming shared state.
65 /// Start each observer at zero, including after switching devices, so errors
66 /// raised during construction are observed. Multiple errors between observations
67 /// coalesce into the latest error; this is not an error queue.
68 pub fn observe_error(&self, generation: &mut u64) -> Option<String> {
69 let last_error = self.last_error.lock();
70 if *generation == last_error.0 {
71 return None;
72 }
73 *generation = last_error.0;
74 last_error.1.clone()
75 }
76
77 /// The generation an observer should start from to see only errors raised after
78 /// this call, for a renderer joining a device other renderers already used.
79 pub fn current_generation(&self) -> u64 {
80 self.last_error.lock().0
81 }
82}
83
84#[derive(Clone, Copy, Debug, Eq, PartialEq)]
85pub enum WgpuBackend {
86 BrowserWebGpu,
87 Gl,
88 Native(wgpu::Backend),
89}
90
91#[cfg(target_family = "wasm")]
92#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
93pub enum WebBackendPreference {
94 #[default]
95 Auto,
96 WebGpu,
97 WebGl,
98}
99
100#[cfg(target_family = "wasm")]
101pub struct PreparedWebGraphics {
102 pub context: WgpuContext,
103 pub surface: wgpu::Surface<'static>,
104}
105
106/// wgpu-core refuses to create a surface when neither the instance nor the surface
107/// target carries a display handle, and `SurfaceTarget::Canvas` always passes `None`.
108/// The WebGL2 backend never reads the handle (WebGPU bypasses wgpu-core entirely), so
109/// a unit web display handle on the instance satisfies the check.
110#[cfg(target_family = "wasm")]
111#[derive(Debug)]
112struct WebDisplaySource;
113
114#[cfg(target_family = "wasm")]
115impl raw_window_handle::HasDisplayHandle for WebDisplaySource {
116 fn display_handle(
117 &self,
118 ) -> Result<raw_window_handle::DisplayHandle<'_>, raw_window_handle::HandleError> {
119 Ok(raw_window_handle::DisplayHandle::web())
120 }
121}
122
123#[derive(Clone, Copy)]
124pub struct CompositorGpuHint {
125 pub vendor_id: u32,
126 pub device_id: u32,
127}
128
129impl WgpuContext {
130 #[cfg(not(target_family = "wasm"))]
131 pub fn new(
132 instance: wgpu::Instance,
133 surface: &wgpu::Surface<'_>,
134 compositor_gpu: Option<CompositorGpuHint>,
135 ) -> anyhow::Result<Self> {
136 Self::new_with_options(instance, surface, compositor_gpu, false)
137 }
138
139 #[cfg(not(target_family = "wasm"))]
140 pub fn new_rejecting_software(
141 instance: wgpu::Instance,
142 surface: &wgpu::Surface<'_>,
143 compositor_gpu: Option<CompositorGpuHint>,
144 ) -> anyhow::Result<Self> {
145 Self::new_with_options(instance, surface, compositor_gpu, true)
146 }
147
148 #[cfg(not(target_family = "wasm"))]
149 fn new_with_options(
150 instance: wgpu::Instance,
151 surface: &wgpu::Surface<'_>,
152 compositor_gpu: Option<CompositorGpuHint>,
153 reject_software: bool,
154 ) -> anyhow::Result<Self> {
155 let device_id_filter = Self::device_id_filter();
156
157 // Select an adapter by actually testing surface configuration with the real device.
158 // This is the only reliable way to determine compatibility on hybrid GPU systems.
159 let (adapter, device, queue, dual_source_blending, color_texture_format) =
160 gpui::block_on(Self::select_adapter_and_device(
161 &instance,
162 device_id_filter,
163 surface,
164 compositor_gpu.as_ref(),
165 reject_software,
166 ))?;
167
168 Ok(Self::from_native_adapter_and_device(
169 instance,
170 adapter,
171 device,
172 queue,
173 dual_source_blending,
174 color_texture_format,
175 ))
176 }
177
178 #[cfg(all(
179 not(target_family = "wasm"),
180 any(test, feature = "bench-support", feature = "test-support")
181 ))]
182 pub(crate) fn new_headless() -> anyhow::Result<(Self, wgpu::TextureFormat)> {
183 // Creating a device takes tens of milliseconds, and benchmarks create a headless
184 // renderer for every window they open, so the process shares one device until it
185 // is lost. A static rather than a thread-local: the cached device is never dropped,
186 // because wgpu's queue reads its own thread-locals on drop and would panic if
187 // dropped while a thread's thread-locals are being destroyed.
188 static HEADLESS: Mutex<Option<(WgpuContext, wgpu::TextureFormat)>> = Mutex::new(None);
189 let mut headless = HEADLESS.lock();
190 if let Some((context, format)) = headless.as_ref()
191 && !context.device_lost()
192 {
193 return Ok((context.clone(), *format));
194 }
195 let created = Self::create_headless()?;
196 *headless = Some(created.clone());
197 Ok(created)
198 }
199
200 #[cfg(all(
201 not(target_family = "wasm"),
202 any(test, feature = "bench-support", feature = "test-support")
203 ))]
204 fn create_headless() -> anyhow::Result<(Self, wgpu::TextureFormat)> {
205 let instance = Self::instance(None);
206 let device_id_filter = Self::device_id_filter();
207 let (adapter, device, queue, dual_source_blending, color_texture_format, target_format) =
208 gpui::block_on(async {
209 let mut adapters = instance.enumerate_adapters(wgpu::Backends::all()).await;
210 Self::sort_adapters(&mut adapters, device_id_filter, None);
211
212 for adapter in adapters {
213 let adapter_info = adapter.get_info();
214 let Some(target_format) = Self::headless_target_format(&adapter) else {
215 log::warn!(
216 "Adapter {:?} has no supported headless render target format",
217 adapter_info.name
218 );
219 continue;
220 };
221
222 match Self::create_device(&adapter).await {
223 Ok((device, queue, dual_source_blending, color_texture_format)) => {
224 #[cfg(feature = "bench-support")]
225 if adapter_info.device_type == wgpu::DeviceType::Cpu {
226 log::error!(
227 "Headless renderer selected software adapter {:?}; \
228 benchmark results measure CPU software rendering, not hardware GPU rendering",
229 adapter_info.name
230 );
231 }
232 return Ok((
233 adapter,
234 device,
235 queue,
236 dual_source_blending,
237 color_texture_format,
238 target_format,
239 ));
240 }
241 Err(error) => {
242 log::warn!(
243 "Failed to create a headless device for adapter {:?}: {error:#}",
244 adapter_info.name
245 );
246 }
247 }
248 }
249
250 anyhow::bail!("No usable headless GPU adapter found")
251 })?;
252
253 Ok((
254 Self::from_native_adapter_and_device(
255 instance,
256 adapter,
257 device,
258 queue,
259 dual_source_blending,
260 color_texture_format,
261 ),
262 target_format,
263 ))
264 }
265
266 #[cfg(all(
267 not(target_family = "wasm"),
268 any(test, feature = "bench-support", feature = "test-support")
269 ))]
270 /// Both candidates are 8-bit RGBA-ordered or BGRA-ordered formats: headless readback
271 /// copies rows as 4 bytes per pixel and only swizzles, so no other formats may be added
272 /// here without updating it.
273 fn headless_target_format(adapter: &wgpu::Adapter) -> Option<wgpu::TextureFormat> {
274 let required_usages =
275 wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC;
276 [
277 wgpu::TextureFormat::Rgba8Unorm,
278 wgpu::TextureFormat::Bgra8Unorm,
279 ]
280 .into_iter()
281 .find(|format| {
282 adapter
283 .get_texture_format_features(*format)
284 .allowed_usages
285 .contains(required_usages)
286 })
287 }
288
289 #[cfg(not(target_family = "wasm"))]
290 fn from_native_adapter_and_device(
291 instance: wgpu::Instance,
292 adapter: wgpu::Adapter,
293 device: wgpu::Device,
294 queue: wgpu::Queue,
295 dual_source_blending: bool,
296 color_texture_format: TextureFormat,
297 ) -> Self {
298 let errors = DeviceErrorState::install(&device);
299
300 log::info!(
301 "Selected GPU adapter: {:?} ({:?})",
302 adapter.get_info().name,
303 adapter.get_info().backend
304 );
305 let backend = WgpuBackend::Native(adapter.get_info().backend);
306
307 Self {
308 instance,
309 adapter,
310 device: Arc::new(device),
311 queue: Arc::new(queue),
312 backend,
313 dual_source_blending,
314 color_texture_format,
315 errors,
316 }
317 }
318
319 #[cfg(not(target_family = "wasm"))]
320 fn device_id_filter() -> Option<u32> {
321 match std::env::var("ZED_DEVICE_ID") {
322 Ok(value) => parse_pci_id(&value)
323 .context("Failed to parse device ID from `ZED_DEVICE_ID` environment variable")
324 .log_err(),
325 Err(std::env::VarError::NotPresent) => None,
326 error => {
327 error
328 .context("Failed to read value of `ZED_DEVICE_ID` environment variable")
329 .log_err();
330 None
331 }
332 }
333 }
334
335 #[cfg(target_family = "wasm")]
336 pub async fn new_web(
337 canvas: &web_sys::HtmlCanvasElement,
338 preference: WebBackendPreference,
339 ) -> anyhow::Result<PreparedWebGraphics> {
340 Self::new_web_with_backend(canvas, preference).await
341 }
342
343 #[cfg(target_family = "wasm")]
344 #[allow(clippy::arc_with_non_send_sync)]
345 async fn new_web_with_backend(
346 canvas: &web_sys::HtmlCanvasElement,
347 preference: WebBackendPreference,
348 ) -> anyhow::Result<PreparedWebGraphics> {
349 let backends = match preference {
350 WebBackendPreference::Auto => wgpu::Backends::BROWSER_WEBGPU | wgpu::Backends::GL,
351 WebBackendPreference::WebGpu => wgpu::Backends::BROWSER_WEBGPU,
352 WebBackendPreference::WebGl => wgpu::Backends::GL,
353 };
354 let descriptor = wgpu::InstanceDescriptor {
355 backends,
356 flags: wgpu::InstanceFlags::default(),
357 backend_options: wgpu::BackendOptions::default(),
358 memory_budget_thresholds: wgpu::MemoryBudgetThresholds::default(),
359 display: Some(Box::new(WebDisplaySource)),
360 };
361 let instance = if preference == WebBackendPreference::Auto {
362 wgpu::util::new_instance_with_webgpu_detection(descriptor).await
363 } else {
364 wgpu::Instance::new(descriptor)
365 };
366 let surface = instance
367 .create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))
368 .map_err(|error| {
369 anyhow::anyhow!("Failed to create browser graphics surface: {error}")
370 })?;
371
372 let adapter = instance
373 .request_adapter(&wgpu::RequestAdapterOptions {
374 power_preference: wgpu::PowerPreference::HighPerformance,
375 compatible_surface: Some(&surface),
376 force_fallback_adapter: false,
377 })
378 .await
379 .map_err(|error| {
380 anyhow::anyhow!(
381 "Failed to request a {preference:?} adapter compatible with the canvas: {error}"
382 )
383 })?;
384 let adapter_info = adapter.get_info();
385 let backend = match adapter_info.backend {
386 wgpu::Backend::BrowserWebGpu => WgpuBackend::BrowserWebGpu,
387 wgpu::Backend::Gl => WgpuBackend::Gl,
388 backend => {
389 anyhow::bail!(
390 "Browser graphics initialization selected unexpected backend {backend:?}"
391 )
392 }
393 };
394
395 let (device, queue, dual_source_blending, color_texture_format) =
396 Self::create_device(&adapter).await?;
397 let errors = DeviceErrorState::install(&device);
398 log::info!(
399 "Browser graphics initialized: requested={preference:?}, selected={backend:?}, \
400 adapter={:?}, limits={:?}, dual_source_blending={dual_source_blending}",
401 adapter_info.name,
402 device.limits(),
403 );
404
405 let context = Self {
406 instance,
407 adapter,
408 device: Arc::new(device),
409 queue: Arc::new(queue),
410 backend,
411 dual_source_blending,
412 color_texture_format,
413 errors,
414 };
415 Ok(PreparedWebGraphics { context, surface })
416 }
417
418 async fn create_device(
419 adapter: &wgpu::Adapter,
420 ) -> anyhow::Result<(wgpu::Device, wgpu::Queue, bool, TextureFormat)> {
421 let dual_source_blending = adapter
422 .features()
423 .contains(wgpu::Features::DUAL_SOURCE_BLENDING);
424
425 let mut required_features = wgpu::Features::empty();
426 if dual_source_blending {
427 required_features |= wgpu::Features::DUAL_SOURCE_BLENDING;
428 } else {
429 log::warn!(
430 "Dual-source blending not available on this GPU. \
431 Subpixel text antialiasing will be disabled."
432 );
433 }
434
435 let color_atlas_texture_format = Self::select_color_texture_format(adapter)?;
436 #[cfg(target_family = "wasm")]
437 let required_limits = if adapter.get_info().backend == wgpu::Backend::Gl {
438 wgpu::Limits::downlevel_webgl2_defaults()
439 .using_resolution(adapter.limits())
440 .using_alignment(adapter.limits())
441 } else {
442 wgpu::Limits::downlevel_defaults()
443 .using_resolution(adapter.limits())
444 .using_alignment(adapter.limits())
445 };
446 #[cfg(not(target_family = "wasm"))]
447 let required_limits = wgpu::Limits::downlevel_defaults()
448 .using_resolution(adapter.limits())
449 .using_alignment(adapter.limits());
450
451 let (device, queue) = adapter
452 .request_device(&wgpu::DeviceDescriptor {
453 label: Some("gpui_device"),
454 required_features,
455 required_limits,
456 memory_hints: wgpu::MemoryHints::MemoryUsage,
457 trace: wgpu::Trace::Off,
458 experimental_features: wgpu::ExperimentalFeatures::disabled(),
459 })
460 .await
461 .map_err(|e| anyhow::anyhow!("Failed to create wgpu device: {e}"))?;
462
463 Ok((
464 device,
465 queue,
466 dual_source_blending,
467 color_atlas_texture_format,
468 ))
469 }
470
471 #[cfg(not(target_family = "wasm"))]
472 pub fn instance(display: Option<Box<dyn wgpu::wgt::WgpuHasDisplayHandle>>) -> wgpu::Instance {
473 wgpu::Instance::new(wgpu::InstanceDescriptor {
474 backends: wgpu::Backends::VULKAN | wgpu::Backends::GL,
475 flags: wgpu::InstanceFlags::default(),
476 backend_options: wgpu::BackendOptions::default(),
477 memory_budget_thresholds: wgpu::MemoryBudgetThresholds::default(),
478 display,
479 })
480 }
481
482 pub fn check_compatible_with_surface(&self, surface: &wgpu::Surface<'_>) -> anyhow::Result<()> {
483 let caps = surface.get_capabilities(&self.adapter);
484 if caps.formats.is_empty() {
485 let info = self.adapter.get_info();
486 anyhow::bail!(
487 "Adapter {:?} (backend={:?}, device={:#06x}) is not compatible with the \
488 display surface for this window.",
489 info.name,
490 info.backend,
491 info.device,
492 );
493 }
494 Ok(())
495 }
496
497 /// Select an adapter and create a device, testing that the surface can actually be configured.
498 /// This is the only reliable way to determine compatibility on hybrid GPU systems, where
499 /// adapters may report surface compatibility via get_capabilities() but fail when actually
500 /// configuring (e.g., NVIDIA reporting Vulkan Wayland support but failing because the
501 /// Wayland compositor runs on the Intel GPU).
502 #[cfg(not(target_family = "wasm"))]
503 async fn select_adapter_and_device(
504 instance: &wgpu::Instance,
505 device_id_filter: Option<u32>,
506 surface: &wgpu::Surface<'_>,
507 compositor_gpu: Option<&CompositorGpuHint>,
508 reject_software: bool,
509 ) -> anyhow::Result<(
510 wgpu::Adapter,
511 wgpu::Device,
512 wgpu::Queue,
513 bool,
514 TextureFormat,
515 )> {
516 let mut adapters: Vec<_> = instance.enumerate_adapters(wgpu::Backends::all()).await;
517
518 if adapters.is_empty() {
519 anyhow::bail!("No GPU adapters found");
520 }
521
522 if let Some(device_id) = device_id_filter {
523 log::info!("ZED_DEVICE_ID filter: {:#06x}", device_id);
524 }
525
526 Self::sort_adapters(&mut adapters, device_id_filter, compositor_gpu);
527
528 // Log all available adapters (in sorted order)
529 log::info!("Found {} GPU adapter(s):", adapters.len());
530 for adapter in &adapters {
531 let info = adapter.get_info();
532 log::info!(
533 " - {} (vendor={:#06x}, device={:#06x}, backend={:?}, type={:?})",
534 info.name,
535 info.vendor,
536 info.device,
537 info.backend,
538 info.device_type,
539 );
540 }
541
542 // Test each adapter by creating a device and configuring the surface
543 for adapter in adapters {
544 let info = adapter.get_info();
545
546 if reject_software && info.device_type == wgpu::DeviceType::Cpu {
547 log::info!(
548 "Skipping software renderer: {} ({:?})",
549 info.name,
550 info.backend
551 );
552 continue;
553 }
554
555 log::info!("Testing adapter: {} ({:?})...", info.name, info.backend);
556
557 match Self::try_adapter_with_surface(&adapter, surface).await {
558 Ok((device, queue, dual_source_blending, color_atlas_texture_format)) => {
559 log::info!(
560 "Selected GPU (passed configuration test): {} ({:?})",
561 info.name,
562 info.backend
563 );
564 return Ok((
565 adapter,
566 device,
567 queue,
568 dual_source_blending,
569 color_atlas_texture_format,
570 ));
571 }
572 Err(e) => {
573 log::info!(
574 " Adapter {} ({:?}) failed: {}, trying next...",
575 info.name,
576 info.backend,
577 e
578 );
579 }
580 }
581 }
582
583 anyhow::bail!("No GPU adapter found that can configure the display surface")
584 }
585
586 /// Sort adapters into a single priority order. Tiers (from highest to lowest):
587 ///
588 /// 1. ZED_DEVICE_ID match — explicit user override
589 /// 2. Compositor GPU match — the GPU the display server is rendering on
590 /// 3. Device type (Discrete > Integrated > Other > Virtual > Cpu).
591 /// "Other" ranks above "Virtual" because OpenGL seems to count as "Other".
592 /// 4. Backend — prefer Vulkan/Metal/Dx12 over GL/etc.
593 #[cfg(not(target_family = "wasm"))]
594 fn sort_adapters(
595 adapters: &mut [wgpu::Adapter],
596 device_id_filter: Option<u32>,
597 compositor_gpu: Option<&CompositorGpuHint>,
598 ) {
599 adapters.sort_by_key(|adapter| {
600 let info = adapter.get_info();
601 // Backends like OpenGL report device=0 for all adapters, so
602 // device-based matching is only meaningful when non-zero.
603 let device_known = info.device != 0;
604 let user_override: u8 = match device_id_filter {
605 Some(id) if device_known && info.device == id => 0,
606 _ => 1,
607 };
608 let compositor_match: u8 = match compositor_gpu {
609 Some(hint)
610 if device_known
611 && info.vendor == hint.vendor_id
612 && info.device == hint.device_id =>
613 {
614 0
615 }
616 _ => 1,
617 };
618 let type_priority: u8 = match info.device_type {
619 wgpu::DeviceType::DiscreteGpu => 0,
620 wgpu::DeviceType::IntegratedGpu => 1,
621 wgpu::DeviceType::Other => 2,
622 wgpu::DeviceType::VirtualGpu => 3,
623 wgpu::DeviceType::Cpu => 4,
624 };
625 let backend_priority: u8 = match info.backend {
626 wgpu::Backend::Vulkan | wgpu::Backend::Metal | wgpu::Backend::Dx12 => 0,
627 _ => 1,
628 };
629
630 (
631 user_override,
632 compositor_match,
633 type_priority,
634 backend_priority,
635 )
636 });
637 }
638
639 /// Try to use an adapter with a surface by creating a device and testing configuration.
640 /// Returns the device and queue if successful, allowing them to be reused.
641 #[cfg(not(target_family = "wasm"))]
642 async fn try_adapter_with_surface(
643 adapter: &wgpu::Adapter,
644 surface: &wgpu::Surface<'_>,
645 ) -> anyhow::Result<(wgpu::Device, wgpu::Queue, bool, TextureFormat)> {
646 let caps = surface.get_capabilities(adapter);
647 if caps.formats.is_empty() {
648 anyhow::bail!("no compatible surface formats");
649 }
650 if caps.alpha_modes.is_empty() {
651 anyhow::bail!("no compatible alpha modes");
652 }
653
654 let (device, queue, dual_source_blending, color_atlas_texture_format) =
655 Self::create_device(adapter).await?;
656 let error_scope = device.push_error_scope(wgpu::ErrorFilter::Validation);
657
658 let test_config = wgpu::SurfaceConfiguration {
659 usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
660 format: caps.formats[0],
661 width: 64,
662 height: 64,
663 present_mode: wgpu::PresentMode::Fifo,
664 desired_maximum_frame_latency: 2,
665 alpha_mode: caps.alpha_modes[0],
666 view_formats: vec![],
667 };
668
669 surface.configure(&device, &test_config);
670
671 let error = error_scope.pop().await;
672 if let Some(e) = error {
673 anyhow::bail!("surface configuration failed: {e}");
674 }
675
676 Ok((
677 device,
678 queue,
679 dual_source_blending,
680 color_atlas_texture_format,
681 ))
682 }
683
684 fn select_color_texture_format(adapter: &wgpu::Adapter) -> anyhow::Result<wgpu::TextureFormat> {
685 let required_usages = wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST;
686 let bgra_features = adapter.get_texture_format_features(wgpu::TextureFormat::Bgra8Unorm);
687 let rgba_features = adapter.get_texture_format_features(wgpu::TextureFormat::Rgba8Unorm);
688 #[cfg(target_family = "wasm")]
689 if adapter.get_info().backend == wgpu::Backend::Gl
690 && rgba_features.allowed_usages.contains(required_usages)
691 {
692 return Ok(wgpu::TextureFormat::Rgba8Unorm);
693 }
694 if bgra_features.allowed_usages.contains(required_usages) {
695 return Ok(wgpu::TextureFormat::Bgra8Unorm);
696 }
697 if rgba_features.allowed_usages.contains(required_usages) {
698 let info = adapter.get_info();
699 log::warn!(
700 "Adapter {} ({:?}) does not support Bgra8Unorm atlas textures with usages {:?}; \
701 falling back to Rgba8Unorm atlas textures.",
702 info.name,
703 info.backend,
704 required_usages,
705 );
706 return Ok(wgpu::TextureFormat::Rgba8Unorm);
707 }
708
709 let info = adapter.get_info();
710 Err(anyhow::anyhow!(
711 "Adapter {} ({:?}, device={:#06x}) does not support a usable color atlas texture \
712 format with usages {:?}. Bgra8Unorm allowed usages: {:?}; \
713 Rgba8Unorm allowed usages: {:?}.",
714 info.name,
715 info.backend,
716 info.device,
717 required_usages,
718 bgra_features.allowed_usages,
719 rgba_features.allowed_usages,
720 ))
721 }
722 pub fn backend(&self) -> WgpuBackend {
723 self.backend
724 }
725
726 pub fn uses_webgl_instance_data(&self) -> bool {
727 matches!(self.backend, WgpuBackend::Gl) && cfg!(target_family = "wasm")
728 }
729
730 pub fn supports_dual_source_blending(&self) -> bool {
731 self.dual_source_blending
732 }
733
734 pub fn color_texture_format(&self) -> wgpu::TextureFormat {
735 self.color_texture_format
736 }
737
738 /// Returns true if the GPU device was lost (e.g., due to driver crash, suspend/resume).
739 /// When this returns true, the context should be recreated.
740 pub fn device_lost(&self) -> bool {
741 self.errors.device_lost()
742 }
743
744 /// The device-wide error state, shared with renderers on this device.
745 pub fn errors(&self) -> &Arc<DeviceErrorState> {
746 &self.errors
747 }
748}
749
750#[cfg(not(target_family = "wasm"))]
751fn parse_pci_id(id: &str) -> anyhow::Result<u32> {
752 let mut id = id.trim();
753
754 if id.starts_with("0x") || id.starts_with("0X") {
755 id = &id[2..];
756 }
757 let is_hex_string = id.chars().all(|c| c.is_ascii_hexdigit());
758 let is_4_chars = id.len() == 4;
759 anyhow::ensure!(
760 is_4_chars && is_hex_string,
761 "Expected a 4 digit PCI ID in hexadecimal format"
762 );
763
764 u32::from_str_radix(id, 16).context("parsing PCI ID as hex")
765}
766
767#[cfg(test)]
768mod tests {
769 use super::{DeviceErrorState, parse_pci_id};
770
771 #[test]
772 fn device_errors_are_observed_independently() {
773 let errors = DeviceErrorState::default();
774 let mut first = 0;
775 let mut second = 0;
776 assert_eq!(errors.observe_error(&mut first), None);
777 errors.record("first".into());
778 assert_eq!(errors.observe_error(&mut first).as_deref(), Some("first"));
779 assert_eq!(errors.observe_error(&mut first), None);
780 assert_eq!(errors.observe_error(&mut second).as_deref(), Some("first"));
781 assert_eq!(errors.observe_error(&mut second), None);
782
783 errors.record("second".into());
784 assert_eq!(errors.observe_error(&mut second).as_deref(), Some("second"));
785 assert_eq!(errors.observe_error(&mut first).as_deref(), Some("second"));
786 assert_eq!(errors.observe_error(&mut first), None);
787 assert_eq!(errors.observe_error(&mut second), None);
788 }
789
790 #[test]
791 fn device_errors_coalesce_and_new_observers_see_latest() {
792 let errors = DeviceErrorState::default();
793 errors.record("older".into());
794 errors.record("latest".into());
795 let mut generation = 0;
796 assert_eq!(
797 errors.observe_error(&mut generation).as_deref(),
798 Some("latest")
799 );
800 assert_eq!(errors.observe_error(&mut generation), None);
801
802 let replacement = DeviceErrorState::default();
803 replacement.record("replacement".into());
804 generation = 0;
805 assert_eq!(
806 replacement.observe_error(&mut generation).as_deref(),
807 Some("replacement")
808 );
809 assert_eq!(replacement.observe_error(&mut generation), None);
810 }
811
812 #[test]
813 fn test_parse_device_id() {
814 assert!(parse_pci_id("0xABCD").is_ok());
815 assert!(parse_pci_id("ABCD").is_ok());
816 assert!(parse_pci_id("abcd").is_ok());
817 assert!(parse_pci_id("1234").is_ok());
818 assert!(parse_pci_id("123").is_err());
819 assert_eq!(
820 parse_pci_id(&format!("{:x}", 0x1234)).unwrap(),
821 parse_pci_id(&format!("{:X}", 0x1234)).unwrap(),
822 );
823
824 assert_eq!(
825 parse_pci_id(&format!("{:#x}", 0x1234)).unwrap(),
826 parse_pci_id(&format!("{:#X}", 0x1234)).unwrap(),
827 );
828 }
829}
vendor/gpui-pre-wgpu/src/wgpu_renderer.rs added +2929 −0
@@ -0,0 +1,2929 @@
1 use crate::{CompositorGpuHint, DeviceErrorState, WgpuAtlas, WgpuContext};
2 use anyhow::{Context as _, Result};
3 use bytemuck::{Pod, Zeroable};
4 use collections::FxHashMap;
5 use gpui::{
6 AtlasTextureId, Background, Bounds, DevicePixels, GpuSpecs, Path, Point, PrimitiveBatch,
7 ScaledPixels, Scene, Size, get_gamma_correction_ratios,
8 };
9 use log::warn;
10 #[cfg(not(target_family = "wasm"))]
11 use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
12 use smallvec::SmallVec;
13 use std::cell::RefCell;
14 use std::num::NonZeroU64;
15 use std::ops::Range;
16 use std::rc::Rc;
17 use std::sync::Arc;
18
19 const MAX_INSTANCE_BUFFER_SIZE: u64 = 256 * 1024 * 1024;
20
21 const INSTANCE_TEXTURE_TEXEL_SIZE: u64 = 16;
22
23 /// Shader variant for backends with storage buffer support: the shared shader
24 /// logic plus the storage-buffer instance transport.
25 const STORAGE_BUFFER_SHADERS: &str = concat!(
26 include_str!("shaders.wgsl"),
27 include_str!("shaders_storage.wgsl"),
28 );
29
30 /// Shader variant for WebGL2, which has no storage buffers: the shared shader
31 /// logic plus the texture-based instance transport.
32 const WEBGL_SHADERS: &str = concat!(
33 include_str!("shaders.wgsl"),
34 include_str!("shaders_webgl.wgsl"),
35 );
36
37 /// Subpixel text rendering requires dual-source blending, which WebGL2 lacks, so
38 /// this variant only ever runs with the storage-buffer transport. The `enable`
39 /// directive must precede all declarations.
40 const SUBPIXEL_SHADERS: &str = concat!(
41 "enable dual_source_blending;\n",
42 include_str!("shaders.wgsl"),
43 include_str!("shaders_storage.wgsl"),
44 include_str!("shaders_subpixel.wgsl"),
45 );
46
47 fn least_common_multiple(left: u64, right: u64) -> u64 {
48 let mut first = left;
49 let mut second = right;
50 while second != 0 {
51 let remainder = first % second;
52 first = second;
53 second = remainder;
54 }
55 left / first * right
56 }
57
58 #[repr(C)]
59 #[derive(Clone, Copy, Pod, Zeroable)]
60 struct GlobalParams {
61 viewport_size: [f32; 2],
62 premultiplied_alpha: u32,
63 pad: u32,
64 }
65
66 #[repr(C)]
67 #[derive(Clone, Copy, Pod, Zeroable)]
68 struct PodBounds {
69 origin: [f32; 2],
70 size: [f32; 2],
71 }
72
73 impl From<Bounds<ScaledPixels>> for PodBounds {
74 fn from(bounds: Bounds<ScaledPixels>) -> Self {
75 Self {
76 origin: [bounds.origin.x.0, bounds.origin.y.0],
77 size: [bounds.size.width.0, bounds.size.height.0],
78 }
79 }
80 }
81
82 #[repr(C)]
83 #[derive(Clone, Copy, Pod, Zeroable)]
84 struct SurfaceParams {
85 bounds: PodBounds,
86 content_mask: PodBounds,
87 }
88
89 #[repr(C)]
90 #[derive(Clone, Copy, Pod, Zeroable)]
91 struct GammaParams {
92 gamma_ratios: [f32; 4],
93 grayscale_enhanced_contrast: f32,
94 subpixel_enhanced_contrast: f32,
95 is_bgr: u32,
96 _pad: u32,
97 }
98
99 #[derive(Clone, Debug)]
100 #[repr(C)]
101 struct PathSprite {
102 bounds: Bounds<ScaledPixels>,
103 }
104
105 #[derive(Clone, Debug)]
106 #[repr(C)]
107 struct PathRasterizationVertex {
108 xy_position: Point<ScaledPixels>,
109 st_position: Point<f32>,
110 color: Background,
111 bounds: Bounds<ScaledPixels>,
112 }
113
114 pub struct WgpuSurfaceConfig {
115 pub size: Size<DevicePixels>,
116 pub transparent: bool,
117 /// Preferred presentation mode. When `Some`, the renderer will use this
118 /// mode if supported by the surface, falling back to `Fifo`.
119 /// When `None`, defaults to `Fifo` (VSync).
120 ///
121 /// Mobile platforms may prefer `Mailbox` (triple-buffering) to avoid
122 /// blocking in `get_current_texture()` during lifecycle transitions.
123 pub preferred_present_mode: Option<wgpu::PresentMode>,
124 }
125
126 struct WgpuPipelines {
127 quads: wgpu::RenderPipeline,
128 shadows: wgpu::RenderPipeline,
129 path_rasterization: wgpu::RenderPipeline,
130 paths: wgpu::RenderPipeline,
131 underlines: wgpu::RenderPipeline,
132 mono_sprites: wgpu::RenderPipeline,
133 subpixel_sprites: Option<wgpu::RenderPipeline>,
134 poly_sprites: wgpu::RenderPipeline,
135 #[allow(dead_code)]
136 surfaces: wgpu::RenderPipeline,
137 }
138
139 /// One frame allocation of instance data, ready to bind.
140 struct InstanceBinding {
141 bind_group: wgpu::BindGroup,
142 /// Index of the allocation's first instance within the bound data. Always
143 /// zero on the storage-buffer path, where the binding offset already
144 /// positions the array; on the WebGL texture path the shader indexes the
145 /// shared instance texture absolutely, so draws must offset their
146 /// instance (or vertex) ranges by this value.
147 first_instance: u32,
148 }
149
150 struct InstanceBindings {
151 quads: InstanceBinding,
152 shadows: InstanceBinding,
153 underlines: InstanceBinding,
154 monochrome_sprites: InstanceBinding,
155 subpixel_sprites: InstanceBinding,
156 polychrome_sprites: InstanceBinding,
157 }
158
159 struct WgpuBindGroupLayouts {
160 globals: wgpu::BindGroupLayout,
161 instances: wgpu::BindGroupLayout,
162 texture: wgpu::BindGroupLayout,
163 surfaces: wgpu::BindGroupLayout,
164 }
165
166 /// Shared GPU context reference, used to coordinate device recovery across multiple windows.
167 pub type GpuContext = Rc<RefCell<Option<WgpuContext>>>;
168
169 enum InstanceData {
170 Storage(wgpu::Buffer),
171 // WebGL2 has no storage buffers. A uint texture keeps the records available to both shader
172 // stages while preserving integer and floating-point bit patterns exactly.
173 Texture {
174 texture: wgpu::Texture,
175 view: wgpu::TextureView,
176 width: u32,
177 height: u32,
178 },
179 }
180
181 /// GPU resources that must be dropped together during device recovery.
182 struct WgpuResources {
183 device: Arc<wgpu::Device>,
184 queue: Arc<wgpu::Queue>,
185 pipelines: WgpuPipelines,
186 bind_group_layouts: WgpuBindGroupLayouts,
187 atlas_sampler: wgpu::Sampler,
188 atlas_texture_bind_groups: FxHashMap<AtlasTextureId, CachedTextureBindGroup>,
189 globals_buffer: wgpu::Buffer,
190 globals_bind_group: wgpu::BindGroup,
191 path_globals_bind_group: wgpu::BindGroup,
192 instance_data: InstanceData,
193 path_intermediate_texture: Option<wgpu::Texture>,
194 path_intermediate_view: Option<wgpu::TextureView>,
195 path_msaa_texture: Option<wgpu::Texture>,
196 path_msaa_view: Option<wgpu::TextureView>,
197 }
198
199 struct CachedTextureBindGroup {
200 texture_generation: u64,
201 bind_group: wgpu::BindGroup,
202 }
203
204 impl WgpuResources {
205 fn invalidate_intermediate_textures(&mut self) {
206 self.path_intermediate_texture = None;
207 self.path_intermediate_view = None;
208 self.path_msaa_texture = None;
209 self.path_msaa_view = None;
210 }
211 }
212
213 struct WgpuRendererCore {
214 resources: WgpuResources,
215 atlas: Arc<WgpuAtlas>,
216 path_globals_offset: u64,
217 gamma_offset: u64,
218 instance_data_capacity: u64,
219 max_instance_data_size: u64,
220 instance_data_alignment: u64,
221 uses_webgl_instance_data: bool,
222 rendering_params: RenderingParameters,
223 is_bgr: bool,
224 dual_source_blending: bool,
225 adapter_info: wgpu::AdapterInfo,
226 target_format: wgpu::TextureFormat,
227 max_texture_size: u32,
228 }
229
230 /// GPU resources of a windowed renderer. A surface is only ever configured against the
231 /// device that owns `core`, so it cannot outlive it: there is no surface-only state.
232 enum RendererState {
233 /// Frames can be drawn.
234 Ready {
235 surface: wgpu::Surface<'static>,
236 core: WgpuRendererCore,
237 },
238 /// The native surface is gone (Android `TerminateWindow`, browser context loss) but
239 /// the device, pipelines, and atlas remain so `replace_surface` can resume without
240 /// re-uploading cached textures.
241 Unconfigured { core: WgpuRendererCore },
242 /// Released by `destroy`, or dropped for a device recovery that has not succeeded yet.
243 Released,
244 }
245
246 pub struct WgpuRenderer {
247 /// Shared GPU context for device recovery coordination (unused on WASM).
248 #[allow(dead_code)]
249 context: Option<GpuContext>,
250 /// Compositor GPU hint for adapter selection (unused on WASM).
251 #[allow(dead_code)]
252 compositor_gpu: Option<CompositorGpuHint>,
253 state: RendererState,
254 surface_config: wgpu::SurfaceConfiguration,
255 atlas: Arc<WgpuAtlas>,
256 transparent_alpha_mode: wgpu::CompositeAlphaMode,
257 opaque_alpha_mode: wgpu::CompositeAlphaMode,
258 max_texture_size: u32,
259 is_bgr: bool,
260 failed_frame_count: u32,
261 device_errors: Arc<DeviceErrorState>,
262 observed_error_generation: u64,
263 last_surface_error: Option<String>,
264 needs_redraw: bool,
265 }
266
267 impl WgpuRenderer {
268 fn core(&self) -> Option<&WgpuRendererCore> {
269 match &self.state {
270 RendererState::Ready { core, .. } | RendererState::Unconfigured { core } => Some(core),
271 RendererState::Released => None,
272 }
273 }
274
275 fn core_mut(&mut self) -> Option<&mut WgpuRendererCore> {
276 match &mut self.state {
277 RendererState::Ready { core, .. } | RendererState::Unconfigured { core } => Some(core),
278 RendererState::Released => None,
279 }
280 }
281
282 /// Creates a new WgpuRenderer from raw window handles.
283 ///
284 /// The `gpu_context` is a shared reference that coordinates GPU context across
285 /// multiple windows. The first window to create a renderer will initialize the
286 /// context; subsequent windows will share it.
287 ///
288 /// # Safety
289 /// The caller must ensure that the window handle remains valid for the lifetime
290 /// of the returned renderer.
291 #[cfg(not(target_family = "wasm"))]
292 pub fn new<W>(
293 gpu_context: GpuContext,
294 window: &W,
295 config: WgpuSurfaceConfig,
296 compositor_gpu: Option<CompositorGpuHint>,
297 ) -> anyhow::Result<Self>
298 where
299 W: HasWindowHandle + HasDisplayHandle + std::fmt::Debug + Send + Sync + Clone + 'static,
300 {
301 let window_handle = window
302 .window_handle()
303 .map_err(|e| anyhow::anyhow!("Failed to get window handle: {e}"))?;
304
305 let target = wgpu::SurfaceTargetUnsafe::RawHandle {
306 // Fall back to the display handle already provided via InstanceDescriptor::display.
307 raw_display_handle: None,
308 raw_window_handle: window_handle.as_raw(),
309 };
310
311 // Use the existing context's instance if available, otherwise create a new one.
312 // The surface must be created with the same instance that will be used for
313 // adapter selection, otherwise wgpu will panic.
314 let instance = gpu_context
315 .borrow()
316 .as_ref()
317 .map(|ctx| ctx.instance.clone())
318 .unwrap_or_else(|| WgpuContext::instance(Some(Box::new(window.clone()))));
319
320 // Safety: The caller guarantees that the window handle is valid for the
321 // lifetime of this renderer. In practice, the RawWindow struct is created
322 // from the native window handles and the surface is dropped before the window.
323 let surface = unsafe {
324 instance
325 .create_surface_unsafe(target)
326 .map_err(|e| anyhow::anyhow!("Failed to create surface: {e}"))?
327 };
328
329 let mut ctx_ref = gpu_context.borrow_mut();
330 let context = match ctx_ref.as_mut() {
331 Some(context) => {
332 context.check_compatible_with_surface(&surface)?;
333 context
334 }
335 None => ctx_ref.insert(WgpuContext::new(instance, &surface, compositor_gpu)?),
336 };
337
338 let atlas = Arc::new(WgpuAtlas::from_context(context));
339
340 Self::new_internal(
341 Some(Rc::clone(&gpu_context)),
342 context,
343 surface,
344 config,
345 compositor_gpu,
346 atlas,
347 )
348 }
349
350 #[cfg(target_family = "wasm")]
351 pub fn new_from_canvas(
352 context: &WgpuContext,
353 canvas: &web_sys::HtmlCanvasElement,
354 config: WgpuSurfaceConfig,
355 ) -> anyhow::Result<Self> {
356 let surface = context
357 .instance
358 .create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))
359 .map_err(|e| anyhow::anyhow!("Failed to create surface: {e}"))?;
360 Self::new_from_surface(context, surface, config)
361 }
362
363 #[cfg(target_family = "wasm")]
364 #[allow(clippy::arc_with_non_send_sync)]
365 pub fn new_from_surface(
366 context: &WgpuContext,
367 surface: wgpu::Surface<'static>,
368 config: WgpuSurfaceConfig,
369 ) -> anyhow::Result<Self> {
370 let atlas = Arc::new(WgpuAtlas::from_context(context));
371 Self::new_internal(None, context, surface, config, None, atlas)
372 }
373
374 fn new_internal(
375 gpu_context: Option<GpuContext>,
376 context: &WgpuContext,
377 surface: wgpu::Surface<'static>,
378 config: WgpuSurfaceConfig,
379 compositor_gpu: Option<CompositorGpuHint>,
380 atlas: Arc<WgpuAtlas>,
381 ) -> anyhow::Result<Self> {
382 let surface_caps = surface.get_capabilities(&context.adapter);
383 let preferred_formats = [
384 wgpu::TextureFormat::Bgra8Unorm,
385 wgpu::TextureFormat::Rgba8Unorm,
386 ];
387 let surface_format = preferred_formats
388 .iter()
389 .find(|f| surface_caps.formats.contains(f))
390 .copied()
391 .or_else(|| surface_caps.formats.iter().find(|f| !f.is_srgb()).copied())
392 .or_else(|| surface_caps.formats.first().copied())
393 .ok_or_else(|| {
394 anyhow::anyhow!(
395 "Surface reports no supported texture formats for adapter {:?}",
396 context.adapter.get_info().name
397 )
398 })?;
399
400 let pick_alpha_mode =
401 |preferences: &[wgpu::CompositeAlphaMode]| -> anyhow::Result<wgpu::CompositeAlphaMode> {
402 preferences
403 .iter()
404 .find(|p| surface_caps.alpha_modes.contains(p))
405 .copied()
406 .or_else(|| surface_caps.alpha_modes.first().copied())
407 .ok_or_else(|| {
408 anyhow::anyhow!(
409 "Surface reports no supported alpha modes for adapter {:?}",
410 context.adapter.get_info().name
411 )
412 })
413 };
414
415 let transparent_alpha_mode = pick_alpha_mode(&[
416 wgpu::CompositeAlphaMode::PreMultiplied,
417 wgpu::CompositeAlphaMode::Inherit,
418 ])?;
419
420 let opaque_alpha_mode = pick_alpha_mode(&[
421 wgpu::CompositeAlphaMode::Opaque,
422 wgpu::CompositeAlphaMode::Inherit,
423 ])?;
424
425 let alpha_mode = if config.transparent {
426 transparent_alpha_mode
427 } else {
428 opaque_alpha_mode
429 };
430
431 let device = Arc::clone(&context.device);
432 let max_texture_size = device.limits().max_texture_dimension_2d;
433
434 let requested_width = config.size.width.0 as u32;
435 let requested_height = config.size.height.0 as u32;
436 let clamped_width = requested_width.min(max_texture_size);
437 let clamped_height = requested_height.min(max_texture_size);
438
439 if clamped_width != requested_width || clamped_height != requested_height {
440 warn!(
441 "Requested surface size ({}, {}) exceeds maximum texture dimension {}. \
442 Clamping to ({}, {}). Window content may not fill the entire window.",
443 requested_width, requested_height, max_texture_size, clamped_width, clamped_height
444 );
445 }
446
447 let surface_config = wgpu::SurfaceConfiguration {
448 usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
449 format: surface_format,
450 width: clamped_width.max(1),
451 height: clamped_height.max(1),
452 present_mode: config
453 .preferred_present_mode
454 .filter(|mode| surface_caps.present_modes.contains(mode))
455 .unwrap_or(wgpu::PresentMode::Fifo),
456 desired_maximum_frame_latency: 2,
457 alpha_mode,
458 view_formats: vec![],
459 };
460 // Configure the surface immediately. The adapter selection process already validated
461 // that this adapter can successfully configure this surface.
462 surface.configure(&context.device, &surface_config);
463
464 let core = WgpuRendererCore::new(context, atlas.clone(), surface_format, alpha_mode);
465
466 Ok(Self {
467 context: gpu_context,
468 compositor_gpu,
469 state: RendererState::Ready { surface, core },
470 surface_config,
471 atlas,
472 transparent_alpha_mode,
473 opaque_alpha_mode,
474 max_texture_size,
475 is_bgr: false,
476 failed_frame_count: 0,
477 device_errors: Arc::clone(context.errors()),
478 observed_error_generation: 0,
479 last_surface_error: None,
480 needs_redraw: false,
481 })
482 }
483 }
484
485 impl WgpuRendererCore {
486 fn create_bind_group_layouts(
487 device: &wgpu::Device,
488 uses_webgl_instance_data: bool,
489 ) -> WgpuBindGroupLayouts {
490 let globals =
491 device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
492 label: Some("globals_layout"),
493 entries: &[
494 wgpu::BindGroupLayoutEntry {
495 binding: 0,
496 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
497 ty: wgpu::BindingType::Buffer {
498 ty: wgpu::BufferBindingType::Uniform,
499 has_dynamic_offset: false,
500 min_binding_size: NonZeroU64::new(
501 std::mem::size_of::<GlobalParams>() as u64
502 ),
503 },
504 count: None,
505 },
506 wgpu::BindGroupLayoutEntry {
507 binding: 1,
508 visibility: wgpu::ShaderStages::FRAGMENT,
509 ty: wgpu::BindingType::Buffer {
510 ty: wgpu::BufferBindingType::Uniform,
511 has_dynamic_offset: false,
512 min_binding_size: NonZeroU64::new(
513 std::mem::size_of::<GammaParams>() as u64
514 ),
515 },
516 count: None,
517 },
518 ],
519 });
520
521 let instance_data_entry = wgpu::BindGroupLayoutEntry {
522 binding: 0,
523 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
524 ty: if uses_webgl_instance_data {
525 wgpu::BindingType::Texture {
526 sample_type: wgpu::TextureSampleType::Uint,
527 view_dimension: wgpu::TextureViewDimension::D2,
528 multisampled: false,
529 }
530 } else {
531 wgpu::BindingType::Buffer {
532 ty: wgpu::BufferBindingType::Storage { read_only: true },
533 has_dynamic_offset: false,
534 min_binding_size: None,
535 }
536 },
537 count: None,
538 };
539
540 let instances = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
541 label: Some("instances_layout"),
542 entries: &[instance_data_entry],
543 });
544
545 let texture = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
546 label: Some("texture_layout"),
547 entries: &[
548 wgpu::BindGroupLayoutEntry {
549 binding: 0,
550 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
551 ty: wgpu::BindingType::Texture {
552 sample_type: wgpu::TextureSampleType::Float { filterable: true },
553 view_dimension: wgpu::TextureViewDimension::D2,
554 multisampled: false,
555 },
556 count: None,
557 },
558 wgpu::BindGroupLayoutEntry {
559 binding: 1,
560 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
561 ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
562 count: None,
563 },
564 ],
565 });
566
567 let surfaces = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
568 label: Some("surfaces_layout"),
569 entries: &[
570 wgpu::BindGroupLayoutEntry {
571 binding: 0,
572 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
573 ty: wgpu::BindingType::Buffer {
574 ty: wgpu::BufferBindingType::Uniform,
575 has_dynamic_offset: false,
576 min_binding_size: NonZeroU64::new(
577 std::mem::size_of::<SurfaceParams>() as u64
578 ),
579 },
580 count: None,
581 },
582 wgpu::BindGroupLayoutEntry {
583 binding: 1,
584 visibility: wgpu::ShaderStages::FRAGMENT,
585 ty: wgpu::BindingType::Texture {
586 sample_type: wgpu::TextureSampleType::Float { filterable: true },
587 view_dimension: wgpu::TextureViewDimension::D2,
588 multisampled: false,
589 },
590 count: None,
591 },
592 wgpu::BindGroupLayoutEntry {
593 binding: 2,
594 visibility: wgpu::ShaderStages::FRAGMENT,
595 ty: wgpu::BindingType::Texture {
596 sample_type: wgpu::TextureSampleType::Float { filterable: true },
597 view_dimension: wgpu::TextureViewDimension::D2,
598 multisampled: false,
599 },
600 count: None,
601 },
602 wgpu::BindGroupLayoutEntry {
603 binding: 3,
604 visibility: wgpu::ShaderStages::FRAGMENT,
605 ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
606 count: None,
607 },
608 ],
609 });
610
611 WgpuBindGroupLayouts {
612 globals,
613 instances,
614 texture,
615 surfaces,
616 }
617 }
618
619 fn create_instance_texture(
620 device: &wgpu::Device,
621 requested_capacity: u64,
622 max_texture_dimension: u32,
623 ) -> (InstanceData, u64) {
624 let texel_count = requested_capacity.div_ceil(INSTANCE_TEXTURE_TEXEL_SIZE);
625 let width = texel_count.min(u64::from(max_texture_dimension)).max(1) as u32;
626 let height = texel_count
627 .div_ceil(u64::from(width))
628 .min(u64::from(max_texture_dimension))
629 .max(1) as u32;
630 let texture = device.create_texture(&wgpu::TextureDescriptor {
631 label: Some("instance_texture"),
632 size: wgpu::Extent3d {
633 width,
634 height,
635 depth_or_array_layers: 1,
636 },
637 mip_level_count: 1,
638 sample_count: 1,
639 dimension: wgpu::TextureDimension::D2,
640 format: wgpu::TextureFormat::Rgba32Uint,
641 usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
642 view_formats: &[],
643 });
644 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
645 let capacity = u64::from(width) * u64::from(height) * INSTANCE_TEXTURE_TEXEL_SIZE;
646 (
647 InstanceData::Texture {
648 texture,
649 view,
650 width,
651 height,
652 },
653 capacity,
654 )
655 }
656
657 fn create_pipelines(
658 device: &wgpu::Device,
659 layouts: &WgpuBindGroupLayouts,
660 surface_format: wgpu::TextureFormat,
661 alpha_mode: wgpu::CompositeAlphaMode,
662 path_sample_count: u32,
663 dual_source_blending: bool,
664 uses_webgl_instance_data: bool,
665 ) -> WgpuPipelines {
666 // Diagnostic guard: verify the device actually has
667 // DUAL_SOURCE_BLENDING. We have a crash report (ZED-5G1) where a
668 // feature mismatch caused a wgpu-hal abort, but we haven't
669 // identified the code path that produces the mismatch. This
670 // guard prevents the crash and logs more evidence.
671 // Remove this check once:
672 // a) We find and fix the root cause, or
673 // b) There are no reports of this warning appearing for some time.
674 let device_has_feature = device
675 .features()
676 .contains(wgpu::Features::DUAL_SOURCE_BLENDING);
677 if dual_source_blending && !device_has_feature {
678 log::error!(
679 "BUG: dual_source_blending flag is true but device does not \
680 have DUAL_SOURCE_BLENDING enabled (device features: {:?}). \
681 Falling back to mono text rendering. Please report this at \
682 https://github.com/zed-industries/zed/issues",
683 device.features(),
684 );
685 }
686 let dual_source_blending =
687 dual_source_blending && device_has_feature && !uses_webgl_instance_data;
688
689 let shader_source = if uses_webgl_instance_data {
690 WEBGL_SHADERS
691 } else {
692 STORAGE_BUFFER_SHADERS
693 };
694 let shader_module = device.create_shader_module(wgpu::ShaderModuleDescriptor {
695 label: Some("gpui_shaders"),
696 source: wgpu::ShaderSource::Wgsl(shader_source.into()),
697 });
698
699 let subpixel_shader_module = if dual_source_blending {
700 Some(device.create_shader_module(wgpu::ShaderModuleDescriptor {
701 label: Some("gpui_subpixel_shaders"),
702 source: wgpu::ShaderSource::Wgsl(SUBPIXEL_SHADERS.into()),
703 }))
704 } else {
705 None
706 };
707
708 let blend_mode = match alpha_mode {
709 wgpu::CompositeAlphaMode::PreMultiplied => {
710 wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING
711 }
712 _ => wgpu::BlendState::ALPHA_BLENDING,
713 };
714
715 let color_target = wgpu::ColorTargetState {
716 format: surface_format,
717 blend: Some(blend_mode),
718 write_mask: wgpu::ColorWrites::ALL,
719 };
720
721 let create_pipeline = |name: &str,
722 vs_entry: &str,
723 fs_entry: &str,
724 globals_layout: &wgpu::BindGroupLayout,
725 data_layout: &wgpu::BindGroupLayout,
726 texture_layout: Option<&wgpu::BindGroupLayout>,
727 topology: wgpu::PrimitiveTopology,
728 color_targets: &[Option<wgpu::ColorTargetState>],
729 sample_count: u32,
730 module: &wgpu::ShaderModule| {
731 let mut bind_group_layouts = vec![Some(globals_layout), Some(data_layout)];
732 bind_group_layouts.extend(texture_layout.map(Some));
733 let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
734 label: Some(&format!("{name}_layout")),
735 bind_group_layouts: &bind_group_layouts,
736 immediate_size: 0,
737 });
738
739 device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
740 label: Some(name),
741 layout: Some(&pipeline_layout),
742 vertex: wgpu::VertexState {
743 module,
744 entry_point: Some(vs_entry),
745 buffers: &[],
746 compilation_options: wgpu::PipelineCompilationOptions::default(),
747 },
748 fragment: Some(wgpu::FragmentState {
749 module,
750 entry_point: Some(fs_entry),
751 targets: color_targets,
752 compilation_options: wgpu::PipelineCompilationOptions::default(),
753 }),
754 primitive: wgpu::PrimitiveState {
755 topology,
756 strip_index_format: None,
757 front_face: wgpu::FrontFace::Ccw,
758 cull_mode: None,
759 polygon_mode: wgpu::PolygonMode::Fill,
760 unclipped_depth: false,
761 conservative: false,
762 },
763 depth_stencil: None,
764 multisample: wgpu::MultisampleState {
765 count: sample_count,
766 mask: !0,
767 alpha_to_coverage_enabled: false,
768 },
769 multiview_mask: None,
770 cache: None,
771 })
772 };
773
774 let quads = create_pipeline(
775 "quads",
776 "vs_quad",
777 "fs_quad",
778 &layouts.globals,
779 &layouts.instances,
780 None,
781 wgpu::PrimitiveTopology::TriangleStrip,
782 &[Some(color_target.clone())],
783 1,
784 &shader_module,
785 );
786
787 let shadows = create_pipeline(
788 "shadows",
789 "vs_shadow",
790 "fs_shadow",
791 &layouts.globals,
792 &layouts.instances,
793 None,
794 wgpu::PrimitiveTopology::TriangleStrip,
795 &[Some(color_target.clone())],
796 1,
797 &shader_module,
798 );
799
800 let path_rasterization = create_pipeline(
801 "path_rasterization",
802 "vs_path_rasterization",
803 "fs_path_rasterization",
804 &layouts.globals,
805 &layouts.instances,
806 None,
807 wgpu::PrimitiveTopology::TriangleList,
808 &[Some(wgpu::ColorTargetState {
809 format: surface_format,
810 blend: Some(wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING),
811 write_mask: wgpu::ColorWrites::ALL,
812 })],
813 path_sample_count,
814 &shader_module,
815 );
816
817 let paths_blend = wgpu::BlendState {
818 color: wgpu::BlendComponent {
819 src_factor: wgpu::BlendFactor::One,
820 dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
821 operation: wgpu::BlendOperation::Add,
822 },
823 alpha: wgpu::BlendComponent {
824 src_factor: wgpu::BlendFactor::One,
825 dst_factor: wgpu::BlendFactor::One,
826 operation: wgpu::BlendOperation::Add,
827 },
828 };
829
830 let paths = create_pipeline(
831 "paths",
832 "vs_path",
833 "fs_path",
834 &layouts.globals,
835 &layouts.instances,
836 Some(&layouts.texture),
837 wgpu::PrimitiveTopology::TriangleStrip,
838 &[Some(wgpu::ColorTargetState {
839 format: surface_format,
840 blend: Some(paths_blend),
841 write_mask: wgpu::ColorWrites::ALL,
842 })],
843 1,
844 &shader_module,
845 );
846
847 let underlines = create_pipeline(
848 "underlines",
849 "vs_underline",
850 "fs_underline",
851 &layouts.globals,
852 &layouts.instances,
853 None,
854 wgpu::PrimitiveTopology::TriangleStrip,
855 &[Some(color_target.clone())],
856 1,
857 &shader_module,
858 );
859
860 let mono_sprites = create_pipeline(
861 "mono_sprites",
862 "vs_mono_sprite",
863 "fs_mono_sprite",
864 &layouts.globals,
865 &layouts.instances,
866 Some(&layouts.texture),
867 wgpu::PrimitiveTopology::TriangleStrip,
868 &[Some(color_target.clone())],
869 1,
870 &shader_module,
871 );
872
873 let subpixel_sprites = if let Some(subpixel_module) = &subpixel_shader_module {
874 let subpixel_blend = wgpu::BlendState {
875 color: wgpu::BlendComponent {
876 src_factor: wgpu::BlendFactor::Src1,
877 dst_factor: wgpu::BlendFactor::OneMinusSrc1,
878 operation: wgpu::BlendOperation::Add,
879 },
880 alpha: wgpu::BlendComponent {
881 src_factor: wgpu::BlendFactor::One,
882 dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
883 operation: wgpu::BlendOperation::Add,
884 },
885 };
886
887 Some(create_pipeline(
888 "subpixel_sprites",
889 "vs_subpixel_sprite",
890 "fs_subpixel_sprite",
891 &layouts.globals,
892 &layouts.instances,
893 Some(&layouts.texture),
894 wgpu::PrimitiveTopology::TriangleStrip,
895 &[Some(wgpu::ColorTargetState {
896 format: surface_format,
897 blend: Some(subpixel_blend),
898 write_mask: wgpu::ColorWrites::COLOR,
899 })],
900 1,
901 subpixel_module,
902 ))
903 } else {
904 None
905 };
906
907 let poly_sprites = create_pipeline(
908 "poly_sprites",
909 "vs_poly_sprite",
910 "fs_poly_sprite",
911 &layouts.globals,
912 &layouts.instances,
913 Some(&layouts.texture),
914 wgpu::PrimitiveTopology::TriangleStrip,
915 &[Some(color_target.clone())],
916 1,
917 &shader_module,
918 );
919
920 let surfaces = create_pipeline(
921 "surfaces",
922 "vs_surface",
923 "fs_surface",
924 &layouts.globals,
925 &layouts.surfaces,
926 None,
927 wgpu::PrimitiveTopology::TriangleStrip,
928 &[Some(color_target)],
929 1,
930 &shader_module,
931 );
932
933 WgpuPipelines {
934 quads,
935 shadows,
936 path_rasterization,
937 paths,
938 underlines,
939 mono_sprites,
940 subpixel_sprites,
941 poly_sprites,
942 surfaces,
943 }
944 }
945
946 fn create_path_intermediate(
947 device: &wgpu::Device,
948 format: wgpu::TextureFormat,
949 width: u32,
950 height: u32,
951 ) -> (wgpu::Texture, wgpu::TextureView) {
952 let texture = device.create_texture(&wgpu::TextureDescriptor {
953 label: Some("path_intermediate"),
954 size: wgpu::Extent3d {
955 width: width.max(1),
956 height: height.max(1),
957 depth_or_array_layers: 1,
958 },
959 mip_level_count: 1,
960 sample_count: 1,
961 dimension: wgpu::TextureDimension::D2,
962 format,
963 usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING,
964 view_formats: &[],
965 });
966 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
967 (texture, view)
968 }
969
970 fn create_msaa_if_needed(
971 device: &wgpu::Device,
972 format: wgpu::TextureFormat,
973 width: u32,
974 height: u32,
975 sample_count: u32,
976 ) -> Option<(wgpu::Texture, wgpu::TextureView)> {
977 if sample_count <= 1 {
978 return None;
979 }
980 let texture = device.create_texture(&wgpu::TextureDescriptor {
981 label: Some("path_msaa"),
982 size: wgpu::Extent3d {
983 width: width.max(1),
984 height: height.max(1),
985 depth_or_array_layers: 1,
986 },
987 mip_level_count: 1,
988 sample_count,
989 dimension: wgpu::TextureDimension::D2,
990 format,
991 usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
992 view_formats: &[],
993 });
994 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
995 Some((texture, view))
996 }
997 }
998
999 impl WgpuRenderer {
1000 /// Records the new drawable size and reconfigures the surface when one is present.
1001 /// The size is kept even without GPU resources so that recovery restores it.
1002 pub fn update_drawable_size(&mut self, size: Size<DevicePixels>) {
1003 let width = size.width.0 as u32;
1004 let height = size.height.0 as u32;
1005
1006 if width == self.surface_config.width && height == self.surface_config.height {
1007 return;
1008 }
1009
1010 let clamped_width = width.min(self.max_texture_size);
1011 let clamped_height = height.min(self.max_texture_size);
1012 if clamped_width != width || clamped_height != height {
1013 warn!(
1014 "Requested surface size ({}, {}) exceeds maximum texture dimension {}. \
1015 Clamping to ({}, {}). Window content may not fill the entire window.",
1016 width, height, self.max_texture_size, clamped_width, clamped_height
1017 );
1018 }
1019 self.surface_config.width = clamped_width.max(1);
1020 self.surface_config.height = clamped_height.max(1);
1021
1022 let Some(core) = self.core_mut() else {
1023 return;
1024 };
1025 let resources = &mut core.resources;
1026
1027 // Wait for any in-flight GPU work to complete before destroying textures
1028 if let Err(e) = resources.device.poll(wgpu::PollType::Wait {
1029 submission_index: None,
1030 timeout: None,
1031 }) {
1032 warn!("Failed to poll device during resize: {e:?}");
1033 }
1034
1035 // Destroy old textures before allocating new ones to avoid GPU memory spikes
1036 if let Some(ref texture) = resources.path_intermediate_texture {
1037 texture.destroy();
1038 }
1039 if let Some(ref texture) = resources.path_msaa_texture {
1040 texture.destroy();
1041 }
1042
1043 // Invalidate intermediate textures - they will be lazily recreated
1044 // in draw() after we confirm the surface is healthy. This avoids
1045 // panics when the device/surface is in an invalid state during resize.
1046 resources.invalidate_intermediate_textures();
1047
1048 if let RendererState::Ready { surface, core } = &self.state {
1049 surface.configure(&core.resources.device, &self.surface_config);
1050 }
1051 }
1052
1053 pub fn set_subpixel_layout(&mut self, is_bgr: bool) {
1054 self.is_bgr = is_bgr;
1055 if let Some(core) = self.core_mut() {
1056 core.is_bgr = is_bgr;
1057 }
1058 }
1059
1060 pub fn update_transparency(&mut self, transparent: bool) {
1061 let new_alpha_mode = if transparent {
1062 self.transparent_alpha_mode
1063 } else {
1064 self.opaque_alpha_mode
1065 };
1066 if new_alpha_mode == self.surface_config.alpha_mode {
1067 return;
1068 }
1069 self.surface_config.alpha_mode = new_alpha_mode;
1070 let format = self.surface_config.format;
1071
1072 let Some(core) = self.core_mut() else {
1073 return;
1074 };
1075 let resources = &mut core.resources;
1076 resources.pipelines = WgpuRendererCore::create_pipelines(
1077 &resources.device,
1078 &resources.bind_group_layouts,
1079 format,
1080 new_alpha_mode,
1081 core.rendering_params.path_sample_count,
1082 core.dual_source_blending,
1083 core.uses_webgl_instance_data,
1084 );
1085
1086 if let RendererState::Ready { surface, core } = &self.state {
1087 surface.configure(&core.resources.device, &self.surface_config);
1088 }
1089 }
1090
1091 #[allow(dead_code)]
1092 pub fn viewport_size(&self) -> Size<DevicePixels> {
1093 Size {
1094 width: DevicePixels(self.surface_config.width as i32),
1095 height: DevicePixels(self.surface_config.height as i32),
1096 }
1097 }
1098
1099 pub fn sprite_atlas(&self) -> &Arc<WgpuAtlas> {
1100 &self.atlas
1101 }
1102
1103 pub fn supports_dual_source_blending(&self) -> bool {
1104 self.core().is_some_and(|core| core.dual_source_blending)
1105 }
1106
1107 /// Returns `None` once GPU resources have been released by `destroy` or a pending
1108 /// device recovery.
1109 pub fn gpu_specs(&self) -> Option<GpuSpecs> {
1110 let adapter_info = &self.core()?.adapter_info;
1111 Some(GpuSpecs {
1112 is_software_emulated: adapter_info.device_type == wgpu::DeviceType::Cpu,
1113 device_name: adapter_info.name.clone(),
1114 driver_name: adapter_info.driver.clone(),
1115 driver_info: adapter_info.driver_info.clone(),
1116 })
1117 }
1118
1119 pub fn max_texture_size(&self) -> u32 {
1120 self.max_texture_size
1121 }
1122
1123 pub fn draw(&mut self, scene: &Scene) -> bool {
1124 #[cfg(target_family = "wasm")]
1125 if self.device_lost() {
1126 if matches!(self.state, RendererState::Ready { .. }) {
1127 log::error!(
1128 "Browser graphics context was lost; rendering has stopped. Reload the page to recover."
1129 );
1130 self.unconfigure_surface();
1131 }
1132 return false;
1133 }
1134
1135 // Bail out early if the surface has been unconfigured (e.g. during
1136 // Android background/rotation transitions). Attempting to acquire
1137 // a texture from an unconfigured surface can block indefinitely on
1138 // some drivers (Adreno).
1139 let RendererState::Ready { surface, core } = &mut self.state else {
1140 return false;
1141 };
1142
1143 if let Some(error) = self.last_surface_error.take().or_else(|| {
1144 self.device_errors
1145 .observe_error(&mut self.observed_error_generation)
1146 }) {
1147 self.failed_frame_count += 1;
1148 log::error!(
1149 "GPU error during frame (failure {} of 10): {error}",
1150 self.failed_frame_count
1151 );
1152
1153 // TBD. Does retrying more actually help?
1154 if self.failed_frame_count > 10 {
1155 panic!("Too many consecutive GPU errors. Last error: {error}");
1156 } else if self.failed_frame_count > 5 {
1157 core.resources.invalidate_intermediate_textures();
1158 self.atlas.clear();
1159 self.needs_redraw = true;
1160 self.failed_frame_count = 0;
1161 return false;
1162 }
1163 } else {
1164 self.failed_frame_count = 0;
1165 }
1166
1167 let frame = match surface.get_current_texture() {
1168 wgpu::CurrentSurfaceTexture::Success(frame) => frame,
1169 wgpu::CurrentSurfaceTexture::Suboptimal(frame) => {
1170 // Textures must be destroyed before the surface can be reconfigured.
1171 drop(frame);
1172 surface.configure(&core.resources.device, &self.surface_config);
1173 return false;
1174 }
1175 wgpu::CurrentSurfaceTexture::Lost | wgpu::CurrentSurfaceTexture::Outdated => {
1176 surface.configure(&core.resources.device, &self.surface_config);
1177 return false;
1178 }
1179 wgpu::CurrentSurfaceTexture::Timeout | wgpu::CurrentSurfaceTexture::Occluded => {
1180 return false;
1181 }
1182 wgpu::CurrentSurfaceTexture::Validation => {
1183 self.last_surface_error = Some("Surface texture validation error".to_string());
1184 return false;
1185 }
1186 };
1187
1188 // The acquired texture is the authority on frame dimensions; the surface
1189 // configuration is only a request.
1190 let size = Size {
1191 width: DevicePixels(frame.texture.width() as i32),
1192 height: DevicePixels(frame.texture.height() as i32),
1193 };
1194 let frame_view = frame
1195 .texture
1196 .create_view(&wgpu::TextureViewDescriptor::default());
1197 let premultiplied_alpha =
1198 self.surface_config.alpha_mode == wgpu::CompositeAlphaMode::PreMultiplied;
1199 if let Err(error) = core.render_frame(
1200 scene,
1201 &frame_view,
1202 size,
1203 premultiplied_alpha,
1204 wgpu::Color::TRANSPARENT,
1205 ) {
1206 log::error!("{error:#}");
1207 return false;
1208 }
1209
1210 frame.present();
1211 true
1212 }
1213 }
1214
1215 impl WgpuRendererCore {
1216 fn new(
1217 context: &WgpuContext,
1218 atlas: Arc<WgpuAtlas>,
1219 target_format: wgpu::TextureFormat,
1220 alpha_mode: wgpu::CompositeAlphaMode,
1221 ) -> Self {
1222 let device = Arc::clone(&context.device);
1223 let queue = Arc::clone(&context.queue);
1224 let rendering_params = RenderingParameters::new(&context.adapter, target_format);
1225 let uses_webgl_instance_data = context.uses_webgl_instance_data();
1226 let dual_source_blending =
1227 context.supports_dual_source_blending() && !uses_webgl_instance_data;
1228 let bind_group_layouts = Self::create_bind_group_layouts(&device, uses_webgl_instance_data);
1229 let pipelines = Self::create_pipelines(
1230 &device,
1231 &bind_group_layouts,
1232 target_format,
1233 alpha_mode,
1234 rendering_params.path_sample_count,
1235 dual_source_blending,
1236 uses_webgl_instance_data,
1237 );
1238 let atlas_sampler = device.create_sampler(&wgpu::SamplerDescriptor {
1239 label: Some("atlas_sampler"),
1240 mag_filter: wgpu::FilterMode::Linear,
1241 min_filter: wgpu::FilterMode::Linear,
1242 ..Default::default()
1243 });
1244 let uniform_alignment = device.limits().min_uniform_buffer_offset_alignment as u64;
1245 let globals_size = std::mem::size_of::<GlobalParams>() as u64;
1246 let gamma_size = std::mem::size_of::<GammaParams>() as u64;
1247 let path_globals_offset = globals_size.next_multiple_of(uniform_alignment);
1248 let gamma_offset = (path_globals_offset + globals_size).next_multiple_of(uniform_alignment);
1249 let globals_buffer = device.create_buffer(&wgpu::BufferDescriptor {
1250 label: Some("globals_buffer"),
1251 size: gamma_offset + gamma_size,
1252 usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
1253 mapped_at_creation: false,
1254 });
1255 let (
1256 instance_data,
1257 instance_data_capacity,
1258 max_instance_data_size,
1259 instance_data_alignment,
1260 ) = if uses_webgl_instance_data {
1261 let max_texture_dimension = device.limits().max_texture_dimension_2d;
1262 let max_instance_data_size = (u64::from(max_texture_dimension).pow(2)
1263 * INSTANCE_TEXTURE_TEXEL_SIZE)
1264 .min(MAX_INSTANCE_BUFFER_SIZE);
1265 let initial_capacity = (2 * 1024 * 1024).min(max_instance_data_size);
1266 let (instance_data, capacity) =
1267 Self::create_instance_texture(&device, initial_capacity, max_texture_dimension);
1268 (
1269 instance_data,
1270 capacity,
1271 max_instance_data_size,
1272 INSTANCE_TEXTURE_TEXEL_SIZE,
1273 )
1274 } else {
1275 let max_buffer_size = device
1276 .limits()
1277 .max_buffer_size
1278 .min(device.limits().max_storage_buffer_binding_size)
1279 .min(MAX_INSTANCE_BUFFER_SIZE);
1280 let initial_capacity = (2 * 1024 * 1024).min(max_buffer_size);
1281 let buffer = device.create_buffer(&wgpu::BufferDescriptor {
1282 label: Some("instance_buffer"),
1283 size: initial_capacity,
1284 usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST,
1285 mapped_at_creation: false,
1286 });
1287 (
1288 InstanceData::Storage(buffer),
1289 initial_capacity,
1290 max_buffer_size,
1291 device.limits().min_storage_buffer_offset_alignment as u64,
1292 )
1293 };
1294 let globals_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
1295 label: Some("globals_bind_group"),
1296 layout: &bind_group_layouts.globals,
1297 entries: &[
1298 wgpu::BindGroupEntry {
1299 binding: 0,
1300 resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1301 buffer: &globals_buffer,
1302 offset: 0,
1303 size: NonZeroU64::new(globals_size),
1304 }),
1305 },
1306 wgpu::BindGroupEntry {
1307 binding: 1,
1308 resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1309 buffer: &globals_buffer,
1310 offset: gamma_offset,
1311 size: NonZeroU64::new(gamma_size),
1312 }),
1313 },
1314 ],
1315 });
1316 let path_globals_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
1317 label: Some("path_globals_bind_group"),
1318 layout: &bind_group_layouts.globals,
1319 entries: &[
1320 wgpu::BindGroupEntry {
1321 binding: 0,
1322 resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1323 buffer: &globals_buffer,
1324 offset: path_globals_offset,
1325 size: NonZeroU64::new(globals_size),
1326 }),
1327 },
1328 wgpu::BindGroupEntry {
1329 binding: 1,
1330 resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1331 buffer: &globals_buffer,
1332 offset: gamma_offset,
1333 size: NonZeroU64::new(gamma_size),
1334 }),
1335 },
1336 ],
1337 });
1338 let max_texture_size = device.limits().max_texture_dimension_2d;
1339
1340 Self {
1341 resources: WgpuResources {
1342 device,
1343 queue,
1344 pipelines,
1345 bind_group_layouts,
1346 atlas_sampler,
1347 atlas_texture_bind_groups: FxHashMap::default(),
1348 globals_buffer,
1349 globals_bind_group,
1350 path_globals_bind_group,
1351 instance_data,
1352 path_intermediate_texture: None,
1353 path_intermediate_view: None,
1354 path_msaa_texture: None,
1355 path_msaa_view: None,
1356 },
1357 atlas,
1358 path_globals_offset,
1359 gamma_offset,
1360 instance_data_capacity,
1361 max_instance_data_size,
1362 instance_data_alignment,
1363 uses_webgl_instance_data,
1364 rendering_params,
1365 is_bgr: false,
1366 dual_source_blending,
1367 adapter_info: context.adapter.get_info(),
1368 target_format,
1369 max_texture_size,
1370 }
1371 }
1372
1373 fn resources(&self) -> &WgpuResources {
1374 &self.resources
1375 }
1376
1377 fn resources_mut(&mut self) -> &mut WgpuResources {
1378 &mut self.resources
1379 }
1380
1381 /// Path rendering goes through an intermediate texture that must match the frame
1382 /// target's dimensions, so the textures are keyed by size and rebuilt on mismatch.
1383 fn ensure_intermediate_textures(&mut self, size: Size<DevicePixels>) {
1384 let width = size.width.0 as u32;
1385 let height = size.height.0 as u32;
1386 if self
1387 .resources
1388 .path_intermediate_texture
1389 .as_ref()
1390 .is_some_and(|texture| texture.width() == width && texture.height() == height)
1391 {
1392 return;
1393 }
1394
1395 let format = self.target_format;
1396 let path_sample_count = self.rendering_params.path_sample_count;
1397 let resources = &mut self.resources;
1398
1399 let (texture, view) =
1400 Self::create_path_intermediate(&resources.device, format, width, height);
1401 resources.path_intermediate_texture = Some(texture);
1402 resources.path_intermediate_view = Some(view);
1403
1404 let (path_msaa_texture, path_msaa_view) = Self::create_msaa_if_needed(
1405 &resources.device,
1406 format,
1407 width,
1408 height,
1409 path_sample_count,
1410 )
1411 .map(|(texture, view)| (Some(texture), Some(view)))
1412 .unwrap_or((None, None));
1413 resources.path_msaa_texture = path_msaa_texture;
1414 resources.path_msaa_view = path_msaa_view;
1415 }
1416
1417 fn render_frame(
1418 &mut self,
1419 scene: &Scene,
1420 target_view: &wgpu::TextureView,
1421 size: Size<DevicePixels>,
1422 premultiplied_alpha: bool,
1423 clear_color: wgpu::Color,
1424 ) -> Result<wgpu::SubmissionIndex> {
1425 anyhow::ensure!(
1426 size.width.0 > 0 && size.height.0 > 0,
1427 "invalid render target size: {size:?}"
1428 );
1429 anyhow::ensure!(
1430 size.width.0 as u32 <= self.max_texture_size
1431 && size.height.0 as u32 <= self.max_texture_size,
1432 "render target size {size:?} exceeds maximum texture dimension {}",
1433 self.max_texture_size
1434 );
1435
1436 self.atlas.before_frame();
1437 self.ensure_intermediate_textures(size);
1438
1439 let gamma_params = GammaParams {
1440 gamma_ratios: self.rendering_params.gamma_ratios,
1441 grayscale_enhanced_contrast: self.rendering_params.grayscale_enhanced_contrast,
1442 subpixel_enhanced_contrast: self.rendering_params.subpixel_enhanced_contrast,
1443 is_bgr: self.is_bgr as u32,
1444 _pad: 0,
1445 };
1446 let globals = GlobalParams {
1447 viewport_size: [size.width.0 as f32, size.height.0 as f32],
1448 premultiplied_alpha: premultiplied_alpha as u32,
1449 pad: 0,
1450 };
1451 let path_globals = GlobalParams {
1452 premultiplied_alpha: 0,
1453 ..globals
1454 };
1455 self.resources.queue.write_buffer(
1456 &self.resources.globals_buffer,
1457 0,
1458 bytemuck::bytes_of(&globals),
1459 );
1460 self.resources.queue.write_buffer(
1461 &self.resources.globals_buffer,
1462 self.path_globals_offset,
1463 bytemuck::bytes_of(&path_globals),
1464 );
1465 self.resources.queue.write_buffer(
1466 &self.resources.globals_buffer,
1467 self.gamma_offset,
1468 bytemuck::bytes_of(&gamma_params),
1469 );
1470
1471 self.record_frame(scene, target_view, clear_color)
1472 .inspect_err(|_| {
1473 // Queue writes are staged before encoding; flush them even if the frame fails.
1474 self.resources.queue.submit(std::iter::empty());
1475 })
1476 }
1477
1478 fn record_frame(
1479 &mut self,
1480 scene: &Scene,
1481 frame_view: &wgpu::TextureView,
1482 clear_color: wgpu::Color,
1483 ) -> Result<wgpu::SubmissionIndex> {
1484 let mut instance_offset = 0;
1485 let instance_bindings = self
1486 .write_instances(scene, &mut instance_offset)
1487 .with_context(|| {
1488 format!(
1489 "scene too large: {} paths, {} shadows, {} quads, {} underlines, {} monochrome sprites, {} subpixel sprites, {} polychrome sprites",
1490 scene.paths.len(),
1491 scene.shadows.len(),
1492 scene.quads.len(),
1493 scene.underlines.len(),
1494 scene.monochrome_sprites.len(),
1495 scene.subpixel_sprites.len(),
1496 scene.polychrome_sprites.len(),
1497 )
1498 })?;
1499 self.prepare_texture_bind_groups(scene);
1500
1501 let mut encoder =
1502 self.resources()
1503 .device
1504 .create_command_encoder(&wgpu::CommandEncoderDescriptor {
1505 label: Some("main_encoder"),
1506 });
1507
1508 {
1509 let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
1510 label: Some("main_pass"),
1511 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
1512 view: frame_view,
1513 resolve_target: None,
1514 ops: wgpu::Operations {
1515 load: wgpu::LoadOp::Clear(clear_color),
1516 store: wgpu::StoreOp::Store,
1517 },
1518 depth_slice: None,
1519 })],
1520 depth_stencil_attachment: None,
1521 ..Default::default()
1522 });
1523
1524 for batch in scene.batches() {
1525 match batch {
1526 PrimitiveBatch::Quads(range) => self.draw_instances(
1527 &instance_bindings.quads,
1528 &self.resources().pipelines.quads,
1529 instance_range(range),
1530 &mut pass,
1531 ),
1532 PrimitiveBatch::Shadows(range) => self.draw_instances(
1533 &instance_bindings.shadows,
1534 &self.resources().pipelines.shadows,
1535 instance_range(range),
1536 &mut pass,
1537 ),
1538 PrimitiveBatch::Paths(range) => {
1539 let paths = &scene.paths[range];
1540 if paths.is_empty() {
1541 continue;
1542 }
1543
1544 drop(pass);
1545 let rasterized = self.draw_paths_to_intermediate(
1546 &mut encoder,
1547 paths,
1548 &mut instance_offset,
1549 )?;
1550
1551 pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
1552 label: Some("main_pass_continued"),
1553 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
1554 view: frame_view,
1555 resolve_target: None,
1556 ops: wgpu::Operations {
1557 load: wgpu::LoadOp::Load,
1558 store: wgpu::StoreOp::Store,
1559 },
1560 depth_slice: None,
1561 })],
1562 depth_stencil_attachment: None,
1563 ..Default::default()
1564 });
1565
1566 if rasterized {
1567 self.draw_paths_from_intermediate(
1568 paths,
1569 &mut instance_offset,
1570 &mut pass,
1571 )?;
1572 }
1573 }
1574 PrimitiveBatch::Underlines(range) => self.draw_instances(
1575 &instance_bindings.underlines,
1576 &self.resources().pipelines.underlines,
1577 instance_range(range),
1578 &mut pass,
1579 ),
1580 PrimitiveBatch::MonochromeSprites { texture_id, range } => {
1581 self.draw_sprites(
1582 &instance_bindings.monochrome_sprites,
1583 texture_id,
1584 &self.resources().pipelines.mono_sprites,
1585 instance_range(range),
1586 &mut pass,
1587 )?;
1588 }
1589 PrimitiveBatch::SubpixelSprites { texture_id, range } => {
1590 let resources = self.resources();
1591 self.draw_sprites(
1592 &instance_bindings.subpixel_sprites,
1593 texture_id,
1594 resources
1595 .pipelines
1596 .subpixel_sprites
1597 .as_ref()
1598 .unwrap_or(&resources.pipelines.mono_sprites),
1599 instance_range(range),
1600 &mut pass,
1601 )?;
1602 }
1603 PrimitiveBatch::PolychromeSprites { texture_id, range } => {
1604 self.draw_sprites(
1605 &instance_bindings.polychrome_sprites,
1606 texture_id,
1607 &self.resources().pipelines.poly_sprites,
1608 instance_range(range),
1609 &mut pass,
1610 )?;
1611 }
1612 // Surfaces are macOS-only for video playback and are not
1613 // implemented by the WGPU renderer.
1614 PrimitiveBatch::Surfaces(_surfaces) => {}
1615 }
1616 }
1617 }
1618
1619 let submission = self
1620 .resources()
1621 .queue
1622 .submit(std::iter::once(encoder.finish()));
1623 Ok(submission)
1624 }
1625
1626 fn write_instances(
1627 &mut self,
1628 scene: &Scene,
1629 instance_offset: &mut u64,
1630 ) -> Result<InstanceBindings> {
1631 Ok(InstanceBindings {
1632 quads: self.write_instance_binding(
1633 "quads_bind_group",
1634 instance_offset,
1635 &scene.quads,
1636 )?,
1637 shadows: self.write_instance_binding(
1638 "shadows_bind_group",
1639 instance_offset,
1640 &scene.shadows,
1641 )?,
1642 underlines: self.write_instance_binding(
1643 "underlines_bind_group",
1644 instance_offset,
1645 &scene.underlines,
1646 )?,
1647 monochrome_sprites: self.write_instance_binding(
1648 "monochrome_sprites_bind_group",
1649 instance_offset,
1650 &scene.monochrome_sprites,
1651 )?,
1652 subpixel_sprites: self.write_instance_binding(
1653 "subpixel_sprites_bind_group",
1654 instance_offset,
1655 &scene.subpixel_sprites,
1656 )?,
1657 polychrome_sprites: self.write_instance_binding(
1658 "polychrome_sprites_bind_group",
1659 instance_offset,
1660 &scene.polychrome_sprites,
1661 )?,
1662 })
1663 }
1664
1665 fn create_texture_bind_group(
1666 &self,
1667 label: &str,
1668 texture_view: &wgpu::TextureView,
1669 ) -> wgpu::BindGroup {
1670 let resources = self.resources();
1671 resources
1672 .device
1673 .create_bind_group(&wgpu::BindGroupDescriptor {
1674 label: Some(label),
1675 layout: &resources.bind_group_layouts.texture,
1676 entries: &[
1677 wgpu::BindGroupEntry {
1678 binding: 0,
1679 resource: wgpu::BindingResource::TextureView(texture_view),
1680 },
1681 wgpu::BindGroupEntry {
1682 binding: 1,
1683 resource: wgpu::BindingResource::Sampler(&resources.atlas_sampler),
1684 },
1685 ],
1686 })
1687 }
1688
1689 fn prepare_texture_bind_groups(&mut self, scene: &Scene) {
1690 let mut texture_ids = SmallVec::<[AtlasTextureId; 8]>::new();
1691 for batch in scene.batches() {
1692 let texture_id = match batch {
1693 PrimitiveBatch::MonochromeSprites { texture_id, .. }
1694 | PrimitiveBatch::SubpixelSprites { texture_id, .. }
1695 | PrimitiveBatch::PolychromeSprites { texture_id, .. } => texture_id,
1696 _ => continue,
1697 };
1698 if !texture_ids.contains(&texture_id) {
1699 texture_ids.push(texture_id);
1700 }
1701 }
1702
1703 self.resources_mut()
1704 .atlas_texture_bind_groups
1705 .retain(|texture_id, _| texture_ids.contains(texture_id));
1706
1707 for texture_id in texture_ids {
1708 let Some(texture_info) = self.atlas.get_texture_info(texture_id) else {
1709 self.resources_mut()
1710 .atlas_texture_bind_groups
1711 .remove(&texture_id);
1712 continue;
1713 };
1714 let is_current = self
1715 .resources()
1716 .atlas_texture_bind_groups
1717 .get(&texture_id)
1718 .is_some_and(|cached| cached.texture_generation == texture_info.generation);
1719 if is_current {
1720 continue;
1721 }
1722
1723 let bind_group =
1724 self.create_texture_bind_group("atlas_texture_bind_group", &texture_info.view);
1725 self.resources_mut().atlas_texture_bind_groups.insert(
1726 texture_id,
1727 CachedTextureBindGroup {
1728 texture_generation: texture_info.generation,
1729 bind_group,
1730 },
1731 );
1732 }
1733 }
1734
1735 fn draw_instances(
1736 &self,
1737 instances: &InstanceBinding,
1738 pipeline: &wgpu::RenderPipeline,
1739 range: Range<u32>,
1740 pass: &mut wgpu::RenderPass<'_>,
1741 ) {
1742 if range.is_empty() {
1743 return;
1744 }
1745 pass.set_pipeline(pipeline);
1746 pass.set_bind_group(0, &self.resources().globals_bind_group, &[]);
1747 pass.set_bind_group(1, &instances.bind_group, &[]);
1748 pass.draw(
1749 0..4,
1750 instances.first_instance + range.start..instances.first_instance + range.end,
1751 );
1752 }
1753
1754 fn draw_sprites(
1755 &self,
1756 sprite_instances: &InstanceBinding,
1757 texture_id: AtlasTextureId,
1758 pipeline: &wgpu::RenderPipeline,
1759 range: Range<u32>,
1760 pass: &mut wgpu::RenderPass<'_>,
1761 ) -> Result<()> {
1762 if range.is_empty() {
1763 return Ok(());
1764 }
1765 let resources = self.resources();
1766 // The atlas has released this texture; the batch belongs to a stale
1767 // paint that will be replaced once its view re-renders.
1768 let Some(texture) = resources.atlas_texture_bind_groups.get(&texture_id) else {
1769 return Ok(());
1770 };
1771 pass.set_pipeline(pipeline);
1772 pass.set_bind_group(0, &resources.globals_bind_group, &[]);
1773 pass.set_bind_group(1, &sprite_instances.bind_group, &[]);
1774 pass.set_bind_group(2, &texture.bind_group, &[]);
1775 pass.draw(
1776 0..4,
1777 sprite_instances.first_instance + range.start
1778 ..sprite_instances.first_instance + range.end,
1779 );
1780 Ok(())
1781 }
1782
1783 unsafe fn instance_bytes<T>(instances: &[T]) -> &[u8] {
1784 unsafe {
1785 std::slice::from_raw_parts(
1786 instances.as_ptr() as *const u8,
1787 std::mem::size_of_val(instances),
1788 )
1789 }
1790 }
1791
1792 fn draw_paths_from_intermediate(
1793 &mut self,
1794 paths: &[Path<ScaledPixels>],
1795 instance_offset: &mut u64,
1796 pass: &mut wgpu::RenderPass<'_>,
1797 ) -> Result<()> {
1798 let first_path = &paths[0];
1799 let sprites: Vec<PathSprite> = if paths.last().map(|p| &p.order) == Some(&first_path.order)
1800 {
1801 paths
1802 .iter()
1803 .map(|p| PathSprite {
1804 bounds: p.clipped_bounds(),
1805 })
1806 .collect()
1807 } else {
1808 let mut bounds = first_path.clipped_bounds();
1809 for path in paths.iter().skip(1) {
1810 bounds = bounds.union(&path.clipped_bounds());
1811 }
1812 vec![PathSprite { bounds }]
1813 };
1814
1815 let Some(path_intermediate_view) = self.resources().path_intermediate_view.clone() else {
1816 return Ok(());
1817 };
1818 let instances =
1819 self.write_instance_binding("path_sprites_bind_group", instance_offset, &sprites)?;
1820 let texture = self.create_texture_bind_group(
1821 "path_intermediate_texture_bind_group",
1822 &path_intermediate_view,
1823 );
1824 let resources = self.resources();
1825 pass.set_pipeline(&resources.pipelines.paths);
1826 pass.set_bind_group(0, &resources.globals_bind_group, &[]);
1827 pass.set_bind_group(1, &instances.bind_group, &[]);
1828 pass.set_bind_group(2, &texture, &[]);
1829 pass.draw(
1830 0..4,
1831 instances.first_instance..instances.first_instance + sprites.len() as u32,
1832 );
1833 Ok(())
1834 }
1835
1836 fn draw_paths_to_intermediate(
1837 &mut self,
1838 encoder: &mut wgpu::CommandEncoder,
1839 paths: &[Path<ScaledPixels>],
1840 instance_offset: &mut u64,
1841 ) -> Result<bool> {
1842 let mut vertices = Vec::new();
1843 for path in paths {
1844 let bounds = path.clipped_bounds();
1845 vertices.extend(path.vertices.iter().map(|v| PathRasterizationVertex {
1846 xy_position: v.xy_position,
1847 st_position: v.st_position,
1848 color: path.color,
1849 bounds,
1850 }));
1851 }
1852
1853 if vertices.is_empty() {
1854 return Ok(false);
1855 }
1856
1857 let vertex_binding = self.write_instance_binding(
1858 "path_rasterization_bind_group",
1859 instance_offset,
1860 &vertices,
1861 )?;
1862
1863 let resources = self.resources();
1864 let Some(path_intermediate_view) = resources.path_intermediate_view.as_ref() else {
1865 return Ok(false);
1866 };
1867
1868 let (target_view, resolve_target) = if let Some(ref msaa_view) = resources.path_msaa_view {
1869 (msaa_view, Some(path_intermediate_view))
1870 } else {
1871 (path_intermediate_view, None)
1872 };
1873
1874 {
1875 let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
1876 label: Some("path_rasterization_pass"),
1877 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
1878 view: target_view,
1879 resolve_target,
1880 ops: wgpu::Operations {
1881 load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
1882 store: wgpu::StoreOp::Store,
1883 },
1884 depth_slice: None,
1885 })],
1886 depth_stencil_attachment: None,
1887 ..Default::default()
1888 });
1889
1890 pass.set_pipeline(&resources.pipelines.path_rasterization);
1891 pass.set_bind_group(0, &resources.path_globals_bind_group, &[]);
1892 pass.set_bind_group(1, &vertex_binding.bind_group, &[]);
1893 // The path rasterization shader loads records by vertex index
1894 // rather than instance index, so the allocation's base shifts the
1895 // vertex range here.
1896 pass.draw(
1897 vertex_binding.first_instance
1898 ..vertex_binding.first_instance + vertices.len() as u32,
1899 0..1,
1900 );
1901 }
1902
1903 Ok(true)
1904 }
1905
1906 fn write_instance_binding<T>(
1907 &mut self,
1908 label: &str,
1909 instance_offset: &mut u64,
1910 instances: &[T],
1911 ) -> Result<InstanceBinding> {
1912 let data = unsafe { Self::instance_bytes(instances) };
1913 // wgpu rejects zero-sized bindings, so empty primitive arrays still
1914 // reserve the 16-byte minimum.
1915 let size = (data.len() as u64).max(16);
1916 let stride = (std::mem::size_of::<T>() as u64).max(1);
1917 let (alignment, allocation_size) = if self.uses_webgl_instance_data {
1918 // The texture transport has no binding offset: the shader indexes
1919 // the instance texture absolutely, so each allocation must start on
1920 // a whole instance (a stride multiple) and a whole texel, and must
1921 // end on a texel boundary so the zero padding of its final partial
1922 // texel cannot overlap the next allocation.
1923 (
1924 least_common_multiple(self.instance_data_alignment, stride),
1925 size.next_multiple_of(INSTANCE_TEXTURE_TEXEL_SIZE),
1926 )
1927 } else {
1928 (self.instance_data_alignment.max(1), size)
1929 };
1930 let mut offset = (*instance_offset).next_multiple_of(alignment);
1931 if offset + allocation_size > self.instance_data_capacity {
1932 self.grow_instance_data(allocation_size)?;
1933 offset = 0;
1934 }
1935 *instance_offset = offset + allocation_size;
1936
1937 let first_instance = if self.uses_webgl_instance_data {
1938 u32::try_from(offset / stride).context("instance index exceeds u32 range")?
1939 } else {
1940 0
1941 };
1942
1943 let resources = self.resources();
1944 if !data.is_empty() {
1945 match &resources.instance_data {
1946 InstanceData::Storage(buffer) => resources.queue.write_buffer(buffer, offset, data),
1947 InstanceData::Texture { .. } => {
1948 Self::write_instance_texture(resources, offset, data)
1949 }
1950 }
1951 }
1952 let bind_group = resources
1953 .device
1954 .create_bind_group(&wgpu::BindGroupDescriptor {
1955 label: Some(label),
1956 layout: &resources.bind_group_layouts.instances,
1957 entries: &[wgpu::BindGroupEntry {
1958 binding: 0,
1959 resource: match &resources.instance_data {
1960 InstanceData::Storage(buffer) => {
1961 wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1962 buffer,
1963 offset,
1964 size: NonZeroU64::new(size),
1965 })
1966 }
1967 InstanceData::Texture { view, .. } => {
1968 wgpu::BindingResource::TextureView(view)
1969 }
1970 },
1971 }],
1972 });
1973 Ok(InstanceBinding {
1974 bind_group,
1975 first_instance,
1976 })
1977 }
1978
1979 fn write_instance_texture(resources: &WgpuResources, offset: u64, data: &[u8]) {
1980 let InstanceData::Texture {
1981 texture,
1982 width,
1983 height,
1984 ..
1985 } = &resources.instance_data
1986 else {
1987 return;
1988 };
1989 let mut byte_offset = 0usize;
1990 let mut texel_offset = offset / INSTANCE_TEXTURE_TEXEL_SIZE;
1991 while byte_offset < data.len() {
1992 let x = (texel_offset % u64::from(*width)) as u32;
1993 let y = (texel_offset / u64::from(*width)) as u32;
1994 if y >= *height {
1995 // The capacity check in write_instance_binding should make this
1996 // unreachable. Truncating silently would leave stale bytes in the
1997 // texture and draw garbage for the remaining instances.
1998 debug_assert!(
1999 false,
2000 "instance texture write out of bounds: row {y} >= height {}",
2001 *height
2002 );
2003 log::error!(
2004 "instance texture write out of bounds; dropping {} bytes of instance data",
2005 data.len() - byte_offset
2006 );
2007 return;
2008 }
2009 let available_texels = u64::from(*width - x);
2010 let remaining_bytes = data.len() - byte_offset;
2011 let complete_texels = remaining_bytes as u64 / INSTANCE_TEXTURE_TEXEL_SIZE;
2012 let texels = complete_texels.min(available_texels);
2013 if texels > 0 {
2014 let byte_count = (texels * INSTANCE_TEXTURE_TEXEL_SIZE) as usize;
2015 resources.queue.write_texture(
2016 wgpu::TexelCopyTextureInfo {
2017 texture,
2018 mip_level: 0,
2019 origin: wgpu::Origin3d { x, y, z: 0 },
2020 aspect: wgpu::TextureAspect::All,
2021 },
2022 &data[byte_offset..byte_offset + byte_count],
2023 wgpu::TexelCopyBufferLayout {
2024 offset: 0,
2025 bytes_per_row: Some(byte_count as u32),
2026 rows_per_image: None,
2027 },
2028 wgpu::Extent3d {
2029 width: texels as u32,
2030 height: 1,
2031 depth_or_array_layers: 1,
2032 },
2033 );
2034 byte_offset += byte_count;
2035 texel_offset += texels;
2036 continue;
2037 }
2038
2039 let mut final_texel = [0; INSTANCE_TEXTURE_TEXEL_SIZE as usize];
2040 final_texel[..remaining_bytes].copy_from_slice(&data[byte_offset..]);
2041 resources.queue.write_texture(
2042 wgpu::TexelCopyTextureInfo {
2043 texture,
2044 mip_level: 0,
2045 origin: wgpu::Origin3d { x, y, z: 0 },
2046 aspect: wgpu::TextureAspect::All,
2047 },
2048 &final_texel,
2049 wgpu::TexelCopyBufferLayout {
2050 offset: 0,
2051 bytes_per_row: Some(INSTANCE_TEXTURE_TEXEL_SIZE as u32),
2052 rows_per_image: None,
2053 },
2054 wgpu::Extent3d {
2055 width: 1,
2056 height: 1,
2057 depth_or_array_layers: 1,
2058 },
2059 );
2060 break;
2061 }
2062 }
2063
2064 fn grow_instance_data(&mut self, required: u64) -> Result<()> {
2065 let capacity = (self.instance_data_capacity * 2)
2066 .max(required.next_power_of_two())
2067 .min(self.max_instance_data_size);
2068 anyhow::ensure!(
2069 capacity >= required,
2070 "instance data needs {required} bytes, above the maximum of {}",
2071 self.max_instance_data_size
2072 );
2073 anyhow::ensure!(
2074 capacity > self.instance_data_capacity,
2075 "frame instance data exceeds the {}-byte maximum",
2076 self.max_instance_data_size
2077 );
2078 log::debug!(
2079 "instance data grown from {} to {capacity}",
2080 self.instance_data_capacity
2081 );
2082 // Bind groups created earlier in the frame keep the previous buffer or
2083 // texture alive, so allocations written before the grow remain valid;
2084 // only subsequent writes land in the new allocation.
2085 let uses_webgl_instance_data = self.uses_webgl_instance_data;
2086 let resources = self.resources_mut();
2087 if uses_webgl_instance_data {
2088 let max_texture_dimension = resources.device.limits().max_texture_dimension_2d;
2089 let (instance_data, actual_capacity) =
2090 Self::create_instance_texture(&resources.device, capacity, max_texture_dimension);
2091 resources.instance_data = instance_data;
2092 self.instance_data_capacity = actual_capacity;
2093 } else {
2094 resources.instance_data =
2095 InstanceData::Storage(resources.device.create_buffer(&wgpu::BufferDescriptor {
2096 label: Some("instance_buffer"),
2097 size: capacity,
2098 usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST,
2099 mapped_at_creation: false,
2100 }));
2101 self.instance_data_capacity = capacity;
2102 }
2103 Ok(())
2104 }
2105 }
2106
2107 impl WgpuRenderer {
2108 /// Mark the surface as unconfigured so rendering is skipped until a new
2109 /// surface is provided via [`replace_surface`](Self::replace_surface).
2110 ///
2111 /// This does **not** drop the renderer — the device, queue, atlas, and
2112 /// pipelines stay alive. Use this when the native window is destroyed
2113 /// (e.g. Android `TerminateWindow`) but you intend to re-create the
2114 /// surface later without losing cached atlas textures.
2115 pub fn unconfigure_surface(&mut self) {
2116 self.state = match std::mem::replace(&mut self.state, RendererState::Released) {
2117 RendererState::Ready { core, surface } => {
2118 drop(surface);
2119 RendererState::Unconfigured { core }
2120 }
2121 state @ (RendererState::Unconfigured { .. } | RendererState::Released) => state,
2122 };
2123 // Drop intermediate textures since they reference the old surface size.
2124 if let Some(core) = self.core_mut() {
2125 core.resources.invalidate_intermediate_textures();
2126 }
2127 }
2128
2129 /// Replace the wgpu surface with a new one (e.g. after Android destroys
2130 /// and recreates the native window). Keeps the device, queue, atlas, and
2131 /// all pipelines intact so cached `AtlasTextureId`s remain valid.
2132 ///
2133 /// The `instance` **must** be the same [`wgpu::Instance`] that was used to
2134 /// create the adapter and device (i.e. from the [`WgpuContext`]). Using a
2135 /// different instance will cause a "Device does not exist" panic because
2136 /// the wgpu device is bound to its originating instance.
2137 #[cfg(not(target_family = "wasm"))]
2138 pub fn replace_surface<W: HasWindowHandle>(
2139 &mut self,
2140 window: &W,
2141 config: WgpuSurfaceConfig,
2142 instance: &wgpu::Instance,
2143 ) -> anyhow::Result<()> {
2144 let window_handle = window
2145 .window_handle()
2146 .map_err(|e| anyhow::anyhow!("Failed to get window handle: {e}"))?;
2147
2148 let surface = create_surface(instance, window_handle.as_raw())?;
2149
2150 let width = (config.size.width.0 as u32).max(1);
2151 let height = (config.size.height.0 as u32).max(1);
2152
2153 let alpha_mode = if config.transparent {
2154 self.transparent_alpha_mode
2155 } else {
2156 self.opaque_alpha_mode
2157 };
2158
2159 self.surface_config.width = width;
2160 self.surface_config.height = height;
2161 self.surface_config.alpha_mode = alpha_mode;
2162 if let Some(mode) = config.preferred_present_mode {
2163 self.surface_config.present_mode = mode;
2164 }
2165
2166 let mut core = match std::mem::replace(&mut self.state, RendererState::Released) {
2167 RendererState::Ready {
2168 core,
2169 surface: old_surface,
2170 } => {
2171 drop(old_surface);
2172 core
2173 }
2174 RendererState::Unconfigured { core } => core,
2175 RendererState::Released => {
2176 anyhow::bail!("Cannot replace the surface: GPU resources have been released")
2177 }
2178 };
2179 surface.configure(&core.resources.device, &self.surface_config);
2180 core.resources.invalidate_intermediate_textures();
2181 self.state = RendererState::Ready { surface, core };
2182
2183 Ok(())
2184 }
2185
2186 pub fn destroy(&mut self) {
2187 // Release surface-bound GPU resources eagerly so the underlying native
2188 // window can be destroyed before the renderer itself is dropped.
2189 self.state = RendererState::Released;
2190 }
2191
2192 /// Returns true if the GPU device was lost and recovery is needed.
2193 pub fn device_lost(&self) -> bool {
2194 self.device_errors.device_lost()
2195 }
2196
2197 /// Returns true if a redraw is needed because GPU state was cleared.
2198 /// Calling this method clears the flag.
2199 pub fn needs_redraw(&mut self) -> bool {
2200 std::mem::take(&mut self.needs_redraw)
2201 }
2202
2203 /// Recovers from a lost GPU device by recreating the renderer with a new context.
2204 ///
2205 /// Call this after detecting `device_lost()` returns true.
2206 ///
2207 /// This method coordinates recovery across multiple windows:
2208 /// - The first window to call this will recreate the shared context
2209 /// - Subsequent windows will adopt the already-recovered context
2210 #[cfg(not(target_family = "wasm"))]
2211 pub fn recover<W>(&mut self, window: &W) -> anyhow::Result<()>
2212 where
2213 W: HasWindowHandle + HasDisplayHandle + std::fmt::Debug + Send + Sync + Clone + 'static,
2214 {
2215 let gpu_context = self.context.as_ref().expect("recover requires gpu_context");
2216
2217 // Check if another window already recovered the context
2218 let needs_new_context = gpu_context
2219 .borrow()
2220 .as_ref()
2221 .is_none_or(|ctx| ctx.device_lost());
2222
2223 let window_handle = window
2224 .window_handle()
2225 .map_err(|e| anyhow::anyhow!("Failed to get window handle: {e}"))?;
2226
2227 let surface = if needs_new_context {
2228 log::warn!("GPU device lost, recreating context...");
2229
2230 // Drop old resources to release Arc<Device>/Arc<Queue> and GPU resources
2231 self.state = RendererState::Released;
2232 *gpu_context.borrow_mut() = None;
2233
2234 // Wait briefly for the GPU driver to stabilize, then try to
2235 // recreate the context without software renderers. If this fails
2236 // the caller should request another frame and retry — the real GPU
2237 // may need more time to come back (e.g. after suspend/resume).
2238 std::thread::sleep(std::time::Duration::from_millis(350));
2239
2240 let instance = WgpuContext::instance(Some(Box::new(window.clone())));
2241 let surface = create_surface(&instance, window_handle.as_raw())?;
2242 let new_context =
2243 WgpuContext::new_rejecting_software(instance, &surface, self.compositor_gpu)?;
2244 *gpu_context.borrow_mut() = Some(new_context);
2245 surface
2246 } else {
2247 let ctx_ref = gpu_context.borrow();
2248 let instance = &ctx_ref.as_ref().unwrap().instance;
2249 create_surface(instance, window_handle.as_raw())?
2250 };
2251
2252 let config = WgpuSurfaceConfig {
2253 size: gpui::Size {
2254 width: gpui::DevicePixels(self.surface_config.width as i32),
2255 height: gpui::DevicePixels(self.surface_config.height as i32),
2256 },
2257 transparent: self.surface_config.alpha_mode != wgpu::CompositeAlphaMode::Opaque,
2258 preferred_present_mode: Some(self.surface_config.present_mode),
2259 };
2260 let gpu_context = Rc::clone(gpu_context);
2261 let ctx_ref = gpu_context.borrow();
2262 let context = ctx_ref.as_ref().expect("context should exist");
2263
2264 self.state = RendererState::Released;
2265 self.atlas.handle_device_lost(context);
2266
2267 let is_bgr = self.is_bgr;
2268 *self = Self::new_internal(
2269 Some(gpu_context.clone()),
2270 context,
2271 surface,
2272 config,
2273 self.compositor_gpu,
2274 self.atlas.clone(),
2275 )?;
2276 self.set_subpixel_layout(is_bgr);
2277
2278 log::info!("GPU recovery complete");
2279 Ok(())
2280 }
2281 }
2282
2283 #[cfg(all(
2284 not(target_family = "wasm"),
2285 any(test, feature = "bench-support", feature = "test-support")
2286 ))]
2287 struct HeadlessRenderTarget {
2288 texture: wgpu::Texture,
2289 view: wgpu::TextureView,
2290 }
2291
2292 #[cfg(all(
2293 not(target_family = "wasm"),
2294 any(test, feature = "bench-support", feature = "test-support")
2295 ))]
2296 impl HeadlessRenderTarget {
2297 fn size(&self) -> Size<DevicePixels> {
2298 Size {
2299 width: DevicePixels(self.texture.width() as i32),
2300 height: DevicePixels(self.texture.height() as i32),
2301 }
2302 }
2303 }
2304
2305 #[cfg(all(
2306 not(target_family = "wasm"),
2307 any(test, feature = "bench-support", feature = "test-support")
2308 ))]
2309 pub struct WgpuHeadlessRenderer {
2310 context: WgpuContext,
2311 core: WgpuRendererCore,
2312 render_target: Option<HeadlessRenderTarget>,
2313 observed_error_generation: u64,
2314 }
2315
2316 #[cfg(all(
2317 not(target_family = "wasm"),
2318 any(test, feature = "bench-support", feature = "test-support")
2319 ))]
2320 impl WgpuHeadlessRenderer {
2321 pub fn new() -> anyhow::Result<Self> {
2322 let (context, target_format) = WgpuContext::new_headless()?;
2323 // The device may be shared with earlier renderers; observe only errors raised from
2324 // here on, including any while this renderer builds its pipelines.
2325 let observed_error_generation = context.errors().current_generation();
2326 let atlas = Arc::new(WgpuAtlas::from_context(&context));
2327 let core = WgpuRendererCore::new(
2328 &context,
2329 atlas,
2330 target_format,
2331 wgpu::CompositeAlphaMode::Opaque,
2332 );
2333
2334 Ok(Self {
2335 context,
2336 core,
2337 render_target: None,
2338 observed_error_generation,
2339 })
2340 }
2341
2342 fn ensure_render_target(&mut self, size: Size<DevicePixels>) -> anyhow::Result<()> {
2343 anyhow::ensure!(
2344 size.width.0 > 0 && size.height.0 > 0,
2345 "invalid headless render target size: {size:?}"
2346 );
2347 anyhow::ensure!(
2348 size.width.0 as u32 <= self.core.max_texture_size
2349 && size.height.0 as u32 <= self.core.max_texture_size,
2350 "headless render target size {size:?} exceeds maximum texture dimension {}",
2351 self.core.max_texture_size
2352 );
2353 if self
2354 .render_target
2355 .as_ref()
2356 .is_some_and(|target| target.size() == size)
2357 {
2358 return Ok(());
2359 }
2360
2361 let texture = self
2362 .core
2363 .resources
2364 .device
2365 .create_texture(&wgpu::TextureDescriptor {
2366 label: Some("headless_render_target"),
2367 size: wgpu::Extent3d {
2368 width: size.width.0 as u32,
2369 height: size.height.0 as u32,
2370 depth_or_array_layers: 1,
2371 },
2372 mip_level_count: 1,
2373 sample_count: 1,
2374 dimension: wgpu::TextureDimension::D2,
2375 format: self.core.target_format,
2376 usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC,
2377 view_formats: &[],
2378 });
2379 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
2380 self.render_target = Some(HeadlessRenderTarget { texture, view });
2381 Ok(())
2382 }
2383
2384 fn check_gpu_errors(&mut self) -> anyhow::Result<()> {
2385 anyhow::ensure!(
2386 !self.context.device_lost(),
2387 "GPU device was lost during headless rendering"
2388 );
2389 if let Some(error) = self
2390 .context
2391 .errors()
2392 .observe_error(&mut self.observed_error_generation)
2393 {
2394 anyhow::bail!("GPU error during headless rendering: {error}");
2395 }
2396 Ok(())
2397 }
2398
2399 fn render(&mut self, scene: &Scene, size: Size<DevicePixels>) -> anyhow::Result<()> {
2400 self.check_gpu_errors()?;
2401 self.ensure_render_target(size)?;
2402 let view = self
2403 .render_target
2404 .as_ref()
2405 .ok_or_else(|| anyhow::anyhow!("Headless render target was not created"))?
2406 .view
2407 .clone();
2408 self.core
2409 .render_frame(scene, &view, size, false, wgpu::Color::BLACK)?;
2410 Ok(())
2411 }
2412
2413 /// Copies the current render target back to the CPU. Dimensions come from the
2414 /// target texture itself, so the copy can never disagree with what was rendered.
2415 fn read_image(&mut self) -> anyhow::Result<image::RgbaImage> {
2416 let target = self
2417 .render_target
2418 .as_ref()
2419 .ok_or_else(|| anyhow::anyhow!("Headless render target was not created"))?;
2420 let width = target.texture.width();
2421 let height = target.texture.height();
2422 let bytes_per_row = width
2423 .checked_mul(4)
2424 .ok_or_else(|| anyhow::anyhow!("Headless render target row size overflowed"))?;
2425 let padded_bytes_per_row = bytes_per_row
2426 .checked_next_multiple_of(wgpu::COPY_BYTES_PER_ROW_ALIGNMENT)
2427 .ok_or_else(|| anyhow::anyhow!("Headless padded row size overflowed"))?;
2428 let buffer_size = u64::from(padded_bytes_per_row)
2429 .checked_mul(u64::from(height))
2430 .ok_or_else(|| anyhow::anyhow!("Headless readback buffer size overflowed"))?;
2431 anyhow::ensure!(
2432 buffer_size <= self.core.resources.device.limits().max_buffer_size,
2433 "Headless readback buffer size {buffer_size} exceeds maximum buffer size {}",
2434 self.core.resources.device.limits().max_buffer_size
2435 );
2436 let readback_buffer = self
2437 .core
2438 .resources
2439 .device
2440 .create_buffer(&wgpu::BufferDescriptor {
2441 label: Some("headless_readback_buffer"),
2442 size: buffer_size,
2443 usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ,
2444 mapped_at_creation: false,
2445 });
2446 let mut encoder =
2447 self.core
2448 .resources
2449 .device
2450 .create_command_encoder(&wgpu::CommandEncoderDescriptor {
2451 label: Some("headless_readback_encoder"),
2452 });
2453 encoder.copy_texture_to_buffer(
2454 wgpu::TexelCopyTextureInfo {
2455 texture: &target.texture,
2456 mip_level: 0,
2457 origin: wgpu::Origin3d::ZERO,
2458 aspect: wgpu::TextureAspect::All,
2459 },
2460 wgpu::TexelCopyBufferInfo {
2461 buffer: &readback_buffer,
2462 layout: wgpu::TexelCopyBufferLayout {
2463 offset: 0,
2464 bytes_per_row: Some(padded_bytes_per_row),
2465 rows_per_image: Some(height),
2466 },
2467 },
2468 wgpu::Extent3d {
2469 width,
2470 height,
2471 depth_or_array_layers: 1,
2472 },
2473 );
2474 let submission = self
2475 .core
2476 .resources
2477 .queue
2478 .submit(std::iter::once(encoder.finish()));
2479 let (sender, receiver) = std::sync::mpsc::channel();
2480 readback_buffer
2481 .slice(..)
2482 .map_async(wgpu::MapMode::Read, move |result| {
2483 if sender.send(result).is_err() {
2484 log::error!("Headless readback receiver was dropped before mapping completed");
2485 }
2486 });
2487 self.core
2488 .resources
2489 .device
2490 .poll(wgpu::PollType::Wait {
2491 submission_index: Some(submission),
2492 timeout: Some(std::time::Duration::from_secs(30)),
2493 })
2494 .map_err(|error| anyhow::anyhow!("Failed to wait for headless rendering: {error}"))?;
2495 receiver
2496 .recv_timeout(std::time::Duration::from_secs(30))
2497 .map_err(|error| anyhow::anyhow!("Failed to receive headless mapping result: {error}"))?
2498 .map_err(|error| anyhow::anyhow!("Failed to map headless readback buffer: {error}"))?;
2499 self.check_gpu_errors()?;
2500
2501 let mapped_data = readback_buffer.slice(..).get_mapped_range();
2502 let pixel_capacity = usize::try_from(u64::from(bytes_per_row) * u64::from(height))
2503 .map_err(|_| anyhow::anyhow!("Headless image size exceeds addressable memory"))?;
2504 let mut pixels = Vec::with_capacity(pixel_capacity);
2505 for row in mapped_data
2506 .chunks_exact(padded_bytes_per_row as usize)
2507 .take(height as usize)
2508 {
2509 pixels.extend_from_slice(&row[..bytes_per_row as usize]);
2510 }
2511 drop(mapped_data);
2512 readback_buffer.unmap();
2513
2514 if self.core.target_format == wgpu::TextureFormat::Bgra8Unorm {
2515 for pixel in pixels.chunks_exact_mut(4) {
2516 pixel.swap(0, 2);
2517 }
2518 }
2519
2520 image::RgbaImage::from_raw(width, height, pixels)
2521 .ok_or_else(|| anyhow::anyhow!("Failed to create image from headless pixel data"))
2522 }
2523 }
2524
2525 #[cfg(all(
2526 not(target_family = "wasm"),
2527 any(test, feature = "bench-support", feature = "test-support")
2528 ))]
2529 impl gpui::PlatformHeadlessRenderer for WgpuHeadlessRenderer {
2530 fn render_scene_to_image(
2531 &mut self,
2532 scene: &Scene,
2533 size: Size<DevicePixels>,
2534 ) -> anyhow::Result<image::RgbaImage> {
2535 self.render(scene, size)?;
2536 self.read_image()
2537 }
2538
2539 fn render_scene(&mut self, scene: &Scene, size: Size<DevicePixels>) -> anyhow::Result<()> {
2540 self.render(scene, size)
2541 }
2542
2543 fn sprite_atlas(&self) -> Arc<dyn gpui::PlatformAtlas> {
2544 self.core.atlas.clone()
2545 }
2546 }
2547
2548 fn instance_range(range: Range<usize>) -> Range<u32> {
2549 range.start as u32..range.end as u32
2550 }
2551
2552 #[cfg(not(target_family = "wasm"))]
2553 fn create_surface(
2554 instance: &wgpu::Instance,
2555 raw_window_handle: raw_window_handle::RawWindowHandle,
2556 ) -> anyhow::Result<wgpu::Surface<'static>> {
2557 unsafe {
2558 instance
2559 .create_surface_unsafe(wgpu::SurfaceTargetUnsafe::RawHandle {
2560 // Fall back to the display handle already provided via InstanceDescriptor::display.
2561 raw_display_handle: None,
2562 raw_window_handle,
2563 })
2564 .map_err(|e| anyhow::anyhow!("{e}"))
2565 }
2566 }
2567
2568 struct RenderingParameters {
2569 path_sample_count: u32,
2570 gamma_ratios: [f32; 4],
2571 grayscale_enhanced_contrast: f32,
2572 subpixel_enhanced_contrast: f32,
2573 }
2574
2575 impl RenderingParameters {
2576 fn new(adapter: &wgpu::Adapter, surface_format: wgpu::TextureFormat) -> Self {
2577 use std::env;
2578
2579 let format_features = adapter.get_texture_format_features(surface_format);
2580 let path_sample_count = [4, 2, 1]
2581 .into_iter()
2582 .find(|&n| format_features.flags.sample_count_supported(n))
2583 .unwrap_or(1);
2584
2585 let gamma = env::var("ZED_FONTS_GAMMA")
2586 .ok()
2587 .and_then(|v| v.parse().ok())
2588 .unwrap_or(1.8_f32)
2589 .clamp(1.0, 2.2);
2590 let gamma_ratios = get_gamma_correction_ratios(gamma);
2591
2592 let grayscale_enhanced_contrast = env::var("ZED_FONTS_GRAYSCALE_ENHANCED_CONTRAST")
2593 .ok()
2594 .and_then(|v| v.parse().ok())
2595 .unwrap_or(1.0_f32)
2596 .max(0.0);
2597
2598 let subpixel_enhanced_contrast = env::var("ZED_FONTS_SUBPIXEL_ENHANCED_CONTRAST")
2599 .ok()
2600 .and_then(|v| v.parse().ok())
2601 .unwrap_or(0.5_f32)
2602 .max(0.0);
2603
2604 Self {
2605 path_sample_count,
2606 gamma_ratios,
2607 grayscale_enhanced_contrast,
2608 subpixel_enhanced_contrast,
2609 }
2610 }
2611 }
2612
2613 #[cfg(test)]
2614 mod tests {
2615 use super::*;
2616 use gpui::{
2617 BorderStyle, ColorSpace, ContentMask, Corners, Edges, Hsla, MonochromeSprite,
2618 PolychromeSprite, Quad, Shadow, Size, SubpixelSprite, Underline, linear_color_stop,
2619 linear_gradient,
2620 };
2621 #[cfg(target_os = "linux")]
2622 use gpui::{DevicePixels, PlatformHeadlessRenderer, Scene};
2623
2624 #[cfg(target_os = "linux")]
2625 fn device_size(width: i32, height: i32) -> Size<DevicePixels> {
2626 Size {
2627 width: DevicePixels(width),
2628 height: DevicePixels(height),
2629 }
2630 }
2631
2632 #[cfg(target_os = "linux")]
2633 fn solid_quad(x: f32, y: f32, width: f32, height: f32, color: Hsla) -> Quad {
2634 let bounds = Bounds {
2635 origin: Point {
2636 x: x.into(),
2637 y: y.into(),
2638 },
2639 size: Size {
2640 width: width.into(),
2641 height: height.into(),
2642 },
2643 };
2644 Quad {
2645 order: 0,
2646 border_style: BorderStyle::Solid,
2647 bounds,
2648 content_mask: ContentMask { bounds },
2649 background: color.into(),
2650 border_color: color,
2651 corner_radii: Corners::default(),
2652 border_widths: Edges::default(),
2653 }
2654 }
2655
2656 /// Channels are compared with a small tolerance so the assertions hold across
2657 /// drivers without pinning exact rasterizer output.
2658 #[cfg(target_os = "linux")]
2659 fn assert_pixel(image: &image::RgbaImage, x: u32, y: u32, expected: [u8; 4]) {
2660 let actual = image.get_pixel(x, y).0;
2661 assert!(
2662 actual
2663 .iter()
2664 .zip(expected)
2665 .all(|(actual, expected)| actual.abs_diff(expected) <= 3),
2666 "pixel ({x}, {y}) was {actual:?}, expected {expected:?}"
2667 );
2668 }
2669
2670 #[cfg(target_os = "linux")]
2671 const RED: [u8; 4] = [255, 0, 0, 255];
2672 #[cfg(target_os = "linux")]
2673 const BLUE: [u8; 4] = [0, 0, 255, 255];
2674 #[cfg(target_os = "linux")]
2675 const BLACK: [u8; 4] = [0, 0, 0, 255];
2676
2677 #[cfg(target_os = "linux")]
2678 #[test]
2679 fn headless_renderer_draws_quads_with_distinct_colors() -> anyhow::Result<()> {
2680 let mut renderer = WgpuHeadlessRenderer::new()?;
2681 let mut scene = Scene::default();
2682 scene.insert_primitive(solid_quad(0.0, 0.0, 32.0, 32.0, gpui::red()));
2683 scene.insert_primitive(solid_quad(32.0, 0.0, 32.0, 32.0, gpui::blue()));
2684 scene.finish();
2685
2686 let image = renderer.render_scene_to_image(&scene, device_size(64, 32))?;
2687 assert_eq!(image.dimensions(), (64, 32));
2688 assert_pixel(&image, 8, 16, RED);
2689 assert_pixel(&image, 24, 16, RED);
2690 assert_pixel(&image, 40, 16, BLUE);
2691 assert_pixel(&image, 56, 16, BLUE);
2692 Ok(())
2693 }
2694
2695 #[cfg(target_os = "linux")]
2696 #[test]
2697 fn headless_renderer_captures_each_requested_size() -> anyhow::Result<()> {
2698 let mut renderer = WgpuHeadlessRenderer::new()?;
2699 let mut scene = Scene::default();
2700 scene.insert_primitive(solid_quad(2.0, 2.0, 4.0, 3.0, gpui::red()));
2701 scene.finish();
2702
2703 // 13 px rows are 52 bytes, forcing readback to strip copy-row padding.
2704 let image = renderer.render_scene_to_image(&scene, device_size(13, 7))?;
2705 assert_eq!(image.dimensions(), (13, 7));
2706 assert_pixel(&image, 0, 0, BLACK);
2707 assert_pixel(&image, 3, 3, RED);
2708 assert_pixel(&image, 12, 6, BLACK);
2709
2710 let image = renderer.render_scene_to_image(&scene, device_size(17, 9))?;
2711 assert_eq!(image.dimensions(), (17, 9));
2712 assert_pixel(&image, 3, 3, RED);
2713 assert_pixel(&image, 16, 8, BLACK);
2714
2715 let image = renderer.render_scene_to_image(&Scene::default(), device_size(13, 7))?;
2716 assert_eq!(image.dimensions(), (13, 7));
2717 assert!(image.pixels().all(|pixel| pixel.0 == BLACK));
2718 Ok(())
2719 }
2720
2721 #[cfg(target_os = "linux")]
2722 #[test]
2723 fn headless_renderer_reuses_target_for_same_size() -> anyhow::Result<()> {
2724 let mut renderer = WgpuHeadlessRenderer::new()?;
2725 let target_texture = |renderer: &WgpuHeadlessRenderer| {
2726 renderer
2727 .render_target
2728 .as_ref()
2729 .map(|target| target.texture.clone())
2730 };
2731
2732 renderer.render_scene(&Scene::default(), device_size(16, 16))?;
2733 let first = target_texture(&renderer);
2734 assert!(first.is_some());
2735
2736 renderer.render_scene(&Scene::default(), device_size(16, 16))?;
2737 assert_eq!(target_texture(&renderer), first);
2738
2739 renderer.render_scene(&Scene::default(), device_size(16, 17))?;
2740 assert_ne!(target_texture(&renderer), first);
2741 Ok(())
2742 }
2743
2744 #[cfg(target_os = "linux")]
2745 #[test]
2746 fn headless_renderer_rejects_invalid_sizes() -> anyhow::Result<()> {
2747 let mut renderer = WgpuHeadlessRenderer::new()?;
2748 let too_large = renderer.core.max_texture_size as i32 + 1;
2749
2750 for size in [
2751 device_size(0, 8),
2752 device_size(8, 0),
2753 device_size(-1, 8),
2754 device_size(too_large, 8),
2755 ] {
2756 assert!(
2757 renderer.render_scene(&Scene::default(), size).is_err(),
2758 "{size:?} should be rejected"
2759 );
2760 assert!(
2761 renderer
2762 .render_scene_to_image(&Scene::default(), size)
2763 .is_err(),
2764 "{size:?} should be rejected"
2765 );
2766 }
2767
2768 // Rejection must leave the renderer usable.
2769 let image = renderer.render_scene_to_image(&Scene::default(), device_size(4, 4))?;
2770 assert_eq!(image.dimensions(), (4, 4));
2771 Ok(())
2772 }
2773
2774 #[test]
2775 fn webgl_shader_is_valid_wgsl_without_storage_buffers() {
2776 assert!(!WEBGL_SHADERS.contains("var<storage"));
2777 validate_wgsl(WEBGL_SHADERS, naga::valid::Capabilities::empty());
2778 }
2779
2780 #[test]
2781 fn storage_buffer_shader_is_valid_wgsl() {
2782 validate_wgsl(STORAGE_BUFFER_SHADERS, naga::valid::Capabilities::empty());
2783 }
2784
2785 #[test]
2786 fn subpixel_shader_is_valid_wgsl() {
2787 validate_wgsl(
2788 SUBPIXEL_SHADERS,
2789 naga::valid::Capabilities::DUAL_SOURCE_BLENDING,
2790 );
2791 }
2792
2793 fn validate_wgsl(source: &str, capabilities: naga::valid::Capabilities) {
2794 let module = naga::front::wgsl::parse_str(source).expect("shader should parse");
2795 naga::valid::Validator::new(naga::valid::ValidationFlags::all(), capabilities)
2796 .validate(&module)
2797 .expect("shader should validate");
2798 }
2799
2800 #[test]
2801 fn webgl_record_sizes_match_shader_word_strides() {
2802 assert_eq!(std::mem::size_of::<Quad>(), 40 * 4);
2803 assert_eq!(std::mem::size_of::<Shadow>(), 28 * 4);
2804 assert_eq!(std::mem::size_of::<PathRasterizationVertex>(), 26 * 4);
2805 assert_eq!(std::mem::size_of::<PathSprite>(), 4 * 4);
2806 assert_eq!(std::mem::size_of::<Underline>(), 16 * 4);
2807 assert_eq!(std::mem::size_of::<MonochromeSprite>(), 28 * 4);
2808 assert_eq!(std::mem::size_of::<SubpixelSprite>(), 28 * 4);
2809 assert_eq!(std::mem::size_of::<PolychromeSprite>(), 24 * 4);
2810 }
2811
2812 #[test]
2813 fn webgl_quad_layout_matches_fixed_decoder() {
2814 let quad = Quad {
2815 order: 41,
2816 border_style: BorderStyle::Dashed,
2817 bounds: Bounds {
2818 origin: Point {
2819 x: 1.0.into(),
2820 y: 2.0.into(),
2821 },
2822 size: Size {
2823 width: 3.0.into(),
2824 height: 4.0.into(),
2825 },
2826 },
2827 content_mask: ContentMask {
2828 bounds: Bounds {
2829 origin: Point {
2830 x: 5.0.into(),
2831 y: 6.0.into(),
2832 },
2833 size: Size {
2834 width: 7.0.into(),
2835 height: 8.0.into(),
2836 },
2837 },
2838 },
2839 background: linear_gradient(
2840 11.0,
2841 linear_color_stop(
2842 Hsla {
2843 h: 12.0,
2844 s: 13.0,
2845 l: 14.0,
2846 a: 15.0,
2847 },
2848 16.0,
2849 ),
2850 linear_color_stop(
2851 Hsla {
2852 h: 17.0,
2853 s: 18.0,
2854 l: 19.0,
2855 a: 20.0,
2856 },
2857 21.0,
2858 ),
2859 )
2860 .color_space(ColorSpace::Oklab),
2861 border_color: Hsla {
2862 h: 22.0,
2863 s: 23.0,
2864 l: 24.0,
2865 a: 25.0,
2866 },
2867 corner_radii: Corners {
2868 top_left: 26.0.into(),
2869 top_right: 27.0.into(),
2870 bottom_right: 28.0.into(),
2871 bottom_left: 29.0.into(),
2872 },
2873 border_widths: Edges {
2874 top: 30.0.into(),
2875 right: 31.0.into(),
2876 bottom: 32.0.into(),
2877 left: 33.0.into(),
2878 },
2879 };
2880
2881 let bytes = unsafe { WgpuRendererCore::instance_bytes(std::slice::from_ref(&quad)) };
2882 let words: &[u32] = bytemuck::cast_slice(bytes);
2883 assert_eq!(
2884 words,
2885 &[
2886 41,
2887 1,
2888 1.0_f32.to_bits(),
2889 2.0_f32.to_bits(),
2890 3.0_f32.to_bits(),
2891 4.0_f32.to_bits(),
2892 5.0_f32.to_bits(),
2893 6.0_f32.to_bits(),
2894 7.0_f32.to_bits(),
2895 8.0_f32.to_bits(),
2896 1,
2897 1,
2898 0,
2899 0,
2900 0,
2901 0,
2902 11.0_f32.to_bits(),
2903 12.0_f32.to_bits(),
2904 13.0_f32.to_bits(),
2905 14.0_f32.to_bits(),
2906 15.0_f32.to_bits(),
2907 16.0_f32.to_bits(),
2908 17.0_f32.to_bits(),
2909 18.0_f32.to_bits(),
2910 19.0_f32.to_bits(),
2911 20.0_f32.to_bits(),
2912 21.0_f32.to_bits(),
2913 0,
2914 22.0_f32.to_bits(),
2915 23.0_f32.to_bits(),
2916 24.0_f32.to_bits(),
2917 25.0_f32.to_bits(),
2918 26.0_f32.to_bits(),
2919 27.0_f32.to_bits(),
2920 28.0_f32.to_bits(),
2921 29.0_f32.to_bits(),
2922 30.0_f32.to_bits(),
2923 31.0_f32.to_bits(),
2924 32.0_f32.to_bits(),
2925 33.0_f32.to_bits(),
2926 ]
2927 );
2928 }
2929 }
@@ -0,0 +1,2929 @@
1use crate::{CompositorGpuHint, DeviceErrorState, WgpuAtlas, WgpuContext};
2use anyhow::{Context as _, Result};
3use bytemuck::{Pod, Zeroable};
4use collections::FxHashMap;
5use gpui::{
6 AtlasTextureId, Background, Bounds, DevicePixels, GpuSpecs, Path, Point, PrimitiveBatch,
7 ScaledPixels, Scene, Size, get_gamma_correction_ratios,
8};
9use log::warn;
10#[cfg(not(target_family = "wasm"))]
11use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
12use smallvec::SmallVec;
13use std::cell::RefCell;
14use std::num::NonZeroU64;
15use std::ops::Range;
16use std::rc::Rc;
17use std::sync::Arc;
18
19const MAX_INSTANCE_BUFFER_SIZE: u64 = 256 * 1024 * 1024;
20
21const INSTANCE_TEXTURE_TEXEL_SIZE: u64 = 16;
22
23/// Shader variant for backends with storage buffer support: the shared shader
24/// logic plus the storage-buffer instance transport.
25const STORAGE_BUFFER_SHADERS: &str = concat!(
26 include_str!("shaders.wgsl"),
27 include_str!("shaders_storage.wgsl"),
28);
29
30/// Shader variant for WebGL2, which has no storage buffers: the shared shader
31/// logic plus the texture-based instance transport.
32const WEBGL_SHADERS: &str = concat!(
33 include_str!("shaders.wgsl"),
34 include_str!("shaders_webgl.wgsl"),
35);
36
37/// Subpixel text rendering requires dual-source blending, which WebGL2 lacks, so
38/// this variant only ever runs with the storage-buffer transport. The `enable`
39/// directive must precede all declarations.
40const SUBPIXEL_SHADERS: &str = concat!(
41 "enable dual_source_blending;\n",
42 include_str!("shaders.wgsl"),
43 include_str!("shaders_storage.wgsl"),
44 include_str!("shaders_subpixel.wgsl"),
45);
46
47fn least_common_multiple(left: u64, right: u64) -> u64 {
48 let mut first = left;
49 let mut second = right;
50 while second != 0 {
51 let remainder = first % second;
52 first = second;
53 second = remainder;
54 }
55 left / first * right
56}
57
58#[repr(C)]
59#[derive(Clone, Copy, Pod, Zeroable)]
60struct GlobalParams {
61 viewport_size: [f32; 2],
62 premultiplied_alpha: u32,
63 pad: u32,
64}
65
66#[repr(C)]
67#[derive(Clone, Copy, Pod, Zeroable)]
68struct PodBounds {
69 origin: [f32; 2],
70 size: [f32; 2],
71}
72
73impl From<Bounds<ScaledPixels>> for PodBounds {
74 fn from(bounds: Bounds<ScaledPixels>) -> Self {
75 Self {
76 origin: [bounds.origin.x.0, bounds.origin.y.0],
77 size: [bounds.size.width.0, bounds.size.height.0],
78 }
79 }
80}
81
82#[repr(C)]
83#[derive(Clone, Copy, Pod, Zeroable)]
84struct SurfaceParams {
85 bounds: PodBounds,
86 content_mask: PodBounds,
87}
88
89#[repr(C)]
90#[derive(Clone, Copy, Pod, Zeroable)]
91struct GammaParams {
92 gamma_ratios: [f32; 4],
93 grayscale_enhanced_contrast: f32,
94 subpixel_enhanced_contrast: f32,
95 is_bgr: u32,
96 _pad: u32,
97}
98
99#[derive(Clone, Debug)]
100#[repr(C)]
101struct PathSprite {
102 bounds: Bounds<ScaledPixels>,
103}
104
105#[derive(Clone, Debug)]
106#[repr(C)]
107struct PathRasterizationVertex {
108 xy_position: Point<ScaledPixels>,
109 st_position: Point<f32>,
110 color: Background,
111 bounds: Bounds<ScaledPixels>,
112}
113
114pub struct WgpuSurfaceConfig {
115 pub size: Size<DevicePixels>,
116 pub transparent: bool,
117 /// Preferred presentation mode. When `Some`, the renderer will use this
118 /// mode if supported by the surface, falling back to `Fifo`.
119 /// When `None`, defaults to `Fifo` (VSync).
120 ///
121 /// Mobile platforms may prefer `Mailbox` (triple-buffering) to avoid
122 /// blocking in `get_current_texture()` during lifecycle transitions.
123 pub preferred_present_mode: Option<wgpu::PresentMode>,
124}
125
126struct WgpuPipelines {
127 quads: wgpu::RenderPipeline,
128 shadows: wgpu::RenderPipeline,
129 path_rasterization: wgpu::RenderPipeline,
130 paths: wgpu::RenderPipeline,
131 underlines: wgpu::RenderPipeline,
132 mono_sprites: wgpu::RenderPipeline,
133 subpixel_sprites: Option<wgpu::RenderPipeline>,
134 poly_sprites: wgpu::RenderPipeline,
135 #[allow(dead_code)]
136 surfaces: wgpu::RenderPipeline,
137}
138
139/// One frame allocation of instance data, ready to bind.
140struct InstanceBinding {
141 bind_group: wgpu::BindGroup,
142 /// Index of the allocation's first instance within the bound data. Always
143 /// zero on the storage-buffer path, where the binding offset already
144 /// positions the array; on the WebGL texture path the shader indexes the
145 /// shared instance texture absolutely, so draws must offset their
146 /// instance (or vertex) ranges by this value.
147 first_instance: u32,
148}
149
150struct InstanceBindings {
151 quads: InstanceBinding,
152 shadows: InstanceBinding,
153 underlines: InstanceBinding,
154 monochrome_sprites: InstanceBinding,
155 subpixel_sprites: InstanceBinding,
156 polychrome_sprites: InstanceBinding,
157}
158
159struct WgpuBindGroupLayouts {
160 globals: wgpu::BindGroupLayout,
161 instances: wgpu::BindGroupLayout,
162 texture: wgpu::BindGroupLayout,
163 surfaces: wgpu::BindGroupLayout,
164}
165
166/// Shared GPU context reference, used to coordinate device recovery across multiple windows.
167pub type GpuContext = Rc<RefCell<Option<WgpuContext>>>;
168
169enum InstanceData {
170 Storage(wgpu::Buffer),
171 // WebGL2 has no storage buffers. A uint texture keeps the records available to both shader
172 // stages while preserving integer and floating-point bit patterns exactly.
173 Texture {
174 texture: wgpu::Texture,
175 view: wgpu::TextureView,
176 width: u32,
177 height: u32,
178 },
179}
180
181/// GPU resources that must be dropped together during device recovery.
182struct WgpuResources {
183 device: Arc<wgpu::Device>,
184 queue: Arc<wgpu::Queue>,
185 pipelines: WgpuPipelines,
186 bind_group_layouts: WgpuBindGroupLayouts,
187 atlas_sampler: wgpu::Sampler,
188 atlas_texture_bind_groups: FxHashMap<AtlasTextureId, CachedTextureBindGroup>,
189 globals_buffer: wgpu::Buffer,
190 globals_bind_group: wgpu::BindGroup,
191 path_globals_bind_group: wgpu::BindGroup,
192 instance_data: InstanceData,
193 path_intermediate_texture: Option<wgpu::Texture>,
194 path_intermediate_view: Option<wgpu::TextureView>,
195 path_msaa_texture: Option<wgpu::Texture>,
196 path_msaa_view: Option<wgpu::TextureView>,
197}
198
199struct CachedTextureBindGroup {
200 texture_generation: u64,
201 bind_group: wgpu::BindGroup,
202}
203
204impl WgpuResources {
205 fn invalidate_intermediate_textures(&mut self) {
206 self.path_intermediate_texture = None;
207 self.path_intermediate_view = None;
208 self.path_msaa_texture = None;
209 self.path_msaa_view = None;
210 }
211}
212
213struct WgpuRendererCore {
214 resources: WgpuResources,
215 atlas: Arc<WgpuAtlas>,
216 path_globals_offset: u64,
217 gamma_offset: u64,
218 instance_data_capacity: u64,
219 max_instance_data_size: u64,
220 instance_data_alignment: u64,
221 uses_webgl_instance_data: bool,
222 rendering_params: RenderingParameters,
223 is_bgr: bool,
224 dual_source_blending: bool,
225 adapter_info: wgpu::AdapterInfo,
226 target_format: wgpu::TextureFormat,
227 max_texture_size: u32,
228}
229
230/// GPU resources of a windowed renderer. A surface is only ever configured against the
231/// device that owns `core`, so it cannot outlive it: there is no surface-only state.
232enum RendererState {
233 /// Frames can be drawn.
234 Ready {
235 surface: wgpu::Surface<'static>,
236 core: WgpuRendererCore,
237 },
238 /// The native surface is gone (Android `TerminateWindow`, browser context loss) but
239 /// the device, pipelines, and atlas remain so `replace_surface` can resume without
240 /// re-uploading cached textures.
241 Unconfigured { core: WgpuRendererCore },
242 /// Released by `destroy`, or dropped for a device recovery that has not succeeded yet.
243 Released,
244}
245
246pub struct WgpuRenderer {
247 /// Shared GPU context for device recovery coordination (unused on WASM).
248 #[allow(dead_code)]
249 context: Option<GpuContext>,
250 /// Compositor GPU hint for adapter selection (unused on WASM).
251 #[allow(dead_code)]
252 compositor_gpu: Option<CompositorGpuHint>,
253 state: RendererState,
254 surface_config: wgpu::SurfaceConfiguration,
255 atlas: Arc<WgpuAtlas>,
256 transparent_alpha_mode: wgpu::CompositeAlphaMode,
257 opaque_alpha_mode: wgpu::CompositeAlphaMode,
258 max_texture_size: u32,
259 is_bgr: bool,
260 failed_frame_count: u32,
261 device_errors: Arc<DeviceErrorState>,
262 observed_error_generation: u64,
263 last_surface_error: Option<String>,
264 needs_redraw: bool,
265}
266
267impl WgpuRenderer {
268 fn core(&self) -> Option<&WgpuRendererCore> {
269 match &self.state {
270 RendererState::Ready { core, .. } | RendererState::Unconfigured { core } => Some(core),
271 RendererState::Released => None,
272 }
273 }
274
275 fn core_mut(&mut self) -> Option<&mut WgpuRendererCore> {
276 match &mut self.state {
277 RendererState::Ready { core, .. } | RendererState::Unconfigured { core } => Some(core),
278 RendererState::Released => None,
279 }
280 }
281
282 /// Creates a new WgpuRenderer from raw window handles.
283 ///
284 /// The `gpu_context` is a shared reference that coordinates GPU context across
285 /// multiple windows. The first window to create a renderer will initialize the
286 /// context; subsequent windows will share it.
287 ///
288 /// # Safety
289 /// The caller must ensure that the window handle remains valid for the lifetime
290 /// of the returned renderer.
291 #[cfg(not(target_family = "wasm"))]
292 pub fn new<W>(
293 gpu_context: GpuContext,
294 window: &W,
295 config: WgpuSurfaceConfig,
296 compositor_gpu: Option<CompositorGpuHint>,
297 ) -> anyhow::Result<Self>
298 where
299 W: HasWindowHandle + HasDisplayHandle + std::fmt::Debug + Send + Sync + Clone + 'static,
300 {
301 let window_handle = window
302 .window_handle()
303 .map_err(|e| anyhow::anyhow!("Failed to get window handle: {e}"))?;
304
305 let target = wgpu::SurfaceTargetUnsafe::RawHandle {
306 // Fall back to the display handle already provided via InstanceDescriptor::display.
307 raw_display_handle: None,
308 raw_window_handle: window_handle.as_raw(),
309 };
310
311 // Use the existing context's instance if available, otherwise create a new one.
312 // The surface must be created with the same instance that will be used for
313 // adapter selection, otherwise wgpu will panic.
314 let instance = gpu_context
315 .borrow()
316 .as_ref()
317 .map(|ctx| ctx.instance.clone())
318 .unwrap_or_else(|| WgpuContext::instance(Some(Box::new(window.clone()))));
319
320 // Safety: The caller guarantees that the window handle is valid for the
321 // lifetime of this renderer. In practice, the RawWindow struct is created
322 // from the native window handles and the surface is dropped before the window.
323 let surface = unsafe {
324 instance
325 .create_surface_unsafe(target)
326 .map_err(|e| anyhow::anyhow!("Failed to create surface: {e}"))?
327 };
328
329 let mut ctx_ref = gpu_context.borrow_mut();
330 let context = match ctx_ref.as_mut() {
331 Some(context) => {
332 context.check_compatible_with_surface(&surface)?;
333 context
334 }
335 None => ctx_ref.insert(WgpuContext::new(instance, &surface, compositor_gpu)?),
336 };
337
338 let atlas = Arc::new(WgpuAtlas::from_context(context));
339
340 Self::new_internal(
341 Some(Rc::clone(&gpu_context)),
342 context,
343 surface,
344 config,
345 compositor_gpu,
346 atlas,
347 )
348 }
349
350 #[cfg(target_family = "wasm")]
351 pub fn new_from_canvas(
352 context: &WgpuContext,
353 canvas: &web_sys::HtmlCanvasElement,
354 config: WgpuSurfaceConfig,
355 ) -> anyhow::Result<Self> {
356 let surface = context
357 .instance
358 .create_surface(wgpu::SurfaceTarget::Canvas(canvas.clone()))
359 .map_err(|e| anyhow::anyhow!("Failed to create surface: {e}"))?;
360 Self::new_from_surface(context, surface, config)
361 }
362
363 #[cfg(target_family = "wasm")]
364 #[allow(clippy::arc_with_non_send_sync)]
365 pub fn new_from_surface(
366 context: &WgpuContext,
367 surface: wgpu::Surface<'static>,
368 config: WgpuSurfaceConfig,
369 ) -> anyhow::Result<Self> {
370 let atlas = Arc::new(WgpuAtlas::from_context(context));
371 Self::new_internal(None, context, surface, config, None, atlas)
372 }
373
374 fn new_internal(
375 gpu_context: Option<GpuContext>,
376 context: &WgpuContext,
377 surface: wgpu::Surface<'static>,
378 config: WgpuSurfaceConfig,
379 compositor_gpu: Option<CompositorGpuHint>,
380 atlas: Arc<WgpuAtlas>,
381 ) -> anyhow::Result<Self> {
382 let surface_caps = surface.get_capabilities(&context.adapter);
383 let preferred_formats = [
384 wgpu::TextureFormat::Bgra8Unorm,
385 wgpu::TextureFormat::Rgba8Unorm,
386 ];
387 let surface_format = preferred_formats
388 .iter()
389 .find(|f| surface_caps.formats.contains(f))
390 .copied()
391 .or_else(|| surface_caps.formats.iter().find(|f| !f.is_srgb()).copied())
392 .or_else(|| surface_caps.formats.first().copied())
393 .ok_or_else(|| {
394 anyhow::anyhow!(
395 "Surface reports no supported texture formats for adapter {:?}",
396 context.adapter.get_info().name
397 )
398 })?;
399
400 let pick_alpha_mode =
401 |preferences: &[wgpu::CompositeAlphaMode]| -> anyhow::Result<wgpu::CompositeAlphaMode> {
402 preferences
403 .iter()
404 .find(|p| surface_caps.alpha_modes.contains(p))
405 .copied()
406 .or_else(|| surface_caps.alpha_modes.first().copied())
407 .ok_or_else(|| {
408 anyhow::anyhow!(
409 "Surface reports no supported alpha modes for adapter {:?}",
410 context.adapter.get_info().name
411 )
412 })
413 };
414
415 let transparent_alpha_mode = pick_alpha_mode(&[
416 wgpu::CompositeAlphaMode::PreMultiplied,
417 wgpu::CompositeAlphaMode::Inherit,
418 ])?;
419
420 let opaque_alpha_mode = pick_alpha_mode(&[
421 wgpu::CompositeAlphaMode::Opaque,
422 wgpu::CompositeAlphaMode::Inherit,
423 ])?;
424
425 let alpha_mode = if config.transparent {
426 transparent_alpha_mode
427 } else {
428 opaque_alpha_mode
429 };
430
431 let device = Arc::clone(&context.device);
432 let max_texture_size = device.limits().max_texture_dimension_2d;
433
434 let requested_width = config.size.width.0 as u32;
435 let requested_height = config.size.height.0 as u32;
436 let clamped_width = requested_width.min(max_texture_size);
437 let clamped_height = requested_height.min(max_texture_size);
438
439 if clamped_width != requested_width || clamped_height != requested_height {
440 warn!(
441 "Requested surface size ({}, {}) exceeds maximum texture dimension {}. \
442 Clamping to ({}, {}). Window content may not fill the entire window.",
443 requested_width, requested_height, max_texture_size, clamped_width, clamped_height
444 );
445 }
446
447 let surface_config = wgpu::SurfaceConfiguration {
448 usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
449 format: surface_format,
450 width: clamped_width.max(1),
451 height: clamped_height.max(1),
452 present_mode: config
453 .preferred_present_mode
454 .filter(|mode| surface_caps.present_modes.contains(mode))
455 .unwrap_or(wgpu::PresentMode::Fifo),
456 desired_maximum_frame_latency: 2,
457 alpha_mode,
458 view_formats: vec![],
459 };
460 // Configure the surface immediately. The adapter selection process already validated
461 // that this adapter can successfully configure this surface.
462 surface.configure(&context.device, &surface_config);
463
464 let core = WgpuRendererCore::new(context, atlas.clone(), surface_format, alpha_mode);
465
466 Ok(Self {
467 context: gpu_context,
468 compositor_gpu,
469 state: RendererState::Ready { surface, core },
470 surface_config,
471 atlas,
472 transparent_alpha_mode,
473 opaque_alpha_mode,
474 max_texture_size,
475 is_bgr: false,
476 failed_frame_count: 0,
477 device_errors: Arc::clone(context.errors()),
478 observed_error_generation: 0,
479 last_surface_error: None,
480 needs_redraw: false,
481 })
482 }
483}
484
485impl WgpuRendererCore {
486 fn create_bind_group_layouts(
487 device: &wgpu::Device,
488 uses_webgl_instance_data: bool,
489 ) -> WgpuBindGroupLayouts {
490 let globals =
491 device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
492 label: Some("globals_layout"),
493 entries: &[
494 wgpu::BindGroupLayoutEntry {
495 binding: 0,
496 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
497 ty: wgpu::BindingType::Buffer {
498 ty: wgpu::BufferBindingType::Uniform,
499 has_dynamic_offset: false,
500 min_binding_size: NonZeroU64::new(
501 std::mem::size_of::<GlobalParams>() as u64
502 ),
503 },
504 count: None,
505 },
506 wgpu::BindGroupLayoutEntry {
507 binding: 1,
508 visibility: wgpu::ShaderStages::FRAGMENT,
509 ty: wgpu::BindingType::Buffer {
510 ty: wgpu::BufferBindingType::Uniform,
511 has_dynamic_offset: false,
512 min_binding_size: NonZeroU64::new(
513 std::mem::size_of::<GammaParams>() as u64
514 ),
515 },
516 count: None,
517 },
518 ],
519 });
520
521 let instance_data_entry = wgpu::BindGroupLayoutEntry {
522 binding: 0,
523 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
524 ty: if uses_webgl_instance_data {
525 wgpu::BindingType::Texture {
526 sample_type: wgpu::TextureSampleType::Uint,
527 view_dimension: wgpu::TextureViewDimension::D2,
528 multisampled: false,
529 }
530 } else {
531 wgpu::BindingType::Buffer {
532 ty: wgpu::BufferBindingType::Storage { read_only: true },
533 has_dynamic_offset: false,
534 min_binding_size: None,
535 }
536 },
537 count: None,
538 };
539
540 let instances = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
541 label: Some("instances_layout"),
542 entries: &[instance_data_entry],
543 });
544
545 let texture = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
546 label: Some("texture_layout"),
547 entries: &[
548 wgpu::BindGroupLayoutEntry {
549 binding: 0,
550 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
551 ty: wgpu::BindingType::Texture {
552 sample_type: wgpu::TextureSampleType::Float { filterable: true },
553 view_dimension: wgpu::TextureViewDimension::D2,
554 multisampled: false,
555 },
556 count: None,
557 },
558 wgpu::BindGroupLayoutEntry {
559 binding: 1,
560 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
561 ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
562 count: None,
563 },
564 ],
565 });
566
567 let surfaces = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
568 label: Some("surfaces_layout"),
569 entries: &[
570 wgpu::BindGroupLayoutEntry {
571 binding: 0,
572 visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
573 ty: wgpu::BindingType::Buffer {
574 ty: wgpu::BufferBindingType::Uniform,
575 has_dynamic_offset: false,
576 min_binding_size: NonZeroU64::new(
577 std::mem::size_of::<SurfaceParams>() as u64
578 ),
579 },
580 count: None,
581 },
582 wgpu::BindGroupLayoutEntry {
583 binding: 1,
584 visibility: wgpu::ShaderStages::FRAGMENT,
585 ty: wgpu::BindingType::Texture {
586 sample_type: wgpu::TextureSampleType::Float { filterable: true },
587 view_dimension: wgpu::TextureViewDimension::D2,
588 multisampled: false,
589 },
590 count: None,
591 },
592 wgpu::BindGroupLayoutEntry {
593 binding: 2,
594 visibility: wgpu::ShaderStages::FRAGMENT,
595 ty: wgpu::BindingType::Texture {
596 sample_type: wgpu::TextureSampleType::Float { filterable: true },
597 view_dimension: wgpu::TextureViewDimension::D2,
598 multisampled: false,
599 },
600 count: None,
601 },
602 wgpu::BindGroupLayoutEntry {
603 binding: 3,
604 visibility: wgpu::ShaderStages::FRAGMENT,
605 ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
606 count: None,
607 },
608 ],
609 });
610
611 WgpuBindGroupLayouts {
612 globals,
613 instances,
614 texture,
615 surfaces,
616 }
617 }
618
619 fn create_instance_texture(
620 device: &wgpu::Device,
621 requested_capacity: u64,
622 max_texture_dimension: u32,
623 ) -> (InstanceData, u64) {
624 let texel_count = requested_capacity.div_ceil(INSTANCE_TEXTURE_TEXEL_SIZE);
625 let width = texel_count.min(u64::from(max_texture_dimension)).max(1) as u32;
626 let height = texel_count
627 .div_ceil(u64::from(width))
628 .min(u64::from(max_texture_dimension))
629 .max(1) as u32;
630 let texture = device.create_texture(&wgpu::TextureDescriptor {
631 label: Some("instance_texture"),
632 size: wgpu::Extent3d {
633 width,
634 height,
635 depth_or_array_layers: 1,
636 },
637 mip_level_count: 1,
638 sample_count: 1,
639 dimension: wgpu::TextureDimension::D2,
640 format: wgpu::TextureFormat::Rgba32Uint,
641 usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
642 view_formats: &[],
643 });
644 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
645 let capacity = u64::from(width) * u64::from(height) * INSTANCE_TEXTURE_TEXEL_SIZE;
646 (
647 InstanceData::Texture {
648 texture,
649 view,
650 width,
651 height,
652 },
653 capacity,
654 )
655 }
656
657 fn create_pipelines(
658 device: &wgpu::Device,
659 layouts: &WgpuBindGroupLayouts,
660 surface_format: wgpu::TextureFormat,
661 alpha_mode: wgpu::CompositeAlphaMode,
662 path_sample_count: u32,
663 dual_source_blending: bool,
664 uses_webgl_instance_data: bool,
665 ) -> WgpuPipelines {
666 // Diagnostic guard: verify the device actually has
667 // DUAL_SOURCE_BLENDING. We have a crash report (ZED-5G1) where a
668 // feature mismatch caused a wgpu-hal abort, but we haven't
669 // identified the code path that produces the mismatch. This
670 // guard prevents the crash and logs more evidence.
671 // Remove this check once:
672 // a) We find and fix the root cause, or
673 // b) There are no reports of this warning appearing for some time.
674 let device_has_feature = device
675 .features()
676 .contains(wgpu::Features::DUAL_SOURCE_BLENDING);
677 if dual_source_blending && !device_has_feature {
678 log::error!(
679 "BUG: dual_source_blending flag is true but device does not \
680 have DUAL_SOURCE_BLENDING enabled (device features: {:?}). \
681 Falling back to mono text rendering. Please report this at \
682 https://github.com/zed-industries/zed/issues",
683 device.features(),
684 );
685 }
686 let dual_source_blending =
687 dual_source_blending && device_has_feature && !uses_webgl_instance_data;
688
689 let shader_source = if uses_webgl_instance_data {
690 WEBGL_SHADERS
691 } else {
692 STORAGE_BUFFER_SHADERS
693 };
694 let shader_module = device.create_shader_module(wgpu::ShaderModuleDescriptor {
695 label: Some("gpui_shaders"),
696 source: wgpu::ShaderSource::Wgsl(shader_source.into()),
697 });
698
699 let subpixel_shader_module = if dual_source_blending {
700 Some(device.create_shader_module(wgpu::ShaderModuleDescriptor {
701 label: Some("gpui_subpixel_shaders"),
702 source: wgpu::ShaderSource::Wgsl(SUBPIXEL_SHADERS.into()),
703 }))
704 } else {
705 None
706 };
707
708 let blend_mode = match alpha_mode {
709 wgpu::CompositeAlphaMode::PreMultiplied => {
710 wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING
711 }
712 _ => wgpu::BlendState::ALPHA_BLENDING,
713 };
714
715 let color_target = wgpu::ColorTargetState {
716 format: surface_format,
717 blend: Some(blend_mode),
718 write_mask: wgpu::ColorWrites::ALL,
719 };
720
721 let create_pipeline = |name: &str,
722 vs_entry: &str,
723 fs_entry: &str,
724 globals_layout: &wgpu::BindGroupLayout,
725 data_layout: &wgpu::BindGroupLayout,
726 texture_layout: Option<&wgpu::BindGroupLayout>,
727 topology: wgpu::PrimitiveTopology,
728 color_targets: &[Option<wgpu::ColorTargetState>],
729 sample_count: u32,
730 module: &wgpu::ShaderModule| {
731 let mut bind_group_layouts = vec![Some(globals_layout), Some(data_layout)];
732 bind_group_layouts.extend(texture_layout.map(Some));
733 let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
734 label: Some(&format!("{name}_layout")),
735 bind_group_layouts: &bind_group_layouts,
736 immediate_size: 0,
737 });
738
739 device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
740 label: Some(name),
741 layout: Some(&pipeline_layout),
742 vertex: wgpu::VertexState {
743 module,
744 entry_point: Some(vs_entry),
745 buffers: &[],
746 compilation_options: wgpu::PipelineCompilationOptions::default(),
747 },
748 fragment: Some(wgpu::FragmentState {
749 module,
750 entry_point: Some(fs_entry),
751 targets: color_targets,
752 compilation_options: wgpu::PipelineCompilationOptions::default(),
753 }),
754 primitive: wgpu::PrimitiveState {
755 topology,
756 strip_index_format: None,
757 front_face: wgpu::FrontFace::Ccw,
758 cull_mode: None,
759 polygon_mode: wgpu::PolygonMode::Fill,
760 unclipped_depth: false,
761 conservative: false,
762 },
763 depth_stencil: None,
764 multisample: wgpu::MultisampleState {
765 count: sample_count,
766 mask: !0,
767 alpha_to_coverage_enabled: false,
768 },
769 multiview_mask: None,
770 cache: None,
771 })
772 };
773
774 let quads = create_pipeline(
775 "quads",
776 "vs_quad",
777 "fs_quad",
778 &layouts.globals,
779 &layouts.instances,
780 None,
781 wgpu::PrimitiveTopology::TriangleStrip,
782 &[Some(color_target.clone())],
783 1,
784 &shader_module,
785 );
786
787 let shadows = create_pipeline(
788 "shadows",
789 "vs_shadow",
790 "fs_shadow",
791 &layouts.globals,
792 &layouts.instances,
793 None,
794 wgpu::PrimitiveTopology::TriangleStrip,
795 &[Some(color_target.clone())],
796 1,
797 &shader_module,
798 );
799
800 let path_rasterization = create_pipeline(
801 "path_rasterization",
802 "vs_path_rasterization",
803 "fs_path_rasterization",
804 &layouts.globals,
805 &layouts.instances,
806 None,
807 wgpu::PrimitiveTopology::TriangleList,
808 &[Some(wgpu::ColorTargetState {
809 format: surface_format,
810 blend: Some(wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING),
811 write_mask: wgpu::ColorWrites::ALL,
812 })],
813 path_sample_count,
814 &shader_module,
815 );
816
817 let paths_blend = wgpu::BlendState {
818 color: wgpu::BlendComponent {
819 src_factor: wgpu::BlendFactor::One,
820 dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
821 operation: wgpu::BlendOperation::Add,
822 },
823 alpha: wgpu::BlendComponent {
824 src_factor: wgpu::BlendFactor::One,
825 dst_factor: wgpu::BlendFactor::One,
826 operation: wgpu::BlendOperation::Add,
827 },
828 };
829
830 let paths = create_pipeline(
831 "paths",
832 "vs_path",
833 "fs_path",
834 &layouts.globals,
835 &layouts.instances,
836 Some(&layouts.texture),
837 wgpu::PrimitiveTopology::TriangleStrip,
838 &[Some(wgpu::ColorTargetState {
839 format: surface_format,
840 blend: Some(paths_blend),
841 write_mask: wgpu::ColorWrites::ALL,
842 })],
843 1,
844 &shader_module,
845 );
846
847 let underlines = create_pipeline(
848 "underlines",
849 "vs_underline",
850 "fs_underline",
851 &layouts.globals,
852 &layouts.instances,
853 None,
854 wgpu::PrimitiveTopology::TriangleStrip,
855 &[Some(color_target.clone())],
856 1,
857 &shader_module,
858 );
859
860 let mono_sprites = create_pipeline(
861 "mono_sprites",
862 "vs_mono_sprite",
863 "fs_mono_sprite",
864 &layouts.globals,
865 &layouts.instances,
866 Some(&layouts.texture),
867 wgpu::PrimitiveTopology::TriangleStrip,
868 &[Some(color_target.clone())],
869 1,
870 &shader_module,
871 );
872
873 let subpixel_sprites = if let Some(subpixel_module) = &subpixel_shader_module {
874 let subpixel_blend = wgpu::BlendState {
875 color: wgpu::BlendComponent {
876 src_factor: wgpu::BlendFactor::Src1,
877 dst_factor: wgpu::BlendFactor::OneMinusSrc1,
878 operation: wgpu::BlendOperation::Add,
879 },
880 alpha: wgpu::BlendComponent {
881 src_factor: wgpu::BlendFactor::One,
882 dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
883 operation: wgpu::BlendOperation::Add,
884 },
885 };
886
887 Some(create_pipeline(
888 "subpixel_sprites",
889 "vs_subpixel_sprite",
890 "fs_subpixel_sprite",
891 &layouts.globals,
892 &layouts.instances,
893 Some(&layouts.texture),
894 wgpu::PrimitiveTopology::TriangleStrip,
895 &[Some(wgpu::ColorTargetState {
896 format: surface_format,
897 blend: Some(subpixel_blend),
898 write_mask: wgpu::ColorWrites::COLOR,
899 })],
900 1,
901 subpixel_module,
902 ))
903 } else {
904 None
905 };
906
907 let poly_sprites = create_pipeline(
908 "poly_sprites",
909 "vs_poly_sprite",
910 "fs_poly_sprite",
911 &layouts.globals,
912 &layouts.instances,
913 Some(&layouts.texture),
914 wgpu::PrimitiveTopology::TriangleStrip,
915 &[Some(color_target.clone())],
916 1,
917 &shader_module,
918 );
919
920 let surfaces = create_pipeline(
921 "surfaces",
922 "vs_surface",
923 "fs_surface",
924 &layouts.globals,
925 &layouts.surfaces,
926 None,
927 wgpu::PrimitiveTopology::TriangleStrip,
928 &[Some(color_target)],
929 1,
930 &shader_module,
931 );
932
933 WgpuPipelines {
934 quads,
935 shadows,
936 path_rasterization,
937 paths,
938 underlines,
939 mono_sprites,
940 subpixel_sprites,
941 poly_sprites,
942 surfaces,
943 }
944 }
945
946 fn create_path_intermediate(
947 device: &wgpu::Device,
948 format: wgpu::TextureFormat,
949 width: u32,
950 height: u32,
951 ) -> (wgpu::Texture, wgpu::TextureView) {
952 let texture = device.create_texture(&wgpu::TextureDescriptor {
953 label: Some("path_intermediate"),
954 size: wgpu::Extent3d {
955 width: width.max(1),
956 height: height.max(1),
957 depth_or_array_layers: 1,
958 },
959 mip_level_count: 1,
960 sample_count: 1,
961 dimension: wgpu::TextureDimension::D2,
962 format,
963 usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING,
964 view_formats: &[],
965 });
966 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
967 (texture, view)
968 }
969
970 fn create_msaa_if_needed(
971 device: &wgpu::Device,
972 format: wgpu::TextureFormat,
973 width: u32,
974 height: u32,
975 sample_count: u32,
976 ) -> Option<(wgpu::Texture, wgpu::TextureView)> {
977 if sample_count <= 1 {
978 return None;
979 }
980 let texture = device.create_texture(&wgpu::TextureDescriptor {
981 label: Some("path_msaa"),
982 size: wgpu::Extent3d {
983 width: width.max(1),
984 height: height.max(1),
985 depth_or_array_layers: 1,
986 },
987 mip_level_count: 1,
988 sample_count,
989 dimension: wgpu::TextureDimension::D2,
990 format,
991 usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
992 view_formats: &[],
993 });
994 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
995 Some((texture, view))
996 }
997}
998
999impl WgpuRenderer {
1000 /// Records the new drawable size and reconfigures the surface when one is present.
1001 /// The size is kept even without GPU resources so that recovery restores it.
1002 pub fn update_drawable_size(&mut self, size: Size<DevicePixels>) {
1003 let width = size.width.0 as u32;
1004 let height = size.height.0 as u32;
1005
1006 if width == self.surface_config.width && height == self.surface_config.height {
1007 return;
1008 }
1009
1010 let clamped_width = width.min(self.max_texture_size);
1011 let clamped_height = height.min(self.max_texture_size);
1012 if clamped_width != width || clamped_height != height {
1013 warn!(
1014 "Requested surface size ({}, {}) exceeds maximum texture dimension {}. \
1015 Clamping to ({}, {}). Window content may not fill the entire window.",
1016 width, height, self.max_texture_size, clamped_width, clamped_height
1017 );
1018 }
1019 self.surface_config.width = clamped_width.max(1);
1020 self.surface_config.height = clamped_height.max(1);
1021
1022 let Some(core) = self.core_mut() else {
1023 return;
1024 };
1025 let resources = &mut core.resources;
1026
1027 // Wait for any in-flight GPU work to complete before destroying textures
1028 if let Err(e) = resources.device.poll(wgpu::PollType::Wait {
1029 submission_index: None,
1030 timeout: None,
1031 }) {
1032 warn!("Failed to poll device during resize: {e:?}");
1033 }
1034
1035 // Destroy old textures before allocating new ones to avoid GPU memory spikes
1036 if let Some(ref texture) = resources.path_intermediate_texture {
1037 texture.destroy();
1038 }
1039 if let Some(ref texture) = resources.path_msaa_texture {
1040 texture.destroy();
1041 }
1042
1043 // Invalidate intermediate textures - they will be lazily recreated
1044 // in draw() after we confirm the surface is healthy. This avoids
1045 // panics when the device/surface is in an invalid state during resize.
1046 resources.invalidate_intermediate_textures();
1047
1048 if let RendererState::Ready { surface, core } = &self.state {
1049 surface.configure(&core.resources.device, &self.surface_config);
1050 }
1051 }
1052
1053 pub fn set_subpixel_layout(&mut self, is_bgr: bool) {
1054 self.is_bgr = is_bgr;
1055 if let Some(core) = self.core_mut() {
1056 core.is_bgr = is_bgr;
1057 }
1058 }
1059
1060 pub fn update_transparency(&mut self, transparent: bool) {
1061 let new_alpha_mode = if transparent {
1062 self.transparent_alpha_mode
1063 } else {
1064 self.opaque_alpha_mode
1065 };
1066 if new_alpha_mode == self.surface_config.alpha_mode {
1067 return;
1068 }
1069 self.surface_config.alpha_mode = new_alpha_mode;
1070 let format = self.surface_config.format;
1071
1072 let Some(core) = self.core_mut() else {
1073 return;
1074 };
1075 let resources = &mut core.resources;
1076 resources.pipelines = WgpuRendererCore::create_pipelines(
1077 &resources.device,
1078 &resources.bind_group_layouts,
1079 format,
1080 new_alpha_mode,
1081 core.rendering_params.path_sample_count,
1082 core.dual_source_blending,
1083 core.uses_webgl_instance_data,
1084 );
1085
1086 if let RendererState::Ready { surface, core } = &self.state {
1087 surface.configure(&core.resources.device, &self.surface_config);
1088 }
1089 }
1090
1091 #[allow(dead_code)]
1092 pub fn viewport_size(&self) -> Size<DevicePixels> {
1093 Size {
1094 width: DevicePixels(self.surface_config.width as i32),
1095 height: DevicePixels(self.surface_config.height as i32),
1096 }
1097 }
1098
1099 pub fn sprite_atlas(&self) -> &Arc<WgpuAtlas> {
1100 &self.atlas
1101 }
1102
1103 pub fn supports_dual_source_blending(&self) -> bool {
1104 self.core().is_some_and(|core| core.dual_source_blending)
1105 }
1106
1107 /// Returns `None` once GPU resources have been released by `destroy` or a pending
1108 /// device recovery.
1109 pub fn gpu_specs(&self) -> Option<GpuSpecs> {
1110 let adapter_info = &self.core()?.adapter_info;
1111 Some(GpuSpecs {
1112 is_software_emulated: adapter_info.device_type == wgpu::DeviceType::Cpu,
1113 device_name: adapter_info.name.clone(),
1114 driver_name: adapter_info.driver.clone(),
1115 driver_info: adapter_info.driver_info.clone(),
1116 })
1117 }
1118
1119 pub fn max_texture_size(&self) -> u32 {
1120 self.max_texture_size
1121 }
1122
1123 pub fn draw(&mut self, scene: &Scene) -> bool {
1124 #[cfg(target_family = "wasm")]
1125 if self.device_lost() {
1126 if matches!(self.state, RendererState::Ready { .. }) {
1127 log::error!(
1128 "Browser graphics context was lost; rendering has stopped. Reload the page to recover."
1129 );
1130 self.unconfigure_surface();
1131 }
1132 return false;
1133 }
1134
1135 // Bail out early if the surface has been unconfigured (e.g. during
1136 // Android background/rotation transitions). Attempting to acquire
1137 // a texture from an unconfigured surface can block indefinitely on
1138 // some drivers (Adreno).
1139 let RendererState::Ready { surface, core } = &mut self.state else {
1140 return false;
1141 };
1142
1143 if let Some(error) = self.last_surface_error.take().or_else(|| {
1144 self.device_errors
1145 .observe_error(&mut self.observed_error_generation)
1146 }) {
1147 self.failed_frame_count += 1;
1148 log::error!(
1149 "GPU error during frame (failure {} of 10): {error}",
1150 self.failed_frame_count
1151 );
1152
1153 // TBD. Does retrying more actually help?
1154 if self.failed_frame_count > 10 {
1155 panic!("Too many consecutive GPU errors. Last error: {error}");
1156 } else if self.failed_frame_count > 5 {
1157 core.resources.invalidate_intermediate_textures();
1158 self.atlas.clear();
1159 self.needs_redraw = true;
1160 self.failed_frame_count = 0;
1161 return false;
1162 }
1163 } else {
1164 self.failed_frame_count = 0;
1165 }
1166
1167 let frame = match surface.get_current_texture() {
1168 wgpu::CurrentSurfaceTexture::Success(frame) => frame,
1169 wgpu::CurrentSurfaceTexture::Suboptimal(frame) => {
1170 // Textures must be destroyed before the surface can be reconfigured.
1171 drop(frame);
1172 surface.configure(&core.resources.device, &self.surface_config);
1173 return false;
1174 }
1175 wgpu::CurrentSurfaceTexture::Lost | wgpu::CurrentSurfaceTexture::Outdated => {
1176 surface.configure(&core.resources.device, &self.surface_config);
1177 return false;
1178 }
1179 wgpu::CurrentSurfaceTexture::Timeout | wgpu::CurrentSurfaceTexture::Occluded => {
1180 return false;
1181 }
1182 wgpu::CurrentSurfaceTexture::Validation => {
1183 self.last_surface_error = Some("Surface texture validation error".to_string());
1184 return false;
1185 }
1186 };
1187
1188 // The acquired texture is the authority on frame dimensions; the surface
1189 // configuration is only a request.
1190 let size = Size {
1191 width: DevicePixels(frame.texture.width() as i32),
1192 height: DevicePixels(frame.texture.height() as i32),
1193 };
1194 let frame_view = frame
1195 .texture
1196 .create_view(&wgpu::TextureViewDescriptor::default());
1197 let premultiplied_alpha =
1198 self.surface_config.alpha_mode == wgpu::CompositeAlphaMode::PreMultiplied;
1199 if let Err(error) = core.render_frame(
1200 scene,
1201 &frame_view,
1202 size,
1203 premultiplied_alpha,
1204 wgpu::Color::TRANSPARENT,
1205 ) {
1206 log::error!("{error:#}");
1207 return false;
1208 }
1209
1210 frame.present();
1211 true
1212 }
1213}
1214
1215impl WgpuRendererCore {
1216 fn new(
1217 context: &WgpuContext,
1218 atlas: Arc<WgpuAtlas>,
1219 target_format: wgpu::TextureFormat,
1220 alpha_mode: wgpu::CompositeAlphaMode,
1221 ) -> Self {
1222 let device = Arc::clone(&context.device);
1223 let queue = Arc::clone(&context.queue);
1224 let rendering_params = RenderingParameters::new(&context.adapter, target_format);
1225 let uses_webgl_instance_data = context.uses_webgl_instance_data();
1226 let dual_source_blending =
1227 context.supports_dual_source_blending() && !uses_webgl_instance_data;
1228 let bind_group_layouts = Self::create_bind_group_layouts(&device, uses_webgl_instance_data);
1229 let pipelines = Self::create_pipelines(
1230 &device,
1231 &bind_group_layouts,
1232 target_format,
1233 alpha_mode,
1234 rendering_params.path_sample_count,
1235 dual_source_blending,
1236 uses_webgl_instance_data,
1237 );
1238 let atlas_sampler = device.create_sampler(&wgpu::SamplerDescriptor {
1239 label: Some("atlas_sampler"),
1240 mag_filter: wgpu::FilterMode::Linear,
1241 min_filter: wgpu::FilterMode::Linear,
1242 ..Default::default()
1243 });
1244 let uniform_alignment = device.limits().min_uniform_buffer_offset_alignment as u64;
1245 let globals_size = std::mem::size_of::<GlobalParams>() as u64;
1246 let gamma_size = std::mem::size_of::<GammaParams>() as u64;
1247 let path_globals_offset = globals_size.next_multiple_of(uniform_alignment);
1248 let gamma_offset = (path_globals_offset + globals_size).next_multiple_of(uniform_alignment);
1249 let globals_buffer = device.create_buffer(&wgpu::BufferDescriptor {
1250 label: Some("globals_buffer"),
1251 size: gamma_offset + gamma_size,
1252 usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
1253 mapped_at_creation: false,
1254 });
1255 let (
1256 instance_data,
1257 instance_data_capacity,
1258 max_instance_data_size,
1259 instance_data_alignment,
1260 ) = if uses_webgl_instance_data {
1261 let max_texture_dimension = device.limits().max_texture_dimension_2d;
1262 let max_instance_data_size = (u64::from(max_texture_dimension).pow(2)
1263 * INSTANCE_TEXTURE_TEXEL_SIZE)
1264 .min(MAX_INSTANCE_BUFFER_SIZE);
1265 let initial_capacity = (2 * 1024 * 1024).min(max_instance_data_size);
1266 let (instance_data, capacity) =
1267 Self::create_instance_texture(&device, initial_capacity, max_texture_dimension);
1268 (
1269 instance_data,
1270 capacity,
1271 max_instance_data_size,
1272 INSTANCE_TEXTURE_TEXEL_SIZE,
1273 )
1274 } else {
1275 let max_buffer_size = device
1276 .limits()
1277 .max_buffer_size
1278 .min(device.limits().max_storage_buffer_binding_size)
1279 .min(MAX_INSTANCE_BUFFER_SIZE);
1280 let initial_capacity = (2 * 1024 * 1024).min(max_buffer_size);
1281 let buffer = device.create_buffer(&wgpu::BufferDescriptor {
1282 label: Some("instance_buffer"),
1283 size: initial_capacity,
1284 usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST,
1285 mapped_at_creation: false,
1286 });
1287 (
1288 InstanceData::Storage(buffer),
1289 initial_capacity,
1290 max_buffer_size,
1291 device.limits().min_storage_buffer_offset_alignment as u64,
1292 )
1293 };
1294 let globals_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
1295 label: Some("globals_bind_group"),
1296 layout: &bind_group_layouts.globals,
1297 entries: &[
1298 wgpu::BindGroupEntry {
1299 binding: 0,
1300 resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1301 buffer: &globals_buffer,
1302 offset: 0,
1303 size: NonZeroU64::new(globals_size),
1304 }),
1305 },
1306 wgpu::BindGroupEntry {
1307 binding: 1,
1308 resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1309 buffer: &globals_buffer,
1310 offset: gamma_offset,
1311 size: NonZeroU64::new(gamma_size),
1312 }),
1313 },
1314 ],
1315 });
1316 let path_globals_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
1317 label: Some("path_globals_bind_group"),
1318 layout: &bind_group_layouts.globals,
1319 entries: &[
1320 wgpu::BindGroupEntry {
1321 binding: 0,
1322 resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1323 buffer: &globals_buffer,
1324 offset: path_globals_offset,
1325 size: NonZeroU64::new(globals_size),
1326 }),
1327 },
1328 wgpu::BindGroupEntry {
1329 binding: 1,
1330 resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1331 buffer: &globals_buffer,
1332 offset: gamma_offset,
1333 size: NonZeroU64::new(gamma_size),
1334 }),
1335 },
1336 ],
1337 });
1338 let max_texture_size = device.limits().max_texture_dimension_2d;
1339
1340 Self {
1341 resources: WgpuResources {
1342 device,
1343 queue,
1344 pipelines,
1345 bind_group_layouts,
1346 atlas_sampler,
1347 atlas_texture_bind_groups: FxHashMap::default(),
1348 globals_buffer,
1349 globals_bind_group,
1350 path_globals_bind_group,
1351 instance_data,
1352 path_intermediate_texture: None,
1353 path_intermediate_view: None,
1354 path_msaa_texture: None,
1355 path_msaa_view: None,
1356 },
1357 atlas,
1358 path_globals_offset,
1359 gamma_offset,
1360 instance_data_capacity,
1361 max_instance_data_size,
1362 instance_data_alignment,
1363 uses_webgl_instance_data,
1364 rendering_params,
1365 is_bgr: false,
1366 dual_source_blending,
1367 adapter_info: context.adapter.get_info(),
1368 target_format,
1369 max_texture_size,
1370 }
1371 }
1372
1373 fn resources(&self) -> &WgpuResources {
1374 &self.resources
1375 }
1376
1377 fn resources_mut(&mut self) -> &mut WgpuResources {
1378 &mut self.resources
1379 }
1380
1381 /// Path rendering goes through an intermediate texture that must match the frame
1382 /// target's dimensions, so the textures are keyed by size and rebuilt on mismatch.
1383 fn ensure_intermediate_textures(&mut self, size: Size<DevicePixels>) {
1384 let width = size.width.0 as u32;
1385 let height = size.height.0 as u32;
1386 if self
1387 .resources
1388 .path_intermediate_texture
1389 .as_ref()
1390 .is_some_and(|texture| texture.width() == width && texture.height() == height)
1391 {
1392 return;
1393 }
1394
1395 let format = self.target_format;
1396 let path_sample_count = self.rendering_params.path_sample_count;
1397 let resources = &mut self.resources;
1398
1399 let (texture, view) =
1400 Self::create_path_intermediate(&resources.device, format, width, height);
1401 resources.path_intermediate_texture = Some(texture);
1402 resources.path_intermediate_view = Some(view);
1403
1404 let (path_msaa_texture, path_msaa_view) = Self::create_msaa_if_needed(
1405 &resources.device,
1406 format,
1407 width,
1408 height,
1409 path_sample_count,
1410 )
1411 .map(|(texture, view)| (Some(texture), Some(view)))
1412 .unwrap_or((None, None));
1413 resources.path_msaa_texture = path_msaa_texture;
1414 resources.path_msaa_view = path_msaa_view;
1415 }
1416
1417 fn render_frame(
1418 &mut self,
1419 scene: &Scene,
1420 target_view: &wgpu::TextureView,
1421 size: Size<DevicePixels>,
1422 premultiplied_alpha: bool,
1423 clear_color: wgpu::Color,
1424 ) -> Result<wgpu::SubmissionIndex> {
1425 anyhow::ensure!(
1426 size.width.0 > 0 && size.height.0 > 0,
1427 "invalid render target size: {size:?}"
1428 );
1429 anyhow::ensure!(
1430 size.width.0 as u32 <= self.max_texture_size
1431 && size.height.0 as u32 <= self.max_texture_size,
1432 "render target size {size:?} exceeds maximum texture dimension {}",
1433 self.max_texture_size
1434 );
1435
1436 self.atlas.before_frame();
1437 self.ensure_intermediate_textures(size);
1438
1439 let gamma_params = GammaParams {
1440 gamma_ratios: self.rendering_params.gamma_ratios,
1441 grayscale_enhanced_contrast: self.rendering_params.grayscale_enhanced_contrast,
1442 subpixel_enhanced_contrast: self.rendering_params.subpixel_enhanced_contrast,
1443 is_bgr: self.is_bgr as u32,
1444 _pad: 0,
1445 };
1446 let globals = GlobalParams {
1447 viewport_size: [size.width.0 as f32, size.height.0 as f32],
1448 premultiplied_alpha: premultiplied_alpha as u32,
1449 pad: 0,
1450 };
1451 let path_globals = GlobalParams {
1452 premultiplied_alpha: 0,
1453 ..globals
1454 };
1455 self.resources.queue.write_buffer(
1456 &self.resources.globals_buffer,
1457 0,
1458 bytemuck::bytes_of(&globals),
1459 );
1460 self.resources.queue.write_buffer(
1461 &self.resources.globals_buffer,
1462 self.path_globals_offset,
1463 bytemuck::bytes_of(&path_globals),
1464 );
1465 self.resources.queue.write_buffer(
1466 &self.resources.globals_buffer,
1467 self.gamma_offset,
1468 bytemuck::bytes_of(&gamma_params),
1469 );
1470
1471 self.record_frame(scene, target_view, clear_color)
1472 .inspect_err(|_| {
1473 // Queue writes are staged before encoding; flush them even if the frame fails.
1474 self.resources.queue.submit(std::iter::empty());
1475 })
1476 }
1477
1478 fn record_frame(
1479 &mut self,
1480 scene: &Scene,
1481 frame_view: &wgpu::TextureView,
1482 clear_color: wgpu::Color,
1483 ) -> Result<wgpu::SubmissionIndex> {
1484 let mut instance_offset = 0;
1485 let instance_bindings = self
1486 .write_instances(scene, &mut instance_offset)
1487 .with_context(|| {
1488 format!(
1489 "scene too large: {} paths, {} shadows, {} quads, {} underlines, {} monochrome sprites, {} subpixel sprites, {} polychrome sprites",
1490 scene.paths.len(),
1491 scene.shadows.len(),
1492 scene.quads.len(),
1493 scene.underlines.len(),
1494 scene.monochrome_sprites.len(),
1495 scene.subpixel_sprites.len(),
1496 scene.polychrome_sprites.len(),
1497 )
1498 })?;
1499 self.prepare_texture_bind_groups(scene);
1500
1501 let mut encoder =
1502 self.resources()
1503 .device
1504 .create_command_encoder(&wgpu::CommandEncoderDescriptor {
1505 label: Some("main_encoder"),
1506 });
1507
1508 {
1509 let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
1510 label: Some("main_pass"),
1511 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
1512 view: frame_view,
1513 resolve_target: None,
1514 ops: wgpu::Operations {
1515 load: wgpu::LoadOp::Clear(clear_color),
1516 store: wgpu::StoreOp::Store,
1517 },
1518 depth_slice: None,
1519 })],
1520 depth_stencil_attachment: None,
1521 ..Default::default()
1522 });
1523
1524 for batch in scene.batches() {
1525 match batch {
1526 PrimitiveBatch::Quads(range) => self.draw_instances(
1527 &instance_bindings.quads,
1528 &self.resources().pipelines.quads,
1529 instance_range(range),
1530 &mut pass,
1531 ),
1532 PrimitiveBatch::Shadows(range) => self.draw_instances(
1533 &instance_bindings.shadows,
1534 &self.resources().pipelines.shadows,
1535 instance_range(range),
1536 &mut pass,
1537 ),
1538 PrimitiveBatch::Paths(range) => {
1539 let paths = &scene.paths[range];
1540 if paths.is_empty() {
1541 continue;
1542 }
1543
1544 drop(pass);
1545 let rasterized = self.draw_paths_to_intermediate(
1546 &mut encoder,
1547 paths,
1548 &mut instance_offset,
1549 )?;
1550
1551 pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
1552 label: Some("main_pass_continued"),
1553 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
1554 view: frame_view,
1555 resolve_target: None,
1556 ops: wgpu::Operations {
1557 load: wgpu::LoadOp::Load,
1558 store: wgpu::StoreOp::Store,
1559 },
1560 depth_slice: None,
1561 })],
1562 depth_stencil_attachment: None,
1563 ..Default::default()
1564 });
1565
1566 if rasterized {
1567 self.draw_paths_from_intermediate(
1568 paths,
1569 &mut instance_offset,
1570 &mut pass,
1571 )?;
1572 }
1573 }
1574 PrimitiveBatch::Underlines(range) => self.draw_instances(
1575 &instance_bindings.underlines,
1576 &self.resources().pipelines.underlines,
1577 instance_range(range),
1578 &mut pass,
1579 ),
1580 PrimitiveBatch::MonochromeSprites { texture_id, range } => {
1581 self.draw_sprites(
1582 &instance_bindings.monochrome_sprites,
1583 texture_id,
1584 &self.resources().pipelines.mono_sprites,
1585 instance_range(range),
1586 &mut pass,
1587 )?;
1588 }
1589 PrimitiveBatch::SubpixelSprites { texture_id, range } => {
1590 let resources = self.resources();
1591 self.draw_sprites(
1592 &instance_bindings.subpixel_sprites,
1593 texture_id,
1594 resources
1595 .pipelines
1596 .subpixel_sprites
1597 .as_ref()
1598 .unwrap_or(&resources.pipelines.mono_sprites),
1599 instance_range(range),
1600 &mut pass,
1601 )?;
1602 }
1603 PrimitiveBatch::PolychromeSprites { texture_id, range } => {
1604 self.draw_sprites(
1605 &instance_bindings.polychrome_sprites,
1606 texture_id,
1607 &self.resources().pipelines.poly_sprites,
1608 instance_range(range),
1609 &mut pass,
1610 )?;
1611 }
1612 // Surfaces are macOS-only for video playback and are not
1613 // implemented by the WGPU renderer.
1614 PrimitiveBatch::Surfaces(_surfaces) => {}
1615 }
1616 }
1617 }
1618
1619 let submission = self
1620 .resources()
1621 .queue
1622 .submit(std::iter::once(encoder.finish()));
1623 Ok(submission)
1624 }
1625
1626 fn write_instances(
1627 &mut self,
1628 scene: &Scene,
1629 instance_offset: &mut u64,
1630 ) -> Result<InstanceBindings> {
1631 Ok(InstanceBindings {
1632 quads: self.write_instance_binding(
1633 "quads_bind_group",
1634 instance_offset,
1635 &scene.quads,
1636 )?,
1637 shadows: self.write_instance_binding(
1638 "shadows_bind_group",
1639 instance_offset,
1640 &scene.shadows,
1641 )?,
1642 underlines: self.write_instance_binding(
1643 "underlines_bind_group",
1644 instance_offset,
1645 &scene.underlines,
1646 )?,
1647 monochrome_sprites: self.write_instance_binding(
1648 "monochrome_sprites_bind_group",
1649 instance_offset,
1650 &scene.monochrome_sprites,
1651 )?,
1652 subpixel_sprites: self.write_instance_binding(
1653 "subpixel_sprites_bind_group",
1654 instance_offset,
1655 &scene.subpixel_sprites,
1656 )?,
1657 polychrome_sprites: self.write_instance_binding(
1658 "polychrome_sprites_bind_group",
1659 instance_offset,
1660 &scene.polychrome_sprites,
1661 )?,
1662 })
1663 }
1664
1665 fn create_texture_bind_group(
1666 &self,
1667 label: &str,
1668 texture_view: &wgpu::TextureView,
1669 ) -> wgpu::BindGroup {
1670 let resources = self.resources();
1671 resources
1672 .device
1673 .create_bind_group(&wgpu::BindGroupDescriptor {
1674 label: Some(label),
1675 layout: &resources.bind_group_layouts.texture,
1676 entries: &[
1677 wgpu::BindGroupEntry {
1678 binding: 0,
1679 resource: wgpu::BindingResource::TextureView(texture_view),
1680 },
1681 wgpu::BindGroupEntry {
1682 binding: 1,
1683 resource: wgpu::BindingResource::Sampler(&resources.atlas_sampler),
1684 },
1685 ],
1686 })
1687 }
1688
1689 fn prepare_texture_bind_groups(&mut self, scene: &Scene) {
1690 let mut texture_ids = SmallVec::<[AtlasTextureId; 8]>::new();
1691 for batch in scene.batches() {
1692 let texture_id = match batch {
1693 PrimitiveBatch::MonochromeSprites { texture_id, .. }
1694 | PrimitiveBatch::SubpixelSprites { texture_id, .. }
1695 | PrimitiveBatch::PolychromeSprites { texture_id, .. } => texture_id,
1696 _ => continue,
1697 };
1698 if !texture_ids.contains(&texture_id) {
1699 texture_ids.push(texture_id);
1700 }
1701 }
1702
1703 self.resources_mut()
1704 .atlas_texture_bind_groups
1705 .retain(|texture_id, _| texture_ids.contains(texture_id));
1706
1707 for texture_id in texture_ids {
1708 let Some(texture_info) = self.atlas.get_texture_info(texture_id) else {
1709 self.resources_mut()
1710 .atlas_texture_bind_groups
1711 .remove(&texture_id);
1712 continue;
1713 };
1714 let is_current = self
1715 .resources()
1716 .atlas_texture_bind_groups
1717 .get(&texture_id)
1718 .is_some_and(|cached| cached.texture_generation == texture_info.generation);
1719 if is_current {
1720 continue;
1721 }
1722
1723 let bind_group =
1724 self.create_texture_bind_group("atlas_texture_bind_group", &texture_info.view);
1725 self.resources_mut().atlas_texture_bind_groups.insert(
1726 texture_id,
1727 CachedTextureBindGroup {
1728 texture_generation: texture_info.generation,
1729 bind_group,
1730 },
1731 );
1732 }
1733 }
1734
1735 fn draw_instances(
1736 &self,
1737 instances: &InstanceBinding,
1738 pipeline: &wgpu::RenderPipeline,
1739 range: Range<u32>,
1740 pass: &mut wgpu::RenderPass<'_>,
1741 ) {
1742 if range.is_empty() {
1743 return;
1744 }
1745 pass.set_pipeline(pipeline);
1746 pass.set_bind_group(0, &self.resources().globals_bind_group, &[]);
1747 pass.set_bind_group(1, &instances.bind_group, &[]);
1748 pass.draw(
1749 0..4,
1750 instances.first_instance + range.start..instances.first_instance + range.end,
1751 );
1752 }
1753
1754 fn draw_sprites(
1755 &self,
1756 sprite_instances: &InstanceBinding,
1757 texture_id: AtlasTextureId,
1758 pipeline: &wgpu::RenderPipeline,
1759 range: Range<u32>,
1760 pass: &mut wgpu::RenderPass<'_>,
1761 ) -> Result<()> {
1762 if range.is_empty() {
1763 return Ok(());
1764 }
1765 let resources = self.resources();
1766 // The atlas has released this texture; the batch belongs to a stale
1767 // paint that will be replaced once its view re-renders.
1768 let Some(texture) = resources.atlas_texture_bind_groups.get(&texture_id) else {
1769 return Ok(());
1770 };
1771 pass.set_pipeline(pipeline);
1772 pass.set_bind_group(0, &resources.globals_bind_group, &[]);
1773 pass.set_bind_group(1, &sprite_instances.bind_group, &[]);
1774 pass.set_bind_group(2, &texture.bind_group, &[]);
1775 pass.draw(
1776 0..4,
1777 sprite_instances.first_instance + range.start
1778 ..sprite_instances.first_instance + range.end,
1779 );
1780 Ok(())
1781 }
1782
1783 unsafe fn instance_bytes<T>(instances: &[T]) -> &[u8] {
1784 unsafe {
1785 std::slice::from_raw_parts(
1786 instances.as_ptr() as *const u8,
1787 std::mem::size_of_val(instances),
1788 )
1789 }
1790 }
1791
1792 fn draw_paths_from_intermediate(
1793 &mut self,
1794 paths: &[Path<ScaledPixels>],
1795 instance_offset: &mut u64,
1796 pass: &mut wgpu::RenderPass<'_>,
1797 ) -> Result<()> {
1798 let first_path = &paths[0];
1799 let sprites: Vec<PathSprite> = if paths.last().map(|p| &p.order) == Some(&first_path.order)
1800 {
1801 paths
1802 .iter()
1803 .map(|p| PathSprite {
1804 bounds: p.clipped_bounds(),
1805 })
1806 .collect()
1807 } else {
1808 let mut bounds = first_path.clipped_bounds();
1809 for path in paths.iter().skip(1) {
1810 bounds = bounds.union(&path.clipped_bounds());
1811 }
1812 vec![PathSprite { bounds }]
1813 };
1814
1815 let Some(path_intermediate_view) = self.resources().path_intermediate_view.clone() else {
1816 return Ok(());
1817 };
1818 let instances =
1819 self.write_instance_binding("path_sprites_bind_group", instance_offset, &sprites)?;
1820 let texture = self.create_texture_bind_group(
1821 "path_intermediate_texture_bind_group",
1822 &path_intermediate_view,
1823 );
1824 let resources = self.resources();
1825 pass.set_pipeline(&resources.pipelines.paths);
1826 pass.set_bind_group(0, &resources.globals_bind_group, &[]);
1827 pass.set_bind_group(1, &instances.bind_group, &[]);
1828 pass.set_bind_group(2, &texture, &[]);
1829 pass.draw(
1830 0..4,
1831 instances.first_instance..instances.first_instance + sprites.len() as u32,
1832 );
1833 Ok(())
1834 }
1835
1836 fn draw_paths_to_intermediate(
1837 &mut self,
1838 encoder: &mut wgpu::CommandEncoder,
1839 paths: &[Path<ScaledPixels>],
1840 instance_offset: &mut u64,
1841 ) -> Result<bool> {
1842 let mut vertices = Vec::new();
1843 for path in paths {
1844 let bounds = path.clipped_bounds();
1845 vertices.extend(path.vertices.iter().map(|v| PathRasterizationVertex {
1846 xy_position: v.xy_position,
1847 st_position: v.st_position,
1848 color: path.color,
1849 bounds,
1850 }));
1851 }
1852
1853 if vertices.is_empty() {
1854 return Ok(false);
1855 }
1856
1857 let vertex_binding = self.write_instance_binding(
1858 "path_rasterization_bind_group",
1859 instance_offset,
1860 &vertices,
1861 )?;
1862
1863 let resources = self.resources();
1864 let Some(path_intermediate_view) = resources.path_intermediate_view.as_ref() else {
1865 return Ok(false);
1866 };
1867
1868 let (target_view, resolve_target) = if let Some(ref msaa_view) = resources.path_msaa_view {
1869 (msaa_view, Some(path_intermediate_view))
1870 } else {
1871 (path_intermediate_view, None)
1872 };
1873
1874 {
1875 let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
1876 label: Some("path_rasterization_pass"),
1877 color_attachments: &[Some(wgpu::RenderPassColorAttachment {
1878 view: target_view,
1879 resolve_target,
1880 ops: wgpu::Operations {
1881 load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
1882 store: wgpu::StoreOp::Store,
1883 },
1884 depth_slice: None,
1885 })],
1886 depth_stencil_attachment: None,
1887 ..Default::default()
1888 });
1889
1890 pass.set_pipeline(&resources.pipelines.path_rasterization);
1891 pass.set_bind_group(0, &resources.path_globals_bind_group, &[]);
1892 pass.set_bind_group(1, &vertex_binding.bind_group, &[]);
1893 // The path rasterization shader loads records by vertex index
1894 // rather than instance index, so the allocation's base shifts the
1895 // vertex range here.
1896 pass.draw(
1897 vertex_binding.first_instance
1898 ..vertex_binding.first_instance + vertices.len() as u32,
1899 0..1,
1900 );
1901 }
1902
1903 Ok(true)
1904 }
1905
1906 fn write_instance_binding<T>(
1907 &mut self,
1908 label: &str,
1909 instance_offset: &mut u64,
1910 instances: &[T],
1911 ) -> Result<InstanceBinding> {
1912 let data = unsafe { Self::instance_bytes(instances) };
1913 // wgpu rejects zero-sized bindings, so empty primitive arrays still
1914 // reserve the 16-byte minimum.
1915 let size = (data.len() as u64).max(16);
1916 let stride = (std::mem::size_of::<T>() as u64).max(1);
1917 let (alignment, allocation_size) = if self.uses_webgl_instance_data {
1918 // The texture transport has no binding offset: the shader indexes
1919 // the instance texture absolutely, so each allocation must start on
1920 // a whole instance (a stride multiple) and a whole texel, and must
1921 // end on a texel boundary so the zero padding of its final partial
1922 // texel cannot overlap the next allocation.
1923 (
1924 least_common_multiple(self.instance_data_alignment, stride),
1925 size.next_multiple_of(INSTANCE_TEXTURE_TEXEL_SIZE),
1926 )
1927 } else {
1928 (self.instance_data_alignment.max(1), size)
1929 };
1930 let mut offset = (*instance_offset).next_multiple_of(alignment);
1931 if offset + allocation_size > self.instance_data_capacity {
1932 self.grow_instance_data(allocation_size)?;
1933 offset = 0;
1934 }
1935 *instance_offset = offset + allocation_size;
1936
1937 let first_instance = if self.uses_webgl_instance_data {
1938 u32::try_from(offset / stride).context("instance index exceeds u32 range")?
1939 } else {
1940 0
1941 };
1942
1943 let resources = self.resources();
1944 if !data.is_empty() {
1945 match &resources.instance_data {
1946 InstanceData::Storage(buffer) => resources.queue.write_buffer(buffer, offset, data),
1947 InstanceData::Texture { .. } => {
1948 Self::write_instance_texture(resources, offset, data)
1949 }
1950 }
1951 }
1952 let bind_group = resources
1953 .device
1954 .create_bind_group(&wgpu::BindGroupDescriptor {
1955 label: Some(label),
1956 layout: &resources.bind_group_layouts.instances,
1957 entries: &[wgpu::BindGroupEntry {
1958 binding: 0,
1959 resource: match &resources.instance_data {
1960 InstanceData::Storage(buffer) => {
1961 wgpu::BindingResource::Buffer(wgpu::BufferBinding {
1962 buffer,
1963 offset,
1964 size: NonZeroU64::new(size),
1965 })
1966 }
1967 InstanceData::Texture { view, .. } => {
1968 wgpu::BindingResource::TextureView(view)
1969 }
1970 },
1971 }],
1972 });
1973 Ok(InstanceBinding {
1974 bind_group,
1975 first_instance,
1976 })
1977 }
1978
1979 fn write_instance_texture(resources: &WgpuResources, offset: u64, data: &[u8]) {
1980 let InstanceData::Texture {
1981 texture,
1982 width,
1983 height,
1984 ..
1985 } = &resources.instance_data
1986 else {
1987 return;
1988 };
1989 let mut byte_offset = 0usize;
1990 let mut texel_offset = offset / INSTANCE_TEXTURE_TEXEL_SIZE;
1991 while byte_offset < data.len() {
1992 let x = (texel_offset % u64::from(*width)) as u32;
1993 let y = (texel_offset / u64::from(*width)) as u32;
1994 if y >= *height {
1995 // The capacity check in write_instance_binding should make this
1996 // unreachable. Truncating silently would leave stale bytes in the
1997 // texture and draw garbage for the remaining instances.
1998 debug_assert!(
1999 false,
2000 "instance texture write out of bounds: row {y} >= height {}",
2001 *height
2002 );
2003 log::error!(
2004 "instance texture write out of bounds; dropping {} bytes of instance data",
2005 data.len() - byte_offset
2006 );
2007 return;
2008 }
2009 let available_texels = u64::from(*width - x);
2010 let remaining_bytes = data.len() - byte_offset;
2011 let complete_texels = remaining_bytes as u64 / INSTANCE_TEXTURE_TEXEL_SIZE;
2012 let texels = complete_texels.min(available_texels);
2013 if texels > 0 {
2014 let byte_count = (texels * INSTANCE_TEXTURE_TEXEL_SIZE) as usize;
2015 resources.queue.write_texture(
2016 wgpu::TexelCopyTextureInfo {
2017 texture,
2018 mip_level: 0,
2019 origin: wgpu::Origin3d { x, y, z: 0 },
2020 aspect: wgpu::TextureAspect::All,
2021 },
2022 &data[byte_offset..byte_offset + byte_count],
2023 wgpu::TexelCopyBufferLayout {
2024 offset: 0,
2025 bytes_per_row: Some(byte_count as u32),
2026 rows_per_image: None,
2027 },
2028 wgpu::Extent3d {
2029 width: texels as u32,
2030 height: 1,
2031 depth_or_array_layers: 1,
2032 },
2033 );
2034 byte_offset += byte_count;
2035 texel_offset += texels;
2036 continue;
2037 }
2038
2039 let mut final_texel = [0; INSTANCE_TEXTURE_TEXEL_SIZE as usize];
2040 final_texel[..remaining_bytes].copy_from_slice(&data[byte_offset..]);
2041 resources.queue.write_texture(
2042 wgpu::TexelCopyTextureInfo {
2043 texture,
2044 mip_level: 0,
2045 origin: wgpu::Origin3d { x, y, z: 0 },
2046 aspect: wgpu::TextureAspect::All,
2047 },
2048 &final_texel,
2049 wgpu::TexelCopyBufferLayout {
2050 offset: 0,
2051 bytes_per_row: Some(INSTANCE_TEXTURE_TEXEL_SIZE as u32),
2052 rows_per_image: None,
2053 },
2054 wgpu::Extent3d {
2055 width: 1,
2056 height: 1,
2057 depth_or_array_layers: 1,
2058 },
2059 );
2060 break;
2061 }
2062 }
2063
2064 fn grow_instance_data(&mut self, required: u64) -> Result<()> {
2065 let capacity = (self.instance_data_capacity * 2)
2066 .max(required.next_power_of_two())
2067 .min(self.max_instance_data_size);
2068 anyhow::ensure!(
2069 capacity >= required,
2070 "instance data needs {required} bytes, above the maximum of {}",
2071 self.max_instance_data_size
2072 );
2073 anyhow::ensure!(
2074 capacity > self.instance_data_capacity,
2075 "frame instance data exceeds the {}-byte maximum",
2076 self.max_instance_data_size
2077 );
2078 log::debug!(
2079 "instance data grown from {} to {capacity}",
2080 self.instance_data_capacity
2081 );
2082 // Bind groups created earlier in the frame keep the previous buffer or
2083 // texture alive, so allocations written before the grow remain valid;
2084 // only subsequent writes land in the new allocation.
2085 let uses_webgl_instance_data = self.uses_webgl_instance_data;
2086 let resources = self.resources_mut();
2087 if uses_webgl_instance_data {
2088 let max_texture_dimension = resources.device.limits().max_texture_dimension_2d;
2089 let (instance_data, actual_capacity) =
2090 Self::create_instance_texture(&resources.device, capacity, max_texture_dimension);
2091 resources.instance_data = instance_data;
2092 self.instance_data_capacity = actual_capacity;
2093 } else {
2094 resources.instance_data =
2095 InstanceData::Storage(resources.device.create_buffer(&wgpu::BufferDescriptor {
2096 label: Some("instance_buffer"),
2097 size: capacity,
2098 usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST,
2099 mapped_at_creation: false,
2100 }));
2101 self.instance_data_capacity = capacity;
2102 }
2103 Ok(())
2104 }
2105}
2106
2107impl WgpuRenderer {
2108 /// Mark the surface as unconfigured so rendering is skipped until a new
2109 /// surface is provided via [`replace_surface`](Self::replace_surface).
2110 ///
2111 /// This does **not** drop the renderer — the device, queue, atlas, and
2112 /// pipelines stay alive. Use this when the native window is destroyed
2113 /// (e.g. Android `TerminateWindow`) but you intend to re-create the
2114 /// surface later without losing cached atlas textures.
2115 pub fn unconfigure_surface(&mut self) {
2116 self.state = match std::mem::replace(&mut self.state, RendererState::Released) {
2117 RendererState::Ready { core, surface } => {
2118 drop(surface);
2119 RendererState::Unconfigured { core }
2120 }
2121 state @ (RendererState::Unconfigured { .. } | RendererState::Released) => state,
2122 };
2123 // Drop intermediate textures since they reference the old surface size.
2124 if let Some(core) = self.core_mut() {
2125 core.resources.invalidate_intermediate_textures();
2126 }
2127 }
2128
2129 /// Replace the wgpu surface with a new one (e.g. after Android destroys
2130 /// and recreates the native window). Keeps the device, queue, atlas, and
2131 /// all pipelines intact so cached `AtlasTextureId`s remain valid.
2132 ///
2133 /// The `instance` **must** be the same [`wgpu::Instance`] that was used to
2134 /// create the adapter and device (i.e. from the [`WgpuContext`]). Using a
2135 /// different instance will cause a "Device does not exist" panic because
2136 /// the wgpu device is bound to its originating instance.
2137 #[cfg(not(target_family = "wasm"))]
2138 pub fn replace_surface<W: HasWindowHandle>(
2139 &mut self,
2140 window: &W,
2141 config: WgpuSurfaceConfig,
2142 instance: &wgpu::Instance,
2143 ) -> anyhow::Result<()> {
2144 let window_handle = window
2145 .window_handle()
2146 .map_err(|e| anyhow::anyhow!("Failed to get window handle: {e}"))?;
2147
2148 let surface = create_surface(instance, window_handle.as_raw())?;
2149
2150 let width = (config.size.width.0 as u32).max(1);
2151 let height = (config.size.height.0 as u32).max(1);
2152
2153 let alpha_mode = if config.transparent {
2154 self.transparent_alpha_mode
2155 } else {
2156 self.opaque_alpha_mode
2157 };
2158
2159 self.surface_config.width = width;
2160 self.surface_config.height = height;
2161 self.surface_config.alpha_mode = alpha_mode;
2162 if let Some(mode) = config.preferred_present_mode {
2163 self.surface_config.present_mode = mode;
2164 }
2165
2166 let mut core = match std::mem::replace(&mut self.state, RendererState::Released) {
2167 RendererState::Ready {
2168 core,
2169 surface: old_surface,
2170 } => {
2171 drop(old_surface);
2172 core
2173 }
2174 RendererState::Unconfigured { core } => core,
2175 RendererState::Released => {
2176 anyhow::bail!("Cannot replace the surface: GPU resources have been released")
2177 }
2178 };
2179 surface.configure(&core.resources.device, &self.surface_config);
2180 core.resources.invalidate_intermediate_textures();
2181 self.state = RendererState::Ready { surface, core };
2182
2183 Ok(())
2184 }
2185
2186 pub fn destroy(&mut self) {
2187 // Release surface-bound GPU resources eagerly so the underlying native
2188 // window can be destroyed before the renderer itself is dropped.
2189 self.state = RendererState::Released;
2190 }
2191
2192 /// Returns true if the GPU device was lost and recovery is needed.
2193 pub fn device_lost(&self) -> bool {
2194 self.device_errors.device_lost()
2195 }
2196
2197 /// Returns true if a redraw is needed because GPU state was cleared.
2198 /// Calling this method clears the flag.
2199 pub fn needs_redraw(&mut self) -> bool {
2200 std::mem::take(&mut self.needs_redraw)
2201 }
2202
2203 /// Recovers from a lost GPU device by recreating the renderer with a new context.
2204 ///
2205 /// Call this after detecting `device_lost()` returns true.
2206 ///
2207 /// This method coordinates recovery across multiple windows:
2208 /// - The first window to call this will recreate the shared context
2209 /// - Subsequent windows will adopt the already-recovered context
2210 #[cfg(not(target_family = "wasm"))]
2211 pub fn recover<W>(&mut self, window: &W) -> anyhow::Result<()>
2212 where
2213 W: HasWindowHandle + HasDisplayHandle + std::fmt::Debug + Send + Sync + Clone + 'static,
2214 {
2215 let gpu_context = self.context.as_ref().expect("recover requires gpu_context");
2216
2217 // Check if another window already recovered the context
2218 let needs_new_context = gpu_context
2219 .borrow()
2220 .as_ref()
2221 .is_none_or(|ctx| ctx.device_lost());
2222
2223 let window_handle = window
2224 .window_handle()
2225 .map_err(|e| anyhow::anyhow!("Failed to get window handle: {e}"))?;
2226
2227 let surface = if needs_new_context {
2228 log::warn!("GPU device lost, recreating context...");
2229
2230 // Drop old resources to release Arc<Device>/Arc<Queue> and GPU resources
2231 self.state = RendererState::Released;
2232 *gpu_context.borrow_mut() = None;
2233
2234 // Wait briefly for the GPU driver to stabilize, then try to
2235 // recreate the context without software renderers. If this fails
2236 // the caller should request another frame and retry — the real GPU
2237 // may need more time to come back (e.g. after suspend/resume).
2238 std::thread::sleep(std::time::Duration::from_millis(350));
2239
2240 let instance = WgpuContext::instance(Some(Box::new(window.clone())));
2241 let surface = create_surface(&instance, window_handle.as_raw())?;
2242 let new_context =
2243 WgpuContext::new_rejecting_software(instance, &surface, self.compositor_gpu)?;
2244 *gpu_context.borrow_mut() = Some(new_context);
2245 surface
2246 } else {
2247 let ctx_ref = gpu_context.borrow();
2248 let instance = &ctx_ref.as_ref().unwrap().instance;
2249 create_surface(instance, window_handle.as_raw())?
2250 };
2251
2252 let config = WgpuSurfaceConfig {
2253 size: gpui::Size {
2254 width: gpui::DevicePixels(self.surface_config.width as i32),
2255 height: gpui::DevicePixels(self.surface_config.height as i32),
2256 },
2257 transparent: self.surface_config.alpha_mode != wgpu::CompositeAlphaMode::Opaque,
2258 preferred_present_mode: Some(self.surface_config.present_mode),
2259 };
2260 let gpu_context = Rc::clone(gpu_context);
2261 let ctx_ref = gpu_context.borrow();
2262 let context = ctx_ref.as_ref().expect("context should exist");
2263
2264 self.state = RendererState::Released;
2265 self.atlas.handle_device_lost(context);
2266
2267 let is_bgr = self.is_bgr;
2268 *self = Self::new_internal(
2269 Some(gpu_context.clone()),
2270 context,
2271 surface,
2272 config,
2273 self.compositor_gpu,
2274 self.atlas.clone(),
2275 )?;
2276 self.set_subpixel_layout(is_bgr);
2277
2278 log::info!("GPU recovery complete");
2279 Ok(())
2280 }
2281}
2282
2283#[cfg(all(
2284 not(target_family = "wasm"),
2285 any(test, feature = "bench-support", feature = "test-support")
2286))]
2287struct HeadlessRenderTarget {
2288 texture: wgpu::Texture,
2289 view: wgpu::TextureView,
2290}
2291
2292#[cfg(all(
2293 not(target_family = "wasm"),
2294 any(test, feature = "bench-support", feature = "test-support")
2295))]
2296impl HeadlessRenderTarget {
2297 fn size(&self) -> Size<DevicePixels> {
2298 Size {
2299 width: DevicePixels(self.texture.width() as i32),
2300 height: DevicePixels(self.texture.height() as i32),
2301 }
2302 }
2303}
2304
2305#[cfg(all(
2306 not(target_family = "wasm"),
2307 any(test, feature = "bench-support", feature = "test-support")
2308))]
2309pub struct WgpuHeadlessRenderer {
2310 context: WgpuContext,
2311 core: WgpuRendererCore,
2312 render_target: Option<HeadlessRenderTarget>,
2313 observed_error_generation: u64,
2314}
2315
2316#[cfg(all(
2317 not(target_family = "wasm"),
2318 any(test, feature = "bench-support", feature = "test-support")
2319))]
2320impl WgpuHeadlessRenderer {
2321 pub fn new() -> anyhow::Result<Self> {
2322 let (context, target_format) = WgpuContext::new_headless()?;
2323 // The device may be shared with earlier renderers; observe only errors raised from
2324 // here on, including any while this renderer builds its pipelines.
2325 let observed_error_generation = context.errors().current_generation();
2326 let atlas = Arc::new(WgpuAtlas::from_context(&context));
2327 let core = WgpuRendererCore::new(
2328 &context,
2329 atlas,
2330 target_format,
2331 wgpu::CompositeAlphaMode::Opaque,
2332 );
2333
2334 Ok(Self {
2335 context,
2336 core,
2337 render_target: None,
2338 observed_error_generation,
2339 })
2340 }
2341
2342 fn ensure_render_target(&mut self, size: Size<DevicePixels>) -> anyhow::Result<()> {
2343 anyhow::ensure!(
2344 size.width.0 > 0 && size.height.0 > 0,
2345 "invalid headless render target size: {size:?}"
2346 );
2347 anyhow::ensure!(
2348 size.width.0 as u32 <= self.core.max_texture_size
2349 && size.height.0 as u32 <= self.core.max_texture_size,
2350 "headless render target size {size:?} exceeds maximum texture dimension {}",
2351 self.core.max_texture_size
2352 );
2353 if self
2354 .render_target
2355 .as_ref()
2356 .is_some_and(|target| target.size() == size)
2357 {
2358 return Ok(());
2359 }
2360
2361 let texture = self
2362 .core
2363 .resources
2364 .device
2365 .create_texture(&wgpu::TextureDescriptor {
2366 label: Some("headless_render_target"),
2367 size: wgpu::Extent3d {
2368 width: size.width.0 as u32,
2369 height: size.height.0 as u32,
2370 depth_or_array_layers: 1,
2371 },
2372 mip_level_count: 1,
2373 sample_count: 1,
2374 dimension: wgpu::TextureDimension::D2,
2375 format: self.core.target_format,
2376 usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC,
2377 view_formats: &[],
2378 });
2379 let view = texture.create_view(&wgpu::TextureViewDescriptor::default());
2380 self.render_target = Some(HeadlessRenderTarget { texture, view });
2381 Ok(())
2382 }
2383
2384 fn check_gpu_errors(&mut self) -> anyhow::Result<()> {
2385 anyhow::ensure!(
2386 !self.context.device_lost(),
2387 "GPU device was lost during headless rendering"
2388 );
2389 if let Some(error) = self
2390 .context
2391 .errors()
2392 .observe_error(&mut self.observed_error_generation)
2393 {
2394 anyhow::bail!("GPU error during headless rendering: {error}");
2395 }
2396 Ok(())
2397 }
2398
2399 fn render(&mut self, scene: &Scene, size: Size<DevicePixels>) -> anyhow::Result<()> {
2400 self.check_gpu_errors()?;
2401 self.ensure_render_target(size)?;
2402 let view = self
2403 .render_target
2404 .as_ref()
2405 .ok_or_else(|| anyhow::anyhow!("Headless render target was not created"))?
2406 .view
2407 .clone();
2408 self.core
2409 .render_frame(scene, &view, size, false, wgpu::Color::BLACK)?;
2410 Ok(())
2411 }
2412
2413 /// Copies the current render target back to the CPU. Dimensions come from the
2414 /// target texture itself, so the copy can never disagree with what was rendered.
2415 fn read_image(&mut self) -> anyhow::Result<image::RgbaImage> {
2416 let target = self
2417 .render_target
2418 .as_ref()
2419 .ok_or_else(|| anyhow::anyhow!("Headless render target was not created"))?;
2420 let width = target.texture.width();
2421 let height = target.texture.height();
2422 let bytes_per_row = width
2423 .checked_mul(4)
2424 .ok_or_else(|| anyhow::anyhow!("Headless render target row size overflowed"))?;
2425 let padded_bytes_per_row = bytes_per_row
2426 .checked_next_multiple_of(wgpu::COPY_BYTES_PER_ROW_ALIGNMENT)
2427 .ok_or_else(|| anyhow::anyhow!("Headless padded row size overflowed"))?;
2428 let buffer_size = u64::from(padded_bytes_per_row)
2429 .checked_mul(u64::from(height))
2430 .ok_or_else(|| anyhow::anyhow!("Headless readback buffer size overflowed"))?;
2431 anyhow::ensure!(
2432 buffer_size <= self.core.resources.device.limits().max_buffer_size,
2433 "Headless readback buffer size {buffer_size} exceeds maximum buffer size {}",
2434 self.core.resources.device.limits().max_buffer_size
2435 );
2436 let readback_buffer = self
2437 .core
2438 .resources
2439 .device
2440 .create_buffer(&wgpu::BufferDescriptor {
2441 label: Some("headless_readback_buffer"),
2442 size: buffer_size,
2443 usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ,
2444 mapped_at_creation: false,
2445 });
2446 let mut encoder =
2447 self.core
2448 .resources
2449 .device
2450 .create_command_encoder(&wgpu::CommandEncoderDescriptor {
2451 label: Some("headless_readback_encoder"),
2452 });
2453 encoder.copy_texture_to_buffer(
2454 wgpu::TexelCopyTextureInfo {
2455 texture: &target.texture,
2456 mip_level: 0,
2457 origin: wgpu::Origin3d::ZERO,
2458 aspect: wgpu::TextureAspect::All,
2459 },
2460 wgpu::TexelCopyBufferInfo {
2461 buffer: &readback_buffer,
2462 layout: wgpu::TexelCopyBufferLayout {
2463 offset: 0,
2464 bytes_per_row: Some(padded_bytes_per_row),
2465 rows_per_image: Some(height),
2466 },
2467 },
2468 wgpu::Extent3d {
2469 width,
2470 height,
2471 depth_or_array_layers: 1,
2472 },
2473 );
2474 let submission = self
2475 .core
2476 .resources
2477 .queue
2478 .submit(std::iter::once(encoder.finish()));
2479 let (sender, receiver) = std::sync::mpsc::channel();
2480 readback_buffer
2481 .slice(..)
2482 .map_async(wgpu::MapMode::Read, move |result| {
2483 if sender.send(result).is_err() {
2484 log::error!("Headless readback receiver was dropped before mapping completed");
2485 }
2486 });
2487 self.core
2488 .resources
2489 .device
2490 .poll(wgpu::PollType::Wait {
2491 submission_index: Some(submission),
2492 timeout: Some(std::time::Duration::from_secs(30)),
2493 })
2494 .map_err(|error| anyhow::anyhow!("Failed to wait for headless rendering: {error}"))?;
2495 receiver
2496 .recv_timeout(std::time::Duration::from_secs(30))
2497 .map_err(|error| anyhow::anyhow!("Failed to receive headless mapping result: {error}"))?
2498 .map_err(|error| anyhow::anyhow!("Failed to map headless readback buffer: {error}"))?;
2499 self.check_gpu_errors()?;
2500
2501 let mapped_data = readback_buffer.slice(..).get_mapped_range();
2502 let pixel_capacity = usize::try_from(u64::from(bytes_per_row) * u64::from(height))
2503 .map_err(|_| anyhow::anyhow!("Headless image size exceeds addressable memory"))?;
2504 let mut pixels = Vec::with_capacity(pixel_capacity);
2505 for row in mapped_data
2506 .chunks_exact(padded_bytes_per_row as usize)
2507 .take(height as usize)
2508 {
2509 pixels.extend_from_slice(&row[..bytes_per_row as usize]);
2510 }
2511 drop(mapped_data);
2512 readback_buffer.unmap();
2513
2514 if self.core.target_format == wgpu::TextureFormat::Bgra8Unorm {
2515 for pixel in pixels.chunks_exact_mut(4) {
2516 pixel.swap(0, 2);
2517 }
2518 }
2519
2520 image::RgbaImage::from_raw(width, height, pixels)
2521 .ok_or_else(|| anyhow::anyhow!("Failed to create image from headless pixel data"))
2522 }
2523}
2524
2525#[cfg(all(
2526 not(target_family = "wasm"),
2527 any(test, feature = "bench-support", feature = "test-support")
2528))]
2529impl gpui::PlatformHeadlessRenderer for WgpuHeadlessRenderer {
2530 fn render_scene_to_image(
2531 &mut self,
2532 scene: &Scene,
2533 size: Size<DevicePixels>,
2534 ) -> anyhow::Result<image::RgbaImage> {
2535 self.render(scene, size)?;
2536 self.read_image()
2537 }
2538
2539 fn render_scene(&mut self, scene: &Scene, size: Size<DevicePixels>) -> anyhow::Result<()> {
2540 self.render(scene, size)
2541 }
2542
2543 fn sprite_atlas(&self) -> Arc<dyn gpui::PlatformAtlas> {
2544 self.core.atlas.clone()
2545 }
2546}
2547
2548fn instance_range(range: Range<usize>) -> Range<u32> {
2549 range.start as u32..range.end as u32
2550}
2551
2552#[cfg(not(target_family = "wasm"))]
2553fn create_surface(
2554 instance: &wgpu::Instance,
2555 raw_window_handle: raw_window_handle::RawWindowHandle,
2556) -> anyhow::Result<wgpu::Surface<'static>> {
2557 unsafe {
2558 instance
2559 .create_surface_unsafe(wgpu::SurfaceTargetUnsafe::RawHandle {
2560 // Fall back to the display handle already provided via InstanceDescriptor::display.
2561 raw_display_handle: None,
2562 raw_window_handle,
2563 })
2564 .map_err(|e| anyhow::anyhow!("{e}"))
2565 }
2566}
2567
2568struct RenderingParameters {
2569 path_sample_count: u32,
2570 gamma_ratios: [f32; 4],
2571 grayscale_enhanced_contrast: f32,
2572 subpixel_enhanced_contrast: f32,
2573}
2574
2575impl RenderingParameters {
2576 fn new(adapter: &wgpu::Adapter, surface_format: wgpu::TextureFormat) -> Self {
2577 use std::env;
2578
2579 let format_features = adapter.get_texture_format_features(surface_format);
2580 let path_sample_count = [4, 2, 1]
2581 .into_iter()
2582 .find(|&n| format_features.flags.sample_count_supported(n))
2583 .unwrap_or(1);
2584
2585 let gamma = env::var("ZED_FONTS_GAMMA")
2586 .ok()
2587 .and_then(|v| v.parse().ok())
2588 .unwrap_or(1.8_f32)
2589 .clamp(1.0, 2.2);
2590 let gamma_ratios = get_gamma_correction_ratios(gamma);
2591
2592 let grayscale_enhanced_contrast = env::var("ZED_FONTS_GRAYSCALE_ENHANCED_CONTRAST")
2593 .ok()
2594 .and_then(|v| v.parse().ok())
2595 .unwrap_or(1.0_f32)
2596 .max(0.0);
2597
2598 let subpixel_enhanced_contrast = env::var("ZED_FONTS_SUBPIXEL_ENHANCED_CONTRAST")
2599 .ok()
2600 .and_then(|v| v.parse().ok())
2601 .unwrap_or(0.5_f32)
2602 .max(0.0);
2603
2604 Self {
2605 path_sample_count,
2606 gamma_ratios,
2607 grayscale_enhanced_contrast,
2608 subpixel_enhanced_contrast,
2609 }
2610 }
2611}
2612
2613#[cfg(test)]
2614mod tests {
2615 use super::*;
2616 use gpui::{
2617 BorderStyle, ColorSpace, ContentMask, Corners, Edges, Hsla, MonochromeSprite,
2618 PolychromeSprite, Quad, Shadow, Size, SubpixelSprite, Underline, linear_color_stop,
2619 linear_gradient,
2620 };
2621 #[cfg(target_os = "linux")]
2622 use gpui::{DevicePixels, PlatformHeadlessRenderer, Scene};
2623
2624 #[cfg(target_os = "linux")]
2625 fn device_size(width: i32, height: i32) -> Size<DevicePixels> {
2626 Size {
2627 width: DevicePixels(width),
2628 height: DevicePixels(height),
2629 }
2630 }
2631
2632 #[cfg(target_os = "linux")]
2633 fn solid_quad(x: f32, y: f32, width: f32, height: f32, color: Hsla) -> Quad {
2634 let bounds = Bounds {
2635 origin: Point {
2636 x: x.into(),
2637 y: y.into(),
2638 },
2639 size: Size {
2640 width: width.into(),
2641 height: height.into(),
2642 },
2643 };
2644 Quad {
2645 order: 0,
2646 border_style: BorderStyle::Solid,
2647 bounds,
2648 content_mask: ContentMask { bounds },
2649 background: color.into(),
2650 border_color: color,
2651 corner_radii: Corners::default(),
2652 border_widths: Edges::default(),
2653 }
2654 }
2655
2656 /// Channels are compared with a small tolerance so the assertions hold across
2657 /// drivers without pinning exact rasterizer output.
2658 #[cfg(target_os = "linux")]
2659 fn assert_pixel(image: &image::RgbaImage, x: u32, y: u32, expected: [u8; 4]) {
2660 let actual = image.get_pixel(x, y).0;
2661 assert!(
2662 actual
2663 .iter()
2664 .zip(expected)
2665 .all(|(actual, expected)| actual.abs_diff(expected) <= 3),
2666 "pixel ({x}, {y}) was {actual:?}, expected {expected:?}"
2667 );
2668 }
2669
2670 #[cfg(target_os = "linux")]
2671 const RED: [u8; 4] = [255, 0, 0, 255];
2672 #[cfg(target_os = "linux")]
2673 const BLUE: [u8; 4] = [0, 0, 255, 255];
2674 #[cfg(target_os = "linux")]
2675 const BLACK: [u8; 4] = [0, 0, 0, 255];
2676
2677 #[cfg(target_os = "linux")]
2678 #[test]
2679 fn headless_renderer_draws_quads_with_distinct_colors() -> anyhow::Result<()> {
2680 let mut renderer = WgpuHeadlessRenderer::new()?;
2681 let mut scene = Scene::default();
2682 scene.insert_primitive(solid_quad(0.0, 0.0, 32.0, 32.0, gpui::red()));
2683 scene.insert_primitive(solid_quad(32.0, 0.0, 32.0, 32.0, gpui::blue()));
2684 scene.finish();
2685
2686 let image = renderer.render_scene_to_image(&scene, device_size(64, 32))?;
2687 assert_eq!(image.dimensions(), (64, 32));
2688 assert_pixel(&image, 8, 16, RED);
2689 assert_pixel(&image, 24, 16, RED);
2690 assert_pixel(&image, 40, 16, BLUE);
2691 assert_pixel(&image, 56, 16, BLUE);
2692 Ok(())
2693 }
2694
2695 #[cfg(target_os = "linux")]
2696 #[test]
2697 fn headless_renderer_captures_each_requested_size() -> anyhow::Result<()> {
2698 let mut renderer = WgpuHeadlessRenderer::new()?;
2699 let mut scene = Scene::default();
2700 scene.insert_primitive(solid_quad(2.0, 2.0, 4.0, 3.0, gpui::red()));
2701 scene.finish();
2702
2703 // 13 px rows are 52 bytes, forcing readback to strip copy-row padding.
2704 let image = renderer.render_scene_to_image(&scene, device_size(13, 7))?;
2705 assert_eq!(image.dimensions(), (13, 7));
2706 assert_pixel(&image, 0, 0, BLACK);
2707 assert_pixel(&image, 3, 3, RED);
2708 assert_pixel(&image, 12, 6, BLACK);
2709
2710 let image = renderer.render_scene_to_image(&scene, device_size(17, 9))?;
2711 assert_eq!(image.dimensions(), (17, 9));
2712 assert_pixel(&image, 3, 3, RED);
2713 assert_pixel(&image, 16, 8, BLACK);
2714
2715 let image = renderer.render_scene_to_image(&Scene::default(), device_size(13, 7))?;
2716 assert_eq!(image.dimensions(), (13, 7));
2717 assert!(image.pixels().all(|pixel| pixel.0 == BLACK));
2718 Ok(())
2719 }
2720
2721 #[cfg(target_os = "linux")]
2722 #[test]
2723 fn headless_renderer_reuses_target_for_same_size() -> anyhow::Result<()> {
2724 let mut renderer = WgpuHeadlessRenderer::new()?;
2725 let target_texture = |renderer: &WgpuHeadlessRenderer| {
2726 renderer
2727 .render_target
2728 .as_ref()
2729 .map(|target| target.texture.clone())
2730 };
2731
2732 renderer.render_scene(&Scene::default(), device_size(16, 16))?;
2733 let first = target_texture(&renderer);
2734 assert!(first.is_some());
2735
2736 renderer.render_scene(&Scene::default(), device_size(16, 16))?;
2737 assert_eq!(target_texture(&renderer), first);
2738
2739 renderer.render_scene(&Scene::default(), device_size(16, 17))?;
2740 assert_ne!(target_texture(&renderer), first);
2741 Ok(())
2742 }
2743
2744 #[cfg(target_os = "linux")]
2745 #[test]
2746 fn headless_renderer_rejects_invalid_sizes() -> anyhow::Result<()> {
2747 let mut renderer = WgpuHeadlessRenderer::new()?;
2748 let too_large = renderer.core.max_texture_size as i32 + 1;
2749
2750 for size in [
2751 device_size(0, 8),
2752 device_size(8, 0),
2753 device_size(-1, 8),
2754 device_size(too_large, 8),
2755 ] {
2756 assert!(
2757 renderer.render_scene(&Scene::default(), size).is_err(),
2758 "{size:?} should be rejected"
2759 );
2760 assert!(
2761 renderer
2762 .render_scene_to_image(&Scene::default(), size)
2763 .is_err(),
2764 "{size:?} should be rejected"
2765 );
2766 }
2767
2768 // Rejection must leave the renderer usable.
2769 let image = renderer.render_scene_to_image(&Scene::default(), device_size(4, 4))?;
2770 assert_eq!(image.dimensions(), (4, 4));
2771 Ok(())
2772 }
2773
2774 #[test]
2775 fn webgl_shader_is_valid_wgsl_without_storage_buffers() {
2776 assert!(!WEBGL_SHADERS.contains("var<storage"));
2777 validate_wgsl(WEBGL_SHADERS, naga::valid::Capabilities::empty());
2778 }
2779
2780 #[test]
2781 fn storage_buffer_shader_is_valid_wgsl() {
2782 validate_wgsl(STORAGE_BUFFER_SHADERS, naga::valid::Capabilities::empty());
2783 }
2784
2785 #[test]
2786 fn subpixel_shader_is_valid_wgsl() {
2787 validate_wgsl(
2788 SUBPIXEL_SHADERS,
2789 naga::valid::Capabilities::DUAL_SOURCE_BLENDING,
2790 );
2791 }
2792
2793 fn validate_wgsl(source: &str, capabilities: naga::valid::Capabilities) {
2794 let module = naga::front::wgsl::parse_str(source).expect("shader should parse");
2795 naga::valid::Validator::new(naga::valid::ValidationFlags::all(), capabilities)
2796 .validate(&module)
2797 .expect("shader should validate");
2798 }
2799
2800 #[test]
2801 fn webgl_record_sizes_match_shader_word_strides() {
2802 assert_eq!(std::mem::size_of::<Quad>(), 40 * 4);
2803 assert_eq!(std::mem::size_of::<Shadow>(), 28 * 4);
2804 assert_eq!(std::mem::size_of::<PathRasterizationVertex>(), 26 * 4);
2805 assert_eq!(std::mem::size_of::<PathSprite>(), 4 * 4);
2806 assert_eq!(std::mem::size_of::<Underline>(), 16 * 4);
2807 assert_eq!(std::mem::size_of::<MonochromeSprite>(), 28 * 4);
2808 assert_eq!(std::mem::size_of::<SubpixelSprite>(), 28 * 4);
2809 assert_eq!(std::mem::size_of::<PolychromeSprite>(), 24 * 4);
2810 }
2811
2812 #[test]
2813 fn webgl_quad_layout_matches_fixed_decoder() {
2814 let quad = Quad {
2815 order: 41,
2816 border_style: BorderStyle::Dashed,
2817 bounds: Bounds {
2818 origin: Point {
2819 x: 1.0.into(),
2820 y: 2.0.into(),
2821 },
2822 size: Size {
2823 width: 3.0.into(),
2824 height: 4.0.into(),
2825 },
2826 },
2827 content_mask: ContentMask {
2828 bounds: Bounds {
2829 origin: Point {
2830 x: 5.0.into(),
2831 y: 6.0.into(),
2832 },
2833 size: Size {
2834 width: 7.0.into(),
2835 height: 8.0.into(),
2836 },
2837 },
2838 },
2839 background: linear_gradient(
2840 11.0,
2841 linear_color_stop(
2842 Hsla {
2843 h: 12.0,
2844 s: 13.0,
2845 l: 14.0,
2846 a: 15.0,
2847 },
2848 16.0,
2849 ),
2850 linear_color_stop(
2851 Hsla {
2852 h: 17.0,
2853 s: 18.0,
2854 l: 19.0,
2855 a: 20.0,
2856 },
2857 21.0,
2858 ),
2859 )
2860 .color_space(ColorSpace::Oklab),
2861 border_color: Hsla {
2862 h: 22.0,
2863 s: 23.0,
2864 l: 24.0,
2865 a: 25.0,
2866 },
2867 corner_radii: Corners {
2868 top_left: 26.0.into(),
2869 top_right: 27.0.into(),
2870 bottom_right: 28.0.into(),
2871 bottom_left: 29.0.into(),
2872 },
2873 border_widths: Edges {
2874 top: 30.0.into(),
2875 right: 31.0.into(),
2876 bottom: 32.0.into(),
2877 left: 33.0.into(),
2878 },
2879 };
2880
2881 let bytes = unsafe { WgpuRendererCore::instance_bytes(std::slice::from_ref(&quad)) };
2882 let words: &[u32] = bytemuck::cast_slice(bytes);
2883 assert_eq!(
2884 words,
2885 &[
2886 41,
2887 1,
2888 1.0_f32.to_bits(),
2889 2.0_f32.to_bits(),
2890 3.0_f32.to_bits(),
2891 4.0_f32.to_bits(),
2892 5.0_f32.to_bits(),
2893 6.0_f32.to_bits(),
2894 7.0_f32.to_bits(),
2895 8.0_f32.to_bits(),
2896 1,
2897 1,
2898 0,
2899 0,
2900 0,
2901 0,
2902 11.0_f32.to_bits(),
2903 12.0_f32.to_bits(),
2904 13.0_f32.to_bits(),
2905 14.0_f32.to_bits(),
2906 15.0_f32.to_bits(),
2907 16.0_f32.to_bits(),
2908 17.0_f32.to_bits(),
2909 18.0_f32.to_bits(),
2910 19.0_f32.to_bits(),
2911 20.0_f32.to_bits(),
2912 21.0_f32.to_bits(),
2913 0,
2914 22.0_f32.to_bits(),
2915 23.0_f32.to_bits(),
2916 24.0_f32.to_bits(),
2917 25.0_f32.to_bits(),
2918 26.0_f32.to_bits(),
2919 27.0_f32.to_bits(),
2920 28.0_f32.to_bits(),
2921 29.0_f32.to_bits(),
2922 30.0_f32.to_bits(),
2923 31.0_f32.to_bits(),
2924 32.0_f32.to_bits(),
2925 33.0_f32.to_bits(),
2926 ]
2927 );
2928 }
2929}