Skip to content

compute.createStorageBuffer#buffer

Summary

compute.createStorageBuffer#buffer exposes the raw WebGPU buffer behind a WasmGPU storage wrapper. Use it with native WebGPU copy and binding APIs. For a wrapped range, translate logical offsets to raw offsets using storage.offsetBytes.

Syntax

readonly StorageBuffer.buffer: GPUBuffer
readonly StorageBuffer.byteLength: number
readonly StorageBuffer.usage: GPUBufferUsageFlags
const raw = storage.buffer;

Returns

GPUBuffer - The original handle for wrapped storage, or the allocation created by the storage factory. storage.byteLength describes the logical range. raw.size includes any allocation padding or bytes outside the wrapped range.

Notes

Keep the handle live until commands that use it have been submitted. Destroy the owning wrapper when finished. For borrowed storage, the owner of the original GPU buffer remains responsible for destroying it. webgpu.bindingResource accepts the wrapper and applies its offset and binding size rules.

See Also