public virtual void Write(ShaderGenerationContext context)
        {
            AddPassRequiredAttributes(GetRequiredPassAttributes(context));
            AddPassKeywords(GetRequiredPassKeywords(context));

            context.LogShaderSection($"Generated Data Struct {AttributeStructName}");

            context.WriteLine($"struct {AttributeStructName}");
            context.WriteLine("{");

            context.WriteIndented((c) =>
            {
                for (int i = 0; i < _attributes.Count; i++)
                {
                    AttributeConfig config = _attributes[i];
                    if (config.AttributeType != AttributeType.Anonymous)
                    {
                        c.WriteLine($"#define __{AttributeStructName.ToUpper()}{config.AttributeType.ToString().ToUpper()}  {config.Name}");
                    }

                    config.WriteAttributeDefinition(c, i, this is KeywordFragmentInput);
                }
            });

            foreach (string keyword in _keywords)
            {
                context.WriteLine(keyword);
            }

            context.WriteLine("};");
            context.Newine();
        }
示例#2
0
 private void WriteFragmentShaderHeader(ShaderGenerationContext context)
 {
     context.WriteLine(context.CurrentPass.GetFragmentShaderHeader());
     context.Newine();
 }