コード例 #1
0
ファイル: Cl.Types.cs プロジェクト: mhahn0106/openclnet_unity
 public InfoBufferArray(int length)
 {
     _buffers = new IntPtr[length];
     for (int i = 0; i < length; i++)
     {
         _buffers[i] = new InfoBuffer(size).Address;
     }
 }
コード例 #2
0
        public static InfoBuffer GetMemObjectInfo(IMem mem, MemInfo paramName, out ErrorCode error)
        {
            if (paramName == MemInfo.HostPtr) // Handle special case
            {
                IntPtr size   = GetInfo(Cl.GetMemObjectInfo, mem, MemInfo.Size, out error).CastTo <IntPtr>();
                var    buffer = new InfoBuffer(size);
                error = GetMemObjectInfo(mem, paramName, size, buffer, out size);
                if (error != ErrorCode.Success)
                {
                    return(InfoBuffer.Empty);
                }

                return(buffer);
            }

            return(GetInfo(GetMemObjectInfo, mem, paramName, out error));
        }
コード例 #3
0
        internal static InfoBuffer GetInfo <THandle1Type, THandle2Type, TEnumType>(
            GetInfoDelegate <THandle1Type, THandle2Type, TEnumType> method, THandle1Type handle1, THandle2Type handle2, TEnumType name, out ErrorCode error)
        {
            IntPtr paramSize;

            error = method(handle1, handle2, name, IntPtr.Zero, InfoBuffer.Empty, out paramSize);
            // no error checking here because some implementations return InvalidValue even
            // though the paramSize is correctly returned

            var buffer = new InfoBuffer(paramSize);

            error = method(handle1, handle2, name, paramSize, buffer, out paramSize);
            if (error != ErrorCode.Success)
            {
                return(InfoBuffer.Empty);
            }

            return(buffer);
        }
コード例 #4
0
ファイル: Cl.Extensions.cs プロジェクト: PlumpMath/gpudotnet
        internal static InfoBuffer GetInfo <THandle1Type, THandle2Type, TEnumType>(
            GetInfoDelegate <THandle1Type, THandle2Type, TEnumType> method, THandle1Type handle1, THandle2Type handle2, TEnumType name, out ErrorCode error)
        {
            IntPtr paramSize;

            error = method(handle1, handle2, name, IntPtr.Zero, InfoBuffer.Empty, out paramSize);
            if (error != ErrorCode.Success)
            {
                return(InfoBuffer.Empty);
            }

            var buffer = new InfoBuffer(paramSize);

            error = method(handle1, handle2, name, paramSize, buffer, out paramSize);
            if (error != ErrorCode.Success)
            {
                return(InfoBuffer.Empty);
            }

            return(buffer);
        }