Exemplo n.º 1
0
        public static ComputeImage2D CreateImage2D(int w, int h, bool write, bool read)
        {
            ImageFormat fmt = new ImageFormat(ChannelOrder.RGB, ChannelType.Unsigned_Int8);
            var         img = Cl.CreateImage2D(_context, (write && read ? MemFlags.ReadWrite : 0) | (write && !read ? MemFlags.WriteOnly : 0) | (!write && read ? MemFlags.ReadOnly : 0), fmt, (IntPtr)w, (IntPtr)h, IntPtr.Zero, null, out var err);

            ComputeImage2D cimg = new ComputeImage2D()
            {
                img    = img,
                Width  = w,
                Height = h
            };

            return(cimg);
        }
Exemplo n.º 2
0
 public static void SubmitImage2DRead(ComputeImage2D img, object dest)
 {
     Cl.EnqueueReadImage(_queue, img.img, Bool.False, new[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero }, new[] { (IntPtr)img.Width, (IntPtr)img.Height, (IntPtr)1 }, IntPtr.Zero, IntPtr.Zero, dest, 0, null, out var ign);
 }