Spaces:
Running
Running
test
Browse files
godot.javascript.opt.tools.threads.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
godot.javascript.opt.tools.threads.wrapped.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
godot.tools.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
godot.tools.worker.js
CHANGED
@@ -1 +1,46 @@
|
|
1 |
-
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
var Module = {};
|
3 |
+
|
4 |
+
function threadPrintErr() {
|
5 |
+
var text = Array.prototype.slice.call(arguments).join(" ");
|
6 |
+
console.error(text)
|
7 |
+
}
|
8 |
+
|
9 |
+
function threadAlert() {
|
10 |
+
var text = Array.prototype.slice.call(arguments).join(" ");
|
11 |
+
postMessage({ cmd: "alert", text: text, threadId: Module["_pthread_self"]() })
|
12 |
+
}
|
13 |
+
var err = threadPrintErr;
|
14 |
+
self.alert = threadAlert;
|
15 |
+
Module["instantiateWasm"] = ((info, receiveInstance) => {
|
16 |
+
var instance = new WebAssembly.Instance(Module["wasmModule"], info);
|
17 |
+
receiveInstance(instance);
|
18 |
+
Module["wasmModule"] = null;
|
19 |
+
return instance.exports
|
20 |
+
});
|
21 |
+
self.onmessage = (e => {
|
22 |
+
try {
|
23 |
+
if (e.data.cmd === "load") {
|
24 |
+
Module["wasmModule"] = e.data.wasmModule;
|
25 |
+
Module["wasmMemory"] = e.data.wasmMemory;
|
26 |
+
Module["buffer"] = Module["wasmMemory"].buffer;
|
27 |
+
Module["ENVIRONMENT_IS_PTHREAD"] = true;
|
28 |
+
if (typeof e.data.urlOrBlob == "string") { importScripts(e.data.urlOrBlob) } else {
|
29 |
+
var objectUrl = URL.createObjectURL(e.data.urlOrBlob);
|
30 |
+
importScripts(objectUrl);
|
31 |
+
URL.revokeObjectURL(objectUrl)
|
32 |
+
}
|
33 |
+
Godot(Module).then(function(instance) { Module = instance })
|
34 |
+
} else if (e.data.cmd === "run") {
|
35 |
+
Module["__performance_now_clock_drift"] = performance.now() - e.data.time;
|
36 |
+
Module["__emscripten_thread_init"](e.data.threadInfoStruct, 0, 0, 1);
|
37 |
+
Module["establishStackSpace"]();
|
38 |
+
Module["PThread"].receiveObjectTransfer(e.data);
|
39 |
+
Module["PThread"].threadInit();
|
40 |
+
try { var result = Module["invokeEntryPoint"](e.data.start_routine, e.data.arg); if (Module["keepRuntimeAlive"]()) { Module["PThread"].setExitStatus(result) } else { Module["__emscripten_thread_exit"](result) } } catch (ex) { if (ex != "unwind") { if (ex instanceof Module["ExitStatus"]) { if (Module["keepRuntimeAlive"]()) {} else { Module["__emscripten_thread_exit"](ex.status) } } else { throw ex } } }
|
41 |
+
} else if (e.data.cmd === "cancel") { if (Module["_pthread_self"]()) { Module["__emscripten_thread_exit"](-1) } } else if (e.data.target === "setimmediate") {} else if (e.data.cmd === "processThreadQueue") { if (Module["_pthread_self"]()) { Module["_emscripten_current_thread_process_queued_calls"]() } } else if (e.data.cmd === "processProxyingQueue") { if (Module["_pthread_self"]()) { Module["_emscripten_proxy_execute_queue"](e.data.queue) } } else {
|
42 |
+
err("worker.js received unknown command " + e.data.cmd);
|
43 |
+
err(e.data)
|
44 |
+
}
|
45 |
+
} catch (ex) { err("worker.js onmessage() captured an uncaught exception: " + ex); if (ex && ex.stack) err(ex.stack); if (Module["__emscripten_thread_crashed"]) { Module["__emscripten_thread_crashed"]() } throw ex }
|
46 |
+
});
|