Also free when initialization fails, and move to end

This commit is contained in:
Pokechu22 2019-05-26 19:59:29 -07:00
parent 19fb3bb4fe
commit 69d9d9f87a

View File

@ -111,7 +111,9 @@ bool Create(u32 adapter_index, bool enable_debug_layer)
{ {
PanicAlertT( PanicAlertT(
"Failed to initialize Direct3D.\nMake sure your video card supports at least D3D 10.0"); "Failed to initialize Direct3D.\nMake sure your video card supports at least D3D 10.0");
dxgi_factory.Reset();
D3DCommon::UnloadLibraries(); D3DCommon::UnloadLibraries();
s_d3d11_library.Close();
return false; return false;
} }
@ -133,7 +135,6 @@ void Destroy()
context->ClearState(); context->ClearState();
context->Flush(); context->Flush();
dxgi_factory.Reset();
context.Reset(); context.Reset();
device1.Reset(); device1.Reset();
@ -156,6 +157,7 @@ void Destroy()
else else
NOTICE_LOG(VIDEO, "Successfully released all device references!"); NOTICE_LOG(VIDEO, "Successfully released all device references!");
dxgi_factory.Reset();
D3DCommon::UnloadLibraries(); D3DCommon::UnloadLibraries();
s_d3d11_library.Close(); s_d3d11_library.Close();
} }