Esempio n. 1
0
        public static Context Create(Platform platform, params Device[] devices)
        {
            if (devices == null)
            {
                throw new ArgumentNullException("devices");
            }
            if (devices.Length == 0)
            {
                throw new ArgumentException("No devices specified.");
            }

            UnsafeNativeMethods.ClDeviceID[] deviceIDs = Array.ConvertAll(devices, device => device.ID);
            ContextSafeHandle handle = UnsafeNativeMethods.CreateContext(platform.ID, deviceIDs, null, IntPtr.Zero);

            return(new Context(handle));
        }