3 using System.Collections.Generic;
 
    4 using System.Threading.Tasks;
 
    5 using SiliconStudio.Assets.Compiler;
 
    6 using SiliconStudio.BuildEngine;
 
    7 using SiliconStudio.Core;
 
    8 using SiliconStudio.Core.Diagnostics;
 
    9 using SiliconStudio.Core.IO;
 
   10 using SiliconStudio.Paradox.Assets.Effect.ValueGenerators;
 
   11 using SiliconStudio.Paradox.Effects;
 
   12 using SiliconStudio.Paradox.Shaders.Compiler;
 
   14 namespace SiliconStudio.
Paradox.Assets.Effect
 
   19     internal class EffectCompileGeneratorBuildStep : PermutationGeneratorBuildStep
 
   21         private readonly 
string url;
 
   23         protected readonly EffectLibraryAsset Asset;
 
   32         public EffectCompileGeneratorBuildStep(
AssetCompilerContext context, 
string url, List<ICompilerParametersGenerator> compilerParametersGenerators, EffectLibraryAsset asset)
 
   33             : base(context, compilerParametersGenerators)
 
   39         public override string Title
 
   43                 return "EffectCompileGenerator";
 
   49             var steps = 
new List<BuildStep>();
 
   53             var log = 
new LoggerResult(
"EffectLibrary [{0}]".ToFormat(url));
 
   55             var urlRoot = 
new UFile(url).GetParent();
 
   58                     Platform = Context.GetGraphicsPlatform(),
 
   59                     Profile = Context.GetGraphicsProfile()
 
   63             var children = Asset.Permutations == null ? null : Asset.Permutations.Children;
 
   65             foreach (var parametersPerPermutation 
in GeneratePermutation(rootParameters, keys, children, log))
 
   67                 var parameters = parametersPerPermutation.Clone();
 
   69                 if (!parameters.ContainsKey(EffectKeys.Name))
 
   71                     log.Warning(
"Permutation not compiled. It doesn't contain [Effect.Name] key to select the correct pdxfx/pdxsl to compile with parameters [{0}]", parametersPerPermutation.ToStringDetailed());
 
   75                     var effectName = parameters.Get(EffectKeys.Name);
 
   76                     steps.Add(
new CommandBuildStep(
new EffectCompileCommand(Context, urlRoot, effectName, parameters)));
 
   81             log.CopyTo(executeContext.Logger);
 
   83             return base.Execute(executeContext, builderContext);
 
   88             if (keys == null || keys.Count == 0)
 
   90                 if (permutations == null || permutations.Count == 0)
 
   92                     foreach (var newParameters 
in GenerateCompilerParametersPermutation(parameters, 0, log))
 
   94                         yield 
return newParameters;
 
   99                     foreach (var permutation 
in permutations)
 
  101                         foreach (var parametersPerPermutations 
in GeneratePermutation(parameters, permutation.
Keys, permutation.Children, log))
 
  103                             yield 
return parametersPerPermutations;
 
  110                 foreach (var parametersPerKeyValuePermutations 
in GenerateKeysPermutation(parameters, keys.GenerateKeyValues()))
 
  112                     foreach (var subParameters 
in GeneratePermutation(parametersPerKeyValuePermutations, null, permutations, log))
 
  114                         yield 
return subParameters;
 
  122             if (compilerGeneratorIndex >= CompilerParametersGenerators.Count)
 
  125                 yield 
return parameters;
 
  129                 var generator = CompilerParametersGenerators[compilerGeneratorIndex];
 
  130                 foreach (var nextParameters 
in generator.Generate(Context, parameters, log))
 
  132                     foreach (var nextSubParameters 
in GenerateCompilerParametersPermutation(nextParameters, compilerGeneratorIndex + 1, log))
 
  134                         yield 
return nextSubParameters;
 
SiliconStudio.Core.Diagnostics.LoggerResult LoggerResult
 
Parameters used for compilation. 
 
Default implementation for a IEffectParameterGenerator using a dictionary of ParameterKey associated ...
 
The context used when compiling an asset in a Package. 
 
IEnumerable< ParameterKey > Keys
Gets the keys of this collection. 
 
Defines a normalized file path. See UPath for details. This class cannot be inherited.