Sfoglia il codice sorgente

Fix staticTexture being disposed if generated from a compute after the static load

ShiroSmith 5 anni fa
parent
commit
8310ae983a
3 ha cambiato i file con 10 aggiunte e 1 eliminazioni
  1. 5 1
      h3d/pass/DirShadowMap.hx
  2. 2 0
      h3d/pass/PointShadowMap.hx
  3. 3 0
      h3d/pass/SpotShadowMap.hx

+ 5 - 1
h3d/pass/DirShadowMap.hx

@@ -248,8 +248,12 @@ class DirShadowMap extends Shadows {
 			return;
 		draw(passes);
 		var texture = dshader.shadowMap;
-		if( staticTexture != null ) staticTexture.dispose();
+		var old = staticTexture;
 		staticTexture = texture.clone();
+		if( old != null ) old.dispose();
+		staticTexture.name = "StaticDirShadowMap";
+		staticTexture.realloc = null;
+		staticTexture.preventAutoDispose();
 		dshader.shadowMap = staticTexture;
 	}
 

+ 2 - 0
h3d/pass/PointShadowMap.hx

@@ -247,6 +247,8 @@ class PointShadowMap extends Shadows {
 		staticTexture = texture.clone();
 		if( old != null ) old.dispose();
 		staticTexture.name = "StaticPointShadowMap";
+		staticTexture.realloc = null;
+		staticTexture.preventAutoDispose();
 		pshader.shadowMap = staticTexture;
 	}
 }

+ 3 - 0
h3d/pass/SpotShadowMap.hx

@@ -166,6 +166,9 @@ class SpotShadowMap extends Shadows {
 		var old = staticTexture;
 		staticTexture = texture.clone();
 		if( old != null ) old.dispose();
+		staticTexture.name = "StaticSpotShadowMap";
+		staticTexture.realloc = null;
+		staticTexture.preventAutoDispose();
 		sshader.shadowMap = staticTexture;
 	}
 }