WasmGPU.frameArena.init¶
Summary¶
WasmGPU.frameArena.init initializes or reinitializes the global frame arena capacity. Calling init refreshes the frame-arena epoch and returns the base pointer. Use this only if you need a non-default capacity.
Syntax¶
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
capBytes |
number |
No | Frame arena capacity in bytes, default 8 * 1024 * 1024. |
Returns¶
number - Base pointer (Wasm address) for the frame arena block.
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const basePtr = wgpu.frameArena.init(16 * 1024 * 1024);
console.log(basePtr, wgpu.frameArena.capBytes());