Restore after context lost issue

https://playground.babylonjs.com/#U2CRTI

If a mesh in a scene has never been in view (so never rendered), then after restoring from a context lost, moving the camera so the mesh is in view causes a crash due to indexing into an undefined array (_bufferData).

This is due to the _rebuildBuffers() call here, calling uniformBuffer._rebuild() on all uniform buffers here, even if create hasn’t been called on that uniformBuffer yet.
This results in a state where this._buffer is defined, but this._bufferData is still undefined (this being a uniformBuffer).

Will add a test for this._bufferData to exist :smiley:

Thanks a lot

1 Like