private OpenCLImage3D(CLMemoryHandle handle, OpenCLContext context, OpenCLMemoryFlags flags) : base(context, flags) { Handle = handle; Init(); }
public extern static CLMemoryHandle CreateFromGLTexture3D( CLContextHandle context, OpenCLMemoryFlags flags, Int32 target, Int32 miplevel, Int32 texture, out OpenCLErrorCode errcode_ret);
public extern static OpenCLErrorCode GetSupportedImageFormats( CLContextHandle context, OpenCLMemoryFlags flags, OpenCLMemoryType image_type, Int32 num_entries, [Out, MarshalAs(UnmanagedType.LPArray)] OpenCLImageFormat[] image_formats, out Int32 num_image_formats);
private OpenCLImage3D(CLMemoryHandle handle, OpenCLContext context, OpenCLMemoryFlags flags) : base(context, flags) { Handle = handle; Init(); }
public extern static CLMemoryHandle CreateImage2D( CLContextHandle context, OpenCLMemoryFlags flags, ref OpenCLImageFormat image_format, IntPtr image_width, IntPtr image_height, IntPtr image_row_pitch, IntPtr host_ptr, out OpenCLErrorCode errcode_ret);
/// <summary> /// Creates a new <see cref="OpenCLImage2D"/> from an OpenGL 2D texture object. /// </summary> /// <param name="context"> A <see cref="OpenCLContext"/> with enabled CL/GL sharing. </param> /// <param name="flags"> A bit-field that is used to specify usage information about the <see cref="OpenCLImage2D"/>. Only <c>OpenCLMemoryFlags.ReadOnly</c>, <c>OpenCLMemoryFlags.WriteOnly</c> and <c>OpenCLMemoryFlags.ReadWrite</c> are allowed. </param> /// <param name="textureTarget"> One of the following values: GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_TEXTURE_RECTANGLE. Using GL_TEXTURE_RECTANGLE for texture_target requires OpenGL 3.1. Alternatively, GL_TEXTURE_RECTANGLE_ARB may be specified if the OpenGL extension GL_ARB_texture_rectangle is supported. </param> /// <param name="mipLevel"> The mipmap level of the OpenGL 2D texture object to be used. </param> /// <param name="textureId"> The OpenGL 2D texture object id to use. </param> /// <returns> The created <see cref="OpenCLImage2D"/>. </returns> public static OpenCLImage2D CreateFromGLTexture2D(OpenCLContext context, OpenCLMemoryFlags flags, int textureTarget, int mipLevel, int textureId) { OpenCLErrorCode error = OpenCLErrorCode.Success; CLMemoryHandle image = CL10.CreateFromGLTexture2D(context.Handle, flags, textureTarget, mipLevel, textureId, out error); OpenCLException.ThrowOnError(error); return(new OpenCLImage2D(image, context, flags)); }
/// <summary> /// Creates a new <see cref="OpenCLImage2D"/> from an OpenGL renderbuffer object. /// </summary> /// <param name="context"> A <see cref="OpenCLContext"/> with enabled CL/GL sharing. </param> /// <param name="flags"> A bit-field that is used to specify usage information about the <see cref="OpenCLImage2D"/>. Only <c>OpenCLMemoryFlags.ReadOnly</c>, <c>OpenCLMemoryFlags.WriteOnly</c> and <c>OpenCLMemoryFlags.ReadWrite</c> are allowed. </param> /// <param name="renderbufferId"> The OpenGL renderbuffer object id to use. </param> /// <returns> The created <see cref="OpenCLImage2D"/>. </returns> public static OpenCLImage2D CreateFromGLRenderbuffer(OpenCLContext context, OpenCLMemoryFlags flags, int renderbufferId) { OpenCLErrorCode error = OpenCLErrorCode.Success; CLMemoryHandle image = CL10.CreateFromGLRenderbuffer(context.Handle, flags, renderbufferId, out error); OpenCLException.ThrowOnError(error); return(new OpenCLImage2D(image, context, flags)); }
/// <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> /// Creates a new <see cref="OpenCLSubBuffer{T}"/> from a specified <see cref="OpenCLBuffer{T}"/>. /// </summary> /// <param name="buffer"> The buffer to create the <see cref="OpenCLSubBuffer{T}"/> from. </param> /// <param name="flags"> A bit-field that is used to specify allocation and usage information about the <see cref="OpenCLBuffer{T}"/>. </param> /// <param name="offset"> The index of the element of <paramref name="buffer"/>, where the <see cref="OpenCLSubBuffer{T}"/> starts. </param> /// <param name="count"> The number of elements of <paramref name="buffer"/> to include in the <see cref="OpenCLSubBuffer{T}"/>. </param> public OpenCLSubBuffer(OpenCLBuffer buffer, OpenCLMemoryFlags flags, long offset, long count) : base(buffer.Context, flags, buffer.ElementType, new long[] { count }) { SysIntX2 region = new SysIntX2(offset * Marshal.SizeOf(buffer.ElementType), count * Marshal.SizeOf(buffer.ElementType)); OpenCLErrorCode error; CLMemoryHandle handle = CL11.CreateSubBuffer(Handle, flags, OpenCLBufferCreateType.Region, ref region, out error); OpenCLException.ThrowOnError(error); Init(); }
/// <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> /// Creates a new <see cref="OpenCLSubBuffer{T}"/> from a specified <see cref="OpenCLBuffer{T}"/>. /// </summary> /// <param name="buffer"> The buffer to create the <see cref="OpenCLSubBuffer{T}"/> from. </param> /// <param name="flags"> A bit-field that is used to specify allocation and usage information about the <see cref="OpenCLBuffer{T}"/>. </param> /// <param name="offset"> The index of the element of <paramref name="buffer"/>, where the <see cref="OpenCLSubBuffer{T}"/> starts. </param> /// <param name="count"> The number of elements of <paramref name="buffer"/> to include in the <see cref="OpenCLSubBuffer{T}"/>. </param> public OpenCLSubBuffer(OpenCLBuffer buffer, OpenCLMemoryFlags flags, long offset, long count) : base(buffer.Context, flags, buffer.ElementType, new long[] { count }) { SysIntX2 region = new SysIntX2(offset * Marshal.SizeOf(buffer.ElementType), count * Marshal.SizeOf(buffer.ElementType)); OpenCLErrorCode error; CLMemoryHandle handle = CL11.CreateSubBuffer(Handle, flags, OpenCLBufferCreateType.Region, ref region, out error); OpenCLException.ThrowOnError(error); Init(); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="flags"></param> protected OpenCLImage(OpenCLContext context, OpenCLMemoryFlags flags) : base(context, flags) { }
/// <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> /// Creates a new <see cref="OpenCLImage3D"/> from an OpenGL 3D texture object. /// </summary> /// <param name="context"> A <see cref="OpenCLContext"/> with enabled CL/GL sharing. </param> /// <param name="flags"> A bit-field that is used to specify usage information about the <see cref="OpenCLImage3D"/>. Only <c>OpenCLMemoryFlags.ReadOnly</c>, <c>OpenCLMemoryFlags.WriteOnly</c> and <c>OpenCLMemoryFlags.ReadWrite</c> are allowed. </param> /// <param name="textureTarget"> The image type of texture. Must be GL_TEXTURE_3D. </param> /// <param name="mipLevel"> The mipmap level of the OpenGL 2D texture object to be used. </param> /// <param name="textureId"> The OpenGL 2D texture object id to use. </param> /// <returns> The created <see cref="OpenCLImage2D"/>. </returns> public static OpenCLImage3D CreateFromGLTexture3D(OpenCLContext context, OpenCLMemoryFlags flags, int textureTarget, int mipLevel, int textureId) { CLMemoryHandle image; OpenCLErrorCode error = OpenCLErrorCode.Success; image = CL10.CreateFromGLTexture3D(context.Handle, flags, textureTarget, mipLevel, textureId, out error); OpenCLException.ThrowOnError(error); return new OpenCLImage3D(image, context, flags); }
/// <summary> /// Creates a new <see cref="OpenCLImage2D"/> from an OpenGL renderbuffer object. /// </summary> /// <param name="context"> A <see cref="OpenCLContext"/> with enabled CL/GL sharing. </param> /// <param name="flags"> A bit-field that is used to specify usage information about the <see cref="OpenCLImage2D"/>. Only <c>OpenCLMemoryFlags.ReadOnly</c>, <c>OpenCLMemoryFlags.WriteOnly</c> and <c>OpenCLMemoryFlags.ReadWrite</c> are allowed. </param> /// <param name="renderbufferId"> The OpenGL renderbuffer object id to use. </param> /// <returns> The created <see cref="OpenCLImage2D"/>. </returns> public static OpenCLImage2D CreateFromGLRenderbuffer(OpenCLContext context, OpenCLMemoryFlags flags, int renderbufferId) { OpenCLErrorCode error = OpenCLErrorCode.Success; CLMemoryHandle image = CL10.CreateFromGLRenderbuffer(context.Handle, flags, renderbufferId, out error); OpenCLException.ThrowOnError(error); return new OpenCLImage2D(image, context, flags); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="flags"></param> protected OpenCLBufferBase(OpenCLContext context, OpenCLMemoryFlags flags, Type elementType, long[] count) : base(context, flags) { ElementType = elementType; this.Count = count; }
/// <summary> /// Gets a collection of supported <see cref="OpenCLImage3D"/> <see cref="OpenCLImageFormat"/>s in a <see cref="OpenCLContext"/>. /// </summary> /// <param name="context"> The <see cref="OpenCLContext"/> for which the collection of <see cref="OpenCLImageFormat"/>s is queried. </param> /// <param name="flags"> The <c>OpenCLMemoryFlags</c> for which the collection of <see cref="OpenCLImageFormat"/>s is queried. </param> /// <returns> The collection of the required <see cref="OpenCLImageFormat"/>s. </returns> public static ICollection<OpenCLImageFormat> GetSupportedFormats(OpenCLContext context, OpenCLMemoryFlags flags) { return GetSupportedFormats(context, flags, OpenCLMemoryType.Image3D); }
public extern static CLMemoryHandle CreateFromGLRenderbuffer( CLContextHandle context, OpenCLMemoryFlags flags, Int32 renderbuffer, out OpenCLErrorCode errcode_ret);
public extern static CLMemoryHandle CreateFromGLTexture3D( CLContextHandle context, OpenCLMemoryFlags flags, Int32 target, Int32 miplevel, Int32 texture, out OpenCLErrorCode errcode_ret);
public extern static CLMemoryHandle CreateSubBuffer( CLMemoryHandle buffer, OpenCLMemoryFlags flags, OpenCLBufferCreateType buffer_create_type, ref SysIntX2 buffer_create_info, out OpenCLErrorCode errcode_ret);
public OpenCLBuffer CreateWriteOnlyBuffer <T>(long count) { const OpenCLMemoryFlags flags = OpenCLMemoryFlags.WriteOnly | OpenCLMemoryFlags.AllocateHostPointer; return(new OpenCLBuffer(Context, flags, typeof(T), new [] { count })); }
public extern static CLMemoryHandle CreateSubBuffer( CLMemoryHandle buffer, OpenCLMemoryFlags flags, OpenCLBufferCreateType buffer_create_type, ref SysIntX2 buffer_create_info, out OpenCLErrorCode errcode_ret);
/// <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> protected OpenCLImage(OpenCLContext context, OpenCLMemoryFlags flags) : base(context, flags) { }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="flags"></param> protected OpenCLBufferBase(OpenCLContext context, OpenCLMemoryFlags flags, Type elementType, long[] count) : base(context, flags) { ElementType = elementType; this.Count = count; }
public extern static CLMemoryHandle CreateFromGLRenderbuffer( CLContextHandle context, OpenCLMemoryFlags flags, Int32 renderbuffer, out OpenCLErrorCode errcode_ret);
public extern static CLMemoryHandle CreateBuffer( CLContextHandle context, OpenCLMemoryFlags flags, IntPtr size, IntPtr host_ptr, out OpenCLErrorCode errcode_ret);
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="flags"></param> protected OpenCLMemory(OpenCLContext context, OpenCLMemoryFlags flags) { this.context = context; this.flags = flags; }
public extern static CLMemoryHandle CreateBuffer( CLContextHandle context, OpenCLMemoryFlags flags, IntPtr size, IntPtr host_ptr, out OpenCLErrorCode errcode_ret);
/// <summary> /// Gets a collection of supported <see cref="OpenCLImage3D"/> <see cref="OpenCLImageFormat"/>s in a <see cref="OpenCLContext"/>. /// </summary> /// <param name="context"> The <see cref="OpenCLContext"/> for which the collection of <see cref="OpenCLImageFormat"/>s is queried. </param> /// <param name="flags"> The <c>OpenCLMemoryFlags</c> for which the collection of <see cref="OpenCLImageFormat"/>s is queried. </param> /// <returns> The collection of the required <see cref="OpenCLImageFormat"/>s. </returns> public static ICollection <OpenCLImageFormat> GetSupportedFormats(OpenCLContext context, OpenCLMemoryFlags flags) { return(GetSupportedFormats(context, flags, OpenCLMemoryType.Image3D)); }
public extern static CLMemoryHandle CreateImage3D( CLContextHandle context, OpenCLMemoryFlags flags, ref OpenCLImageFormat image_format, IntPtr image_width, IntPtr image_height, IntPtr image_depth, IntPtr image_row_pitch, IntPtr image_slice_pitch, IntPtr host_ptr, out OpenCLErrorCode errcode_ret);
public extern static OpenCLErrorCode GetSupportedImageFormats( CLContextHandle context, OpenCLMemoryFlags flags, OpenCLMemoryType image_type, Int32 num_entries, [Out, MarshalAs(UnmanagedType.LPArray)] OpenCLImageFormat[] image_formats, out Int32 num_image_formats);
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="flags"></param> protected OpenCLMemory(OpenCLContext context, OpenCLMemoryFlags flags) { this.context = context; this.flags = flags; }