コード例 #1
0
ファイル: Image.cs プロジェクト: 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);
            }
        }