示例#1
0
 /// <summary>
 /// Constructor of the <see cref="MemoryObject"/> object. Don't use this constructor, use <see cref="SharpCL.Context"/> methods to create <see cref="Buffer"/>s and <see cref="Image"/>s.
 /// </summary>
 public MemoryObject(IntPtr handle, Context context, MemoryObjectType objectType, MemoryFlags memoryFlags)
 {
     Handle           = handle;
     Context          = context;
     MemoryObjectType = objectType;
     MemoryFlags      = memoryFlags;
 }
示例#2
0
 private extern static ErrorCode clGetSupportedImageFormats(
     IntPtr context,
     MemoryFlags flags,
     MemoryObjectType image_type,
     UInt32 num_entries,
     [Out, MarshalAs(UnmanagedType.LPArray)] ImageFormat[] image_formats,
     out UInt32 num_image_formats);
示例#3
0
 /// <summary>
 /// Constructor of the <see cref="Image"/> object. Don't use this constructor, use CreateImage* methods of <see cref="Context"/> object instead.
 /// </summary>
 public Image(IntPtr handle, Context context, MemoryObjectType objectType, MemoryFlags memoryFlags, Size size, UInt64 arraySize, ImageChannelOrder channelOrder, ImageChannelType channelType) :
     base(handle, context, objectType, memoryFlags)
 {
     Size         = size;
     ArraySize    = arraySize;
     ChannelOrder = channelOrder;
     ChannelType  = channelType;
 }
示例#4
0
 public static extern Result GetSupportedImageFormats(
     [In] IntPtr context,
     [In][MarshalAs(UnmanagedType.U8)] MemoryFlag flags,
     [In][MarshalAs(UnmanagedType.U4)] MemoryObjectType imageType,
     [In][MarshalAs(UnmanagedType.U4)] uint numberOfEntries,
     [Out][MarshalAs(UnmanagedType.LPArray)] ImageFormat[] imageFormats,
     [Out][MarshalAs(UnmanagedType.U4)] out uint numberOfImageFormats
     );
示例#5
0
        /// <summary>
        /// Return the list of the supported <see cref="Image"/> formats as a list of <see cref="ImageFormat"/>.
        /// </summary>
        /// <param name="type">The type of image.</param>
        /// <param name="flags">A bit-field that is used to specify allocation and usage information about the image.</param>
        /// <returns></returns>
        public List <ImageFormat> SupportedImageFormats(MemoryObjectType type, MemoryFlags flags)
        {
            error = clGetSupportedImageFormats(Handle, flags, type, 0, null, out UInt32 formatCount);
            if (error != ErrorCode.Success)
            {
                return(null);
            }

            ImageFormat[] formats = new ImageFormat[formatCount];
            error = clGetSupportedImageFormats(Handle, flags, type, formatCount, formats, out _);
            if (error != ErrorCode.Success)
            {
                return(null);
            }

            return(new List <ImageFormat>(formats));
        }
示例#6
0
 /// <summary>
 /// Constructor of the <see cref="Buffer"/> object. Don't use this constructor, use <see cref="Context.CreateBuffer{DataType}(DataType[], MemoryFlags)"/> or <see cref="Context.CreateBuffer{DataType}(ulong, MemoryFlags)"/> instead.
 /// </summary>
 public Buffer(IntPtr handle, Context context, UInt64 length, UInt64 itemSize, MemoryObjectType objectType, MemoryFlags memoryFlags) : base(handle, context, objectType, memoryFlags)
 {
     Length   = length;
     ItemSize = itemSize;
 }