예제 #1
0
        /// <summary>
        /// Creates a new <see cref="OpenCLImage3D"/>.
        /// </summary>
        /// <param name="context"> A valid <see cref="OpenCLContext"/> in which the <see cref="OpenCLImage3D"/> is created. </param>
        /// <param name="flags"> A bit-field that is used to specify allocation and usage information about the <see cref="OpenCLImage3D"/>. </param>
        /// <param name="format"> A structure that describes the format properties of the <see cref="OpenCLImage3D"/>. </param>
        /// <param name="width"> The width of the <see cref="OpenCLImage3D"/> in pixels. </param>
        /// <param name="height"> The height of the <see cref="OpenCLImage3D"/> in pixels. </param>
        /// <param name="depth"> The depth of the <see cref="OpenCLImage3D"/> in pixels. </param>
        /// <param name="rowPitch"> The size in bytes of each row of elements of the <see cref="OpenCLImage3D"/>. If <paramref name="rowPitch"/> is zero, OpenCL will compute the proper value based on <see cref="OpenCLImage.Width"/> and <see cref="OpenCLImage.ElementSize"/>. </param>
        /// <param name="slicePitch"> The size in bytes of each 2D slice in the <see cref="OpenCLImage3D"/>. If <paramref name="slicePitch"/> is zero, OpenCL will compute the proper value based on <see cref="OpenCLImage.RowPitch"/> and <see cref="OpenCLImage.Height"/>. </param>
        /// <param name="data"> The data to initialize the <see cref="OpenCLImage3D"/>. Can be <c>IntPtr.Zero</c>. </param>
        public OpenCLImage3D(OpenCLContext context, OpenCLMemoryFlags flags, OpenCLImageFormat format, int width, int height, int depth, long rowPitch, long slicePitch, IntPtr data)
            : base(context, flags)
        {
            OpenCLErrorCode error = OpenCLErrorCode.Success;

            Handle = CL10.CreateImage3D(context.Handle, flags, ref format, new IntPtr(width), new IntPtr(height), new IntPtr(depth), new IntPtr(rowPitch), new IntPtr(slicePitch), data, out error);
            OpenCLException.ThrowOnError(error);

            Init();
        }
예제 #2
0
 /// <summary>
 /// Creates a new <see cref="ComputeImage3D"/>.
 /// </summary>
 /// <param name="context"> A valid context in which the <see cref="ComputeImage3D"/> is created. </param>
 /// <param name="flags"> A bit-field that is used to specify allocation and usage information about the <see cref="ComputeImage3D"/>. </param>
 /// <param name="format"> A structure that describes the format properties of the <see cref="ComputeImage3D"/>. </param>
 /// <param name="width"> The width of the <see cref="ComputeImage3D"/> in pixels. </param>
 /// <param name="height"> The height of the <see cref="ComputeImage3D"/> in pixels. </param>
 /// <param name="depth"> The depth of the <see cref="ComputeImage3D"/> in pixels. </param>
 /// <param name="rowPitch"> The size in bytes of each row of elements of the <see cref="ComputeImage3D"/>. If <paramref name="rowPitch"/> is zero, OpenCL will compute the proper value based on image width and image element size. </param>
 /// <param name="slicePitch"> The size in bytes of each 2D slice in the <see cref="ComputeImage3D"/>. If <paramref name="slicePitch"/> is zero, OpenCL will compute the proper value based on image row pitch and image height. </param>
 /// <param name="data"> The data to initialize the <see cref="ComputeImage3D"/>. Can be <c>IntPtr.Zero</c>. </param>
 public ComputeImage3D(IComputeContext context, ComputeMemoryFlags flags, ComputeImageFormat format,
                       int width, int height, int depth, long rowPitch, long slicePitch, IntPtr data)
     : base(context, flags)
 {
     Handle = CL10.CreateImage3D(
         context.Handle,
         flags,
         ref format,
         new IntPtr(width),
         new IntPtr(height),
         new IntPtr(depth),
         new IntPtr(rowPitch),
         new IntPtr(slicePitch),
         data,
         out ComputeErrorCode error);
     ComputeException.ThrowOnError(error);
     Init();
 }