Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,16 @@ export class PreviewManager {

this._scene = scene;

this._dummyExternalTexture?.dispose();
const dummyTexture = this._dummyExternalTexture;

// The texture could be used by the command buffer that will be processed at the end of the frame, so we can't dispose it immediately
// We must call setTimeout(0) two times to make sure we dispose the texture at the right time (the first setTimeout(0) executes just after _initSceneAsync has been processed because it is async, which is too soon)
setTimeout(() => {
setTimeout(() => {
dummyTexture?.dispose();
}, 0);
}, 0);

this._dummyExternalTexture = new Texture("https://assets.babylonjs.com/textures/Checker_albedo.png", this._scene, true);
this._dummyExternalTexture.name = "Dummy external texture for preview NRGE";

Expand Down
Loading