Luxar Viewer API Documentation - v2026.10.22
    Preparing search index...

    Module rendering/element-storage

    Shared texture-backed element storage for instanced geometry.

    Per-element data lives in an RGBA32F element texture (gsplats: 4 texels/splat; points: 3 texels/point; lines: 6 texels/segment — layout authority in ./element-texture-layout) sampled by the vertex shader via texelFetch. The only per-instance data is the ordering pair aSortedIndex / aSortedIndexB (Uint32), which maps the draw slot to a storage slot so draw order can be permuted without rewriting element data (depth-sorting plan, docs/guides/specs/GSPLAT_DEPTH_SORTING_SPEC.md §4/§8). The pair is DOUBLE-BUFFERED — a new ordering streams into the inactive buffer and the uSortedIndexSlot uniform flips on completion (spec §2.1 tier 3), so no frame ever samples a half-applied permutation. An ordering reaches the inactive buffer from one of two producers: a HOST array the pump uploads (writeSortedIndexOrdering), or a DEVICE writer that fills the GPU buffer itself (writeDeviceSortedIndexOrdering, the WebGPU compute sort of #3162). The flip, acknowledgement, held-draw and supersede rules are shared.

    Texture lifetime = geometry lifetime: attachElementStorage registers a dispose listener on the geometry, so every dispose site (pool evictors, pool.dispose(), the fallback rebuild swap) frees the texture with the geometry — no site-by-site bookkeeping.

    DeviceOrderingWrite
    SortedIndexApplyCallbacks
    SortedIndexPumpResult
    SORTED_INDEX_CHUNK_ELEMENTS
    isElementTexture
    hasPendingElementTextureFullUpload
    hasElementTextureBeenUploaded
    markElementTextureFullDirty
    registerElementTexelDirtyRange
    setSortedIndexChunkElementsForTests
    canComputeSortedIndex
    activeSortedIndexSlot
    getActiveSortedIndexAttribute
    hasPendingSortedIndexOrderingApply
    pumpSortedIndexOrderingApply
    acknowledgeSortedIndexOrderingDraw
    cancelSortedIndexOrderingApply
    cancelAllSortedIndexOrderingApplies
    writeFreshElementStorage
    attachElementStorage
    getElementTexture
    isElementTextureCurrent
    getElementTextureLayout
    elementTexelCapacity
    holdSortedIndexDrawForAppend
    holdSortedIndexDrawFromSeed
    sortedIndexDrawHoldTarget
    releaseSortedIndexDrawHold
    writeSortedIndexIdentity
    writeSortedIndexOrderingLive
    repairSortedIndexForCount
    writeSortedIndexOrdering
    writeDeviceSortedIndexOrdering
    isSortedIndexHostArrayCurrent
    repairSortedIndexHostArray