Beispiel #1
0
 public ShaderPipeline(SingularShader vertexShader, SingularShader geometryShader, SingularShader fragmentShader)
     : base(Gl.GenProgramPipeline(), Gl.BindProgramPipeline, Gl.DeleteProgramPipelines)
 {
     VertexShader   = vertexShader;
     GeometryShader = geometryShader;
     FragmentShader = fragmentShader;
 }
Beispiel #2
0
        public ShaderPipeline BuildPipeline()
        {
            var vertexStages   = from stage in shaderStages where stage.Type == ShaderStage.StageType.Vertex select stage;
            var geometryStages = from stage in shaderStages where stage.Type == ShaderStage.StageType.Geometry select stage;
            var fragmentStages = from stage in shaderStages where stage.Type == ShaderStage.StageType.Fragment select stage;

            SingularShader CreateProgram(IEnumerable <ShaderStage> programStages) =>
            SingularShader.FromShader(new ShaderBuilder().AddStages(programStages).BuildShader());

            var vertexShader   = CreateProgram(vertexStages);
            var geometryShader = CreateProgram(geometryStages);
            var fragmentShader = CreateProgram(fragmentStages);

            ClearCurrentBuild();
            return(new ShaderPipeline(vertexShader, geometryShader, fragmentShader));
        }
Beispiel #3
0
 public ShaderPipeline(SingularShader vertexShader, SingularShader fragmentShader) : this(vertexShader, vertexShader, fragmentShader)
 {
 }