substrate-lang 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/compiler/{checker.4dd4556dd421@0+0.wasm → checker.1d67e1d4e91a@0+0.wasm} +0 -0
- package/build/compiler/{expander.967ce443d379@0+0.wasm → expander.34110a31a949@0+0.wasm} +0 -0
- package/build/compiler/{main.4fc52f204d54@0+0.wasm → main.ca9b5089c24d@0+0.wasm} +0 -0
- package/build/compiler/program +4 -4
- package/build/compiler/{roots.cefd10e93684@0+0.wasm → roots.2f1ad1a79459@0+0.wasm} +0 -0
- package/build/sub/{build.459c5b9412bd@0+0.wasm → build.eef7dfa467ec@0+0.wasm} +0 -0
- package/build/sub/{common.1edc613607a0@0+0.wasm → common.7617940db2dc@0+0.wasm} +0 -0
- package/build/sub/deflate.23f7c4679260@0+0.wasm +0 -0
- package/build/sub/{doc.0775df5de6fe@0+0.wasm → doc.92d6d82d99c1@0+0.wasm} +0 -0
- package/build/sub/{doc.ef9965d5d402@0+0.wasm → doc.dab689b811ca@0+0.wasm} +0 -0
- package/build/sub/{fetch.96b2d10f025e@0+0.wasm → fetch.3367ff4f88c0@0+0.wasm} +0 -0
- package/build/sub/{files.ad0469fdf6fa@0+0.wasm → files.5ae9d3cebeca@0+0.wasm} +0 -0
- package/build/sub/gzip.16e372eda1cf@0+0.wasm +0 -0
- package/build/sub/{hash.660682e4f491@0+0.wasm → hash.c57c141b4862@0+0.wasm} +0 -0
- package/build/sub/{html.a23126eb949a@0+0.wasm → html.803f73c35c4a@0+0.wasm} +0 -0
- package/build/sub/{manifest.ef317480deb0@0+0.wasm → manifest.da52a88c7af7@0+0.wasm} +0 -0
- package/build/sub/{map.f455cca6a42a@0+0.wasm → map.5c8084999550@0+0.wasm} +0 -0
- package/build/sub/program +22 -22
- package/build/sub/{root.f10a4906f460@0+0.wasm → root.78253db36643@0+0.wasm} +0 -0
- package/build/sub/{roots.cefd10e93684@0+0.wasm → roots.2f1ad1a79459@0+0.wasm} +0 -0
- package/build/sub/sha256.a6c32b04d799@0+0.wasm +0 -0
- package/build/sub/site.47fd989be8fb@0+0.wasm +0 -0
- package/build/sub/site.c908b1f6db12@0+0.wasm +0 -0
- package/build/sub/{store.a24d7a25daa6@0+0.wasm → store.048c77bb124d@0+0.wasm} +0 -0
- package/build/sub/sub.a618f89f2ec8@0+0.wasm +0 -0
- package/build/sub/{test.9bd59c73f65e@0+0.wasm → test.b529bf52ba3e@0+0.wasm} +0 -0
- package/build/sub/{text.1bc90482bd43@0+0.wasm → text.b214933a4984@0+0.wasm} +0 -0
- package/build/sub/{upgrade.39ee449b00d5@0+0.wasm → upgrade.7ec5651ed2e9@0+0.wasm} +0 -0
- package/package.json +1 -1
- package/std/http/server.sub +7 -7
- package/std/http/static.sub +66 -30
- package/std/package/manifest.sub +9 -4
- package/std/package/site.sub +209 -15
- package/std/package.sub +4 -3
- package/std/test/browser.sub +20 -14
- package/std/test/build.sub +8 -6
- package/std/test/page/agent.mjs +8 -2
- package/std/web/canvas.sub +4 -4
- package/std/web/dom.sub +45 -11
- package/std/web/gpu-commands.sub +439 -0
- package/std/web/gpu.sub +17 -424
- package/std/web/patches.sub +53 -18
- package/substrate/VERSION +1 -1
- package/substrate/compiler/expander.sub +2 -3
- package/substrate/compiler/roots.sub +12 -5
- package/substrate/host/grants.mjs +3 -3
- package/substrate/host/node/net.mjs +17 -2
- package/substrate/host/node/worker.mjs +3 -1
- package/substrate/host/subhost.mjs +4 -1
- package/substrate/host/web/audio.mjs +18 -10
- package/substrate/host/web/audio.sub +9 -3
- package/substrate/host/web/dom.mjs +167 -66
- package/substrate/host/web/dom.sub +9 -27
- package/substrate/host/web/fs.mjs +3 -3
- package/substrate/host/web/gpu.mjs +65 -27
- package/substrate/host/web/gpu.sub +18 -4
- package/substrate/host/web/location.mjs +15 -1
- package/substrate/host/web/location.sub +11 -3
- package/substrate/host/web/start.mjs +11 -7
- package/substrate/host/web/subhost-web.mjs +54 -33
- package/substrate/host/web/worker-script.mjs +4 -4
- package/substrate/host/web/worker.mjs +4 -4
- package/substrate/host/worker.mjs +1 -1
- package/build/sub/site.1732b58ec0e8@0+0.wasm +0 -0
- package/build/sub/site.ae3913b0b0f4@0+0.wasm +0 -0
- package/build/sub/sub.2e3092140706@0+0.wasm +0 -0
package/std/web/gpu.sub
CHANGED
|
@@ -1,429 +1,22 @@
|
|
|
1
|
-
;; WebGPU from a program: the
|
|
1
|
+
;; WebGPU from a program: the commands of gpu-commands.sub, sent to the host module "gpu" (host/web/gpu.sub) in
|
|
2
|
+
;; batches. gpu-begin! starts a batch with the tag that its events go to, and gpu-send! sends it. The commands must be
|
|
3
|
+
;; sent, or dropped with gpu-commands-done!, before the next batch begins.
|
|
2
4
|
(require-unqualified host-gpu host/web/gpu)
|
|
5
|
+
(require-unqualified commands "gpu-commands.sub")
|
|
3
6
|
|
|
4
|
-
(provide (all-from-out host-gpu)
|
|
5
|
-
gpu-surface! gpu-shader! gpu-render-pipeline! gpu-layout-item! gpu-target! gpu-vertex-buffer-layout! gpu-attribute!
|
|
6
|
-
gpu-compute-pipeline! gpu-buffer! gpu-texture! gpu-texture-file! gpu-sampler! gpu-layout! gpu-layout-entry!
|
|
7
|
-
gpu-bind-group! gpu-bind-buffer! gpu-bind-sampler! gpu-bind-texture! gpu-destroy!
|
|
8
|
-
gpu-write-buffer! gpu-write-texture! gpu-read-texture! gpu-read-buffer!
|
|
9
|
-
gpu-render-pass! gpu-pass-target! gpu-compute-pass! gpu-end-pass! gpu-pipeline! gpu-bind-group-set! gpu-offset!
|
|
10
|
-
gpu-vertex-buffer! gpu-index-buffer! gpu-draw! gpu-draw-indexed! gpu-dispatch! gpu-viewport! gpu-scissor!
|
|
11
|
-
gpu-commands gpu-commands-done! gpu-frame-alloc gpu-frame-copy
|
|
12
|
-
gpu-format-surface gpu-rgba8 gpu-bgra8 gpu-r8 gpu-rg8 gpu-rgba16f gpu-r32f gpu-rgba32f gpu-depth24 gpu-depth32f
|
|
13
|
-
gpu-f32 gpu-f32x2 gpu-f32x3 gpu-f32x4 gpu-u32 gpu-u32x2 gpu-u32x4 gpu-i32 gpu-unorm8x4 gpu-snorm8x4
|
|
14
|
-
gpu-f16x2 gpu-f16x4 gpu-u8x4 gpu-unorm16x2 gpu-unorm16x4
|
|
15
|
-
gpu-triangles gpu-triangle-strip gpu-lines gpu-line-strip gpu-points
|
|
16
|
-
gpu-cull-none gpu-cull-back gpu-cull-front gpu-ccw gpu-cw
|
|
17
|
-
gpu-blend-none gpu-blend-alpha gpu-blend-premultiplied gpu-blend-add
|
|
18
|
-
gpu-compare-none gpu-less gpu-less-equal gpu-greater gpu-greater-equal gpu-equal gpu-always gpu-never
|
|
19
|
-
gpu-vertex gpu-index gpu-uniform gpu-storage gpu-indirect gpu-sampled gpu-target gpu-storage-texture
|
|
20
|
-
gpu-nearest gpu-linear gpu-clamp gpu-repeat gpu-mirror
|
|
21
|
-
gpu-uniform-entry gpu-storage-entry gpu-read-only-entry gpu-dynamic-uniform-entry gpu-dynamic-storage-entry
|
|
22
|
-
gpu-dynamic-read-only-entry gpu-sampler-entry gpu-comparison-entry gpu-texture-entry gpu-depth-entry
|
|
23
|
-
gpu-storage-texture-entry gpu-texture-array-entry gpu-depth-array-entry gpu-in-vertex gpu-in-fragment gpu-in-compute
|
|
24
|
-
gpu-per-vertex gpu-per-instance gpu-on-surface gpu-on-texture gpu-keep gpu-clear gpu-u16-indexes gpu-u32-indexes
|
|
25
|
-
gpu-kind-surface gpu-kind-shader gpu-kind-pipeline gpu-kind-buffer gpu-kind-texture gpu-kind-sampler
|
|
26
|
-
gpu-kind-layout gpu-kind-bind-group)
|
|
7
|
+
(provide (all-from-out host-gpu) (all-from-out commands) gpu-begin! gpu-send!)
|
|
27
8
|
|
|
28
|
-
|
|
9
|
+
(define batch-tag (ptr void) 0)
|
|
10
|
+
(define batch-begun bool #f)
|
|
29
11
|
|
|
30
|
-
|
|
31
|
-
(
|
|
32
|
-
(
|
|
33
|
-
(
|
|
34
|
-
(const gpu-r8 u32 3)
|
|
35
|
-
(const gpu-rg8 u32 4)
|
|
36
|
-
(const gpu-rgba16f u32 5)
|
|
37
|
-
(const gpu-r32f u32 6)
|
|
38
|
-
(const gpu-rgba32f u32 7)
|
|
39
|
-
(const gpu-depth24 u32 8)
|
|
40
|
-
(const gpu-depth32f u32 9)
|
|
12
|
+
(define (gpu-begin! [tag (ptr void)])
|
|
13
|
+
(when (> (-> (gpu-commands) length) 0) (host-trap "gpu: a batch began while commands were waiting to be sent"))
|
|
14
|
+
(set! batch-tag tag)
|
|
15
|
+
(set! batch-begun #t))
|
|
41
16
|
|
|
42
|
-
(
|
|
43
|
-
(
|
|
44
|
-
(
|
|
45
|
-
(
|
|
46
|
-
(
|
|
47
|
-
(
|
|
48
|
-
(const gpu-u32x4 u32 7)
|
|
49
|
-
(const gpu-i32 u32 8)
|
|
50
|
-
(const gpu-unorm8x4 u32 9)
|
|
51
|
-
(const gpu-snorm8x4 u32 10)
|
|
52
|
-
(const gpu-f16x2 u32 11)
|
|
53
|
-
(const gpu-f16x4 u32 12)
|
|
54
|
-
(const gpu-u8x4 u32 13)
|
|
55
|
-
(const gpu-unorm16x2 u32 14)
|
|
56
|
-
(const gpu-unorm16x4 u32 15)
|
|
57
|
-
|
|
58
|
-
(const gpu-triangles u32 1)
|
|
59
|
-
(const gpu-triangle-strip u32 2)
|
|
60
|
-
(const gpu-lines u32 3)
|
|
61
|
-
(const gpu-line-strip u32 4)
|
|
62
|
-
(const gpu-points u32 5)
|
|
63
|
-
|
|
64
|
-
(const gpu-cull-none u32 0)
|
|
65
|
-
(const gpu-cull-back u32 1)
|
|
66
|
-
(const gpu-cull-front u32 2)
|
|
67
|
-
(const gpu-ccw u32 0)
|
|
68
|
-
(const gpu-cw u32 1)
|
|
69
|
-
|
|
70
|
-
(const gpu-blend-none u32 0)
|
|
71
|
-
(const gpu-blend-alpha u32 1)
|
|
72
|
-
(const gpu-blend-premultiplied u32 2)
|
|
73
|
-
(const gpu-blend-add u32 3)
|
|
74
|
-
|
|
75
|
-
(const gpu-compare-none u32 0)
|
|
76
|
-
(const gpu-less u32 1)
|
|
77
|
-
(const gpu-less-equal u32 2)
|
|
78
|
-
(const gpu-greater u32 3)
|
|
79
|
-
(const gpu-greater-equal u32 4)
|
|
80
|
-
(const gpu-equal u32 5)
|
|
81
|
-
(const gpu-always u32 6)
|
|
82
|
-
(const gpu-never u32 7)
|
|
83
|
-
|
|
84
|
-
(const gpu-vertex u32 1)
|
|
85
|
-
(const gpu-index u32 2)
|
|
86
|
-
(const gpu-uniform u32 4)
|
|
87
|
-
(const gpu-storage u32 8)
|
|
88
|
-
(const gpu-indirect u32 16)
|
|
89
|
-
(const gpu-sampled u32 1)
|
|
90
|
-
(const gpu-target u32 2)
|
|
91
|
-
(const gpu-storage-texture u32 4)
|
|
92
|
-
|
|
93
|
-
(const gpu-nearest u32 0)
|
|
94
|
-
(const gpu-linear u32 1)
|
|
95
|
-
(const gpu-clamp u32 0)
|
|
96
|
-
(const gpu-repeat u32 1)
|
|
97
|
-
(const gpu-mirror u32 2)
|
|
98
|
-
|
|
99
|
-
(const gpu-uniform-entry u32 1)
|
|
100
|
-
(const gpu-storage-entry u32 2)
|
|
101
|
-
(const gpu-read-only-entry u32 3)
|
|
102
|
-
(const gpu-dynamic-uniform-entry u32 4)
|
|
103
|
-
(const gpu-dynamic-storage-entry u32 5)
|
|
104
|
-
(const gpu-dynamic-read-only-entry u32 6)
|
|
105
|
-
(const gpu-sampler-entry u32 7)
|
|
106
|
-
(const gpu-comparison-entry u32 8)
|
|
107
|
-
(const gpu-texture-entry u32 9)
|
|
108
|
-
(const gpu-depth-entry u32 10)
|
|
109
|
-
(const gpu-storage-texture-entry u32 11)
|
|
110
|
-
(const gpu-texture-array-entry u32 12)
|
|
111
|
-
(const gpu-depth-array-entry u32 13)
|
|
112
|
-
(const gpu-in-vertex u32 1)
|
|
113
|
-
(const gpu-in-fragment u32 2)
|
|
114
|
-
(const gpu-in-compute u32 4)
|
|
115
|
-
|
|
116
|
-
(const gpu-per-vertex u32 0)
|
|
117
|
-
(const gpu-per-instance u32 1)
|
|
118
|
-
(const gpu-on-surface u32 1)
|
|
119
|
-
(const gpu-on-texture u32 2)
|
|
120
|
-
(const gpu-keep u32 0)
|
|
121
|
-
(const gpu-clear u32 1)
|
|
122
|
-
(const gpu-u16-indexes u32 0)
|
|
123
|
-
(const gpu-u32-indexes u32 1)
|
|
124
|
-
|
|
125
|
-
(const gpu-kind-surface u32 1)
|
|
126
|
-
(const gpu-kind-shader u32 2)
|
|
127
|
-
(const gpu-kind-pipeline u32 3)
|
|
128
|
-
(const gpu-kind-buffer u32 4)
|
|
129
|
-
(const gpu-kind-texture u32 5)
|
|
130
|
-
(const gpu-kind-sampler u32 6)
|
|
131
|
-
(const gpu-kind-layout u32 7)
|
|
132
|
-
(const gpu-kind-bind-group u32 8)
|
|
133
|
-
|
|
134
|
-
;; ---- the buffer ----
|
|
135
|
-
|
|
136
|
-
(define commands buffer)
|
|
137
|
-
(define frame arena)
|
|
138
|
-
|
|
139
|
-
(define (gpu-commands) -> (ptr buffer) (& commands))
|
|
140
|
-
|
|
141
|
-
(define (gpu-commands-done!)
|
|
142
|
-
(set! (-> commands length) 0)
|
|
143
|
-
(arena-free (& frame)))
|
|
144
|
-
|
|
145
|
-
(define (gpu-frame-alloc [n u32]) -> (ptr void) (arena-alloc (& frame) n))
|
|
146
|
-
|
|
147
|
-
(define (gpu-frame-copy [p (ptr void)] [n u32]) -> (ptr void)
|
|
148
|
-
(let ([copy (gpu-frame-alloc n)])
|
|
149
|
-
(memcpy copy p n)
|
|
150
|
-
copy))
|
|
151
|
-
|
|
152
|
-
(define (words! [w (slice u32)]) (buffer-add! (& commands) (slice (cast (ptr u8) (-> w items)) (* 4 (-> w length)))))
|
|
153
|
-
|
|
154
|
-
(define (word! [w u32]) (words! (slice (array-of u32 w))))
|
|
155
|
-
|
|
156
|
-
(define (float! [x f64]) (buffer-add! (& commands) (slice (cast (ptr u8) (array-of f32 (cast f32 x))) 4)))
|
|
157
|
-
|
|
158
|
-
(define (text! [s string])
|
|
159
|
-
(let ([copy (cast (ptr u8) (gpu-frame-alloc (-> s length)))])
|
|
160
|
-
(memcpy copy (-> s bytes) (-> s length))
|
|
161
|
-
(words! (slice (array-of u32 (cast u32 copy) (-> s length))))))
|
|
162
|
-
|
|
163
|
-
;; ---- the items a command still expects ----
|
|
164
|
-
|
|
165
|
-
(define expected-layouts u32 0)
|
|
166
|
-
(define expected-targets u32 0)
|
|
167
|
-
(define expected-buffers u32 0)
|
|
168
|
-
(define expected-attributes u32 0)
|
|
169
|
-
(define expected-entries u32 0)
|
|
170
|
-
(define expected-bindings u32 0)
|
|
171
|
-
(define expected-pass-targets u32 0)
|
|
172
|
-
(define expected-offsets u32 0)
|
|
173
|
-
|
|
174
|
-
(define (complete!)
|
|
175
|
-
(when (or (> expected-layouts 0) (> expected-targets 0) (> expected-buffers 0) (> expected-attributes 0)
|
|
176
|
-
(> expected-entries 0) (> expected-bindings 0) (> expected-pass-targets 0) (> expected-offsets 0))
|
|
177
|
-
(host-trap "gpu: the last command is still waiting for its items (layouts, targets, attributes, entries or offsets)")))
|
|
178
|
-
|
|
179
|
-
(define (item! [expected (ptr u32)] [unexpected string])
|
|
180
|
-
(when (== (@ expected) 0) (host-trap unexpected))
|
|
181
|
-
(-= (@ expected) 1))
|
|
182
|
-
|
|
183
|
-
;; ---- numbers ----
|
|
184
|
-
|
|
185
|
-
(define next-surface u32 1)
|
|
186
|
-
(define next-shader u32 1)
|
|
187
|
-
(define next-pipeline u32 1)
|
|
188
|
-
(define next-buffer u32 1)
|
|
189
|
-
(define next-texture u32 1)
|
|
190
|
-
(define next-sampler u32 1)
|
|
191
|
-
(define next-layout u32 1)
|
|
192
|
-
(define next-bind-group u32 1)
|
|
193
|
-
|
|
194
|
-
(define (fresh! [next (ptr u32)]) -> u32
|
|
195
|
-
(let ([n (@ next)])
|
|
196
|
-
(+= (@ next) 1)
|
|
197
|
-
n))
|
|
198
|
-
|
|
199
|
-
;; ---- making resources ----
|
|
200
|
-
|
|
201
|
-
(define (gpu-surface! [node u32]) -> u32
|
|
202
|
-
(complete!)
|
|
203
|
-
(let ([id (fresh! (& next-surface))])
|
|
204
|
-
(words! (slice (array-of u32 1 id node)))
|
|
205
|
-
id))
|
|
206
|
-
|
|
207
|
-
(define (gpu-shader! [code string]) -> u32
|
|
208
|
-
(complete!)
|
|
209
|
-
(let ([id (fresh! (& next-shader))])
|
|
210
|
-
(words! (slice (array-of u32 2 id)))
|
|
211
|
-
(text! code)
|
|
212
|
-
id))
|
|
213
|
-
|
|
214
|
-
(define (gpu-render-pipeline! [shader u32] [vertex string] [fragment string] [topology u32] [cull u32] [front u32]
|
|
215
|
-
[blend u32] [depth-format u32] [depth-compare u32] [depth-write bool]
|
|
216
|
-
[layouts u32] [targets u32] [buffers u32]) -> u32
|
|
217
|
-
(complete!)
|
|
218
|
-
(let ([id (fresh! (& next-pipeline))])
|
|
219
|
-
(words! (slice (array-of u32 3 id shader)))
|
|
220
|
-
(text! vertex)
|
|
221
|
-
(text! fragment)
|
|
222
|
-
(words! (slice (array-of u32 topology cull front blend depth-format depth-compare depth-write layouts)))
|
|
223
|
-
(set! expected-layouts layouts)
|
|
224
|
-
(set! expected-targets targets)
|
|
225
|
-
(set! expected-buffers buffers)
|
|
226
|
-
(set! rendering #t)
|
|
227
|
-
(when (== layouts 0) (after-layouts!))
|
|
228
|
-
id))
|
|
229
|
-
|
|
230
|
-
(define rendering bool #f)
|
|
231
|
-
|
|
232
|
-
(define (after-layouts!)
|
|
233
|
-
(when rendering
|
|
234
|
-
(word! expected-targets)
|
|
235
|
-
(when (== expected-targets 0) (after-targets!))))
|
|
236
|
-
|
|
237
|
-
(define (after-targets!) (word! expected-buffers))
|
|
238
|
-
|
|
239
|
-
(define (gpu-layout-item! [layout u32])
|
|
240
|
-
(item! (& expected-layouts) "gpu: no layout is expected here")
|
|
241
|
-
(word! layout)
|
|
242
|
-
(when (== expected-layouts 0) (after-layouts!)))
|
|
243
|
-
|
|
244
|
-
(define (gpu-target! [format u32])
|
|
245
|
-
(item! (& expected-targets) "gpu: no target is expected here")
|
|
246
|
-
(word! format)
|
|
247
|
-
(when (== expected-targets 0) (after-targets!)))
|
|
248
|
-
|
|
249
|
-
(define (gpu-vertex-buffer-layout! [stride u32] [step u32] [attributes u32])
|
|
250
|
-
(when (> expected-attributes 0) (host-trap "gpu: the attributes of the last vertex buffer are not complete"))
|
|
251
|
-
(item! (& expected-buffers) "gpu: no vertex buffer layout is expected here")
|
|
252
|
-
(words! (slice (array-of u32 stride step attributes)))
|
|
253
|
-
(set! expected-attributes attributes))
|
|
254
|
-
|
|
255
|
-
(define (gpu-attribute! [location u32] [offset u32] [format u32])
|
|
256
|
-
(item! (& expected-attributes) "gpu: no attribute is expected here")
|
|
257
|
-
(words! (slice (array-of u32 location offset format))))
|
|
258
|
-
|
|
259
|
-
(define (gpu-compute-pipeline! [shader u32] [entry string] [layouts u32]) -> u32
|
|
260
|
-
(complete!)
|
|
261
|
-
(let ([id (fresh! (& next-pipeline))])
|
|
262
|
-
(words! (slice (array-of u32 4 id shader)))
|
|
263
|
-
(text! entry)
|
|
264
|
-
(word! layouts)
|
|
265
|
-
(set! expected-layouts layouts)
|
|
266
|
-
(set! rendering #f)
|
|
267
|
-
id))
|
|
268
|
-
|
|
269
|
-
(define (gpu-buffer! [size u32] [usage u32]) -> u32
|
|
270
|
-
(complete!)
|
|
271
|
-
(let ([id (fresh! (& next-buffer))])
|
|
272
|
-
(words! (slice (array-of u32 5 id size usage)))
|
|
273
|
-
id))
|
|
274
|
-
|
|
275
|
-
(define (gpu-texture! [width u32] [height u32] [layers u32] [mips u32] [format u32] [usage u32]) -> u32
|
|
276
|
-
(complete!)
|
|
277
|
-
(let ([id (fresh! (& next-texture))])
|
|
278
|
-
(words! (slice (array-of u32 6 id width height layers mips format usage)))
|
|
279
|
-
id))
|
|
280
|
-
|
|
281
|
-
(define (gpu-texture-file! [path string]) -> u32
|
|
282
|
-
(complete!)
|
|
283
|
-
(let ([id (fresh! (& next-texture))])
|
|
284
|
-
(words! (slice (array-of u32 7 id)))
|
|
285
|
-
(text! path)
|
|
286
|
-
id))
|
|
287
|
-
|
|
288
|
-
(define (gpu-sampler! [filter u32] [address u32] [compare u32]) -> u32
|
|
289
|
-
(complete!)
|
|
290
|
-
(let ([id (fresh! (& next-sampler))])
|
|
291
|
-
(words! (slice (array-of u32 8 id filter address compare)))
|
|
292
|
-
id))
|
|
293
|
-
|
|
294
|
-
(define (gpu-layout! [n u32]) -> u32
|
|
295
|
-
(complete!)
|
|
296
|
-
(let ([id (fresh! (& next-layout))])
|
|
297
|
-
(words! (slice (array-of u32 9 id n)))
|
|
298
|
-
(set! expected-entries n)
|
|
299
|
-
id))
|
|
300
|
-
|
|
301
|
-
(define (gpu-layout-entry! [binding u32] [visibility u32] [kind u32])
|
|
302
|
-
(item! (& expected-entries) "gpu: no layout entry is expected here")
|
|
303
|
-
(words! (slice (array-of u32 binding visibility kind))))
|
|
304
|
-
|
|
305
|
-
(define (gpu-bind-group! [layout u32] [pipeline u32] [group u32] [n u32]) -> u32
|
|
306
|
-
(complete!)
|
|
307
|
-
(let ([id (fresh! (& next-bind-group))])
|
|
308
|
-
(words! (slice (array-of u32 10 id layout pipeline group n)))
|
|
309
|
-
(set! expected-bindings n)
|
|
310
|
-
id))
|
|
311
|
-
|
|
312
|
-
(define (gpu-bind-buffer! [binding u32] [buffer u32] [offset u32] [size u32])
|
|
313
|
-
(item! (& expected-bindings) "gpu: no binding is expected here")
|
|
314
|
-
(words! (slice (array-of u32 binding 1 buffer offset size))))
|
|
315
|
-
|
|
316
|
-
(define (gpu-bind-sampler! [binding u32] [sampler u32])
|
|
317
|
-
(item! (& expected-bindings) "gpu: no binding is expected here")
|
|
318
|
-
(words! (slice (array-of u32 binding 2 sampler 0 0))))
|
|
319
|
-
|
|
320
|
-
(define (gpu-bind-texture! [binding u32] [texture u32])
|
|
321
|
-
(item! (& expected-bindings) "gpu: no binding is expected here")
|
|
322
|
-
(words! (slice (array-of u32 binding 3 texture 0 0))))
|
|
323
|
-
|
|
324
|
-
(define (gpu-destroy! [kind u32] [id u32])
|
|
325
|
-
(complete!)
|
|
326
|
-
(words! (slice (array-of u32 11 kind id))))
|
|
327
|
-
|
|
328
|
-
;; ---- writing and reading ----
|
|
329
|
-
|
|
330
|
-
(define (gpu-write-buffer! [buffer u32] [offset u32] [p (ptr void)] [n u32])
|
|
331
|
-
(complete!)
|
|
332
|
-
(words! (slice (array-of u32 12 buffer offset (cast u32 p) n))))
|
|
333
|
-
|
|
334
|
-
(define (gpu-write-texture! [texture u32] [mip u32] [layer u32] [x u32] [y u32] [w u32] [h u32] [p (ptr void)] [n u32])
|
|
335
|
-
(complete!)
|
|
336
|
-
(words! (slice (array-of u32 13 texture mip layer x y w h (cast u32 p) n))))
|
|
337
|
-
|
|
338
|
-
(define (gpu-read-texture! [texture u32] [mip u32] [layer u32] [x u32] [y u32] [w u32] [h u32])
|
|
339
|
-
(complete!)
|
|
340
|
-
(words! (slice (array-of u32 14 texture mip layer x y w h))))
|
|
341
|
-
|
|
342
|
-
(define (gpu-read-buffer! [buffer u32] [offset u32] [n u32])
|
|
343
|
-
(complete!)
|
|
344
|
-
(words! (slice (array-of u32 15 buffer offset n))))
|
|
345
|
-
|
|
346
|
-
;; ---- passes ----
|
|
347
|
-
|
|
348
|
-
(define (gpu-render-pass! [targets u32] [depth-texture u32] [depth-mip u32] [depth-layer u32] [depth-load u32] [depth-clear f64])
|
|
349
|
-
(complete!)
|
|
350
|
-
(words! (slice (array-of u32 16 targets)))
|
|
351
|
-
(set! expected-pass-targets targets)
|
|
352
|
-
(set! pending-depth-texture depth-texture)
|
|
353
|
-
(set! pending-depth-mip depth-mip)
|
|
354
|
-
(set! pending-depth-layer depth-layer)
|
|
355
|
-
(set! pending-depth-load depth-load)
|
|
356
|
-
(set! pending-depth-clear depth-clear)
|
|
357
|
-
(when (== targets 0) (depth!)))
|
|
358
|
-
|
|
359
|
-
(define pending-depth-texture u32 0)
|
|
360
|
-
(define pending-depth-mip u32 0)
|
|
361
|
-
(define pending-depth-layer u32 0)
|
|
362
|
-
(define pending-depth-load u32 0)
|
|
363
|
-
(define pending-depth-clear f64 0.0)
|
|
364
|
-
|
|
365
|
-
(define (depth!)
|
|
366
|
-
(words! (slice (array-of u32 pending-depth-texture pending-depth-mip pending-depth-layer pending-depth-load)))
|
|
367
|
-
(float! pending-depth-clear))
|
|
368
|
-
|
|
369
|
-
(define (gpu-pass-target! [kind u32] [id u32] [mip u32] [layer u32] [load u32] [r f64] [g f64] [b f64] [a f64])
|
|
370
|
-
(item! (& expected-pass-targets) "gpu: no pass target is expected here")
|
|
371
|
-
(words! (slice (array-of u32 kind id mip layer load)))
|
|
372
|
-
(float! r)
|
|
373
|
-
(float! g)
|
|
374
|
-
(float! b)
|
|
375
|
-
(float! a)
|
|
376
|
-
(when (== expected-pass-targets 0) (depth!)))
|
|
377
|
-
|
|
378
|
-
(define (gpu-compute-pass!)
|
|
379
|
-
(complete!)
|
|
380
|
-
(word! 17))
|
|
381
|
-
|
|
382
|
-
(define (gpu-end-pass!)
|
|
383
|
-
(complete!)
|
|
384
|
-
(word! 18))
|
|
385
|
-
|
|
386
|
-
(define (gpu-pipeline! [pipeline u32])
|
|
387
|
-
(complete!)
|
|
388
|
-
(words! (slice (array-of u32 19 pipeline))))
|
|
389
|
-
|
|
390
|
-
(define (gpu-bind-group-set! [group u32] [bind-group u32] [n u32])
|
|
391
|
-
(complete!)
|
|
392
|
-
(words! (slice (array-of u32 20 group bind-group n)))
|
|
393
|
-
(set! expected-offsets n))
|
|
394
|
-
|
|
395
|
-
(define (gpu-offset! [offset u32])
|
|
396
|
-
(item! (& expected-offsets) "gpu: no offset is expected here")
|
|
397
|
-
(word! offset))
|
|
398
|
-
|
|
399
|
-
(define (gpu-vertex-buffer! [slot u32] [buffer u32] [offset u32])
|
|
400
|
-
(complete!)
|
|
401
|
-
(words! (slice (array-of u32 21 slot buffer offset))))
|
|
402
|
-
|
|
403
|
-
(define (gpu-index-buffer! [buffer u32] [format u32] [offset u32])
|
|
404
|
-
(complete!)
|
|
405
|
-
(words! (slice (array-of u32 22 buffer format offset))))
|
|
406
|
-
|
|
407
|
-
(define (gpu-draw! [vertices u32] [instances u32] [first-vertex u32] [first-instance u32])
|
|
408
|
-
(complete!)
|
|
409
|
-
(words! (slice (array-of u32 23 vertices instances first-vertex first-instance))))
|
|
410
|
-
|
|
411
|
-
(define (gpu-draw-indexed! [indexes u32] [instances u32] [first-index u32] [base-vertex u32] [first-instance u32])
|
|
412
|
-
(complete!)
|
|
413
|
-
(words! (slice (array-of u32 24 indexes instances first-index base-vertex first-instance))))
|
|
414
|
-
|
|
415
|
-
(define (gpu-dispatch! [x u32] [y u32] [z u32])
|
|
416
|
-
(complete!)
|
|
417
|
-
(words! (slice (array-of u32 25 x y z))))
|
|
418
|
-
|
|
419
|
-
(define (gpu-viewport! [x f64] [y f64] [w f64] [h f64])
|
|
420
|
-
(complete!)
|
|
421
|
-
(word! 26)
|
|
422
|
-
(float! x)
|
|
423
|
-
(float! y)
|
|
424
|
-
(float! w)
|
|
425
|
-
(float! h))
|
|
426
|
-
|
|
427
|
-
(define (gpu-scissor! [x u32] [y u32] [w u32] [h u32])
|
|
428
|
-
(complete!)
|
|
429
|
-
(words! (slice (array-of u32 27 x y w h))))
|
|
17
|
+
(define (gpu-send!)
|
|
18
|
+
(unless batch-begun (host-trap "gpu: gpu-send! was called without gpu-begin!"))
|
|
19
|
+
(set! batch-begun #f)
|
|
20
|
+
(let ([b (gpu-commands)])
|
|
21
|
+
(when (> (-> b length) 0) (gpu-apply (buffer-bytes b) batch-tag)))
|
|
22
|
+
(gpu-commands-done!))
|
package/std/web/patches.sub
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
;; Changes to the
|
|
2
|
-
;; the nodes a program will change are marked: elements with a data-n attribute, <!--t--> for a text node, and
|
|
3
|
-
;; for a place that other pieces can be put before. dom-add! puts a piece, a copy of a template,
|
|
4
|
-
;; the piece's number; its marked nodes are numbered after it, in document order. The strings these
|
|
5
|
-
;; copied, and the copies last until the patches are sent or dom-discard! drops them.
|
|
1
|
+
;; Changes to the document, written as patches for the host module "dom". dom.sub sends them. A template is HTML in
|
|
2
|
+
;; which the nodes a program will change are marked: elements with a data-n attribute, <!--t--> for a text node, and
|
|
3
|
+
;; <!--a--> for a place that other pieces can be put before. dom-add! puts a piece, a copy of a template, in the document
|
|
4
|
+
;; and returns the piece's number; its marked nodes are numbered after it, in document order. The strings these
|
|
5
|
+
;; functions take are copied, and the copies last until the patches are sent or dom-discard! drops them.
|
|
6
6
|
(provide dom-template dom-add! dom-remove! dom-forget! dom-move! dom-set-text! dom-set-attr! dom-remove-attr! dom-listen!
|
|
7
|
-
dom-listen-window! dom-
|
|
8
|
-
dom-
|
|
7
|
+
dom-listen-window! dom-value dom-number dom-text dom-write-number! dom-write-text! dom-call! dom-call-with!
|
|
8
|
+
dom-document dom-image! dom-stylesheet! dom-new-node!
|
|
9
|
+
dom-discard! dom-patches dom-frame-alloc dom-flushes)
|
|
10
|
+
|
|
11
|
+
;; The document's node number. The root's number is 0.
|
|
12
|
+
(const dom-document u32 1)
|
|
9
13
|
|
|
10
14
|
(define patches buffer)
|
|
11
15
|
(define frame arena)
|
|
12
|
-
(define next-id u32
|
|
16
|
+
(define next-id u32 2)
|
|
13
17
|
(define next-template u32 1)
|
|
14
18
|
(define flushes u32 0)
|
|
15
19
|
(define counts buffer)
|
|
@@ -45,8 +49,8 @@
|
|
|
45
49
|
(words! (slice (array-of u32 2 template first n parent before)))
|
|
46
50
|
first))
|
|
47
51
|
|
|
48
|
-
;; dom-remove! takes a piece
|
|
49
|
-
;; inside one taken
|
|
52
|
+
;; dom-remove! takes a piece out of the document and forgets its nodes. dom-forget! only forgets them, for a piece that
|
|
53
|
+
;; was inside one taken out.
|
|
50
54
|
(define (dom-remove! [first u32] [template u32]) (words! (slice (array-of u32 3 first (size-of template)))))
|
|
51
55
|
(define (dom-forget! [first u32] [template u32]) (words! (slice (array-of u32 4 first (size-of template)))))
|
|
52
56
|
|
|
@@ -106,22 +110,53 @@
|
|
|
106
110
|
(let ([n (kept name)]) (words! (slice (array-of u32 8 node (cast u32 (-> n bytes)) (-> n length))))))
|
|
107
111
|
|
|
108
112
|
;; dom-listen! sends the node's event to tag's handler, and dom-listen-window! sends the window's event there while the
|
|
109
|
-
;; node is
|
|
113
|
+
;; node is in the document.
|
|
110
114
|
(define (dom-listen! [node u32] [event string] [tag (ptr void)])
|
|
111
115
|
(let ([e (kept event)]) (words! (slice (array-of u32 9 node (cast u32 (-> e bytes)) (-> e length) (cast u32 tag))))))
|
|
112
116
|
|
|
113
117
|
(define (dom-listen-window! [node u32] [event string] [tag (ptr void)])
|
|
114
|
-
(let ([e (kept event)]) (words! (slice (array-of u32
|
|
118
|
+
(let ([e (kept event)]) (words! (slice (array-of u32 10 node (cast u32 (-> e bytes)) (-> e length) (cast u32 tag))))))
|
|
119
|
+
|
|
120
|
+
;; Writes and calls name a property or method as reads do (dom.sub), starting at the node. They happen after the other
|
|
121
|
+
;; patches sent with them.
|
|
122
|
+
(variant dom-value [dom-number [n f64]] [dom-text [s string]])
|
|
123
|
+
|
|
124
|
+
(define (value! [v (ptr dom-value)])
|
|
125
|
+
(match v
|
|
126
|
+
[(dom-number n)
|
|
127
|
+
(let ([b (cast u64 (f64-bits n))]) (words! (slice (array-of u32 0 (cast u32 b) (cast u32 (>> b 32))))))]
|
|
128
|
+
[(dom-text s)
|
|
129
|
+
(let ([t (kept s)]) (words! (slice (array-of u32 1 (cast u32 (-> t bytes)) (-> t length)))))]))
|
|
130
|
+
|
|
131
|
+
(define (write! [node u32] [path string] [v dom-value])
|
|
132
|
+
(let ([p (kept path)])
|
|
133
|
+
(words! (slice (array-of u32 14 node (cast u32 (-> p bytes)) (-> p length))))
|
|
134
|
+
(value! (& v))))
|
|
115
135
|
|
|
116
|
-
(define (dom-
|
|
136
|
+
(define (dom-write-number! [node u32] [path string] [n f64]) (write! node path (dom-number n)))
|
|
117
137
|
|
|
118
|
-
(define (dom-
|
|
138
|
+
(define (dom-write-text! [node u32] [path string] [s string]) (write! node path (dom-text s)))
|
|
119
139
|
|
|
120
|
-
(define (dom-
|
|
140
|
+
(define (dom-call-with! [node u32] [method string] [arguments (slice dom-value)])
|
|
141
|
+
(let ([m (kept method)])
|
|
142
|
+
(words! (slice (array-of u32 15 node (cast u32 (-> m bytes)) (-> m length) (-> arguments length))))
|
|
143
|
+
(for ([i u32 0]) (< i (-> arguments length)) (+= i 1) (value! (& (@ arguments i))))))
|
|
121
144
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
145
|
+
(define (dom-call! [node u32] [method string]) (dom-call-with! node method (slice (cast (ptr dom-value) 0) 0)))
|
|
146
|
+
|
|
147
|
+
;; dom-image! loads the image at path under the number id, for canvas-load-image! (canvas.sub). Its loaded or failed
|
|
148
|
+
;; event goes to tag.
|
|
149
|
+
(define (dom-image! [id u32] [path string] [tag (ptr void)])
|
|
150
|
+
(let ([p (kept path)]) (words! (slice (array-of u32 12 id (cast u32 (-> p bytes)) (-> p length) (cast u32 tag))))))
|
|
151
|
+
|
|
152
|
+
(define (dom-stylesheet! [css string])
|
|
153
|
+
(let ([c (kept css)]) (words! (slice (array-of u32 13 (cast u32 (-> c bytes)) (-> c length))))))
|
|
154
|
+
|
|
155
|
+
;; A fresh node number, for dom-element (dom.sub).
|
|
156
|
+
(define (dom-new-node!) -> u32
|
|
157
|
+
(let ([n next-id])
|
|
158
|
+
(+= next-id 1)
|
|
159
|
+
n))
|
|
125
160
|
|
|
126
161
|
(define (dom-discard!)
|
|
127
162
|
(set! (-> patches length) 0)
|
package/substrate/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.10.
|
|
1
|
+
0.10.2
|
|
@@ -1069,10 +1069,9 @@
|
|
|
1069
1069
|
(equal? (section d 'format) (make-integer cache-format))
|
|
1070
1070
|
(equal? (section d 'compiler) compiler-hash)))
|
|
1071
1071
|
|
|
1072
|
-
;; load-cached loads
|
|
1073
|
-
;; from.
|
|
1072
|
+
;; load-cached loads the module at path from the program's compiled modules when they hold it, or else from the cache.
|
|
1074
1073
|
(define (load-cached [path datum]) -> datum
|
|
1075
|
-
(if (
|
|
1074
|
+
(if (and (== (compiled-module path) 0) (or (compiled-root? path) (== (cache-compiler) 0)))
|
|
1076
1075
|
0
|
|
1077
1076
|
(begin
|
|
1078
1077
|
(begin-module-arena)
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
(provide set-toolchain-directory! set-module-map! set-module-map-text! set-display-directory! toolchain-root? toolchain-roots
|
|
10
10
|
toolchain-holding root-directories root-under-test? identity identity-label host-file entry-identity program-identity
|
|
11
11
|
set-compiled-module-map! compiled-module-map compiled-module compiled-root? module-source-file module-path-from
|
|
12
|
-
module-identity named-file program-forms language-path compiler-file module-source?
|
|
13
|
-
write-error fail-at read-text file-text host-error module-refusal)
|
|
12
|
+
module-identity named-file named-directory program-forms language-path compiler-file module-source?
|
|
13
|
+
string-literal? displayed write-error fail-at read-text file-text host-error module-refusal)
|
|
14
14
|
|
|
15
15
|
(define (symbol-of [s datum]) -> datum (string->symbol (datum->string s)))
|
|
16
16
|
|
|
@@ -183,10 +183,12 @@
|
|
|
183
183
|
(define (set-module-map-text! [text datum] [source datum])
|
|
184
184
|
(set-module-map! (map (lambda ([f datum]) -> datum (syntax->datum f)) (read-text text (symbol-of source)))))
|
|
185
185
|
|
|
186
|
-
;; set-compiled-module-map!
|
|
186
|
+
;; set-compiled-module-map! gives sessions the program's compiled modules. When the program has given no roots with
|
|
187
|
+
;; directories, it also replaces the roots with those of the compiled modules, which have no directories.
|
|
187
188
|
(define (set-compiled-module-map! [forms datum] [modules datum])
|
|
188
|
-
(
|
|
189
|
-
|
|
189
|
+
(when (null? (root-directories))
|
|
190
|
+
(set! toolchain-directory 0)
|
|
191
|
+
(set-module-map! forms))
|
|
190
192
|
(set! compiled (keep modules)))
|
|
191
193
|
|
|
192
194
|
;; compiled-module-map returns the module map without directories, which a build writes next to the program's compiled
|
|
@@ -390,6 +392,11 @@
|
|
|
390
392
|
(let ([file (concat rest '".sub")] [inner (file-in rest (concat (last-part rest) '".sub"))])
|
|
391
393
|
(if (and (== (compiled-module (identity label file)) 0) (!= (compiled-module (identity label inner)) 0)) inner file)))
|
|
392
394
|
|
|
395
|
+
;; named-directory gives the directory that name stands for in a require from file, or #f for a root of compiled modules.
|
|
396
|
+
(define (named-directory [file datum] [name datum]) -> datum
|
|
397
|
+
(let ([r (root-holding (absolute file))])
|
|
398
|
+
(cadr (root-in (named-root 0 name (if (== r 0) program-label (car r)) roots) roots))))
|
|
399
|
+
|
|
393
400
|
;; naming-label returns the root used to resolve module names in code from a given module: that module's root, or the
|
|
394
401
|
;; program's root for code outside any root, such as session input.
|
|
395
402
|
(define (naming-label [from datum]) -> datum
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// What a program may do beyond computing: read and write files, reach hosts, read the environment and run
|
|
2
|
-
// programs. The grants match Deno's permissions wherever the two overlap, except that the host never prompts, a
|
|
3
|
-
// cannot check where fetch is redirected or where names resolve, and a child may keep the dynamic loader's
|
|
4
|
-
// the host started with.
|
|
2
|
+
// programs. The grants match Deno's permissions wherever the two overlap, except that the host never prompts, a web
|
|
3
|
+
// program cannot check where fetch is redirected or where names resolve, and a child may keep the dynamic loader's
|
|
4
|
+
// variables the host started with.
|
|
5
5
|
const kinds = ['read', 'write', 'net', 'env', 'run'];
|
|
6
6
|
export const flags = {
|
|
7
7
|
read: '--allow-read', write: '--allow-write', net: '--allow-net', env: '--allow-env', run: '--allow-run',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// The host module "net" (net.sub).
|
|
1
|
+
// The host module "net" (net.sub). A TLS server reloads its certificate and key when their files change.
|
|
2
|
+
import fs from 'node:fs';
|
|
2
3
|
import net from 'node:net';
|
|
3
4
|
import tls from 'node:tls';
|
|
4
5
|
import { errorOf, reasonOf } from '../errors.mjs';
|
|
@@ -14,6 +15,19 @@ const ACCEPT = 2;
|
|
|
14
15
|
const CONNECTED = 3;
|
|
15
16
|
const FAILED = 4;
|
|
16
17
|
|
|
18
|
+
function renewed(server, certificate) {
|
|
19
|
+
const [certFile, keyFile] = certificate.files;
|
|
20
|
+
const reload = () => {
|
|
21
|
+
try {
|
|
22
|
+
server.setSecureContext({ cert: fs.readFileSync(certFile), key: fs.readFileSync(keyFile) });
|
|
23
|
+
} catch {}
|
|
24
|
+
};
|
|
25
|
+
for (const file of certificate.files) fs.watchFile(file, { interval: 1000, persistent: false }, reload);
|
|
26
|
+
server.once('close', () => {
|
|
27
|
+
for (const file of certificate.files) fs.unwatchFile(file, reload);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
17
31
|
export function netModule(grants, certificate) {
|
|
18
32
|
const listeners = new Map();
|
|
19
33
|
const ca = certificate ? [...tls.rootCertificates, certificate.cert] : undefined;
|
|
@@ -39,9 +53,10 @@ export function netModule(grants, certificate) {
|
|
|
39
53
|
throw new Error('net.listen: TLS needs the host started with --tls-cert and --tls-key');
|
|
40
54
|
}
|
|
41
55
|
server = secure
|
|
42
|
-
? tls.createServer({
|
|
56
|
+
? tls.createServer({ cert: certificate.cert, key: certificate.key, allowHalfOpen: true })
|
|
43
57
|
: net.createServer({ allowHalfOpen: true });
|
|
44
58
|
if (most > 0) server.maxConnections = most;
|
|
59
|
+
if (secure && certificate.files) renewed(server, certificate);
|
|
45
60
|
if (addressDenials(grants.net) && !net.isIP(host)) {
|
|
46
61
|
lookupWithin(grants, 'net.listen', port)(host, {}, (e, address) => {
|
|
47
62
|
if (listeners.get(id) !== server) return;
|
|
@@ -30,7 +30,9 @@ export function workers(setup) {
|
|
|
30
30
|
spawn(plan) {
|
|
31
31
|
const { port1, port2 } = new MessageChannel();
|
|
32
32
|
const signal = new Int32Array(new SharedArrayBuffer(4));
|
|
33
|
-
const tls = plan.tls
|
|
33
|
+
const tls = plan.tls
|
|
34
|
+
? { cert: read(plan.tls.cert), key: read(plan.tls.key), files: [plan.tls.cert, plan.tls.key] }
|
|
35
|
+
: setup.tls;
|
|
34
36
|
const thread = new Worker(new URL('./worker-thread.mjs', import.meta.url));
|
|
35
37
|
// The messages a thread posted before it ended, which can still wait on the port when its exit is heard.
|
|
36
38
|
let heard = null;
|