예제 #1
0
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 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
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 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
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 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
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 internal static extern CLError clReleaseContext(CLContext context);
예제 #11
0
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 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
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 internal static extern CLError clRetainContext(CLContext context);
예제 #16
0
 internal static extern CLError clReleaseContext(CLContext context);
예제 #17
0
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 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
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 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
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 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
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 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();
            }
        }