Skip to content

StorageBufferAttribute: Provide method for creating a GPU-only storage buffer without CPU array #33280

@gkjohnson

Description

@gkjohnson

Description

Right now if you create a "StorageBufferAttribute" a CPU array is always created whether the user provided an array or not:

const attr = new StorageBufferAttribute( 30_000_000, 1, Uint32Array );

The above creates a 120MB, 30 million element array on the CPU even if the user is only intending to read and write to the storage buffer on the GPU. When working with multiple large buffer this can eat up a lot of CPU memory unnecessarily.

Solution

Don't create an array if the user does not explicitly create a storage buffer.

From the name alone I thought that "IndirectStorageBufferAttribute" would do what I was hoping (as in the data not directly accessible on the CPU) but it seems this is only designed for compute kernel dispatch.

Alternatives

None

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions