Skip to content

Commit

Permalink
Makes NVidia Card Default in Ambient Occlusion example. (#740)
Browse files Browse the repository at this point in the history
Fixes the selection of iGPU before dGPU for this sample
  • Loading branch information
BrennerLittle authored Sep 29, 2021
1 parent 05c6b64 commit 7bf2e12
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,15 @@ void DeviceResources::InitializeAdapter(IDXGIAdapter1** ppAdapter)
*ppAdapter = nullptr;

ComPtr<IDXGIAdapter1> adapter;
for (UINT adapterID = 0; DXGI_ERROR_NOT_FOUND != m_dxgiFactory->EnumAdapters1(adapterID, &adapter); ++adapterID)
ComPtr<IDXGIFactory6> factory6;
HRESULT hr = m_dxgiFactory.As(&factory6);
if (FAILED(hr))
{
throw exception("DXGI 1.6 not supported");
}
for (UINT adapterID = 0; DXGI_ERROR_NOT_FOUND != factory6->EnumAdapterByGpuPreference(adapterID, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&adapter)); ++adapterID)
{

if (m_adapterIDoverride != UINT_MAX && adapterID != m_adapterIDoverride)
{
continue;
Expand Down Expand Up @@ -694,4 +701,4 @@ void DeviceResources::InitializeAdapter(IDXGIAdapter1** ppAdapter)
}

*ppAdapter = adapter.Detach();
}
}

0 comments on commit 7bf2e12

Please sign in to comment.