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()
{
IUnknown.ReleaseAndNull!(ref Device);
IUnknown.ReleaseAndNull!(ref ImmediateContext);
Device?.Release();
Device = null;
ImmediateContext?.Release();
ImmediateContext = null;
Log.EngineLogger.Trace("Creating D3D11 Device and Context...");
@@ -123,13 +126,20 @@ namespace GlitchyEngine.Platform.DX11
public static void Shutdown()
{
IUnknown.ReleaseAndNull!(ref Device);
IUnknown.ReleaseAndNull!(ref ImmediateContext);
Device?.Release();
Device = null;
IUnknown.ReleaseAndNull!(ref DxgiDevice);
IUnknown.ReleaseAndNull!(ref SwapChain);
ImmediateContext?.Release();
ImmediateContext = null;
DxgiDevice?.Release();
DxgiDevice = null;
IUnknown.ReleaseAndNull!(ref BackBufferTarget);
SwapChain?.Release();
SwapChain = null;
BackBufferTarget?.Release();
BackBufferTarget = null;
}
public static void Present()