فهرست منبع

Fix some leaks

ShiroSmith 6 سال پیش
والد
کامیت
07eefe7a2e
5فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 1 0
      h3d/pass/DirShadowMap.hx
  2. 1 0
      h3d/pass/SpotShadowMap.hx
  3. 1 0
      h3d/scene/Scene.hx
  4. 6 0
      h3d/scene/pbr/Light.hx
  5. 5 0
      h3d/scene/pbr/Renderer.hx

+ 1 - 0
h3d/pass/DirShadowMap.hx

@@ -34,6 +34,7 @@ class DirShadowMap extends Shadows {
 	override function dispose() {
 		super.dispose();
 		if( customDepth && depth != null ) depth.dispose();
+		border.dispose();
 	}
 
 	public override function getShadowTex() {

+ 1 - 0
h3d/pass/SpotShadowMap.hx

@@ -40,6 +40,7 @@ class SpotShadowMap extends Shadows {
 	override function dispose() {
 		super.dispose();
 		if( customDepth && depth != null ) depth.dispose();
+		border.dispose();
 	}
 
 	public override function getShadowTex() {

+ 1 - 0
h3d/scene/Scene.hx

@@ -245,6 +245,7 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 			hardwarePass.dispose();
 			hardwarePass = null;
 		}
+		ctx.dispose();
 		renderer.dispose();
 		renderer = new Renderer();
 	}

+ 6 - 0
h3d/scene/pbr/Light.hx

@@ -14,6 +14,12 @@ class Light extends h3d.scene.Light {
 		if( shadows == null ) shadows = new h3d.pass.Shadows(this);
 	}
 
+	override function dispose() {
+		super.dispose();
+		if( shadows != null ) shadows.dispose();
+		if( primitive != null ) primitive.dispose();
+	}
+
 	override function sync(ctx) {
 		super.sync(ctx);
 		if(isMainLight){

+ 5 - 0
h3d/scene/pbr/Renderer.hx

@@ -116,6 +116,11 @@ class Renderer extends h3d.scene.Renderer {
 		refreshProps();
 	}
 
+	override function dispose() {
+		super.dispose();
+		env.dispose();
+	}
+
 	inline function get_exposure() return tonemap.shader.exposure;
 	inline function set_exposure(v:Float) return tonemap.shader.exposure = v;