コード例 #1
0
 public LoggingTransform(ModelCompiler compiler)
 {
     if (compiler.Logging)
     {
         loggingAction = Builder.VarRefExpr(Builder.VarDecl("loggingAction", typeof(Action <string>)));
     }
 }
コード例 #2
0
ファイル: MapLoader.cs プロジェクト: langresser/unityro
    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);
    }
コード例 #3
0
ファイル: ModelCompilerTask.cs プロジェクト: loreggia/SharpDX
        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);
        }
コード例 #4
0
        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;
        }
コード例 #5
0
ファイル: InferenceEngine.cs プロジェクト: zouwuhe/infer
 /// <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.");
             }
         }
     };
 }
コード例 #6
0
ファイル: Rbx2Source.cs プロジェクト: ddddeessse/Rbx2Source
        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();
        }
コード例 #7
0
 public IterationTransform(ModelCompiler compiler)
 {
     this.compiler = compiler;
 }
コード例 #8
0
 public DeadCodeTransform(ModelCompiler compiler, bool pruneDeadCode)
 {
     this.compiler      = compiler;
     this.pruneDeadCode = pruneDeadCode;
 }
コード例 #9
0
 internal InitializerTransform(ModelCompiler compiler)
 {
     this.compiler = compiler;
 }
コード例 #10
0
        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");
            }
        }
コード例 #11
0
        public static object Process <TModel>(TModel instance, MemberInfo m)
        {
            var aquire = ModelCompiler <TModel> .Compile(m);

            return(aquire(instance));
        }
コード例 #12
0
 public IncrementAnalysisTransform(ModelCompiler compiler)
 {
     this.compiler = compiler;
 }
コード例 #13
0
ファイル: HoistingTransform.cs プロジェクト: dotnet/infer
 internal HoistingTransform(ModelCompiler compiler)
 {
     this.compiler = compiler;
 }
コード例 #14
0
ファイル: LocalTransform.cs プロジェクト: kant2002/infer
 internal LocalTransform(ModelCompiler compiler)
 {
     this.compiler = compiler;
 }
コード例 #15
0
 internal LivenessAnalysisTransform(ModelCompiler compiler)
 {
     this.compiler = compiler;
 }
コード例 #16
0
 public IncrementTransform(ModelCompiler compiler)
 {
     analysis = new IncrementAnalysisTransform(compiler);
 }
コード例 #17
0
 internal DeadCode2Transform(ModelCompiler compiler)
 {
     this.compiler = compiler;
 }
コード例 #18
0
 public static object Process <TModel>(TModel instance, MemberInfo m)
 {
     return(ModelCompiler <TModel> .Compile(m)(instance));
 }