Documentation
    Preparing search index...

    Per-context store of uploaded textures (§77, §61).

    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 TextureCache(gl);
    const record = cache.acquire(item.material.texture);
    if (record !== null) {
    gl.bindTexture(GL.TEXTURE_2D, record.texture);
    // draw…
    }
    Index
    • get size(): number

      Number of textures currently uploaded. Diagnostics and tests (§83, §84).

      Returns number

    • Returns the GL texture for texture, uploading it on first use and re-uploading it whenever texture.version has advanced.

      Returns null — and creates no entry — when the texture has been 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 TextureRecord | null

    • Upload and wait for GPU completion without a blocking client wait.

      Parameters

      • texture: MaterialTexture
      • poll: () => Promise<void> = textureUploadTick
      • maximumPolls: number = 4096

      Returns Promise<TextureRecord | null>

    • Deletes every texture this cache created (§83). Idempotent.

      Only valid on a live context — the renderer calls TextureCache.forget instead when the context is lost. The application's Texture objects are untouched: the renderer did not create them, so it does not dispose them.

      Returns void

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

      Returns void

    • Residency of the submitted version; async preparation exposes in-flight work.

      Parameters

      Returns "absent" | "stale" | "uploading" | "resident"