Video: Fix crash when getting the AA modes
DX12 would often crash when starting and stopping the emulation many times, due to the device enumerator failing for some reason. Checking for success fixes it.
This commit is contained in:
parent
44d93048b3
commit
80d12e3e88
|
@ -48,7 +48,10 @@ std::vector<u32> DXContext::GetAAModes(u32 adapter_index)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
ComPtr<IDXGIAdapter> adapter;
|
ComPtr<IDXGIAdapter> adapter;
|
||||||
temp_dxgi_factory->EnumAdapters(adapter_index, &adapter);
|
HRESULT hr = temp_dxgi_factory->EnumAdapters(adapter_index, &adapter);
|
||||||
|
|
||||||
|
if (!SUCCEEDED(hr))
|
||||||
|
return {};
|
||||||
|
|
||||||
PFN_D3D12_CREATE_DEVICE d3d12_create_device;
|
PFN_D3D12_CREATE_DEVICE d3d12_create_device;
|
||||||
if (!temp_lib.Open("d3d12.dll") ||
|
if (!temp_lib.Open("d3d12.dll") ||
|
||||||
|
@ -57,8 +60,7 @@ std::vector<u32> DXContext::GetAAModes(u32 adapter_index)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT hr =
|
hr = d3d12_create_device(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&temp_device));
|
||||||
d3d12_create_device(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&temp_device));
|
|
||||||
if (!SUCCEEDED(hr))
|
if (!SUCCEEDED(hr))
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue