private void showImage(byte[] data)
        {
            var bitmap = new WriteableBitmap(1280, 720);
            var stream = bitmap.PixelBuffer.AsStream();

            data = BenchmarkMain.ConvertRGBToBGRA(data);
            stream.Write(data, 0, data.Length);
            image.Source = bitmap;
        }
Esempio n. 2
0
	public static void Main ()
	{
		var self = new BenchmarkMain ();
		var stopwatch = new Stopwatch ();
		PrepareBuffers ();
		stopwatch.Start ();
		self.Run ();
		stopwatch.Stop ();
		Console.Out.WriteLine (stopwatch.ElapsedMilliseconds);
	}
Esempio n. 3
0
        private void showImage(byte[] data)
        {
            var bitmap = new WriteableBitmap(1280, 720);
            var data2  = BenchmarkMain.ConvertRGBToBGRAInt(data);

            for (int i = 0; i != data2.Length; ++i)
            {
                bitmap.Pixels[i] = data2[i];
            }
            image.Source = bitmap;
        }
Esempio n. 4
0
    public static void Main()
    {
        var self      = new BenchmarkMain();
        var stopwatch = new Stopwatch();

        PrepareBuffers();
        stopwatch.Start();
        self.Run();
        stopwatch.Stop();
        Console.Out.WriteLine(stopwatch.ElapsedMilliseconds);
    }
Esempio n. 5
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);
    }
Esempio n. 6
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();
 }
Esempio n. 8
0
 private void startClicked(object s, EventArgs args)
 {
     RayTraceBenchmark.Console.WriteLineCallback = print;
     BenchmarkMain.SaveImageCallback             = drawImage;
     BenchmarkMain.Start();
 }