You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Use primary WebAssembly.instantiate overload
Previously WebAssembly.compile was used along with the secondary WebAssembly.instantiate overload. Using only the primary overload is recommended to get best performance.
This commit is contained in:
@@ -84,10 +84,10 @@
|
|||||||
rtenvOpts.print = stdout;
|
rtenvOpts.print = stdout;
|
||||||
if (typeof stderr === 'function')
|
if (typeof stderr === 'function')
|
||||||
rtenvOpts.printErr = stderr;
|
rtenvOpts.printErr = stderr;
|
||||||
if (typeof WebAssembly === 'object' && initializer instanceof WebAssembly.Module) {
|
if (typeof WebAssembly === 'object' && initializer instanceof ArrayBuffer) {
|
||||||
rtenvOpts.instantiateWasm = function(imports, onSuccess) {
|
rtenvOpts.instantiateWasm = function(imports, onSuccess) {
|
||||||
WebAssembly.instantiate(initializer, imports).then(function(result) {
|
WebAssembly.instantiate(initializer, imports).then(function(result) {
|
||||||
onSuccess(result);
|
onSuccess(result.instance);
|
||||||
});
|
});
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
return Promise.reject(new Error("Browser doesn't support WebAssembly"));
|
return Promise.reject(new Error("Browser doesn't support WebAssembly"));
|
||||||
// TODO cache/retrieve module to/from idb
|
// TODO cache/retrieve module to/from idb
|
||||||
engineLoadPromise = loadPromise(basePath + '.wasm').then(function(xhr) {
|
engineLoadPromise = loadPromise(basePath + '.wasm').then(function(xhr) {
|
||||||
return WebAssembly.compile(xhr.response);
|
return xhr.response;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var asmjsPromise = loadPromise(basePath + '.asm.js').then(function(xhr) {
|
var asmjsPromise = loadPromise(basePath + '.asm.js').then(function(xhr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user