From bc0faf9a3cee317173849523c132800d13790243 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 3 Nov 2016 07:03:02 -0700 Subject: [PATCH] libobs-d3d11: Clear device state before unloading Unloads all device data and clears all device references. Probably not necessary, but it's unknown how D3D11 handles this internally so probably best to be safe. --- libobs-d3d11/d3d11-subsystem.cpp | 5 +++++ libobs-d3d11/d3d11-subsystem.hpp | 1 + 2 files changed, 6 insertions(+) diff --git a/libobs-d3d11/d3d11-subsystem.cpp b/libobs-d3d11/d3d11-subsystem.cpp index 048d3fd5c..c3b936c6f 100644 --- a/libobs-d3d11/d3d11-subsystem.cpp +++ b/libobs-d3d11/d3d11-subsystem.cpp @@ -440,6 +440,11 @@ gs_device::gs_device(uint32_t adapterIdx) device_set_render_target(this, NULL, NULL); } +gs_device::~gs_device() +{ + context->ClearState(); +} + const char *device_get_name(void) { return "Direct3D 11"; diff --git a/libobs-d3d11/d3d11-subsystem.hpp b/libobs-d3d11/d3d11-subsystem.hpp index ac190d273..df62d6370 100644 --- a/libobs-d3d11/d3d11-subsystem.hpp +++ b/libobs-d3d11/d3d11-subsystem.hpp @@ -679,4 +679,5 @@ struct gs_device { void UpdateViewProjMatrix(); gs_device(uint32_t adapterIdx); + ~gs_device(); };