예제 #1
0
파일: Device.cs 프로젝트: lu4/ManOCL
        private static String GetDeviceInfoString(Device device, CLDeviceInfo deviceInfo)
        {
            byte[] buffer = GetDeviceInfoBuffer(device, deviceInfo);

            Int32 count = Array.IndexOf <byte>(buffer, 0);

            return(System.Text.ASCIIEncoding.ASCII.GetString(buffer, 0, count < 0 ? buffer.Length : count).Trim());
        }
예제 #2
0
파일: Device.cs 프로젝트: lu4/ManOCL
        private static Byte[] GetDeviceInfoBuffer(Device device, CLDeviceInfo deviceInfo)
        {
            SizeT bufferSize = SizeT.Zero;

            OpenCLError.Validate(OpenCLDriver.clGetDeviceInfo(device.CLDeviceID, deviceInfo, SizeT.Zero, IntPtr.Zero, ref bufferSize));

            Byte[] buffer = new Byte[(Int64)bufferSize];

            OpenCLError.Validate(OpenCLDriver.clGetDeviceInfo(device.CLDeviceID, deviceInfo, bufferSize, buffer, ref bufferSize));

            return(buffer);
        }
예제 #3
0
파일: Device.cs 프로젝트: lu4/ManOCL
        private static T GetDeviceInfo <T>(Device device, CLDeviceInfo deviceInfo) where T : struct
        {
            Byte[] buffer = GetDeviceInfoBuffer(device, deviceInfo);

            GCHandle bufferHandle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            try
            {
                return((T)Marshal.PtrToStructure(bufferHandle.AddrOfPinnedObject(), typeof(T)));
            }
            finally
            {
                bufferHandle.Free();
            }
        }
예제 #4
0
 public static extern CLError clGetDeviceInfo(
     CLDeviceID device,
     CLDeviceInfo param_name,
     SizeT param_value_size,
     IntPtr param_value,
     ref SizeT param_value_size_ret);
예제 #5
0
 internal static extern CLError clGetDeviceInfo(CLDeviceID device, CLDeviceInfo param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);
예제 #6
0
 internal static extern CLError clGetDeviceInfo(CLDeviceID device, CLDeviceInfo param_name, SizeT param_value_size, [Out] CLPlatformID[] param_value, ref SizeT param_value_size_ret);
예제 #7
0
파일: OpenCLDriver.cs 프로젝트: lu4/ManOCL
 internal static extern CLError clGetDeviceInfo(CLDeviceID device, CLDeviceInfo param_name, SizeT param_value_size, [Out] byte[] param_value, ref SizeT param_value_size_ret);