/// <summary> /// Compiles a program’s source for specific device(s) in the OpenCL context associated with program. /// </summary> /// <param name="devices">A pointer to a list of devices associated with program. If device_list is /// a NULL value, the compile is performed for all devices associated with program. If device_list /// is a non-NULL value, the compile is performed for devices specified in this list.</param> /// <param name="inputHeaders">An array of program embedded headers created with /// <see cref="UnsafeNativeMethods.clCreateProgramWithSource"/>.</param> /// <param name="headerNames">An array that has a one to one correspondence with input_headers. /// Each entry in header_include_names specifies the include name used by source in program that comes /// from an embedded header. The corresponding entry in input_headers identifies the program object /// which contains the header source to be used. The embedded headers are first searched before the /// headers in the list of directories specified by the –I compile option (as described in section /// 5.8.4.1). If multiple entries in header_include_names refer to the same header name, the first one /// encountered will be used.</param> public void Compile(Device[] devices, ProgramSafeHandle[] inputHeaders, string[] headerNames) { UnsafeNativeMethods.ClDeviceID[] deviceIDs = null; if (devices != null) deviceIDs = Array.ConvertAll(devices, device => device.ID); UnsafeNativeMethods.CompileProgram(_handle, deviceIDs, "", inputHeaders, headerNames, null, IntPtr.Zero); }
/// <summary> /// Compiles a program’s source for all the devices. /// </summary> public void Compile() { ProgramSafeHandle[] inputHeaders = new ProgramSafeHandle[0]; string[] headerNames = new string[0]; UnsafeNativeMethods.CompileProgram(_handle, null, "", inputHeaders, headerNames, null, IntPtr.Zero); }
/// <summary> /// Compiles a program’s source for all the devices. /// </summary> /// <param name="inputHeaders">An array of program embedded headers created with /// <see cref="UnsafeNativeMethods.clCreateProgramWithSource"/>.</param> /// <param name="headerNames">An array that has a one to one correspondence with input_headers. /// Each entry in header_include_names specifies the include name used by source in program that comes /// from an embedded header. The corresponding entry in input_headers identifies the program object /// which contains the header source to be used. The embedded headers are first searched before the /// headers in the list of directories specified by the –I compile option (as described in section /// 5.8.4.1). If multiple entries in header_include_names refer to the same header name, the first one /// encountered will be used.</param> public void Compile(ProgramSafeHandle[] inputHeaders, string[] headerNames) { UnsafeNativeMethods.CompileProgram(_handle, null, "", inputHeaders, headerNames, null, IntPtr.Zero); }