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
Describe the bug
While loading a big xkt file using the xeokitSdk.XKTLoaderPlugin the load method entered into an infinite loop.
After debugging the issue, I found out that the code got stuck in this loop inside the _getVBOBatchingLayer method of the SceneModel class:
while (!vboBatchingLayer) {
switch (cfg.primitive) {
case "triangles":
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
vboBatchingLayer = new VBOBatchingTrianglesLayer({
model,
textureSet,
layerIndex: 0, // This is set in #finalize()
scratchMemory: this._vboBatchingLayerScratchMemory,
positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined
uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined
origin,
maxGeometryBatchSize: this._maxGeometryBatchSize,
solid: (cfg.primitive === "solid"),
autoNormals: true
});
break;
case "solid":
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
vboBatchingLayer = new VBOBatchingTrianglesLayer({
model,
textureSet,
layerIndex: 0, // This is set in #finalize()
scratchMemory: this._vboBatchingLayerScratchMemory,
positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined
uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined
origin,
maxGeometryBatchSize: this._maxGeometryBatchSize,
solid: (cfg.primitive === "solid"),
autoNormals: true
});
break;
case "surface":
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
vboBatchingLayer = new VBOBatchingTrianglesLayer({
model,
textureSet,
layerIndex: 0, // This is set in #finalize()
scratchMemory: this._vboBatchingLayerScratchMemory,
positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined
uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined
origin,
maxGeometryBatchSize: this._maxGeometryBatchSize,
solid: (cfg.primitive === "solid"),
autoNormals: true
});
break;
case "lines":
// console.info(`[SceneModel ${this.id}]: creating VBOBatchingLinesLayer`);
vboBatchingLayer = new VBOBatchingLinesLayer({
model,
layerIndex: 0, // This is set in #finalize()
scratchMemory: this._vboBatchingLayerScratchMemory,
positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined
uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined
origin,
maxGeometryBatchSize: this._maxGeometryBatchSize
});
break;
case "points":
// console.info(`[SceneModel ${this.id}]: creating VBOBatchingPointsLayer`);
vboBatchingLayer = new VBOBatchingPointsLayer({
model,
layerIndex: 0, // This is set in #finalize()
scratchMemory: this._vboBatchingLayerScratchMemory,
positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined
uvDecodeMatrix: cfg.uvDecodeMatrix, // Can be undefined
origin,
maxGeometryBatchSize: this._maxGeometryBatchSize
});
break;
}
const lenPositions = cfg.positionsCompressed ? cfg.positionsCompressed.length : cfg.positions.length;
const canCreatePortion = (cfg.primitive === "points")
? vboBatchingLayer.canCreatePortion(lenPositions)
: vboBatchingLayer.canCreatePortion(lenPositions, cfg.indices.length);
if (!canCreatePortion) {
vboBatchingLayer.finalize();
delete this._vboBatchingLayers[layerId];
vboBatchingLayer = null;
}
}
It seems that if the requested geometry doesn't pass the canCreatePortion check the code goes into infinite loop.
Steps to reproduce the behavior:
Load a xkt file large enough to not pass the canCreatePortion check
Expected behavior
The falsy case should be handled properly. Worst scenario could be raise a proper error
Desktop:
OS: Windows
Browser Chrome
Version 2.6.6 (Before opening the bug, I also checked and the code is the same also in newer versions)
The text was updated successfully, but these errors were encountered:
Right, we've probably never hit this condition because we're always splitting conversion into multiple smaller XKT files (like here).
BTW if that loop never ends, then it means WebGL is out of memory for your model, a dire situation, but we'll at least be optimistic and add a recovery attempt of some sort.
Are you able to provide your XKT file so we can test the fix?
Unfortunately we can't share with you the XKT files because they cannot be disclosed as they are property of a client.
If you want, we can still test your fixes in our environment before releasing.
If it cab be helpful, those files were working with the 2.3.5 version of @xeokit/xeokit-sdk.
Describe the bug
While loading a big xkt file using the
xeokitSdk.XKTLoaderPlugin
theload
method entered into an infinite loop.After debugging the issue, I found out that the code got stuck in this loop inside the
_getVBOBatchingLayer
method of theSceneModel
class:It seems that if the requested geometry doesn't pass the
canCreatePortion
check the code goes into infinite loop.Steps to reproduce the behavior:
canCreatePortion
checkExpected behavior
The falsy case should be handled properly. Worst scenario could be raise a proper error
Desktop:
The text was updated successfully, but these errors were encountered: