예제 #1
0
 static AdlHelper()
 {
     try {
         int numberOfAdapters = 0;
         var adlStatus        = AdlNativeMethods.ADLMainControlCreate(out _context);
         if (adlStatus >= AdlStatus.ADL_OK)
         {
             adlStatus = AdlNativeMethods.ADL_Adapter_NumberOfAdapters_Get(ref numberOfAdapters);
             if (adlStatus < AdlStatus.ADL_OK)
             {
                 NTMinerConsole.DevError(() => $"{nameof(AdlNativeMethods.ADL_Adapter_NumberOfAdapters_Get)} {adlStatus.ToString()}");
             }
         }
         if (numberOfAdapters > 0)
         {
             _adapterInfoes = new ADLAdapterInfo[numberOfAdapters];
             adlStatus      = AdlNativeMethods.ADLAdapterAdapterInfoGet(_adapterInfoes);
             if (adlStatus >= AdlStatus.ADL_OK && _adapterInfoes != null && _adapterInfoes.Length != 0)
             {
                 _adapterInfoes = _adapterInfoes.Where(adapterInfo => !string.IsNullOrEmpty(adapterInfo.UDID) && adapterInfo.VendorID == AdlConst.ATI_VENDOR_ID).ToArray();
                 _isHasATIGpu   = _adapterInfoes.Length > 0;
             }
         }
     }
     catch (Exception ex) {
         Logger.ErrorDebugLine(ex);
     }
 }