Skip to content

Documentation / @ripl/webgpu / GeometryManager

Class: GeometryManager ​

Defined in: webgpu/src/geometry.ts:36

Manages GPU buffer allocation and per-frame mesh accumulation.

CPU staging arrays and GPU buffers are pooled between frames: capacity grows in powers of two and is only released by GeometryManager.destroy, so steady-state frames perform no allocations and no GPU buffer recreation.

Constructors ​

Constructor ​

new GeometryManager(device, pipelineState, textureManager?): GeometryManager

Defined in: webgpu/src/geometry.ts:59

Parameters ​

ParameterTypeDescription
deviceGPUDeviceThe device to allocate buffers on.
pipelineStatePipelineStateThe pipeline the buffers are laid out for.
textureManager?TextureManagerUploads and binds material textures. Omit to skip texture binding.

Returns ​

GeometryManager

Methods ​

beginFrame() ​

beginFrame(): void

Defined in: webgpu/src/geometry.ts:66

Resets per-frame state for a new render pass.

Returns ​

void


destroy() ​

destroy(): void

Defined in: webgpu/src/geometry.ts:155

Releases all GPU buffers and pooled CPU staging arrays, leaving the manager permanently inert.

Returns ​

void


flush() ​

flush(): FlushResult | null

Defined in: webgpu/src/geometry.ts:86

Uploads all queued meshes to pooled GPU buffers and returns draw commands.

Staging arrays and GPU buffers are reused between frames and only grow (in powers of two) when the frame's geometry exceeds current capacity; uploads and draw commands cover the used lengths, never the capacity.

Returns null once GeometryManager.destroy has run: a destroyed manager allocates nothing, rather than quietly recreating buffers on a device it has already released.

Returns ​

FlushResult | null


submit() ​

submit(submission): void

Defined in: webgpu/src/geometry.ts:72

Queues a mesh for rendering this frame.

Parameters ​

ParameterType
submissionMeshSubmission

Returns ​

void