public InfoBufferArray(int length) { _buffers = new IntPtr[length]; for (int i = 0; i < length; i++) { _buffers[i] = new InfoBuffer(size).Address; } }
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)); }
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); }
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); }