Skip to content
Browse files

Propagating depdency information properly now. This is a fix to issue…

…s caused by 5f66df7.
  • Loading branch information...
1 parent 0904cc1 commit 362c18e1cf3df8261e7450bf0558db2116a5e353 @WolfgangSt WolfgangSt committed Oct 17, 2011
Showing with 11 additions and 6 deletions.
  1. +5 −2 IIS.SLSharp/Shaders/Shader.Context.cs
  2. +6 −4 IIS.SLSharp/Shaders/Shader.cs
View
7 IIS.SLSharp/Shaders/Shader.Context.cs
@@ -25,11 +25,14 @@ public struct UnitContext
{
public readonly List<FunctionDescription> Functions;
public readonly List<string> ForwardDeclarations;
+ public readonly List<Type> Dependencies;
- public UnitContext(List<FunctionDescription> functions, List<string> forwardDeclarations)
+ public UnitContext(List<FunctionDescription> functions, List<string> forwardDeclarations,
+ List<Type> dependencies)
{
Functions = functions;
ForwardDeclarations = forwardDeclarations;
+ Dependencies = dependencies;
}
}
@@ -183,7 +186,7 @@ private UnitContext CollectFuncs<T>(ShaderType type)
}
var forwardDecl = trans.ForwardDeclare(DebugMode);
- return new UnitContext(desc, forwardDecl);
+ return new UnitContext(desc, forwardDecl, trans.Dependencies.ToList());
}
// shaderType = GetShaderType()
View
10 IIS.SLSharp/Shaders/Shader.cs
@@ -44,6 +44,8 @@ public abstract partial class Shader : ShaderDefinition, IDisposable
private Shader _parentLogic;
+ private List<Type> _dependencies = new List<Type>(); // SL# shaders, this shader depends on
+
private Type GetImplementingType()
{
var t = GetType();
@@ -96,10 +98,12 @@ private void CompileShader(ShaderType type)
throw new NotImplementedException();
}
- var desc = new SourceDescription(unit.Functions, _context.Uniforms, _context.Attribs, _context.Varyings, _context.Ins, _context.Outs, unit.ForwardDeclarations);
+ var desc = new SourceDescription(unit.Functions, _context.Uniforms, _context.Attribs, _context.Varyings, _context.Ins, _context.Outs,
+ unit.ForwardDeclarations);
var shader = Binding.Active.Compile(this, type, desc);
+ _dependencies = _dependencies.Union(unit.Dependencies).ToList();
_objects.Add(shader);
}
@@ -136,9 +140,7 @@ protected void Link(Shader[] libaries = null, int version = 130)
Compile();
e = e.Concat(_objects);
- // TODO: this smells hacky, we need refactoring in the transform logic...
- var deps = Binding.Active.Transform.Dependencies;
- foreach (var dep in deps)
+ foreach (var dep in _dependencies)
{
if (!compiled.Add(dep))
continue;

0 comments on commit 362c18e

Please sign in to comment.
Something went wrong with that request. Please try again.