// Get the input and output types for this function (assumed to be an entry point)
 static void GetInOutTypes(ShaderFunction function, out ShaderType inputType, out ShaderType outputType)
 {
     inputType = outputType = ShaderType.Invalid;
     if (function.IsValid)
     {
         outputType = function.ReturnType;
         var parameters = function.Parameters.GetEnumerator();
         if (parameters.MoveNext())
         {
             inputType = parameters.Current.Type;
         }
     }
 }
            static List <BlockVariable> BuildVariablesFromTypeFields(ShaderContainer container, ShaderType type)
            {
                var results = new List <BlockVariable>();

                foreach (var field in type.StructFields)
                {
                    var builder = new BlockVariable.Builder(container);
                    builder.Name = field.Name;
                    builder.Type = field.Type;
                    foreach (var attribute in field.Attributes)
                    {
                        builder.AddAttribute(attribute);
                    }
                    results.Add(builder.Build());
                }
                return(results);
            }
 public void AddReferencedType(ShaderType type)
 {
     referencedTypes.Add(type);
 }
 internal void AddType(ShaderType type)
 {
     types.Add(type);
 }
Esempio n. 5
0
            public void AddOutput(ShaderType type, string name)
            {
                var paramBuilder = new FunctionParameter.Builder(container, name, type, false, true);

                AddParameter(paramBuilder.Build());
            }
Esempio n. 6
0
 // Construct a function with specified return type in the specified block scope
 public Builder(ShaderFoundry.Block.Builder blockBuilder, string name, ShaderType returnType)
     : this(blockBuilder.Container, name, returnType, blockBuilder)
 {
 }
Esempio n. 7
0
 // Construct a function with specified return type in the global scope
 public Builder(ShaderContainer container, string name, ShaderType returnType)
     : this(container, name, returnType, null)
 {
 }