Ejemplo n.º 1
0
        static void WriteLayout(StringBuilder builder, CDomainShader shader, Pair<TesselationLayout, ShaderStage> layoutAndOutputStage)
        {
            var layout = layoutAndOutputStage.First;

            TesselationDomain hullDomain;
            TesselationPartitioning partitioning;
            TesselationTopology topology;
            layout.Decode(out hullDomain, out partitioning, out topology);

            if (hullDomain != shader.Domain)
                throw new InvalidOperationException("Hull and Domain shaders have cannot have different domains");
            builder.AppendLine(string.Format("layout ( {0}, {1}, {2} ) in;",
                TesselationDomainToString(hullDomain), TesselationPartitioningToString(partitioning), TesselationTopologyToString(topology)));
        }
Ejemplo n.º 2
0
        static void WriteIOAndCode(StringBuilder builder, CDomainShader shader, Pair<TesselationLayout, ShaderStage> layoutAndOutputStage)
        {
            var outputStage = layoutAndOutputStage.Second;

            var reflection = shader.Reflection;
            WriteCodeLines(builder, reflection.CodeGlobalLines);
            builder.AppendLine();
            WritePatchBlock(builder, reflection.InputPatch, "INPUT_PATCH", "bs_patch_", "patch in");
            WriteInputArrayBlock(builder, reflection.Input, OutputPrefixForStage(ShaderStage.Domain));
            WriteInputExtraBlock(builder, reflection.InputExtra, "INPUT_EXTRA", "InputExtra", "bs_input_extra_");
            WriteSimpleIOBlock(builder, reflection.Output, "OUTPUT", "out", OutputPrefixForStage(outputStage));
            WriteFunction(builder, "main", null, reflection.CodeMainLines, outputStage == ShaderStage.Pixel ? PositionAdjustment : null);
        }