/** * @import { WebgpuGraphicsDevice } from './webgpu-graphics-device.js' */ /** * WebGPU implementation of DrawCommands. * Retained by the device for recovery until destroyed by the owning DrawCommands. * * @ignore */ export class WebgpuDrawCommands { /** * @param {WebgpuGraphicsDevice} device - Graphics device. */ constructor(device: WebgpuGraphicsDevice); /** @type {WebgpuGraphicsDevice} */ device: WebgpuGraphicsDevice; /** @type {Uint32Array|null} */ gpuIndirect: Uint32Array | null; /** @type {Int32Array|null} */ gpuIndirectSigned: Int32Array | null; /** * @type {StorageBuffer|null} */ storage: StorageBuffer | null; /** @type {number} */ count: number; /** * Allocate AoS buffer and backing storage buffer. * @param {number} maxCount - Number of sub-draws. */ allocate(maxCount: number): void; /** * Write a single draw entry. * @param {number} i - Draw index. * @param {number} indexOrVertexCount - Count of indices/vertices. * @param {number} instanceCount - Instance count. * @param {number} firstIndexOrVertex - First index/vertex. * @param {number} baseVertex - Base vertex (signed). * @param {number} firstInstance - First instance. */ add(i: number, indexOrVertexCount: number, instanceCount: number, firstIndexOrVertex: number, baseVertex?: number, firstInstance?: number): void; /** * Upload AoS data to storage buffer. * @param {number} count - Number of active draws. */ update(count: number): void; /** * Calculate primitives per sub-draw before accumulating, so strip overhead and incomplete * list primitives are handled separately for each instance. * @param {number} count - Number of active draws. * @param {number} type - Primitive topology. * @returns {number} Total primitive count. Zero for GPU-authored indirect commands. */ getPrimitiveCount(count: number, type: number): number; restoreContext(): void; destroy(): void; } import type { WebgpuGraphicsDevice } from './webgpu-graphics-device.js'; import { StorageBuffer } from '../storage-buffer.js';