示例#1
0
 internal static extern CLSampler clCreateSampler(CLContext context, CLBool normalized_coords, CLAddressingMode addressing_mode, CLFilterMode filter_mode, ref CLError errcode_ret);
示例#2
0
 internal static extern CLError clGetContextInfo(CLContext context, CLContextInfo param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);
示例#3
0
 internal static extern CLSampler clCreateSampler(CLContext context, CLBool normalized_coords, CLAddressingMode addressing_mode, CLFilterMode filter_mode, ref CLError errcode_ret);
示例#4
0
 internal static extern CLError clCreateFromGLBuffer(CLContext context, CLMemFlags flags, int bufobj, ref CLError errcode_ret);
示例#5
0
 internal static extern CLCommandQueue clCreateCommandQueue(CLContext context, CLDeviceID device, CLCommandQueueProperties properties, ref CLError errcode_ret);
示例#6
0
 internal static extern CLProgram clCreateProgramWithBinary(CLContext context, int num_devices, [In] CLDeviceID[] device_list, [In] SizeT[] lengths, [In] IntPtr[] binaries, [In] int[] binary_status, ref CLError errcode_ret);
示例#7
0
 internal static extern CLMem clCreateBuffer(CLContext context, CLMemFlags flags, SizeT size, IntPtr host_ptr, ref CLError errcode_ret);
示例#8
0
 internal static extern CLError clRetainContext(CLContext context);
示例#9
0
 internal static extern CLError clGetSupportedImageFormats(CLContext context, CLMemFlags flags, CLMemObjectType image_type, int num_entries, [Out] CLImageFormat[] image_formats, ref int num_image_formats);
示例#10
0
 internal static extern CLError clReleaseContext(CLContext context);
示例#11
0
 internal static extern CLError clGetContextInfo(CLContext context, CLContextInfo param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);
示例#12
0
 internal static extern CLMem clCreateFromGLTexture3D(CLContext context, CLMemFlags flags, int target, int miplevel, uint texture, ref CLError errcode_ret);
示例#13
0
 internal static extern CLError clCreateFromGLRenderbuffer(CLContext context, CLMemFlags flags, int renderbuffer, ref CLError errcode_ret);
示例#14
0
 internal static extern CLError clGetSupportedImageFormats(CLContext context, CLMemFlags flags, CLMemObjectType image_type, int num_entries, [Out] CLImageFormat[] image_formats, ref int num_image_formats);
示例#15
0
 internal static extern CLError clRetainContext(CLContext context);
示例#16
0
 internal static extern CLError clReleaseContext(CLContext context);
示例#17
0
 internal static extern CLCommandQueue clCreateCommandQueue(CLContext context, CLDeviceID device, CLCommandQueueProperties properties, ref CLError errcode_ret);
示例#18
0
 internal static extern CLMem clCreateBuffer(CLContext context, CLMemFlags flags, SizeT size, IntPtr host_ptr, ref CLError errcode_ret);
示例#19
0
 internal static extern CLMem clCreateImage3D(CLContext context, CLMemFlags flags, ref CLImageFormat image_format, SizeT image_width, SizeT image_height, SizeT image_depth, SizeT image_row_pitch, SizeT image_slice_pitch, IntPtr host_ptr, ref CLError errcode_ret);
示例#20
0
 internal static extern CLMem clCreateImage3D(CLContext context, CLMemFlags flags, ref CLImageFormat image_format, SizeT image_width, SizeT image_height, SizeT image_depth, SizeT image_row_pitch, SizeT image_slice_pitch, IntPtr host_ptr, ref CLError errcode_ret);
示例#21
0
 internal static extern CLProgram clCreateProgramWithBinary(CLContext context, int num_devices, [In] CLDeviceID[] device_list, [In] SizeT[] lengths, [In] IntPtr[] binaries, [In] int[] binary_status, ref CLError errcode_ret);
示例#22
0
 internal static extern CLProgram clCreateProgramWithSource(CLContext context, int count, [In] string[] strings, [In] SizeT[] lengths, ref CLError errcode_ret);
示例#23
0
 internal static extern CLProgram clCreateProgramWithSource(CLContext context, int count, [In] string[] strings, [In] SizeT[] lengths, ref CLError errcode_ret);
示例#24
0
 private Context(CLContext openclContext, Platforms platforms, Devices devices)
 {
     this.Devices = devices;
     this.Platforms = platforms;
     this.CLContext = openclContext;
 }
示例#25
0
文件: Context.cs 项目: ddrinka/ManOCL
        public static Context Share(IntPtr openclContext)
        {
            SizeT devicesSize = SizeT.Zero;

            CLContext clContext = new CLContext { Value = openclContext };

            OpenCLError.Validate(OpenCLDriver.clGetContextInfo(clContext, CLContextInfo.Devices, SizeT.Zero, IntPtr.Zero, ref devicesSize));

            CLDeviceID[] devices = new CLDeviceID[((Int64)(devicesSize)) / IntPtr.Size];

            GCHandle devicesHandle = GCHandle.Alloc(devices, GCHandleType.Pinned);

            try
            {
                OpenCLError.Validate(OpenCLDriver.clGetContextInfo(clContext, CLContextInfo.Devices, devicesSize, devicesHandle.AddrOfPinnedObject(), ref devicesSize));

                Dictionary<CLPlatformID, CLPlatformID> platformsDictionary = new Dictionary<CLPlatformID, CLPlatformID>();

                CLPlatformID[] platforms = null;

                foreach (CLDeviceID device in devices)
                {
                    SizeT platformsSize = SizeT.Zero;

                    OpenCLError.Validate(OpenCLDriver.clGetDeviceInfo(device, CLDeviceInfo.Platform, SizeT.Zero, platforms, ref platformsSize));

                    platforms = new CLPlatformID[((Int64)(platformsSize)) / IntPtr.Size];

                    OpenCLError.Validate(OpenCLDriver.clGetDeviceInfo(device, CLDeviceInfo.Platform, platformsSize, platforms, ref platformsSize));

                    foreach (CLPlatformID platform in platforms)
                    {
                        if (!platformsDictionary.ContainsKey(platform))
                        {
                            platformsDictionary.Add(platform, platform);
                        }
                    }
                }

                platforms = new CLPlatformID[platformsDictionary.Count];

                Int32 index = 0;

                foreach (var platform in platformsDictionary.Keys)
                {
                    platforms[index++] = platform;
                }

                return new Context(clContext, new Platforms(platforms), new Devices(devices));
            }
            finally
            {
                devicesHandle.Free();
            }
        }