protected IEnumerator BuildCompileUnits_Internal(BuildTarget target, DirectoryInfo sourceDir) { ClearCompileUnits(); var c = kernels.Count; var s = 1f / Mathf.Max(1, c - 1); for (var i = 0; i < c; i++) { var kernel = kernels[i]; progress.SetNormalizedProgress(s * i, "Building compile units {0:D3} / {1:D3}", i + 1, c); var compileOptions = ShaderAnalysisUtils.DefaultCompileOptions(kernel.defines, kernel.name, sourceDir); compileOptions.defines.Add(ShaderAnalysisUtils.DefineCompute); compileOptions.defines.Add(ShaderAnalysisUtils.DefineCompute); var unit = new CompileUnit { sourceCodeFile = sourceCodeFile, compileOptions = compileOptions, compileProfile = ShaderProfile.ComputeProgram, compileTarget = ShaderTarget.CS_5, compiledFile = ShaderAnalysisUtils.GetTemporaryProgramCompiledFile(sourceCodeFile, temporaryDirectory, kernel.name) }; AddCompileUnit(unit); yield return(null); } }
protected IEnumerator BuildCompileUnits_Internal(BuildTarget target, DirectoryInfo sourceDir) { ClearCompileUnits(); m_CompileUnitPerPass.Clear(); var c = passes.Count; var s = 1f / Mathf.Max(1, c - 1); for (var i = 0; i < c; i++) { var pass = passes[i]; var c2 = pass.combinedMulticompiles.Count; var s2 = 1f / Mathf.Max(1, c2 - 1); m_CompileUnitPerPass[i] = new List <int>(); for (var j = 0; j < pass.combinedMulticompiles.Count; j++) { progress.SetNormalizedProgress(s * (i + s2 * j), "Building compile units pass: {0:D3} / {1:D3}, unit: {2:D3} / {3:D3}", i + 1, c, j + 1, c2); var match = k_FragmentDeclaration.Match(pass.sourceCode); Assert.IsTrue(match.Success); var entryPoint = match.Groups[1].Value; var compileOptions = ShaderAnalysisUtils.DefaultCompileOptions( m_ShaderKeywords, entryPoint, sourceDir, pass.shaderModel); compileOptions.defines.UnionWith(pass.combinedMulticompiles[j]); compileOptions.defines.Add(ShaderAnalysisUtils.DefineFragment); var unit = new CompileUnit { sourceCodeFile = pass.sourceCodeFile, compileOptions = compileOptions, compileProfile = ShaderProfile.PixelProgram, compileTarget = ShaderTarget.PS_5, compiledFile = ShaderAnalysisUtils.GetTemporaryProgramCompiledFile(pass.sourceCodeFile, temporaryDirectory, j.ToString("D3")) }; m_CompileUnitPerPass[i].Add(compileUnitCount); AddCompileUnit(unit); yield return(null); } } }