Example #1
0
        IEnumerable <BlockVariable> GetVariableEnumerable(FoundryHandle listHandle)
        {
            var localContainer = Container;
            var list           = new FixedHandleListInternal(listHandle);

            return(list.Select <BlockVariable>(localContainer, (handle) => (new BlockVariable(localContainer, handle))));
        }
Example #2
0
        IEnumerable <TemplatePassStageElement> GetStageElements(FoundryHandle stageElementListHandle)
        {
            var localContainer = Container;
            var list           = new FixedHandleListInternal(stageElementListHandle);

            return(list.Select(localContainer, (handle) => (new TemplatePassStageElement(localContainer, handle))));
        }
 internal IEnumerable <StructField> StructFields(ShaderContainer container)
 {
     if (IsStruct)
     {
         var list = new FixedHandleListInternal(m_v0);
         return(list.Select <StructField>(container, (handle) => (new StructField(container, handle))));
     }
     return(Enumerable.Empty <StructField>());
 }
Example #4
0
            public StructField Build()
            {
                var structFieldInternal = new StructFieldInternal();

                structFieldInternal.m_NameHandle          = container.AddString(name);
                structFieldInternal.m_TypeHandle          = type.handle;
                structFieldInternal.m_AttributeListHandle = FixedHandleListInternal.Build(container, attributes, (a) => (a.handle));
                var returnHandle = container.AddStructFieldInternal(structFieldInternal);

                return(new StructField(container, returnHandle));
            }
            public TemplateInstance Build()
            {
                var templateInstanceInternal = new TemplateInstanceInternal();

                templateInstanceInternal.m_TemplateHandle = template.handle;
                templateInstanceInternal.m_CustomizationPointListHandle = FixedHandleListInternal.Build(container, customizationPointInstances, (o) => (o.handle));
                templateInstanceInternal.m_TagDescriptorListHandle      = FixedHandleListInternal.Build(container, tagDescriptors, (o) => (o.handle));

                var returnTypeHandle = container.AddTemplateInstanceInternal(templateInstanceInternal);

                return(new TemplateInstance(container, returnTypeHandle));
            }
            public CustomizationPointInstance Build()
            {
                var customizationPointInstanceInternal = new CustomizationPointInstanceInternal()
                {
                    m_CustomizationPointHandle = customizationPoint.handle,
                };

                customizationPointInstanceInternal.m_BlockInstanceListHandle  = FixedHandleListInternal.Build(container, BlockInstances, (v) => (v.handle));
                customizationPointInstanceInternal.m_PassIdentifierListHandle = FixedHandleListInternal.Build(container, PassIdentifiers, (p) => (container.AddPassIdentifier(p.SubShaderIndex, p.PassIndex)));

                var returnTypeHandle = container.AddCustomizationPointInstanceInternal(customizationPointInstanceInternal);

                return(new CustomizationPointInstance(container, returnTypeHandle));
            }
Example #7
0
        // only for use by the Builder
        ShaderFunction(ShaderContainer container, FoundryHandle functionHandle, string name, string body, FoundryHandle returnTypeHandle, List <FunctionParameter> parameters, FoundryHandle parentBlockHandle)
        {
            this.container = container;
            if (container != null)
            {
                FoundryHandle parametersList = FixedHandleListInternal.Build(container, parameters, (p) => (p.handle));
                handle = functionHandle;
                container.SetFunction(functionHandle, name, body, returnTypeHandle, parametersList, parentBlockHandle);
                function = container.GetFunction(handle);
                return;
            }

            // failure
            this = Invalid;
        }
Example #8
0
            public CustomizationPoint Build()
            {
                var customizationPointInternal = new CustomizationPointInternal
                {
                    m_NameHandle = container.AddString(name),
                };

                customizationPointInternal.m_InputListHandle          = FixedHandleListInternal.Build(container, inputs, (v) => (v.handle));
                customizationPointInternal.m_OutputListHandle         = FixedHandleListInternal.Build(container, outputs, (v) => (v.handle));
                customizationPointInternal.m_PropertyListHandle       = FixedHandleListInternal.Build(container, properties, (v) => (v.handle));
                customizationPointInternal.m_DefaultBlockInstanceList = FixedHandleListInternal.Build(container, defaultBlockInstances, (v) => (v.handle));

                var returnTypeHandle = container.AddCustomizationPointInternal(customizationPointInternal);

                return(new CustomizationPoint(container, returnTypeHandle));
            }
            public Template Build()
            {
                var templateInternal = new TemplateInternal()
                {
                    m_NameHandle = container.AddString(Name),
                    m_AdditionalShaderIDStringHandle = container.AddString(AdditionalShaderID),
                    m_LinkerHandle = container.AddTemplateLinker(linker)
                };

                templateInternal.m_PassListHandle          = FixedHandleListInternal.Build(container, passes, (p) => (p.handle));
                templateInternal.m_TagDescriptorListHandle = FixedHandleListInternal.Build(container, tagDescriptors, (t) => (t.handle));

                var returnTypeHandle = container.AddTemplateInternal(templateInternal);

                return(new Template(container, returnTypeHandle));
            }
Example #10
0
            public TemplatePass Build()
            {
                var templatePassInternal = new TemplatePassInternal()
                {
                    m_DisplayNameHandle   = container.AddString(displayName),
                    m_ReferenceNameHandle = container.AddString(referenceName),
                };

                templatePassInternal.m_PassIdentifierHandle           = container.AddPassIdentifier(passIdentifier.SubShaderIndex, passIdentifier.PassIndex);
                templatePassInternal.m_VertexStageElementListHandle   = FixedHandleListInternal.Build(container, vertexStageElements, (e) => BuildStageElement(e));
                templatePassInternal.m_FragmentStageElementListHandle = FixedHandleListInternal.Build(container, fragmentStageElements, (e) => BuildStageElement(e));
                templatePassInternal.m_TagDescriptorListHandle        = FixedHandleListInternal.Build(container, tagDescriptors, (o) => (o.handle));

                var returnTypeHandle = container.AddTemplatePassInternal(templatePassInternal);

                return(new TemplatePass(container, returnTypeHandle));
            }
            public Block Build()
            {
                if (finalized)
                {
                    return(new Block(Container, blockHandle));
                }
                finalized = true;

                var blockInternal = new BlockInternal();

                blockInternal.m_NameHandle = container.AddString(name);

                blockInternal.m_DeclaredTypeListHandle       = FixedHandleListInternal.Build(container, types, (t) => (t.handle));
                blockInternal.m_ReferencedTypeListHandle     = FixedHandleListInternal.Build(container, referencedTypes, (t) => (t.handle));
                blockInternal.m_DeclaredFunctionListHandle   = FixedHandleListInternal.Build(container, functions, (f) => (f.handle));
                blockInternal.m_ReferencedFunctionListHandle = FixedHandleListInternal.Build(container, referencedFunctions, (f) => (f.handle));
                blockInternal.m_EntryPointFunctionHandle     = entryPointFunction.handle;

                // Build up the input/output variable list from the entry point function
                GetInOutTypes(entryPointFunction, out var inputType, out var outputType);
                var inputs  = BuildVariablesFromTypeFields(Container, inputType);
                var outputs = BuildVariablesFromTypeFields(Container, outputType);

                blockInternal.m_InputVariableListHandle  = FixedHandleListInternal.Build(container, inputs, (v) => (v.handle));
                blockInternal.m_OutputVariableListHandle = FixedHandleListInternal.Build(container, outputs, (v) => (v.handle));

                blockInternal.m_CommandListHandle    = FixedHandleListInternal.Build(container, m_Commands, (c) => (c.handle));
                blockInternal.m_DefineListHandle     = FixedHandleListInternal.Build(container, m_Defines, (d) => (d.handle));
                blockInternal.m_IncludeListHandle    = FixedHandleListInternal.Build(container, m_Includes, (i) => (i.handle));
                blockInternal.m_KeywordListHandle    = FixedHandleListInternal.Build(container, m_Keywords, (k) => (k.handle));
                blockInternal.m_PragmaListHandle     = FixedHandleListInternal.Build(container, m_Pragmas, (p) => (p.handle));
                blockInternal.m_PassParentHandle     = passParentHandle;
                blockInternal.m_TemplateParentHandle = templateParentHandle;

                container.SetBlockInternal(blockHandle, blockInternal);
                return(new Block(container, blockHandle));
            }
Example #12
0
        internal IEnumerable <ShaderAttribute> Attributes(ShaderContainer container)
        {
            var list = new FixedHandleListInternal(m_AttributeListHandle);

            return(list.Select <ShaderAttribute>(container, (handle) => (new ShaderAttribute(container, handle))));
        }
        internal IEnumerable <IncludeDescriptor> Includes(ShaderContainer container)
        {
            var list = new FixedHandleListInternal(m_IncludeListHandle);

            return(list.Select <IncludeDescriptor>(container, (handle) => (new IncludeDescriptor(container, handle))));
        }