InternalCPU-side backing buffer used to populate this texture.
The concrete type depends on the implementation (e.g., Uint32Array,
Float32Array, or a view over an ArrayBuffer). This buffer is
uploaded to the GPU when updated.
The ArrayBufferView class used for the CPU-side buffer.
Size in bytes of a single texel in the data texture.
Enables internal event emission for this data texture.
Human-readable description of the data stored in this texture.
Intended for debugging UIs and diagnostics (e.g., displayed above inspectors). Subclasses or owners should populate this with a concise explanation of the layout and semantic meaning (e.g., “mesh matrices (Mat4, row-major), indexed by meshId”).
Number of individual elements (e.g., floats, uint32s) stored per logical item in this data texture.
Number of individual elements (e.g., floats, uint32s) stored per texel in the data texture.
Texture format (e.g., gl.RGBA, gl.RGBA_INTEGER).
The WebGL2 rendering context.
Texture height in texels.
Texture internal format (e.g., gl.RGBA8, gl.RGBA32UI, gl.RGBA32F).
Size in bytes of a single logical item stored in the data texture.
Duration (in milliseconds) of the last upload to GPU.
This value is 0 until the first upload occurs.
Maximum number of logical items that can be stored in this texture.
The value of numItems never exceeds this limit.
Emitted when the CPU-side buffer for this texture has changed and been uploaded to the GPU.
This event is intended for debugging tools and monitoring UIs; it is only emitted when debugging is enabled.
Number of texels occupied by a single logical item in the data texture.
InternaltextureThe underlying WebGL texture object.
This is the GPU resource that is bound and sampled/loaded by shaders.
Texture data type (e.g., gl.UNSIGNED_BYTE, gl.UNSIGNED_INT, gl.FLOAT).
Whether to use a CPU-side buffer for staging data before uploading to the GPU.
Texture width in texels.
Static ReadonlyitemGets the number of logical items currently stored in this texture.
Cancels all pending uploads by clearing the dirty set.
InternalFrees GPU resources associated with this data texture.
Gets the total capacity in bytes of the data texture.
Read-back helper — not used by the renderer but required by
the abstract base class. Returns the eight pattern entries
for slotIndex as a plain number[].
Retrieves all logical items currently stored in this texture.
An array of decoded items.
Gets the used capacity in bytes of the data texture.
ProtectednotifyInternalNotifies listeners that the data texture has been updated.
ProtectedsetMarks an item as dirty, so it will be uploaded on the next update.
Index of the item to mark as dirty.
Writes the eight pattern entries for slotIndex as raw
Float32 bit patterns. Trailing entries past entries.length
(or past index 7) are zero-padded so the shader can sum the
full 8-entry array to recover the period without consulting
a separate length.
Slot 0 is the "no pattern" sentinel and should not be written — callers allocate slots starting at index 1.
Uploads all dirty items to the GPU as efficiently as possible.
Internal algorithm:
texSubImage2D calls by uploading as large a block as possible per call.True if any uploads occurred, false otherwise.
Stores per-slot dash / gap patterns for the thick-line draw technique.
The renderer routes each line-mesh's per-material SceneMaterial.linePattern into one slot in this table (per batch, allocated on demand by GPUMemoryBatch). A 16-bit slot index lands in MeshAttributeTexture's alpha slot; the thick-line vertex shader reads that index and, when non-zero, fetches the slot's two texels here to recover the pattern.
Slot 0 is reserved as the "no per-mesh pattern" sentinel — meshes whose materials carry no pattern leave the slot index at 0, and the shader falls back to the View-level
linesMaterial.linePatternuniform.Two texels per slot, eight u32 elements (linearised —
baseisslotIndex * elementsPerItem):base + 0..3pattern entries [0..3] — Float32 bit patterns (line-width units, recovered viauintBitsToFloatin the shader).base + 4..6pattern entries [4..6].base + 7pattern entry [7] in the high bits… and pattern length[0..8]in the low byte of the eighth slot? No — keep it simple and store len in a third half-texel.In practice we use two full texels for the 8 entries and put the length in the unused channel of the second texel's last slot. The shader unpacks the length from the same u32 bit pattern's high byte before reinterpreting the rest as a Float32. Avoids a third texel for a single byte.
Concrete layout adopted here — eight slots wide:
base + 0entry[0] (Float32 bits)base + 1entry[1]base + 2entry[2]base + 3entry[3]base + 4entry[4]base + 5entry[5]base + 6entry[6]base + 7entry[7]Pattern length is not stored here — it's reconstructed in the shader by counting trailing-zero entries (zero-padded by the CPU encoder). That keeps the texel-per-slot count to exactly two RGBA32UI texels.