Бранимир Караџић 3 anni fa
parent
commit
66de825e6f
1 ha cambiato i file con 14 aggiunte e 13 eliminazioni
  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);