Documentation
    Preparing search index...

    Class WgpuTextureCache

    Per-device store of uploaded textures and their samplers (§77, §61, §83).

    One cache belongs to one device; the renderer builds it during initialize — which allocates nothing, so a frame that draws no texture costs exactly what it did before this packet — and drops it whole on device loss.

    const record = textures.acquire(material.map);
    if (record !== null) {
    pass.setBindGroup(MAP_BIND_GROUP_INDEX, record.bindGroup);
    // draw…
    }
    Index
    • get bindGroupLayout(): object

      Group 1's bind-group layout (wgpu-bindings.ts), created on first use.

      Lazy, and the laziness is the point: a createBindGroupLayout in initialize would put one more call into every recorded transcript in this repository, including those of applications that never draw a texture — R-30b's lazy-query law, which is about not moving what nothing asked to move. The pipeline cache reaches this through the provider the renderer hands it, so the layout a textured pipeline is built against and the layout its bind group is created against are the same object by construction.

      Returns the same object for the life of the cache; forget() and dispose() drop it.

      Returns object

    • get samplerCount(): number

      Number of distinct samplers created (§77).

      The measurable form of this module's central claim: a scene whose fifty textures all sample the same way holds one sampler, not fifty.

      Returns number

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

      Returns null — and creates no entry — when the texture has been disposed or once the cache is disposed, so the draw is skipped rather than painting undefined content (§83). Never throws: this runs inside Renderer.render, and §61 forbids throwing there.

      Parameters

      Returns WgpuTextureRecord | null

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

      Only the textures: samplers, bind groups, layouts and pipelines have no destroy() in WebGPU — they are released when the last reference goes away — so dropping the maps is their release, exactly as it is in wgpu-pipeline-cache.ts. The application's Texture objects are untouched: the renderer did not create them, so it does not dispose them.

      Returns void

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

      Returns void