0 Replies Latest reply on Feb 11, 2017 2:39 AM by fleuve

    ADL SDK with DirectX11 UWP.

    fleuve

      Hello.

       

      I've develop an engine with Visual Studio 2017, DirectX on C++ UWP. I'm targeting PC/Surface pro and Surface RT (ARM). All begin when i decide to put Video card summary inside my engine. Then I begin by programming my class inside a console application. Using LoadLibrary and GetProcAddress on atiadlxx.dll and connecting to

      • ADL_Main_Control_Create
      • ADL_Adapter_AdapterInfo_Get
      • ADL_Adapter_MemoryInfo_Get
      • ADL_Main_Control_Destroy
      • ADL_Adapter_NumberOfAdapters_Get
      • ADL_Adapter_ID_Get
      • ADL_Adapter_Active_Get
      • ADL_Overdrive5_CurrentActivity_Get
      • ADL_Overdrive5_Temperature_Get
      • ADL_Overdrive5_FanSpeed_Get

      I'm getting Video card name, Memory size, Memory Type, Temperature, Fan RPM, Fan Percent and GPU Usage. Look great for the moment, no require admin right and working on surface pro. With this code :

      hDLL = LoadLibrary(L"atiadlxx.dll");
          if (hDLL == NULL)
              hDLL = LoadLibrary(L"atiadlxy.dll");
      
          /*if (hDLL != NULL)*/
          {
      ...
      

      It's returning Empty video card list if DLL not exist.

       

      Good, It's time to integrate class inside UWP Engine. After, integrate everything inside UWP, I face LoadLibrary problem. This one was undefined UWP, you must refer to LoadPackageLibrary that's seem to not work and give UWP failed certification. Cause of DLL calling was not Windows Store Certified. Then I decide to make a test.

       

      • I've create a atiadlxx.def file.
      EXPORTS
      ADL_Main_Control_Create
      ADL_Adapter_AdapterInfo_Get
      ADL_Adapter_MemoryInfo_Get
      ADL_Main_Control_Destroy
      ADL_Adapter_NumberOfAdapters_Get
      ADL_Adapter_ID_Get
      ADL_Adapter_Active_Get
      ADL_Overdrive5_CurrentActivity_Get
      ADL_Overdrive5_Temperature_Get
      ADL_Overdrive5_FanSpeed_Get
      • After I've create lib file for every version
      lib /def:"atiadlxx.def" /OUT:"x86\atiadlxx.lib" /machine:x86
      lib
      /def:"atiadlxx.def" /OUT:"x64\atiadlxx.lib" /machine:x64
      lib
      /def:"atiadlxx.def" /OUT:"ARM\atiadlxx.lib" /machine:ARM
      • Rebuild the Atiadlxx.h
      #if (_M_ARM) 
       #pragma comment(lib, "arm\\atiadlxx.lib")
      #else
      #if (_WIN64) 
       #pragma comment(lib, "x64\\atiadlxx.lib")
      #else
       #pragma comment(lib, "x86\\atiadlxx.lib")
      #endif
      #endif
      
      typedef void* (__stdcall *ADL_MAIN_MALLOC_CALLBACK)(int size);
      EXTERN_C int ADL_Main_Control_Create(ADL_MAIN_MALLOC_CALLBACK callback, int enumConnectedAdapters);
      EXTERN_C int ADL_Adapter_AdapterInfo_Get(void* info, int size);
      EXTERN_C int ADL_Adapter_MemoryInfo_Get(int adapterIndex, ADLMemoryInfo* MemoryInfo);
      EXTERN_C int ADL_Main_Control_Destroy();
      EXTERN_C int ADL_Adapter_NumberOfAdapters_Get(int* numAdapters);
      EXTERN_C int ADL_Adapter_ID_Get(int adapterIndex, int* adapterID);
      EXTERN_C int ADL_Adapter_Active_Get(int adapterIndex, int* status);
      EXTERN_C int ADL_Overdrive5_CurrentActivity_Get(int iAdapterIndex, ADLPMActivity* activity);
      EXTERN_C int ADL_Overdrive5_Temperature_Get(int adapterIndex, int thermalControllerIndex, ADLTemperature* temperature);
      EXTERN_C int ADL_Overdrive5_FanSpeed_Get(int adapterIndex, int thermalControllerIndex, ADLFanSpeedValue* fanSpeedValue);

      Now it's working on UWP without register your dll inside your application manifest and without copy it inside your program folder. The problem with EXTERN_C it's that's only work on computer with AMD Video card installed and because surface pro was running on intel video card It's not returning empty video card list, but pop a message dialog that dll missing and halt program.

       

      EmptyTexture-Clear.jpgStat.jpg

      Another problem it's the generated lib file still pointing to dll, instead obj. Then the lib file was not really static. I know that the question was respond 3-4 year ago, but there is anyway to get or generated static lib version or pass-through dll missing program and continue running with Empty video card on intel.

       

      Note:

      LoadLibrary was not defined in UWP

      LoadPackageLibrary not work and require dll inside your sanddbox and fail certification rule.

      Generated Lib work, but fail certification rule due Library point to DLL and crash if DLL missing (or video drivers missing)

      GetProcAddress was defined inside UWP, but not tested.

       

      Any idea?

      Any intention to made light version for video summary (static/light and uwp compatible)?

      Thanks