import type { BufferData, BufferUsagePreset, GpuBuffer, GpuContext } from "./types.js"; /** * Type guard for {@link GpuBuffer} resource objects (raw GPUBuffers also have a * similar shape — discriminate on `id`). */ export declare const isGpuBuffer: (value: unknown) => value is GpuBuffer; /** * Usage presets for {@link createBuffer}: common GPUBufferUsage flag * combinations by name. */ export declare const BUFFER_USAGE_PRESETS: Record; export interface CreateBufferOptions extends GPUObjectDescriptorBase { /** Usage preset name, or raw GPUBufferUsage flags. */ usage: BufferUsagePreset | GPUBufferUsageFlags; /** * Initial contents. Plain arrays coerce to Float32Array (Uint16/Uint32Array * for index data). */ data?: BufferData; /** Byte size when allocating without data, or to over-allocate. */ size?: number; /** * Index format for index buffers. Derived from the data when omitted; * required knowledge for buffers allocated by size and filled later, as * updateBuffer converts index data to the buffer's declared format. */ indexFormat?: GPUIndexFormat; } /** * Create a GPU buffer. * * ```js * const positions = gpu.createBuffer(ctx, { * usage: "vertex", * data: geometry.positions, * }); * const indices = gpu.createBuffer(ctx, { * usage: "index", * data: geometry.cells, * }); * ``` */ export declare function createBuffer(ctx: GpuContext, options: CreateBufferOptions): GpuBuffer; /** * Upload data into an existing buffer. * * ```js * gpu.updateBuffer(ctx, positions, newPositions); * ``` */ export declare function updateBuffer(ctx: GpuContext, target: GpuBuffer, data: BufferData, byteOffset?: number): void; //# sourceMappingURL=buffer.d.ts.map