/** * @import { GraphicsDevice } from './graphics-device.js' */ /** * A base class representing a single per platform buffer. * * @ignore */ export class DynamicBuffer { constructor(device: any); /** @type {GraphicsDevice} */ device: GraphicsDevice; /** * A cache of bind groups for each uniform buffer size, which is used to avoid creating a new * bind group for each uniform buffer. * * @type {Map} */ bindGroupCache: Map; /** * Int32 access over the CPU accessible memory of the whole buffer, or null when the buffer has * none. The views span the whole buffer and an allocation is addressed by an offset into them, * so handing out an allocation creates no views of its own - which matters, as that happens for * every draw. * * @type {Int32Array|null} */ storageInt32: Int32Array | null; /** * Uint32 access over the whole buffer. See {@link DynamicBuffer#storageInt32}. * * @type {Uint32Array|null} */ storageUint32: Uint32Array | null; /** * Float32 access over the whole buffer. See {@link DynamicBuffer#storageInt32}. * * @type {Float32Array|null} */ storageFloat32: Float32Array | null; bindGroupFormat: BindGroupFormat; /** * Create the storage views over the CPU accessible memory of the whole buffer. * * @param {ArrayBuffer|null} arrayBuffer - The memory of the whole buffer, or null to release * the views when the memory is no longer accessible. */ setStorage(arrayBuffer: ArrayBuffer | null): void; /** * Upload the buffer's data to the GPU. A no-op on backends (such as WebGPU) that copy the data * to the GPU separately; WebGL overrides this to eagerly upload, as it has no buffer mapping and * executes draws immediately. */ upload(): void; getBindGroup(ub: any): BindGroup; } import type { GraphicsDevice } from './graphics-device.js'; import { BindGroup } from './bind-group.js'; import { BindGroupFormat } from './bind-group-format.js';