public Builder(ShaderContainer container, string name, ITemplateLinker linker)
            {
                if (container == null || linker == null)
                {
                    throw new Exception("A valid ShaderContainer and ITemplateLinker must be provided to create a Template Builder.");
                }

                this.container = container;
                this.Name      = name;
                this.linker    = linker;
            }
Ejemplo n.º 2
0
        internal FoundryHandle AddTemplateLinker(ITemplateLinker linker)
        {
            // If the linker is either null, or has already been added, we return an invalid handle
            if (linker == null)
            {
                throw new Exception("Registering a null template linker is not valid.");
            }

            var existingLinkerIndex = m_TemplateLinkers.FindIndex((l) => (l == linker));

            if (existingLinkerIndex != -1)
            {
                throw new Exception($"Template linker '{linker}' has already been registered.");
            }

            FoundryHandle handle = new FoundryHandle();

            handle.Handle = (uint)m_TemplateLinkers.Count;
            m_TemplateLinkers.Add(linker);

            return(handle);
        }