@openheart/tavio-renderer 2.2.9-without-wasm → 2.2.10-without-wasm
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/esm/wasm/pkg/no-thread/package.json +18 -0
- package/build/esm/wasm/pkg/no-thread/tavio.d.ts +106 -0
- package/build/esm/wasm/pkg/no-thread/tavio.js +933 -0
- package/build/esm/wasm/pkg/no-thread/tavio_bg.wasm +0 -0
- package/build/esm/wasm/pkg/no-thread/tavio_bg.wasm.d.ts +28 -0
- package/build/esm/wasm/pkg/thread/package.json +18 -0
- package/build/esm/wasm/pkg/thread/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js +107 -0
- package/build/esm/wasm/pkg/thread/tavio.d.ts +128 -0
- package/build/esm/wasm/pkg/thread/tavio.js +1081 -0
- package/build/esm/wasm/pkg/thread/tavio_bg.wasm +0 -0
- package/build/esm/wasm/pkg/thread/tavio_bg.wasm.d.ts +35 -0
- package/package.json +1 -1
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const decodeTavio: (a: number, b: number, c: number) => number;
|
|
5
|
+
export const main: () => void;
|
|
6
|
+
export const registerEventHandler: (a: number) => number;
|
|
7
|
+
export const sort: (a: number, b: number, c: number) => number;
|
|
8
|
+
export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
9
|
+
export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
10
|
+
export const intounderlyingbytesource_cancel: (a: number) => void;
|
|
11
|
+
export const intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
12
|
+
export const intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
13
|
+
export const intounderlyingbytesource_type: (a: number) => number;
|
|
14
|
+
export const __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
15
|
+
export const intounderlyingsink_abort: (a: number, b: number) => number;
|
|
16
|
+
export const intounderlyingsink_close: (a: number) => number;
|
|
17
|
+
export const intounderlyingsink_write: (a: number, b: number) => number;
|
|
18
|
+
export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
19
|
+
export const intounderlyingsource_cancel: (a: number) => void;
|
|
20
|
+
export const intounderlyingsource_pull: (a: number, b: number) => number;
|
|
21
|
+
export const __wasm_bindgen_func_elem_720: (a: number, b: number) => void;
|
|
22
|
+
export const __wasm_bindgen_func_elem_1266: (a: number, b: number, c: number, d: number) => void;
|
|
23
|
+
export const __wasm_bindgen_func_elem_721: (a: number, b: number, c: number) => void;
|
|
24
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
25
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
26
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
27
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
28
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bindings-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"hnd <honda@softdevice.co.jp>"
|
|
6
|
+
],
|
|
7
|
+
"version": "0.1.0",
|
|
8
|
+
"files": [
|
|
9
|
+
"tavio_bg.wasm",
|
|
10
|
+
"tavio.js",
|
|
11
|
+
"tavio.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"main": "tavio.js",
|
|
14
|
+
"types": "tavio.d.ts",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"./snippets/*"
|
|
17
|
+
]
|
|
18
|
+
}
|
package/build/esm/wasm/pkg/thread/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 Google Inc. All Rights Reserved.
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
+
* See the License for the specific language governing permissions and
|
|
11
|
+
* limitations under the License.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// Note: we use `wasm_bindgen_worker_`-prefixed message types to make sure
|
|
15
|
+
// we can handle bundling into other files, which might happen to have their
|
|
16
|
+
// own `postMessage`/`onmessage` communication channels.
|
|
17
|
+
//
|
|
18
|
+
// If we didn't take that into the account, we could send much simpler signals
|
|
19
|
+
// like just `0` or whatever, but the code would be less resilient.
|
|
20
|
+
|
|
21
|
+
function waitForMsgType(target, type) {
|
|
22
|
+
return new Promise(resolve => {
|
|
23
|
+
target.addEventListener('message', function onMsg({ data }) {
|
|
24
|
+
if (data?.type !== type) return;
|
|
25
|
+
target.removeEventListener('message', onMsg);
|
|
26
|
+
resolve(data);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
waitForMsgType(self, 'wasm_bindgen_worker_init').then(async ({ init, receiver }) => {
|
|
32
|
+
// # Note 1
|
|
33
|
+
// Our JS should have been generated in
|
|
34
|
+
// `[out-dir]/snippets/wasm-bindgen-rayon-[hash]/workerHelpers.js`,
|
|
35
|
+
// resolve the main module via `../../..`.
|
|
36
|
+
//
|
|
37
|
+
// This might need updating if the generated structure changes on wasm-bindgen
|
|
38
|
+
// side ever in the future, but works well with bundlers today. The whole
|
|
39
|
+
// point of this crate, after all, is to abstract away unstable features
|
|
40
|
+
// and temporary bugs so that you don't need to deal with them in your code.
|
|
41
|
+
//
|
|
42
|
+
// # Note 2
|
|
43
|
+
// This could be a regular import, but then some bundlers complain about
|
|
44
|
+
// circular deps.
|
|
45
|
+
//
|
|
46
|
+
// Dynamic import could be cheap if this file was inlined into the parent,
|
|
47
|
+
// which would require us just using `../../..` in `new Worker` below,
|
|
48
|
+
// but that doesn't work because wasm-pack unconditionally adds
|
|
49
|
+
// "sideEffects":false (see below).
|
|
50
|
+
//
|
|
51
|
+
// OTOH, even though it can't be inlined, it should be still reasonably
|
|
52
|
+
// cheap since the requested file is already in cache (it was loaded by
|
|
53
|
+
// the main thread).
|
|
54
|
+
const pkg = await import('../../..');
|
|
55
|
+
await pkg.default(init);
|
|
56
|
+
postMessage({ type: 'wasm_bindgen_worker_ready' });
|
|
57
|
+
pkg.wbg_rayon_start_worker(receiver);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Note: this is never used, but necessary to prevent a bug in Firefox
|
|
61
|
+
// (https://bugzilla.mozilla.org/show_bug.cgi?id=1702191) where it collects
|
|
62
|
+
// Web Workers that have a shared WebAssembly memory with the main thread,
|
|
63
|
+
// but are not explicitly rooted via a `Worker` instance.
|
|
64
|
+
//
|
|
65
|
+
// By storing them in a variable, we can keep `Worker` objects around and
|
|
66
|
+
// prevent them from getting GC-d.
|
|
67
|
+
let _workers;
|
|
68
|
+
|
|
69
|
+
export async function startWorkers(module, memory, builder) {
|
|
70
|
+
if (builder.numThreads() === 0) {
|
|
71
|
+
throw new Error(`num_threads must be > 0.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const workerInit = {
|
|
75
|
+
type: 'wasm_bindgen_worker_init',
|
|
76
|
+
init: { module_or_path: module, memory },
|
|
77
|
+
receiver: builder.receiver()
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
_workers = await Promise.all(
|
|
81
|
+
Array.from({ length: builder.numThreads() }, async () => {
|
|
82
|
+
// Self-spawn into a new Worker.
|
|
83
|
+
//
|
|
84
|
+
// TODO: while `new URL('...', import.meta.url) becomes a semi-standard
|
|
85
|
+
// way to get asset URLs relative to the module across various bundlers
|
|
86
|
+
// and browser, ideally we should switch to `import.meta.resolve`
|
|
87
|
+
// once it becomes a standard.
|
|
88
|
+
//
|
|
89
|
+
// Note: we could use `../../..` as the URL here to inline workerHelpers.js
|
|
90
|
+
// into the parent entry instead of creating another split point -
|
|
91
|
+
// this would be preferable from optimization perspective -
|
|
92
|
+
// however, Webpack then eliminates all message handler code
|
|
93
|
+
// because wasm-pack produces "sideEffects":false in package.json
|
|
94
|
+
// unconditionally.
|
|
95
|
+
//
|
|
96
|
+
// The only way to work around that is to have side effect code
|
|
97
|
+
// in an entry point such as Worker file itself.
|
|
98
|
+
const worker = new Worker(new URL('./workerHelpers.js', import.meta.url), {
|
|
99
|
+
type: 'module'
|
|
100
|
+
});
|
|
101
|
+
worker.postMessage(workerInit);
|
|
102
|
+
await waitForMsgType(worker, 'wasm_bindgen_worker_ready');
|
|
103
|
+
return worker;
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
builder.build();
|
|
107
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* The `ReadableStreamType` enum.
|
|
5
|
+
*
|
|
6
|
+
* *This API requires the following crate features to be activated: `ReadableStreamType`*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
type ReadableStreamType = "bytes";
|
|
10
|
+
|
|
11
|
+
interface DecodeOptions {
|
|
12
|
+
decodeMode?: "sync" | "parallel";
|
|
13
|
+
maxDecodePoints?: number;
|
|
14
|
+
useSphericalHarmonics?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export class IntoUnderlyingByteSource {
|
|
20
|
+
private constructor();
|
|
21
|
+
free(): void;
|
|
22
|
+
[Symbol.dispose](): void;
|
|
23
|
+
cancel(): void;
|
|
24
|
+
pull(controller: ReadableByteStreamController): Promise<any>;
|
|
25
|
+
start(controller: ReadableByteStreamController): void;
|
|
26
|
+
readonly autoAllocateChunkSize: number;
|
|
27
|
+
readonly type: ReadableStreamType;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class IntoUnderlyingSink {
|
|
31
|
+
private constructor();
|
|
32
|
+
free(): void;
|
|
33
|
+
[Symbol.dispose](): void;
|
|
34
|
+
abort(reason: any): Promise<any>;
|
|
35
|
+
close(): Promise<any>;
|
|
36
|
+
write(chunk: any): Promise<any>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class IntoUnderlyingSource {
|
|
40
|
+
private constructor();
|
|
41
|
+
free(): void;
|
|
42
|
+
[Symbol.dispose](): void;
|
|
43
|
+
cancel(): void;
|
|
44
|
+
pull(controller: ReadableStreamDefaultController): Promise<any>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function decodeTavio(url: string, decode_options: DecodeOptions): Promise<void>;
|
|
48
|
+
|
|
49
|
+
export function initThreadPool(num_threads: number): Promise<any>;
|
|
50
|
+
|
|
51
|
+
export function main(): void;
|
|
52
|
+
|
|
53
|
+
export function registerEventHandler(event_handler: Function): Promise<void>;
|
|
54
|
+
|
|
55
|
+
export function sort(depths: Uint16Array, ordering: Uint32Array, splat_count: number): number;
|
|
56
|
+
|
|
57
|
+
export class wbg_rayon_PoolBuilder {
|
|
58
|
+
private constructor();
|
|
59
|
+
free(): void;
|
|
60
|
+
[Symbol.dispose](): void;
|
|
61
|
+
build(): void;
|
|
62
|
+
numThreads(): number;
|
|
63
|
+
receiver(): number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function wbg_rayon_start_worker(receiver: number): void;
|
|
67
|
+
|
|
68
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
69
|
+
|
|
70
|
+
export interface InitOutput {
|
|
71
|
+
readonly sort: (a: number, b: number, c: number) => number;
|
|
72
|
+
readonly decodeTavio: (a: number, b: number, c: number) => number;
|
|
73
|
+
readonly registerEventHandler: (a: number) => number;
|
|
74
|
+
readonly main: () => void;
|
|
75
|
+
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
76
|
+
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
77
|
+
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
78
|
+
readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
79
|
+
readonly intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
80
|
+
readonly intounderlyingbytesource_type: (a: number) => number;
|
|
81
|
+
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
82
|
+
readonly intounderlyingsink_abort: (a: number, b: number) => number;
|
|
83
|
+
readonly intounderlyingsink_close: (a: number) => number;
|
|
84
|
+
readonly intounderlyingsink_write: (a: number, b: number) => number;
|
|
85
|
+
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
86
|
+
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
87
|
+
readonly intounderlyingsource_pull: (a: number, b: number) => number;
|
|
88
|
+
readonly __wbg_wbg_rayon_poolbuilder_free: (a: number, b: number) => void;
|
|
89
|
+
readonly initThreadPool: (a: number) => number;
|
|
90
|
+
readonly wbg_rayon_poolbuilder_build: (a: number) => void;
|
|
91
|
+
readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number;
|
|
92
|
+
readonly wbg_rayon_poolbuilder_receiver: (a: number) => number;
|
|
93
|
+
readonly wbg_rayon_start_worker: (a: number) => void;
|
|
94
|
+
readonly __wasm_bindgen_func_elem_639: (a: number, b: number) => void;
|
|
95
|
+
readonly __wasm_bindgen_func_elem_1539: (a: number, b: number, c: number, d: number) => void;
|
|
96
|
+
readonly __wasm_bindgen_func_elem_640: (a: number, b: number, c: number) => void;
|
|
97
|
+
readonly memory: WebAssembly.Memory;
|
|
98
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
99
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
100
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
101
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
102
|
+
readonly __wbindgen_thread_destroy: (a?: number, b?: number, c?: number) => void;
|
|
103
|
+
readonly __wbindgen_start: (a: number) => void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
110
|
+
* a precompiled `WebAssembly.Module`.
|
|
111
|
+
*
|
|
112
|
+
* @param {{ module: SyncInitInput, memory?: WebAssembly.Memory, thread_stack_size?: number }} module - Passing `SyncInitInput` directly is deprecated.
|
|
113
|
+
* @param {WebAssembly.Memory} memory - Deprecated.
|
|
114
|
+
*
|
|
115
|
+
* @returns {InitOutput}
|
|
116
|
+
*/
|
|
117
|
+
export function initSync(module: { module: SyncInitInput, memory?: WebAssembly.Memory, thread_stack_size?: number } | SyncInitInput, memory?: WebAssembly.Memory): InitOutput;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
121
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
122
|
+
*
|
|
123
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput>, memory?: WebAssembly.Memory, thread_stack_size?: number }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
124
|
+
* @param {WebAssembly.Memory} memory - Deprecated.
|
|
125
|
+
*
|
|
126
|
+
* @returns {Promise<InitOutput>}
|
|
127
|
+
*/
|
|
128
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput>, memory?: WebAssembly.Memory, thread_stack_size?: number } | InitInput | Promise<InitInput>, memory?: WebAssembly.Memory): Promise<InitOutput>;
|