public override string VisitStruct(ShaderInputsParser.StructContext context) { string name = context.NAME().GetText(); MembersVisitor visitor = new MembersVisitor(); visitor.Visit(context); AnnotationsVisitor annotVisitor = new AnnotationsVisitor(); annotVisitor.Visit(context); Structure structure = new Structure(name, visitor.Members); structure.Annotations = new List <Annotation>(annotVisitor.Annotations); if (structure.IsCommon) { m_globalCtx.Structures.Add(structure); } else { OutputContext.Structures.Add(structure); } return(name); }
public override string VisitCbufferTempl(ShaderInputsParser.CbufferTemplContext context) { // In our grammar the cb name goes last whilst the typename first (if exist), if not, there is only one name, typename is a general type. int cbufferNamePos = context.NAME().Length - 1; string name = context.NAME()[cbufferNamePos].GetText(); string typename = ""; if (context.TYPE() != null) { typename = context.TYPE().GetText(); } else if (context.NAME()[0] != null) { typename = context.NAME()[0].GetText(); } ArrayDimVisitor arrayVisiotr = new ArrayDimVisitor(); arrayVisiotr.Visit(context); AnnotationsVisitor annotVisitor = new AnnotationsVisitor(); annotVisitor.Visit(context); ConstantBuffer buffer = new ConstantBuffer(name, typename); buffer.Annotations = new List <Annotation>(annotVisitor.Annotations); buffer.Size = arrayVisiotr.Size; OutputContext.ConstantBuffers.Add(buffer); return(name); }
public override string VisitUniformConstant(ShaderInputsParser.UniformConstantContext context) { AnnotationsVisitor annotVisitor = new AnnotationsVisitor(); annotVisitor.Visit(context); UniformConstant constant = new UniformConstant(context.TYPE().GetText(), context.NAME().GetText()); constant.Annotations = new List <Annotation>(annotVisitor.Annotations); OutputContext.UniformConstants.Add(constant); return(""); }
public override string VisitCbuffer(ShaderInputsParser.CbufferContext context) { string name = context.NAME().GetText(); MembersVisitor visitor = new MembersVisitor(); visitor.Visit(context); AnnotationsVisitor annotVisitor = new AnnotationsVisitor(); annotVisitor.Visit(context); ConstantBuffer buffer = new ConstantBuffer(name, visitor.Members); buffer.Annotations = new List <Annotation>(annotVisitor.Annotations); OutputContext.ConstantBuffers.Add(buffer); return(name); }