فهرست منبع

only set realloc for texture cache allocated targets

Nicolas Cannasse 4 سال پیش
والد
کامیت
1357a76d2b
4فایلهای تغییر یافته به همراه3 افزوده شده و 5 حذف شده
  1. 2 0
      h3d/impl/TextureCache.hx
  2. 0 4
      h3d/mat/Texture.hx
  3. 1 0
      h3d/pass/PointShadowMap.hx
  4. 0 1
      h3d/scene/pbr/Environment.hx

+ 2 - 0
h3d/impl/TextureCache.hx

@@ -60,6 +60,8 @@ class TextureCache {
 		var flags : Array<h3d.mat.Data.TextureFlags> = [Target];
 		if( isCube ) flags.push(Cube);
 		var newt = new h3d.mat.Texture(width, height, flags, format);
+		// make the texture disposable if we're out of memory
+		newt.realloc = function() {};
 		if( t != null )
 			cache.insert(position,newt);
 		else

+ 0 - 4
h3d/mat/Texture.hx

@@ -100,10 +100,6 @@ class Texture {
 		if( tw != w || th != h )
 			this.flags.set(IsNPOT);
 
-		// make the texture disposable if we're out of memory
-		// this can be disabled after allocation by reseting realloc
-		if( this.flags.has(Target) ) realloc = function() { };
-
 		this.width = w;
 		this.height = h;
 		this.mipMap = this.flags.has(MipMapped) ? Nearest : None;

+ 1 - 0
h3d/pass/PointShadowMap.hx

@@ -159,6 +159,7 @@ class PointShadowMap extends Shadows {
 		if( tmpTex != null) return tmpTex;
 		tmpTex = new h3d.mat.Texture(1,1, [Target,Cube], format);
 		tmpTex.name = "defaultCubeShadowMap";
+		tmpTex.realloc = function() clear(tmpTex);
 		clear(tmpTex);
 		return tmpTex;
 	}

+ 0 - 1
h3d/scene/pbr/Environment.hx

@@ -279,7 +279,6 @@ class Environment {
 		pass.shader.texture = source;
 		pass.shader.aboveThresholdScale = scale;
 		pass.shader.threshold = threshold;
-		env.realloc = null;
 		for( i in 0...6 ) {
 			engine.pushTarget(env,i);
 			pass.shader.faceMatrix = getCubeMatrix(i);