internal static void ValidateBuild(CLProgram openclProgram, Device device, CLError error) { if (CLError.None != error) { SizeT bufferSize = SizeT.Zero; OpenCLError.Validate(OpenCLDriver.clGetProgramBuildInfo(openclProgram, device.CLDeviceID, CLProgramBuildInfo.Log, SizeT.Zero, IntPtr.Zero, ref bufferSize)); byte[] buffer = new byte[(Int64)bufferSize]; GCHandle bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned); try { OpenCLError.Validate(OpenCLDriver.clGetProgramBuildInfo(openclProgram, device.CLDeviceID, CLProgramBuildInfo.Log, new SizeT(buffer.LongLength), bufferHandle.AddrOfPinnedObject(), ref bufferSize)); Int32 count = Array.IndexOf<byte>(buffer, 0); throw new OpenCLBuildError(error, System.Text.Encoding.ASCII.GetString(buffer, 0, count < 0 ? buffer.Length : count).Trim()); } finally { bufferHandle.Free(); } } }
internal static extern CLError clCreateKernelsInProgram(CLProgram program, int num_kernels, [Out] CLKernel[] kernels, ref int num_kernels_ret);
internal static extern CLKernel clCreateKernel(CLProgram program, string kernel_name, ref CLError errcode_ret);
internal static extern CLError clBuildProgram(CLProgram program, int num_devices, [In] CLDeviceID[] device_list, string options, NotifyFunction func, IntPtr user_data);
internal static extern CLError clRetainProgram(CLProgram program);
internal static extern CLError clReleaseProgram(CLProgram program);
internal static extern CLError clGetProgramInfo(CLProgram program, CLProgramInfo param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);