Exemplo n.º 1
0
 // 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;
         }
     }
 }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
 public void AddReferencedType(ShaderType type)
 {
     referencedTypes.Add(type);
 }
Exemplo n.º 4
0
 internal void AddType(ShaderType type)
 {
     types.Add(type);
 }
Exemplo n.º 5
0
            public void AddOutput(ShaderType type, string name)
            {
                var paramBuilder = new FunctionParameter.Builder(container, name, type, false, true);

                AddParameter(paramBuilder.Build());
            }
Exemplo 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)
 {
 }
Exemplo 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)
 {
 }