import type { BufferData, TypedArray } from "./types.js"; /** Round `value` up to the next multiple of `alignment`. */ export declare const alignTo: (value: number, alignment: number) => number; export declare const isTypedArray: (data: unknown) => data is TypedArray; /** * Coerce buffer factory input into a typed array. Nested number arrays are * flattened; plain arrays default to Float32Array (Uint16Array/Uint32Array for * index data, based on the max value). Raw ArrayBuffers pass through as a byte * view (Uint8Array) — the data is trusted to already be in the right format. */ export declare function toTypedArray(data: BufferData, { index }?: { index?: boolean; }): TypedArray; /** * Coerce texture upload data to a typed array. Typed arrays pass through as * trusted bytes — the required path for integer/unorm/snorm/packed formats. A * plain number array is treated as float data and packed at the format's float * precision: Float16Array for half-float formats, Float32Array otherwise. */ export declare function toTextureData(data: BufferData, format: GPUTextureFormat): TypedArray; /** * Bytes per texel for a supported texture format. Throws for * unsupported/compressed formats — compressed data is measured in blocks, see * {@link blockInfo}. */ export declare function bytesPerTexel(format: GPUTextureFormat): number; /** Footprint of one compressed block: its texel extent and encoded size. */ export interface BlockInfo { width: number; height: number; bytes: number; } /** * Block footprint of a compressed format, or `undefined` for uncompressed ones * — which is also the test for "is this format block-compressed". */ export declare function blockInfo(format: GPUTextureFormat): BlockInfo | undefined; /** Whether `format` stores texels in compressed blocks. */ export declare const isCompressedFormat: (format: GPUTextureFormat) => boolean; /** * Row pitch for a `writeTexture` of `width`x`height` texels. Compressed formats * are measured in whole blocks, partial blocks at the edge counting as full * ones. `queue.writeTexture` imposes no 256-byte row alignment (that is a * `copyBufferToTexture` rule), so this is the tight pitch. */ export declare function texelCopyLayout(format: GPUTextureFormat, width: number, height: number): { bytesPerRow: number; rowsPerImage: number; }; /** * Copy extent rounded up to whole blocks — the physical size a compressed * subresource occupies, which copy extents must match even when the logical mip * size is smaller. Identity for uncompressed formats. */ export declare function physicalExtent(format: GPUTextureFormat, width: number, height: number): { width: number; height: number; }; /** Compressed textures are allocated in whole blocks. */ export declare function assertBlockAlignedSize(format: GPUTextureFormat, width: number, height: number): void; /** Compressed copies must start on a block boundary. */ export declare function assertBlockAlignedOrigin(format: GPUTextureFormat, origin: GPUOrigin3D): void; //# sourceMappingURL=utils.d.ts.map