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.
Files changed (2) hide show
  1. package/index.js +5 -6
  2. 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
- // Create memory (WASM will import it)
111
- const memory = new WebAssembly.Memory({ initial: 16, maximum: 256 });
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webgl2",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "WebGL2 tools to derisk large GPU projects on the web beyond toys and demos.",
5
5
  "type": "module",
6
6
  "main": "index.js",