Преглед изворни кода

some performances improvements in -debug

ncannasse пре 11 година
родитељ
комит
abfbac6e1c
4 измењених фајлова са 26 додато и 17 уклоњено
  1. 1 0
      h3d/Matrix.hx
  2. 1 0
      h3d/anim/LinearAnimation.hx
  3. 18 14
      hxd/res/LocalFileSystem.hx
  4. 6 3
      hxsl/Cache.hx

+ 1 - 0
h3d/Matrix.hx

@@ -213,6 +213,7 @@ class Matrix {
 		multiply(tmp, this);
 	}
 
+	@:noDebug
 	public function multiply3x4( a : Matrix, b : Matrix ) {
 		var m11 = a._11; var m12 = a._12; var m13 = a._13;
 		var m21 = a._21; var m22 = a._22; var m23 = a._23;

+ 1 - 0
h3d/anim/LinearAnimation.hx

@@ -99,6 +99,7 @@ class LinearAnimation extends Animation {
 	}
 
 	@:access(h3d.scene.Skin)
+	@:noDebug
 	override function sync( decompose = false ) {
 		if( frame == syncFrame && !decompose )
 			return;

+ 18 - 14
hxd/res/LocalFileSystem.hx

@@ -293,23 +293,27 @@ private class LocalEntry extends FileEntry {
 
 	var watchCallback : Void -> Void;
 	var watchTime : Float;
+	static var WATCH_INDEX = 0;
 	static var WATCH_LIST : Array<LocalEntry> = null;
 
 	static function checkFiles(_) {
-		for( w in WATCH_LIST ) {
-			var t = try w.file.modificationDate.getTime() catch( e : Dynamic ) -1;
-			if( t != w.watchTime ) {
-				// check we can write (might be deleted/renamed/currently writing)
-				try {
-					var f = new flash.filesystem.FileStream();
-					f.open(w.file, flash.filesystem.FileMode.READ);
-					f.close();
-					f.open(w.file, flash.filesystem.FileMode.APPEND);
-					f.close();
-				} catch( e : Dynamic ) continue;
-				w.watchTime = t;
-				w.watchCallback();
-			}
+		var w = WATCH_LIST[WATCH_INDEX++];
+		if( w == null ) {
+			WATCH_INDEX = 0;
+			return;
+		}
+		var t = try w.file.modificationDate.getTime() catch( e : Dynamic ) -1;
+		if( t != w.watchTime ) {
+			// check we can write (might be deleted/renamed/currently writing)
+			try {
+				var f = new flash.filesystem.FileStream();
+				f.open(w.file, flash.filesystem.FileMode.READ);
+				f.close();
+				f.open(w.file, flash.filesystem.FileMode.APPEND);
+				f.close();
+			} catch( e : Dynamic ) return;
+			w.watchTime = t;
+			w.watchCallback();
 		}
 	}
 

+ 6 - 3
hxsl/Cache.hx

@@ -41,6 +41,7 @@ class Cache {
 		return id;
 	}
 
+	@:noDebug
 	public function link( shaders : hxsl.ShaderList, outVars : Int ) {
 		var c = linkCache.get(outVars);
 		if( c == null ) {
@@ -57,9 +58,12 @@ class Cache {
 			}
 			c = cs;
 		}
-		if( c.linked != null )
-			return c.linked;
+		if( c.linked == null )
+			c.linked = compileRuntimeShader(shaders, outVars);
+		return c.linked;
+	}
 
+	function compileRuntimeShader( shaders : hxsl.ShaderList, outVars : Int ) {
 		var shaderDatas = [];
 		var index = 0;
 		for( s in shaders ) {
@@ -96,7 +100,6 @@ class Cache {
 			r.globals.set(v.gid, true);
 		for( v in r.fragment.globals )
 			r.globals.set(v.gid, true);
-		c.linked = r;
 		return r;
 	}