Exemplo n.º 1
0
 internal static extern CLSampler clCreateSampler(CLContext context, CLBool normalized_coords, CLAddressingMode addressing_mode, CLFilterMode filter_mode, ref CLError errcode_ret);
Exemplo n.º 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);
Exemplo n.º 3
0
 internal static extern CLSampler clCreateSampler(CLContext context, CLBool normalized_coords, CLAddressingMode addressing_mode, CLFilterMode filter_mode, ref CLError errcode_ret);
Exemplo n.º 4
0
 internal static extern CLError clCreateFromGLBuffer(CLContext context, CLMemFlags flags, int bufobj, ref CLError errcode_ret);
Exemplo n.º 5
0
 internal static extern CLCommandQueue clCreateCommandQueue(CLContext context, CLDeviceID device, CLCommandQueueProperties properties, ref CLError errcode_ret);
Exemplo n.º 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);
Exemplo n.º 7
0
 internal static extern CLMem clCreateBuffer(CLContext context, CLMemFlags flags, SizeT size, IntPtr host_ptr, ref CLError errcode_ret);
Exemplo n.º 8
0
 internal static extern CLError clRetainContext(CLContext context);
Exemplo n.º 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);
Exemplo n.º 10
0
 internal static extern CLError clReleaseContext(CLContext context);
Exemplo n.º 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);
Exemplo n.º 12
0
 internal static extern CLMem clCreateFromGLTexture3D(CLContext context, CLMemFlags flags, int target, int miplevel, uint texture, ref CLError errcode_ret);
Exemplo n.º 13
0
 internal static extern CLError clCreateFromGLRenderbuffer(CLContext context, CLMemFlags flags, int renderbuffer, ref CLError errcode_ret);
Exemplo n.º 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);
Exemplo n.º 15
0
 internal static extern CLError clRetainContext(CLContext context);
Exemplo n.º 16
0
 internal static extern CLError clReleaseContext(CLContext context);
Exemplo n.º 17
0
 internal static extern CLCommandQueue clCreateCommandQueue(CLContext context, CLDeviceID device, CLCommandQueueProperties properties, ref CLError errcode_ret);
Exemplo n.º 18
0
 internal static extern CLMem clCreateBuffer(CLContext context, CLMemFlags flags, SizeT size, IntPtr host_ptr, ref CLError errcode_ret);
Exemplo n.º 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);
Exemplo n.º 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);
Exemplo n.º 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);
Exemplo n.º 22
0
 internal static extern CLProgram clCreateProgramWithSource(CLContext context, int count, [In] string[] strings, [In] SizeT[] lengths, ref CLError errcode_ret);
Exemplo n.º 23
0
 internal static extern CLProgram clCreateProgramWithSource(CLContext context, int count, [In] string[] strings, [In] SizeT[] lengths, ref CLError errcode_ret);
Exemplo n.º 24
0
 private Context(CLContext openclContext, Platforms platforms, Devices devices)
 {
     this.Devices = devices;
     this.Platforms = platforms;
     this.CLContext = openclContext;
 }
Exemplo n.º 25
0
        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();
            }
        }