public LoggingTransform(ModelCompiler compiler) { if (compiler.Logging) { loggingAction = Builder.VarRefExpr(Builder.VarDecl("loggingAction", typeof(Action <string>))); } }
private List <RSM.CompiledModel> CompileModels(RSM[] objects) { List <RSM.CompiledModel> models = new List <RSM.CompiledModel>(); pendingCMThreads = objects.Length; doneCMEvent = new ManualResetEvent(false); float start = Time.realtimeSinceStartup; ModelCompiler[] compilerArray = new ModelCompiler[objects.Length]; for (int i = 0; i < objects.Length; i++) { ModelCompiler compiler = new ModelCompiler(objects[i]); compilerArray[i] = compiler; ThreadPool.QueueUserWorkItem(compiler.ThreadPoolCallback, i); } doneCMEvent.WaitOne(); float delta = Time.realtimeSinceStartup - start; Debug.Log("Models compiling time: " + delta); start = Time.realtimeSinceStartup; for (int i = 0; i < objects.Length; i++) { ModelCompiler compiler = compilerArray[i]; models.Add(compiler.CompiledModel); } delta = Time.realtimeSinceStartup - start; Debug.Log("Models gathering time: " + delta); return(models); }
protected override Diagnostics.Logger ProcessFileAndGetLogResults(string inputFilePath, string outputFilePath, string dependencyFilePath, TkItem item) { var compilerOptions = new ModelCompilerOptions() { DependencyFile = dependencyFilePath, Quality = Debug ? ModelRealTimeQuality.Low : ModelRealTimeQuality.Maximum }; var compilerResult = ModelCompiler.CompileAndSave(inputFilePath, outputFilePath, compilerOptions); return(compilerResult.Logger); }
protected override bool ProcessFile(string inputFilePath, string outputFilePath, string dependencyFilePath, OdItem item) { ModelOperation op = ModelOperation.None; if (ModelOperations != null) op = ModelOperations.Aggregate(ModelOperation.None, (current, t) => current | (ModelOperation) Enum.Parse(typeof (ModelOperation), t.ItemSpec)); var compilerOptions = new ModelCompilerOptions() { DependencyFile = dependencyFilePath, Quality = Debug ? ModelRealTimeQuality.Low : ModelRealTimeQuality.Maximum, ExcludeElements = ExcludeElements != null ? ExcludeElements.Select(element => element.ItemSpec).ToArray() : new string[0], ModelOperations = op }; var result = ModelCompiler.CompileAndSave(inputFilePath, outputFilePath, compilerOptions); return result.HasErrors; }
/// <summary> /// Create a new ModelCompiler object /// </summary> private void CreateCompiler() { compiler = new ModelCompiler(); compiler.ParametersChanged += delegate(object sender, EventArgs e) { InvalidateCompiledAlgorithms(); }; compiler.Compiling += delegate(ModelCompiler sender, ModelCompiler.CompileEventArgs e) { if (ShowProgress) { Console.Write("Compiling model..."); } }; compiler.Compiled += delegate(ModelCompiler sender, ModelCompiler.CompileEventArgs e) { if (ShowWarnings && e.Warnings != null && (e.Warnings.Count > 0)) { Console.WriteLine("compilation had " + e.Warnings.Count + " warning(s)."); int count = 1; foreach (TransformError te in e.Warnings) { if (!te.IsWarning) { continue; } Console.WriteLine(" [" + count + "] " + te.ErrorText); count++; } } if (e.Exception != null) { if (ShowProgress) { Console.WriteLine("compilation failed."); } } else { if (ShowProgress) { Console.WriteLine("done."); } } }; }
private async void compile_Click(object sender, EventArgs e) { Stopwatch trackCompileTime = new Stopwatch(); trackCompileTime.Start(); output.Text = ""; outputQueue.Clear(); compileProgress.Value = 0; foreach (Control control in CONTROLS_TO_DISABLE_WHEN_COMPILING) { control.Enabled = false; } Compiler.UseWaitCursor = true; ModelCompiler.PreScheduleTasks(); Func <AssemblerData> assemble; if (compilerTypeSelect.Text == "Avatar") { var assembler = new CharacterAssembler(); var userAvatar = UserAvatar.FromUsername(currentUser.Username); assemble = new Func <AssemblerData>(() => assembler.Assemble(userAvatar)); } else { var assembler = new CatalogItemAssembler(); assemble = new Func <AssemblerData>(() => assembler.Assemble(currentAssetId)); } Task <AssemblerData> buildModel = Task.Run(assemble); while (!buildModel.IsCompleted) { await UpdateCompilerState(); } if (buildModel.IsFaulted) { LogException(buildModel, "assemble"); } else { AssemblerData data = buildModel.Result; Task <string> compileModel = ModelCompiler.Compile(selectedGame, data); while (!compileModel.IsCompleted) { await UpdateCompilerState(); } if (compileModel.IsFaulted) { LogException(compileModel, "compile"); } else { PrintHeader("FINISHED MODEL!"); trackCompileTime.Stop(); Print("Assembled in {0} seconds.", trackCompileTime.Elapsed.TotalSeconds); await UpdateCompilerState(); compileModel.Wait(); latestCompiledModel = compileModel.Result; latestCompiledOnGame = selectedGame; } } foreach (Control control in CONTROLS_TO_DISABLE_WHEN_COMPILING) { control.Enabled = true; } if (trackCompileTime.IsRunning) { trackCompileTime.Stop(); } Compiler.UseWaitCursor = false; progressQueue.Clear(); }
public IterationTransform(ModelCompiler compiler) { this.compiler = compiler; }
public DeadCodeTransform(ModelCompiler compiler, bool pruneDeadCode) { this.compiler = compiler; this.pruneDeadCode = pruneDeadCode; }
internal InitializerTransform(ModelCompiler compiler) { this.compiler = compiler; }
void Run(string[] args) { // Print the exe header PrintHeader(); // Parse the command line if (!ParseCommandLine(args)) { Environment.Exit(-1); } var options = this; bool hasErrors = false; // ---------------------------------------------------------------- // Process model file // ---------------------------------------------------------------- var filePath = Path.Combine(Environment.CurrentDirectory, ModelFile); if (!File.Exists(filePath)) { ErrorColor(); Console.Error.WriteLine("File [{0}] does not exist", filePath); ResetColor(); Environment.Exit(-1); } var defaultOutputFile = Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath)); // Compiles to SpriteData OutputFile = OutputFile ?? defaultOutputFile; string dependencyFile = null; if (CompileOnlyIfNewer) { dependencyFile = Path.Combine(OutputDependencyDirectory, FileDependencyList.GetDependencyFileNameFromSourcePath(Path.GetFileName(filePath))); } Console.WriteLine("Compile Model from File [{0}] => {1}", filePath, OutputFile); var compilerOptions = new ModelCompilerOptions() { DependencyFile = dependencyFile, Quality = FastQuality ? ModelRealTimeQuality.Low : ModelRealTimeQuality.Maximum }; var result = ModelCompiler.CompileAndSave(filePath, OutputFile, compilerOptions); if (result.HasErrors) { ErrorColor(); Console.Error.WriteLine("Compilation has errors. Process aborted."); ResetColor(); Environment.Exit(-1); } if (result.IsContentGenerated) { Console.WriteLine("Successfull"); } else { Console.WriteLine("Nothing to generate. Model and Compiled Model are in sync"); } }
public static object Process <TModel>(TModel instance, MemberInfo m) { var aquire = ModelCompiler <TModel> .Compile(m); return(aquire(instance)); }
public IncrementAnalysisTransform(ModelCompiler compiler) { this.compiler = compiler; }
internal HoistingTransform(ModelCompiler compiler) { this.compiler = compiler; }
internal LocalTransform(ModelCompiler compiler) { this.compiler = compiler; }
internal LivenessAnalysisTransform(ModelCompiler compiler) { this.compiler = compiler; }
public IncrementTransform(ModelCompiler compiler) { analysis = new IncrementAnalysisTransform(compiler); }
internal DeadCode2Transform(ModelCompiler compiler) { this.compiler = compiler; }
public static object Process <TModel>(TModel instance, MemberInfo m) { return(ModelCompiler <TModel> .Compile(m)(instance)); }