Exemplo n.º 1
0
Arquivo: Device.cs Projeto: 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());
        }
Exemplo n.º 2
0
Arquivo: Device.cs Projeto: 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);
        }
Exemplo n.º 3
0
Arquivo: Device.cs Projeto: 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();
            }
        }
Exemplo n.º 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);
Exemplo n.º 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);
Exemplo n.º 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);
Exemplo n.º 7
0
 internal static extern CLError clGetDeviceInfo(CLDeviceID device, CLDeviceInfo param_name, SizeT param_value_size, [Out] byte[] param_value, ref SizeT param_value_size_ret);