Documentation
    Preparing search index...

    Class GeometryCache

    Per-context store of uploaded geometry (§61, §64 stage 7).

    One cache belongs to one GL context: the renderer builds it during initialize and builds a new one on context restore, since every handle the old one held died with the context.

    const cache = new GeometryCache(gl);
    const record = cache.acquire(item.geometry);
    if (record !== null) {
    gl.bindVertexArray(record.vertexArray);
    // draw…
    }
    Index
    • get disposed(): boolean

      Whether GeometryCache.dispose has run.

      Returns boolean

    • get size(): number

      Number of geometries currently uploaded. Diagnostics and tests (§83).

      Returns number

    • Returns the vertex array for geometry, uploading it on first use and re-uploading it whenever geometry.version has advanced. Compatible layouts retain their GL objects; returned metadata belongs to the acquired version.

      Returns null — and creates no entry — when there is nothing to draw (drawCount === 0, which includes every disposed geometry), after this cache is disposed, or when GL refuses to allocate an object. Never throws: this runs inside Renderer.render, and §61 forbids throwing there for a lost context; a failed allocation is the same class of asynchronous, driver-scheduled event, so it skips the object rather than unwinding the frame.

      Parameters

      Returns GeometryRecord | null

    • Deletes every vertex array and buffer this cache created (§83). Idempotent.

      Only valid on a live context — the renderer calls GeometryCache.forget instead when the context is lost.

      Returns void

    • Drops every record without touching the context — the context-loss path (§61). The handles are already invalid; calling deleteBuffer on them would be a GL call against a lost context for no benefit.

      Returns void