Ejemplo n.º 1
0
		private static void WritePixelInputStructs(EffectCodeGenerator generator, 
			TechniqueSymbol technique, TechniquePassSymbol pass, string uniquePassName)
		{
			generator.Writer.WriteLine("// -------- pixel input structures --------");

			SemanticGenerator semanticGenerator = new SemanticGenerator("TEXCOORD");
			pass.ForEachFragment(generator, (g, f, s) => WritePixelInputStructure(g, f, s, semanticGenerator));

			generator.Writer.WriteLine("struct {0}_PIXELINPUT", uniquePassName);
			generator.Writer.WriteLine("{");
			pass.ForEachFragment(generator, (g, f, s) => g.Writer.WriteLine("\t{0}_{1}_PIXELINPUT {1};", s, f.UniqueName));
			generator.Writer.WriteLine("};");
			generator.Writer.WriteLine();
			generator.Writer.WriteLine("static {0}_PIXELINPUT gPixelInput_{0};", uniquePassName);
			generator.Writer.WriteLine();
		}
Ejemplo n.º 2
0
        private static void WritePixelInputStructs(EffectCodeGenerator generator,
                                                   TechniqueSymbol technique, TechniquePassSymbol pass, string uniquePassName)
        {
            generator.Writer.WriteLine("// -------- pixel input structures --------");

            SemanticGenerator semanticGenerator = new SemanticGenerator("TEXCOORD");

            pass.ForEachFragment(generator, (g, f, s) => WritePixelInputStructure(g, f, s, semanticGenerator));

            generator.Writer.WriteLine("struct {0}_PIXELINPUT", uniquePassName);
            generator.Writer.WriteLine("{");
            pass.ForEachFragment(generator, (g, f, s) => g.Writer.WriteLine("\t{0}_{1}_PIXELINPUT {1};", s, f.UniqueName));
            generator.Writer.WriteLine("};");
            generator.Writer.WriteLine();
            generator.Writer.WriteLine("static {0}_PIXELINPUT gPixelInput_{0};", uniquePassName);
            generator.Writer.WriteLine();
        }
Ejemplo n.º 3
0
		private static void WritePixelOutputStructs(EffectCodeGenerator generator,
			TechniqueSymbol technique, TechniquePassSymbol pass, string uniquePassName)
		{
			ScriptTextWriter writer = generator.Writer;
			writer.WriteLine("// -------- pixel output structures --------");

			SemanticGenerator semanticGenerator = new SemanticGenerator("COLOR", 1);
			pass.ForEachFragment(generator, (g, f, n) => WritePixelOutputStructure(g, f, n, semanticGenerator));

			writer.WriteLine("struct {0}_PIXELOUTPUT", uniquePassName);
			writer.WriteLine("{");
			writer.WriteLine("\tfloat4 color : COLOR0;");
			pass.ForEachFragment(generator, (g, f, s) =>
			{
				if (f.FragmentNode.PixelOutputs != null && f.FragmentNode.PixelOutputs.VariableDeclarations.Any())
					writer.WriteLine("\t{0}_{1}_PIXELOUTPUT {1};", s, f.UniqueName);
			});
			writer.WriteLine("};");
			writer.WriteLine();
		}
Ejemplo n.º 4
0
        private static void WriteVertexInputStructures(EffectCodeGenerator generator,
                                                       TechniqueSymbol technique, TechniquePassSymbol pass, string uniquePassName)
        {
            ScriptTextWriter writer = generator.Writer;

            writer.WriteLine("// -------- vertex input structures --------");

            SemanticGenerator semanticGenerator = new SemanticGenerator("TEXCOORD");

            pass.ForEachFragment(generator, (g, f, s) => WriteVertexInputStructure(g, f, s, semanticGenerator));

            writer.WriteLine("struct {0}_VERTEXINPUT", uniquePassName);
            writer.WriteLine("{");

            pass.ForEachFragment(generator, (g, f, s) => g.Writer.WriteLine("\t{0}_{1}_VERTEXINPUT {1};", uniquePassName, f.UniqueName));

            writer.WriteLine("};");
            writer.WriteLine();
            writer.WriteLine("static {0}_VERTEXINPUT gVertexInput_{0};", uniquePassName);
            writer.WriteLine();
        }
Ejemplo n.º 5
0
        private static void WritePixelOutputStructs(EffectCodeGenerator generator,
                                                    TechniqueSymbol technique, TechniquePassSymbol pass, string uniquePassName)
        {
            ScriptTextWriter writer = generator.Writer;

            writer.WriteLine("// -------- pixel output structures --------");

            SemanticGenerator semanticGenerator = new SemanticGenerator("COLOR", 1);

            pass.ForEachFragment(generator, (g, f, n) => WritePixelOutputStructure(g, f, n, semanticGenerator));

            writer.WriteLine("struct {0}_PIXELOUTPUT", uniquePassName);
            writer.WriteLine("{");
            writer.WriteLine("\tfloat4 color : COLOR0;");
            pass.ForEachFragment(generator, (g, f, s) =>
            {
                if (f.FragmentNode.PixelOutputs != null && f.FragmentNode.PixelOutputs.VariableDeclarations.Any())
                {
                    writer.WriteLine("\t{0}_{1}_PIXELOUTPUT {1};", s, f.UniqueName);
                }
            });
            writer.WriteLine("};");
            writer.WriteLine();
        }
Ejemplo n.º 6
0
 private static void WritePixelInputStructure(EffectCodeGenerator generator, StitchedFragmentSymbol stitchedFragment, string uniqueName, SemanticGenerator semanticGenerator)
 {
     WriteShaderInputStructure(generator, stitchedFragment, uniqueName, semanticGenerator, "PIXELINPUT", stitchedFragment.FragmentNode.Interpolators, true);
 }
Ejemplo n.º 7
0
        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();
        }
Ejemplo n.º 8
0
 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);
 }
Ejemplo n.º 9
0
 private static void WriteVertexInputStructure(EffectCodeGenerator generator, StitchedFragmentSymbol stitchedFragment, string uniqueName, SemanticGenerator semanticGenerator)
 {
     WriteShaderInputStructure(generator, stitchedFragment, uniqueName, semanticGenerator, "VERTEXINPUT", stitchedFragment.FragmentNode.VertexAttributes, false);
 }
Ejemplo n.º 10
0
		private static void WriteVertexInputStructures(EffectCodeGenerator generator, 
			TechniqueSymbol technique, TechniquePassSymbol pass, string uniquePassName)
		{
			ScriptTextWriter writer = generator.Writer;

			writer.WriteLine("// -------- vertex input structures --------");

			SemanticGenerator semanticGenerator = new SemanticGenerator("TEXCOORD");
			pass.ForEachFragment(generator, (g, f, s) => WriteVertexInputStructure(g, f, s, semanticGenerator));

			writer.WriteLine("struct {0}_VERTEXINPUT", uniquePassName);
			writer.WriteLine("{");

			pass.ForEachFragment(generator, (g, f, s) => g.Writer.WriteLine("\t{0}_{1}_VERTEXINPUT {1};", uniquePassName, f.UniqueName));

			writer.WriteLine("};");
			writer.WriteLine();
			writer.WriteLine("static {0}_VERTEXINPUT gVertexInput_{0};", uniquePassName);
			writer.WriteLine();
		}
Ejemplo n.º 11
0
		private static void WritePixelInputStructure(EffectCodeGenerator generator, StitchedFragmentSymbol stitchedFragment, string uniqueName, SemanticGenerator semanticGenerator)
		{
			WriteShaderInputStructure(generator, stitchedFragment, uniqueName, semanticGenerator, "PIXELINPUT", stitchedFragment.FragmentNode.Interpolators, true);
		}
Ejemplo n.º 12
0
		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();
		}
Ejemplo n.º 13
0
		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);
		}
Ejemplo n.º 14
0
		private static void WriteVertexInputStructure(EffectCodeGenerator generator, StitchedFragmentSymbol stitchedFragment, string uniqueName, SemanticGenerator semanticGenerator)
		{
			WriteShaderInputStructure(generator, stitchedFragment, uniqueName, semanticGenerator, "VERTEXINPUT", stitchedFragment.FragmentNode.VertexAttributes, false);
		}