public VarDecl(HLSLDeclaration decl, TextSpan loc) { varDeclaration = decl; varLocation = loc; }
//Adds a struct type and its members public void AddStructType(LexValue loc) { if (!shouldAddDeclarations()) { return; } HLSLDeclaration structDecl = new HLSLDeclaration("struct", loc.str, GLYPHSTRUCT, loc.str); // structDecls.Add(structDecl); //Need to keep this static member for the initial lex since the source hasn't been created yet, //but really only need it for the names, the sources still keep their own struct decls if(!structDecls.ContainsKey(loc.str)) structDecls.Add(loc.str, new StructMembers(loc.str, tempMembers, structDecl)); _source.structDecls.Add(loc.str, new StructMembers(loc.str, tempMembers, structDecl)); tempMembers.Clear(); }
public StructMembers(string name, List<HLSLDeclaration> members, HLSLDeclaration decl) { structName = name; structMembers = new List<HLSLDeclaration>(members); structDecl = decl; }
public void AddFunctionParamVar(LexValue varName, LexValue type, LexLocation loc) { if (!shouldAddDeclarations()) { return; } HLSLDeclaration newDecl = new HLSLDeclaration(type.str, varName.str, GLYPHVARIABLE, varName.str); tempFunctionVars.Add(varName.str, new VarDecl(newDecl, MkTSpan(loc))); }
internal static void AddFloatProperty(this PropertyCollector collector, string referenceName, float defaultValue, HLSLDeclaration declarationType = HLSLDeclaration.DoNotDeclare) { collector.AddShaderProperty(new Vector1ShaderProperty { floatType = FloatType.Default, hidden = true, overrideHLSLDeclaration = true, hlslDeclarationOverride = declarationType, value = defaultValue, overrideReferenceName = referenceName, }); }
internal override void ForeachHLSLProperty(Action <HLSLProperty> action) { HLSLDeclaration decl = GetDefaultHLSLDeclaration(); action(new HLSLProperty(HLSLType._float2, referenceName, decl, concretePrecision)); }
// Texture2D properties cannot be set via Hybrid path at the moment; disallow that choice internal override bool AllowHLSLDeclaration(HLSLDeclaration decl) => (decl != HLSLDeclaration.HybridPerInstance) && (decl != HLSLDeclaration.DoNotDeclare);
internal static void AddToggleProperty(this PropertyCollector collector, string referenceName, bool defaultValue, HLSLDeclaration declarationType = HLSLDeclaration.DoNotDeclare) { collector.AddShaderProperty(new BooleanShaderProperty { value = defaultValue, hidden = true, overrideHLSLDeclaration = true, hlslDeclarationOverride = declarationType, displayName = referenceName, overrideReferenceName = referenceName, }); }