public override void ViewDidLoad()
        {
            metalView = (MTKView)View;

            // Set the view to use the default device.
            metalView.Device = MTLDevice.SystemDefault;

            // Make sure the current device supports MetalPerformanceShaders.
            if (metalView.Device == null)
            {
                return;
            }

            bool deviceSupportsMPS = MPSKernel.Supports(metalView.Device);

            if (!deviceSupportsMPS)
            {
                return;
            }

            MetalPerformanceShadersDisabledLabel.Hidden = true;
            SetupView();
            SetupMetal();
            LoadAssets();
        }
		public void Metal ()
		{
			TestRuntime.AssertDevice ();
			TestRuntime.AssertXcodeVersion (10, 0);

			device = MTLDevice.SystemDefault;
			// some older hardware won't have a default
			if (device == null || !MPSKernel.Supports (device))
				Assert.Inconclusive ("Metal is not supported");
		}
        public void MPSKernelCopyTest()
        {
#if !MONOMAC
            TestRuntime.AssertDevice();
#endif

            TestRuntime.AssertXcodeVersion(9, 0);

            var kernel  = new MPSKernel(MTLDevice.SystemDefault);
            var kernel2 = kernel.CopyWithZone(NSZone.Default, MTLDevice.SystemDefault);
            Assert.That(kernel2.RetainCount, Is.EqualTo(1));
        }
        public void Metal()
        {
#if !MONOMAC
            TestRuntime.AssertXcodeVersion(7, 0);
#else
            TestRuntime.AssertXcodeVersion(9, 0);
#endif

            device = MTLDevice.SystemDefault;
            // some older hardware won't have a default
            if (device == null || !MPSKernel.Supports(device))
            {
                Assert.Inconclusive("Metal is not supported");
            }
        }
示例#5
0
        public void Metal()
        {
            TestRuntime.AssertXcodeVersion(9, 0);

#if !MONOMAC
            if (Runtime.Arch == Arch.SIMULATOR && Environment.OSVersion.Version.Major >= 15)
            {
                Assert.Inconclusive("Metal is not supported in the simulator on macOS 10.15");
            }
#endif

            device = MTLDevice.SystemDefault;
            // some older hardware won't have a default
            if (device == null || !MPSKernel.Supports(device))
            {
                Assert.Inconclusive("Metal is not supported");
            }
        }
示例#6
0
        public void Metal()
        {
            TestRuntime.AssertXcodeVersion(9, 0);

#if !MONOMAC && !__MACCATALYST__
            if (Runtime.Arch == Arch.SIMULATOR)
            {
                Assert.Inconclusive("Metal Performance Shaders is not supported in the simulator");
            }
#endif

            device = MTLDevice.SystemDefault;
            // some older hardware won't have a default
            if (device == null || !MPSKernel.Supports(device))
            {
                Assert.Inconclusive("Metal is not supported");
            }
        }
示例#7
0
        public void Metal()
        {
            TestRuntime.AssertDevice();
            TestRuntime.AssertXcodeVersion(10, 0);

            device = MTLDevice.SystemDefault;
            // some older hardware won't have a default
            if (device == null || !MPSKernel.Supports(device))
            {
                Assert.Inconclusive("Metal is not supported");
            }

            cache = NSArray <MPSImage> .FromNSObjects(
                new MPSImage (device, MPSImageDescriptor.GetImageDescriptor(MPSImageFeatureChannelFormat.Float32, 224, 224, 3)),
                new MPSImage (device, MPSImageDescriptor.GetImageDescriptor(MPSImageFeatureChannelFormat.Float32, 224, 224, 3)),
                new MPSImage (device, MPSImageDescriptor.GetImageDescriptor(MPSImageFeatureChannelFormat.Float32, 224, 224, 3)),
                new MPSImage (device, MPSImageDescriptor.GetImageDescriptor(MPSImageFeatureChannelFormat.Float32, 224, 224, 3)),
                new MPSImage (device, MPSImageDescriptor.GetImageDescriptor(MPSImageFeatureChannelFormat.Float32, 224, 224, 3))
                );
        }
示例#8
0
        public void Metal()
        {
            TestRuntime.AssertDevice();
            TestRuntime.AssertXcodeVersion(10, 0);

            device = MTLDevice.SystemDefault;
            // some older hardware won't have a default
            if (device == null || !MPSKernel.Supports(device))
            {
                Assert.Inconclusive("Metal is not supported");
            }

            cache = NSArray <MPSState> .FromNSObjects(
                new MPSState (device, MTLTextureDescriptor.CreateTexture2DDescriptor(MTLPixelFormat.RGBA32Float, 220, 220, false)),
                new MPSState (device, MTLTextureDescriptor.CreateTexture2DDescriptor(MTLPixelFormat.RGBA32Float, 221, 221, false)),
                new MPSState (device, MTLTextureDescriptor.CreateTexture2DDescriptor(MTLPixelFormat.RGBA32Float, 222, 222, false)),
                new MPSState (device, MTLTextureDescriptor.CreateTexture2DDescriptor(MTLPixelFormat.RGBA32Float, 223, 223, false)),
                new MPSState (device, MTLTextureDescriptor.CreateTexture2DDescriptor(MTLPixelFormat.RGBA32Float, 224, 224, false)),
                new MPSState (device, MTLTextureDescriptor.CreateTexture2DDescriptor(MTLPixelFormat.RGBA32Float, 225, 225, false))
                );
        }
示例#9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Load default device.
            device = MTLDevice.SystemDefault;

            // Make sure the current device supports MetalPerformanceShaders.
            if (!MPSKernel.Supports(device))
            {
                Console.WriteLine("Metal Performance Shaders not Supported on current Device");
                return;
            }

            // Create new command queue.
            commandQueue = device.CreateCommandQueue();

            // initialize the networks we shall use to detect digits
            neuralNetwork     = new MnistFullLayerNeuralNetwork(commandQueue);
            neuralNetworkDeep = new MnistDeepConvNeuralNetwork(commandQueue);

            runningNet = neuralNetwork;
        }