webgl2 1.0.6 → 1.0.7
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/index.js +5 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -107,18 +107,17 @@ async function initWASM() {
|
|
|
107
107
|
// Compile WASM module
|
|
108
108
|
const wasmModule = await WebAssembly.compile(wasmBuffer);
|
|
109
109
|
|
|
110
|
-
//
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
// Instantiate WASM
|
|
114
|
-
const importObj = { env: { memory } };
|
|
115
|
-
const instance = await WebAssembly.instantiate(wasmModule, importObj);
|
|
110
|
+
// Instantiate WASM (no imports needed, memory is exported)
|
|
111
|
+
const instance = await WebAssembly.instantiate(wasmModule, {});
|
|
116
112
|
|
|
117
113
|
// Verify required exports
|
|
118
114
|
const ex = instance.exports;
|
|
119
115
|
if (typeof ex.wasm_create_context !== 'function') {
|
|
120
116
|
throw new Error('WASM module missing wasm_create_context export');
|
|
121
117
|
}
|
|
118
|
+
if (!(ex.memory instanceof WebAssembly.Memory)) {
|
|
119
|
+
throw new Error('WASM module missing memory export');
|
|
120
|
+
}
|
|
122
121
|
return wasmInitPromise = { ex, instance };
|
|
123
122
|
}
|
|
124
123
|
|