/// <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(); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="flags"></param> /// <param name="type"></param> /// <returns></returns> protected static ICollection <OpenCLImageFormat> GetSupportedFormats(OpenCLContext context, OpenCLMemoryFlags flags, OpenCLMemoryType type) { int formatCountRet = 0; OpenCLErrorCode error = CL10.GetSupportedImageFormats(context.Handle, flags, type, 0, null, out formatCountRet); OpenCLException.ThrowOnError(error); OpenCLImageFormat[] formats = new OpenCLImageFormat[formatCountRet]; error = CL10.GetSupportedImageFormats(context.Handle, flags, type, formatCountRet, formats, out formatCountRet); OpenCLException.ThrowOnError(error); return(new Collection <OpenCLImageFormat>(formats)); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="flags"></param> /// <param name="type"></param> /// <returns></returns> protected static ICollection<OpenCLImageFormat> GetSupportedFormats(OpenCLContext context, OpenCLMemoryFlags flags, OpenCLMemoryType type) { int formatCountRet = 0; OpenCLErrorCode error = CL10.GetSupportedImageFormats(context.Handle, flags, type, 0, null, out formatCountRet); OpenCLException.ThrowOnError(error); OpenCLImageFormat[] formats = new OpenCLImageFormat[formatCountRet]; error = CL10.GetSupportedImageFormats(context.Handle, flags, type, formatCountRet, formats, out formatCountRet); OpenCLException.ThrowOnError(error); return new Collection<OpenCLImageFormat>(formats); }