Bladeren bron

minor fixes

ncannasse 7 jaren geleden
bovenliggende
commit
827c6ee6a6
2 gewijzigde bestanden met toevoegingen van 8 en 4 verwijderingen
  1. 7 3
      hxsl/CacheFile.hx
  2. 1 1
      hxsl/CacheFileBuilder.hx

+ 7 - 3
hxsl/CacheFile.hx

@@ -227,8 +227,12 @@ class CacheFile extends Cache {
 				if( sdata == null ) break;
 				var r : RuntimeShader = haxe.Unserializer.run(sdata);
 				var spec = rtMap.get(r.signature);
-				r.signature = spec.signature;
 
+				// shader was modified
+				if( spec == null )
+					continue;
+
+				r.signature = spec.signature;
 				var shaderList = null;
 				spec.inst.reverse();
 				for( i in spec.inst ) {
@@ -454,7 +458,7 @@ class CacheFile extends Cache {
 	**/
 	function cleanRuntime( r : RuntimeShader ) {
 		var rc = new RuntimeShader();
-		rc.id = r.id;
+		rc.id = 0;
 		rc.signature = r.spec.signature; // store by spec, not by sign (dups)
 		rc.vertex = cleanRuntimeData(r.vertex);
 		rc.fragment = cleanRuntimeData(r.fragment);
@@ -498,7 +502,7 @@ class CacheFile extends Cache {
 		Puts things back after we load a cleaned up runtime shader
 	**/
 	function reviveRuntime( r : RuntimeShader ) {
-		@:privateAccess if( RuntimeShader.UID <= r.id ) RuntimeShader.UID = r.id + 1;
+		r.id = @:privateAccess hxsl.RuntimeShader.UID++;
 		r.globals = new Map();
 		reviveRuntimeData(r, r.vertex);
 		reviveRuntimeData(r, r.fragment);

+ 1 - 1
hxsl/CacheFileBuilder.hx

@@ -68,7 +68,7 @@ class CacheFileBuilder {
 	}
 
 	function binaryPayload( data : haxe.io.Bytes ) {
-		return "\nBIN=" + haxe.crypto.Base64.encode(data) + "#";
+		return "\n//BIN=" + haxe.crypto.Base64.encode(data) + "#\n";
 	}
 
 	public function compileShader( r : RuntimeShader, rd : RuntimeShader.RuntimeShaderData ) : String {