CPU-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.
ReadonlypassPer-pass primitive ranges.
Each entry defines a contiguous segment within the packed primitive buffer.
ReadonlyprimFull range of drawable primitives across all visible portions and all registered passes.
This is useful for passes such as picking that want to consider all visible primitives regardless of render pass.
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 ReadonlyitemSize of a single item in bytes.
Each item stores:
meshIndex (uint32)offset (uint32)Number of allocated primitives across all portions, including invisible ones.
Number of primitives currently drawable after the most recent packing pass.
This counts only visible primitives in registered render passes.
ProtectedcancelCancels any pending uploads.
This clears the dirty flag without modifying the current buffer contents.
Checks if a new portion of the given size fits within capacity.
This check considers allocation only and ignores visibility/culling.
Number of items to allocate.
Allocates a portion belonging to a given render pass.
The render pass must already be registered.
Number of items in the portion.
Mesh index for the portion.
Render pass ID.
Frees a previously allocated portion.
Portion handle.
Frees GPU resources and clears internal state.
Gets the total capacity in bytes of the data texture.
Gets the mesh index and primitive offset for a packed primitive index.
The offset is the primitive index within its mesh. For example, for a triangle mesh,
the offset will be 0 for the first triangle, 1 for the second triangle, and so on.
Packed primitive index.
Retrieves all logical items currently stored in this texture.
An array of decoded items.
Gets the first/count range for a render pass.
If the pass has no drawable primitives, a zero-length range is returned.
Render pass ID.
Gets the full range of drawable primitives, for picking or other whole-buffer passes.
This can be used for passes that want to consider all visible primitives regardless of render pass.
Gets the ordered list of registered render pass IDs.
The returned array is a copy and can be safely modified by the caller.
Gets the used capacity in bytes of the data texture.
Checks whether a render pass is currently registered.
Render pass ID.
Gets the current visibility of a portion.
This mirrors the original behavior: if the handle is still known by the texture, visibility is read from internal state; otherwise the visibility recorded on the handle is returned as a fallback.
Portion handle.
ProtectednotifyInternalNotifies listeners that the data texture has been updated.
Registers a render pass at runtime.
If the pass is already registered, this is a no-op.
Ordering can optionally be controlled relative to an existing pass.
If neither before nor after is provided, the pass is appended.
Unique pass ID.
Optionaloptions: RegisterRenderPassOptionsOptional ordering constraints.
Sets the mesh-level visibility of a portion.
Portion handle.
Whether the portion is visible at the mesh level.
Sets the object-level visibility of a portion.
Portion handle.
Whether the portion is visible at the object level.
Changes a portion's render pass.
The target render pass must already be registered.
Portion handle.
New render pass ID.
Unregisters a render pass.
By default this throws if any portions are still assigned to the pass. Callers may instead choose to move or hide those portions.
If the pass is not registered, this is a no-op.
Render pass ID to remove.
Optionaloptions: UnregisterRenderPassOptionsBehavior for portions still assigned to the pass.
Uploads the current CPU buffer if dirty and rebuilds packed runs when necessary.
Internal algorithm:
false.false.true if a GPU upload occurred, otherwise false.
StaticdecodeDecodes a linear address into (x, y) for a 2D table with known width.
Linear address.
Table width.
StaticencodeEncodes (x, y) into a linear address for a 2D table with known width.
X coordinate.
Y coordinate.
Table width.
GPU data texture mapping each primitive to its owning mesh for a given render pass.
PrimitiveMeshIndexTextureis a GPU-resident table used by the renderer to efficiently determine, for each primitive (triangle, line, or point), which mesh it belongs to and its offset within that mesh.Structure
uint32values:meshIndex: index of the owning meshoffset: primitive index within that meshmeshIndex)renderPass)Render pass model
Visibility
A portion is included in packing only when both:
objectVisible === truemeshVisible === trueInvisible portions remain allocated, but do not contribute to packed primitive ranges.
Usage
Typical flow: