Documentation
    Preparing search index...

    Class WgpuParticleCache

    Per-device store of particle instance buffers, keyed by the emitting node's id (§61, §64 stage 7) — ParticleBatchCache's contract minus the vertex arrays WebGPU does not have.

    One cache belongs to one device, like WgpuGeometryCache: built at initialization (which allocates nothing), forget() on device loss, dispose() with the renderer. The eviction policy is the GL cache's, verbatim: records rebuild lazily on the next acquire when the capacity changes, and a system removed from the scene keeps its buffer until the renderer is disposed — the same documented leak window GeometryCache carries, for §83's creator-owns reasons.

    Index
    • get disposed(): boolean

      Whether WgpuParticleCache.dispose has run.

      Returns boolean

    • get size(): number

      Number of particle systems currently holding GPU buffers (§83, §84).

      Returns number

    • Returns the instance buffer for item, creating it on first use and re-creating it when the system's capacity has changed.

      Returns null — and creates no entry — when the system has no capacity at all, and once disposed (a draw racing teardown skips rather than resurrecting the cache — the reentrant-dispose family's rule). Never throws: this runs inside Renderer.render, where §61 forbids it.

      Parameters

      Returns WgpuParticleRecord | null

    • Destroys every instance buffer and marks the cache disposed (§83). Idempotent.

      Returns void

    • Drops every record without destroying anything — the device-loss path (§61). The allocations belong to a device that no longer exists.

      Returns void

    • Uploads item's live instances into record's buffer — the frame's only particle traffic, count × 32 bytes — unless frame already did (the once-per-frame cadence; the module header owns the argument).

      The five-argument writeBuffer form is what keeps this allocation-free: dataOffset and size are in elements of item.instances, so no subarray view is created per system per frame (plan D7 — the GL module's bufferSubData decision, one API over).

      The caller has already skipped a zero-count system (item.count === 0 skips the draw before the cache is consulted, as GL's arm does), so the range here is always non-empty.

      Parameters

      Returns void