Fixed compatibility with older AMD/ATI cards when calling ADL2_Adapter_FrameMetrics_Caps (#535)
This commit is contained in:
@@ -131,7 +131,7 @@ namespace LibreHardwareMonitor.Hardware.Gpu
|
||||
int enabled = 0;
|
||||
int version = 0;
|
||||
|
||||
if (AtiAdlxx.ADL2_Adapter_FrameMetrics_Caps(_context, _adapterIndex, ref supported) == AtiAdlxx.ADLStatus.ADL_OK)
|
||||
if (AtiAdlxx.ADL_Method_Exists("ADL2_Adapter_FrameMetrics_Caps") && AtiAdlxx.ADL2_Adapter_FrameMetrics_Caps(_context, _adapterIndex, ref supported) == AtiAdlxx.ADLStatus.ADL_OK)
|
||||
{
|
||||
if (supported == AtiAdlxx.ADL_TRUE && AtiAdlxx.ADL2_Adapter_FrameMetrics_Start(_context, _adapterIndex, 0) == AtiAdlxx.ADLStatus.ADL_OK)
|
||||
{
|
||||
|
||||
@@ -130,7 +130,19 @@ namespace LibreHardwareMonitor.Interop
|
||||
public static extern ADLStatus ADL2_Adapter_FrameMetrics_Start(IntPtr context, int adapterIndex, int displayIndex);
|
||||
|
||||
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern ADLStatus ADL2_Adapter_FrameMetrics_Stop(IntPtr context, int adapterIndex, int displayIndex);
|
||||
public static extern ADLStatus ADL2_Adapter_FrameMetrics_Stop(IntPtr context, int adapterIndex, int displayIndex);
|
||||
|
||||
public static bool ADL_Method_Exists(string ADL_Method)
|
||||
{
|
||||
IntPtr module = Kernel32.LoadLibrary(DllName);
|
||||
if (module != IntPtr.Zero)
|
||||
{
|
||||
bool result = Kernel32.GetProcAddress(module, ADL_Method) != IntPtr.Zero;
|
||||
Kernel32.FreeLibrary(module);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ADLStatus ADL_Main_Control_Create(int enumConnectedAdapters)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user