mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Prefer high performance GPUs in laptops with DX12 #746
This commit is contained in:
parent
8c9f79b28f
commit
75e6fe2a27
2 changed files with 13 additions and 1 deletions
|
@ -28,6 +28,7 @@
|
|||
|
||||
#if USE_DX11 || USE_DX12
|
||||
#include <DXGI.h>
|
||||
#include <dxgi1_6.h>
|
||||
#endif
|
||||
|
||||
#if USE_DX11
|
||||
|
|
|
@ -121,11 +121,22 @@ static RefCountPtr<IDXGIAdapter> FindAdapter( const std::wstring& targetName )
|
|||
return targetAdapter;
|
||||
}
|
||||
|
||||
RefCountPtr<IDXGIFactory6> DXGIFactory6;
|
||||
|
||||
unsigned int adapterNo = 0;
|
||||
while( SUCCEEDED( hres ) )
|
||||
{
|
||||
RefCountPtr<IDXGIAdapter> pAdapter;
|
||||
hres = DXGIFactory->EnumAdapters( adapterNo, &pAdapter );
|
||||
|
||||
// Try to use EnumAdapterByGpuPreference method to get the better performing GPU.
|
||||
if( S_OK == DXGIFactory->QueryInterface( IID_PPV_ARGS( &DXGIFactory6 ) ) )
|
||||
{
|
||||
hres = DXGIFactory6->EnumAdapterByGpuPreference( adapterNo, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS( &pAdapter ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
hres = DXGIFactory->EnumAdapters( adapterNo, &pAdapter );
|
||||
}
|
||||
|
||||
if( SUCCEEDED( hres ) )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue