private RendererComponent[] Append(RendererComponent[] components, RendererComponent next) { Array.Resize(ref components, components.Length + 1); components[components.Length - 1] = next; return(components); }
private RenderPlan(RenderPlan previous, RendererComponent next) { this.kernel = previous.kernel; this.renderer = previous.renderer; this.resources = new Dictionary <string, Resource>(previous.resources); this.resourceLastUsed = new Dictionary <string, int>(previous.resourceLastUsed); this.components = Append(previous.components, next); var context = CreateContext(previous.finalContext); next.Initialise(renderer, context); foreach (var resource in context.Inputs) { resourceLastUsed[resource] = components.Length - 1; } foreach (var resource in context.Outputs) { if (!resources.ContainsKey(resource.Name)) { resources[resource.Name] = resource; } resourceLastUsed[resource.Name] = components.Length - 1; } this.finalContext = context; if (context.Outputs.Count > 0) { this.output = resources[context.Outputs[0].Name]; } else { this.output = previous.output; resourceLastUsed[output.Name] = components.Length - 1; } }
public RenderPlan Then(RendererComponent component) { return(new RenderPlan(this, component)); }