@reearth/ezu 0.4.2 → 0.5.0
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/bundler/ezu.d.ts +97 -0
- package/bundler/ezu.js +1 -1
- package/bundler/ezu_bg.js +143 -25
- package/bundler/ezu_bg.wasm +0 -0
- package/bundler/ezu_bg.wasm.d.ts +4 -0
- package/nodejs/ezu.d.ts +97 -0
- package/nodejs/ezu.js +144 -25
- package/nodejs/ezu_bg.wasm +0 -0
- package/nodejs/ezu_bg.wasm.d.ts +4 -0
- package/package.json +1 -1
- package/simd/bundler/ezu.d.ts +97 -0
- package/simd/bundler/ezu.js +1 -1
- package/simd/bundler/ezu_bg.js +143 -25
- package/simd/bundler/ezu_bg.wasm +0 -0
- package/simd/bundler/ezu_bg.wasm.d.ts +4 -0
- package/simd/nodejs/ezu.d.ts +97 -0
- package/simd/nodejs/ezu.js +144 -25
- package/simd/nodejs/ezu_bg.wasm +0 -0
- package/simd/nodejs/ezu_bg.wasm.d.ts +4 -0
- package/simd/web/ezu.d.ts +101 -0
- package/simd/web/ezu.js +143 -25
- package/simd/web/ezu_bg.wasm +0 -0
- package/simd/web/ezu_bg.wasm.d.ts +4 -0
- package/simd/workerd/ezu.js +1 -1
- package/web/ezu.d.ts +101 -0
- package/web/ezu.js +143 -25
- package/web/ezu_bg.wasm +0 -0
- package/web/ezu_bg.wasm.d.ts +4 -0
- package/workerd/ezu.js +1 -1
package/simd/bundler/ezu_bg.js
CHANGED
|
@@ -178,6 +178,71 @@ export class Renderer {
|
|
|
178
178
|
clearSources() {
|
|
179
179
|
wasm.renderer_clearSources(this.__wbg_ptr);
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* What this renderer is holding, in bytes, so a host can shed load
|
|
183
|
+
* *before* an allocation fails rather than after.
|
|
184
|
+
*
|
|
185
|
+
* Returns a JS object:
|
|
186
|
+
* - `heapBytes` — wasm linear memory committed to the **module**,
|
|
187
|
+
* shared by every `Renderer` in this instance. This is the number
|
|
188
|
+
* that meets an isolate's memory cap. It is a high-water mark:
|
|
189
|
+
* freeing Rust values returns them to the allocator, never to the
|
|
190
|
+
* host, so it only ever grows.
|
|
191
|
+
* - `glyphBytes` / `glyphRanges` — SDF bitmaps resident in the
|
|
192
|
+
* glyph bank, and how many 256-codepoint blocks they span. Glyphs
|
|
193
|
+
* accumulate for the life of the renderer and survive
|
|
194
|
+
* `clearSources`, so on a long-lived instance this is usually
|
|
195
|
+
* what grew. `glyphBudget` is the per-fontstack ceiling
|
|
196
|
+
* `setGlyphBudget` put on them, or `Infinity` if none — note
|
|
197
|
+
* `glyphBytes` totals *every* fontstack, so it can exceed the
|
|
198
|
+
* budget legitimately.
|
|
199
|
+
* - `fontBytes` — outline font files held in the font bank.
|
|
200
|
+
* - `imageBytes` — decoded pixels of bound images and sprite
|
|
201
|
+
* atlases.
|
|
202
|
+
* - `cacheBytes` / `cacheBudget` — the render cache's pixel
|
|
203
|
+
* payload against its own eviction budget; it bounds itself, so
|
|
204
|
+
* `cacheBytes` near `cacheBudget` is steady state, not a leak.
|
|
205
|
+
*
|
|
206
|
+
* These are payload sizes, not an accounting of the heap: they omit
|
|
207
|
+
* allocator overhead, decoded features, per-font glyph-path caches,
|
|
208
|
+
* and the buffers a render is using right now. Expect the parts to
|
|
209
|
+
* sum to less than `heapBytes`.
|
|
210
|
+
* @returns {object}
|
|
211
|
+
*/
|
|
212
|
+
memoryUsage() {
|
|
213
|
+
const ret = wasm.renderer_memoryUsage(this.__wbg_ptr);
|
|
214
|
+
if (ret[2]) {
|
|
215
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
216
|
+
}
|
|
217
|
+
return takeFromExternrefTable0(ret[0]);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Codepoints the currently bound features can require, as
|
|
221
|
+
* `{ [glyphsSourceName]: number[] }` sorted ascending.
|
|
222
|
+
*
|
|
223
|
+
* This is the precise form of
|
|
224
|
+
* [`neededGlyphRanges`](Self::needed_glyph_ranges): a host that
|
|
225
|
+
* can build its own glyph PBF — one message holding just these
|
|
226
|
+
* codepoints — transfers only the glyphs the tile draws instead
|
|
227
|
+
* of the whole 256-codepoint block around each of them. On CJK
|
|
228
|
+
* labels that is the difference between a few thousand glyphs and
|
|
229
|
+
* a few tens of megabytes. `bindSource` files each glyph by its
|
|
230
|
+
* own id, so such a subset may span any number of blocks and
|
|
231
|
+
* needs no particular `range` string.
|
|
232
|
+
*
|
|
233
|
+
* Hosts that can only fetch whole `{range}.pbf` files off a
|
|
234
|
+
* MapLibre glyphs endpoint want `neededGlyphRanges` instead. Both
|
|
235
|
+
* calls see the same set of codepoints and carry the same
|
|
236
|
+
* over-approximation caveat.
|
|
237
|
+
* @returns {object}
|
|
238
|
+
*/
|
|
239
|
+
neededCodepoints() {
|
|
240
|
+
const ret = wasm.renderer_neededCodepoints(this.__wbg_ptr);
|
|
241
|
+
if (ret[2]) {
|
|
242
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
243
|
+
}
|
|
244
|
+
return takeFromExternrefTable0(ret[0]);
|
|
245
|
+
}
|
|
181
246
|
/**
|
|
182
247
|
* Glyph ranges the currently bound features can require, as
|
|
183
248
|
* `{ [glyphsSourceName]: number[] }` where each number is a range
|
|
@@ -189,6 +254,11 @@ export class Renderer {
|
|
|
189
254
|
* scraping every string in the MVT, call this after binding the
|
|
190
255
|
* vector sources and bind exactly the listed ranges.
|
|
191
256
|
*
|
|
257
|
+
* A range holds 256 codepoints and a tile typically draws a
|
|
258
|
+
* handful of them, so this is a coarse unit to fetch in. Hosts
|
|
259
|
+
* that can assemble their own subset PBF should call
|
|
260
|
+
* [`neededCodepoints`](Self::needed_codepoints) instead.
|
|
261
|
+
*
|
|
192
262
|
* It is an over-approximation, deliberately: a range is listed if
|
|
193
263
|
* *any* feature in a text layer carries the codepoint in a property
|
|
194
264
|
* the layer's `text` expression reads, without evaluating filters,
|
|
@@ -271,6 +341,34 @@ export class Renderer {
|
|
|
271
341
|
}
|
|
272
342
|
return takeFromExternrefTable0(ret[0]);
|
|
273
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Cap the glyph bytes each bound fontstack keeps resident, in
|
|
346
|
+
* bytes. Unset, a fontstack keeps every range ever bound to it for
|
|
347
|
+
* the life of the renderer — `clearSources` does not touch glyphs,
|
|
348
|
+
* and on a long-lived instance rendering across a basemap that is
|
|
349
|
+
* usually what grew.
|
|
350
|
+
*
|
|
351
|
+
* Trimming happens **after** each `renderTile`, not while binding,
|
|
352
|
+
* so a render never loses glyphs that were bound for it. The tile
|
|
353
|
+
* that just drew is therefore the most recently used, and a budget
|
|
354
|
+
* large enough for one tile's glyphs always keeps that tile's; what
|
|
355
|
+
* goes is what earlier tiles needed and this one did not. Set it
|
|
356
|
+
* below one tile's worth and the ceiling still holds — the stack
|
|
357
|
+
* empties after every render and nothing carries over, which
|
|
358
|
+
* renders correctly but buys no reuse.
|
|
359
|
+
*
|
|
360
|
+
* It is a per-fontstack ceiling: a style with a regular, a medium
|
|
361
|
+
* and an italic stack can hold three times what is set here.
|
|
362
|
+
*
|
|
363
|
+
* This host cannot refetch, so anything trimmed must be bound again
|
|
364
|
+
* before the next tile that needs it. `neededCodepoints()` already
|
|
365
|
+
* names exactly what to bind, and a host that re-binds every tile
|
|
366
|
+
* (rather than tracking what it sent) needs no other change.
|
|
367
|
+
* @param {number} bytes
|
|
368
|
+
*/
|
|
369
|
+
setGlyphBudget(bytes) {
|
|
370
|
+
wasm.renderer_setGlyphBudget(this.__wbg_ptr, bytes);
|
|
371
|
+
}
|
|
274
372
|
/**
|
|
275
373
|
* Replace the active style. Returns the new node count. Invalidates
|
|
276
374
|
* the intermediate cache and drops any pending source bindings.
|
|
@@ -297,6 +395,26 @@ export class Renderer {
|
|
|
297
395
|
}
|
|
298
396
|
if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
|
|
299
397
|
|
|
398
|
+
/**
|
|
399
|
+
* Wasm linear memory currently committed to this module, in bytes.
|
|
400
|
+
*
|
|
401
|
+
* This is the figure an isolate's memory cap applies to, and the one
|
|
402
|
+
* to watch to shed load before an allocation fails — a refused
|
|
403
|
+
* `memory.grow` throws [`OutOfMemory`](oom) and ends the instance.
|
|
404
|
+
* It never falls: freed Rust values return to the allocator for reuse,
|
|
405
|
+
* but wasm cannot hand pages back to the host. So a drop in demand
|
|
406
|
+
* leaves the number where its peak left it, and only a fresh instance
|
|
407
|
+
* resets it.
|
|
408
|
+
*
|
|
409
|
+
* Module-wide, not per-`Renderer`. For what a given renderer is
|
|
410
|
+
* holding, and which bank to evict, call `memoryUsage()`.
|
|
411
|
+
* @returns {number}
|
|
412
|
+
*/
|
|
413
|
+
export function heapBytes() {
|
|
414
|
+
const ret = wasm.heapBytes();
|
|
415
|
+
return ret >>> 0;
|
|
416
|
+
}
|
|
417
|
+
|
|
300
418
|
/**
|
|
301
419
|
* Whether the wasm binary was compiled with `+simd128`. Lets the demo
|
|
302
420
|
* page label the renderer build accurately.
|
|
@@ -318,29 +436,29 @@ export function threadsEnabled() {
|
|
|
318
436
|
const ret = wasm.threadsEnabled();
|
|
319
437
|
return ret !== 0;
|
|
320
438
|
}
|
|
321
|
-
export function
|
|
439
|
+
export function __wbg___wbindgen_boolean_get_fa956cfa2d1bd751(arg0) {
|
|
322
440
|
const v = arg0;
|
|
323
441
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
324
442
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
325
443
|
}
|
|
326
|
-
export function
|
|
444
|
+
export function __wbg___wbindgen_is_null_ea9085d691f535d3(arg0) {
|
|
327
445
|
const ret = arg0 === null;
|
|
328
446
|
return ret;
|
|
329
447
|
}
|
|
330
|
-
export function
|
|
448
|
+
export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
|
|
331
449
|
const ret = arg0 === undefined;
|
|
332
450
|
return ret;
|
|
333
451
|
}
|
|
334
|
-
export function
|
|
452
|
+
export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
|
|
335
453
|
const obj = arg1;
|
|
336
454
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
337
455
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
338
456
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
339
457
|
}
|
|
340
|
-
export function
|
|
458
|
+
export function __wbg___wbindgen_rethrow_4915403b40f010b4(arg0) {
|
|
341
459
|
throw arg0;
|
|
342
460
|
}
|
|
343
|
-
export function
|
|
461
|
+
export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
|
|
344
462
|
const obj = arg1;
|
|
345
463
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
346
464
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
@@ -348,10 +466,10 @@ export function __wbg___wbindgen_string_get_d109740c0d18f4d7(arg0, arg1) {
|
|
|
348
466
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
349
467
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
350
468
|
}
|
|
351
|
-
export function
|
|
469
|
+
export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
|
|
352
470
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
353
471
|
}
|
|
354
|
-
export function
|
|
472
|
+
export function __wbg_call_a6e5c5dce5018821() { return handleError(function (arg0, arg1, arg2) {
|
|
355
473
|
const ret = arg0.call(arg1, arg2);
|
|
356
474
|
return ret;
|
|
357
475
|
}, arguments); }
|
|
@@ -366,15 +484,15 @@ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
|
366
484
|
wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
|
|
367
485
|
}
|
|
368
486
|
}
|
|
369
|
-
export function
|
|
487
|
+
export function __wbg_get_507a50627bffa49b(arg0, arg1) {
|
|
370
488
|
const ret = arg0[arg1 >>> 0];
|
|
371
489
|
return ret;
|
|
372
490
|
}
|
|
373
|
-
export function
|
|
491
|
+
export function __wbg_get_78f252d074a84d0b() { return handleError(function (arg0, arg1) {
|
|
374
492
|
const ret = Reflect.get(arg0, arg1);
|
|
375
493
|
return ret;
|
|
376
494
|
}, arguments); }
|
|
377
|
-
export function
|
|
495
|
+
export function __wbg_instanceof_Object_33f20e6f12439f3e(arg0) {
|
|
378
496
|
let result;
|
|
379
497
|
try {
|
|
380
498
|
result = arg0 instanceof Object;
|
|
@@ -384,43 +502,43 @@ export function __wbg_instanceof_Object_03924e0dbda74bd8(arg0) {
|
|
|
384
502
|
const ret = result;
|
|
385
503
|
return ret;
|
|
386
504
|
}
|
|
387
|
-
export function
|
|
505
|
+
export function __wbg_isArray_0677c962b281d01a(arg0) {
|
|
388
506
|
const ret = Array.isArray(arg0);
|
|
389
507
|
return ret;
|
|
390
508
|
}
|
|
391
|
-
export function
|
|
509
|
+
export function __wbg_length_370319915dc99107(arg0) {
|
|
392
510
|
const ret = arg0.length;
|
|
393
511
|
return ret;
|
|
394
512
|
}
|
|
395
|
-
export function
|
|
396
|
-
const ret = new
|
|
513
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
514
|
+
const ret = new Error();
|
|
397
515
|
return ret;
|
|
398
516
|
}
|
|
399
|
-
export function
|
|
400
|
-
const ret = new
|
|
517
|
+
export function __wbg_new_32b398fb48b6d94a() {
|
|
518
|
+
const ret = new Array();
|
|
401
519
|
return ret;
|
|
402
520
|
}
|
|
403
|
-
export function
|
|
404
|
-
const ret = new Error();
|
|
521
|
+
export function __wbg_new_b667d279fd5aa943(arg0, arg1) {
|
|
522
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
405
523
|
return ret;
|
|
406
524
|
}
|
|
407
|
-
export function
|
|
408
|
-
const ret = new
|
|
525
|
+
export function __wbg_new_da52cf8fe3429cb2() {
|
|
526
|
+
const ret = new Object();
|
|
409
527
|
return ret;
|
|
410
528
|
}
|
|
411
|
-
export function
|
|
529
|
+
export function __wbg_now_86c0d4ba3fa605b8() {
|
|
412
530
|
const ret = Date.now();
|
|
413
531
|
return ret;
|
|
414
532
|
}
|
|
415
|
-
export function
|
|
533
|
+
export function __wbg_push_d2ae3af0c1217ae6(arg0, arg1) {
|
|
416
534
|
const ret = arg0.push(arg1);
|
|
417
535
|
return ret;
|
|
418
536
|
}
|
|
419
|
-
export function
|
|
537
|
+
export function __wbg_set_8535240470bf2500() { return handleError(function (arg0, arg1, arg2) {
|
|
420
538
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
421
539
|
return ret;
|
|
422
540
|
}, arguments); }
|
|
423
|
-
export function
|
|
541
|
+
export function __wbg_set_name_3bbc583faefa4193(arg0, arg1, arg2) {
|
|
424
542
|
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
425
543
|
}
|
|
426
544
|
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
package/simd/bundler/ezu_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_logsink_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_renderer_free: (a: number, b: number) => void;
|
|
6
|
+
export const heapBytes: () => number;
|
|
6
7
|
export const logsink_clear: (a: number) => void;
|
|
7
8
|
export const logsink_drain: (a: number) => any;
|
|
8
9
|
export const logsink_drainLines: (a: number) => [number, number];
|
|
@@ -15,10 +16,13 @@ export const renderer_attribution: (a: number) => [number, number];
|
|
|
15
16
|
export const renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
16
17
|
export const renderer_boundSources: (a: number) => [number, number];
|
|
17
18
|
export const renderer_clearSources: (a: number) => void;
|
|
19
|
+
export const renderer_memoryUsage: (a: number) => [number, number, number];
|
|
20
|
+
export const renderer_neededCodepoints: (a: number) => [number, number, number];
|
|
18
21
|
export const renderer_neededGlyphRanges: (a: number) => [number, number, number];
|
|
19
22
|
export const renderer_new: (a: number, b: number) => [number, number, number];
|
|
20
23
|
export const renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
21
24
|
export const renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
|
|
25
|
+
export const renderer_setGlyphBudget: (a: number, b: number) => void;
|
|
22
26
|
export const renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
|
|
23
27
|
export const renderer_tileSize: (a: number) => number;
|
|
24
28
|
export const simdEnabled: () => number;
|
package/simd/nodejs/ezu.d.ts
CHANGED
|
@@ -92,6 +92,57 @@ export class Renderer {
|
|
|
92
92
|
* Drop every pending source binding. Call between tile renders.
|
|
93
93
|
*/
|
|
94
94
|
clearSources(): void;
|
|
95
|
+
/**
|
|
96
|
+
* What this renderer is holding, in bytes, so a host can shed load
|
|
97
|
+
* *before* an allocation fails rather than after.
|
|
98
|
+
*
|
|
99
|
+
* Returns a JS object:
|
|
100
|
+
* - `heapBytes` — wasm linear memory committed to the **module**,
|
|
101
|
+
* shared by every `Renderer` in this instance. This is the number
|
|
102
|
+
* that meets an isolate's memory cap. It is a high-water mark:
|
|
103
|
+
* freeing Rust values returns them to the allocator, never to the
|
|
104
|
+
* host, so it only ever grows.
|
|
105
|
+
* - `glyphBytes` / `glyphRanges` — SDF bitmaps resident in the
|
|
106
|
+
* glyph bank, and how many 256-codepoint blocks they span. Glyphs
|
|
107
|
+
* accumulate for the life of the renderer and survive
|
|
108
|
+
* `clearSources`, so on a long-lived instance this is usually
|
|
109
|
+
* what grew. `glyphBudget` is the per-fontstack ceiling
|
|
110
|
+
* `setGlyphBudget` put on them, or `Infinity` if none — note
|
|
111
|
+
* `glyphBytes` totals *every* fontstack, so it can exceed the
|
|
112
|
+
* budget legitimately.
|
|
113
|
+
* - `fontBytes` — outline font files held in the font bank.
|
|
114
|
+
* - `imageBytes` — decoded pixels of bound images and sprite
|
|
115
|
+
* atlases.
|
|
116
|
+
* - `cacheBytes` / `cacheBudget` — the render cache's pixel
|
|
117
|
+
* payload against its own eviction budget; it bounds itself, so
|
|
118
|
+
* `cacheBytes` near `cacheBudget` is steady state, not a leak.
|
|
119
|
+
*
|
|
120
|
+
* These are payload sizes, not an accounting of the heap: they omit
|
|
121
|
+
* allocator overhead, decoded features, per-font glyph-path caches,
|
|
122
|
+
* and the buffers a render is using right now. Expect the parts to
|
|
123
|
+
* sum to less than `heapBytes`.
|
|
124
|
+
*/
|
|
125
|
+
memoryUsage(): object;
|
|
126
|
+
/**
|
|
127
|
+
* Codepoints the currently bound features can require, as
|
|
128
|
+
* `{ [glyphsSourceName]: number[] }` sorted ascending.
|
|
129
|
+
*
|
|
130
|
+
* This is the precise form of
|
|
131
|
+
* [`neededGlyphRanges`](Self::needed_glyph_ranges): a host that
|
|
132
|
+
* can build its own glyph PBF — one message holding just these
|
|
133
|
+
* codepoints — transfers only the glyphs the tile draws instead
|
|
134
|
+
* of the whole 256-codepoint block around each of them. On CJK
|
|
135
|
+
* labels that is the difference between a few thousand glyphs and
|
|
136
|
+
* a few tens of megabytes. `bindSource` files each glyph by its
|
|
137
|
+
* own id, so such a subset may span any number of blocks and
|
|
138
|
+
* needs no particular `range` string.
|
|
139
|
+
*
|
|
140
|
+
* Hosts that can only fetch whole `{range}.pbf` files off a
|
|
141
|
+
* MapLibre glyphs endpoint want `neededGlyphRanges` instead. Both
|
|
142
|
+
* calls see the same set of codepoints and carry the same
|
|
143
|
+
* over-approximation caveat.
|
|
144
|
+
*/
|
|
145
|
+
neededCodepoints(): object;
|
|
95
146
|
/**
|
|
96
147
|
* Glyph ranges the currently bound features can require, as
|
|
97
148
|
* `{ [glyphsSourceName]: number[] }` where each number is a range
|
|
@@ -103,6 +154,11 @@ export class Renderer {
|
|
|
103
154
|
* scraping every string in the MVT, call this after binding the
|
|
104
155
|
* vector sources and bind exactly the listed ranges.
|
|
105
156
|
*
|
|
157
|
+
* A range holds 256 codepoints and a tile typically draws a
|
|
158
|
+
* handful of them, so this is a coarse unit to fetch in. Hosts
|
|
159
|
+
* that can assemble their own subset PBF should call
|
|
160
|
+
* [`neededCodepoints`](Self::needed_codepoints) instead.
|
|
161
|
+
*
|
|
106
162
|
* It is an over-approximation, deliberately: a range is listed if
|
|
107
163
|
* *any* feature in a text layer carries the codepoint in a property
|
|
108
164
|
* the layer's `text` expression reads, without evaluating filters,
|
|
@@ -144,6 +200,31 @@ export class Renderer {
|
|
|
144
200
|
* Throws `UnknownSource` if `name` is not declared in the style.
|
|
145
201
|
*/
|
|
146
202
|
requestedNeighborOffsets(name: string): Array<any>;
|
|
203
|
+
/**
|
|
204
|
+
* Cap the glyph bytes each bound fontstack keeps resident, in
|
|
205
|
+
* bytes. Unset, a fontstack keeps every range ever bound to it for
|
|
206
|
+
* the life of the renderer — `clearSources` does not touch glyphs,
|
|
207
|
+
* and on a long-lived instance rendering across a basemap that is
|
|
208
|
+
* usually what grew.
|
|
209
|
+
*
|
|
210
|
+
* Trimming happens **after** each `renderTile`, not while binding,
|
|
211
|
+
* so a render never loses glyphs that were bound for it. The tile
|
|
212
|
+
* that just drew is therefore the most recently used, and a budget
|
|
213
|
+
* large enough for one tile's glyphs always keeps that tile's; what
|
|
214
|
+
* goes is what earlier tiles needed and this one did not. Set it
|
|
215
|
+
* below one tile's worth and the ceiling still holds — the stack
|
|
216
|
+
* empties after every render and nothing carries over, which
|
|
217
|
+
* renders correctly but buys no reuse.
|
|
218
|
+
*
|
|
219
|
+
* It is a per-fontstack ceiling: a style with a regular, a medium
|
|
220
|
+
* and an italic stack can hold three times what is set here.
|
|
221
|
+
*
|
|
222
|
+
* This host cannot refetch, so anything trimmed must be bound again
|
|
223
|
+
* before the next tile that needs it. `neededCodepoints()` already
|
|
224
|
+
* names exactly what to bind, and a host that re-binds every tile
|
|
225
|
+
* (rather than tracking what it sent) needs no other change.
|
|
226
|
+
*/
|
|
227
|
+
setGlyphBudget(bytes: number): void;
|
|
147
228
|
/**
|
|
148
229
|
* Replace the active style. Returns the new node count. Invalidates
|
|
149
230
|
* the intermediate cache and drops any pending source bindings.
|
|
@@ -161,6 +242,22 @@ export class Renderer {
|
|
|
161
242
|
readonly tileSize: number;
|
|
162
243
|
}
|
|
163
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Wasm linear memory currently committed to this module, in bytes.
|
|
247
|
+
*
|
|
248
|
+
* This is the figure an isolate's memory cap applies to, and the one
|
|
249
|
+
* to watch to shed load before an allocation fails — a refused
|
|
250
|
+
* `memory.grow` throws [`OutOfMemory`](oom) and ends the instance.
|
|
251
|
+
* It never falls: freed Rust values return to the allocator for reuse,
|
|
252
|
+
* but wasm cannot hand pages back to the host. So a drop in demand
|
|
253
|
+
* leaves the number where its peak left it, and only a fresh instance
|
|
254
|
+
* resets it.
|
|
255
|
+
*
|
|
256
|
+
* Module-wide, not per-`Renderer`. For what a given renderer is
|
|
257
|
+
* holding, and which bank to evict, call `memoryUsage()`.
|
|
258
|
+
*/
|
|
259
|
+
export function heapBytes(): number;
|
|
260
|
+
|
|
164
261
|
/**
|
|
165
262
|
* Whether the wasm binary was compiled with `+simd128`. Lets the demo
|
|
166
263
|
* page label the renderer build accurately.
|