Fixed com interface releasing and nullification

This commit is contained in:
Simon Lübeß
2020-11-17 12:56:13 +01:00
parent a3eb2b08ba
commit dbecf7cdb1
+17 -7
View File
@@ -40,8 +40,11 @@ namespace GlitchyEngine.Platform.DX11
*/ */
static void InitDevice() static void InitDevice()
{ {
IUnknown.ReleaseAndNull!(ref Device); Device?.Release();
IUnknown.ReleaseAndNull!(ref ImmediateContext); Device = null;
ImmediateContext?.Release();
ImmediateContext = null;
Log.EngineLogger.Trace("Creating D3D11 Device and Context..."); Log.EngineLogger.Trace("Creating D3D11 Device and Context...");
@@ -123,13 +126,20 @@ namespace GlitchyEngine.Platform.DX11
public static void Shutdown() public static void Shutdown()
{ {
IUnknown.ReleaseAndNull!(ref Device); Device?.Release();
IUnknown.ReleaseAndNull!(ref ImmediateContext); Device = null;
IUnknown.ReleaseAndNull!(ref DxgiDevice); ImmediateContext?.Release();
IUnknown.ReleaseAndNull!(ref SwapChain); ImmediateContext = null;
DxgiDevice?.Release();
DxgiDevice = null;
IUnknown.ReleaseAndNull!(ref BackBufferTarget); SwapChain?.Release();
SwapChain = null;
BackBufferTarget?.Release();
BackBufferTarget = null;
} }
public static void Present() public static void Present()