Pārlūkot izejas kodu

Merge pull request #9734 from Popov72/contextlost-dumpinfo

NME texture blocks: dispose textures when disposing of blocks
David Catuhe 4 gadi atpakaļ
vecāks
revīzija
888cadfa99

+ 5 - 5
nodeEditor/src/components/preview/previewManager.ts

@@ -460,7 +460,7 @@ export class PreviewManager {
                     }
 
                     if (this._material) {
-                        this._material.dispose();
+                        this._material.dispose(false, true);
                     }
                     this._material = tempMaterial;
                     break;
@@ -471,7 +471,7 @@ export class PreviewManager {
                     this._proceduralTexture = tempMaterial.createProceduralTexture(512, this._scene);
 
                     if (this._material) {
-                        this._material.dispose();
+                        this._material.dispose(false, true);
                     }
 
                     if (this._layer) {
@@ -495,7 +495,7 @@ export class PreviewManager {
                     tempMaterial.createEffectForParticles(this._particleSystem!);
 
                     if (this._material) {
-                        this._material.dispose();
+                        this._material.dispose(false, true);
                     }
                     this._material = tempMaterial;
                     break;
@@ -512,7 +512,7 @@ export class PreviewManager {
                                 }
 
                                 if (this._material) {
-                                    this._material.dispose();
+                                    this._material.dispose(false, true);
                                 }
 
                                 this._material = tempMaterial;
@@ -545,7 +545,7 @@ export class PreviewManager {
         this._globalState.onLightUpdated.remove(this._onLightUpdatedObserver);
 
         if (this._material) {
-            this._material.dispose();
+            this._material.dispose(false, true);
         }
 
         this._camera.dispose();

+ 0 - 5
src/Materials/Node/Blocks/Dual/currentScreenBlock.ts

@@ -300,11 +300,6 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
             this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;
         }
     }
-
-    public dispose() {
-        super.dispose();
-        this.texture?.dispose();
-    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.CurrentScreenBlock"] = CurrentScreenBlock;

+ 0 - 5
src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts

@@ -459,11 +459,6 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock {
             }
         }
     }
-
-    public dispose() {
-        super.dispose();
-        this.texture?.dispose();
-    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.ReflectionTextureBaseBlock"] = ReflectionTextureBaseBlock;

+ 0 - 5
src/Materials/Node/Blocks/Dual/textureBlock.ts

@@ -453,11 +453,6 @@ export class TextureBlock extends NodeMaterialBlock {
             this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;
         }
     }
-
-    public dispose() {
-        super.dispose();
-        this.texture?.dispose();
-    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.TextureBlock"] = TextureBlock;

+ 0 - 5
src/Materials/Node/Blocks/PBR/refractionBlock.ts

@@ -349,11 +349,6 @@ export class RefractionBlock extends NodeMaterialBlock {
         this.linkRefractionWithTransparency = serializationObject.linkRefractionWithTransparency;
         this.invertRefractionY = serializationObject.invertRefractionY;
     }
-
-    public dispose() {
-        super.dispose();
-        this.texture?.dispose();
-    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.RefractionBlock"] = RefractionBlock;

+ 0 - 5
src/Materials/Node/Blocks/Particle/particleTextureBlock.ts

@@ -218,11 +218,6 @@ export class ParticleTextureBlock extends NodeMaterialBlock {
             this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;
         }
     }
-
-    public dispose() {
-        super.dispose();
-        this.texture?.dispose();
-    }
 }
 
 _TypeStore.RegisteredTypes["BABYLON.ParticleTextureBlock"] = ParticleTextureBlock;