Esempio n. 1
0
        private DeviceEntry[] searchForDevices()
        {
            if (mainForm.Renderer.Context == null)
            {
                return(null);                                              //bail out if the GL context hasn't been created
            }
            DeviceEntry[]      eDevs   = null;
            List <DeviceEntry> devList = new List <DeviceEntry>();

            try{
                OpenCLDeviceEntry.CheckSupport();                 //will throw an exception if not supported

                eDevs = OpenCLDeviceEntry.GetDevices();
                if (eDevs != null)
                {
                    devList.AddRange(eDevs);
                }
            }
            catch {}

            try{
                CudaDeviceEntry.CheckSupport();                 //will throw an exception if not supported

                eDevs = CudaDeviceEntry.GetDevices();
                if (eDevs != null)
                {
                    devList.AddRange(eDevs);
                }
            }
            catch {}

            try{
                CPUDeviceEntry.CheckSupport();                 //will throw an exception if not supported

                eDevs = CPUDeviceEntry.GetDevices();
                if (eDevs != null)
                {
                    devList.AddRange(eDevs);
                }
            }
            catch {}

            return(devList.ToArray());
        }