You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KHR_mesh_primitive_restart is the successor to the published EXT_mesh_primitive_restart extension. Instead of the EXT's mesh-level primitiveGroups JSON (one glTF primitive per sub-strip plus a separate "combined" accessor), the KHR extension has no JSON payload at all: a primitive's own indices accessor may contain inline "restart" values (the maximum value for the accessor's component type (0xff / 0xffff / 0xffffffff)). Each of these terminates the current strip and begins a new one. This allows many line strips to be batched into a single primitive, avoiding significant glTF JSON bloat for polyline-heavy assets.
We suspect CesiumJS already supports this format de facto, but not officially; there are no tests, no fixture, no docs, and no CHANGES entry.
We believe the loader never validates the core-glTF prohibition on max-value indices, so inline restart values pass through GltfLoader transparently.
WebGL 2 should have PRIMITIVE_RESTART_FIXED_INDEX behavior permanently enabled for indexed draws, so restart works on the GPU with zero renderer changes.
The original EXT primitiveGroups format has explicit handling in getMeshPrimitives.js with fixture + 6 specs in GltfLoaderSpec.js; that support should be retained for backward compatibility (for now, at least).
Proposed work
Test assets: add a KHR-format test asset (single LINE_STRIP primitive with inline restart values, extensionsUsed + extensionsRequired). Ideally a styled line-strip asset (BENTLEY_materials_line_style pattern + CUMULATIVE_DISTANCE) to exercise the styling path as well. Keep the existing EXT fixture (Specs/Data/Models/glTF-2.0/MeshPrimitiveRestart/).
Specs: add a "loads model with KHR_mesh_primitive_restart" spec to GltfLoaderSpec.js. Keep the 6 existing EXT specs.
(Optional; is this necessary?) Conformance: buildVectorGltfFromMVT.js emits inline 0xffffffff restart values in LINE_STRIP index buffers but does not seem to declare any restart extension in the generated glTF. Considering adding KHR_mesh_primitive_restart to its extensionsUsed/extensionsRequired.
Known limitations (to document, not necessarily fix)
WebGL 1: no hardware primitive restart; supporting it would require CPU index-splitting preprocessing. Not implemented.
Summary
KHR_mesh_primitive_restartis the successor to the publishedEXT_mesh_primitive_restartextension. Instead of the EXT's mesh-levelprimitiveGroupsJSON (one glTF primitive per sub-strip plus a separate "combined" accessor), the KHR extension has no JSON payload at all: a primitive's own indices accessor may contain inline "restart" values (the maximum value for the accessor's component type (0xff/0xffff/0xffffffff)). Each of these terminates the current strip and begins a new one. This allows many line strips to be batched into a single primitive, avoiding significant glTF JSON bloat for polyline-heavy assets.We suspect CesiumJS already supports this format de facto, but not officially; there are no tests, no fixture, no docs, and no CHANGES entry.
Current state
ModelUtility.supportedExtensionsalready whitelistsKHR_mesh_primitive_restart(added in Vector Tiles: Support 3DTILES_content_gltf_vector and EXT_mesh_polygon #13478 for vector tiles /3DTILES_content_gltf), soextensionsRequireddeclaring it does not throw.GltfLoadertransparently.PRIMITIVE_RESTART_FIXED_INDEXbehavior permanently enabled for indexed draws, so restart works on the GPU with zero renderer changes.primitiveGroupsformat has explicit handling ingetMeshPrimitives.jswith fixture + 6 specs inGltfLoaderSpec.js; that support should be retained for backward compatibility (for now, at least).Proposed work
LINE_STRIPprimitive with inline restart values,extensionsUsed+extensionsRequired). Ideally a styled line-strip asset (BENTLEY_materials_line_stylepattern +CUMULATIVE_DISTANCE) to exercise the styling path as well. Keep the existing EXT fixture (Specs/Data/Models/glTF-2.0/MeshPrimitiveRestart/).GltfLoaderSpec.js. Keep the 6 existing EXT specs.Model.jsJSDoc extension list to addKHR_mesh_primitive_restartlinking Add KHR_mesh_primitive_restart KhronosGroup/glTF#2569.buildVectorGltfFromMVT.jsemits inline0xffffffffrestart values inLINE_STRIPindex buffers but does not seem to declare any restart extension in the generated glTF. Considering addingKHR_mesh_primitive_restartto itsextensionsUsed/extensionsRequired.Known limitations (to document, not necessarily fix)
Related
KHR_mesh_primitive_restartspec (open)supportedExtensionswhitelist entry