pub fn storage_buffer_init(device: &Device, label: &str, data: &[u8]) -> BufferExpand description
Create a GPU storage buffer initialised with data.
The returned buffer has usages STORAGE | COPY_DST | COPY_SRC:
STORAGE— bindable as a shader storage buffer.COPY_DST— allowsqueue.write_bufferupdates.COPY_SRC— allows copying to astaging_bufferfor CPU readback.
§Parameters
device— the logical wgpu device.label— debug label visible in GPU capture tools (pass""to omit).data— raw bytes to upload; length determines the buffer size.
§Panics
Panics if data is empty (zero-size buffers are forbidden by the WebGPU
spec and wgpu validation).