VTK  9.7.20261114
vtkWebGPULinearAllocator Class Reference

#include <vtkWebGPUContextDevice2DPrivate.h>

Detailed Description

Linear allocator for dynamic WebGPU buffers.

Definition at line 25 of file vtkWebGPUContextDevice2DPrivate.h.

Public Member Functions

 vtkWebGPULinearAllocator (const std::string &label)
 ~vtkWebGPULinearAllocator ()
void Reset ()
 Resets the internal offset and releases all stale buffers.
uint64_t Allocate (vtkWebGPUConfiguration *config, uint64_t sizeInBytes, WGPUBufferUsage usage)
 Reserves a contiguous block of memory in the current WebGPU buffer.
WGPUBuffer GetBuffer () const
 Gets the active WebGPU buffer object.

Constructor & Destructor Documentation

◆ vtkWebGPULinearAllocator()

vtkWebGPULinearAllocator::vtkWebGPULinearAllocator ( const std::string & label)
inline

Definition at line 28 of file vtkWebGPUContextDevice2DPrivate.h.

◆ ~vtkWebGPULinearAllocator()

vtkWebGPULinearAllocator::~vtkWebGPULinearAllocator ( )
inline

Definition at line 33 of file vtkWebGPUContextDevice2DPrivate.h.

Member Function Documentation

◆ Reset()

void vtkWebGPULinearAllocator::Reset ( )
inline

Resets the internal offset and releases all stale buffers.

Definition at line 44 of file vtkWebGPUContextDevice2DPrivate.h.

◆ Allocate()

uint64_t vtkWebGPULinearAllocator::Allocate ( vtkWebGPUConfiguration * config,
uint64_t sizeInBytes,
WGPUBufferUsage usage )
inline

Reserves a contiguous block of memory in the current WebGPU buffer.

If the requested size exceeds the remaining capacity, the current buffer is marked as stale, and a new buffer is allocated (doubling the capacity).

Parameters
configThe WebGPU configuration used to create new buffers.
sizeInBytesThe exact number of bytes needed.
usageThe expected WebGPU usage flags for the buffer.
Returns
The starting byte offset within the buffer returned by GetBuffer().

Definition at line 66 of file vtkWebGPUContextDevice2DPrivate.h.

◆ GetBuffer()

WGPUBuffer vtkWebGPULinearAllocator::GetBuffer ( ) const
inline

Gets the active WebGPU buffer object.

Returns
The current WGPUBuffer handling allocations.

Definition at line 95 of file vtkWebGPUContextDevice2DPrivate.h.


The documentation for this class was generated from the following file: