浏览代码

Fixed issue #2982.

Бранимир Караџић 3 年之前
父节点
当前提交
66de825e6f
共有 1 个文件被更改,包括 14 次插入13 次删除
  1. 14 13
      src/renderer_d3d11.cpp

+ 14 - 13
src/renderer_d3d11.cpp

@@ -883,7 +883,20 @@ namespace bgfx { namespace d3d11
 
 			errorState = ErrorState::LoadedDXGI;
 
-			if (NULL == m_device)
+			if (NULL != m_device)
+			{
+				m_device->AddRef();
+				m_device->GetImmediateContext(&m_deviceCtx);
+
+				if (NULL == m_deviceCtx)
+				{
+					BX_TRACE("Init error: Unable to retrieve Direct3D11 ImmediateContext.");
+					goto error;
+				}
+
+				m_featureLevel = m_device->GetFeatureLevel();
+			}
+			else
 			{
 				if (NULL != m_renderDocDll)
 				{
@@ -964,18 +977,6 @@ namespace bgfx { namespace d3d11
 					goto error;
 				}
 			}
-			else
-			{
-				m_device->GetImmediateContext(&m_deviceCtx);
-
-				if (NULL == m_deviceCtx)
-				{
-					BX_TRACE("Init error: Unable to retrieve Direct3D11 ImmediateContext.");
-					goto error;
-				}
-
-				m_featureLevel = m_device->GetFeatureLevel();
-			}
 
 			m_dxgi.update(m_device);