Skip to content

compute.createStorageBuffer#offsetBytes

Summary

compute.createStorageBuffer#offsetBytes is the start of the wrapper's logical range in the raw GPU buffer. It is zero for allocated storage and set by compute.wrapStorageBuffer for external storage.

Syntax

readonly offsetBytes: number
const rawOffset = storage.offsetBytes;

Returns

number - Byte offset into storage.buffer. For WebGPU calls that take the raw handle, add this to the logical offset. WasmGPU transfer and binding helpers add it when the caller supplies the wrapper.

Example

const wgpu = await WasmGPU.create(document.querySelector("canvas"));
const storage = wgpu.compute.createStorageBuffer({ byteLength: 16 });
console.log(storage.offsetBytes, storage.byteLength); // 0, 16
storage.destroy();

See Also