/// <summary>Process all stages in order and send progress accordingly.</summary>
        /// <param name="p">Progress notifier to use for progression.</param>
        /// <param name="stages">Stages to execute.</param>
        /// <returns>Return an enumerator to tick to process the stages. Last value is <c>true</c> when it succeeds.</returns>
        protected IEnumerator <bool> ProcessStages(ProgressWrapper p, StageTick[] stages)
        {
            var min = 0f;
            var max = stages[0].stageRange;

            for (var i = 0; i < stages.Length; i++)
            {
                p.SetProgressRange(min, max);
                var e = stages[i].operation();
                while (e.MoveNext())
                {
                    yield return(false);

                    if (isCancelled)
                    {
                        yield break;
                    }
                }
                if (isCancelled)
                {
                    yield break;
                }

                min += stages[i].stageRange;
                max += stages[i].stageRange;
                if (max > 1)
                {
                    var d = max - 1;
                    max -= d;
                    min -= d;
                }
            }

            yield return(true);
        }
示例#2
0
 protected ReportBuildData(
     DirectoryInfo temporaryDirectory,
     ProgressWrapper progress,
     ShaderProgramFilter filter)
 {
     this.temporaryDirectory = temporaryDirectory;
     this.progress           = progress;
     this.filter             = filter;
 }
示例#3
0
        protected ComputeShaderReportBuildData(
            ComputeShader compute,
            DirectoryInfo temporaryDirectory,
            ShaderProgramFilter filter,
            ProgressWrapper progress) : base(temporaryDirectory, progress, filter)
        {
            this.compute = compute;

            kernels = new List <Kernel>();
        }
        protected ShaderBuildData(
            Shader shader,
            DirectoryInfo temporaryDirectory,
            IEnumerable <string> shaderKeywords,
            ShaderProgramFilter filter,
            ProgressWrapper progress) : base(temporaryDirectory, progress, filter)
        {
            this.m_Shader         = shader;
            this.m_ShaderKeywords = shaderKeywords != null ? new HashSet <string>(shaderKeywords) : new HashSet <string>();

            passes = new List <Pass>();
        }