@ifc-lite/geometry 3.6.0 → 3.7.1
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/dist/diagnostics.d.ts +20 -0
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +18 -0
- package/dist/diagnostics.js.map +1 -1
- package/dist/geometry-native.d.ts +26 -3
- package/dist/geometry-native.d.ts.map +1 -1
- package/dist/geometry-native.js +82 -11
- package/dist/geometry-native.js.map +1 -1
- package/dist/geometry-parallel.d.ts +34 -0
- package/dist/geometry-parallel.d.ts.map +1 -1
- package/dist/geometry-parallel.js +119 -52
- package/dist/geometry-parallel.js.map +1 -1
- package/dist/geometry.worker.d.ts +0 -8
- package/dist/geometry.worker.d.ts.map +1 -1
- package/dist/geometry.worker.js +33 -19
- package/dist/geometry.worker.js.map +1 -1
- package/dist/ifc-lite-bridge.d.ts +2 -0
- package/dist/ifc-lite-bridge.d.ts.map +1 -1
- package/dist/ifc-lite-bridge.js +4 -0
- package/dist/ifc-lite-bridge.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -78
- package/dist/index.js.map +1 -1
- package/dist/native-bridge-conversion.d.ts.map +1 -1
- package/dist/native-bridge-conversion.js +42 -8
- package/dist/native-bridge-conversion.js.map +1 -1
- package/dist/packed-geometry-decoder.d.ts.map +1 -1
- package/dist/packed-geometry-decoder.js +17 -0
- package/dist/packed-geometry-decoder.js.map +1 -1
- package/dist/wasm-asset-error.d.ts.map +1 -1
- package/dist/wasm-asset-error.js +6 -2
- package/dist/wasm-asset-error.js.map +1 -1
- package/dist/wasm-instance-free.d.ts +12 -0
- package/dist/wasm-instance-free.d.ts.map +1 -0
- package/dist/wasm-instance-free.js +41 -0
- package/dist/wasm-instance-free.js.map +1 -0
- package/dist/wasm-runtime-trap.d.ts.map +1 -1
- package/dist/wasm-runtime-trap.js +5 -2
- package/dist/wasm-runtime-trap.js.map +1 -1
- package/dist/wasm-shared-module.d.ts.map +1 -1
- package/dist/wasm-shared-module.js +7 -1
- package/dist/wasm-shared-module.js.map +1 -1
- package/package.json +3 -3
package/dist/diagnostics.d.ts
CHANGED
|
@@ -83,4 +83,24 @@ export interface GeometryDiagnostics {
|
|
|
83
83
|
* count, and is capped. `null` operands pass through so callers can fold a stream.
|
|
84
84
|
*/
|
|
85
85
|
export declare function mergeGeometryDiagnostics(a: GeometryDiagnostics | null | undefined, b: GeometryDiagnostics | null | undefined): GeometryDiagnostics | null;
|
|
86
|
+
/** Payload shape of the geometry worker's streaming `complete` message. */
|
|
87
|
+
export interface GeometryWorkerCompleteMessage {
|
|
88
|
+
type: 'complete';
|
|
89
|
+
totalMeshes: number;
|
|
90
|
+
/** CSG / opening diagnostics merged over this worker's batches (the
|
|
91
|
+
* GeometryDiagnostics contract). Omitted when none were recorded. */
|
|
92
|
+
diagnostics?: GeometryDiagnostics;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Build the streaming `complete` event payload (`geometry.worker.ts`'s
|
|
96
|
+
* `emitSessionEnd`, the only caller). Extracted so it can be exercised
|
|
97
|
+
* directly by tests without importing the worker module itself, which
|
|
98
|
+
* assigns `self.onmessage` at module load time and therefore cannot be
|
|
99
|
+
* imported outside a Worker/browser-like global (see diagnostics.test.ts).
|
|
100
|
+
*
|
|
101
|
+
* `diagnostics` is omitted from the returned object entirely (not sent as
|
|
102
|
+
* `undefined`) when `null` — callers gate on presence
|
|
103
|
+
* (`if (event.diagnostics)`), not just truthy counts.
|
|
104
|
+
*/
|
|
105
|
+
export declare function buildGeometryWorkerCompleteMessage(totalMeshes: number, diagnostics: GeometryDiagnostics | null): GeometryWorkerCompleteMessage;
|
|
86
106
|
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAIA;;;;;;;;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KAC/B,CAAC;IACF,qEAAqE;IACrE,UAAU,EAAE,KAAK,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B;6EACqE;QACrE,IAAI,CAAC,EAAE;YAAE,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YAAC,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;SAAE,CAAC;QACxE;6DACqD;QACrD,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;CACJ;AAKD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EACzC,CAAC,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GACxC,mBAAmB,GAAG,IAAI,CA8D5B;AAED,2EAA2E;AAC3E,MAAM,WAAW,6BAA6B;IAC5C,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB;0EACsE;IACtE,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,mBAAmB,GAAG,IAAI,GACtC,6BAA6B,CAM/B"}
|
package/dist/diagnostics.js
CHANGED
|
@@ -73,4 +73,22 @@ export function mergeGeometryDiagnostics(a, b) {
|
|
|
73
73
|
worstHosts,
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Build the streaming `complete` event payload (`geometry.worker.ts`'s
|
|
78
|
+
* `emitSessionEnd`, the only caller). Extracted so it can be exercised
|
|
79
|
+
* directly by tests without importing the worker module itself, which
|
|
80
|
+
* assigns `self.onmessage` at module load time and therefore cannot be
|
|
81
|
+
* imported outside a Worker/browser-like global (see diagnostics.test.ts).
|
|
82
|
+
*
|
|
83
|
+
* `diagnostics` is omitted from the returned object entirely (not sent as
|
|
84
|
+
* `undefined`) when `null` — callers gate on presence
|
|
85
|
+
* (`if (event.diagnostics)`), not just truthy counts.
|
|
86
|
+
*/
|
|
87
|
+
export function buildGeometryWorkerCompleteMessage(totalMeshes, diagnostics) {
|
|
88
|
+
return {
|
|
89
|
+
type: 'complete',
|
|
90
|
+
totalMeshes,
|
|
91
|
+
...(diagnostics ? { diagnostics } : {}),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
76
94
|
//# sourceMappingURL=diagnostics.js.map
|
package/dist/diagnostics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA2E/D,sFAAsF;AACtF,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,CAAyC,EACzC,CAAyC;IAEzC,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,IAAI,IAAI,CAAC;IACzB,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IAEjB,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,EAAE,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,CAAC;IAE3E,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,gBAAgB;QAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAClG,KAAK,MAAM,CAAC,IAAI,CAAC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|
32
32
|
coalescedBatchCount: number;
|
|
33
33
|
}): void;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
* path-
|
|
35
|
+
* The two behavioural axes on which the buffer-based native route
|
|
36
|
+
* (`GeometryProcessor.processStreaming`) differs from the path- and
|
|
37
|
+
* cache-based ones. Everything else about the drain loop — including the
|
|
38
|
+
* failure handling this module exists to get right — is shared.
|
|
39
|
+
*/
|
|
40
|
+
export interface NativeStreamOptions {
|
|
41
|
+
/**
|
|
42
|
+
* Apply native queue back-pressure: coalesce consecutive batch events once
|
|
43
|
+
* the queue is deep, and yield to the event loop mid-drain so the main
|
|
44
|
+
* thread keeps breathing. `processStreaming`'s native branch has always used
|
|
45
|
+
* a plain push-only queue with no mid-drain yield; pass `false` there.
|
|
46
|
+
*/
|
|
47
|
+
coalesce?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* How streamed meshes are folded into the coordinate handler. Defaults to
|
|
50
|
+
* `processTrustedMeshesIncremental` (native output is already site-local, so
|
|
51
|
+
* the generic RTC/outlier scan is skipped). `processStreaming` has always
|
|
52
|
+
* used the generic `processMeshesIncremental`, so it passes that explicitly.
|
|
53
|
+
*/
|
|
54
|
+
processMeshes?: (meshes: MeshData[]) => void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Shared native streaming generator used by every native geometry route:
|
|
58
|
+
* buffer-based (`processStreaming`), path-based and cache-based.
|
|
37
59
|
*
|
|
38
60
|
* @param startStream Callback that kicks off the native stream and
|
|
39
61
|
* returns a promise resolving when it finishes.
|
|
@@ -41,11 +63,12 @@ export declare function enqueueNativeStreamingEvent(queuedEvents: QueuedNativeSt
|
|
|
41
63
|
* @param coordinator CoordinateHandler for incremental bounds.
|
|
42
64
|
* @param setLastNativeStats Callback to persist the latest stats on
|
|
43
65
|
* the owning GeometryProcessor instance.
|
|
66
|
+
* @param options Per-route queue/coordinate behaviour; see NativeStreamOptions.
|
|
44
67
|
*/
|
|
45
68
|
export declare function streamNativeGeometry(startStream: (options: {
|
|
46
69
|
onBatch: (batch: GeometryBatch) => void;
|
|
47
70
|
onColorUpdate: (updates: Map<number, [number, number, number, number]>) => void;
|
|
48
71
|
onComplete: (stats: PlatformGeometryStats) => void;
|
|
49
72
|
onError: (error: Error) => void;
|
|
50
|
-
}) => Promise<PlatformGeometryStats>, totalEstimate: number, coordinator: CoordinateHandler, setLastNativeStats: (stats: PlatformGeometryStats) => void): AsyncGenerator<StreamingGeometryEvent>;
|
|
73
|
+
}) => Promise<PlatformGeometryStats>, totalEstimate: number, coordinator: CoordinateHandler, setLastNativeStats: (stats: PlatformGeometryStats) => void, options?: NativeStreamOptions): AsyncGenerator<StreamingGeometryEvent>;
|
|
51
74
|
//# sourceMappingURL=geometry-native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-native.d.ts","sourceRoot":"","sources":["../src/geometry-native.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,IAAI,qBAAqB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACxH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAKzD,eAAO,MAAM,8BAA8B,IAAI,CAAC;AAChD,eAAO,MAAM,8BAA8B,QAAQ,CAAC;AACpD,eAAO,MAAM,iCAAiC,IAAI,CAAC;AACnD,eAAO,MAAM,iCAAiC,OAAO,CAAC;AACtD,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAI7C,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;IAAC,eAAe,CAAC,EAAE,oBAAoB,CAAA;CAAE,GAC7E;IAAE,IAAI,EAAE,aA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M,CAAC,CAAC,CAAA;CAAE,CAAC;AAIpF,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAUhD;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,0BAA0B,EAAE,EAC1C,KAAK,EAAE,0BAA0B,EACjC,UAAU,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GAChE,IAAI,CA6BN;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CAC9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAuB,oBAAoB,CACzC,WAAW,EAAE,CAAC,OAAO,EAAE;IACrB,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,aAAa,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,CAAC;IAChF,UAAU,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACnD,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACjC,KAAK,OAAO,CAAC,qBAAqB,CAAC,EACpC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,iBAAiB,EAC9B,kBAAkB,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,EAC1D,OAAO,GAAE,mBAAwB,GAChC,cAAc,CAAC,sBAAsB,CAAC,CAsMxC"}
|
package/dist/geometry-native.js
CHANGED
|
@@ -49,8 +49,8 @@ export function enqueueNativeStreamingEvent(queuedEvents, event, queueState) {
|
|
|
49
49
|
queueState.queuedMeshes += event.meshes.length;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Shared native streaming generator used by
|
|
53
|
-
* path-based
|
|
52
|
+
* Shared native streaming generator used by every native geometry route:
|
|
53
|
+
* buffer-based (`processStreaming`), path-based and cache-based.
|
|
54
54
|
*
|
|
55
55
|
* @param startStream Callback that kicks off the native stream and
|
|
56
56
|
* returns a promise resolving when it finishes.
|
|
@@ -58,8 +58,11 @@ export function enqueueNativeStreamingEvent(queuedEvents, event, queueState) {
|
|
|
58
58
|
* @param coordinator CoordinateHandler for incremental bounds.
|
|
59
59
|
* @param setLastNativeStats Callback to persist the latest stats on
|
|
60
60
|
* the owning GeometryProcessor instance.
|
|
61
|
+
* @param options Per-route queue/coordinate behaviour; see NativeStreamOptions.
|
|
61
62
|
*/
|
|
62
|
-
export async function* streamNativeGeometry(startStream, totalEstimate, coordinator, setLastNativeStats) {
|
|
63
|
+
export async function* streamNativeGeometry(startStream, totalEstimate, coordinator, setLastNativeStats, options = {}) {
|
|
64
|
+
const coalesce = options.coalesce !== false;
|
|
65
|
+
const processMeshes = options.processMeshes ?? ((meshes) => coordinator.processTrustedMeshesIncremental(meshes));
|
|
63
66
|
coordinator.reset();
|
|
64
67
|
yield { type: 'start', totalEstimate };
|
|
65
68
|
await yieldToEventLoop();
|
|
@@ -78,13 +81,21 @@ export async function* streamNativeGeometry(startStream, totalEstimate, coordina
|
|
|
78
81
|
resolvePending = null;
|
|
79
82
|
}
|
|
80
83
|
};
|
|
84
|
+
const enqueue = (event) => {
|
|
85
|
+
if (coalesce) {
|
|
86
|
+
enqueueNativeStreamingEvent(queuedEvents, event, queueState);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
queuedEvents.push(event);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
81
92
|
const streamingPromise = startStream({
|
|
82
93
|
onBatch: (batch) => {
|
|
83
|
-
|
|
94
|
+
enqueue({ type: 'batch', meshes: batch.meshes, nativeTelemetry: batch.nativeTelemetry });
|
|
84
95
|
wake();
|
|
85
96
|
},
|
|
86
97
|
onColorUpdate: (updates) => {
|
|
87
|
-
|
|
98
|
+
enqueue({ type: 'colorUpdate', updates: new Map(updates) });
|
|
88
99
|
wake();
|
|
89
100
|
},
|
|
90
101
|
onComplete: (stats) => {
|
|
@@ -100,6 +111,35 @@ export async function* streamNativeGeometry(startStream, totalEstimate, coordina
|
|
|
100
111
|
wake();
|
|
101
112
|
},
|
|
102
113
|
});
|
|
114
|
+
// A `startStream` rejection that never reached `onError` used to strand this
|
|
115
|
+
// generator: `completed` stays false, so the drain loop parks on the wake
|
|
116
|
+
// promise below and nothing ever resolves it — the load hangs forever and the
|
|
117
|
+
// failure surfaces only as an unhandled rejection. That is reachable today,
|
|
118
|
+
// because the bridge only routes throws through `onError` from inside its own
|
|
119
|
+
// try/catch: `NativeBridge.processGeometryStreamingPath` has none at all (the
|
|
120
|
+
// missing-cache-key throw, and every failure of the packed-shard stream it
|
|
121
|
+
// delegates to — including the Rust-reported `failed` status and the 60 s
|
|
122
|
+
// stall guard — reject straight out), and its siblings can still reject from
|
|
123
|
+
// the `init()` / `listen()` calls that precede their try. Treat a rejected
|
|
124
|
+
// stream promise as a stream error so the caller sees the real message.
|
|
125
|
+
//
|
|
126
|
+
// Only while the stream is still running, though. A rejection that arrives
|
|
127
|
+
// AFTER `onComplete`/`onError` has settled the stream is teardown fallout,
|
|
128
|
+
// not the load's outcome: `NativeBridge.processGeometryStreaming` runs its
|
|
129
|
+
// three `unlisten()` calls in a `finally`, which executes after `onComplete`,
|
|
130
|
+
// so a throwing `unlisten` rejects the promise of a load that fully
|
|
131
|
+
// succeeded. Failing it here would discard every mesh already delivered.
|
|
132
|
+
// Post-completion rejections are logged by the `finally` below instead.
|
|
133
|
+
void streamingPromise.catch((error) => {
|
|
134
|
+
if (completed)
|
|
135
|
+
return;
|
|
136
|
+
// `??=` rather than `=`: `onError` sets `streamError` and `completed`
|
|
137
|
+
// together, so the guard above already covers it, but this keeps the
|
|
138
|
+
// "never shadow a richer onError message" property local to the assignment.
|
|
139
|
+
streamError ??= error instanceof Error ? error : new Error(String(error));
|
|
140
|
+
completed = true;
|
|
141
|
+
wake();
|
|
142
|
+
});
|
|
103
143
|
try {
|
|
104
144
|
while (!completed || queuedEvents.length > 0) {
|
|
105
145
|
let drainedEventCount = 0;
|
|
@@ -112,9 +152,7 @@ export async function* streamNativeGeometry(startStream, totalEstimate, coordina
|
|
|
112
152
|
continue;
|
|
113
153
|
}
|
|
114
154
|
queueState.queuedMeshes = Math.max(0, queueState.queuedMeshes - event.meshes.length);
|
|
115
|
-
|
|
116
|
-
// avoid the generic JS RTC/outlier scan on every streamed batch.
|
|
117
|
-
coordinator.processTrustedMeshesIncremental(event.meshes);
|
|
155
|
+
processMeshes(event.meshes);
|
|
118
156
|
totalMeshes += event.meshes.length;
|
|
119
157
|
const coordinateInfo = coordinator.getCurrentCoordinateInfo();
|
|
120
158
|
yield {
|
|
@@ -126,7 +164,7 @@ export async function* streamNativeGeometry(startStream, totalEstimate, coordina
|
|
|
126
164
|
};
|
|
127
165
|
drainedEventCount += 1;
|
|
128
166
|
drainedMeshCount += event.meshes.length;
|
|
129
|
-
if (queuedEvents.length > 0) {
|
|
167
|
+
if (coalesce && queuedEvents.length > 0) {
|
|
130
168
|
const shouldYield = drainedEventCount >= MAX_NATIVE_STREAM_EVENTS_PER_TURN ||
|
|
131
169
|
drainedMeshCount >= MAX_NATIVE_STREAM_MESHES_PER_TURN ||
|
|
132
170
|
performance.now() - drainStartedAt >= MAX_NATIVE_STREAM_DRAIN_MS;
|
|
@@ -147,6 +185,14 @@ export async function* streamNativeGeometry(startStream, totalEstimate, coordina
|
|
|
147
185
|
});
|
|
148
186
|
}
|
|
149
187
|
}
|
|
188
|
+
// The in-loop check above only runs while the loop still has a reason to
|
|
189
|
+
// spin. `onError` sets `completed` AND leaves the queue empty, so the wake
|
|
190
|
+
// it triggers falls straight out of the loop past that check — and this
|
|
191
|
+
// generator then reported `complete` for a stream that failed. Re-check on
|
|
192
|
+
// the way out so the error reaches the caller.
|
|
193
|
+
if (streamError) {
|
|
194
|
+
throw streamError;
|
|
195
|
+
}
|
|
150
196
|
}
|
|
151
197
|
finally {
|
|
152
198
|
// Ensure the native stream and its Tauri listeners are torn down
|
|
@@ -155,10 +201,35 @@ export async function* streamNativeGeometry(startStream, totalEstimate, coordina
|
|
|
155
201
|
try {
|
|
156
202
|
await streamingPromise;
|
|
157
203
|
}
|
|
158
|
-
catch {
|
|
159
|
-
|
|
204
|
+
catch (err) {
|
|
205
|
+
// Two ways to land here, neither of which the caller learns anything new
|
|
206
|
+
// from: the rejection arrived while the stream was still running, in which
|
|
207
|
+
// case the handler above already recorded it as `streamError` and the
|
|
208
|
+
// drain loop threw it — this is the same error a second time; or it
|
|
209
|
+
// arrived after the stream had already completed, in which case it is
|
|
210
|
+
// teardown fallout that must NOT retro-fail a finished load. Debug level,
|
|
211
|
+
// because this is the only place that kind is reported at all — a real
|
|
212
|
+
// failure reported through `onError` (rather than only this bare
|
|
213
|
+
// rejection) is not swallowed here: it sets `streamError` unconditionally
|
|
214
|
+
// and the recheck right after this `finally` still throws it below.
|
|
215
|
+
console.debug('[GeometryProcessor] native stream teardown rejected:', err);
|
|
160
216
|
}
|
|
161
217
|
}
|
|
218
|
+
// Defense in depth, matching the shape of the two exit-guard checks above:
|
|
219
|
+
// `onError` is never gated on `completed` — a bridge that reports a genuine
|
|
220
|
+
// failure must win regardless of when that report arrives — so it can still
|
|
221
|
+
// fire after both of those checks already ran clean (streamError was null
|
|
222
|
+
// at both), while this generator sits in the `finally` above awaiting
|
|
223
|
+
// `streamingPromise`. Nothing rechecked `streamError` after that point, so
|
|
224
|
+
// a failure signalled that late was recorded and then never read: the
|
|
225
|
+
// caller got `complete` for a stream that, per its own `onError` call,
|
|
226
|
+
// failed. This does NOT reopen the post-complete teardown case just above —
|
|
227
|
+
// a rejection that only ever reaches the detached `.catch()` (never
|
|
228
|
+
// `onError`) is still gated on `!completed` there and leaves `streamError`
|
|
229
|
+
// null, so that case still falls through to `complete` unchanged.
|
|
230
|
+
if (streamError) {
|
|
231
|
+
throw streamError;
|
|
232
|
+
}
|
|
162
233
|
if (queueState.coalescedBatchCount > 0) {
|
|
163
234
|
console.info(`[GeometryProcessor] Coalesced ${queueState.coalescedBatchCount} native batches while JS drained the queue`);
|
|
164
235
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-native.js","sourceRoot":"","sources":["../src/geometry-native.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAgB/D,+BAA+B;AAE/B,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,CAAC;AACpD,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,CAAC;AACtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAQ7C,gBAAgB;AAEhB,MAAM,UAAU,gBAAgB;IAC9B,MAAM,cAAc,GAAI,UAEtB,CAAC,SAAS,CAAC;IACb,IAAI,OAAO,cAAc,EAAE,KAAK,KAAK,UAAU,EAAE,CAAC;QAChD,OAAO,cAAc,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CACzC,YAA0C,EAC1C,KAAiC,EACjC,UAAiE;IAEjE,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACxD,IAAI,SAAS,EAAE,IAAI,KAAK,aAAa,EAAE,CAAC;YACtC,KAA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,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;AACJ,CAAC"}
|
|
@@ -23,6 +23,40 @@ import type { CoordinateHandler } from './coordinate-handler.js';
|
|
|
23
23
|
import type { TessellationQuality } from './types.js';
|
|
24
24
|
import type { StreamingGeometryEvent } from './index.js';
|
|
25
25
|
import type { BatchSizingConfig } from './batch-sizing.js';
|
|
26
|
+
/**
|
|
27
|
+
* Prepass class-byte layout, mirroring the `PREPASS_CLASS_*` definitions in
|
|
28
|
+
* `rust/processing/src/shard_classes.rs` (the source of truth — these are
|
|
29
|
+
* pinned to it by `prepass-class-spans.test.ts`).
|
|
30
|
+
*
|
|
31
|
+
* The producer packs a named code in the LOW bits and composes FLAG bits on
|
|
32
|
+
* top (`PREPASS_CLASS_FLAG_GEOMETRY_JOB` 0x80, `..._FLAG_TYPE_CANDIDATE`
|
|
33
|
+
* 0x40), so a consumer must mask before comparing — the Rust consumer does
|
|
34
|
+
* (`gpu_meshes/prepass_discovery.rs`), and so does {@link extractPrepassSpanLists}.
|
|
35
|
+
*/
|
|
36
|
+
export declare const PREPASS_CLASS_CODE_MASK = 63;
|
|
37
|
+
/** `IFCSTYLEDITEM`. */
|
|
38
|
+
export declare const PREPASS_CLASS_STYLED_ITEM = 4;
|
|
39
|
+
/** `IFCINDEXEDCOLOURMAP`. */
|
|
40
|
+
export declare const PREPASS_CLASS_INDEXED_COLOUR_MAP = 5;
|
|
41
|
+
/** `IFCMATERIALDEFINITIONREPRESENTATION`. */
|
|
42
|
+
export declare const PREPASS_CLASS_MATERIAL_DEF_REPR = 6;
|
|
43
|
+
/** `IFCRELASSOCIATESMATERIAL`. */
|
|
44
|
+
export declare const PREPASS_CLASS_REL_ASSOCIATES_MATERIAL = 7;
|
|
45
|
+
/** `IFCRELVOIDSELEMENT`. */
|
|
46
|
+
export declare const PREPASS_CLASS_REL_VOIDS = 8;
|
|
47
|
+
/** `IFCRELFILLSELEMENT`. */
|
|
48
|
+
export declare const PREPASS_CLASS_REL_FILLS = 9;
|
|
49
|
+
/** `IFCRELAGGREGATES`. */
|
|
50
|
+
export declare const PREPASS_CLASS_REL_AGGREGATES = 10;
|
|
51
|
+
/**
|
|
52
|
+
* Build one `(id, start, length)` span list per host-consumed prepass class
|
|
53
|
+
* from the stitched shard columns, in FILE ORDER. Every comparison goes
|
|
54
|
+
* through {@link PREPASS_CLASS_CODE_MASK}, so a record that carries a flag bit
|
|
55
|
+
* alongside its named code still lands in its list instead of being dropped.
|
|
56
|
+
* Returns exact-size arrays (one entry per class in `HOST_SPAN_CLASSES`,
|
|
57
|
+
* empty when the file has none).
|
|
58
|
+
*/
|
|
59
|
+
export declare function extractPrepassSpanLists(classes: Uint8Array, ids: Uint32Array, starts: Uint32Array, lengths: Uint32Array): Map<number, Uint32Array>;
|
|
26
60
|
/**
|
|
27
61
|
* Plan content-affinity routing for one chunk: assign each job (by index) to a
|
|
28
62
|
* worker bucket so that every job sharing an affinity key lands on the SAME
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-parallel.d.ts","sourceRoot":"","sources":["../src/geometry-parallel.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAY,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAO3D;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,WAAW,EAAE,MAAM,GAClB;IAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAA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able, notifyIfWorkerScriptUnavailable } from '.
|
|
|
8
8
|
// `IfcLiteBridge.init()` path can reuse whatever this pool already compiled
|
|
9
9
|
// (and vice versa) instead of fetching the same binary a second time.
|
|
10
10
|
import { compileSharedWasmModule } from './wasm-shared-module.js';
|
|
11
|
+
/**
|
|
12
|
+
* Prepass class-byte layout, mirroring the `PREPASS_CLASS_*` definitions in
|
|
13
|
+
* `rust/processing/src/shard_classes.rs` (the source of truth — these are
|
|
14
|
+
* pinned to it by `prepass-class-spans.test.ts`).
|
|
15
|
+
*
|
|
16
|
+
* The producer packs a named code in the LOW bits and composes FLAG bits on
|
|
17
|
+
* top (`PREPASS_CLASS_FLAG_GEOMETRY_JOB` 0x80, `..._FLAG_TYPE_CANDIDATE`
|
|
18
|
+
* 0x40), so a consumer must mask before comparing — the Rust consumer does
|
|
19
|
+
* (`gpu_meshes/prepass_discovery.rs`), and so does {@link extractPrepassSpanLists}.
|
|
20
|
+
*/
|
|
21
|
+
export const PREPASS_CLASS_CODE_MASK = 0x3f;
|
|
22
|
+
/** `IFCSTYLEDITEM`. */
|
|
23
|
+
export const PREPASS_CLASS_STYLED_ITEM = 4;
|
|
24
|
+
/** `IFCINDEXEDCOLOURMAP`. */
|
|
25
|
+
export const PREPASS_CLASS_INDEXED_COLOUR_MAP = 5;
|
|
26
|
+
/** `IFCMATERIALDEFINITIONREPRESENTATION`. */
|
|
27
|
+
export const PREPASS_CLASS_MATERIAL_DEF_REPR = 6;
|
|
28
|
+
/** `IFCRELASSOCIATESMATERIAL`. */
|
|
29
|
+
export const PREPASS_CLASS_REL_ASSOCIATES_MATERIAL = 7;
|
|
30
|
+
/** `IFCRELVOIDSELEMENT`. */
|
|
31
|
+
export const PREPASS_CLASS_REL_VOIDS = 8;
|
|
32
|
+
/** `IFCRELFILLSELEMENT`. */
|
|
33
|
+
export const PREPASS_CLASS_REL_FILLS = 9;
|
|
34
|
+
/** `IFCRELAGGREGATES`. */
|
|
35
|
+
export const PREPASS_CLASS_REL_AGGREGATES = 10;
|
|
36
|
+
/** The classes the host builds span lists for (every other code is ignored). */
|
|
37
|
+
const HOST_SPAN_CLASSES = [
|
|
38
|
+
PREPASS_CLASS_STYLED_ITEM,
|
|
39
|
+
PREPASS_CLASS_INDEXED_COLOUR_MAP,
|
|
40
|
+
PREPASS_CLASS_MATERIAL_DEF_REPR,
|
|
41
|
+
PREPASS_CLASS_REL_ASSOCIATES_MATERIAL,
|
|
42
|
+
PREPASS_CLASS_REL_VOIDS,
|
|
43
|
+
PREPASS_CLASS_REL_FILLS,
|
|
44
|
+
PREPASS_CLASS_REL_AGGREGATES,
|
|
45
|
+
];
|
|
46
|
+
/**
|
|
47
|
+
* Build one `(id, start, length)` span list per host-consumed prepass class
|
|
48
|
+
* from the stitched shard columns, in FILE ORDER. Every comparison goes
|
|
49
|
+
* through {@link PREPASS_CLASS_CODE_MASK}, so a record that carries a flag bit
|
|
50
|
+
* alongside its named code still lands in its list instead of being dropped.
|
|
51
|
+
* Returns exact-size arrays (one entry per class in `HOST_SPAN_CLASSES`,
|
|
52
|
+
* empty when the file has none).
|
|
53
|
+
*/
|
|
54
|
+
export function extractPrepassSpanLists(classes, ids, starts, lengths) {
|
|
55
|
+
// Sized by the code mask rather than by the highest class the host consumes:
|
|
56
|
+
// a masked code is always < 64, so a class added on the Rust side cannot
|
|
57
|
+
// write out of bounds here (typed arrays discard such writes silently).
|
|
58
|
+
const counts = new Uint32Array(PREPASS_CLASS_CODE_MASK + 1);
|
|
59
|
+
for (let i = 0; i < classes.length; i++)
|
|
60
|
+
counts[classes[i] & PREPASS_CLASS_CODE_MASK]++;
|
|
61
|
+
const slots = new Map();
|
|
62
|
+
for (const k of HOST_SPAN_CLASSES)
|
|
63
|
+
slots.set(k, { arr: new Uint32Array(counts[k] * 3), w: 0 });
|
|
64
|
+
for (let i = 0; i < classes.length; i++) {
|
|
65
|
+
const slot = slots.get(classes[i] & PREPASS_CLASS_CODE_MASK);
|
|
66
|
+
if (!slot)
|
|
67
|
+
continue;
|
|
68
|
+
slot.arr[slot.w] = ids[i];
|
|
69
|
+
slot.arr[slot.w + 1] = starts[i];
|
|
70
|
+
slot.arr[slot.w + 2] = lengths[i];
|
|
71
|
+
slot.w += 3;
|
|
72
|
+
}
|
|
73
|
+
const spans = new Map();
|
|
74
|
+
for (const [k, slot] of slots)
|
|
75
|
+
spans.set(k, slot.arr);
|
|
76
|
+
return spans;
|
|
77
|
+
}
|
|
11
78
|
/**
|
|
12
79
|
* Plan content-affinity routing for one chunk: assign each job (by index) to a
|
|
13
80
|
* worker bucket so that every job sharing an affinity key lands on the SAME
|
|
@@ -70,6 +137,26 @@ function readShardScanFlag() {
|
|
|
70
137
|
return false;
|
|
71
138
|
return true;
|
|
72
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Terminate a pool worker on a teardown path that is already unwinding.
|
|
142
|
+
*
|
|
143
|
+
* `Worker.terminate()` is specified never to throw, and is a no-op on a worker
|
|
144
|
+
* that is already gone — so every one of these teardown calls is expected to
|
|
145
|
+
* succeed and a throw means something unexpected about the host, not a
|
|
146
|
+
* double-terminate. Worth one line; never worth failing a teardown that runs
|
|
147
|
+
* while a real error is on its way to the caller.
|
|
148
|
+
*
|
|
149
|
+
* Bounded by construction: each caller terminates the pool once and then
|
|
150
|
+
* throws, returns, or leaves the generator.
|
|
151
|
+
*/
|
|
152
|
+
function terminateWorkerQuietly(worker, label) {
|
|
153
|
+
try {
|
|
154
|
+
worker.terminate();
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
console.warn(`[stream] ${label} terminate failed:`, err);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
73
160
|
/**
|
|
74
161
|
* SPIKE: stitch N speculative shard scans into the full entity index —
|
|
75
162
|
* byte-identical to the single-threaded scan. Port of the native
|
|
@@ -531,7 +618,23 @@ existingSab, options) {
|
|
|
531
618
|
try {
|
|
532
619
|
w.postMessage({ type: 'stream-end' });
|
|
533
620
|
}
|
|
534
|
-
catch {
|
|
621
|
+
catch (err) {
|
|
622
|
+
// A structured-clonable payload posted to a terminated worker is a
|
|
623
|
+
// no-op, not a throw — so this means the port is in a state we did
|
|
624
|
+
// not expect. That worker will never flush its tail: `complete` is
|
|
625
|
+
// posted ONLY from `emitSessionEnd` in geometry.worker.js, which
|
|
626
|
+
// fires ONLY in response to `stream-end`. The drain loop below waits
|
|
627
|
+
// for a `complete` from every worker (`workersCompleted >=
|
|
628
|
+
// workers.length`), so leaving this as a log would make the load
|
|
629
|
+
// hang forever instead of failing loudly — the same "swallowed
|
|
630
|
+
// failure" shape as the fixes already on this branch, just a stall
|
|
631
|
+
// instead of a false success. Surface it as a load error and
|
|
632
|
+
// terminate the unreachable worker so it isn't left dangling.
|
|
633
|
+
console.warn('[stream] stream-end postMessage failed; failing the load instead of hanging on that worker:', err);
|
|
634
|
+
workerError = workerError ?? new Error(`Geometry worker failed: stream-end could not be delivered (${err instanceof Error ? err.message : String(err)})`);
|
|
635
|
+
terminateWorkerQuietly(w, 'process worker');
|
|
636
|
+
wake();
|
|
637
|
+
}
|
|
535
638
|
}
|
|
536
639
|
};
|
|
537
640
|
const sendStreamStartIfReady = () => {
|
|
@@ -789,35 +892,17 @@ existingSab, options) {
|
|
|
789
892
|
// stitched columns, split into one contiguous slice per worker, and
|
|
790
893
|
// resolve them in parallel while everyone waits on the pre-pass scan.
|
|
791
894
|
const classes = stitched.classes;
|
|
792
|
-
|
|
793
|
-
// 6 material def repr, 7 rel-associates-material, 8 voids, 9 fills,
|
|
794
|
-
// 10 aggregates. Extract each list in FILE ORDER.
|
|
795
|
-
const counts = new Uint32Array(11);
|
|
796
|
-
for (let i = 0; i < classes.length; i++)
|
|
797
|
-
counts[classes[i]]++;
|
|
798
|
-
const kinds = [4, 5, 6, 7, 8, 9, 10];
|
|
799
|
-
const spanLists = new Map();
|
|
800
|
-
for (const k of kinds)
|
|
801
|
-
spanLists.set(k, { arr: new Uint32Array(counts[k] * 3), w: 0 });
|
|
802
|
-
for (let i = 0; i < classes.length; i++) {
|
|
803
|
-
const slot = spanLists.get(classes[i]);
|
|
804
|
-
if (!slot)
|
|
805
|
-
continue;
|
|
806
|
-
slot.arr[slot.w] = ids[i];
|
|
807
|
-
slot.arr[slot.w + 1] = starts[i];
|
|
808
|
-
slot.arr[slot.w + 2] = lengths[i];
|
|
809
|
-
slot.w += 3;
|
|
810
|
-
}
|
|
895
|
+
const spanLists = extractPrepassSpanLists(classes, ids, starts, lengths);
|
|
811
896
|
supportSpans = {
|
|
812
|
-
colourMapSpans: spanLists.get(
|
|
813
|
-
materialDefSpans: spanLists.get(
|
|
814
|
-
relMaterialSpans: spanLists.get(
|
|
815
|
-
voidSpans: spanLists.get(
|
|
816
|
-
fillsSpans: spanLists.get(
|
|
817
|
-
aggregateSpans: spanLists.get(
|
|
897
|
+
colourMapSpans: spanLists.get(PREPASS_CLASS_INDEXED_COLOUR_MAP),
|
|
898
|
+
materialDefSpans: spanLists.get(PREPASS_CLASS_MATERIAL_DEF_REPR),
|
|
899
|
+
relMaterialSpans: spanLists.get(PREPASS_CLASS_REL_ASSOCIATES_MATERIAL),
|
|
900
|
+
voidSpans: spanLists.get(PREPASS_CLASS_REL_VOIDS),
|
|
901
|
+
fillsSpans: spanLists.get(PREPASS_CLASS_REL_FILLS),
|
|
902
|
+
aggregateSpans: spanLists.get(PREPASS_CLASS_REL_AGGREGATES),
|
|
818
903
|
};
|
|
819
|
-
const
|
|
820
|
-
const
|
|
904
|
+
const styledSpans = spanLists.get(PREPASS_CLASS_STYLED_ITEM);
|
|
905
|
+
const styledCount = styledSpans.length / 3;
|
|
821
906
|
// 2 slices per worker (round-robin): the tail is set by the SLOWEST
|
|
822
907
|
// worker, and macOS occasionally schedules one onto a slow core — halving
|
|
823
908
|
// the slice size halves the damage a slow core can do to the tail.
|
|
@@ -1288,23 +1373,14 @@ existingSab, options) {
|
|
|
1288
1373
|
}
|
|
1289
1374
|
if (workerError) {
|
|
1290
1375
|
for (const w of workers) {
|
|
1291
|
-
|
|
1292
|
-
w.terminate();
|
|
1293
|
-
}
|
|
1294
|
-
catch { /* cleanup — safe to ignore */ }
|
|
1295
|
-
}
|
|
1296
|
-
try {
|
|
1297
|
-
prepassWorker.terminate();
|
|
1376
|
+
terminateWorkerQuietly(w, 'process worker');
|
|
1298
1377
|
}
|
|
1299
|
-
|
|
1378
|
+
terminateWorkerQuietly(prepassWorker, 'pre-pass worker');
|
|
1300
1379
|
throw workerError;
|
|
1301
1380
|
}
|
|
1302
1381
|
if (prepassError) {
|
|
1303
1382
|
for (const w of workers) {
|
|
1304
|
-
|
|
1305
|
-
w.terminate();
|
|
1306
|
-
}
|
|
1307
|
-
catch { /* cleanup — safe to ignore */ }
|
|
1383
|
+
terminateWorkerQuietly(w, 'process worker');
|
|
1308
1384
|
}
|
|
1309
1385
|
throw prepassError;
|
|
1310
1386
|
}
|
|
@@ -1315,10 +1391,7 @@ existingSab, options) {
|
|
|
1315
1391
|
// explicit terminate to exit.
|
|
1316
1392
|
if (prepassDone && !streamStartSentToWorkers && prepassJobsTotal === 0) {
|
|
1317
1393
|
for (const w of workers) {
|
|
1318
|
-
|
|
1319
|
-
w.terminate();
|
|
1320
|
-
}
|
|
1321
|
-
catch { /* cleanup — safe to ignore */ }
|
|
1394
|
+
terminateWorkerQuietly(w, 'process worker');
|
|
1322
1395
|
}
|
|
1323
1396
|
const coordinateInfo = coordinator.getFinalCoordinateInfo();
|
|
1324
1397
|
yield { type: 'complete', totalMeshes: 0, coordinateInfo };
|
|
@@ -1353,15 +1426,9 @@ existingSab, options) {
|
|
|
1353
1426
|
}
|
|
1354
1427
|
finally {
|
|
1355
1428
|
for (const w of workers) {
|
|
1356
|
-
|
|
1357
|
-
w.terminate();
|
|
1358
|
-
}
|
|
1359
|
-
catch { /* cleanup — safe to ignore */ }
|
|
1360
|
-
}
|
|
1361
|
-
try {
|
|
1362
|
-
prepassWorker.terminate();
|
|
1429
|
+
terminateWorkerQuietly(w, 'process worker');
|
|
1363
1430
|
}
|
|
1364
|
-
|
|
1431
|
+
terminateWorkerQuietly(prepassWorker, 'pre-pass worker');
|
|
1365
1432
|
}
|
|
1366
1433
|
}
|
|
1367
1434
|
//# sourceMappingURL=geometry-parallel.js.map
|