Răsfoiți Sursa

fixed null fullback shader pre-compilation

ncannasse 6 ani în urmă
părinte
comite
8dd92dc6bb
1 a modificat fișierele cu 12 adăugiri și 2 ștergeri
  1. 12 2
      hxsl/CacheFile.hx

+ 12 - 2
hxsl/CacheFile.hx

@@ -96,8 +96,18 @@ class CacheFile extends Cache {
 			log(runtimeShaders.length+" shaders loaded in "+hxd.Math.fmt(haxe.Timer.stamp() - t0)+"s");
 		} else if( !allowCompile )
 			throw "Missing " + file;
-		if( linkCache.linked == null )
-			linkCache.linked = link(makeDefaultShader());
+		if( linkCache.linked == null ) {
+			var rt = link(makeDefaultShader());
+			linkCache.linked = rt;
+			if( rt.vertex.code == null || rt.fragment.code == null ) {
+				if( !allowCompile ) throw "Missing default shader code";
+				waitCount++;
+				haxe.Timer.delay(function() {
+					h3d.Engine.getCurrent().selectShader(rt);
+					addNewShader(rt);
+				}, 1000);
+			}
+		}
 		isLoading = false;
 	}