Exemplo n.º 1
0
Arquivo: Image.cs Projeto: bHimes/warp
        public IntPtr GetDevice(Intent intent)
        {
            lock (Sync)
            {
                if ((intent & Intent.Read) > 0 && IsHostDirty)
                {
                    for (int z = 0; z < Dims.Z; z++)
                    {
                        if (!IsHalf)
                        {
                            GPU.CopyHostToDevice(HostData[z], new IntPtr((long)DeviceData + ElementsSliceReal * z * sizeof(float)), ElementsSliceReal);
                        }
                        else
                        {
                            GPU.CopyHostToDeviceHalf(HostData[z], new IntPtr((long)DeviceData + ElementsSliceReal * z * sizeof(short)), ElementsSliceReal);
                        }
                    }

                    IsHostDirty = false;
                }

                if ((intent & Intent.Write) > 0)
                {
                    IsDeviceDirty = true;
                    IsHostDirty   = false;
                }

                return(DeviceData);
            }
        }