示例#1
0
 /// <summary>
 /// Convenience function. Checks if a context supports a specific image format
 /// </summary>
 /// <param name="flags"></param>
 /// <param name="type"></param>
 /// <param name="channelOrder"></param>
 /// <param name="channelType"></param>
 /// <returns>true if the image format is supported, false otherwise</returns>
 public bool SupportsImageFormat(MemFlags flags, MemObjectType type, ChannelOrder channelOrder, ChannelType channelType)
 {
     CLImageFormat[] imageFormats = GetSupportedImageFormats(flags, type);
     foreach (CLImageFormat imageFormat in imageFormats)
     {
         if (imageFormat.ChannelOrder == channelOrder && imageFormat.ChannelType == channelType)
         {
             return(true);
         }
     }
     return(false);
 }
示例#2
0
        public bool IsSupported(Context context, MemFlags flags, MemObjectType type)
        {
            ImageFormat[] supportedFormats = GetSupportedImageFormats(context, flags, type);

            foreach (ImageFormat supported in supportedFormats)
            {
                if (supported == this)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#3
0
        /// <summary>
        ///     Convenience function. Checks if a context supports a specific image format
        /// </summary>
        /// <param name="flags"></param>
        /// <param name="type"></param>
        /// <param name="channelOrder"></param>
        /// <param name="channelType"></param>
        /// <returns>true if the image format is supported, false otherwise</returns>
        public Boolean SupportsImageFormat(MemFlags flags, MemObjectType type, ChannelOrder channelOrder, ChannelType channelType)
        {
            var imageFormats = this.GetSupportedImageFormats(flags, type);

            foreach (var imageFormat in imageFormats)
            {
                if (imageFormat.ChannelOrder == channelOrder && imageFormat.ChannelType == channelType)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#4
0
        /// <summary>
        /// Query which ImageFormats are supported by this context
        /// </summary>
        /// <param name="flags"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public CLImageFormat[] GetSupportedImageFormats(MemFlags flags, MemObjectType type)
        {
            uint numImageFormats;

            CLImageFormat[] imageFormats;
            ErrorCode       result;

            result = OpenCL.GetSupportedImageFormats(ContextID, (ulong)flags, (uint)type, (uint)0, null, out numImageFormats);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("GetSupportedImageFormats failed with error code " + result, result);
            }

            imageFormats = new CLImageFormat[numImageFormats];

            result = OpenCL.GetSupportedImageFormats(ContextID, (ulong)flags, (uint)type, numImageFormats, imageFormats, out numImageFormats);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("GetSupportedImageFormats failed with error code " + result, result);
            }

            return(imageFormats);
        }
示例#5
0
        /// <summary>
        ///     Query which ImageFormats are supported by this context
        /// </summary>
        /// <param name="flags"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public ImageFormat[] GetSupportedImageFormats(MemFlags flags, MemObjectType type)
        {
            UInt32 numImageFormats;

            ImageFormat[] imageFormats;
            ErrorCode     result;

            result = OpenCL.GetSupportedImageFormats(this.ContextID, (UInt64)flags, (UInt32)type, 0, null, out numImageFormats);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("GetSupportedImageFormats failed with error code " + result, result);
            }

            imageFormats = new ImageFormat[numImageFormats];

            result = OpenCL.GetSupportedImageFormats(this.ContextID, (UInt64)flags, (UInt32)type, numImageFormats, imageFormats, out numImageFormats);
            if (result != ErrorCode.SUCCESS)
            {
                throw new OpenCLException("GetSupportedImageFormats failed with error code " + result, result);
            }

            return(imageFormats);
        }
示例#6
0
 internal extern static unsafe ErrorCode GetSupportedImageFormats(IntPtr context, MemFlags flags, MemObjectType image_type, uint num_entries, ImageFormat *image_formats, uint *num_image_formats);
示例#7
0
 /// <summary>
 /// Convenience function. Checks if a context supports a specific image format
 /// </summary>
 /// <param name="flags"></param>
 /// <param name="type"></param>
 /// <param name="channelOrder"></param>
 /// <param name="channelType"></param>
 /// <returns>true if the image format is supported, false otherwise</returns>
 public bool SupportsImageFormat(MemFlags flags, MemObjectType type, ChannelOrder channelOrder, ChannelType channelType)
 {
     ImageFormat[] imageFormats = GetSupportedImageFormats(flags, type);
     foreach (ImageFormat imageFormat in imageFormats)
     {
         if (imageFormat.ChannelOrder == channelOrder && imageFormat.ChannelType == channelType)
             return true;
     }
     return false;
 }
示例#8
0
        /// <summary>
        /// Query which ImageFormats are supported by this context
        /// </summary>
        /// <param name="flags"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public ImageFormat[] GetSupportedImageFormats(MemFlags flags, MemObjectType type)
        {
            uint numImageFormats;
            ImageFormat[] imageFormats;
            ErrorCode result;

            result = OpenCL.GetSupportedImageFormats(ContextID, (ulong)flags, (uint)type, (uint)0, null, out numImageFormats);
            if( result!=ErrorCode.SUCCESS )
                throw new OpenCLException("GetSupportedImageFormats failed with error code " + result, result);

            imageFormats = new ImageFormat[numImageFormats];

            result = OpenCL.GetSupportedImageFormats(ContextID, (ulong)flags, (uint)type, numImageFormats, imageFormats, out numImageFormats);
            if (result != ErrorCode.SUCCESS)
                throw new OpenCLException("GetSupportedImageFormats failed with error code " + result, result);

            return imageFormats;
        }
示例#9
0
        public static ImageFormat[] GetSupportedImageFormats(Context context, MemFlags flags, MemObjectType imageType, out ErrorCode error)
        {
            uint imageFormatCount;

            error = GetSupportedImageFormats(context, flags, imageType, 0, null, out imageFormatCount);
            if (error != ErrorCode.Success)
            {
                return(new ImageFormat[0]);
            }

            var imageFormats = new ImageFormat[imageFormatCount];

            error = GetSupportedImageFormats(context, flags, imageType, imageFormatCount, imageFormats, out imageFormatCount);
            if (error != ErrorCode.Success)
            {
                return(new ImageFormat[0]);
            }

            return(imageFormats);
        }
示例#10
0
        public static ImageFormat[] GetSupportedImageFormats(Context context, MemFlags flags, MemObjectType imageType, out ErrorCode error)
        {
            uint imageFormatCount;
            error = GetSupportedImageFormats(context, flags, imageType, 0, null, out imageFormatCount);
            if (error != ErrorCode.Success)
                return new ImageFormat[0];

            var imageFormats = new ImageFormat[imageFormatCount];
            error = GetSupportedImageFormats(context, flags, imageType, imageFormatCount, imageFormats, out imageFormatCount);
            if (error != ErrorCode.Success)
                return new ImageFormat[0];
            
            return imageFormats;
        }
示例#11
0
        public static       ImageFormat[] GetSupportedImageFormats(Context context, MemFlags flags, MemObjectType type)
        {
            uint count = 0;

            unsafe {
                Native.Call(Native.GetSupportedImageFormats(context.Handle, flags, type, 0, null, &count));
            }

            ImageFormat[] result = new ImageFormat[count];

            unsafe
            {
                fixed(ImageFormat *p_result = result)
                {
                    Native.Call(Native.GetSupportedImageFormats(context.Handle, flags, type, count, p_result, null));
                }
            }
            return(result);
        }
示例#12
0
 internal extern static unsafe int GetSupportedImageFormats(IntPtr context, MemFlags flags, MemObjectType image_type, uint num_entries, ImageFormat* image_formats, uint* num_image_formats);
示例#13
0
 public static Error clGetSupportedImageFormats(OpenCLContext context, MemFlags flags, MemObjectType image_type, Int32 num_entries, [Out] ImageFormat[] image_formats, Int32 num_image_formats)
 {
     Console.WriteLine("Calling Error clGetSupportedImageFormats(OpenCLContext context, MemFlags flags, MemObjectType image_type, Int32 num_entries, [Out] ImageFormat[] image_formats, Int32 num_image_formats)");
     return default(Error);
 }
示例#14
0
 public static extern Error clGetSupportedImageFormats(OpenCLContext context, MemFlags flags, MemObjectType image_type, Int32 num_entries, [Out] ImageFormat[] image_formats, Int32 num_image_formats);
示例#15
0
 private static extern OpenCLErrorCode clGetSupportedImageFormats(IntPtr context,
                                                            MemFlags flags,
                                                            MemObjectType imageType,
                                                            uint numEntries,
                                                            [Out] [MarshalAs(UnmanagedType.LPArray)] ImageFormat[] imageFormats,
                                                            out uint numImageFormats);
示例#16
0
 public static OpenCLErrorCode GetSupportedImageFormats(ContextHandle context,
                                                  MemFlags flags,
                                                  MemObjectType imageType,
                                                  uint numEntries,
                                                  ImageFormat[] imageFormats,
                                                  out uint numImageFormats)
 {
     return clGetSupportedImageFormats((context as IHandleData).Handle, flags, imageType, numEntries, imageFormats, out numImageFormats);
 }