Beispiel #1
0
        public Image(IntPtr deviceData, int3 dims, bool isft = false, bool iscomplex = false, bool ishalf = false)
        {
            Dims      = dims;
            IsFT      = isft;
            IsComplex = iscomplex;
            IsHalf    = ishalf;

            _DeviceData = !IsHalf?GPU.MallocDevice(ElementsReal) : GPU.MallocDeviceHalf(ElementsReal);

            GPU.OnMemoryChanged();
            if (deviceData != IntPtr.Zero)
            {
                if (!IsHalf)
                {
                    GPU.CopyDeviceToDevice(deviceData, _DeviceData, ElementsReal);
                }
                else
                {
                    GPU.CopyDeviceHalfToDeviceHalf(deviceData, _DeviceData, ElementsReal);
                }
            }
            IsDeviceDirty = true;
        }