Beispiel #1
0
    void OnGUI()
    {
        PrintMonoVersion();

        if (GUI.Button(new Rect(0, 0, 128, 64), "Start"))
        {
            var pixels  = BenchmarkMain.Start();
            var texture = new Texture2D(Benchmark.Width, Benchmark.Height, TextureFormat.RGBA32, false);
            texture.SetPixels32(convertRGBToColor32(pixels));
            texture.Apply();
            this.GetComponent <Renderer>().material.mainTexture = texture;
        }

        GUI.Label(new Rect(0, 80, 128, 32), BenchmarkMain.TimeToComplete);
    }
Beispiel #2
0
        static int Main(string[] args)
        {
            System.Console.WriteLine($"Mono Runtime Mode: " + Environment.GetEnvironmentVariable("UNO_BOOTSTRAP_MONO_RUNTIME_MODE"));

            var w = Stopwatch.StartNew();

            System.Console.WriteLine($"Start benchmark");

            RayTraceBenchmark.Console.WriteLineCallback = s =>
            {
                System.Console.WriteLine(s);
                var r = Runtime.InvokeJS($"Interop.appendResult(\"{s}\")", out var result);
            };

            BenchmarkMain.SaveImageCallback = d =>
            {
                w.Stop();
                System.Console.WriteLine($"Got results {d.Length} {w.Elapsed}");

                d = BenchmarkMain.ConvertRGBToBGRA(d);

                var gch        = GCHandle.Alloc(d, GCHandleType.Pinned);
                var pinnedData = gch.AddrOfPinnedObject();

                try
                {
                    var str = $"Interop.setImageRawData({pinnedData}, {Benchmark.Width}, {Benchmark.Height})";
                    System.Console.WriteLine($"Running {str}");
                    var r = Runtime.InvokeJS(str, out var result);

                    if (result != 0)
                    {
                        System.Console.WriteLine($"Eval failed {result}");
                    }
                }
                finally
                {
                    gch.Free();
                }
            };

            BenchmarkMain.Start();

            return(0);
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     RayTraceBenchmark.Console.WriteLineCallback = print;
     BenchmarkMain.SaveImageCallback             = showImage;
     BenchmarkMain.Start();
 }
Beispiel #4
0
 private void startClicked(object s, EventArgs args)
 {
     RayTraceBenchmark.Console.WriteLineCallback = print;
     BenchmarkMain.SaveImageCallback             = drawImage;
     BenchmarkMain.Start();
 }