|
@@ -165,7 +165,10 @@ class Linker {
|
|
debug(curShader.name + " read " + v.path);
|
|
debug(curShader.name + " read " + v.path);
|
|
curShader.read.set(v.id, v);
|
|
curShader.read.set(v.id, v);
|
|
// if we read a varying, force into fragment
|
|
// if we read a varying, force into fragment
|
|
- if( v.v.kind == Var ) curShader.vertex = false;
|
|
|
|
|
|
+ if( curShader.vertex == null && v.v.kind == Var ) {
|
|
|
|
+ debug("Force " + curShader.name+" into fragment (use varying)");
|
|
|
|
+ curShader.vertex = false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return { e : TVar(v.v), t : v.v.type, p : e.p };
|
|
return { e : TVar(v.v), t : v.v.type, p : e.p };
|
|
case TBinop(op, e1, e2):
|
|
case TBinop(op, e1, e2):
|
|
@@ -254,10 +257,14 @@ class Linker {
|
|
cur.onStack = true;
|
|
cur.onStack = true;
|
|
for( d in cur.deps.keys() )
|
|
for( d in cur.deps.keys() )
|
|
collect(d, out, vertex);
|
|
collect(d, out, vertex);
|
|
- if( cur.vertex == null )
|
|
|
|
|
|
+ if( cur.vertex == null ) {
|
|
|
|
+ debug("MARK " + cur.name+" " + (vertex?"vertex":"fragment"));
|
|
cur.vertex = vertex;
|
|
cur.vertex = vertex;
|
|
- if( cur.vertex == vertex )
|
|
|
|
|
|
+ }
|
|
|
|
+ if( cur.vertex == vertex ) {
|
|
|
|
+ debug("COLLECT " + cur.name + " " + (vertex?"vertex":"fragment"));
|
|
out.push(cur);
|
|
out.push(cur);
|
|
|
|
+ }
|
|
cur.onStack = false;
|
|
cur.onStack = false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -281,6 +288,7 @@ class Linker {
|
|
}
|
|
}
|
|
|
|
|
|
public function link( shadersData : Array<ShaderData>, outVars : Array<String> ) : ShaderData {
|
|
public function link( shadersData : Array<ShaderData>, outVars : Array<String> ) : ShaderData {
|
|
|
|
+ debug("---------------------- LINKING -----------------------");
|
|
varMap = new Map();
|
|
varMap = new Map();
|
|
varIdMap = new Map();
|
|
varIdMap = new Map();
|
|
allVars = new Array();
|
|
allVars = new Array();
|