private static void WriteShaderInputStructure(EffectCodeGenerator generator, StitchedFragmentSymbol stitchedFragment, string uniqueName, SemanticGenerator semanticGenerator, string structSuffix, ParameterBlockNode parameterBlock, bool alwaysUseTexCoords) { WriteShaderStructure(generator, stitchedFragment, uniqueName, semanticGenerator, structSuffix, parameterBlock); }
private static void WriteShaderStructure(EffectCodeGenerator generator, StitchedFragmentSymbol stitchedFragment, string uniquePassName, SemanticGenerator semanticGenerator, string structSuffix, ParameterBlockNode parameterBlock) { generator.Writer.WriteLine("struct {0}_{1}_{2}", uniquePassName, stitchedFragment.UniqueName, structSuffix); generator.Writer.WriteLine("{"); if (parameterBlock != null) parameterBlock.VariableDeclarations.ForEach(v => { string semantic = semanticGenerator.GetNextSemantic(v); generator.Writer.WriteLine("\t{0} {1} : {2};", Token.GetString(v.DataType), v.Name, semantic); }); generator.Writer.WriteLine("};"); generator.Writer.WriteLine(); }
private static string ReplaceVariableNames(StitchedFragmentSymbol stitchedFragment, ParameterBlockNode parameters, string mangledCode) { if (parameters != null) parameters.VariableDeclarations.ToList().ForEach(i => mangledCode = Regex.Replace(mangledCode, @"([^\w\.])(" + i.Name + @")(\W)", "$1" + stitchedFragment.UniqueName + "_$2$3")); return mangledCode; }